Skip to content

Commit cf489fe

Browse files
authored
Merge pull request #4105 from opendatalab/release-2.6.6
Release 2.6.6
2 parents 0e7b480 + db666bf commit cf489fe

File tree

14 files changed

+524
-87
lines changed

14 files changed

+524
-87
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@
4444
</div>
4545

4646
# Changelog
47+
48+
- 2025/12/02 2.6.6 Release
49+
- `mineru-api` tool optimizations
50+
- Added descriptive text to `mineru-api` interface parameters to improve API documentation readability.
51+
- You can use the environment variable `MINERU_API_ENABLE_FASTAPI_DOCS` to control whether the auto-generated interface documentation page is enabled (enabled by default).
52+
- Added concurrency configuration options for the `vlm-vllm-async-engine`, `vlm-lmdeploy-engine`, and `vlm-http-client` backends. Users can use the environment variable `MINERU_API_MAX_CONCURRENT_REQUESTS` to set the maximum number of concurrent API requests (unlimited by default).
53+
4754
- 2025/11/26 2.6.5 Release
4855
- Added support for a new backend vlm-lmdeploy-engine. Its usage is similar to vlm-vllm-(async)engine, but it uses lmdeploy as the inference engine and additionally supports native inference acceleration on Windows platforms compared to vllm.
4956

@@ -797,6 +804,8 @@ Currently, some models in this project are trained based on YOLO. However, since
797804
- [pdfminer.six](https://github.com/pdfminer/pdfminer.six)
798805
- [pypdf](https://github.com/py-pdf/pypdf)
799806
- [magika](https://github.com/google/magika)
807+
- [vLLM](https://github.com/vllm-project/vllm)
808+
- [LMDeploy](https://github.com/InternLM/lmdeploy)
800809

801810
# Citation
802811

README_zh-CN.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@
4545

4646
# 更新记录
4747

48+
- 2025/12/02 2.6.6 发布
49+
- `Ascend`适配优化
50+
- 优化命令行工具初始化流程,使Ascend适配方案中`vlm-vllm-engine`后端在命令行工具中可用。
51+
- 为Atlas 300I Duo(310p)设备更新适配文档。
52+
- `mineru-api`工具优化
53+
-`mineru-api`接口参数增加描述性文本,优化接口文档可读性。
54+
- 可通过环境变量`MINERU_API_ENABLE_FASTAPI_DOCS`控制是否启用自动生成的接口文档页面,默认为启用。
55+
-`vlm-vllm-async-engine``vlm-lmdeploy-engine``vlm-http-client`后端增加并发数配置选项,用户可通过环境变量`MINERU_API_MAX_CONCURRENT_REQUESTS`控制api接口的最大并发请求数,默认为不限制数量。
56+
4857
- 2025/11/26 2.6.5 发布
4958
- 增加新后端`vlm-lmdeploy-engine`支持,使用方式与`vlm-vllm-(async)engine`类似,但使用`lmdeploy`作为推理引擎,与`vllm`相比额外支持Windows平台原生推理加速。
5059
- 新增国产算力平台`昇腾/npu``平头哥/ppu``沐曦/maca`的适配支持,用户可在对应平台上使用`pipeline``vlm`模型,并使用`vllm`/`lmdeploy`引擎加速vlm模型推理,具体使用方式请参考[其他加速卡适配](https://opendatalab.github.io/MinerU/zh/usage/)
@@ -791,6 +800,8 @@ mineru -p <input_path> -o <output_path>
791800
- [pdfminer.six](https://github.com/pdfminer/pdfminer.six)
792801
- [pypdf](https://github.com/py-pdf/pypdf)
793802
- [magika](https://github.com/google/magika)
803+
- [vLLM](https://github.com/vllm-project/vllm)
804+
- [LMDeploy](https://github.com/InternLM/lmdeploy)
794805

795806
# Citation
796807

docker/china/npu.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 基础镜像配置 vLLM 或 LMDeploy ,请根据实际需要选择其中一个,要求 ARM(AArch64) CPU + Ascend NPU。
22
# Base image containing the vLLM inference environment, requiring ARM(AArch64) CPU + Ascend NPU.
3-
FROM quay.io/ascend/vllm-ascend:v0.11.0rc2
3+
FROM quay.m.daocloud.io/ascend/vllm-ascend:v0.11.0rc2
44
# Base image containing the LMDeploy inference environment, requiring ARM(AArch64) CPU + Ascend NPU.
55
# FROM crpi-4crprmm5baj1v8iv.cn-hangzhou.personal.cr.aliyuncs.com/lmdeploy_dlinfer/ascend:mineru-a2
66

docs/zh/usage/acceleration_cards/Ascend.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,36 @@ docker: 20.10.12
1414
>Ascend加速卡支持使用`vllm``lmdeploy`进行VLM模型推理加速。请根据实际需求选择安装和使用其中之一:
1515
1616
### 2.1 使用 Dockerfile 构建镜像 (vllm)
17+
> [!TIP]
18+
> ascend-vllm支持设备如下:
19+
>
20+
> - Atlas A2 training series (Atlas 800T A2, Atlas 900 A2 PoD, Atlas 200T A2 Box16, Atlas 300T A2)
21+
> - Atlas 800I A2 inference series (Atlas 800I A2)
22+
> - Atlas A3 training series (Atlas 800T A3, Atlas 900 A3 SuperPoD, Atlas 9000 A3 SuperPoD)
23+
> - Atlas 800I A3 inference series (Atlas 800I A3)
24+
> - [Experimental] Atlas 300I inference series (Atlas 300I Duo)
25+
>
26+
> Dockerfile文件第三行为ascend-vllm基础镜像信息,默认tag为A2适配的版本,例如 `v0.11.0rc2`
27+
>
28+
> - 如需使用A3适配的版本,请将第三行的tag修改为 `v0.11.0rc2-a3`,然后再执行build操作。
29+
> - 如需使用Atlas 300I Duo适配的版本,请将第三行的tag修改为 `v0.10.0rc1-310p`,然后再执行build操作。
30+
1731

1832
```bash
1933
wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/china/npu.Dockerfile
2034
docker build --network=host -t mineru:npu-vllm-latest -f npu.Dockerfile .
21-
```
35+
```
2236

2337
### 2.2 使用 Dockerfile 构建镜像 (lmdeploy)
2438

39+
> [!TIP]
40+
> ascend-lmdeploy支持设备如下:
41+
>
42+
> - Atlas A2 training series (Atlas 800T A2, Atlas 900 A2 PoD, Atlas 200T A2 Box16, Atlas 300T A2)
43+
> - Atlas 800I A2 inference series (Atlas 800I A2)
44+
>
45+
> 如果您的设备为Atlas A3系列或Atlas 300I Duo系列,请使用vllm版本的镜像。
46+
2547
```bash
2648
wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/china/npu.Dockerfile
2749
# 将基础镜像从 vllm 切换为 lmdeploy
@@ -51,6 +73,7 @@ docker run -u root --name mineru_docker --privileged=true \
5173
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
5274
-v /usr/local/Ascend/driver:/usr/local/Ascend/driver \
5375
-e MINERU_MODEL_SOURCE=local \
76+
-e MINERU_VIRTUAL_VRAM_SIZE=16 \
5477
-e MINERU_LMDEPLOY_DEVICE=ascend \
5578
-it mineru:npu-vllm-latest \
5679
/bin/bash
@@ -62,6 +85,9 @@ docker run -u root --name mineru_docker --privileged=true \
6285
执行该命令后,您将进入到Docker容器的交互式终端,您可以直接在容器内运行MinerU相关命令来使用MinerU的功能。
6386
您也可以直接通过替换`/bin/bash`为服务启动命令来启动MinerU服务,详细说明请参考[通过命令启动服务](https://opendatalab.github.io/MinerU/zh/usage/quick_usage/#apiwebuihttp-clientserver)
6487

88+
>[!NOTE]
89+
> 由于310p加速卡不支持bf16精度,因此在使用该加速卡时,执行任意与`vllm`相关命令需追加`--enforce-eager --dtype float16`参数。
90+
6591
## 4. 注意事项
6692

6793
不同环境下,MinerU对Ascend加速卡的支持情况如下表所示:
@@ -91,7 +117,7 @@ docker run -u root --name mineru_docker --privileged=true \
91117
</tr>
92118
<tr>
93119
<td>vlm-&lt;engine_name&gt;-engine</td>
94-
<td>🔴</td>
120+
<td>🟢</td>
95121
<td>🟢</td>
96122
</tr>
97123
<tr>
@@ -160,8 +186,9 @@ docker run -u root --name mineru_docker --privileged=true \
160186
🔴: 不支持,无法运行,或精度存在较大差异
161187

162188
>[!NOTE]
163-
>由于npu卡的特殊性,单次服务启动后,可能会在运行过程中切换推理后端(backend)类型(pipeline/vlm)时出现异常,请尽量根据实际需求选择合适的推理后端进行使用。
164-
>如在服务中切换推理后端类型遇到报错或异常,请重新启动服务即可。
189+
>在使用vllm镜像启动mineru-api服务时,如先使用了pipeline后端解析,再切换到vlm-vllm-async-engine后端,会出现vllm引擎初始化失败的问题。
190+
>如需在一个mineru-api服务中同时使用pipeline和vlm-vllm-async-engine两种后端,请先使用vlm-vllm-async-engine后端解析一次,之后即可自由切换。
191+
>如在服务中切换推理后端类型时遇到报错或异常,请重新启动服务即可。
165192
166193
>[!TIP]
167194
>NPU加速卡指定可用加速卡的方式与NVIDIA GPU类似,请参考[ASCEND_RT_VISIBLE_DEVICES](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/850alpha001/maintenref/envvar/envref_07_0028.html)

docs/zh/usage/acceleration_cards/METAX.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ docker: 28.1.1
1515
1616
### 2.1 使用metax官方镜像作为基础镜像构建vllm环境镜像
1717

18-
- 1. 从metax官方仓库拉取基础镜像
19-
- 1.1 镜像获取地址:https://developer.metax-tech.com/softnova/docker
18+
1. 从metax官方仓库拉取基础镜像
19+
- 1.1 镜像获取地址:[https://developer.metax-tech.com/softnova/docker](https://developer.metax-tech.com/softnova/docker)
2020
- 1.2 在镜像网站选择`AI`分类,软件包类型选择`vllm`,操作系统选择`ubuntu`
2121
- 1.3 找到`vllm:maca.ai3.1.0.7-torch2.6-py310-ubuntu22.04-amd64`镜像,复制拉取命令并在本地终端执行
22-
- 2. 使用 Dockerfile 构建镜像 (vllm)
22+
2. 使用 Dockerfile 构建镜像 (vllm)
2323
```bash
2424
wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/china/maca.Dockerfile
2525
docker build --network=host -t mineru:maca-vllm-latest -f maca.Dockerfile .
2626
```
27+
2728

2829
### 2.2 使用 Dockerfile 构建镜像 (lmdeploy)
2930

mineru/backend/pipeline/pipeline_analyze.py

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ def batch_image_analyze(
159159

160160
model_manager = ModelSingleton()
161161

162-
batch_ratio = 1
163162
device = get_device()
164163

165164
if str(device).startswith('npu'):
@@ -173,25 +172,21 @@ def batch_image_analyze(
173172
"Please ensure that the torch_npu package is installed correctly."
174173
) from e
175174

176-
if str(device).startswith('npu') or str(device).startswith('cuda'):
177-
vram = get_vram(device)
178-
if vram is not None:
179-
gpu_memory = int(os.getenv('MINERU_VIRTUAL_VRAM_SIZE', round(vram)))
180-
if gpu_memory >= 16:
181-
batch_ratio = 16
182-
elif gpu_memory >= 12:
183-
batch_ratio = 8
184-
elif gpu_memory >= 8:
185-
batch_ratio = 4
186-
elif gpu_memory >= 6:
187-
batch_ratio = 2
188-
else:
189-
batch_ratio = 1
190-
logger.info(f'gpu_memory: {gpu_memory} GB, batch_ratio: {batch_ratio}')
191-
else:
192-
# Default batch_ratio when VRAM can't be determined
193-
batch_ratio = 1
194-
logger.info(f'Could not determine GPU memory, using default batch_ratio: {batch_ratio}')
175+
gpu_memory = get_vram(device)
176+
if gpu_memory >= 16:
177+
batch_ratio = 16
178+
elif gpu_memory >= 12:
179+
batch_ratio = 8
180+
elif gpu_memory >= 8:
181+
batch_ratio = 4
182+
elif gpu_memory >= 6:
183+
batch_ratio = 2
184+
else:
185+
batch_ratio = 1
186+
logger.info(
187+
f'GPU Memory: {gpu_memory} GB, Batch Ratio: {batch_ratio}. '
188+
f'You can set MINERU_VIRTUAL_VRAM_SIZE environment variable to adjust GPU memory allocation.'
189+
)
195190

196191
# 检测torch的版本号
197192
import torch

mineru/backend/vlm/utils.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,16 @@ def set_default_gpu_memory_utilization() -> float:
8181
def set_default_batch_size() -> int:
8282
try:
8383
device = get_device()
84-
vram = get_vram(device)
85-
if vram is not None:
86-
gpu_memory = int(os.getenv('MINERU_VIRTUAL_VRAM_SIZE', round(vram)))
87-
if gpu_memory >= 16:
88-
batch_size = 8
89-
elif gpu_memory >= 8:
90-
batch_size = 4
91-
else:
92-
batch_size = 1
93-
logger.info(f'gpu_memory: {gpu_memory} GB, batch_size: {batch_size}')
84+
gpu_memory = get_vram(device)
85+
86+
if gpu_memory >= 16:
87+
batch_size = 8
88+
elif gpu_memory >= 8:
89+
batch_size = 4
9490
else:
95-
# Default batch_ratio when VRAM can't be determined
9691
batch_size = 1
97-
logger.info(f'Could not determine GPU memory, using default batch_ratio: {batch_size}')
92+
logger.info(f'gpu_memory: {gpu_memory} GB, batch_size: {batch_size}')
93+
9894
except Exception as e:
9995
logger.warning(f'Error determining VRAM: {e}, using default batch_ratio: 1')
10096
batch_size = 1

mineru/cli/client.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@
113113
'--formula',
114114
'formula_enable',
115115
type=bool,
116-
help='Enable formula parsing. Default is True. Adapted only for the case where the backend is set to "pipeline".',
116+
help='Enable formula parsing. Default is True. ',
117117
default=True,
118118
)
119119
@click.option(
120120
'-t',
121121
'--table',
122122
'table_enable',
123123
type=bool,
124-
help='Enable table parsing. Default is True. Adapted only for the case where the backend is set to "pipeline".',
124+
help='Enable table parsing. Default is True. ',
125125
default=True,
126126
)
127127
@click.option(
@@ -172,9 +172,8 @@ def get_device_mode() -> str:
172172
def get_virtual_vram_size() -> int:
173173
if virtual_vram is not None:
174174
return virtual_vram
175-
if get_device_mode().startswith("cuda") or get_device_mode().startswith("npu"):
176-
return round(get_vram(get_device_mode()))
177-
return 1
175+
else:
176+
return get_vram(get_device_mode())
178177
if os.getenv('MINERU_VIRTUAL_VRAM_SIZE', None) is None:
179178
os.environ['MINERU_VIRTUAL_VRAM_SIZE']= str(get_virtual_vram_size())
180179

0 commit comments

Comments
 (0)