ComfyUI Node

💾 Save LDM Checkpoint

Shrink that 6 GB checkpoint to 3 GB — and snapshot the pipeline you actually run

By Winlensky·Created 22 days ago·Updated 16 days ago· 1
💾 Save LDM Checkpoint
  • model
  • bert
  • vae
    filenameldm_f8

    Most custom-node packs don't ship a save-your-own-checkpoint node, and this one has a boring-sounding but genuinely useful job: it takes the fully loaded pipeline - UNet + BERT encoder + VAE + noise schedule - and writes it back out as a single .safetensors file into ComfyUI/models/ldm. Its most practical use is precision conversion. Load the 6 GB fp32 checkpoint with precision set to fp16, run this node, and you've got a 3 GB fp16 file that loads faster, uses half the VRAM, and is byte-for-byte the same architecture.

    Think of it as the checkpoint equivalent of "save as." You loaded something, maybe you have a finetune you want to keep, or you want a lighter copy for daily use - this is how you get one.

    How it works

    The node takes the three outputs of 🏰 Load LDM Checkpoint - model, bert, and vae - plus a filename. On run, it writes each component's state dict back out under its original CompVis key prefixes:

    • model.diffusion_model.* - the UNet
    • cond_stage_model.transformer.* - the BERT text encoder
    • first_stage_model.* - the VAE
    • plus the 12 noise-schedule tensors (betas, alphas_cumprod, and friends)

    That prefix discipline is the whole trick: the file it produces is structurally identical to the originals, so the loader reads it back without any conversion, and it could in principle be consumed by other tools that understand the original format. Two deliberate omissions worth knowing: model_ema weights are not saved (they're training-time EMA copies, dead weight at inference), and the file is saved in whatever precision the model was loaded with - which is exactly how you'd produce an fp16 or bf16 copy in the first place.

    filename defaults to ldm_f8, and .safetensors is appended automatically, so type ldm_f8_fp16, not ldm_f8_fp16.safetensors. Files land in ComfyUI/models/ldm, and it writes metadata (format, source, precision) into the file header - handy for telling your converted copies apart later.

    The recipe that makes it worth installing

    The fp16 and bf16 downloads on the author's HuggingFace repo exist precisely because this conversion is useful - but you can do it yourself if you only grabbed the fp32 file:

    1. Load the fp32 checkpoint with precision = fp16 (and memory_mode = keep if your GPU fits it - the node reads all three components).
    2. Wire MODEL/BERT/VAE into 💾 Save LDM Checkpoint.
    3. Set a filename and run it once.

    You now have a ~3 GB copy that behaves the same at generation time for a fraction of the VRAM cost. bf16 works the same way if you're on Ampere+.

    Wiring and gotchas

    It's an output node with no sockets coming out - it runs purely for the side effect, and it appears to "do nothing" in your graph because there's nothing to connect downstream. That's normal; watch the console for [LDM] saved ... to confirm it worked.

    Gotchas, in order of how often they bite:

    • Loaded precision is saved precision. Expecting a small fp16 file but loaded the ckpt as fp32? You'll get a full-size fp32 file. Set the loader's precision first.
    • Don't type the extension. .safetensors is added for you; ldm_f8.safetensors becomes ldm_f8.safetensors.safetensors.
    • The saved file must be picked up by the loader. If your new file doesn't appear in the checkpoint dropdown, restart ComfyUI so it rescans models/ldm.
    • No output socket means no preview. Beginners often think the node failed because nothing renders. The console message is your success signal.

    Install is the same as the rest of the pack - ComfyUI Manager (search comfyui_compvis_ldm) or git clone https://github.com/Winlensky/comfyui_compvis_ldm into custom_nodes, then restart.

    CategoryLDM

    Inputs (4)

    NameTypeDefaultDescription
    modelLDM_MODELMODEL output from Load LDM Checkpoint.
    bertLDM_BERTBERT output from Load LDM Checkpoint.
    vaeLDM_VAEVAE output from Load LDM Checkpoint.
    filenameSTRINGldm_f8Output filename in models/ldm. The .safetensors extension is appended automatically.

    Outputs (0)

    No outputs