Skip to content

Commit 2ecf893

Browse files
localai-botmudler
andauthored
fix(sherpa-onnx): install cuDNN in the CUDA builder so the package can bundle it (#11145)
sherpa-onnx links onnxruntime's CUDA execution provider, and libonnxruntime_providers_cuda.so carries cuDNN as a hard DT_NEEDED. The onnxruntime GPU tarball ships no cuDNN of its own, and Dockerfile.golang only installs libcudnn9 on the arm64 + CUDA 13 branch, so the amd64 CUDA builders have none at all. Since #10946 added the packaging guard, that combination is fatal rather than silent: package-gpu-libs.sh reports 'cuDNN: venv=absent system=absent -> bundle=detect', correctly detects the reference, finds nothing to copy and refuses to emit the package. Both -gpu-nvidia-cuda-12-sherpa-onnx and -gpu-nvidia-cuda-13-sherpa-onnx have failed to build since 2026-07-19, so neither image has been published. Before the guard existed they shipped without cuDNN and failed at load time instead. Install the runtime package for this backend only. The auto-detection bundles solely what a package references, so no other backend would grow, but every Go CUDA builder would pay ~1.1 GB of layer and registry cache for a library ggml never calls. Assisted-by: Claude Code:claude-opus-5 [Read] [Edit] [Bash] Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 05ff401 commit 2ecf893

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

backend/Dockerfile.golang

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,33 @@ RUN if [ "${BACKEND}" = "crispasr" ]; then \
221221
apt-get clean && rm -rf /var/lib/apt/lists/*; \
222222
fi
223223

224+
# sherpa-onnx links onnxruntime's CUDA execution provider, and
225+
# libonnxruntime_providers_cuda.so has cuDNN as a hard DT_NEEDED. The
226+
# onnxruntime GPU tarball does not ship cuDNN itself, so without this the
227+
# builder has none (the arm64 + CUDA 13 branch above is the only other place
228+
# that installs it) and package-gpu-libs.sh correctly refuses to produce a
229+
# package that references cuDNN with no cuDNN available to it.
230+
#
231+
# Installed per-backend rather than for every cublas build: the auto-detection
232+
# in package-gpu-libs.sh bundles only what a package actually references, so
233+
# the ggml backends would not grow either way, but they would all pay ~1.1 GB
234+
# of builder layer and registry cache for a library they never call.
235+
#
236+
# Runtime package only, no -dev: sherpa-onnx consumes onnxruntime's prebuilt
237+
# CUDA provider and never compiles against cuDNN headers. libcudnn9-cuda-N
238+
# carries the dispatcher plus all seven dlopen()ed sublibraries, which is what
239+
# complete_cudnn_family needs to assemble a whole bundle.
240+
RUN <<EOT bash
241+
if [ "${BACKEND}" = "sherpa-onnx" ] && [ "${BUILD_TYPE}" = "cublas" ] && [ "${SKIP_DRIVERS}" = "false" ]; then
242+
apt-get update && \
243+
apt-get install -y --no-install-recommends \
244+
libcudnn9-cuda-${CUDA_MAJOR_VERSION} && \
245+
ldconfig && \
246+
apt-get clean && \
247+
rm -rf /var/lib/apt/lists/*
248+
fi
249+
EOT
250+
224251
COPY . /LocalAI
225252

226253
RUN git config --global --add safe.directory /LocalAI

0 commit comments

Comments
 (0)