Skip to content

Commit 2a0ad55

Browse files
authored
Add train.py --name cfg option (ultralytics#7202)
Automatically names run as --cfg argument
1 parent 39c6e56 commit 2a0ad55

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

train.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,8 @@ def main(opt, callbacks=Callbacks()):
519519
if opt.project == str(ROOT / 'runs/train'): # if default project name, rename to runs/evolve
520520
opt.project = str(ROOT / 'runs/evolve')
521521
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
522524
opt.save_dir = str(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok))
523525

524526
# DDP mode

0 commit comments

Comments
 (0)