Hanrui / syxin_old /launch_train_wrapper.py
Lekr0's picture
Add files using upload-large-folder tool
40d87dd verified
#!/usr/bin/env python3
"""
Python wrapper to launch bash training script via torchrun
"""
import subprocess
import sys
import os
if __name__ == "__main__":
# Get the bash script path and arguments
bash_script = "/workspace/hanrui/syxin_old/run_train_multinode.sh"
args = sys.argv[1:] # Pass through all arguments
# Build the command
cmd = ["bash", bash_script] + args
# Execute the bash script
result = subprocess.run(cmd, env=os.environ.copy())
# Exit with the same code as the bash script
sys.exit(result.returncode)