# Torch.cuda.is\_available() is False on ZeroGPU Space

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftorch-cuda-is-available-is-false-on-zerogpu-space%2F151707%3E%5C
**Category:** Spaces\
**Created:** [April 22, 2025, 12:21am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftorch-cuda-is-available-is-false-on-zerogpu-space%2F151707 "2025-04-22T00:21:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NariLabs](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/narilabs/32/46065_2.png) [@NariLabs](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FNariLabs)%5C
**Post date:** [April 22, 2025, 12:21am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftorch-cuda-is-available-is-false-on-zerogpu-space%2F151707%2F1 "2025-04-22T00:21:49Z")

</div>

```auto
/usr/local/lib/python3.10/site-packages/torch/cuda/ __init__.py:734: UserWarning: Can't initialize NVML
  warnings.warn("Can't initialize NVML")
Using device: cpu
Loading Nari model...

config.json: 0%| | 0.00/1.08k [00:00<?, ?B/s]
config.json: 100%|██████████| 1.08k/1.08k [00:00<00:00, 7.24MB/s]

dia-v0_1.pth: 0%| | 0.00/6.44G [00:00<?, ?B/s]
dia-v0_1.pth: 1%|▏ | 94.4M/6.44G [00:01<01:08, 92.9MB/s]
dia-v0_1.pth: 23%|██▎ | 1.46G/6.44G [00:02<00:06, 830MB/s] 
dia-v0_1.pth: 50%|████▉ | 3.22G/6.44G [00:03<00:02, 1.25GB/s]
dia-v0_1.pth: 75%|███████▌ | 4.85G/6.44G [00:04<00:01, 1.40GB/s]
dia-v0_1.pth: 100%|█████████▉| 6.44G/6.44G [00:05<00:00, 1.27GB/s]
Error loading Nari model: Error loading checkpoint from /home/user/.cache/huggingface/hub/models--nari-labs--Dia-1.6B/snapshots/ea1fb6655d1de2f270f1b0ee6743bba7465f407a/dia-v0_1.pth
Traceback (most recent call last):
  File "/home/user/app/dia/model.py", line 91, in from_local
    dia.model.load_state_dict(torch.load(checkpoint_path, map_location=device))
  File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 1462, in load
    return _load(
  File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 1964, in _load
    result = unpickler.load()
  File "/usr/local/lib/python3.10/site-packages/torch/_weights_only_unpickler.py", line 512, in load
    self.append(self.persistent_load(pid))
  File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 1928, in persistent_load
    typed_storage = load_tensor(
  File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 1900, in load_tensor
    wrap_storage=restore_location(storage, location),
  File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 1806, in restore_location
    return default_restore_location(storage, str(map_location))
  File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 693, in default_restore_location
    result = fn(storage, location)
  File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 631, in _deserialize
    device = _validate_device(location, backend_name)
  File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 600, in _validate_device
    raise RuntimeError(
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

```

Trying to get my Space up with a ZeroGPU.  
But failing due to torch.cuda.is\_available() being False?!

Can someone please help me…

---

<div class="post-metadata">

**Author:** ![NariLabs](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/narilabs/32/46065_2.png) [@NariLabs](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FNariLabs)%5C
**Post date:** [April 22, 2025, 12:22am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftorch-cuda-is-available-is-false-on-zerogpu-space%2F151707%2F2 "2025-04-22T00:22:44Z")

</div>

descript-audio-codec\>=1.0.0  
gradio\>=5.25.2  
huggingface-hub\>=0.30.2  
numpy\>=2.2.4  
pydantic\>=2.11.3  
soundfile\>=0.13.1  
torchaudio\>=2.0.0  
torch\>=2.0.0

is requirements.txt

here’s the link to space: [Dia 1.6B - a Hugging Face Space by nari-labs](https://huggingface.co/spaces/nari-labs/Dia-1.6B)

---

<div class="post-metadata">

**Author:** ![NariLabs](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/narilabs/32/46065_2.png) [@NariLabs](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FNariLabs)%5C
**Post date:** [April 22, 2025, 12:44am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftorch-cuda-is-available-is-false-on-zerogpu-space%2F151707%2F3 "2025-04-22T00:44:02Z")

</div>

Fixed it by using @spaces.  
Sorry for the noob-issue.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [April 22, 2025, 12:44pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftorch-cuda-is-available-is-false-on-zerogpu-space%2F151707%2F4 "2025-04-22T12:44:37Z")

</div>

Closed on April 22, 2025, 12:44pm UTC

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
