From fed005abd793fb730b5419a95d14263b798d970d Mon Sep 17 00:00:00 2001 From: vahidrezanezhad Date: Sat, 28 Feb 2026 09:01:06 +0100 Subject: [PATCH] Fix a bug by saving model weights in steps --- src/eynollah/training/train.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/eynollah/training/train.py b/src/eynollah/training/train.py index 11ecc8c..f75be96 100644 --- a/src/eynollah/training/train.py +++ b/src/eynollah/training/train.py @@ -58,6 +58,7 @@ class SaveWeightsAfterSteps(Callback): self.save_path = save_path self.step_count = 0 self._config = _config + self.characters_cnnrnn_ocr = characters_cnnrnn_ocr def on_train_batch_end(self, batch, logs=None): self.step_count += 1 @@ -68,8 +69,8 @@ class SaveWeightsAfterSteps(Callback): self.model.save(save_file) - if characters_cnnrnn_ocr: - os.system("cp "+characters_cnnrnn_ocr+" "+os.path.join(os.path.join(self.save_path, f"model_step_{self.step_count}"),"characters_org.txt")) + if self.characters_cnnrnn_ocr: + os.system("cp "+self.characters_cnnrnn_ocr+" "+os.path.join(os.path.join(self.save_path, f"model_step_{self.step_count}"),"characters_org.txt")) with open(os.path.join(os.path.join(self.save_path, f"model_step_{self.step_count}"),"config_eynollah.json"), "w") as fp: json.dump(self._config, fp) # encode dict into JSON