From 39140c91d4c4d4c78f27c692e055b55dab78c2be Mon Sep 17 00:00:00 2001 From: Johan de Ruiter Date: Tue, 14 Jul 2026 18:56:42 +0000 Subject: [PATCH] cosmos3: pin baked hf CLI to 1.16.4 (matches framework; no PyPI fetch at boot) The framework's checkpoint_db shells out to `uvx hf@1.16.4 download ...` at model-init time, but the image baked/prefetched with hf@1.13.0. That version mismatch means uvx fetches hf 1.16.4 from PyPI on every pod boot (a runtime network dependency), and the prefetched HF cache (1.13.0 layout) isn't hit by the 1.16.4 runtime -> weights re-download from HF too. Align all hf invocations to 1.16.4 so the baked tool is reused and cache layout matches runtime. This is the tool half of removing the per-boot network dependency; the weights half (auxiliary encoder/VAE/sound-tokenizer served from deep-storage via a mounted HF cache + HF_HUB_OFFLINE=1) is a per-deployment change, not baked here. Co-Authored-By: Claude Opus 4.8 (1M context) --- examples/cosmos3/Dockerfile | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/cosmos3/Dockerfile b/examples/cosmos3/Dockerfile index 7cca53876b54..2b8271d76b8a 100644 --- a/examples/cosmos3/Dockerfile +++ b/examples/cosmos3/Dockerfile @@ -63,10 +63,12 @@ ENV TRITON_PTXAS_PATH="/usr/local/cuda/bin/ptxas" RUN --mount=type=cache,target=/root/.cache/uv \ uv pip install fastapi uvicorn ai-dynamo==1.1.1 uvloop -# Pre-install the HF CLI tool so that `uvx hf@1.13.0` reuses this -# installation instead of creating an ephemeral env missing `click`. +# Pre-install the HF CLI tool at the version the framework invokes at runtime +# (`uvx hf@1.16.4` in cosmos_framework's checkpoint_db) so uvx reuses this +# baked copy instead of fetching the tool from PyPI at every pod boot. MUST +# match the framework's pinned hf version, else uvx re-downloads it. RUN --mount=type=cache,target=/root/.cache/uv \ - uv tool install hf@1.13.0 --with click + uv tool install hf@1.16.4 --with click RUN --mount=type=cache,target=/root/.cache/uv \ uv pip install --no-deps -e /workspace @@ -83,32 +85,32 @@ RUN --mount=type=cache,target=/root/.cache/uv \ # — guardrails are disabled in worker.py (guardrails=False), so it is never # loaded at runtime. Re-add its download here (and the BuildKit hf_token secret # it needs) if guardrails are ever turned back on. -RUN uvx hf@1.13.0 download --format=json \ +RUN uvx hf@1.16.4 download --format=json \ Qwen/Qwen3-0.6B \ --repo-type model \ --revision c1899de289a04d12100db370d81485cdf75e47ca \ --include '*.json' --include '*.txt' && \ - uvx hf@1.13.0 download --format=json \ + uvx hf@1.16.4 download --format=json \ Qwen/Qwen3-VL-2B-Instruct \ --repo-type model \ --revision 89644892e4d85e24eaac8bacfd4f463576704203 \ --include '*.json' --include '*.txt' && \ - uvx hf@1.13.0 download --format=json \ + uvx hf@1.16.4 download --format=json \ Qwen/Qwen3-VL-8B-Instruct \ --repo-type model \ --revision 0c351dd01ed87e9c1b53cbc748cba10e6187ff3b \ --include '*.json' --include '*.txt' && \ - uvx hf@1.13.0 download --format=json \ + uvx hf@1.16.4 download --format=json \ Qwen/Qwen3-VL-32B-Instruct \ --repo-type model \ --revision 0cfaf48183f594c314753d30a4c4974bc75f3ccb \ --include '*.json' --include '*.txt' && \ - uvx hf@1.13.0 download --format=json \ + uvx hf@1.16.4 download --format=json \ Wan-AI/Wan2.1-T2V-14B \ --repo-type model \ --revision a064a6c71f5be440641209c07bf2a5ce7a2ff5e4 \ Wan2.1_VAE.pth && \ - uvx hf@1.13.0 download --format=json \ + uvx hf@1.16.4 download --format=json \ Wan-AI/Wan2.2-TI2V-5B \ --repo-type model \ --revision 921dbaf3f1674a56f47e83fb80a34bac8a8f203e \