Spaces:
Running on Zero
fix: Hold the Space's torch on CUDA 12 wheels
Browse filesThe @spaces.GPU restructure works: the logs now show "Waiting for a GPU to
become available" then "Successfully acquired a GPU", where before the call
never reached ZeroGPU's scheduler at all. But its forked worker still dies in
worker_init -> torch.init(nvidia_uuid) -> torch.Tensor([0]).cuda() with
"No CUDA GPUs are available", holding a GPU it just acquired.
Unconstrained, pip resolved torch 2.11.0, and its wheels carry CUDA 13 --
nvidia-cudnn-cu13, cuda-toolkit 13.0.2, nvidia-nccl-cu13 are all in the build
log. Two plausible reasons that fails on zero-a10g, and one bound covers both:
the host driver may not support CUDA 13, and torch 2.11 is new enough that
spaces 0.51.1 may not patch it correctly. spaces declares no torch dependency at
all, so nothing was holding it back.
<2.9 keeps torch on CUDA 12 wheels and on a release spaces has had time to
patch, and stays well inside the platform's own torch<=2.11.0. This is a
deliberate exception to the no-upper-bounds rule the rest of this file follows,
which is why it is commented there.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- requirements-space.txt +7 -1
|
@@ -9,7 +9,13 @@
|
|
| 9 |
# upper bound here can make the resolve impossible -- pinning transformers <4.56
|
| 10 |
# did exactly that, because gradio 6.x needs huggingface-hub >=1.16 and every
|
| 11 |
# transformers <4.56 needs <1.0.
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
transformers>=4.51.0
|
| 14 |
accelerate>=0.30.0
|
| 15 |
bitsandbytes>=0.43.0 # 4-bit NF4; CUDA-only
|
|
|
|
| 9 |
# upper bound here can make the resolve impossible -- pinning transformers <4.56
|
| 10 |
# did exactly that, because gradio 6.x needs huggingface-hub >=1.16 and every
|
| 11 |
# transformers <4.56 needs <1.0.
|
| 12 |
+
# Upper-bounded on purpose, unlike everything else here. Unconstrained, pip
|
| 13 |
+
# resolved torch 2.11.0, whose wheels carry CUDA 13 (nvidia-cudnn-cu13,
|
| 14 |
+
# cuda-toolkit 13.0.2). ZeroGPU then acquired a GPU and its own forked worker
|
| 15 |
+
# still failed in torch.init(): "RuntimeError: No CUDA GPUs are available".
|
| 16 |
+
# <2.9 keeps torch on CUDA 12 wheels, and on a release `spaces` has had time to
|
| 17 |
+
# patch. Still well inside the platform's own `torch<=2.11.0`.
|
| 18 |
+
torch>=2.4.0,<2.9
|
| 19 |
transformers>=4.51.0
|
| 20 |
accelerate>=0.30.0
|
| 21 |
bitsandbytes>=0.43.0 # 4-bit NF4; CUDA-only
|