在昇腾910B服务上部署搭建适配PDF解析工具Mineru2.5开源项目
文章目录
一、在昇腾社区下载适用的mindie镜像并运行容器
powershell
docker run -itd \
--shm-size=500g \
--net=host \
--privileged \
--name mindie \
--restart=always \
--device=/dev/davinci4 \
--device=/dev/davinci5 \
--device=/dev/davinci_manager \
--device=/dev/devmm_svm \
--device=/dev/hisi_hdc \
-v /usr/local/Ascend/driver/:/usr/local/Ascend/driver/ \
-v /usr/local/Ascend/add-ons/:/usr/local/Ascend/add-ons/ \
-v /usr/local/sbin/:/usr/local/sbin/ \
-v /var/log/npu/slog/:/var/log/npu/slog \
-v /var/log/npu/profiling/:/var/log/npu/profiling \
-v /var/log/npu/dump/:/var/log/npu/dump \
-v /var/log/npu/:/usr/slog \
-v /etc/hccn.conf:/etc/hccn.conf \
swr.cn-south-1.myhuaweicloud.com/ascendhub/mindie:2.0.RC1-800I-A2-py311-openeuler24.03-lts \
/bin/bash
二、安装系统运行所需要的依赖
进入容器并执行
powershell
yum install -y mesa-libGL mesa-libGL-devel libXrender libSM libXext tesseract tesseract-langpack-chi_sim
三、安装mineru所需python依赖并设置环境变量
由博主多次测试失败找到的版本号
报错列举一下
1、报错一
operator torchvision::nms does not exist
是这个torchvision和torch没有对应的结果
2、报错二
ERR00100 PTA call acl api failed
Error\]: The internal ACL of the system is incorrect. Rectify the fault based on the error information in the ascend log. EC0010: Failed to import Python module \[AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead...\]. 这个是昇腾软件栈与NumPy 2.0不兼容 ##### 3、报错三 An error happened while trying to locate the files on the Hub and we cannot find the appropriate snapshot folder for the specified revision on the local disk. Please check your internet connection and try again. 这个是必需配置本地模型:export MINERU_MODEL_SOURCE=local ##### 4、报错四 ImportError: /usr/local/lib64/python3.11/site-packages/torch_npu/lib/libtorch_npu.so: undefined symbol: _ZNK5torch8autograd4Node4nameEv 这个是torch和torch_npu版本不匹配 [安装版本](https://gitee.com/ascend/pytorch/releases/tag/v7.1.0.2-pytorch2.5.1) ```powershell pip install torchvision==0.20.1 numpy==1.26.4 torch==2.5.1 accelerate==1.10.1 pip install torch_npu-2.5.1.post3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl ``` 环境变量设置 ```powershell export MINERU_MODEL_SOURCE=local export HF_ENDPOINT=https://hf-mirror.com ``` #### 四、部署Mineru项目 core 模块是 MinerU 的核心依赖,包含了除vllm外的所有功能模块。安装此模块可以确保 MinerU 的基本功能正常运行 ```powershell pip install mineru[core] ``` 下载模型 ```powershell mineru-models-download ``` 下载源选择modelscope NPU支持跑pipeline #### 五、运行测试 mineru-gradio --device npu --server-name 0.0.0.0 --server-port 7860   