opendatalab/MinerU · error · ValueError
Unsupported lmdeploy backend: {lm_backend}
Error message
Unsupported lmdeploy backend: {lm_backend} What it means
Raised when the lmdeploy engine backend name supplied via the `lmdeploy_backend` kwarg is neither 'pytorch' nor 'turbomind'. This validation runs only when MINERU_LMDEPLOY_BACKEND is unset; the value decides whether a PytorchEngineConfig or TurbomindEngineConfig is built.
Source
Thrown at mineru/backend/vlm/vlm_analyze.py:197
except ImportError:
raise ImportError("Please install lmdeploy to use the lmdeploy-engine backend.")
if "cache_max_entry_count" not in kwargs:
kwargs["cache_max_entry_count"] = 0.5
device_type = os.getenv("MINERU_LMDEPLOY_DEVICE", "")
if device_type == "":
if "lmdeploy_device" in kwargs:
device_type = kwargs.pop("lmdeploy_device")
if device_type not in ["cuda", "ascend", "maca", "camb"]:
raise ValueError(f"Unsupported lmdeploy device type: {device_type}")
else:
device_type = "cuda"
lm_backend = os.getenv("MINERU_LMDEPLOY_BACKEND", "")
if lm_backend == "":
if "lmdeploy_backend" in kwargs:
lm_backend = kwargs.pop("lmdeploy_backend")
if lm_backend not in ["pytorch", "turbomind"]:
raise ValueError(f"Unsupported lmdeploy backend: {lm_backend}")
else:
lm_backend = set_lmdeploy_backend(device_type)
logger.info(f"lmdeploy device is: {device_type}, lmdeploy backend is: {lm_backend}")
if lm_backend == "pytorch":
kwargs["device_type"] = device_type
backend_config = PytorchEngineConfig(**kwargs)
elif lm_backend == "turbomind":
backend_config = TurbomindEngineConfig(**kwargs)
else:
raise ValueError(f"Unsupported lmdeploy backend: {lm_backend}")
log_level = 'ERROR'
from lmdeploy.utils import get_logger
lm_logger = get_logger('lmdeploy')
lm_logger.setLevel(log_level)
if os.getenv('TM_LOG_LEVEL') is None:
os.environ['TM_LOG_LEVEL'] = log_levelView on GitHub (pinned to 4fe4bde114)
Solutions
- Use exactly 'pytorch' or 'turbomind' for lmdeploy_backend
- Or omit the kwarg entirely and let set_lmdeploy_backend(device_type) pick the right engine for your device
- Or set the env var MINERU_LMDEPLOY_BACKEND=pytorch (or turbomind) instead
- Check for trailing whitespace/casing: pass lmdeploy_backend.strip().lower()
Example fix
# before analyzer = MineVlmAnalyzer(backend='vlm-engine', lmdeploy_backend='PytorchEngine') # after analyzer = MineVlmAnalyzer(backend='vlm-engine') # auto-select via set_lmdeploy_backend(device_type)
Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED_LMDEPLOY_BACKENDS = {"pytorch", "turbomind"}
if lmdeploy_backend is not None:
assert lmdeploy_backend.strip().lower() in SUPPORTED_LMDEPLOY_BACKENDS, (
f"lmdeploy_backend must be one of {SUPPORTED_LMDEPLOY_BACKENDS}"
)
# best: omit lmdeploy_backend and let mineru auto-select per device Try / catch
try:
analyzer = MineVlmAnalyzer(backend="vlm-engine", lmdeploy_backend=lm_backend)
except ValueError as e:
if "Unsupported lmdeploy backend" in str(e):
lm_backend = None # fall back to auto-selection via set_lmdeploy_backend
analyzer = MineVlmAnalyzer(backend="vlm-engine")
else:
raise Prevention
- Omit lmdeploy_backend to use automatic per-device selection
- Use the MINERU_LMDEPLOY_BACKEND env var in deployment configs so code stays backend-agnostic
- Keep a unit test asserting your configured backend value is in {'pytorch','turbomind'}
When it happens
Trigger: Passing lmdeploy_backend='pytorch-engine', 'Pytorch', 'triton', or any string other than pytorch/turbomind in the analyzer kwargs while MINERU_LMDEPLOY_BACKEND is empty.
Common situations: Version drift: configs written for older mineru releases that accepted different backend spellings; users assuming the kwarg accepts the same names as the lmdeploy CLI; copy-paste from lmdeploy docs where backend names differ.
Related errors
- Unsupported lmdeploy device type: {device_type}
- Unsupported lmdeploy backend: {lm_backend}
- backend={backend} requires server_url
- CUDA is not available.
- Unsupported operating system.
AI-assisted analysis of opendatalab/MinerU@4fe4bde114 (2026-08-14).
Data as JSON: /api/errors/eda1ec2ca728a5bf.
Report an issue: GitHub.