Win and linux can run the code
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user