Nodes//Nougan Qwen 2.1 RefMod Encode 🎯
ComfyUI Node

Nougan Qwen 2.1 RefMod Encode 🎯

Qwen Image 2.1 encode with baked references β€” and the extra latent output

By WinnouganΒ·Created 3 months agoΒ·Updated about 16 hours agoΒ· 10
Nougan Qwen 2.1 RefMod Encode 🎯
  • clip
  • extra_image
  • vae
  • positive
  • negative
  • latent
β—„promptβ€”β–Ί
β—„negative_promptβ€”β–Ί
β—„refmod_1β–Ύβ–Ί
β—„refmod_2β–Ύβ–Ί
β—„refmod_3β–Ύβ–Ί
β—„extra_image_resolution1024β–Ί
β—„ref_strength1.00β–Ί

This is the node you actually keep in your workflow. Nougan Qwen 2.1 RefMod Encode 🎯 is a drop-in for Text Encode Qwen Image 2.1, except the references come from baked files - pick a character by name, wire conditioning out, done.

Qwen 2.1 is the friendliest of the reference-capable families in this pack, and the reason is architectural: it handles reference latents natively. No model patch, no Ostris side-pack, no edit LoRA with a specific training flag. The Krea 2 and MOSS branches of RefMod need all of that; this one needs a VAE and a CLIP.

What's on the node

clip - the Qwen Image 2.1 text encoder.

prompt and negative_prompt - both real, both used. Qwen's edit path responds to negatives in a way that some of the newer edit models don't.

refmod_1 (required, None allowed), refmod_2, refmod_3 - dropdowns from models/refmods/qwen21. Up to sixteen references can live in a baked file; three per encode node is the wiring limit.

extra_image + vae - a reference you haven't baked. extra_image_resolution (default 1024, step 32, 0 = original) sizes it.

ref_strength - how long the references stay in play, expressed as a fraction of the denoising steps from the start. It's a schedule, not a volume knob: 1.0 uses them on every step, 0.6 lets the references steer the first 60% and then the prompt finishes, 0 switches them off. Lower is looser likeness and more prompt freedom - and unlike an amplitude slider, it behaves predictably, because most composition decisions land in the early steps anyway.

The three outputs

  • positive (CONDITIONING)
  • negative (CONDITIONING)
  • latent (LATENT) - the bit that surprises people. You don't need an Empty Latent Image node downstream; this hands you one at the size the references imply. If you're used to sizing by hand, check whether you're now setting it twice.

What happens under the hood (short version)

The text encoder looks at every reference image, drops the vision tokens from its output, and the DiT splices each reference latent into the prompt sequence at the slot where that image's tokens used to be. That's why the matching Bake node stores a copy of the image alongside the latent - the encoder genuinely needs the picture, every run. ref_strength then decides how much of the denoise those spliced references survive into.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Winnougan/Nougan_Nodes
# restart ComfyUI

Or ComfyUI Manager β†’ "Nougan". Nothing extra: no model patch, no side-pack, no pip installs. Hard-refresh after restarting so the refmod picker loads - otherwise you get a dropdown that only ever says None and a suspicion that baking failed.

Where people get burned

Empty dropdown. Either you haven't baked anything, or the files aren't under models/refmods in the qwen21 subfolder, or you baked for a different family. Each family's refmods are keyed by metadata and deliberately invisible to the others.

A stock text-encode node left in the graph. It's a drop-in replacement - if the old node is still there and still wired to the sampler, the references never reach it. Delete it, don't mute it.

Baking at 1MP Γ— 8 and calling it "slow". Every reference contributes prompt slots and vision passes. Two is the honest default for character work; the cap of sixteen is a ceiling, not a target.

Expecting the licence drama. There isn't any - the Qwen-Image family is Apache 2.0, which is precisely why people left Kontext's anti-circumvention clause behind for it. That doesn't make the model unfiltered in practice, but it does mean your fine-tunes and LoRAs aren't a licence problem.

CategoryNougan/RefMod

Inputs (10)

NameTypeDefaultDescription
clipCLIPβ€”
promptSTRINGβ€”
negative_promptSTRINGβ€”
refmod_1COMBO1 options: None
refmod_2optCOMBO1 options: None
refmod_3optCOMBO1 options: None
extra_imageoptIMAGEOptional plain reference(s), encoded on the fly. Needs the VAE.
vaeoptVAEOnly needed for extra_image.
extra_image_resolutionoptINT10240–4096β€”
ref_strengthoptFLOAT1.000–1How long the references stay active, as a fraction of the denoising steps counted from the start. 1.0 = every step (default, same as before). 0.6 = the references steer the first 60% of the steps, then the prompt alone finishes. 0 = references off. Lower = looser likeness and more prompt freedom.

Outputs (3)

NameTypeDescription
positiveCONDITIONINGβ€”
negativeCONDITIONINGβ€”
latentLATENTβ€”