sgl-project/sglang · critical · ValueError
H3 conditioning projection MLP outputs width {layer_input_di
Error message
H3 conditioning projection MLP outputs width {layer_input_dim}, expected {self.output_dim} What it means
An MLP chain was recognized in the conditioning projection tensors, but its final layer's output width (layer_input_dim after consuming all layers) does not equal the module's declared output_dim. The projected conditioning signal would then be the wrong width for the downstream model.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/encoders/minimax_h3_qwen3vl.py:154
f"H3 conditioning projection {weight_name} cannot follow "
f"width {layer_input_dim}: got {tuple(weight.shape)}"
)
if bias is not None and tuple(bias.shape) != (int(weight.shape[0]),):
raise ValueError(
f"H3 conditioning projection {bias_name} has shape "
f"{tuple(bias.shape)}, expected ({int(weight.shape[0])},)"
)
layers.append(_FrozenLinear(weight, bias))
layer_input_dim = int(weight.shape[0])
if tensors:
raise ValueError(
"H3 conditioning projection contains unsupported tensors: "
f"{sorted(tensors)}"
)
if self.weight is None and not layers:
raise ValueError("H3 conditioning projection has neither W nor an MLP")
if layers and layer_input_dim != self.output_dim:
raise ValueError(
f"H3 conditioning projection MLP outputs width {layer_input_dim}, "
f"expected {self.output_dim}"
)
if self.weight is not None and tuple(self.weight.shape) != (
self.input_dim,
self.output_dim,
):
raise ValueError(
"H3 conditioning projection W has shape "
f"{tuple(self.weight.shape)}, expected "
f"({self.input_dim}, {self.output_dim})"
)
self.layers = nn.ModuleList(layers)
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
if int(hidden_states.shape[-1]) != self.input_dim:
raise ValueError(
f"H3 conditioning projection expects width {self.input_dim}, "View on GitHub (pinned to 0132848349)
Solutions
- Check the last MLP weight's shape[0] and compare with the expected output width (MINIMAX_H3_QWEN3VL_HIDDEN_DIM)
- Use the projection checkpoint matching the target model's hidden size
Defensive patterns
Strategy: validation
Validate before calling
out_w = [v for k, v in sd.items() if "weight" in k][-1] assert int(out_w.shape[0]) == expected_output_dim
Prevention
- Match projection checkpoints to the target model's hidden size
- Automate a shape smoke-test in CI for each model/projection pairing
When it happens
Trigger: Constructing MiniMaxH3ConditioningProjection where the last MLP weight's shape[0] != output_dim, e.g. passing a projection for a different model's hidden size.
Common situations: Mixing projection checkpoints across MiniMax H3 model sizes (e.g. 4096 vs 5120 hidden dims), or mis-specifying output_dim when the checkpoint defines it implicitly.
Related errors
- H3 conditioning projection {bias_name} has shape {tuple(bias
- H3 conditioning projection W has shape {tuple(self.weight.sh
- H3 conditioning projection expects width {self.input_dim}, g
- H3 conditioning projection expects encoder width {input_dim}
- H3 conditioning projection must output width {MINIMAX_H3_QWE
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/44ee100a3e68b53c.
Report an issue: GitHub.