Upload bench_thor.py with huggingface_hub
Browse files45 unmodified lines464748495051524 unmodified lines575859606162638 unmodified lines72737475767778798079 unmodified lines16016116216316416516616716816945 unmodified lines# "huggingface_hub>=0.25.0",# ]# ///"""Run N inference iterations, output JSON metrics to stdout."""import jsonimport osimport sys4 unmodified linesBASE = os.environ.get("BASE_MODEL", "Qwen/Qwen3-4B-Instruct-2507")ADAPTER = os.environ.get("ADAPTER", "kinglyai/qwen3-4b-atc-parser-v0")ADAPTER_SUBFOLDER = os.environ.get("ADAPTER_SUBFOLDER", "v7_r16")N_RUNS = int(os.environ.get("N_RUNS", "30"))PROMPTS = [8 unmodified lines]SYSTEM_PROMPT = ("You are an ATC parser. Output ONLY a JSON object: "'{"intent": <one-of-50-enum>, "slots": {<UPPERCASE_SLOT>: <value>}}. '"No prose, no code fences.")def main():79 unmodified lines)print(f"executing benchmark on {thor_host}...")cmd = (f"cd {REMOTE_WORKDIR} && "f"N_RUNS={n_runs} ADAPTER_SUBFOLDER={adapter_subfolder} "f"uv run --quiet run_bench.py")result = subprocess.run(["ssh", thor_host, cmd],45 unmodified lines464748495051525354554 unmodified lines606162636465668 unmodified lines7576777879808182838479 unmodified lines16416516616716816917017117217317417517645 unmodified lines# "huggingface_hub>=0.25.0",# ]# ///"""Run N inference iterations, output JSON metrics to stdout.V1 schema target: outputs `{segments: [...], abstain_reason: ...}`LoRA adapter v10 is the current canonical-v2-trained checkpoint."""import jsonimport osimport sys4 unmodified linesBASE = os.environ.get("BASE_MODEL", "Qwen/Qwen3-4B-Instruct-2507")ADAPTER = os.environ.get("ADAPTER", "kinglyai/qwen3-4b-atc-parser-v0")ADAPTER_SUBFOLDER = os.environ.get("ADAPTER_SUBFOLDER", "v10")N_RUNS = int(os.environ.get("N_RUNS", "30"))PROMPTS = [8 unmodified lines]SYSTEM_PROMPT = ("You are an ATC parser. Parse the air traffic control transmission into a JSON object.\\n\\n""OUTPUT SCHEMA: {\\"segments\\": [{\\"intent\\":<enum>,\\"slots\\":{<lowercase_key>:<value>},\\"text\\":<seg>}], \\"abstain_reason\\": null|<reason>}\\n\\n""Use 51-intent enum (50 canonical + \\"unknown\\" for ambiguous). Slot keys are lowercase. ""Compound transmissions emit multiple segments. Output ONLY the JSON object.")def main():79 unmodified lines)print(f"executing benchmark on {thor_host}...")# Use bash -lc to source ~/.profile so uv is on PATH (uv at /home/naac/.local/bin/uv)# Pass HF_TOKEN if present locally (for private adapter download)hf_token = os.environ.get("HF_TOKEN", "")cmd = (f"bash -lc 'cd {REMOTE_WORKDIR} && "f"HF_TOKEN={hf_token} N_RUNS={n_runs} ADAPTER_SUBFOLDER={adapter_subfolder} "f"uv run --quiet run_bench.py'")result = subprocess.run(["ssh", thor_host, cmd],
bench_thor.py+15-8