Nodes/Comfyui-DiffusersUtils/Diffusers Text Encode
ComfyUI Node

Diffusers Text Encode

Turn your prompt into diffusers conditioning — and why it's not ComfyUI conditioning

By lrzjason·Created 9 months ago·Updated 8 months ago· 14
Diffusers Text Encode
  • pipeline
  • image
  • diffusers_cond
promptMasterpiece, best quality, 8k uhd, photo realistic,
batch_size1

DiffusersTextEncode is the pack's prompt-encoding node, and it exists because these pipelines don't speak ComfyUI's native conditioning format. ComfyUI's CONDITIONING type and its standard KSampler are built around CLIP-era text encoders - SD, SDXL, Flux. LongCat 6B and GLM-Image, on the other hand, use language-model text encoders (Qwen2.5-VL for LongCat, T5/ByT5 + a vision-language encoder for GLM), and they do their own thing with the encoded output. So this node wraps pipeline.encode_prompt() and hands back a pack-specific DIFFUSERS_COND bundle instead of a normal conditioning tensor.

That's the single most important thing to internalize: you cannot feed this node's output into a stock KSampler. The two conditioning systems don't mix. The bundle is a dict carrying the encoded output, the pipeline type, the batch size, and your prompt text - and downstream nodes keep adding to it. DiffusersGenPriorTokens stuffs prior tokens and resolution into it; DiffusersSampling reads the embeddings back out. It's the pack's version of a context bus, which means it's also the pack's version of a stale-context hazard: keep the graph linear, pipeline → encode → sample, and don't expect the bundle to survive being split across branches.

Inputs

  • pipeline - required, from DiffusersPipeline. The node inspects it at runtime to pick the right encode path.
  • prompt - multiline; defaults to the author's Masterpiece, best quality, 8k uhd, photo realistic, boilerplate. For LongCat and GLM, plain descriptive language beats SDXL-style tag spam - these encoders are LLMs, not CLIP, and they read natural sentences fine.
  • image (optional) - only used when the pipeline supports image+text encoding (the LongCat edit pipelines). Wire an image here and it gets passed into the encoder alongside the prompt.
  • batch_size - 1–64, default 1. How many images the conditioning is prepared for.

Output

A single diffusers_cond output. It goes to:

  • DiffusersSampling directly (the LongCat text-to-image path),
  • or DiffusersGenPriorTokens first (the GLM path), which augments it and then forwards it to sampling.

How it works

Under the hood it checks whether the pipeline has an encode_prompt method (every pipeline this pack builds does), then calls it - with an image if you supplied one and the pipeline is an image-encoding type, otherwise text-only. The encoded result goes into the bundle without the node assuming anything about its shape, because LongCat and GLM return differently-structured encodings. If a pipeline lacks the method, you get a clear NotImplementedError rather than a silent failure.

Install

ComfyUI Manager → "Comfyui-DiffusersUtils", or:

cd ComfyUI/custom_nodes
git clone https://github.com/lrzjason/Comfyui-DiffusersUtils

Restart ComfyUI. The README's requirements.txt step is a dead end - no such file ships in the repo; the pack leans on ComfyUI's bundled diffusers/transformers. GLM pipelines additionally need the git-installs of transformers, diffusers, and peft described on the GLM nodes.

Troubleshooting

  • "No such node: CONDITIONING output" - you tried to wire this into a normal sampler. Don't. It only talks to this pack's nodes.
  • Image ignored - you're on a text-only pipeline type, or you wired the image into the sampling node instead of the encode node. The edit path wants the image here.
  • Memory: the text encoder is the forgotten VRAM hog on these models. LongCat's Qwen2.5-VL encoder is ~8B on its own; if you're squeaking by on VRAM, this node is where the pressure shows first.
CategoryDiffusers/Encode

Inputs (4)

NameTypeDefaultDescription
pipelinePIPELINE
promptSTRINGMasterpiece, best quality, 8k uhd, photo realistic,
imageoptIMAGE
batch_sizeoptINT11–64

Outputs (1)

NameTypeDescription
diffusers_condDIFFUSERS_COND