Nodes/comfyui-lsnet/Kaloscope Model Loader
ComfyUI Node

Kaloscope Model Loader

The one node you have to set up right

By spawner1145·Created 12 months ago·Updated 2 days ago· 104
Kaloscope Model Loader
    • model
    ◄model_folder►
    ◄devicecuda►

    If you searched "Kaloscope Model Loader" expecting another checkpoint loader, take a breath: this isn't a diffusion model. Nothing here generates an image. Kaloscope loads a small vision backbone - LSNet or DINOv3, trained by @heathcliff01 on art data - that turns a picture into a feature vector, and, when the checkpoint has a classification head, into a list of artist/style tags.

    Think of it as a fingerprinting tool. You point it at a folder of images and it tells you which ones look like each other, or which Danbooru artist your render is closest to. That's a genuinely different job from everything else in your node graph, and this node is the gateway to all of it.

    What it actually does

    The node does three things, all at load time. It scans ComfyUI/models/kaloscope/ for subfolders and offers them as a dropdown. It finds the checkpoint inside the folder you pick - config.json's checkpoint key first, then best.pt, best_checkpoint.pth, model.safetensors, pytorch_model.bin. Then it reads config.json for the architecture name, builds that model, loads the weights, optionally attaches class_mapping.csv, moves everything to the device and calls .eval().

    The result is a bundle - model, preprocessing transform, class mapping, device, feature dimension - wrapped in a custom KALOSCOPE_MODEL type. Every other node in the pack takes that bundle. You load once, wire it everywhere. It also means the image transform (resize, normalization, mean/std) comes from the checkpoint's own training config rather than from you, which is exactly what you want: features are only comparable if the preprocessing matches.

    The two inputs that matter

    model_folder is the dropdown built from your models/kaloscope/ subfolders. device is a plain string defaulting to cuda - not a dropdown, so typos like CUDA0 fail at load rather than at the picker. cpu works if you're desperate, and it's tolerable for a handful of images, since these backbones are tiny compared to a diffusion UNet. There's one output: model.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/spawner1145/comfyui-kaloscope
    cd comfyui-kaloscope
    python -m pip install -r requirements.txt
    

    The GitHub URL redirects, so spawner1145/comfyui-lsnet and spawner1145/comfyui-kaloscope are the same repo - it was renamed. In ComfyUI Manager, "Install from Git URL" with either link works; the pack isn't in the public registry, so searching by name can come up empty.

    Dependencies are heavier than the node looks: torch>=2.4.1, timm>=1.0.20, einops, scikit-learn, scipy, matplotlib, safetensors, plus fvcore/easydict/yacs/scikit-image/wandb. On Windows it also pulls triton-windows, and that one is not cosmetic - LSNet's SKA attention is a real Triton kernel, so a missing Triton is an import error at load, not a slowdown.

    Models go in a subfolder you create yourself:

    ComfyUI/models/kaloscope/Kaloscope2.0/
    ├── best_checkpoint.pth      # or best.pt / model.safetensors
    ├── config.json              # tells the loader which architecture this is
    └── class_mapping.csv        # optional: class_id,class_name
    

    Download from heathcliff01/Kaloscope2.0 or the ModelScope mirror; v1 is still up at heathcliff01/Kaloscope. The v3 model isn't public yet.

    Where people get burned

    The README says config.json is optional ("if it exists, download it"). The code disagrees: without a model key naming the architecture (lsnet_b_artist, lsnet_xl_artist_448, dinov3_*, custom_vit, custom_convnext…), loading raises rather than guessing. Grab it from the model repo alongside the weights.

    Two checkpoints in one folder is also a hard error - the loader refuses to pick for you. Fix it by adding "checkpoint": "best.pt" to config.json or by moving one file out. Same story if class_mapping.csv exists and its class IDs don't line up exactly with the classifier's output count: the CSV has to cover every class or none of it.

    Finally, that folder dropdown is scanned when the node definition is built, so dropping a new model in while ComfyUI runs usually means a restart before it appears. And remember these requirements install straight into your shared ComfyUI environment - timm and torch upgrades there have a habit of breaking other packs, which is the oldest story in the ecosystem. If something unrelated starts erroring after this install, suspect that first.

    CategoryKaloscope

    Inputs (2)

    NameTypeDefaultDescription
    model_folderCOMBO0 options:
    deviceSTRINGcuda—

    Outputs (1)

    NameTypeDescription
    modelKALOSCOPE_MODEL—