"""Download an upstream model at a recorded immutable revision via the hf CLI.""" from pathlib import Path import argparse import json import subprocess def main(): p = argparse.ArgumentParser() p.add_argument("--repo", default="Qwen/Qwen3.5-0.8B") args = p.parse_args() sources = json.loads(Path("reports/sources.json").read_text())["models"] found = next((x for x in sources if x["repo"] == args.repo), None) if found is None: raise ValueError("Model must be recorded in reports/sources.json first") target = Path(".cache") / args.repo.split("/")[-1] subprocess.run(["hf", "download", args.repo, "--revision", found["revision"], "--local-dir", str(target), "--include", "*.json", "--include", "*.safetensors", "--include", "*.txt", "--include", "*.jinja", "--include", "LICENSE", "--include", "README.md"], check=True) if __name__ == "__main__": main()