MinerU icon indicating copy to clipboard operation
MinerU copied to clipboard

CUDA device is not set properly

Open HakunanMatatat opened this issue 1 year ago • 1 comments

Description of the bug | 错误描述

在win11的docker 里安装后,运行magic-pdf -p /home/data/12_Malovichko.pdf -o /home/data/output -m auto,运行中cuda 出错。但是cuda 显示已经安装好了,不过nvcc -v出错了。

PS C:\Users\AQUANAUT> docker run --rm --gpus=all nvidia/cuda:12.1.0-base-ubuntu22.04 nvidia-smi Fri Nov 22 11:53:49 2024 +-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 560.35.02 Driver Version: 560.94 CUDA Version: 12.6 | |-----------------------------------------+------------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| | 0 NVIDIA GeForce RTX 4060 On | 00000000:01:00.0 On | N/A | | 0% 30C P8 N/A / 115W | 940MiB / 8188MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=========================================================================================| | 0 N/A N/A 20 G /Xwayland N/A | | 0 N/A N/A 20 G /Xwayland N/A | | 0 N/A N/A 23 G /Xwayland N/A | +-----------------------------------------------------------------------------------------+

How to reproduce the bug | 如何复现

root@2d5fcb104a8a:/home/data/output# magic-pdf -p /home/data/12_Malovichko.pdf -o /home/data/output -m auto
2024-11-22 11:44:44.284 | INFO     | magic_pdf.libs.pdf_check:detect_invalid_chars:57 - cid_count: 147, text_len: 23246, cid_chars_radio: 0.006614173228346456
/opt/mineru_venv/lib/python3.10/site-packages/paddle/base/framework.py:743: UserWarning: You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default.
  warnings.warn(
import tensorrt_llm failed, if do not use tensorrt, ignore this message
import lmdeploy failed, if do not use lmdeploy, ignore this message
2024-11-22 11:44:49.582 | INFO     | magic_pdf.model.pdf_extract_kit:__init__:68 - DocAnalysis init, this may take some times, layout_model: layoutlmv3, apply_formula: True, apply_ocr: False, apply_table: False, table_model: rapid_table, lang: None
2024-11-22 11:44:49.582 | INFO     | magic_pdf.model.pdf_extract_kit:__init__:77 - using device: cuda
2024-11-22 11:44:49.582 | INFO     | magic_pdf.model.pdf_extract_kit:__init__:79 - using models_dir: /root/.cache/modelscope/hub/opendatalab/PDF-Extract-Kit-1___0/models
CustomVisionEncoderDecoderModel init
VariableUnimerNetModel init
VariableUnimerNetPatchEmbeddings init
VariableUnimerNetModel init
VariableUnimerNetPatchEmbeddings init
CustomMBartForCausalLM init
CustomMBartDecoder init
2024-11-22 11:44:55.035 | ERROR    | magic_pdf.tools.cli:parse_doc:109 - Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 500: named symbol not found
Traceback (most recent call last):

Operating system | 操作系统

Linux

Python version | Python 版本

3.10

Software version | 软件版本 (magic-pdf --version)

0.9.x

Device mode | 设备模式

cuda

HakunanMatatat avatar Nov 22 '24 11:11 HakunanMatatat

windows的docker好像要装个wsl专用的驱动,你要不试试直接在windows装conda直接用pip装呢?

myhloli avatar Nov 22 '24 14:11 myhloli

我遇到了类似的问题,解决方案:https://github.com/NVIDIA/nvidia-container-toolkit/issues/520

对我而言,只需要更新docker desktop即可修复

pth2000 avatar Apr 19 '25 05:04 pth2000