Enable PaddleOCR GPU on Linux / CUDA 12#25
Open
chsbusch-dot wants to merge 2 commits into
Open
Conversation
CodeProject.AI's ALPR runs PaddleOCR on CPU on CUDA-12 Linux hosts due to three issues; this fixes all three so the module uses the GPU: - requirements.linux.cuda12.txt had a bare `paddlepaddle-gpu`, but PyPI only ships CUDA<=11.7 builds, so a non-CUDA-12 build (or none) was installed. Pin 2.6.2.post120 and add Paddle's cu120 package index so the real CUDA-12 wheel is used. (Works on CUDA 12.0-12.7 drivers via forward compat.) - modulesettings.linux.json hardcoded "InstallGPU": false (stale "GPU only installs easily on Windows" assumption). Flip to true so the adapter's enable_GPU isn't forced off. - install.sh: Paddle dlopens the unversioned libcudnn.so, but Ubuntu ships only libcudnn.so.8. Symlink it during install so cuDNN loads. Verified on an RTX A5000 (CUDA 12.4/12.7 driver, cuDNN 8.9) container: ALPR now reports inferenceDevice=GPU. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tall The CUDA-12 wheel is served only from Paddle's China-hosted index, which many networks/VMs cannot reach — so the requirements install silently gets no CUDA build and ALPR runs on CPU. install.sh now falls back to a wheel placed in the module's wheels/ folder when paddlepaddle isn't already installed. Adds wheels/README.md documenting where to get the wheel. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upstream notes "GPU support on Linux is not currently supported." In practice that's three separate, fixable issues. This PR fixes all three so the ALPR module reports
inferenceDevice=GPUon a Linux / CUDA-12 host.Tested on an RTX A5000 (CUDA 12.4 / 12.7 driver, cuDNN 8.9, Python 3.8).
Changes
requirements.linux.cuda12.txt—paddlepaddle-gpuwas unpinned, but PyPI only ships CUDA ≤ 11.7 builds, so the CUDA-12 build was never installed and ALPR silently ran on CPU. Pinpaddlepaddle-gpu==2.6.2.post120and add Paddle's cu120 package index via--extra-index-url. (Runs on CUDA 12.0–12.7 drivers via minor-version forward compatibility.)modulesettings.linux.json—"InstallGPU": falseforced the adapter'senable_GPUoff even when a capable GPU was present (use_gpu = enable_GPU and can_use_GPU). Set totrue.install.sh— PaddlePaddledlopens the unversionedlibcudnn.so, but Ubuntu's cuDNN package ships onlylibcudnn.so.8, causingPreconditionNotMetError: Cannot load cudnn shared library. Symlinklibcudnn.so → libcudnn.so.8on Linux x86_64 during install (guarded: only if the versioned lib exists and the link is missing).Notes
2.6.2.post120+paddleocr==2.7.0.3..post120wheel is China-hosted (paddlepaddle.org.cn/bcebos.com); on networks that can't reach it, download the wheel elsewhere andpip installthe local file. TheInstallGPUflip andlibcudnn.sosymlink need no network and apply regardless.Testing
and the ALPR module status reports
inferenceDevice: GPU.