sana-zimage-sdxl
Operate Nunchaku's non-FLUX Diffusers replacements for Sana, Z-Image, SDXL, and SDXL-Turbo.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- sana-zimage-sdxl
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Operate Nunchaku's non-FLUX Diffusers replacements for Sana, Z-Image, SDXL, and SDXL-Turbo.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/non-flux-models.md10.5 KB
- 参考文档references/troubleshooting.md5.8 KB
- 脚本scripts/non_flux_template.py13.7 KB
03 SKILL.md 正文
sana-zimage-sdxl
Use this sub-skill when a task needs Nunchaku's non-FLUX image-generation replacements:
NunchakuSanaTransformer2DModelwithSanaPipelineorSanaPAGPipeline.NunchakuZImageTransformer2DModelwithZImagePipeline.NunchakuSDXLUNet2DConditionModelwithStableDiffusionXLPipelinefor SDXL or SDXL-Turbo.
Do not use this sub-skill for FLUX, Qwen-Image, LoRA/adapters, or performance-cache/offload tuning beyond the family-specific notes here. Do not claim CPU-only inference support: Nunchaku quantized inference requires a compatible CUDA backend even when Diffusers sequential CPU offload is used for memory placement.
Route by family
| User intent | Use | Read next |
|---|---|---|
| Sana 1.6B text-to-image | NunchakuSanaTransformer2DModel.from_pretrained(...) then SanaPipeline.from_pretrained(..., transformer=...) |
references/non-flux-models.md#sana |
| Sana with PAG | Same Sana transformer, pass pag_layers, then SanaPAGPipeline with matching pag_applied_layers |
references/non-flux-models.md#sana-pag |
| Z-Image-Turbo | NunchakuZImageTransformer2DModel.from_pretrained(...) then ZImagePipeline.from_pretrained(..., transformer=...) |
references/non-flux-models.md#z-image-turbo |
| SDXL base | NunchakuSDXLUNet2DConditionModel.from_pretrained(...) then StableDiffusionXLPipeline(..., unet=...) |
references/non-flux-models.md#sdxl-and-sdxl-turbo |
| SDXL-Turbo | Same SDXL UNet class with the SDXL-Turbo quantized asset and base pipeline | references/non-flux-models.md#sdxl-and-sdxl-turbo |
| Failure, asset, precision, or backend issue | Diagnose family/class mismatch, CUDA support, safetensors, dtype, offload, or PAG setup | references/troubleshooting.md |
Safe operating workflow
- Identify the model family first; never swap a quantized Sana/Z-Image transformer into an SDXL UNet slot or vice versa.
- Require the caller to provide both the Diffusers base model ID/path and the Nunchaku quantized
.safetensors/.sftasset path. Avoid silent repo defaults. - Choose dtype/device from the target GPU:
torch.bfloat16is the normal Ampere/Ada path; Z-Image usestorch.float16on Turing GPUs. Sana and SDXL native candidates skip Turing and FP4 paths. - Construct the Diffusers pipeline by passing the Nunchaku replacement component at
from_pretrainedtime, then move or offload the pipeline according to the family notes. - Run a bounded smoke generation only when model assets, credentials, CUDA, and output budget are explicitly available.
Bundled template
Use scripts/non_flux_template.py as a parameterized starter. It supports --family sana|zimage|sdxl, requires explicit --base-model and --quantized-path, and fails clearly for missing local assets or unsupported family/variant combinations.
Verification candidates
The following native tests/examples are evidence and future verification candidates only; this skill does not claim they were run:
examples/sana1.6b.py,examples/sana1.6b_pag.py,tests/sana/test_examples.pyexamples/v1/z-image-turbo.py,tests/v1/z_image/test_z_image_turbo.pyexamples/v1/sdxl.py,examples/v1/sdxl-turbo.py,tests/v1/sdxl/test_sdxl.py
04 同仓库更多 Skills
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.
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.
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.
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.
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.
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).