From 196a8f5bffae3fd150f79c0a4967b5123aa283e3 Mon Sep 17 00:00:00 2001 From: E Date: Fri, 2 Oct 2026 22:08:28 -0400 Subject: [PATCH] worker: use RunPod's cached-model mount when the endpoint caches CHAMBER_MODEL (unbilled download) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KkLuf2FYZUkVyoLue4wyoe --- live/worker.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/live/worker.py b/live/worker.py index b97f192..b07006c 100644 --- a/live/worker.py +++ b/live/worker.py @@ -23,6 +23,17 @@ from pathlib import Path sys.path.insert(0, str(Path(__file__).parent)) print("WORKER-ENV", sys.executable, sys.version.split()[0], flush=True) + +# RunPod cached models (endpoint model reference) mount here in HF hub layout; +# download time there isn't billed, which matters at 70B (~40 GB). Must be set +# before transformers/huggingface_hub are imported. +_HF_CACHE = "/runpod-volume/huggingface-cache/hub" +_cached = os.path.join(_HF_CACHE, "models--" + os.environ.get( + "CHAMBER_MODEL", "Qwen/Qwen3-4B").replace("/", "--")) +if os.path.isdir(_cached): + os.environ["HF_HUB_CACHE"] = _HF_CACHE + os.environ.setdefault("HF_HUB_OFFLINE", "1") # the mount is read-only + print("WORKER-CACHE", _cached, flush=True) try: import torch print("WORKER-TORCH", torch.__version__, flush=True)