File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33# Resume all interrupted trainings in yolov5/ dir including DDP trainings
44# Usage: $ python utils/aws/resume.py
55
6- import os
6+ import subprocess
77import sys
88from pathlib import Path
99
3434
3535 if ddp : # multi-GPU
3636 port += 1
37- cmd = f"python -m torch.distributed.run --nproc_per_node { nd } --master_port { port } train.py --resume { last } "
37+ cmd = [
38+ "python" ,
39+ "-m" ,
40+ "torch.distributed.run" ,
41+ "--nproc_per_node" ,
42+ str (nd ),
43+ "--master_port" ,
44+ str (port ),
45+ "train.py" ,
46+ "--resume" ,
47+ str (last ),
48+ ]
3849 else : # single-GPU
39- cmd = f "python train.py --resume { last } "
50+ cmd = [ "python" , " train.py" , " --resume" , str ( last )]
4051
41- cmd += " > /dev/null 2>&1 &" # redirect output to dev/null and run in daemon thread
42- print (cmd )
43- os .system (cmd )
52+ print (" " .join (cmd ))
53+ subprocess .Popen (cmd , stdout = subprocess .DEVNULL , stderr = subprocess .DEVNULL ) # run in daemon thread
You can’t perform that action at this time.
0 commit comments