Skip to content

Commit

Permalink
Simplify and fix --save-period epoch 0 (ultralytics#8042)
Browse files Browse the repository at this point in the history
Simplify and update `--save-period` epoch 0
  • Loading branch information
glenn-jocher authored and Clay Januhowski committed Sep 8, 2022
1 parent ddb579b commit fcb5e06
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fcb5e06

Please sign in to comment.