glenn-jocher commited on
Commit
621b6d5
·
unverified ·
1 Parent(s): b74dd4b

Evolution `--resume` fix (#4802)

Browse files

Also disable `/weights` dir creation when evolving as no weights are saved and empty folder causes user expectations of weights.

Files changed (1) hide show
  1. train.py +2 -2
train.py CHANGED
@@ -64,7 +64,7 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary
64
 
65
  # Directories
66
  w = save_dir / 'weights' # weights dir
67
- w.mkdir(parents=True, exist_ok=True) # make dir
68
  last, best = w / 'last.pt', w / 'best.pt'
69
 
70
  # Hyperparameters
@@ -489,7 +489,7 @@ def main(opt, callbacks=Callbacks()):
489
  assert len(opt.cfg) or len(opt.weights), 'either --cfg or --weights must be specified'
490
  if opt.evolve:
491
  opt.project = 'runs/evolve'
492
- opt.exist_ok = opt.resume
493
  opt.save_dir = str(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok))
494
 
495
  # DDP mode
 
64
 
65
  # Directories
66
  w = save_dir / 'weights' # weights dir
67
+ (w.parent if evolve else w).mkdir(parents=True, exist_ok=True) # make dir
68
  last, best = w / 'last.pt', w / 'best.pt'
69
 
70
  # Hyperparameters
 
489
  assert len(opt.cfg) or len(opt.weights), 'either --cfg or --weights must be specified'
490
  if opt.evolve:
491
  opt.project = 'runs/evolve'
492
+ opt.exist_ok, opt.resume = opt.resume, False # pass resume to exist_ok and disable resume
493
  opt.save_dir = str(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok))
494
 
495
  # DDP mode