Nodes/ComfyUI-EditUtils/EditUtils: MOSS-Image Model Config lrzjason
ComfyUI Node

EditUtils: MOSS-Image Model Config lrzjason

MOSS-Image is text-to-image only. This node is the start of the workaround.

By lrzjason·Created 11 months ago·Updated 15 days ago· 271
EditUtils: MOSS-Image Model Config lrzjason
    • model_config
    ◄instruction►

    MOSS-Image doesn't take reference images. It's a text-to-image DiT, full stop. Everything the EditUtils pack does for it is a retrofit - a reference-image edit path grafted on in the same shape as the pack's Krea2 route - and this node is the piece that tells the encoder which retrofit you're running.

    What it's for

    ComfyUI-EditUtils juggles eight model families through one encoder. The switch is a dict. MossImageModelConfig_EditUtils emits the MOSS-Image dict, and EditTextEncode_EditUtils reads it and takes the MOSS branch instead of Qwen's or Flux's.

    That branch does two things worth understanding, because MOSS-Image's two halves have nothing in common with each other:

    • The text encoder is Qwen3.5-9B with its vision tower, so a reference can be grounded through the prompt as Picture n: <|vision_start|>… - the same trick Krea2 uses.
    • The VAE is the FLUX.2 packed autoencoder: 128 latent channels, 16 px per latent token.

    That second fact is what vae_unit=16 records. Every reference size in the graph snaps to that grid, so the latent and the token count stay in step.

    How it works

    The output is:

    {"model_name": "moss_image", "vae_unit": 16, "llama_template": "", "config_for": "moss_image"}
    

    llama_template is empty on purpose. The moss_image tokenizer owns its chat template - a user turn plus an open think block - and it inserts the vision blocks for the reference images itself. Hand it a custom template and those insertions don't happen, which is a silent quality problem rather than a crash.

    Inputs and outputs

    One optional input: instruction, multiline, default empty. It is unused. Its tooltip is blunt about it: the tokenizer builds its own chat template, leave it empty. It stays in the schema so you can swap a Krea2 or Qwen config node for this one without rewiring a graph - not because it does anything.

    One output: model_config (DICT), wired into EditTextEncode_EditUtils.model_config. If you're hand-building the graph, it goes there and nowhere else; the reference latents are attached by the encoder, and consumed by the patch node.

    What it does not do

    This is the trap. Wiring this node in does not make MOSS-Image reference-capable. You need all three of:

    1. this config dict (or the generic config node set to moss_image),
    2. MossImageConfigPreparer_EditUtils per reference image,
    3. MossImageEditApply_EditUtils on the model wire - the actual forward patch that appends reference tokens to the sequence.

    And you need an edit LoRA trained on that same layout (ai-toolkit's moss_image edit mode, kv_cache on). The base and SFT checkpoints are text-to-image; without a LoRA, a reference is an untrained conditioning signal and the model will politely ignore it. A config node cannot fix that.

    Installing

    cd ComfyUI/custom_nodes
    git clone https://github.com/lrzjason/ComfyUI-EditUtils
    # restart ComfyUI
    

    Or search ComfyUI-EditUtils in ComfyUI Manager. No pip dependencies - the pack ships no requirements file and is pure ComfyUI-core glue. The flip side: MOSS-Image support needs a ComfyUI build that knows image_model="moss_image" and offers moss_image as a CLIPLoader type. Models in the example workflow: moss_image_sft_int8_convrot (UNET), qwen3.5_9b_w4a8_gptq (CLIP, type moss_image), flux2-vae.

    Common issues

    "Nothing happened to my reference." No LoRA, or no patch node. See above; this node is not the mechanism.

    You used the generic ModelConfig_EditUtils and it's subtly wrong. It does list moss_image as a choice, but its vae_unit defaults to 8. On a FLUX.2 VAE that's the wrong grid - references won't align to 16 px tokens. Use this node, which hardcodes 16.

    You typed a system prompt into instruction. Nothing reads it. MOSS's tokenizer writes its own template; your instruction is discarded.

    Categoryadvanced/conditioning

    Inputs (1)

    NameTypeDefaultDescription
    instructionoptSTRINGUnused: the MOSS-Image tokenizer builds its own chat template (user turn + think block). Leave empty.

    Outputs (1)

    NameTypeDescription
    model_configDICT—