#!/usr/bin/env bash # HF Job entrypoint. Runs from the repo root (downloaded via `hf download` into the # current working dir at launch, to avoid FUSE-mount read races). Runs the CausalGame # LLM-agent matrix via HF Inference Providers, LLM-judges the reports, and copies all # outputs to the mounted bucket at /out. set -uo pipefail MODELS="${MODELS:-hf-deepseek-v3 hf-qwen3-235b hf-glm-4.6 hf-kimi-k2 hf-gpt-oss-120b hf-llama-3.3-70b}" SCENARIOS="${SCENARIOS:-antenna_trap antenna_trap_no_selection_bias deployment_zone_trap_categorical weather_noise}" MODES="${MODES:-legacy}" REPEATS="${REPEATS:-1}" TIMEOUT="${TIMEOUT:-900}" JUDGE_MODEL="${JUDGE_MODEL:-Qwen/Qwen3-235B-A22B-Instruct-2507}" echo "== CausalGame repro job ==" echo "cwd=$(pwd)"; ls -la echo "models=$MODELS" echo "scenarios=$SCENARIOS ; repeats=$REPEATS ; modes=$MODES" pip install -q -r CausalGame/requirements.txt openai plotly 2>&1 | tail -3 || pip install -q -r CausalGame/requirements.txt openai mkdir -p outputs python scripts/run_llm_agents.py \ --models $MODELS \ --scenarios $SCENARIOS \ --modes $MODES \ --repeats "$REPEATS" \ --timeout "$TIMEOUT" \ --out outputs/llm_results.jsonl || echo "runner exited non-zero" echo "== judging reports ==" python scripts/judge_reports.py --in outputs/llm_results.jsonl \ --judge-model "$JUDGE_MODEL" \ --out outputs/llm_results_judged.jsonl || echo "judge failed" echo "== copying outputs to bucket /out ==" mkdir -p /out cp -v outputs/llm_results*.jsonl /out/ 2>/dev/null || true cp -v outputs/llm_summary.csv /out/ 2>/dev/null || true cp -v outputs/.sess_*.log /out/ 2>/dev/null || true echo "== done ==" ls -la /out || true