""" 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})