From 36a8897f1b39cfeeb9e627e722dfad34c98cd5f5 Mon Sep 17 00:00:00 2001 From: Charlie Meyers Date: Wed, 29 Nov 2023 13:18:22 +0000 Subject: [PATCH 1/2] fix time bug --- deckard/base/model/model.py | 16 ++++++++-------- deckard/layers/README.md | 4 ++++ test/layers/test_exp.py | 0 3 files changed, 12 insertions(+), 8 deletions(-) delete mode 100644 test/layers/test_exp.py diff --git a/deckard/base/model/model.py b/deckard/base/model/model.py index bd69bc4a..943f3723 100644 --- a/deckard/base/model/model.py +++ b/deckard/base/model/model.py @@ -190,8 +190,8 @@ def __call__(self, data: list, model: object, library=None): else: raise e time_dict = { - "train_time": (start - end) / 1e9, - "train_time_per_sample": end / (len(data[0]) * 1e9), + "train_time": (end - start) / 1e9, + "train_time_per_sample": (end - start) / (len(data[0]) * 1e9), "train_time_start": start, "train_time_end": end, "train_device": device, @@ -573,8 +573,8 @@ def predict(self, data=None, model=None, predictions_file=None): return ( predictions, { - "predict_time": (start - end) / 1e9, - "predict_time_per_sample": start - end / (len(data[0]) * 1e9), + "predict_time": (end - start) / 1e9, + "predict_time_per_sample": (end - start) / (len(data[0]) * 1e9), "predict_start_time": start, "predict_stop_time": end, "predict_device": device, @@ -623,8 +623,8 @@ def predict_proba(self, data=None, model=None, probabilities_file=None): return ( predictions, { - "predict_proba_time": (start - end) / 1e9, - "predict_proba_time_per_sample": end / (len(data[0]) * 1e9), + "predict_proba_time": (end - start) / 1e9, + "predict_proba_time_per_sample": (end - start) / (len(data[0]) * 1e9), "predict_proba_start_time": start, "predict_proba_stop_time": end, "predict_proba_device": device, @@ -680,8 +680,8 @@ def predict_log_loss(self, data, model, losses_file=None): return ( predictions, { - "predict_log_proba_time": (start - end) / 1e9, - "predict_log_proba_time_per_sample": end / (len(data[0]) * 1e9), + "predict_log_proba_time": (end - start) / 1e9, + "predict_log_proba_time_per_sample": (end - start) / (len(data[0]) * 1e9), "predict_log_proba_start_time": start, "predict_log_proba_stop_time": end, "predict_log_device": device, diff --git a/deckard/layers/README.md b/deckard/layers/README.md index ba0e0dea..774c6707 100644 --- a/deckard/layers/README.md +++ b/deckard/layers/README.md @@ -11,4 +11,8 @@ ├── parse.py: Dumps the hydra configuration folder to `params.yaml` as specified by the `defaults` list in the hydra configuration file. ├── template.html: Draft webpage for each experiment (work in progress) ├── utils.py: Handy utilities for the other scripts +├── afr.py: For building accelerated failure rate models +├── plots.py: For generating plots using seaborn └── watcher.py: Watches a file, transforms the data, and moves it somewhere else via parallelized scp (work in progress). + + diff --git a/test/layers/test_exp.py b/test/layers/test_exp.py deleted file mode 100644 index e69de29b..00000000 From 172337939d5713dd4872e6e756b56a9887e6ba3c Mon Sep 17 00:00:00 2001 From: Charlie Meyers Date: Wed, 29 Nov 2023 13:27:28 +0000 Subject: [PATCH 2/2] linting --- deckard/base/model/model.py | 7 ++++--- deckard/layers/README.md | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/deckard/base/model/model.py b/deckard/base/model/model.py index 22385897..d335ef60 100644 --- a/deckard/base/model/model.py +++ b/deckard/base/model/model.py @@ -203,7 +203,7 @@ def __call__(self, data: list, model: object, library=None): raise e time_dict = { "train_time": (end - start) / 1e9, - "train_time_per_sample": (end - start) / (len(data[0]) * 1e9), + "train_time_per_sample": (end - start) / (len(data[0]) * 1e9), "train_start_time": start_timestamp, "train_end_time": end_timestamp, "train_device": device, @@ -644,7 +644,7 @@ def predict_proba(self, data=None, model=None, probabilities_file=None): predictions, { "predict_proba_time": (end - start) / 1e9, - "predict_proba_time_per_sample": (end - start) / (len(data[0]) * 1e9), + "predict_proba_time_per_sample": (end - start) / (len(data[0]) * 1e9), "predict_proba_start_time": start_timestamp, "predict_proba_stop_time": end_timestamp, "predict_proba_device": device, @@ -707,7 +707,8 @@ def predict_log_loss(self, data, model, losses_file=None): predictions, { "predict_log_proba_time": (end - start) / 1e9, - "predict_log_proba_time_per_sample": (end - start) / (len(data[0]) * 1e9), + "predict_log_proba_time_per_sample": (end - start) + / (len(data[0]) * 1e9), "predict_log_proba_start_time": start_timestamp, "predict_log_proba_stop_time": end_timestamp, "predict_log_device": device, diff --git a/deckard/layers/README.md b/deckard/layers/README.md index 774c6707..2e8a75a1 100644 --- a/deckard/layers/README.md +++ b/deckard/layers/README.md @@ -14,5 +14,3 @@ ├── afr.py: For building accelerated failure rate models ├── plots.py: For generating plots using seaborn └── watcher.py: Watches a file, transforms the data, and moves it somewhere else via parallelized scp (work in progress). - -