Pull requests / #2382
#2382 setup: put the CUDA runtime DLLs (bin\x64) on the image job's search path on Windows
open · @hogtinbao · 0 Kommentare · Auf GitHub
Setup & installServer & APINVIDIA / CUDAWindowsLinux
Beschreibung
Fixes #2381.
## The bug
`setup.py`'s `build_image_engine` recorded `lib_dirs` for a Windows CUDA build as `<CUDA_ROOT>\bin`:
```python
lib_dirs = [str(root / "bin")] if WIN else [str(d) for d in (root / "lib64", root / "lib") if d.is_dir()]
```
CUDA 12 moved the runtime libraries to `<CUDA_ROOT>\bin\x64`; `bin` keeps only the tools (`nvcc.exe`, `ptxas.exe`, `nvlink.exe`, ...). On a CUDA 13.0.2 install:
```
<CUDA_ROOT>\bin\*.dll 0 files
<CUDA_ROOT>\bin\x64\*.dll 27 files (cublas64_13.dll, cublasLt64_13.dll, cudart64_13.dll, ...)
```
`tools/image/install.py` stores that list in the run config (`images.lib_dirs`), and `serve/images.py` / `serve/server.py` prepend it to the child's `PATH`. So `sd-cli.exe` cannot resolve `cublas64_13.dll`, exits with `3221225781` (`0xC0000135`, `STATUS_DLL_NOT_FOUND`), and the API answers:
```
HTTP 500 {"error": {"type": "server_error", "code": "image_generation_failed",
"message": "sd-cli exited with code 3221225781; the end of its log:\n"}}
```
Anyone who installs CUDA on Windows and enables image generation hits this; nothing else in the build or the three model files is at fault.
## The fix
```python
lib_dirs = ([str(d) for d in (root / "bin" / "x64", root / "bin") if d.is_dir()] if WIN
else [str(d) for d in (root / "lib64", root / "lib") if d.is_dir()])
```
`bin\x64` first, `bin` second, so CUDA 11 (DLLs in `bin`), CUDA 12/13 (`bin\x64`), and any layout that has both are covered. The Linux branch is untouched.
## Verification
- On a real CUDA 13.0.2 root the new expression returns `[<CUDA>\bin\x64, <CUDA>\bin]` with `cublas64_13.dll` present in the first entry, where the old expression returned only `<CUDA>\bin` (0 DLLs in it).
- `python -m unittest tools.test_qimage` → 14 tests OK; `python -m unittest serve.test_images` → 19 tests OK.
- End to end on Windows 11 / RTX 5070 Ti 12 GB / CUDA 13.0.2 / `Q6_K`, with `images.lib_dirs` hand-patched the same way: `POST /v1/images/generations` renders 512×512 in ~21 s and 1024×1024 in ~26 s.
Mehr auf der Site
Links zu Install, Modellen, Releases.