"""Kaggle notebook body: the director stage, isolated from Ming's transformers. Ming pins transformers 4.46.3; Qwen3.5 needs 5.x. They cannot share a process, so the director runs here and leaves a validated script behind. The radio stage reads that file instead of calling an LLM itself. The probe runs as a subprocess on purpose: this notebook imports huggingface_hub to download the bundle, and after `pip install --upgrade` the already-imported module is stale, which breaks transformers' `from huggingface_hub.utils import httpx`. A fresh interpreter picks up the new version. """ import os import subprocess import sys BUNDLE = "/kaggle/working/webfm-eval" def sh(cmd: str) -> None: print(f"$ {cmd}", flush=True) if subprocess.run(cmd, shell=True).returncode != 0: raise SystemExit(f"failed: {cmd}") def main() -> None: # transformers 5 imports `httpx` from huggingface_hub.utils. huggingface_hub # 2.x renamed that to httpx2, so hold hub below 2. sh("pip install -q --upgrade 'transformers>=5' 'huggingface_hub>=1.31,<2' accelerate") target = os.path.join(BUNDLE, "kaggle/director_probe.py") if not os.path.exists(target): raise SystemExit(f"{target} missing") env = dict(os.environ, WORK_ROOT="/kaggle/working", MODE=os.environ.get("MODE", "probe"), N_SAMPLES=os.environ.get("N_SAMPLES", "8")) rc = subprocess.run([sys.executable, target], env=env).returncode print("director rc", rc) if __name__ == "__main__": main()