sgl-project/sglang · error · ValueError

MiniMaxH3TextEncodingStage direct encode requires a tokenize

Error message

MiniMaxH3TextEncodingStage direct encode requires a tokenizer component

What it means

Direct encode also requires the tokenizer pipeline component; if self.tokenizer is None at encode time, _encode_from_plan raises this ValueError. Like 2436, it fires lazily — construction allows a tokenizer-less pipeline (embedding-only usage) but direct encode does not.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/text_encoding.py:286

        elif keyframes:
            raise ValueError(
                f"task {plan.task!r} cannot carry image.target_canvas materials"
            )
        if MINIMAX_H3_TEXT_EMBEDDINGS_EXTRA_KEY in batch.extra:
            return
        if self.text_encoder is None:
            raise ValueError(
                "MiniMaxH3TextEncodingStage direct encode requires a text_encoder "
                "component"
            )
        encode_ids = getattr(self.text_encoder, "encode_ids", None)
        if not callable(encode_ids):
            raise TypeError(
                "MiniMax H3 text_encoder component must expose callable "
                "encode_ids(...) for direct encode (MiniMaxH3Qwen3VLEncoder)"
            )
        if self.tokenizer is None:
            raise ValueError(
                "MiniMaxH3TextEncodingStage direct encode requires a tokenizer component"
            )
        with set_forward_context(current_timestep=0, attn_metadata=None):
            if plan.task == "ref2va":
                embeddings = self._encode_ref2va(
                    batch,
                    plan,
                    encode_ids,
                    include_video_token_mask=include_video_token_mask,
                )
            elif keyframes:
                embeddings = self._encode_fl2va_keyframes(
                    batch,
                    plan,
                    encode_ids,
                    prompt=prompt,
                )
            else:

View on GitHub (pinned to 0132848349)

Solutions

  1. Load the pipeline with its tokenizer component included
  2. Pre-populate MINIMAX_H3_TEXT_EMBEDDINGS_EXTRA_KEY to bypass direct encode
  3. Verify the tokenizer entry exists in model_index.json
Defensive patterns

Strategy: validation

Validate before calling

if stage.tokenizer is None and MINIMAX_H3_TEXT_EMBEDDINGS_EXTRA_KEY not in batch.extra:
    raise RuntimeError("load tokenizer component or supply precomputed embeddings")

Prevention

When it happens

Trigger: _encode_from_plan reaches the tokenizer check with self.tokenizer None — stage constructed from a pipeline missing the tokenizer component while the plan has no cached text embeddings.

Common situations: Slim pipelines shipping only the diffusion model and encoder weights, tokenizer subfolder excluded from the snapshot, or embedding-replay setups accidentally receiving fresh plans.

Related errors


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