From fcb5e0643e64b7ba2e08192f5d2730ed9be42558 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 30 May 2022 12:42:12 +0200 Subject: [PATCH] Simplify and fix `--save-period` epoch 0 (#8042) Simplify and update `--save-period` epoch 0 --- train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train.py b/train.py index 5552b77f1a40..a06ad5a418f8 100644 --- a/train.py +++ b/train.py @@ -423,7 +423,7 @@ def train(hyp, opt, device, callbacks): # hyp is path/to/hyp.yaml or hyp dictio torch.save(ckpt, last) if best_fitness == fi: torch.save(ckpt, best) - if (epoch > 0) and (opt.save_period > 0) and (epoch % opt.save_period == 0): + if opt.save_period > 0 and epoch % opt.save_period == 0: torch.save(ckpt, w / f'epoch{epoch}.pt') del ckpt callbacks.run('on_model_save', last, epoch, final_epoch, best_fitness, fi)