opendatalab/MinerU · error · ValueError

Unsupported lmdeploy device type: {device_type}

Error message

Unsupported lmdeploy device type: {device_type}

What it means

Raised when starting the lmdeploy VLM server if the resolved device type is not one of cuda, ascend, maca, or camb. The value comes from the function argument overridden by the MINERU_LMDEPLOY_DEVICE environment variable; empty string defaults to cuda.

Source

Thrown at mineru/model/vlm/lmdeploy_server.py:61

            indices_to_remove.append(i)

    # 从后往前删除,避免索引错位
    for i in sorted(set(indices_to_remove), reverse=True):
        args.pop(i)

    # 添加默认参数
    if not has_port_arg:
        args.extend(["--server-port", "30000"])
    if not has_gpu_memory_utilization_arg:
        args.extend(["--cache-max-entry-count", "0.5"])
    if not has_log_level_arg:
        args.extend(["--log-level", "ERROR"])

    device_type = os.getenv("MINERU_LMDEPLOY_DEVICE", device_type)
    if device_type == "":
        device_type = "cuda"
    elif device_type not in ["cuda", "ascend", "maca", "camb"]:
        raise ValueError(f"Unsupported lmdeploy device type: {device_type}")
    lm_backend = os.getenv("MINERU_LMDEPLOY_BACKEND", lm_backend)
    if lm_backend == "":
        lm_backend = set_lmdeploy_backend(device_type)
    elif lm_backend not in ["pytorch", "turbomind"]:
        raise ValueError(f"Unsupported lmdeploy backend: {lm_backend}")
    logger.info(f"lmdeploy device is: {device_type}, lmdeploy backend is: {lm_backend}")

    if lm_backend == "pytorch":
        os.environ["TOKENIZERS_PARALLELISM"] = "false"


    args.extend(["--device", device_type])
    args.extend(["--backend", lm_backend])

    model_path = auto_download_and_get_model_root_path("/", "vlm")

    # logger.debug(args)

View on GitHub (pinned to 4fe4bde114)

Solutions

  1. Set MINERU_LMDEPLOY_DEVICE to a supported value: cuda, ascend, maca, or camb (or unset it to default to cuda).
  2. On CPU-only machines, do not use the lmdeploy VLM backend; select a different mineru VLM backend.
  3. For ROCm, note 'cuda' is typically still the right device string.

Example fix

# before
export MINERU_LMDEPLOY_DEVICE=cpu

# after
unset MINERU_LMDEPLOY_DEVICE   # defaults to cuda
# or: export MINERU_LMDEPLOY_DEVICE=cuda
Defensive patterns

Strategy: validation

Validate before calling

import os
VALID_DEVICES = {"cuda", "ascend", "maca", "camb"}
device = os.getenv("MINERU_LMDEPLOY_DEVICE", "") or "cuda"
assert device in VALID_DEVICES, f"MINERU_LMDEPLOY_DEVICE must be one of {VALID_DEVICES}, got {device!r}"

Type guard

def is_supported_lmdeploy_device(d: str) -> bool:
    return d in {"cuda", "ascend", "maca", "camb"}

Prevention

When it happens

Trigger: Setting MINERU_LMDEPLOY_DEVICE=cpu / rocm / npu / nvidia (anything outside the allowlist), or passing device_type='cpu' to the server-builder function when calling mineru's VLM backend.

Common situations: Trying to run the VLM pipeline on CPU (unsupported by this lmdeploy path — use the non-lmdeploy backend instead); vendor accelerator names not in the list; leftover env vars from other tooling.

Related errors


AI-assisted analysis of opendatalab/MinerU@4fe4bde114 (2026-08-14). Data as JSON: /api/errors/dea50041ba3acc88. Report an issue: GitHub.