File size: 678 Bytes
2d7087a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | """Start training in background and write to log file."""
import subprocess, sys, os
BASE = os.path.dirname(os.path.abspath(__file__))
log = os.path.join(BASE, "training_log.txt")
# Remove partial download so torchvision can re-download cleanly
partial = os.path.join(BASE, "training_data", "stl10_binary.tar.gz")
if os.path.exists(partial):
os.remove(partial)
proc = subprocess.Popen(
[sys.executable, "-u", os.path.join(BASE, "train_local.py")],
stdout=open(log, "w", buffering=1),
stderr=subprocess.STDOUT,
cwd=BASE
)
with open(os.path.join(BASE, "train.pid"), "w") as f:
f.write(str(proc.pid))
print(f"Training started, PID: {proc.pid}, log: {log}")
|