Nodes/comfyui-ccip/CCIPModelLoader
ComfyUI Node

CCIPModelLoader

The boring node that makes the other three work — where CCIP models actually live

By spawner1145·Created 9 months ago·Updated 9 months ago· 0
CCIPModelLoader
    • CCIP_MODEL
    ◄model_folder►

    CCIPModelLoader is the least interesting node in this pack and the one you'll trip over first. It doesn't compare anything or compute anything. It just hands the other three nodes - CCIPExtractFeature, CCIPDifference, CCIPSame - a CCIP_MODEL object so they know which character-similarity model to run. The whole pack is dead in the water without it.

    The thing that burns people: the ComfyUI nodes are local-model only. The pack README tells a rosier story about auto-downloading from Hugging Face if you don't pass a model directory - that's true for the bundled ccip_lib CLI, but the node code explicitly killed the remote option. If the loader finds nothing, it raises No model folder selected; remote option removed. Please choose a local model folder. So your first job is getting the model files onto disk in the right place.

    Where the models go

    CCIP (Contrastive Anime Character Image Pre-Training, from deepghs's imgutils project) ships as ONNX files. The loader scans ComfyUI/models/ccip/ and builds the model_folder dropdown from every subfolder it finds. Each folder needs three files, per the pack's own structure docs:

    • model_feat.onnx - extracts an embedding from a character image
    • model_metrics.onnx - turns two embeddings into a difference score
    • metrics.json - holds the default threshold for "same character" verdicts

    Grab them from the deepghs/ccip_onnx repo on Hugging Face. The pruned caformer-24 model is the default and the one you'll probably want; it scores about 0.92 F1 on the similarity benchmark while the other options range down to the fast little ccip-caformer-5_fp32:

    cd ComfyUI/models
    mkdir -p ccip/ccip-caformer-24-randaug-pruned
    cd ccip/ccip-caformer-24-randaug-pruned
    wget https://huggingface.co/deepghs/ccip_onnx/resolve/main/ccip-caformer-24-randaug-pruned/model_feat.onnx
    wget https://huggingface.co/deepghs/ccip_onnx/resolve/main/ccip-caformer-24-randaug-pruned/model_metrics.onnx
    wget https://huggingface.co/deepghs/ccip_onnx/resolve/main/ccip-caformer-24-randaug-pruned/metrics.json
    

    Drop the files, reload ComfyUI, and the dropdown fills in. If it's still empty, check the exact path - it's models/ccip/, not models/ccip_onnx/ or whatever you typed first.

    Inputs, outputs, install

    One input, one output. model_folder is an enum populated from your models/ccip/ subfolders, and it's the only required input - there are no optional ones. Output is a single CCIP_MODEL, which you wire straight into any of the other three nodes' model sockets.

    Installing the pack is standard custom-node fare:

    cd ComfyUI/custom_nodes
    git clone https://github.com/spawner1145/comfyui-ccip
    

    …then restart ComfyUI. ComfyUI Manager may have it under "comfyui-ccip" if you'd rather click - niche packs sometimes lag the registry, so the clone route is the reliable one. The pack's requirements.txt wants onnxruntime>=1.15.0, plus huggingface-hub, scikit-learn, and tqdm; ComfyUI already ships numpy and Pillow. If you run GPU, onnxruntime-gpu is the swap you want, though at 384×384 on character crops even CPU inference is fast enough that you may never bother.

    One last note: because each model folder bundles its own metrics.json, swapping models changes the default "same" threshold automatically - which is exactly why CCIPSame has that use_default_threshold switch. Load a different folder and the verdicts can shift slightly without you touching a slider.

    CategoryCCIP

    Inputs (1)

    NameTypeDefaultDescription
    model_folderCOMBO0 options:

    Outputs (1)

    NameTypeDescription
    CCIP_MODELCCIP_MODEL—