Download code/tools/remote_sh.py from hello-test1/PhotonTTS: direct link, hf CLI and curl.
- Browser
- Download file 908 Bytes
-
https://huggingface.co/hello-test1/PhotonTTS/resolve/main/code/tools/remote_sh.py
- Command line
-
hf download hf://hello-test1/PhotonTTS/code/tools/remote_sh.py
-
curl -L -o remote_sh.py https://huggingface.co/hello-test1/PhotonTTS/resolve/main/code/tools/remote_sh.py
908 Bytes
| """Run a shell command on the remote GPU box and print its output. | |
| MARIMO_URL=... MARIMO_TOKEN=... python tools/remote_sh.py "cd /root/PhotonTTS && pytest -q" | |
| """ | |
| from __future__ import annotations | |
| import os | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parent)) | |
| from push_remote import DEFAULT_EXEC, run_remote # noqa: E402 | |
| def main(): | |
| sys.stdout.reconfigure(encoding="utf-8", errors="replace") | |
| cmd = " ".join(sys.argv[1:]) | |
| timeout = int(os.environ.get("REMOTE_TIMEOUT", 3600)) | |
| code = ( | |
| "import subprocess\n" | |
| f"r = subprocess.run({cmd!r}, shell=True, capture_output=True, text=True, timeout={timeout})\n" | |
| "print(r.stdout[-20000:], r.stderr[-5000:], f'[exit {r.returncode}]')\n" | |
| ) | |
| print(run_remote(code, os.environ["MARIMO_URL"], os.environ["MARIMO_TOKEN"], DEFAULT_EXEC)) | |
| if __name__ == "__main__": | |
| main() | |