glenn-jocher commited on
Commit
df9008e
·
unverified ·
1 Parent(s): c94736a

Add train.py `--name cfg` option (#7202)

Browse files

Automatically names run as --cfg argument

Files changed (1) hide show
  1. train.py +2 -0
train.py CHANGED
@@ -519,6 +519,8 @@ def main(opt, callbacks=Callbacks()):
519
  if opt.project == str(ROOT / 'runs/train'): # if default project name, rename to runs/evolve
520
  opt.project = str(ROOT / 'runs/evolve')
521
  opt.exist_ok, opt.resume = opt.resume, False # pass resume to exist_ok and disable resume
 
 
522
  opt.save_dir = str(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok))
523
 
524
  # DDP mode
 
519
  if opt.project == str(ROOT / 'runs/train'): # if default project name, rename to runs/evolve
520
  opt.project = str(ROOT / 'runs/evolve')
521
  opt.exist_ok, opt.resume = opt.resume, False # pass resume to exist_ok and disable resume
522
+ if opt.name == 'cfg':
523
+ opt.name = Path(opt.cfg).stem # use model.yaml as name
524
  opt.save_dir = str(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok))
525
 
526
  # DDP mode