Nodes/ComfyUI-Zlycoris/Z-Image Save Text Encoder
ComfyUI Node

Z-Image Save Text Encoder

Bake your patched Qwen text encoder to disk so you never re-patch it

By TripleHeadedMonkey·Created 7 months ago·Updated 7 months ago· 4
Z-Image Save Text Encoder
  • raw_clip
    filename_prefixqwen_patched

    Z-Image's text encoder is Qwen3-4B - 4 billion parameters, a huge chunk of the model's footprint, and increasingly the thing people patch. If you've ever loaded a text-encoder LoRA, baked a patched CLIP through the pack's ZImageComfyUninjector, or just want the same Qwen encoder available to every workflow without rebuilding it, this is the node that makes the result permanent. It takes a RAW_CLIP and writes it to disk as a standalone safetensors text encoder.

    How it works

    It's an output node with exactly two inputs:

    • raw_clip (RAW_CLIP) - the patched state dict, fresh from a Zlycoris loader or uninjector.
    • filename_prefix - default qwen_patched, no extension needed.

    That's it. The node saves the state dict to ComfyUI/output/text_encoders/<prefix>.safetensors and returns nothing. The next time you want that encoder, load it with any standard text encoder loader instead of re-running your whole patch pipeline. Because the Qwen TE is a big model, baking it once and loading it cold is meaningfully faster than re-patching every run - and it makes your workflow exportable, since the heavy lifting is now just a file.

    This is the text-encoder half of the pack's saving story. There's a sibling ZImageSaveTransformer node that does the same thing for the diffusion transformer (RAW_MODELoutput/diffusion_models/), in case the two get mixed up.

    When you'd chain it

    The natural flow is: ZImageLoaderAndPatcher (or the AITK loader) applies your LyCORIS/LoRA patches to the raw Qwen state dict → ZImageSaveTextEncoder writes the result → done, forever. Same idea with a standard-LoRA workflow: apply the LoRA with the regular Load LoRA, pull the baked model back to raw with ZImageComfyUninjector, then save. The pattern that motivates this whole pack is "patch once, reuse everywhere," and this node is the reusable artifact at the end.

    Install

    ComfyUI Manager (search ComfyUI-Zlycoris) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TripleHeadedMonkey/ComfyUI-Zlycoris.git
    

    Restart ComfyUI. No model downloads - this is tooling, not weights.

    Gotchas

    • Empty input is silently ignored. If raw_clip is None (say, you only loaded a transformer upstream), the node does nothing and quietly returns. No error, no file. If you save and find nothing in output/text_encoders/, check that a real RAW_CLIP reached the input.
    • It's a state-dict dump, not a quantization step. What you save is exactly what the raw wrapper held. A GGUF-derived raw clip was already dequantized by the loader, so you'd be saving a full-precision file - big, but valid.
    • File lands in output/, not models/. If you want it in the text_encoders folder that dropdowns read from, move it there once and re-scan. The node only ever writes to output.
    • The default prefix is qwen_patched, so if you save multiple variants without changing it, later runs overwrite earlier ones. Set the prefix to something meaningful like qwen3_te_character_lora the first time.
    CategoryZ-Image/Saving

    Inputs (2)

    NameTypeDefaultDescription
    raw_clipRAW_CLIP
    filename_prefixSTRINGqwen_patched

    Outputs (0)

    No outputs