AGENT SKILL

nunchaku

Route and operate the Nunchaku repo skill for CUDA-accelerated 4-bit Diffusers image-generation workflows, quantized transformers, LoRA/adapters, and performance controls.

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

01 前言 Front Matter

name
nunchaku
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Route and operate the Nunchaku repo skill for CUDA-accelerated 4-bit Diffusers image-generation workflows, quantized transformers, LoRA/adapters, and performance controls.
disable-model-invocation
true

02 资源文件 6

03 SKILL.md 正文

nunchaku

Use this repo skill when a task involves the nunchaku Python package: loading Nunchaku quantized .safetensors/.sft assets, replacing Diffusers transformer/UNet components, choosing INT4 vs FP4 assets, debugging CUDA/build/runtime issues, composing FLUX LoRAs, or adapting Nunchaku examples/tests into bounded user workflows.

Do not use this skill for generic Diffusers work that does not use Nunchaku, CPU-only image generation, unsupported GPU architectures, training new models, or Qwen custom LoRA workflows. Qwen custom LoRA support is documented as under development.

First steps

  1. If Nunchaku is not installed, prefer a prebuilt wheel that matches the user's Python, PyTorch, CUDA, OS, and GPU architecture; use references/installation-build-runtime.md for source builds and compatibility repairs.
  2. Check installation and backend with scripts/inspect_nunchaku_install.py --device cuda:0 --pretty or the performance-and-memory checker before promising CUDA-specific behavior.
  3. Identify the model family and route to the smallest matching sub-skill.
  4. Require explicit model assets or Hugging Face IDs from the task. Do not assume source-checkout example defaults are available.
  5. Treat repo-native tests/examples as verification candidates unless they have been run in the current task.
  6. If model downloads or private gated assets are required, ask for credentials/cache policy or use local paths.

Route by task

User task Load
FLUX.1-dev/schnell/krea, FLUX Kontext, FLUX tools, FLUX v2 transformer replacement sub-skills/flux-pipelines/SKILL.md
Qwen-Image, Qwen-Image-Edit, Qwen Lightning, Qwen 2509, Qwen ControlNet/offload sub-skills/qwen-image-workflows/SKILL.md
Sana, Sana PAG, Z-Image, SDXL, SDXL-Turbo sub-skills/sana-zimage-sdxl/SKILL.md
Cache, offload, FP16 attention, quantized T5 encoder, CUDA architecture/precision checks, speed/memory planning sub-skills/performance-and-memory/SKILL.md
FLUX LoRA loading/composition/conversion, safetensor merge, IP-Adapter, PuLID sub-skills/lora-and-adapters/SKILL.md

Core package facts

  • Public root exports include NunchakuFluxTransformer2dModel, NunchakuFluxTransformer2DModelV2, NunchakuQwenImageTransformer2DModel, NunchakuSanaTransformer2DModel, NunchakuZImageTransformer2DModel, and NunchakuT5EncoderModel.
  • Important non-root helpers live under package modules: nunchaku.caching.diffusers_adapters.apply_cache_on_pipe, nunchaku.models.ip_adapter.diffusers_adapters.apply_IPA_on_pipe, nunchaku.lora.flux.compose.compose_lora, nunchaku.lora.flux.nunchaku_converter.to_nunchaku, and nunchaku.merge_safetensors.merge_safetensors.
  • Nunchaku quantized inference is a CUDA-backed workflow. CPU-only is not a full substitute for selected package capabilities.
  • Precision is architecture-sensitive: current guidance is INT4 for Turing/Ampere/Ada and FP4 for Blackwell-class GPUs. Use nunchaku.utils.get_precision() when possible.
  • Build/source installs require compatible Python, PyTorch, CUDA, compiler, and initialized submodules; prefer a prebuilt wheel when the task is only runtime usage.

Root references and scripts

  • references/repo-provenance.md — source commit, package version, evidence paths, and staleness signals.
  • references/repo-routing-metadata.json — structured router metadata for managed repo-skill import tooling.
  • references/api-and-entrypoints.md — public API, helper functions, CLI/module entry points, and native candidate map.
  • references/installation-build-runtime.md — supported Python/CUDA/GPU/PyTorch combinations and source-build troubleshooting.
  • references/troubleshooting.md — cross-cutting install/import, asset, backend, and workflow failure diagnoses.
  • scripts/inspect_nunchaku_install.py — safe JSON probe for the current Python environment.

Safety and verification boundaries

  • Do not copy local checkout paths, private environment names, or construction logs into user code.
  • Do not run long image generation, benchmark, or model-download workflows unless the user authorizes time, storage, credentials, and output handling.
  • Native verification candidates from tests/ and examples/ should be selected narrowly and run only after task-specific setup is clear.
  • IP-Adapter support is documented as deprecated in March 2026; surface this before recommending new long-lived IP-Adapter integrations.

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