worker: use RunPod's cached-model mount when the endpoint caches CHAMBER_MODEL (unbilled download)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KkLuf2FYZUkVyoLue4wyoe
This commit is contained in:
1 parent
9f60f71a6d
commit
196a8f5bff
1 file changed
+11
@@ -23,6 +23,17 @@ from pathlib import Path
|
|||||||
sys.path.insert(0, str(Path(__file__).parent))
|
sys.path.insert(0, str(Path(__file__).parent))
|
||||||
|
|
||||||
print("WORKER-ENV", sys.executable, sys.version.split()[0], flush=True)
|
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:
|
try:
|
||||||
import torch
|
import torch
|
||||||
print("WORKER-TORCH", torch.__version__, flush=True)
|
print("WORKER-TORCH", torch.__version__, flush=True)
|
||||||
|
|||||||
Reference in new issue
Block a user