| #!/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/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) | |