From 621b6d5ba80707ca98242dd7c71d738e5594b41e Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Wed, 15 Sep 2021 13:13:33 +0200 Subject: [PATCH] Evolution `--resume` fix (#4802) Also disable `/weights` dir creation when evolving as no weights are saved and empty folder causes user expectations of weights. --- train.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/train.py b/train.py index d243a9c..1d0c2c6 100644 --- a/train.py +++ b/train.py @@ -64,7 +64,7 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary # Directories w = save_dir / 'weights' # weights dir - w.mkdir(parents=True, exist_ok=True) # make dir + (w.parent if evolve else w).mkdir(parents=True, exist_ok=True) # make dir last, best = w / 'last.pt', w / 'best.pt' # Hyperparameters @@ -489,7 +489,7 @@ def main(opt, callbacks=Callbacks()): assert len(opt.cfg) or len(opt.weights), 'either --cfg or --weights must be specified' if opt.evolve: opt.project = 'runs/evolve' - opt.exist_ok = opt.resume + opt.exist_ok, opt.resume = opt.resume, False # pass resume to exist_ok and disable resume opt.save_dir = str(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok)) # DDP mode