Nodes/h4_Live/h4 - Model Pruner
ComfyUI Node

h4 - Model Pruner

Slash your checkpoint's waistline

By m3rr·Created 9 months ago·Updated 10 days ago· 1
h4 - Model Pruner
  • model
  • clip
  • vae
  • pruned_model_path
prune_modeRaw File (Fast - Recommended)
target_precisionauto
filename_prefixh4_Pruned_
saved_model_path

Checkpoints ship fat. A model trained with EMA, optimizer state, and training-only extras can be a full gigabyte heavier than the weights you actually need to generate images. The h4 - Model Pruner is the pack's answer to that: strip the training-only cruft off a checkpoint and hand you a leaner file. It sits right next to H4_ModelSave and H4_ModelMerger in the toolkit's model-merging family, and it's the node you run right before you're happy with a merge and want it to take up less disk.

How it works

The idea is simple: delete the tensors that only matter during training (EMA copies, optimizer slots, and similar), then save what's left. The execution differs by mode, which is the interesting part.

Raw File (Fast - Recommended) works entirely on disk. You feed it the saved_model_path output from H4_ModelSave, it reads the file, strips the training-only weights, and writes a pruned copy - no model ever lands in VRAM, so it's fast and featherweight on memory. This is the mode to use on big checkpoints.

In-Memory (Passthrough) instead takes live MODEL/CLIP/VAE inputs and produces the pruned result as part of the graph. You trade speed and memory for the convenience of pruning without ever touching disk first. Use it when you want to prune a merged model that only exists in the current workflow.

Both modes let you set target_precision - auto, float16, bfloat16, float32, or the float8 variants - which means pruning and re-quantizing in one pass. That's a genuinely useful combo: strip the fat and shrink the precision in the same run.

The inputs and outputs

  • prune_mode - Raw File vs In-Memory. Pick based on whether you're starting from a path or from live nodes.
  • target_precision - output precision.
  • filename_prefix - output name, default h4_Pruned_.
  • saved_model_path - required for Raw File mode; this is where the H4_ModelSave handshake comes in.
  • model, clip, vae - used by In-Memory mode.

One output: pruned_model_path, a string with the saved file location.

Installing it

It's part of h4_Live:

cd ComfyUI/custom_nodes
git clone https://github.com/m3rr/h4_Live
# restart ComfyUI

or ComfyUI Manager → search "h4_Live." No extra dependencies.

Where it can bite you

Pruning is destructive by design - once you've written the pruned file, the training weights are gone, and that's a one-way door. Keep the original until you've confirmed the pruned model loads and generates identically (it should; those tensors do nothing at inference time). The float8 precision options carry the same caveat as everywhere else: they need recent PyTorch/GPU support and not every loader reads them back, so don't prune straight to float8 as your first move. And keep expectations measured: pruning shrinks files but it's not magic. If your model is a merge where half the size is baked-in weights you actually use, the savings will be modest. It shines on checkpoints that shipped with full training state and were never cleaned.

Categoryh4_ToolKit/Model Merging

Inputs (7)

NameTypeDefaultDescription
prune_modeCOMBORaw File (Fast - Recommended)2 options: Raw File (Fast - Recommended), In-Memory (Passthrough)
target_precisionCOMBOauto6 options: auto, float16, bfloat16, float32, float8_e4m3fn, float8_e5m2
filename_prefixSTRINGh4_Pruned_
saved_model_pathoptSTRINGConnect the 'saved_model_path' from H4_ModelSave for Raw File mode.
modeloptMODEL
clipoptCLIP
vaeoptVAE

Outputs (1)

NameTypeDescription
pruned_model_pathSTRING