Skip to content

Commit f2b2fad

Browse files
committed
fix: training history is now correctly built taking into account past training processes
1 parent 0c18671 commit f2b2fad

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ergo/project.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,17 @@ def train(self, gpus):
224224
log.info("training with %d GPUs", gpus)
225225
to_train = multi_gpu_model(self.model, gpus=gpus)
226226

227-
self.history = self.logic.trainer(to_train, self.dataset).history
228-
self.accu = self.accuracy()
227+
past = self.history.copy() if self.history is not None else None
228+
present = self.logic.trainer(to_train, self.dataset).history
229+
230+
if past is None:
231+
self.history = present
232+
else:
233+
self.history = {}
234+
for name, past_values in past.items():
235+
self.history[name] = past_values + present[name]
236+
237+
self.accu = self.accuracy()
229238

230239
print("")
231240
self._emit_txt_stats(sys.stdout)

0 commit comments

Comments
 (0)