Nodes/VACE Tools/WanVideo Save Merged Model
ComfyUI Node

WanVideo Save Merged Model

Bake your LoRAs into a checkpoint so you stop re-applying them

By ethanfel·Created 7 months ago·Updated 6 months ago· 9
WanVideo Save Merged Model
  • model
    filename_prefixmerged_wanvideo
    save_dtypesame
    custom_path

    Every Wan workflow with a favorite LoRA pays the same tax: load the base model, re-apply the LoRA, every single time. WanVideoSaveMergedModel is the "get out of jail" node - it takes a WANVIDEOMODEL that already has its LoRAs merged and writes it out as a .safetensors file, so the next run loads one self-contained checkpoint instead of a base plus a stack of adapters. That's its whole job, and for anyone generating the same character or style on repeat, it removes both the setup time and a failure point.

    It shows up under the WanVideoWrapper category, and there's a reason: the model input is a WANVIDEOMODEL - the custom type from Kijai's ComfyUI-WanVideoWrapper, the ecosystem this pack lives in. That means you need the wrapper installed to feed this node anything at all.

    How it works

    The node's real skill is figuring out which state dict to save, because a Wan wrapper model doesn't always hold its weights the way you'd expect. It tries three sources in order:

    1. The wrapper's merged state dict (pipeline["sd"]) - this is the good one, because after a merge it contains the base plus VACE weights plus your LoRAs, all in one dict. When this is available, that's what gets saved.
    2. The diffusion model's state_dict() - works if the model was loaded to a real device.
    3. A fallback reload from the checkpoint file on disk - only used if the weights are still on meta device (shape-only, no data). The catch, and it's a loud one in the code: this saves the base checkpoint without the VACE weights, and the node logs a warning to that effect. You'd only hit it if your loader isn't keeping the merged dict around.

    Beyond the sourcing, the mechanics are deliberate: it clones every tensor before saving (safetensors can't handle shared/aliased weights, and a naive dedupe breaks ComfyUI's own loader), writes the source model name and merged LoRA names + strengths into the file's metadata for traceability, and appends _1, _2, … rather than overwriting an existing file.

    Inputs that matter

    • model - the WANVIDEOMODEL with merged LoRA, straight from the WanVideo Model Loader.
    • filename_prefix (default merged_wanvideo) - the output file is <prefix>.safetensors.
    • save_dtype - same (keep each tensor's current dtype), bf16, fp16, or fp32. The tooltip's advice is the one to remember: if you loaded the model in fp8, set this explicitly. "Same" on an fp8 model saves fp8.
    • custom_path - absolute directory override. Leave empty and it saves to ComfyUI/models/diffusion_models/, which is exactly where you'll want it to live so you can load it back as a diffusion model.

    It has no outputs - it's an output node, terminal, done.

    How to install it

    Part of ethanfel's ComfyUI-VACE-Tools pack (the same dev behind ComfyUI-LoRA-Optimizer and ComfyUI-Krea2TexTEncoder):

    cd ComfyUI/custom_nodes/
    git clone https://github.com/ethanfel/Comfyui-VACE-Tools.git
    

    Restart ComfyUI, or search "VACE Tools" in ComfyUI Manager. The pack declares zero Python dependencies - this node runs on what ComfyUI already bundles. The real dependency is outside the pack: you need Kijai's ComfyUI-WanVideoWrapper installed to produce the WANVIDEOMODEL input, and the actual Wan/VACE checkpoints are separate downloads regardless.

    Common issues

    The most likely stumble is the meta-device fallback: if your merged model's weights aren't materialized, the node can only save the base checkpoint and will warn about it - you'll get a model that behaves like stock Wan, no LoRA baked in. If that happens, the fix is on the loader side: make sure the wrapper is keeping its merged state dict. And double-check the dtype before you save; a "same" save on an fp8-loaded model is how people end up with a checkpoint that loads slower or errors on a card that expects bf16.

    CategoryWanVideoWrapper

    Inputs (4)

    NameTypeDefaultDescription
    modelWANVIDEOMODELWanVideo model with merged LoRA from the WanVideo Model Loader
    filename_prefixSTRINGmerged_wanvideoFilename prefix for the saved model
    save_dtypeoptCOMBOsameCast weights to this dtype before saving. 'same' keeps the current dtype of each tensor. Recommended to set explicitly if model was loaded in fp8.
    custom_pathoptSTRINGAbsolute path to save directory. Leave empty to save in ComfyUI/models/diffusion_models/

    Outputs (0)

    No outputs