From 91f0f30a7889db781b614585ba27160fd7600908 Mon Sep 17 00:00:00 2001 From: iperov Date: Mon, 11 Oct 2021 15:02:41 +0400 Subject: [PATCH] fix save in trainer --- mainscripts/Trainer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mainscripts/Trainer.py b/mainscripts/Trainer.py index 5cc8acf..df74ca3 100644 --- a/mainscripts/Trainer.py +++ b/mainscripts/Trainer.py @@ -163,9 +163,13 @@ def trainerThread (s2c, c2s, e, model_save() is_reached_goal = True io.log_info ('You can use preview now.') - - if not is_reached_goal and (time.time() - last_save_time) >= save_interval_min*60: + + need_save = False + while time.time() - last_save_time >= save_interval_min*60: last_save_time += save_interval_min*60 + need_save = True + + if not is_reached_goal and need_save: model_save() send_preview()