Simplify and fix `--save-period` epoch 0 (#8042)
Browse files
train.py
CHANGED
@@ -423,7 +423,7 @@ def train(hyp, opt, device, callbacks): # hyp is path/to/hyp.yaml or hyp dictio
|
|
423 |
torch.save(ckpt, last)
|
424 |
if best_fitness == fi:
|
425 |
torch.save(ckpt, best)
|
426 |
-
if
|
427 |
torch.save(ckpt, w / f'epoch{epoch}.pt')
|
428 |
del ckpt
|
429 |
callbacks.run('on_model_save', last, epoch, final_epoch, best_fitness, fi)
|
|
|
423 |
torch.save(ckpt, last)
|
424 |
if best_fitness == fi:
|
425 |
torch.save(ckpt, best)
|
426 |
+
if opt.save_period > 0 and epoch % opt.save_period == 0:
|
427 |
torch.save(ckpt, w / f'epoch{epoch}.pt')
|
428 |
del ckpt
|
429 |
callbacks.run('on_model_save', last, epoch, final_epoch, best_fitness, fi)
|