Nodes/comfyui-save-vpred/Save Checkpoint V-Pred
ComfyUI Node

Save Checkpoint V-Pred

Merging a vpred model? This node saves it before it forgets it's vpred.

By Miyuutsu·Created 2 years ago·Updated 2 years ago· 4
Save Checkpoint V-Pred
  • model
  • clip
  • vae
    filename_prefixcheckpoints/V-Pred

    The one thing a v-prediction model needs to survive is a pair of keys. ComfyUI's SDXL loader checks the checkpoint for a v_pred key to switch to V_PREDICTION sampling, and a ztsnr key to turn on the zero-terminal-SNR schedule that makes it trainable. Feed a vpred model through a normal merge and ComfyUI's stock SaveCheckpoint writes the result out without those keys - load it back up and you get pure static, no error, nothing to tell you why. Save Checkpoint V-Pred is a drop-in replacement that puts the keys back. It exists for the people merging NoobAI vpred 1.0 and its relatives with eps models and watching the result come out as noise.

    How it works

    Under the hood it's a near-copy of ComfyUI's built-in SaveCheckpoint, hardcoded for the vpred case. It takes whatever MODEL is in your graph, grabs the CLIP and VAE state dicts, and dumps a .safetensors file with state_dict_for_saving(). Then it does two things the stock node won't: it injects empty v_pred and ztsnr tensors into the state dict, and it writes modelspec metadata declaring modelspec.predict_key = "v" and modelspec.prediction_type = "v-zsnr". Presence of the keys is all the loader checks - the tensors are empty markers, and that's the whole trick.

    Which is worth being honest about: this node tags, it doesn't convert. If you feed it a plain epsilon-prediction model, you get a checkpoint labeled vpred whose weights were never trained for velocity prediction, and sampling it that way gives you garbage. Use it when the model in your graph genuinely is vpred - a vpred checkpoint you loaded, or a merge built on one - so the flag survives the save. That's the intended job (it lives in advanced/model_merging), and it's a genuinely useful one. Also note the metadata hardcodes stable-diffusion-xl-v1-base: this is an SDXL tool. Don't run it on an SD 1.5 graph.

    The inputs

    All four are required, and it's an output node - nothing comes out of it.

    • model - the merged or patched model you want to keep.
    • clip and vae - the text encoder and VAE to embed, same as any checkpoint save.
    • filename_prefix - defaults to checkpoints/V-Pred, so it writes V-Pred_00001_.safetensors.

    That's the whole list. The one gotcha: the file lands in ComfyUI's output folder (output/checkpoints/…), not models/checkpoints/, because it reuses the image-save path machinery. Grab it from there and drop it in models/checkpoints/ to use it like a normal checkpoint. The workflow graph also gets embedded in the metadata as JSON unless you launched ComfyUI with --disable-metadata.

    Install

    No dependencies beyond ComfyUI itself - no requirements file, nothing to download, it just imports torch and safetensors that are already there. Either search "Save Checkpoint V-Pred" in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Miyuutsu/comfyui-save-vpred
    

    Restart ComfyUI and the node appears under advanced/model_merging → Save Checkpoint V-Pred.

    Troubleshooting

    The failure modes here are all downstream. If you load a file this node saved and get static, the usual suspects, in order: you're sampling it in eps mode (set ModelSamplingDiscrete to v_prediction with zsnr enabled, or just let ComfyUI autodetect - current versions will), you're using CFG at eps levels around 5-7 instead of CFG++ at 1.5-2.0 or a RescaleCFG node, or you tagged a genuinely-eps model. Static is the signature vpred symptom precisely because it produces no error - one wrong flag and the whole run looks like a broken model. And if the file isn't where you expected, check output/, not models/. For a one-function pack that saves you a specific, painful class of broken merge, that's about all there is to it.

    Categoryadvanced/model_merging

    Inputs (4)

    NameTypeDefaultDescription
    modelMODEL
    clipCLIP
    vaeVAE
    filename_prefixSTRINGcheckpoints/V-Pred

    Outputs (0)

    No outputs