{"record":{"id":"49794a390cb8b6c2","repo":"Comfy-Org/ComfyUI","slug":"unknown-activation-function-act-fn","errorCode":null,"errorMessage":"Unknown activation function: {act_fn}","messagePattern":"Unknown activation function: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/lightricks/model.py","lineNumber":269,"sourceCode":"\n    Adapted from https://github.com/PixArt-alpha/PixArt-alpha/blob/master/diffusion/model/nets/PixArt_blocks.py\n    \"\"\"\n\n    def __init__(\n        self, in_features, hidden_size, out_features=None, act_fn=\"gelu_tanh\", dtype=None, device=None, operations=None\n    ):\n        super().__init__()\n        if out_features is None:\n            out_features = hidden_size\n        self.linear_1 = operations.Linear(\n            in_features=in_features, out_features=hidden_size, bias=True, dtype=dtype, device=device\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        self.linear_2 = operations.Linear(\n            in_features=hidden_size, out_features=out_features, bias=True, dtype=dtype, device=device\n        )\n\n    def forward(self, caption):\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 NormSingleLinearTextProjection(nn.Module):\n    \"\"\"Text projection for 20B models - single linear with RMSNorm (no activation).\"\"\"\n\n    def __init__(\n        self, in_features, hidden_size, dtype=None, device=None, operations=None\n    ):\n        super().__init__()","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/lightricks/model.py#L251-L287","documentation":"The LTX text projection feed-forward only implements two activations: gelu_tanh and silu. A config string outside this set means the checkpoint's projection type is not implemented in this port, and the error names the exact unsupported value.","triggerScenarios":"Constructing the caption projection with act_fn='gelu' (exact), 'swish', 'relu', etc.; usually from a config key copied from the original Lightricks repo which uses different activation names.","commonSituations":"Porting new LTX checkpoints whose configs use 'gelu' vs this repo's 'gelu_tanh' naming, or hand-written config dicts.","solutions":["Map 'gelu' -> 'gelu_tanh' and 'swish' -> 'silu' when converting configs","Use the config values shipped with the repo's checkpoint conversions","Verify against the checkpoint's config.json after conversion"],"exampleFix":"# before\nproj = FeedForward(..., act_fn=\"gelu\")\n# after\nproj = FeedForward(..., act_fn=\"gelu_tanh\")","handlingStrategy":"validation","validationCode":"assert act_fn in {\"gelu_tanh\", \"silu\"}, act_fn","typeGuard":"def is_supported_act(v: str) -> bool:\n    return v in {\"gelu_tanh\", \"silu\"}","tryCatchPattern":null,"preventionTips":["Map upstream activation names ('gelu'->'gelu_tanh', 'swish'->'silu') in the conversion script","Fail config validation early with the checkpoint name in the message"],"tags":["ltx","activation","config","init"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}