File size: 794 Bytes
ab29d8f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | """
BAPO LLM runner as a SINGLE python file that downloads itself.
Avoids bash escaping issues.
"""
import subprocess
import sys
# Install deps
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "numpy", "torch", "transformers", "accelerate", "huggingface_hub"], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
# Now download the actual LLM script
from huggingface_hub import hf_hub_download
import os
script_path = hf_hub_download(
repo_id="AceVikings/bapo-llm-script",
filename="hf_bapo_llm.py",
repo_type="dataset",
token=os.environ.get("HF_TOKEN"),
)
print(f"Downloaded: {script_path}")
# Read and execute
with open(script_path) as f:
code = f.read()
exec(compile(code, script_path, "exec"), {"__name__": "__main__", "__file__": script_path})
|