Nodes/ComfyUI_diffusers_loader/加载千问Diffusers模型
ComfyUI Node

加载千问Diffusers模型

Run Qwen-Image straight from its HuggingFace folder, no checkpoint conversion

By TianDongL·Created about a year ago·Updated about a year ago· 5
加载千问Diffusers模型
    • MODEL
    • CLIP
    • VAE
    model_path
    weight_dtype
    device

    You've got a Qwen-Image folder sitting on disk - the raw HuggingFace diffusers layout with transformer/, text_encoder/, vae/ and a model_index.json, exactly how it downloads from Qwen/Qwen-Image. ComfyUI's built-in loaders mostly want .safetensors checkpoints or a unet/-style diffusers folder, and Qwen doesn't play that game. That's the gap this node fills: QwenDiffusersLoader (display name 加载千问Diffusers模型) points at that folder and hands you a ready-to-wire MODEL, CLIP, and VAE triple.

    If you haven't met Qwen-Image yet: it's Alibaba's 20B Apache-2.0 image model, the one with genuinely best-in-class text rendering (especially Chinese glyphs). It's also a straight-up VRAM hog - the README doesn't mince words about it, "approximately 40g of VRAM" for the full pipeline. So this is a node for a niche use case: you specifically want the Qwen diffusers format and its text-heavy output, posters, UI mockups, Chinese signage. If you're after fast everyday generation on a 12GB card, reach for something smaller; Qwen's the heavyweight you run when text legibility is the whole point.

    How it works

    The node walks ComfyUI/models/diffusers/, finds every folder with a model_index.json, and lists them in the model_path dropdown. When you run it, a custom loader handles what the built-in diffusers loader chokes on: Qwen's transformer/ subfolder instead of unet/, including sharded multi-file models (.safetensors.index.json), which it reassembles and caches to disk inside the pack's own .cache/ directory so reloads are fast. The text encoder goes through ComfyUI's core comfy.text_encoders.qwen_image support, and the VAE is a custom QwenVAE wrapper over diffusers' AutoencoderKLQwenImage with tiled decoding built in - that's the memory safety net for big images.

    If anything in the custom path fails it falls back to ComfyUI's stock diffusers loader, but don't count on it: that fallback needs unet/, and Qwen is transformer/, so it'll usually error out and you'll see a raised exception with both messages. That's by design, if not by polish.

    The inputs that matter

    Only three, and two of them are one-word choices:

    • model_path - the dropdown of diffusers folders under models/diffusers/. Pick your model.
    • weight_dtype - default, fp8_e4m3fn, fp8_e4m3fn_fast, fp8_e5m2, fp16, bf16. Start at default if your VRAM allows; drop to fp8_e4m3fn or bf16 if it doesn't. One catch: the fp8 options require a torch build with float8 support, and if you don't have it the node silently falls back to fp16 with a console warning. Check your log if the VRAM savings aren't showing up.
    • device - default or cpu. An advanced/optional input; leave it alone unless you're trying to run the whole thing on CPU (slow, but the README's tables suggest it works).

    Outputs are MODEL, CLIP, VAE, which wire into the usual KSampler + CLIP Text Encode + VAEDecode chain - or into ComfyUI's official Qwen-Image workflow, which is what the README points you at. Note Qwen wants natural-language sentences in the prompt, not tag soup; weighting syntax is mostly inert on it.

    Installing it

    ComfyUI Manager: search "ComfyUI_diffusers_loader". Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/BEIMEN1934/ComfyUI_diffusers_loader
    

    Then restart. The requirements.txt pulls in diffusers>=0.34.0, transformers>=4.44.0, accelerate, plus torch/torchvision - the full HuggingFace stack, which ComfyUI otherwise avoids, so let it install. Then download a Qwen-Image diffusers folder (HuggingFace or ModelScope) into ComfyUI/models/diffusers/.

    Where people get burned

    First, the README's own install commands still say git clone https://github.com/your-repo/qwen_diffusers_loader.git - a template URL that doesn't exist. Use the real repo above. Second, the VRAM. Ignore the 40GB warning at your peril; fp8 or bf16 plus the tiled VAE decode is the practical path on consumer cards. Third, if you swap models or dtypes, the cache invalidates itself (it hashes path + mtimes), so a slow reload after a switch is normal - and it's safe to delete the pack's .cache/ folder if it ever grows out of hand.

    One honest caveat: this is a small, early pack with a single commit and an English/Chinese README that's clearly still template-flavored. It's the right tool when you specifically need the diffusers layout for Qwen. For most people, ComfyUI's native Qwen nodes and checkpoint conversions are the more-maintained path - but this one exists exactly for the format they don't cover.

    Categoryloaders

    Inputs (3)

    NameTypeDefaultDescription
    model_pathCOMBO选择要加载的千问Diffusers模型路径
    weight_dtypeCOMBO模型权重数据类型,影响显存占用和推理速度
    deviceoptCOMBO模型加载设备,默认为GPU

    Outputs (3)

    NameTypeDescription
    MODELMODEL用于去噪潜在空间的千问扩散模型(Transformer)
    CLIPCLIP用于编码文本提示的千问CLIP模型
    VAEVAE用于编码和解码图像到潜在空间的千问VAE模型