Nodes/Emu35-Comfyui-Nodes/Emu 3.5 Clear Cache
ComfyUI Node

Emu 3.5 Clear Cache

The 'free my VRAM, please' button Emu needs

By EricRollei·Created 9 months ago·Updated 9 months ago· 5
Emu 3.5 Clear Cache
  • any_input
  • model
  • vq_model

    Emu 3.5 is not a polite model. It's a 34-65B autoregressive beast that grabs tens of gigabytes the moment you load it, and if you try to run a second generation without clearing the deck, it will happily OOM on you. Emu 3.5 Clear Cache is the original V1 answer to that: a dead-simple node you drop at the end of a branch that shoves the loaded model out of VRAM so the next task has room.

    It's not clever and it doesn't need to be. When triggered, it takes the wired model and vq_model (both optional), moves them to CPU, deletes its local references, then runs gc.collect(), torch.cuda.empty_cache(), and torch.cuda.ipc_collect(). That's the whole job. It's an output node, so it returns nothing - you use it for its side effect, not its wires.

    The inputs that matter

    • any_input - the required * port. It exists purely to trigger execution; wire anything into it (even the image you just generated) so ComfyUI runs this node when you want it to.
    • model / vq_model - optional EMU_MODEL and EMU_VQ ports. If you wire the loaded model in, it gets explicitly unloaded instead of just relying on the cache being emptied.

    Because the model gets moved to CPU and dereferenced, this is a terminal node in practice: plan it at the end of a workflow branch, not in the middle of one that still needs the model on the GPU.

    Install

    It ships in the same pack as everything else - install once, get all twelve nodes:

    cd ComfyUI/custom_nodes
    git clone --recursive https://github.com/EricRollei/Emu35-Comfyui-Nodes.git emu35
    cd emu35
    pip install -r requirements.txt
    

    (Or use ComfyUI Manager and search "Emu3.5 Nodes".) The --recursive flag matters - it pulls the patched BAAI Emu3_5_repo submodule with the transformers 4.57+ compatibility fixes. Weights go in ComfyUI/models/emu35/, and the pack needs real GPU: 48GB+ VRAM for BF16, or the NF4 quantized weights (wikeeyang/Emu35-Image-NF4) for a 24GB card.

    When you actually need it

    If you're on a 24GB card with NF4 weights, you'll reach for this constantly. The known-good recipe people converge on: run one generation, clear the cache, then run the next - because a resident 34B model plus the vision tokenizer is already most of your VRAM before you've generated a single token. On a 96GB card you can often skip it, but it's cheap insurance after a long T2I.

    One honest note: this is the V1, minimal utility. If you want memory telemetry, per-level cleanup depth, and a pass-through so you can chain it mid-workflow, the pack's newer Emu 3.5 VRAM Cleanup and Emu 3.5 Memory Manager nodes supersede it. Clear Cache remains perfectly fine when you just want the "shut it all down" button.

    CategoryEmu3.5

    Inputs (3)

    NameTypeDefaultDescription
    any_input*
    modeloptEMU_MODEL
    vq_modeloptEMU_VQ

    Outputs (0)

    No outputs