Skip to content

Commit

Permalink
Merge pull request #201 from supervisely-ecosystem/best_epoch
Browse files Browse the repository at this point in the history
added best epoch number to best checkpoint file
  • Loading branch information
MaxTeselkin authored Jun 16, 2023
2 parents e5af1e0 + fb902e2 commit 36bf76b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@


def train(hyp, opt, device, tb_writer=None):

train_batches_uploaded = False

logger.info("hyperparameters", extra=hyp)
Expand Down Expand Up @@ -626,6 +625,9 @@ def train(hyp, opt, device, tb_writer=None):
# Save last, best and delete
torch.save(ckpt, last)
if best_fitness == fi:
if epoch != 0:
os.remove(best)
best = wdir / f"best_{epoch}.pt"
torch.save(ckpt, best)
if wandb_logger.wandb:
if (
Expand Down

0 comments on commit 36bf76b

Please sign in to comment.