Nodes/ComfyUI-QwenImageWanBridge/Qwen Template Connector
ComfyUI Node

Qwen Template Connector

Keep template and encoder modes in sync

By fblissjr·Created 12 months ago·Updated 4 months ago· 188
Qwen Template Connector
    • text_for_encoder
    • encoder_mode
    • apply_template
    • token_removal
    formatted_prompt
    use_with_encoder
    mode_info

    This is a plumbing node - an optional adapter that sits between QwenTemplateBuilder and a Qwen encoder to make sure the two agree on what mode you're in and which tokens to drop. The pack describes it plainly: it "properly connects template to encoder." If you've ever built a template as an edit but had the encoder run it as text-to-image (or vice versa), this is the piece that stops that mismatch from happening.

    You don't strictly need it - the template builder can hand its bundle straight to the encoder - but when you want the mode and token-handling to travel together and stay consistent, this is the node that carries them.

    How it works

    The template builder produces a formatted prompt and a mode. QwenTemplateConnector takes that formatted prompt plus a couple of control flags and re-emits them as discrete, typed outputs the encoder can consume without ambiguity: the text to encode, the encoder mode as an explicit string, a boolean for whether to apply the template, and the token-removal setting. In other words, it unpacks the template into the exact signals the encoder reads, so nothing gets inferred or guessed. It's the kind of glue node that only exists because the alternative - hoping two nodes silently agree - bites people.

    The inputs and outputs that matter

    • formatted_prompt (required) - the assembled prompt string coming from the template side.
    • use_with_encoder (required, boolean) - whether this is being wired into an encoder, which gates how it emits the mode.
    • mode_info (required) - the mode string it should carry through.

    Outputs, all meant to land on the matching encoder sockets: text_for_encoder (the prompt), encoder_mode (the mode as a string), apply_template (boolean - whether the encoder should apply template handling), and token_removal (the token-drop setting: text vs. image_edit affects how many tokens get stripped).

    How to install it

    ComfyUI Manager: search ComfyUI-QwenImageWanBridge, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/fblissjr/ComfyUI-QwenImageWanBridge
    

    then restart. Nothing to download - it moves strings and booleans around. It only earns its place next to the Qwen encoder and template nodes, which need the Qwen2.5-VL weights.

    Common issues & troubleshooting

    You're not sure you even need it. Honestly, often you don't - the README marks it optional, and the template builder can feed the encoder directly. Reach for the connector when you're routing the template's mode and token settings through several nodes and want them to stay locked together instead of drifting apart.

    The encoder is dropping the wrong number of tokens. Check token_removal. Qwen-Image-Edit strips a different token count for text vs. image_edit operations; this output is where that decision is made explicit, so if edits look off, verify it matches the mode you intend.

    Template still isn't applying. Confirm apply_template is coming through as true and that its outputs are actually wired to the encoder - this node only helps if its four outputs land on the right encoder inputs. An unconnected connector connects nothing.

    CategoryQwenImage/Templates

    Inputs (3)

    NameTypeDefaultDescription
    formatted_promptSTRING
    use_with_encoderBOOLEAN
    mode_infoSTRING

    Outputs (4)

    NameTypeDescription
    text_for_encoderSTRING
    encoder_modeSTRING
    apply_templateBOOLEAN
    token_removalSTRING