Nodes/comfyui-timm-backbone/Timm Backbone Loader
ComfyUI Node

Timm Backbone Loader

The entire timm model zoo, one model name away

By p1atdev·Created about a year ago·Updated about a year ago· 1
Timm Backbone Loader
    • MODEL
    model_nametimm/vit_huge_patch14_clip_224.laion2b

    Timm Backbone Loader is the door into a collection you won't find anywhere else in ComfyUI: most of the ~thousands of pretrained vision models that Hugging Face's timm library can load. ViTs, ResNets, EfficientNets, ConvNeXts, CLIP image encoders - you type a name, the node fetches the weights, and you're holding a real image backbone in your graph. There's no ComfyUI equivalent for this. That's the whole pitch.

    Before you get excited: this is a builder's tool, not an end-user toy. The output is a raw timm torch.nn.Module shipped out under the MODEL datatype, and it only plugs into the pack's own Timm Backbone Image Encode node. It is not a diffusion checkpoint - the name MODEL is borrowed. Wire it into a KSampler and you'll get a confusing crash, so don't. If your goal is a finished image, this pack isn't for you. If your goal is image features - retrieval, clustering, feeding an embedding into a custom node you wrote - this is the missing bridge.

    How it works

    Under the hood it's a one-liner wrapped in node plumbing:

    model = timm.create_model(model_name, pretrained=True)
    model.reset_classifier(0)  # strip the classification head
    

    That pretrained=True is doing real work: on the first load with any given name, timm downloads the weights from Hugging Face Hub (or its own hosted zoo) into your HF cache, then loads them. The model is moved to your torch device and cast to fp16 so it doesn't eat your VRAM, and the classifier head is removed because you want features, not class logits.

    The input that matters

    One input, one name:

    • model_name - a string. The default is timm/vit_huge_patch14_clip_224.laion2b, a ViT-Huge CLIP vision tower. Note the timm/ prefix: that tells timm to pull weights hosted under the timm org on Hugging Face Hub. Without the prefix, timm falls back to its own bundled pretrained tags.

    Beginner traps, and they're both real:

    • That default model is enormous. ViT-Huge is north of 600M parameters - you're downloading over a gigabyte of weights on first load, and it'll use a chunk of VRAM in fp16. It's an odd default for a beginner. Swap it for something like timm/vit_base_patch16_clip_224.laion2b or timm/efficientnet_b0 if you're just testing the pipeline. Smaller, faster, same mechanism.
    • First load looks like a hang. The node sits there while timm pulls weights from Hugging Face Hub. That's a download, not a freeze. Let it finish once, and it's cached locally after that.

    Installing it

    The pack's only real dependency is timm itself - no model files are bundled, and everything else it touches (torch, torchvision) is already in your ComfyUI environment. Easiest path is ComfyUI Manager: search timm backbone, install, restart. Or, from the terminal:

    cd ComfyUI/custom_nodes
    git clone https://github.com/p1atdev/comfyui-timm-backbone
    cd comfyui-timm-backbone
    pip install -r requirements.txt   # just installs timm
    

    Restart ComfyUI after. Worth knowing: this is a small, quiet pack from p1atdev, the same dev behind the LECO LoRA trainer. It has no community fanfare - it's a utility for people building their own nodes, and it knows it.

    Categoryloaders

    Inputs (1)

    NameTypeDefaultDescription
    model_nameSTRINGtimm/vit_huge_patch14_clip_224.laion2b

    Outputs (1)

    NameTypeDescription
    MODELMODEL