fix: pull torch from CPU-only index to shrink backend image (3.3GB → ~588MB)#4686
Conversation
torch 2.12 (bumped transitively via #4672) changed its CUDA dependency markers from `platform_machine == 'x86_64'` to `platform_system == 'Linux'`, so the arm64 backend image started pulling the full NVIDIA CUDA stack (cuda-toolkit + 15 nvidia-* wheels + triton). Compressed image jumped from ~588MB to ~3.31GB — none of it usable, the host has no GPU. Bind torch to the PyTorch CPU index. torch is declared as a direct dependency because [tool.uv.sources] only applies to direct deps, not transitive ones (it's otherwise pulled in by sentence-transformers). Relock removes 19 packages (all CUDA/nvidia/triton); torch resolves to 2.12.1+cpu. Lock stays format version 1 (compatible with the Dockerfile's pinned uv==0.5.5). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Pins Potential issue: macOS arm64 installs may break The new lock file drops all macOS wheels — previously the lock included With Before merging, verify |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4686 +/- ##
=======================================
Coverage 92.43% 92.43%
=======================================
Files 355 355
Lines 10719 10719
Branches 818 818
=======================================
Hits 9908 9908
Misses 698 698
Partials 113 113 🚀 New features to boost your workflow:
|
Problem
The arm64 backend image jumped from ~588MB to ~3.31GB compressed starting 2026-06-19.
Root cause: the uv group bump in #4672 upgraded
torchtransitively 2.10.0 → 2.12.1. torch 2.12 changed its CUDA dependency markers:platform_machine == 'x86_64' and sys_platform == 'linux'platform_system == 'Linux'The backend image is arm64. Under the old marker, the
x86_64guard excluded CUDA on arm. Under the new marker, arm64 Linux now pulls the full NVIDIA CUDA stack —cuda-toolkit+ 15nvidia-*wheels +triton— ~2.7GB of GPU libraries the host can never use (no GPU).torch reaches the tree via
sentence-transformers.Fix
Bind torch to the PyTorch CPU-only index. The
+cpuwheels declare no nvidia dependencies.torch is declared as a direct dependency because
[tool.uv.sources]only binds direct deps, not transitive ones.Verification
2.12.1+cpufromdownload.pytorch.org/whl/cpu.+cpu/cpu wheels confirmed present on the index → CI and dev machines covered.version = 1→ compatible with the Dockerfile's pinneduv==0.5.5.uv lock --lockedpasses.Note: verified at install/lock level; the actual ECR image size is produced by CI on this branch.
🤖 Generated with Claude Code