Skip to content

npu 310p3部署推理报错 #2580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
truthsun22 opened this issue Jun 6, 2025 · 0 comments
Open
3 tasks done

npu 310p3部署推理报错 #2580

truthsun22 opened this issue Jun 6, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@truthsun22
Copy link

🔎 Search before asking | 提交之前请先搜索

  • I have searched the MinerU Readme and found no similar bug report.
  • I have searched the MinerU Issues and found no similar bug report.
  • I have searched the MinerU Discussions and found no similar bug report.

Description of the bug | 错误描述

华为310p3 npu,一开始报找不到libascend_hal.so,我把libascend_hal.so添加到环境变量后,又报这个错
25-06-06 01:57:46.943 | ERROR | api.analysis.pdf_ext:analysis_pdf:59 - Traceback (most recent call last):
File "/app/web_demo/api/analysis/pdf_ext.py", line 45, in analysis_pdf
infer_result = ds.apply(doc_analyze, ocr=False)
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/data/dataset.py", line 214, in apply
return proc(self, *args, **kwargs)
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/model/doc_analyze_by_custom_model.py", line 163, in doc_analyze
result = may_batch_image_analyze(batch_image, ocr, show_log,layout_model, formula_enable, table_enable)
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/model/doc_analyze_by_custom_model.py", line 288, in may_batch_image_analyze
results = batch_model(images_with_extra_info)
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/model/batch_analyze.py", line 33, in call
self.model = self.model_manager.get_model(
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/model/doc_analyze_by_custom_model.py", line 46, in get_model
self._models[key] = custom_model_init(
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/model/doc_analyze_by_custom_model.py", line 111, in custom_model_init
custom_model = CustomPEKModel(**model_input)
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/model/pdf_extract_kit.py", line 109, in init
self.mfr_model = atom_model_manager.get_atom_model(
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/model/sub_modules/model_init.py", line 150, in get_atom_model
self._models[key] = atom_model_init(model_name=atom_model_name, **kwargs)
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/model/sub_modules/model_init.py", line 176, in atom_model_init
atom_model = mfr_model_init(
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/model/sub_modules/model_init.py", line 75, in mfr_model_init
mfr_model = UnimernetModel(weight_dir, cfg_path, device)
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/model/sub_modules/mfr/unimernet/Unimernet.py", line 29, in init
self.model.to(device)
File "/opt/mineru_venv/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3851, in to
return super().to(*args, **kwargs)
File "/opt/mineru_venv/lib/python3.10/site-packages/torch_npu/utils/_module.py", line 75, in to
return self._apply(convert)
File "/opt/mineru_venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 779, in _apply
module._apply(fn)
File "/opt/mineru_venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 779, in _apply
module._apply(fn)
File "/opt/mineru_venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 779, in _apply
module._apply(fn)
[Previous line repeated 2 more times]
File "/opt/mineru_venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 804, in _apply
param_applied = fn(param)
File "/opt/mineru_venv/lib/python3.10/site-packages/torch_npu/utils/_module.py", line 73, in convert
return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
File "/opt/mineru_venv/lib/python3.10/site-packages/torch_npu/npu/init.py", line 214, in _lazy_init
torch_npu._C._npu_init()
RuntimeError: GetDevice:build/CMakeFiles/torch_npu.dir/compiler_depend.ts:54 NPU function error: aclrtGetCurrentContext(&used_devices[local_device]), error code is 107002
[ERROR] 2025-06-06-01:57:46 (PID:48, Device:0, RankID:-1) ERR00100 PTA call acl api failed
[Error]: The context is empty.
Check whether acl.rt.set_context or acl.rt.set_device is called.
EE1001: 2025-06-06-01:57:46.938.925 The argument is invalid.Reason: rtGetDevMsg execute failed, reason=[context pointer null]
Solution: 1.Check the input parameter range of the function. 2.Check the function invocation relationship.
TraceBack (most recent call last):
[Init][Version]init soc version failed, ret = 507008[FUNC:ReportInnerError][FILE:log_inner.cpp][LINE:145]
ctx is NULL![FUNC:GetDevErrMsg][FILE:api_impl.cc][LINE:4916]
The argument is invalid.Reason: rtGetDevMsg execute failed, reason=[context pointer null]

Traceback (most recent call last):
File "/app/web_demo/api/analysis/pdf_ext.py", line 103, in analysis_pdf_task
md_content, bbox_info = analysis_pdf(image_url_prefix, image_dir, pdf_bytes, is_ocr)
TypeError: cannot unpack non-iterable NoneType object

2025-06-06 01:57:46.966 | ERROR | api.analysis.pdf_ext:analysis_pdf_task:145 - Traceback (most recent call last):
File "/app/web_demo/api/analysis/pdf_ext.py", line 103, in analysis_pdf_task
md_content, bbox_info = analysis_pdf(image_url_prefix, image_dir, pdf_bytes, is_ocr)
TypeError: cannot unpack non-iterable NoneType object

How to reproduce the bug | 如何复现

310p机器上拉取minerU npu镜像,按readme说明启动容器

Operating System Mode | 操作系统类型

No response

Operating System Version| 操作系统版本

UOS Server 20 arm 64

Python version | Python 版本

3.10

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

1.3.x

Device mode | 设备模式

npu

@truthsun22 truthsun22 added the bug Something isn't working label Jun 6, 2025
@truthsun22 truthsun22 changed the title npu 310p3 npu 310p3部署推理报错 Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant