Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed train time bug #151

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions deckard/base/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __call__(self, data: list, model: object, library=None):
start = process_time_ns()
start_timestamp = time()
model.fit(data[0], data[2], **trainer)
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
except np.AxisError: # pragma: no cover
from art.utils import to_categorical
Expand All @@ -139,7 +139,7 @@ def __call__(self, data: list, model: object, library=None):
start = process_time_ns()
start_timestamp = time()
model.fit(data[0], data[2], **trainer)
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
except ValueError as e: # pragma: no cover
if "Shape of labels" in str(e):
Expand All @@ -150,7 +150,7 @@ def __call__(self, data: list, model: object, library=None):
start = process_time_ns()
start_timestamp = time()
model.fit(data[0], data[2], **trainer)
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
else:
raise e
Expand All @@ -162,7 +162,7 @@ def __call__(self, data: list, model: object, library=None):
start = process_time_ns()
start_timestamp = time()
model.fit(data[0], data[2], **trainer)
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
except Exception as e:
raise e
Expand All @@ -174,7 +174,7 @@ def __call__(self, data: list, model: object, library=None):
start = process_time_ns()
start_timestamp = time()
model.fit(data[0], data[2], **trainer)
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
elif "should be the same" in str(e).lower():
import torch
Expand All @@ -194,7 +194,7 @@ def __call__(self, data: list, model: object, library=None):
start = process_time_ns()
start_timestamp = time()
model.fit(data[0], data[2], **trainer)
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
else:
raise e
Expand Down Expand Up @@ -561,7 +561,7 @@ def predict(self, data=None, model=None, predictions_file=None):
start = process_time_ns()
start_timestamp = time()
predictions = model.predict(data[1])
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
except NotFittedError as e: # pragma: no cover
logger.warning(e)
Expand All @@ -579,7 +579,7 @@ def predict(self, data=None, model=None, predictions_file=None):
except Exception as e: # pragma: no cover
logger.error(e)
raise e
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
if predictions_file is not None:
self.data.save(predictions, predictions_file)
Expand Down Expand Up @@ -627,13 +627,13 @@ def predict_proba(self, data=None, model=None, probabilities_file=None):
start = process_time_ns()
start_timestamp = time()
predictions = model.predict_proba(data[1])
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
else:
start = process_time_ns()
start_timestamp = time()
predictions = model.predict(data[1])
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
if probabilities_file is not None:
self.data.save(predictions, probabilities_file)
Expand Down Expand Up @@ -680,19 +680,19 @@ def predict_log_loss(self, data, model, losses_file=None):
start = process_time_ns()
start_timestamp = time()
predictions = model.predict_log_proba(data[1])
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
elif hasattr(model, "predict_proba"):
start = process_time_ns()
start_timestamp = time()
predictions = model.predict_proba(data[1])
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
elif hasattr(model, "predict"):
start = process_time_ns()
start_timestamp = time()
predictions = model.predict(data[1])
end = process_time_ns() - start
end = process_time_ns()
end_timestamp = time()
else: # pragma: no cover
raise ValueError(
Expand Down
Loading