🤗 Diffusers Compel Prompt Embedding
Prompt weighting, but a different dialect than ComfyUI's own
- pipeline
- positive prompt embedding
- negative prompt embedding
This is the CLIPTextEncode equivalent for the ComfyUI-J family - it turns your prompt text into the actual embeddings the sampler reads. Two boxes in, two embeddings out. The thing worth knowing before you type a single word into it: the weighting syntax here isn't ComfyUI's own.
What it is and how it works
The node name gives it away - it's built on Compel, the prompt-weighting library that ships alongside HuggingFace's Diffusers. Compel's whole job is turning a plain-text prompt into a weighted embedding tensor, handling emphasis and de-emphasis on specific phrases, and doing it as a proper embedding-space blend rather than a token hack. It reads both your positive and negative prompt in one pass and produces a matched pair of embeddings - this is also why the node returns two outputs instead of one: the sampler needs both to run classifier-free guidance.
Look at the default value in the positive prompt box and you can see the syntax directly: (masterpiece)1.2, (best quality)1.4. That's Compel's own convention - a phrase in parentheses, followed by a multiplier with no colon. ComfyUI's native prompt weighting uses (word:1.3) instead. Same underlying idea (turn up or down how much a phrase pulls on generation) but different punctuation, and if you paste a ComfyUI-style weighted prompt in here out of habit, it won't parse the way you expect.
The inputs and outputs that matter
pipeline(required) - theDIFFUSERS_PIPELINEfrom a Diffusers Pipeline or Diffusers XL Pipeline node. This is what supplies the text encoder Compel actually runs against.positive_prompt(required, multiline, default(masterpiece)1.2, (best quality)1.4) - what you want.negative_prompt(required, multiline, default empty) - what you don't. Worth remembering this pack targets SD1.5/SDXL-class checkpoints exclusively, where negative prompting still does real work at normal CFG values - unlike on newer, guidance-distilled models where a negative box can silently do nothing at CFG 1. You're safe leaning on it here.
Outputs are positive prompt embedding and negative prompt embedding, both DIFFUSERS_PROMPT_EMBEDDING - wire them straight into the matching inputs on the Diffusers Generator node. They're a matched pair; there's no reason to mix a positive embedding from one call with a negative from another.
Installing it
It's part of the ComfyUI-J pack, not a separate install. ComfyUI Manager: search ComfyUI-J, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Jannchie/ComfyUI-J
cd ComfyUI-J
pip install -r requirements.txt
Compel is a real, separately-versioned PyPI package pulled in by that requirements file alongside Diffusers itself. It's a small, stable library, so it's not usually the thing that breaks - but it's one more dependency added to ComfyUI's shared, unisolated Python environment, and the general dependency-conflict risk that applies to the rest of this pack applies here too.
Where people get burned
The syntax mismatch is the one that actually costs people time: bring your (word:1.3)-style habits over from stock ComfyUI and Compel won't error, it'll just treat the colon as literal text and not weight anything the way you intended. If your carefully weighted prompt is producing suspiciously flat, unweighted-looking output, check the punctuation before you check anything else.
Second, this node needs a pipeline to run against - it can't precompute an embedding in isolation the way a plain tokenizer could, because the weighting math happens against that specific text encoder's embedding space. If you're prototyping prompts and swapping checkpoints frequently, remember each new pipeline needs its own pass through this node; the embeddings aren't portable across a checkpoint swap.
And a general Compel property worth knowing rather than discovering by accident: because it works in embedding space rather than truncating tokens, very long prompts behave more gracefully here than they might with a plain CLIP tokenizer hitting the 77-token wall - but "more graceful" isn't "unlimited," and an extremely long prompt still dilutes itself the same way any prompt soup does.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| pipeline | DIFFUSERS_PIPELINE | — | |
| positive_prompt | STRING | (masterpiece)1.2, (best quality)1.4 | — |
| negative_prompt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| positive prompt embedding | DIFFUSERS_PROMPT_EMBEDDING | — |
| negative prompt embedding | DIFFUSERS_PROMPT_EMBEDDING | — |