From d526ce0d118fcbbfae3e73d9627183b95ceb2b26 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 2 Apr 2019 16:33:52 +0200 Subject: [PATCH] updates --- train.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/train.py b/train.py index 1a6a98c5..b87600d5 100644 --- a/train.py +++ b/train.py @@ -180,15 +180,16 @@ def train( model) is nn.parallel.DistributedDataParallel else model.state_dict(), 'optimizer': optimizer.state_dict()} torch.save(checkpoint, latest) - del checkpoint # Save best checkpoint if best_loss == mloss['total']: - os.system('cp ' + latest + ' ' + best) + torch.save(checkpoint, best) # Save backup weights every 10 epochs (optional) if epoch > 0 and epoch % 10 == 0: - os.system('cp ' + latest + ' ' + weights + 'backup%g.pt' % epoch) + torch.save(checkpoint, weights + 'backup%g.pt' % epoch) + + del checkpoint # Calculate mAP with torch.no_grad():