Nodes/ZenTrainer/MOSS Edit Encode
ComfyUI Node

MOSS Edit Encode

Your instruction and your photo, wired the way the LoRA was trained

By Nynxz·Created 8 days ago·Updated about 23 hours ago· 5
MOSS Edit Encode
  • clip
  • vae
  • image
  • image2
  • image3
  • positive
  • negative
  • latent
◄prompt—►
◄encoder_sees_inputtrue►
◄reference_methodindex_timestep_zero►
◄megapixels1.00►
◄negative►

You have a photo and a sentence describing what should change about it. MOSS Image can do that, and an edit LoRA makes it do it well - but an edit LoRA only behaves if sampling matches training. This node is the "matches training" part, wrapped into one box.

It bundles three jobs people usually get wrong separately: sizing the empty latent, turning your reference pictures into latents the model can attend to, and (optionally) letting the text encoder look at the pictures while it reads your instruction.

What it's doing inside

MOSS Image's conditioning can carry something ComfyUI calls reference_latents - the raw latents of other pictures, attached to the conditioning rather than fed in as a channel input. Krea 2 and Kontext take references this way too, and the difference matters: a reference can move things around in the output, where a channel input is closer to painting over what's already there. ZenTrainer's changelog lists both routes for MOSS edits; this node is the reference route.

Per the source:

  • The size is computed, not typed. Area is megapixels × 1024², aspect ratio comes from the first picture, and both sides snap to multiples of 64 - the same buckets training uses. A 2:3 photo at 1 megapixel gives you roughly 832×1280, not whatever your Empty Latent node says.
  • Each picture is VAE-encoded at that size, center-cropped. Reference latents get cropped to the output frame, exactly as training's were.
  • The encoder sees the whole picture, unscaled-down to a 384×384 area, wrapped in MOSS's own chat template with Picture 1: markers before each image - the ai-toolkit layout. That's encoder_sees_input, and it's why the instruction can say "the man on the left" and land.
  • The latent output is zeros in the first reference's shape. It's the empty latent for your sampler, nothing more.

The inputs you actually touch

clip, vae, and image are the plumbing. prompt is your instruction - write a sentence, not tag soup, because the text encoder here is a vision-language LLM.

Then three real decisions:

  • megapixels (default 1.0, 0.25–4.0). MOSS's authors put the floor around 1MP; the pack's own MOSS profile calls 1024² the recommended minimum. Go up if you're editing fine detail, down if VRAM is tight.
  • encoder_sees_input (default on). The tooltip is the instruction: match the LoRA's "Encoder sees the input" setting. If you trained without it, turn it off - the node then does a plain text-only encode and the pictures reach the model only as latents.
  • reference_method: index_timestep_zero (default) or index. Also a match-the-LoRA field. index_timestep_zero is ai-toolkit's layout; index puts references in the sequence at the step's noise level. Wrong choice doesn't error, it just quietly samples differently than you trained.

image2 and image3 take extra references. negative is optional and defaults to empty - fine for most edit work, and CFG 3 doesn't need much.

Outputs are positive, negative, and latent. The two conditionings go to your guider; the latent is what your sampler wants as its starting noise.

Install

Same pack, same steps. Search ZenTrainer in ComfyUI Manager and install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Nynxz/ZenTrainer
# restart ComfyUI

A git clone needs the web app built once (cd web && pnpm install && pnpm build) for the ZenTrainer UI; the nodes work without it. Requires ComfyUI 0.41 or newer.

Nothing to pip install here - requirements.txt says everything ships with ComfyUI, and the optional optimizers are training-only. You do need MOSS Image on disk: the diffusion model, its Qwen3.5 text encoder, and the VAE. ComfyUI has no MOSS template, so if ZenTrainer's model picker doesn't recognise the family, load the files by hand.

Where people get burned

You also need MOSS Edit Model (references). This node only attaches the reference latents to the conditioning. Stock MOSS Image in ComfyUI doesn't read them - the pack has to patch the model to consume them. Skip that node and your carefully cropped reference is silently dropped: you get a text-to-image render that looks like it ignored your photo.

Only the first frame of a batch counts. The source takes image[:1]. Load a batch of three photos into image and you get one reference; use image2/image3 for genuinely multiple references.

The crop is real. Aspect ratio comes from the first picture and everything else is center-cropped to it. A tall reference with the thing you want changed near the top loses that thing before the model sees it - while the encoder still saw the whole picture, so your prompt can refer to detail that's no longer in frame. Easy to misdiagnose as a weak LoRA.

"Grounded edits need a vision-language text encoder." That's a real error from this node's code: encoder_sees_input on with a plain CLIP wired in. MOSS's encoder is Qwen3.5; use it, or switch the flag off.

Sampling defaults that work: Euler, 50 steps, CFG 3, with layer 22 skipped in the negative pass - that's what MOSS's own user guide recommends and what the shipped MOSS profile applies.

Categoryzentrainer/moss

Inputs (10)

NameTypeDefaultDescription
clipCLIP—
vaeVAE—
imageIMAGE—
promptSTRING—
encoder_sees_inputBOOLEANtrueThe text encoder looks at the pictures with the instruction. Match the LoRA's 'Encoder sees the input'
reference_methodCOMBOindex_timestep_zeroHow the pictures join the sequence, as the LoRA trained: index_timestep_zero (the default: clean, attending to each other, ai-toolkit's layout) or index (at the step's noise level, attending to everything)
megapixelsFLOAT1.000.25–4—
negativeoptSTRING—
image2optIMAGE—
image3optIMAGE—

Outputs (3)

NameTypeDescription
positiveCONDITIONING—
negativeCONDITIONING—
latentLATENT—