Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions utils/aws/resume.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Resume all interrupted trainings in yolov5/ dir including DDP trainings
# Usage: $ python utils/aws/resume.py

import os
import subprocess
import sys
from pathlib import Path

Expand Down Expand Up @@ -34,10 +34,20 @@

if ddp: # multi-GPU
port += 1
cmd = f"python -m torch.distributed.run --nproc_per_node {nd} --master_port {port} train.py --resume {last}"
cmd = [
"python",
"-m",
"torch.distributed.run",
"--nproc_per_node",
str(nd),
"--master_port",
str(port),
"train.py",
"--resume",
str(last),
]
else: # single-GPU
cmd = f"python train.py --resume {last}"
cmd = ["python", "train.py", "--resume", str(last)]

cmd += " > /dev/null 2>&1 &" # redirect output to dev/null and run in daemon thread
print(cmd)
os.system(cmd)
print(" ".join(cmd))
subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) # run in daemon thread
Loading