You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
问题现象
NPU 占用率为 0:执行推理时,通过 npu-smi info 查看 NPU 利用率始终为 0%
推理速度异常:device="npu" 推理耗时约 15.585 秒,device="cpu" 时速度更快
日志存在 NPU 加载信息但未生效
plaintext
(paddle_npu) root@autodl-container-d19d40bcb0-52560c5e:~/NPU-Nw-kf-aiep-sealrec-service# /root/miniconda3/envs/paddle_npu/bin/python /root/NPU-Nw-kf-aiep-sealrec-service/test_ppocr.py
Creating model: ('PP-OCRv5_mobile_det', None)
Using official model (PP-OCRv5_mobile_det), the model files will be automatically downloaded and saved in /root/.paddlex/official_models.
/root/miniconda3/envs/paddle_npu/lib/python3.10/site-packages/paddle/utils/cpp_extension/extension_utils.py:711: UserWarning: No ccache found. Please be aware that recompiling all source files may be required. You can download and install ccache from: https://github.com/ccache/ccache/blob/master/doc/INSTALL.md
warnings.warn(warning_message)
WARNING: OMP_NUM_THREADS set to 24, not 1. The computation speed will not be optimized if you use data parallel. It will fail if this PaddlePaddle binary is compiled with OpenBlas since OpenBlas does not support multi-threads.
PLEASE USE OMP_NUM_THREADS WISELY.
I0122 11:14:52.348821 814349 init.cc:237] ENV [CUSTOM_DEVICE_ROOT]=/root/miniconda3/envs/paddle_npu/lib/python3.10/site-packages/paddle_custom_device
I0122 11:14:52.348886 814349 init.cc:146] Try loading custom device libs from: [/root/miniconda3/envs/paddle_npu/lib/python3.10/site-packages/paddle_custom_device]
I0122 11:14:53.330207 814349 custom_device_load.cc:52] Succeed in loading custom runtime in lib: /root/miniconda3/envs/paddle_npu/lib/python3.10/site-packages/paddle_custom_device/libpaddle-custom-npu.so
I0122 11:14:53.330283 814349 custom_device_load.cc:59] Skipped lib [/root/miniconda3/envs/paddle_npu/lib/python3.10/site-packages/paddle_custom_device/libpaddle-custom-npu.so]: no custom engine Plugin symbol in this lib.
I0122 11:14:53.335661 814349 custom_kernel.cc:63] Succeed in loading 358 custom kernel(s) from loaded lib(s), will be used like native ones.
I0122 11:14:53.335866 814349 init.cc:158] Finished in LoadCustomDevice with libs_path: [/root/miniconda3/envs/paddle_npu/lib/python3.10/site-packages/paddle_custom_device]
I0122 11:14:53.335907 814349 init.cc:243] CustomDevice: npu, visible devices count: 1
Creating model: ('PP-OCRv5_mobile_rec', 'models/Seal_Check/paddleocr/PADDLEOCR/PP-OCRv5_rec')
推理时间: 15.585 秒
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
环境信息
硬件:华为昇腾 910B 服务器
软件版本
CANN: 8.0.0
npu-smi: 25.2.0 (Version: 25.2.0)
Python 包版本
plaintext
paddle-custom-npu 3.0.0 pypi_0 pypi
paddleocr 3.0.0 pypi_0 pypi
paddlepaddle 3.0.0 pypi_0 pypi
paddlex 3.0.0 pypi_0 pypi
torch 2.8.0 pypi_0 pypi
torch-npu 2.8.0 pypi_0 pypi
numpy 1.26.4
环境搭建文档:PaddlePaddle NPU 安装指南
基础验证结果
执行 PaddlePaddle NPU 健康检查命令:
bash
运行
python -c "import paddle; paddle.utils.run_check()"
输出结果(验证通过):
plaintext
Running verify PaddlePaddle program ...
I0122 09:31:12.683343 108175 pir_interpreter.cc:1541] New Executor is Running ...
I0122 09:31:12.688441 108175 pir_interpreter.cc:1564] pir interpreter is running by multi-thread mode ...
PaddlePaddle works well on 1 npu.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
复现代码
python
运行
from paddleocr import PaddleOCR
ppocr_model = PaddleOCR(
device="npu",
use_doc_unwarping=False,
use_doc_orientation_classify=False,
use_textline_orientation=False,
text_det_thresh=0.0,
text_det_box_thresh=0.6,
text_det_limit_side_len=736,
text_det_limit_type="max",
text_det_unclip_ratio=1.5,
text_detection_model_name="PP-OCRv5_mobile_det",
text_detection_model_dir="models//PP-OCRv5_det",
text_recognition_model_name="PP-OCRv5_mobile_rec",
text_recognition_model_dir="models//PP-OCRv5_rec"
)
执行推理(示例)
result = ppocr_model.ocr("test_image.jpg")
问题现象
NPU 占用率为 0:执行推理时,通过 npu-smi info 查看 NPU 利用率始终为 0%
推理速度异常:device="npu" 推理耗时约 15.585 秒,device="cpu" 时速度更快
日志存在 NPU 加载信息但未生效
plaintext
(paddle_npu) root@autodl-container-d19d40bcb0-52560c5e:~/NPU-Nw-kf-aiep-sealrec-service# /root/miniconda3/envs/paddle_npu/bin/python /root/NPU-Nw-kf-aiep-sealrec-service/test_ppocr.py
Creating model: ('PP-OCRv5_mobile_det', None)
Using official model (PP-OCRv5_mobile_det), the model files will be automatically downloaded and saved in /root/.paddlex/official_models.
/root/miniconda3/envs/paddle_npu/lib/python3.10/site-packages/paddle/utils/cpp_extension/extension_utils.py:711: UserWarning: No ccache found. Please be aware that recompiling all source files may be required. You can download and install ccache from: https://github.com/ccache/ccache/blob/master/doc/INSTALL.md
warnings.warn(warning_message)
WARNING: OMP_NUM_THREADS set to 24, not 1. The computation speed will not be optimized if you use data parallel. It will fail if this PaddlePaddle binary is compiled with OpenBlas since OpenBlas does not support multi-threads.
PLEASE USE OMP_NUM_THREADS WISELY.
I0122 11:14:52.348821 814349 init.cc:237] ENV [CUSTOM_DEVICE_ROOT]=/root/miniconda3/envs/paddle_npu/lib/python3.10/site-packages/paddle_custom_device
I0122 11:14:52.348886 814349 init.cc:146] Try loading custom device libs from: [/root/miniconda3/envs/paddle_npu/lib/python3.10/site-packages/paddle_custom_device]
I0122 11:14:53.330207 814349 custom_device_load.cc:52] Succeed in loading custom runtime in lib: /root/miniconda3/envs/paddle_npu/lib/python3.10/site-packages/paddle_custom_device/libpaddle-custom-npu.so
I0122 11:14:53.330283 814349 custom_device_load.cc:59] Skipped lib [/root/miniconda3/envs/paddle_npu/lib/python3.10/site-packages/paddle_custom_device/libpaddle-custom-npu.so]: no custom engine Plugin symbol in this lib.
I0122 11:14:53.335661 814349 custom_kernel.cc:63] Succeed in loading 358 custom kernel(s) from loaded lib(s), will be used like native ones.
I0122 11:14:53.335866 814349 init.cc:158] Finished in LoadCustomDevice with libs_path: [/root/miniconda3/envs/paddle_npu/lib/python3.10/site-packages/paddle_custom_device]
I0122 11:14:53.335907 814349 init.cc:243] CustomDevice: npu, visible devices count: 1
Creating model: ('PP-OCRv5_mobile_rec', 'models/Seal_Check/paddleocr/PADDLEOCR/PP-OCRv5_rec')
推理时间: 15.585 秒
Beta Was this translation helpful? Give feedback.
All reactions