diffvof-simulation-data / scripts /detached_train.py
AlanZee's picture
Upload folder using huggingface_hub
ed552fd verified
Raw
History Blame Contribute Delete
1.19 kB
"""
独立 launcher — 运行后关闭父进程,子进程继续运行。
在远程执行: F:\f\pyopenfoam-gpu\python.exe Code\scripts\detached_train.py
"""
import subprocess
import os
import sys
os.chdir(r"F:\agent-workspace\paper2")
os.environ["PYTHONUNBUFFERED"] = "1"
log_path = r"Exp\results\R1\train_log.txt"
# 用 CREATE_NEW_PROCESS_GROUP + DETACHED_PROCESS 脱离父进程
flags = 0x00000200 | 0x00000008 # DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP
with open(log_path, "w") as log:
proc = subprocess.Popen(
[
r"F:\f\pyopenfoam-gpu\python.exe", "-u",
r"Code\scripts\resolution_generalization.py",
"--checkpoint_root", "checkpoints",
"--output_dir", r"Exp\results\R1",
"--train_resolutions", "64", "256",
"--skip_generalization",
"--n_rollout_steps", "50",
"--epochs_s1", "50",
"--epochs_s2", "30",
"--seed", "42",
"--device", "cuda",
],
stdout=log,
stderr=subprocess.STDOUT,
creationflags=flags,
)
print(f"PID={proc.pid}", flush=True)
# 不等待 — 父进程退出后子进程继续