Win and linux can run the code

This commit is contained in:
MZ YANG
2026-01-22 17:39:31 +08:00
parent c3f750cd9d
commit f37a8ce179
22 changed files with 32572 additions and 87 deletions

View File

@@ -6,10 +6,19 @@ import subprocess
import sys
from pathlib import Path
from platform_utils import safe_path, is_windows
def run(cmd):
print("running:", " ".join(cmd))
subprocess.run(cmd, check=True)
# 使用safe_path确保跨平台兼容性
cmd = [safe_path(arg) for arg in cmd]
# 在Windows上可能需要特殊处理
if is_windows():
subprocess.run(cmd, check=True, shell=False)
else:
subprocess.run(cmd, check=True)
def parse_args():
@@ -32,7 +41,7 @@ def main():
args = parse_args()
base_dir = Path(__file__).resolve().parent
run([sys.executable, str(base_dir / "prepare_data.py")])
run([sys.executable, str(base_dir / "train.py"), "--config", args.config])
run([sys.executable, str(base_dir / "train.py"), "--config", args.config, "--device", args.device])
run(
[
sys.executable,