Updates save_period to include first epoch (#14700)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Burhan 2024-07-25 17:49:04 -04:00 committed by GitHub
parent fc7f1f3aea
commit db42d180d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -507,7 +507,7 @@ class BaseTrainer:
self.last.write_bytes(serialized_ckpt) # save last.pt
if self.best_fitness == self.fitness:
self.best.write_bytes(serialized_ckpt) # save best.pt
if (self.save_period > 0) and (self.epoch > 0) and (self.epoch % self.save_period == 0):
if (self.save_period > 0) and (self.epoch >= 0) and (self.epoch % self.save_period == 0):
(self.wdir / f"epoch{self.epoch}.pt").write_bytes(serialized_ckpt) # save epoch, i.e. 'epoch3.pt'
def get_dataset(self):