Add nvidia-cuda-runtime + LD_LIBRARY_PATH shim so nvdiffrast's JIT-compiled CUDA extension can find libcudart.so.13 on Blackwell/CUDA-13 ZeroGPU workers
Browse files- app.py +10 -0
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -13,6 +13,16 @@ from glob import glob
|
|
| 13 |
import requests
|
| 14 |
from huggingface_hub import snapshot_download
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
# Download models
|
| 17 |
os.makedirs("ckpts", exist_ok=True)
|
| 18 |
|
|
|
|
| 13 |
import requests
|
| 14 |
from huggingface_hub import snapshot_download
|
| 15 |
|
| 16 |
+
# nvdiffrast JIT-compiles a native CUDA extension against the container's system
|
| 17 |
+
# CUDA toolkit; on ZeroGPU workers with a driver reporting CUDA 13 (e.g. Blackwell
|
| 18 |
+
# MIG slices), libcudart.so.13 isn't on the default linker search path, so pull it
|
| 19 |
+
# in from the nvidia-cuda-runtime pip package instead.
|
| 20 |
+
import sysconfig
|
| 21 |
+
|
| 22 |
+
_cu13_lib_dir = os.path.join(sysconfig.get_paths()["purelib"], "nvidia", "cu13", "lib")
|
| 23 |
+
if os.path.isdir(_cu13_lib_dir):
|
| 24 |
+
os.environ["LD_LIBRARY_PATH"] = _cu13_lib_dir + os.pathsep + os.environ.get("LD_LIBRARY_PATH", "")
|
| 25 |
+
|
| 26 |
# Download models
|
| 27 |
os.makedirs("ckpts", exist_ok=True)
|
| 28 |
|
requirements.txt
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
spaces
|
| 2 |
setuptools<82
|
|
|
|
| 3 |
torch==2.1.2 --index-url https://download.pytorch.org/whl/cu121
|
| 4 |
torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu121
|
| 5 |
torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121
|
|
|
|
| 1 |
spaces
|
| 2 |
setuptools<82
|
| 3 |
+
nvidia-cuda-runtime
|
| 4 |
torch==2.1.2 --index-url https://download.pytorch.org/whl/cu121
|
| 5 |
torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu121
|
| 6 |
torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121
|