Nodes/ComfyUI_TwinFlow/TwinFlow_SM_Model
ComfyUI Node

TwinFlow_SM_Model

You can't load a TwinFlow model with a normal loader. This is why.

By smthemex·Created 9 months ago·Updated 7 months ago· 109
TwinFlow_SM_Model
    • model
    dit
    gguf
    use_dypefalse

    TwinFlow is a distillation method from inclusionAI that turns big text-to-image models into one- or two-step generators - Qwen-Image's 20B and Z-Image's 6B were the two it actually shipped for. This node is the thing that gets those distilled weights into ComfyUI. There's no TwinFlow checkpoint you can drop into a standard loader; the weights ship as standalone single-file models that only this pack knows how to interpret, so if a downloaded workflow says TwinFlow_SM_Model, this is your entry point.

    What it actually does

    Instead of loading a Comfy checkpoint, it builds a diffusers pipeline from config folders bundled inside the pack plus your downloaded weight file. The pack vendors its own patched diffusers classes for Qwen-Image and Z-Image (there's a whole diffusers_patch/ directory), which is why this works at all - the vanilla diffusers pipeline doesn't know how to chew a TwinFlow file. GGUF files go through diffusers' GGUFQuantizationConfig, and the node picks the architecture from the filename: a path containing qwen gets the Qwen-Image wrapper, anything else gets Z-Image.

    The three inputs are basically the whole node:

    • dit - a safetensors checkpoint from ComfyUI/models/diffusion_models. Leave at none if you're going GGUF.
    • gguf - a quantized model from ComfyUI/models/gguf. Leave at none if you're going safetensors. You need one of the two, not both.
    • use_dype - a Boolean, default off. "DyPE" is dynamic positional encoding extrapolation for Z-Image, and it's the trick that lets the model generate way past its ~2MP native ceiling - the author's README notes 3840×2160 in 2 steps with it on. The cost is VRAM, and honestly most people don't need it until they try to push a big canvas.

    The output is a single model that you feed straight into TwinFlow_SM_LoraLoader (if you want LoRAs) and then into TwinFlow_SM_KSampler. Don't try to wire it into a vanilla KSampler; that's a different conversation, but the short version is you won't get an image.

    Model files you need

    Nothing in this pack includes weights, so plan on a download:

    Everything lands in the normal spots: GGUF in ComfyUI/models/gguf, VAE in ComfyUI/models/vae, CLIP in ComfyUI/models/clip. The node even creates and registers the gguf model folder for you.

    Install

    ComfyUI Manager - search ComfyUI_TwinFlow - or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/smthemex/ComfyUI_TwinFlow
    cd ComfyUI_TwinFlow
    pip install -r requirements.txt
    

    The dependency that matters is diffusers >= 0.36.0 - the README calls it required for Z-Image support, and the pack patches newer diffusers versions for a known attention-mask bug. The rest of requirements.txt is gguf, accelerate, transformers, tokenizers, omegaconf.

    Where people get burned

    • Stale GGUF = dtype errors. The Qwen GGUF files were re-quantized after release and the type tag changed to match city96's loader. If you grabbed the files early, re-download - old files throw dtype errors that look like hardware problems but aren't.
    • safetensors OOMs where GGUF survives. A 4060 Ti 16GB user reported the Z-Image safetensors OOMing outright while the GGUF ran fine. If you have ≤16GB, start GGUF. The flip side: Q4/Q3 quants look genuinely bad with this technique, so Q8 is the sweet spot - on a 12GB card the README quotes 2–3s per 1024×768 image.
    • Custom models folders. If you use an extra_model_paths.yaml setup, add gguf to it or the dropdown stays empty.
    • VRAM tiers. Z-Image fits 12GB; Qwen-Image on 12GB wants offloading (that's block_num on the KSampler, not here). If you're at 16GB+, set block_num to 0 for full speed.

    It's a loader, so it won't make you a better prompt engineer - but without it, none of the one-step speed this pack is known for exists.

    CategoryTwinFlow

    Inputs (3)

    NameTypeDefaultDescription
    ditCOMBO1 options: none
    ggufCOMBO1 options: none
    use_dypeBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    modelMODEL