From b3678234fe0ee923b2388fc032f54b638e2ea595 Mon Sep 17 00:00:00 2001 From: gaotingquan Date: Tue, 16 May 2023 08:26:39 +0000 Subject: [PATCH] fix bug when update_freq > iter_per_epoch --- ppcls/engine/engine.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ppcls/engine/engine.py b/ppcls/engine/engine.py index 378d241b..e468b29a 100755 --- a/ppcls/engine/engine.py +++ b/ppcls/engine/engine.py @@ -141,6 +141,11 @@ class Engine(object): # set max iteration per epoch mannualy, when training by iteration(s), such as XBM, FixMatch. self.iter_per_epoch = self.config["Global"].get( "iter_per_epoch") + if self.iter_per_epoch < self.update_freq: + logger.warning( + "The arg Global.update_freq greater than iter_per_epoch and has been set to 1. This may be caused by too few of batches." + ) + self.update_freq = 1 self.iter_per_epoch = self.iter_per_epoch // self.update_freq * self.update_freq if self.mode == "eval" or (self.mode == "train" and -- GitLab