From b9d2b3de098c203d80eaac98d5085b03174c2e2f Mon Sep 17 00:00:00 2001 From: myhloli Date: Fri, 30 Jan 2026 02:50:41 +0800 Subject: [PATCH] fix: update vllm engine configuration for corex device type in vlm_analyze.py --- mineru/backend/vlm/vlm_analyze.py | 33 +++++++++++++++++++------------ 1 file changed, 20 insertions(+), 13 deletions(-) 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):