{"record":{"id":"0c78f174cb88585c","repo":"sgl-project/sglang","slug":"unknown-activation-function-act-fn","errorCode":null,"errorMessage":"Unknown activation function: {act_fn}","messagePattern":"Unknown activation function: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/multimodal_gen/runtime/models/dits/ltx_2.py","lineNumber":622,"sourceCode":"        self,\n        in_features: int,\n        hidden_size: int,\n        out_features: int | None = None,\n        act_fn: str = \"gelu_tanh\",\n    ) -> None:\n        super().__init__()\n        if out_features is None:\n            out_features = hidden_size\n\n        self.linear_1 = ColumnParallelLinear(\n            in_features, hidden_size, bias=True, gather_output=True\n        )\n        if act_fn == \"gelu_tanh\":\n            self.act_1 = nn.GELU(approximate=\"tanh\")\n        elif act_fn == \"silu\":\n            self.act_1 = nn.SiLU()\n        else:\n            raise ValueError(f\"Unknown activation function: {act_fn}\")\n\n        self.linear_2 = ColumnParallelLinear(\n            hidden_size, out_features, bias=True, gather_output=True\n        )\n\n    def forward(self, caption: torch.Tensor) -> torch.Tensor:\n        hidden_states, _ = self.linear_1(caption)\n        hidden_states = self.act_1(hidden_states)\n        hidden_states, _ = self.linear_2(hidden_states)\n        return hidden_states\n\n\nclass LTX2TimestepEmbedder(nn.Module):\n    def __init__(self, embedding_dim: int, in_channels: int = 256) -> None:\n        super().__init__()\n        self.linear_1 = ColumnParallelLinear(\n            in_channels, embedding_dim, bias=True, gather_output=True\n        )","sourceCodeStart":604,"sourceCodeEnd":640,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/dits/ltx_2.py#L604-L640","documentation":"The LTX-2 caption/text projection supports only gelu_tanh and silu activation in its MLP. An unknown act_fn string fails at init when trying to select the activation module.","triggerScenarios":"Constructing the caption projection with act_fn='gelu' (exact, non-tanh), 'relu', 'swish', or a typo.","commonSituations":"Config drift between checkpoints (older configs saying 'gelu'); assuming diffusers-style act_fn names ('swish' vs 'silu'); hand-edited configs.","solutions":["Use 'silu' (same as swish) or 'gelu_tanh'","Map legacy names in your loader: 'swish'->'silu', 'gelu'->'gelu_tanh' if checkpoint compatibility allows","Verify against the config.json shipped with the LTX-2 checkpoint"],"exampleFix":"// before\nproj = LTX2CaptionProjection(..., act_fn=\"swish\")\n\n// after\nproj = LTX2CaptionProjection(..., act_fn=\"silu\")","handlingStrategy":"validation","validationCode":"assert act_fn in ('gelu_tanh', 'silu'), f'unknown act_fn {act_fn!r}'","typeGuard":"def is_supported_act_fn(v: str) -> bool:\\n    return v in ('gelu_tanh', 'silu')","tryCatchPattern":null,"preventionTips":["Map legacy names ('swish'->'silu', 'gelu'->'gelu_tanh') in the loader","Copy act_fn from the reference config.json","Unit-test config string enums"],"tags":["config-validation","activation","init-time","ltx2"],"backgroundTag":"unsupported-config-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}