sgl-project/sglang · error · ValueError

use_fast={use_fast} conflicts with image_processor_backend={

Error message

use_fast={use_fast} conflicts with image_processor_backend={backend!r}.

What it means

The legacy use_fast boolean conflicts with the explicitly chosen image_processor_backend: use_fast=True maps to torchvision and use_fast=False to pil, so any other explicit backend (e.g. flash) plus use_fast is contradictory.

Source

Thrown at python/sglang/srt/utils/hf_transformers/processor.py:82

    if getattr(mm_config, "disable_fast_image_processor", False):
        return "pil"
    return getattr(mm_config, "image_processor_backend", "auto")


def _normalize_image_processor_backend(
    image_processor_backend: Optional[str], use_fast: Optional[bool]
) -> str:
    backend = image_processor_backend or "auto"
    if backend not in _IMAGE_PROCESSOR_BACKENDS:
        raise ValueError(
            f"Unsupported image processor backend: {backend}. "
            f"Expected one of {sorted(_IMAGE_PROCESSOR_BACKENDS)}."
        )

    if use_fast is not None:
        legacy_backend = "torchvision" if use_fast else "pil"
        if backend not in {"auto", legacy_backend}:
            raise ValueError(
                f"use_fast={use_fast} conflicts with "
                f"image_processor_backend={backend!r}."
            )
        backend = legacy_backend
    return backend


def _apply_image_processor_backend(
    processor,
    tokenizer_name,
    args,
    trust_remote_code,
    revision,
    backend,
    kwargs,
):
    """Apply an explicit backend only to the image sub-processor.

View on GitHub (pinned to 0132848349)

Solutions

  1. Remove the use_fast flag and keep only image_processor_backend
  2. Or keep use_fast and set backend to auto so it derives from the boolean

Example fix

# before
--image-processor-backend flash --use-fast
# after
--image-processor-backend flash
Defensive patterns

Strategy: validation

Validate before calling

if use_fast is not None and image_processor_backend not in (None,'auto','torchvision' if use_fast else 'pil'):
    raise ConfigError('conflicting tokenizer/image processor flags')

Prevention

When it happens

Trigger: Passing both --use-fast/--no-use-fast and --image-processor-backend <non-matching> to get_processor.

Common situations: Old scripts that set use_fast are extended with a new backend flag without removing the legacy one.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/1639f3a84623f9e7. Report an issue: GitHub.