unslothai/unsloth · error · ValueError

Batched prompt/seed lists are not supported on the native sd

Error message

Batched prompt/seed lists are not supported on the native sd.cpp engine (it renders serially); run on a GPU (diffusers) for batched generation, or use batch_size for a serial native batch.

What it means

ValueError: the native sd.cpp engine renders serially, so per-image prompt/seed lists (prompts=[...], seeds=[...]) are rejected. The message points to batch_size for a serial native batch or to diffusers on GPU for true batched generation.

Source

Thrown at studio/backend/core/inference/sd_cpp_backend.py:2065

    ) -> dict[str, Any]:
        import tempfile

        from PIL import Image

        from core.inference import diffusion_lora

        if (
            init_image is not None
            or mask_image is not None
            or reference_images
            or (upscale is not None and upscale > 1)
        ):
            raise ValueError(
                "img2img / inpaint / reference / upscale are not yet supported on the native "
                "sd.cpp engine; run on a GPU (diffusers) for image-conditioned workflows."
            )
        if prompts is not None or seeds is not None:
            raise ValueError(
                "Batched prompt/seed lists are not supported on the native sd.cpp engine "
                "(it renders serially); run on a GPU (diffusers) for batched generation, "
                "or use batch_size for a serial native batch."
            )
        # strength 0/None disables ControlNet (matches diffusers), so no-op it rather than 400.
        if controlnet is not None and controlnet[3] in (None, 0, 0.0):
            controlnet = None
        if controlnet is not None:
            raise ValueError(
                "ControlNet is not yet supported on the native sd.cpp engine; run on a GPU "
                "(diffusers) for ControlNet conditioning."
            )

        cancel = threading.Event()
        with self._generate_lock:
            with self._lock:
                state = self._state
                if state is None:

View on GitHub (pinned to 203007d190)

Solutions

  1. Use batch_size=N with a single prompt/seed for a serial native batch.
  2. Loop generate() per prompt/seed pair on the native engine.
  3. Switch to the diffusers engine on GPU for genuine batched generation.

Example fix

# before
backend.generate(prompts=['a cat', 'a dog'], seeds=[1, 2])

# after
for p, s in [('a cat', 1), ('a dog', 2)]:
    backend.generate(prompt=p, seed=s, batch_size=1)
Defensive patterns

Strategy: validation

Validate before calling

if isinstance(prompts, list) or isinstance(seeds, list):
    for p, s in zip(prompts or [prompt], seeds or [seed] * len(prompts or [prompt])):
        submit_native_generate(prompt=p, seed=s)  # serial loop; or use batch_size

Type guard

def is_scalar_prompt(prompt, prompts, seed, seeds) -> bool:
    return prompts is None and seeds is None and isinstance(prompt, str)

Prevention

When it happens

Trigger: generate() with prompts or seeds passed as lists on the native engine.

Common situations: Porting a batched diffusers request to a CPU/native host; automation generating galleries from prompt lists.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/08e417140600863f. Report an issue: GitHub.