sgl-project/sglang · critical · ValueError
H3 conditioning projection W has shape {tuple(self.weight.sh
Error message
H3 conditioning projection W has shape {tuple(self.weight.shape)}, expected ({self.input_dim}, {self.output_dim}) What it means
The direct W matrix in the conditioning projection does not have shape (input_dim, output_dim). Since the projection maps encoder hidden states to the target width, any other shape makes the matmul impossible or wrong.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/encoders/minimax_h3_qwen3vl.py:162
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}, "
f"got {int(hidden_states.shape[-1])}"
)
normalized = (hidden_states.float() - self.mean_in) / self.std_in
projected = normalized @ self.weight if self.weight is not None else None
if self.layers:
residual = normalized.to(self.layers[0].weight.dtype)
for index, layer in enumerate(self.layers):
residual = layer(residual)View on GitHub (pinned to 0132848349)
Solutions
- Print tuple(W.shape) and compare to (input_dim, output_dim); transpose if the checkpoint stores (output_dim, input_dim)
- Re-export W in the expected orientation from the source model
Example fix
# before
proj = MiniMaxH3ConditioningProjection({"weight": W.T}, input_dim=2048, output_dim=4096)
# after
sd = {"weight": W} # ensure W.shape == (input_dim, output_dim)
proj = MiniMaxH3ConditioningProjection(sd, input_dim=2048, output_dim=4096) Defensive patterns
Strategy: validation
Validate before calling
w = sd.get("weight") or sd.get("W")
if w is not None:
assert tuple(w.shape) == (input_dim, output_dim), f"W is {tuple(w.shape)}, want {(input_dim, output_dim)}; maybe transpose" Prevention
- Document the expected orientation (input_dim, output_dim) in export scripts
- Add a transpose fallback in your export tooling if the source stores the transpose
When it happens
Trigger: MiniMaxH3ConditioningProjection constructed with a W tensor whose shape is not exactly (input_dim, output_dim) — commonly transposed weights or wrong-dimension checkpoint.
Common situations: See trigger scenarios.
Related errors
- H3 conditioning projection {bias_name} has shape {tuple(bias
- H3 conditioning projection MLP outputs width {layer_input_di
- MiniMax-H3 checkpoint shards disagree on adaln_t_table shape
- img_position_ids must be [1, S, 3], got {list(img_position_i
- adaln out_features mismatch: {out_features} != {expand_ratio
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/3c45ac0437455630.
Report an issue: GitHub.