ComfyUI Node

Ptf SiLU

The smooth ReLU that modern models actually use

By HowToSD·Created about a year ago·Updated about a year ago· 7
Ptf SiLU
    • PTCALLABLE

    SiLU - also known as Swish, the name it went by when Google published it - is the smooth, non-monotonic activation that quietly took over modern architectures. If you've seen a recent diffusion model's internals, you've seen SiLU. Ptf SiLU packages it as a callable component for the pack's no-code model building: no inputs, one PTCALLABLE output, ready to drop into Pt Apply Function or a model closure.

    How it works

    The node returns torch.nn.functional.silu. The function is x * sigmoid(x): like ReLU it's roughly linear for large positive inputs, but unlike ReLU it doesn't hard-zero negatives - small negative inputs get a small negative pass-through, and there's a gentle dip below zero before it flattens. That smoothness is the point: no kink at zero, no dead neurons, and gradients that stay informative. It's strictly more expressive than ReLU for the same parameter count, which is why it keeps showing up in the guts of modern transformers and image models.

    As with the other Ptf nodes, you get a function, not a tensor op. Output type PTCALLABLE; feed it into Pt Apply Function alongside a tensor, or into a model node that accepts a closure, and it applies element-wise to whatever comes through. It composes exactly like writing F.silu between layers in raw PyTorch.

    The one output

    • PTCALLABLE - the SiLU function. No inputs.

    If you're deciding between this and Ptf ReLU: ReLU is simpler and slightly cheaper, SiLU is smoother and more modern. For a first no-code network either works; for anything meant to resemble current research architectures, SiLU is the closer match.

    Where people get burned

    • The usual callable trap: you can't feed a tensor into this node (no tensor input). Apply it via Pt Apply Function or a closure socket.
    • It's the functional form, not an nn.Module. When a layer node specifically asks for a module, use a layer node instead.
    • Semantic nit that confuses people: SiLU and Swish are the same function. No, you're not missing a node.

    Installing it

    It's in ComfyUI-Pt-Wrapper:

    • ComfyUI Manager → search "ComfyUI-Pt-Wrapper" → Install → restart.
    • Or cd ComfyUI/custom_nodes && git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper and restart.

    The pack installs a heavy ML stack (transformers, datasets, peft, accelerate, scikit-learn, scipy, gensim, sentencepiece), so the first boot takes a while. No model downloads needed. It's a niche educational pack by HowToSD with almost no community chatter; the repo's docs/reference/ is the authoritative doc.

    CategoryData Analysis

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    PTCALLABLEPTCALLABLE