sgl-project/sglang · error · TypeError
MiniMaxH3DiTModel.forward received unexpected kwargs: {unexp
Error message
MiniMaxH3DiTModel.forward received unexpected kwargs: {unexpected}; supported kwargs: {sorted(_FORWARD_SUPPORTED_KWARGS)} What it means
MiniMaxH3DiTModel.forward enforces a strict keyword contract: any kwarg not in _FORWARD_SUPPORTED_KWARGS raises TypeError. This catches typos and stale call sites early instead of silently ignoring parameters via **kwargs.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/dits/minimax_h3.py:2373
audio_row_ids,
audio_embed.to(_BF16_DTYPE),
)
t_emb = self._time_embedding(unique_timesteps)
return embeddings, t_emb
def forward(self, **kwargs: Any) -> tuple[torch.Tensor, torch.Tensor]:
"""Packed inference forward.
Keyword names follow the checkpoint's serving contract.
Returns `(video_logits, audio_logits)` from rows selected by
`img_pos_for_infer_output_info` and `audio_pos_info`, with condition
rows zeroed by update masks.
"""
# Strict keyword contract: refuse any kwarg forward does not consume.
unexpected = sorted(set(kwargs) - _FORWARD_SUPPORTED_KWARGS)
if unexpected:
raise TypeError(
"MiniMaxH3DiTModel.forward received unexpected kwargs: "
f"{unexpected}; supported kwargs: "
f"{sorted(_FORWARD_SUPPORTED_KWARGS)}"
)
x = _required_kwarg(kwargs, "x")
audio_x = _required_kwarg(kwargs, "audio_x")
img_position_ids = _required_kwarg(kwargs, "img_position_ids")
unique_timesteps = _required_kwarg(kwargs, "unique_timesteps")
inverse_indices = (
_required_kwarg(kwargs, "inverse_indices").view(-1).to(torch.long)
)
update_mask = _required_kwarg(kwargs, "update_mask")
subblock_sparse_query_block_mask = kwargs.get(
"subblock_sparse_query_block_mask"
)
block_token_tags = kwargs.get("block_token_tags")
token_tags = kwargs.get("token_tags")View on GitHub (pinned to 0132848349)
Solutions
- Check the error message: it lists the supported kwargs; remove/rename the unexpected ones
- Align pipeline code with the current forward signature (see _FORWARD_SUPPORTED_KWARGS in the source)
- Pin versions of the multimodal_gen runtime and model code to matching commits
Example fix
// before model(x=x, img_pos_for_infer=img_pos, ...) // after model(x=x, img_pos_for_infer_output_info=img_pos, ...)
Defensive patterns
Strategy: validation
Validate before calling
from sglang.multimodal_gen.runtime.models.dits.minimax_h3 import _FORWARD_SUPPORTED_KWARGS
bad = set(my_kwargs) - _FORWARD_SUPPORTED_KWARGS
assert not bad, f"unsupported kwargs: {bad}" Try / catch
try:
model.forward(**kwargs)
except TypeError as e:
if 'unexpected kwargs' in str(e):
log_and_align_signature(e) # message lists supported kwargs
raise Prevention
- Update pipeline and model code together (same commit/PR)
- Write a smoke test that calls forward with the pipeline's exact kwargs
When it happens
Trigger: Calling forward with a misspelled or deprecated kwarg (e.g. img_pos_for_infer instead of img_pos_for_infer_output_info), or a caller written against an older/newer signature.
Common situations: Version drift between the pipeline code and the DiT model signature; copy-pasted kwargs from a different DiT implementation; renamed flags after refactors.
Related errors
- fl2va requires first_frame, last_frame, or both
- ref2va requires at least one of reference_image, reference_v
- t2va takes no conditioning inputs; pick another task
- MiniMax-H3 quality="high" is validated only for the strict 4
- MiniMax-H3 on MPS requires synchronous layerwise offload for
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/84929cc23cd4aeef.
Report an issue: GitHub.