AGENT SKILL

qwen-image-workflows

Operate Qwen-Image, Qwen-Image-Edit, Lightning, 2509, ControlNet, and offload workflows with Nunchaku quantized transformers.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
qwen-image-workflows
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Operate Qwen-Image, Qwen-Image-Edit, Lightning, 2509, ControlNet, and offload workflows with Nunchaku quantized transformers.
disable-model-invocation
true

02 资源文件 3

03 SKILL.md 正文

Qwen Image workflows with Nunchaku

Use this sub-skill when a task involves Qwen-Image text-to-image, Qwen-Image-Edit, Qwen-Image-Edit-2509, Qwen Lightning variants, Qwen ControlNet, or Qwen-specific transformer offload in an installed nunchaku environment.

Do not use this sub-skill for FLUX-only LoRA/adapters or custom Qwen LoRA training/loading. The Qwen docs describe custom LoRA support as under development; use only the pre-quantized Lightning assets documented for Qwen workflows.

Fast routing

Need Start here
Basic Qwen-Image generation references/qwen-workflows.md#text-to-image-workflows
Qwen-Image-Lightning 4/8-step generation references/qwen-workflows.md#lightning-scheduler-and-step-counts
Qwen-Image-Edit with one input image references/qwen-workflows.md#edit-workflows
Qwen-Image-Edit-2509 or multi-image edit references/qwen-workflows.md#2509-edit-plus-workflows
Qwen ControlNet Union routing references/qwen-workflows.md#controlnet-routing
Low-VRAM Qwen inference references/qwen-workflows.md#offload-patterns
Failure diagnosis references/troubleshooting.md
Parameterized local template scripts/qwen_image_template.py

Core operating pattern

  1. Pick the Diffusers pipeline for the workflow (QwenImagePipeline, QwenImageEditPipeline, QwenImageEditPlusPipeline, or QwenImageControlNetPipeline).
  2. Load a Nunchaku quantized transformer with NunchakuQwenImageTransformer2DModel.from_pretrained(...) and pass it into pipeline.from_pretrained(..., transformer=transformer, torch_dtype=...).
  3. Pass a single .safetensors/.sft checkpoint path or Hugging Face file path to from_pretrained; do not pass a model directory.
  4. Choose torch.float16 on Turing-class GPUs and usually torch.bfloat16 elsewhere; set dtype during from_pretrained, not by casting the quantized model after load.
  5. For low VRAM, prefer transformer.set_offload(True, ...), append "transformer" to the pipeline CPU-offload exclusion list, and then call Diffusers sequential CPU offload.
  6. For 2509 and ControlNet routing, require Diffusers APIs new enough for the Qwen classes; use diffusers>=0.36 when those classes are needed.

Minimal snippets

import torch
from diffusers import QwenImagePipeline
from nunchaku import NunchakuQwenImageTransformer2DModel

transformer = NunchakuQwenImageTransformer2DModel.from_pretrained(
    "nunchaku-tech/nunchaku-qwen-image/svdq-int4_r32-qwen-image.safetensors",
    torch_dtype=torch.bfloat16,
)
pipe = QwenImagePipeline.from_pretrained(
    "Qwen/Qwen-Image", transformer=transformer, torch_dtype=torch.bfloat16
)
pipe.to("cuda")
image = pipe(prompt="a clean storefront sign that reads Nunchaku", num_inference_steps=50, true_cfg_scale=4.0).images[0]

For complete generation/edit templates and offload-safe variants, use references/qwen-workflows.md and scripts/qwen_image_template.py.

Evidence base

Distilled from the Qwen usage docs, Qwen examples, Qwen native test candidates, live public API inspection, and NunchakuQwenImageTransformer2DModel source behavior. Native Qwen tests/examples are verification candidates for later integration; this sub-skill does not claim they were run during drafting.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351