Nodes/MTB Nodes/Model Pruner (mtb)
ComfyUI Node Runs on cloud

Model Pruner (mtb)

Shrink a checkpoint on disk (experimental, but useful)

By melMass·Created 3 years ago·Updated about a month ago· 721
Model Pruner (mtb)
  • unet
  • clip
  • vae
    save_separatelyfalse
    save_foldercheckpoints/ComfyUI
    fix_cliptrue
    remove_junktrue
    ema_moderemove_ema
    precision_unetfull
    operation_unetconvert
    precision_clipfull
    operation_clipconvert
    precision_vaefull
    operation_vaeconvert

    Checkpoints are fat, and a lot of that fat is stuff you don't need to keep on disk. Model Pruner is MTB's node for slimming one down - convert the weights to a smaller precision, strip the EMA copy, drop junk keys, and save a lighter file. If you've got a 6GB fp32 checkpoint that could be a 2GB fp16, this is how you cut it without leaving ComfyUI.

    Fair warning up front, straight from the node's own description: this is experimental. It works, people use it, but treat the output as something to verify rather than trust blindly. Prune a copy, load it back, make sure it still generates before you delete the original.

    How it works

    It's an output node - it doesn't hand you a MODEL to keep chaining, it writes a file to disk and stops. You wire in whichever components you want to keep (the UNet, the CLIP, the VAE - all optional), tell it what to do with each, and it saves a new checkpoint. The savings come from three places: dropping the EMA weights (a second copy of the UNet used during training that you don't need for inference), converting precision (fp16 is half the size of fp32 for a negligible quality difference in most cases), and removing junk metadata keys.

    The inputs and outputs that matter

    The three model inputs - unet (MODEL), clip (CLIP), vae (VAE) - are all optional; wire the ones you want in the output. For each, there's a matching pair of knobs:

    • precision_unet / precision_clip / precision_vae - full, fp32, fp16, bf16, or fp8. fp16 is the standard "make it half the size" choice. fp8 is aggressive and can cost quality - test it.
    • operation_unet / operation_clip / operation_vae - copy (keep as-is), convert (change precision), or delete (drop this component entirely).
    • ema_mode - remove_ema (the usual choice, drops the training copy), disabled, or ema_only.
    • fix_clip and remove_junk (both default true) - clean up a broken CLIP and strip junk keys.
    • save_folder (default checkpoints/ComfyUI) - where it lands. A relative path is relative to ComfyUI's output directory. save_separately splits the components into separate files instead of one checkpoint.

    There are no node outputs - the result is the saved file.

    How to install it

    Via ComfyUI Manager: search MTB Nodes, install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/melMass/comfy_mtb
    

    then restart. No extra models.

    Common issues & troubleshooting

    The pruned model looks worse. Precision is the usual culprit. fp16 is almost always safe; fp8 trades real quality for size and isn't a free lunch. If quality dropped, re-prune at fp16 (or bf16) before blaming anything else.

    I can't find the output file. Check save_folder - a relative path saves under ComfyUI's output folder, not models/checkpoints. Move it into your checkpoints folder afterward, or point save_folder at an absolute path.

    Nothing happens / it's an output node. Right - you can't feed its result into a sampler in the same graph. It writes a file; you load that file in a fresh run. Queue the prompt, then go find the checkpoint on disk.

    It's experimental, so verify. Load the pruned checkpoint and generate a test image before you throw away the original. Dedicated prune scripts exist too; this node is the convenient in-Comfy option, not the only one.

    Categorymtb/prune

    Inputs (14)

    NameTypeDefaultDescription
    save_separatelyBOOLEANfalse
    save_folderSTRINGcheckpoints/ComfyUI
    fix_clipBOOLEANtrue
    remove_junkBOOLEANtrue
    ema_modeCOMBOremove_ema3 options: disabled, remove_ema, ema_only
    precision_unetCOMBOfull5 options: full, fp32, fp16, bf16, fp8
    operation_unetCOMBOconvert3 options: copy, convert, delete
    precision_clipCOMBOfull5 options: full, fp32, fp16, bf16, fp8
    operation_clipCOMBOconvert3 options: copy, convert, delete
    precision_vaeCOMBOfull5 options: full, fp32, fp16, bf16, fp8
    operation_vaeCOMBOconvert3 options: copy, convert, delete
    unetoptMODEL
    clipoptCLIP
    vaeoptVAE

    Outputs (0)

    No outputs