Skip to content
Snippets Groups Projects
Commit 42ecd142 authored by lukas leufen's avatar lukas leufen
Browse files

save best model after training in data store

parent 3d6d32a5
No related branches found
No related tags found
2 merge requests!24include recent development,!23Lukas issue018 feat evaluate train val
...@@ -93,6 +93,7 @@ class Training(RunEnvironment): ...@@ -93,6 +93,7 @@ class Training(RunEnvironment):
model_name = os.path.join(path, name) model_name = os.path.join(path, name)
logging.debug(f"save best model to {model_name}") logging.debug(f"save best model to {model_name}")
self.model.save(model_name) self.model.save(model_name)
self.data_store.put("best_model", self.model, "general")
def load_best_model(self, name: str) -> None: def load_best_model(self, name: str) -> None:
""" """
...@@ -119,6 +120,3 @@ class Training(RunEnvironment): ...@@ -119,6 +120,3 @@ class Training(RunEnvironment):
json.dump(history.history, f) json.dump(history.history, f)
with open(os.path.join(path, "history_lr.json"), "w") as f: with open(os.path.join(path, "history_lr.json"), "w") as f:
json.dump(self.lr_sc.lr, f) json.dump(self.lr_sc.lr, f)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment