Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

fix: update vllm engine configuration for corex device type in vlm_analyze.py

myhlolib9d2b3de098c
diff --git a/mineru/backend/vlm/vlm_analyze.py b/mineru/backend/vlm/vlm_analyze.py
index 0d6fb04b..114eb17b 100644
--- a/mineru/backend/vlm/vlm_analyze.py
+++ b/mineru/backend/vlm/vlm_analyze.py
@@ -148,20 +148,27 @@ class ModelSingleton:
except ImportError:
raise ImportError("Please install vllm to use the vllm-async-engine backend.")
- """
# musa vllm v1 引擎特殊配置
- device = get_device()
- if device.startswith("musa"):
- import torch
- if torch.musa.is_available():
- compilation_config = CompilationConfig(
- cudagraph_capture_sizes=[1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 24, 28, 30],
- simple_cuda_graph=True
- )
- block_size = 32
- kwargs["compilation_config"] = compilation_config
- kwargs["block_size"] = block_size
- """
+ # device = get_device()
+ # if device_type.startswith("musa"):
+ # import torch
+ # if torch.musa.is_available():
+ # compilation_config = {
+ # "cudagraph_capture_sizes": [1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 24, 28, 30],
+ # "simple_cuda_graph": True
+ # }
+ # block_size = 32
+ # kwargs["compilation_config"] = compilation_config
+ # kwargs["block_size"] = block_size
+
+ # corex vllm v1 引擎特殊配置
+ device_type = os.getenv("MINERU_LMDEPLOY_DEVICE", "")
+ if device_type.lower() == "corex":
+ compilation_config = {
+ "cudagraph_mode": "FULL_DECODE_ONLY",
+ "level": 0
+ }
+ kwargs["compilation_config"] = compilation_config
if "compilation_config" in kwargs:
if isinstance(kwargs["compilation_config"], dict):