|
1 | 1 | # MinerU Gaudi 部署指南 |
2 | 2 |
|
3 | | -本指南提供在 MinerU v2.5.4 上使用 Intel Gaudi 作为硬件加速器通过 pipeline后端/VLLM 后端进行部署的详细步骤。 |
| 3 | +本指南提供在 MinerU v2.5.4 和 MinerU v2.6.4 上使用 Intel Gaudi 作为硬件加速器通过 pipeline后端/VLLM 后端进行部署的详细步骤。 |
4 | 4 |
|
5 | 5 | ## 前提条件 |
6 | 6 |
|
7 | 7 | - 已安装 Intel Gaudi 软件栈 |
8 | 8 | - 支持 Gaudi 对应驱动版本的基础Docker镜像 |
9 | 9 |
|
10 | | -## 使用MinerU v2.5.4 |
| 10 | +## 使用MinerU v2.5.4,v2.6.4 |
11 | 11 |
|
12 | 12 | ### 1. 启动docker |
13 | 13 |
|
@@ -55,11 +55,30 @@ https://github.com/opendatalab/MinerU/blob/master/mineru.template.json |
55 | 55 |
|
56 | 56 | ```bash |
57 | 57 | git clone https://github.com/HabanaAI/vllm-fork.git -b aice/v1.22.0 |
58 | | -pip install -e . -i https://mirrors.aliyun.com/pypi/simple |
59 | 58 | git clone https://github.com/vllm-project/vllm.git |
60 | 59 | cp -r vllm/vllm/v1/sample/logits_processor vllm-fork/vllm/v1/sample/logits_processor |
| 60 | +cd vllm-fork |
| 61 | +VLLM_TARGET_DEVICE=hpu pip install . -i https://mirrors.aliyun.com/pypi/simple |
61 | 62 | ``` |
62 | 63 |
|
| 64 | +以下修改针对minerU 2.5.4 及2.6.x 版本中出现的问题 |
| 65 | +mineru.cli.client:parse_doc:211 - name 'LogitsProcessor' is not defined |
| 66 | +在docker 内部修改 MinerULogitsProcessors配置,替换v1的LogitsProcessor |
| 67 | + /usr/local/lib/python3.10/dist-packages/mineru_vl_utils/__init__.py |
| 68 | +'''bash |
| 69 | +--- __init__.py.prev 2025-11-24 01:09:19.275702572 +0000 |
| 70 | ++++ __init__.py 2025-11-24 01:08:36.723701017 +0000 |
| 71 | +@@ -7,7 +7,7 @@ |
| 72 | + __lazy_attrs__ = { |
| 73 | + "MinerUClient": (".mineru_client", "MinerUClient"), |
| 74 | + "MinerUSamplingParams": (".mineru_client", "MinerUSamplingParams"), |
| 75 | +- "MinerULogitsProcessor": (".logits_processor.vllm_v1_no_repeat_ngram", "VllmV1NoRepeatNGramLogitsProcessor"), |
| 76 | +- "MinerULogitsProcessor": (".logits_processor.vllm_v0_no_repeat_ngram", "VllmV0NoRepeatNGramLogitsProcessor"), |
| 77 | + } |
| 78 | + |
| 79 | + if TYPE_CHECKING: |
| 80 | +''' |
| 81 | + |
63 | 82 | #### 4.2 在Gaudi上运行vlm-vllm-engine backend |
64 | 83 |
|
65 | 84 | #### 4.2.1 设置环境变量 |
@@ -94,7 +113,7 @@ export VLLM_FP32_SOFTMAX_VISION=true |
94 | 113 | #### 4.2.2 使用命令行方式运行Mineru |
95 | 114 |
|
96 | 115 | ```bash |
97 | | -mineru -p <input_path> -o <output_path> -b vlm-vllm-engine |
| 116 | +mineru -p <input_path> -o <output_path> -b vlm-vllm-engine |
98 | 117 | ``` |
99 | 118 |
|
100 | 119 | #### 4.2.3 使用 http-client/server 方式运行Mineru |
@@ -218,3 +237,49 @@ vim /usr/local/lib/python3.10/dist-packages/ultralytics/nn/autobackend.py |
218 | 237 | ```bash |
219 | 238 | $ MINERU_DEVICE_MODE=hpu mineru -p ./test.pdf -o ./ -d hpu -b pipeline -m ocr |
220 | 239 | ``` |
| 240 | +
|
| 241 | +### 6. 针对MinerU v2.6.4 相关更新 |
| 242 | +
|
| 243 | +#### 6.1 部署方式 |
| 244 | +
|
| 245 | +在v2.6.4 上部署vllm-backend和pipeline backend命令与v2.5.4相同,可以参考前面5个章节内容进行 |
| 246 | +
|
| 247 | +#### 6.2 新功能支持 |
| 248 | +
|
| 249 | +MinerU 天枢API 服务部署在Gaudi上的支持。 |
| 250 | +天枢服务主要提供面向企业基的增强服务部署,在Gaudi上已经验证了单卡单worker部署方式。 |
| 251 | +天枢服务包括但不限于如下功能: |
| 252 | +##### 企业级功能 |
| 253 | +- ✅ **异步处理** - 客户端立即响应(~100ms),无需等待处理完成 |
| 254 | +- ✅ **任务持久化** - SQLite 存储,服务重启任务不丢失 |
| 255 | +- ✅ **优先级队列** - 重要任务优先处理 |
| 256 | +- ✅ **自动清理** - 定期清理旧结果文件,保留数据库记录 |
| 257 | +
|
| 258 | +项目链接 |
| 259 | +https://github.com/opendatalab/MinerU/tree/master/projects/mineru_tianshu |
| 260 | +
|
| 261 | +##### 部署步骤 |
| 262 | +''' bash |
| 263 | +cd MinerU/projects/mineru_tianshu |
| 264 | +pip install -r requirements.txt |
| 265 | +python start_all.py --workers-per-device 1 --devices auto 2>&1 \ |
| 266 | + | tee tianshu.log >/dev/null & |
| 267 | +
|
| 268 | +''' |
| 269 | +#### API 访问 |
| 270 | +Gaudi 目前支持vlm-vllm-engine访问方式 |
| 271 | +''' |
| 272 | +curl -X 'POST' \ |
| 273 | + 'http://10.239.129.55:8000/api/v1/tasks/submit' \ |
| 274 | + -H 'accept: application/json' \ |
| 275 | + -H 'Content-Type: multipart/form-data' \ |
| 276 | + -F '[email protected];type=application/pdf' \ |
| 277 | + -F 'backend=vlm-vllm-engine' \ |
| 278 | + -F 'lang=ch' \ |
| 279 | + -F 'method=auto' \ |
| 280 | + -F 'formula_enable=true' \ |
| 281 | + -F 'table_enable=true' \ |
| 282 | + -F 'priority=0' |
| 283 | +''' |
| 284 | +详细API 参考 |
| 285 | +http://localhost:8000/docs |
0 commit comments