Nodes/ComfyUI-TJ_NODE/Free Text Encoder VRAM (TJ)
ComfyUI Node

Free Text Encoder VRAM (TJ)

A deliberate place to drop your text encoder out of VRAM

By designloves2·Created 3 months ago·Updated 5 days ago· 13
Free Text Encoder VRAM (TJ)
  • clip
  • trigger
  • trigger
  • report

Text encoders are the sneakiest part of the 2026 VRAM budget. The diffusion model gets all the attention, but on LLM-encoded architectures the CLIP/text encoder is a separate file with its own footprint - Flux 2 Dev's 24B Mistral encoder is roughly 18GB on its own - and it shares the card with the sampler while you're actually generating. Free Text Encoder VRAM (TJ) exists to give you a hard, explicit point in the graph where the encoder gets forced out of VRAM, right after it's done its job.

Now, honest framing first: ComfyUI's memory management is already smart about this. When a text encoder isn't needed for the next step, the engine unloads it. Most of the time you don't need this node. But "most of the time" isn't "always" - the heuristic can leave fragments resident, and on a tight card that's the difference between a clean 20-step run and OOM swaps during sampling. This node is the sledgehammer option: it unloads the encoder right there, no trusting the scheduler to get around to it.

The mechanism is refreshingly small. You connect two things:

  • clip - the text encoder you want evicted. Connect the exact same CLIP you used to build the conditioning.
  • trigger - any type at all. The node does nothing to it; it just passes it through. It exists so you can wire the conditioning through the node and create an ordering: "once this conditioning exists, unload the encoder."

Internally it grabs the clip's patcher, calls unload_model_and_clones() plus soft_empty_cache(), then reads free VRAM before and after so you get a report line like free VRAM: 11.20GB -> 14.80GB (+3.60GB). That's the report output - a STRING you can inspect with a show-text node if you want proof it did anything.

The trigger output is a straight pass-through of whatever you fed in, so you can insert this node mid-chain without breaking the data flow. It's also deliberately generic - it says "H3" nowhere in the logic, and works on any CLIP-using workflow (checkpoint loaders, dual-CLIP setups, anything). The typical spot: right after your text encode node, before the sampler, so the diffusion model has the whole card during the long part.

The one real caveat: if your workflow needs the encoder again later - say you do a second conditioning pass after sampling, or you're using an in-graph LLM that shares the card - unloading early means ComfyUI will reload it on demand, and that reload has a cost. This is a tool for the "encode once, then sample hard" shape of workflow, not for graphs that bounce between encode and sample repeatedly.

Install

It's part of the ComfyUI-TJ_NODE pack:

cd ComfyUI/custom_nodes
git clone https://github.com/designloves2/ComfyUI-TJ_NODE

or via ComfyUI Manager, searching "ComfyUI-TJ_NODE", then restart. This node itself needs nothing extra - it's pure comfy.model_management calls - though the pack as a whole pulls in llama-cpp-python and friends for its LLM nodes if you install everything.

Troubleshooting

  • Report says "clip.patcher를 찾지 못해..." (patcher not found) - the connected input isn't a real CLIP object with a patcher, or it's already been unloaded/patched in a way the node can't reach. It returns your trigger untouched and moves on; no harm, but also no unload.
  • You see no VRAM gain - check the report numbers. If they're unchanged, the encoder was likely already swapped out by ComfyUI's own scheduler (in which case, good - you're fighting a ghost) or the device it unloaded from isn't the one you're watching.
  • Workflow got slower - the encoder is being reloaded later in the graph. Move the node later, or drop it if ComfyUI's built-in management was already doing the job.
Category ✨ TJ_Node/Utility

Inputs (2)

NameTypeDefaultDescription
clipCLIP내리고 싶은 텍스트 인코더. conditioning을 만든 그 clip을 그대로 연결하세요.
trigger*conditioning 등 아무 타입이나 연결하세요 — 이 노드는 그 값을 그대로 통과시키기만 하고, 실제로 하는 일은 '이 입력이 준비된 시점'에 clip을 강제로 언로드하는 것.

Outputs (2)

NameTypeDescription
trigger*
reportSTRING