glenn-jocher commited on
Commit
dcf8073
·
unverified ·
1 Parent(s): 632559b

Simplify and fix `--save-period` epoch 0 (#8042)

Browse files
Files changed (1) hide show
  1. train.py +1 -1
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 (epoch > 0) and (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)
 
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)