sgl-project/sglang · error · ValueError

Unsupported SANA-WM update_rule: {self.update_rule}

Error message

Unsupported SANA-WM update_rule: {self.update_rule}

What it means

The SANA-WM GDN mixer validates update_rule at construction; only 'torch_chunk' and 'torch_recurrent' are supported. Any other value fails fast with this ValueError.

Source

Thrown at python/sglang/multimodal_gen/runtime/models/dits/sana_wm_components.py:1889

    ) -> None:
        super().__init__()
        out_dim = heads * head_dim
        assert (
            out_dim == in_dim
        ), f"in_dim ({in_dim}) must equal heads*head_dim ({out_dim})"
        self.in_dim = in_dim
        self.out_dim = out_dim
        self.heads = heads
        self.dim = head_dim
        self.eps = eps
        self.softmax_main = softmax_main
        self.update_rule = update_rule
        self.cam_update_rule = cam_update_rule
        self.chunk_gdn_chunk_size = chunk_gdn_chunk_size
        self.use_chunked_softmax_attention = use_chunked_softmax_attention
        self.gdn_backend = gdn_backend
        if self.update_rule not in ("torch_chunk", "torch_recurrent"):
            raise ValueError(f"Unsupported SANA-WM update_rule: {self.update_rule}")
        if self.cam_update_rule not in ("torch_chunk", "torch_recurrent"):
            raise ValueError(
                f"Unsupported SANA-WM cam_update_rule: {self.cam_update_rule}"
            )
        if self.gdn_backend not in ("auto", "torch", "triton"):
            raise ValueError(
                "Unsupported SANA-WM gdn_backend: "
                f"{self.gdn_backend}. Expected one of auto, torch, triton."
            )

        # Fused QKV + output proj (proj shared with cam branch).
        self.qkv = nn.Linear(in_dim, 3 * out_dim, bias=False)
        self.proj = nn.Linear(out_dim, out_dim, bias=True)

        if qk_norm:
            self.q_norm = _RMSNorm(in_dim, eps=1e-5)
            self.k_norm = _RMSNorm(in_dim, eps=1e-5)
            self.q_norm_cam = _RMSNorm(in_dim, eps=1e-5)

View on GitHub (pinned to 0132848349)

Solutions

  1. Set update_rule to 'torch_chunk' (fast, parallel) or 'torch_recurrent' (lower memory) — use torch_chunk unless memory-bound
  2. To use Triton kernels, set gdn_backend='triton' or 'auto', keeping update_rule as one of the two valid values
  3. Check the model config JSON/dict for a typo in update_rule

Example fix

# before
block = GDNBlock(dim, update_rule="triton")
# after
block = GDNBlock(dim, update_rule="torch_chunk", gdn_backend="triton")
Defensive patterns

Strategy: validation

Validate before calling

assert update_rule in ("torch_chunk", "torch_recurrent"), update_rule

Type guard

def valid_update_rule(r: str) -> bool: return r in ("torch_chunk", "torch_recurrent")

Prevention

When it happens

Trigger: Instantiating the GDN block (or the containing SANA-WM model) with update_rule='triton', 'chunk', 'cuda', or similar from a config dict.

Common situations: Config files ported from another implementation using different rule names; trying to select a Triton update rule (Triton is selected via gdn_backend, not update_rule).

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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