flux-pipelines
Operate Nunchaku FLUX and FLUX v2 Diffusers replacement workflows for text-to-image, Kontext editing, and FLUX.1 tools.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- flux-pipelines
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Operate Nunchaku FLUX and FLUX v2 Diffusers replacement workflows for text-to-image, Kontext editing, and FLUX.1 tools.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/flux-workflows.md9.7 KB
- 参考文档references/troubleshooting.md7.2 KB
- 脚本scripts/flux_minimal_template.py6.0 KB
03 SKILL.md 正文
flux-pipelines
Use this operating sub-skill when a task asks to replace a Diffusers FLUX transformer with Nunchaku quantized FLUX weights, including basic FLUX.1-dev, FLUX.1-schnell, FLUX.1-krea-dev, FLUX.1-Kontext-dev, and FLUX.1 Tools-style Canny/Depth/Fill/Redux/ControlNet routes.
Fast route
- Pick the Diffusers pipeline class from the task:
- Text-to-image FLUX.1-dev, schnell, and krea:
diffusers.FluxPipeline. - Kontext image editing:
diffusers.FluxKontextPipelinewith an inputimage=. - Canny or Depth control:
diffusers.FluxControlPipelinewithcontrol_image=. - Fill/inpaint:
diffusers.FluxFillPipelinewithimage=andmask_image=. - Redux:
diffusers.FluxPriorReduxPipelinefirst, then aFluxPipelineusing the prior output.
- Text-to-image FLUX.1-dev, schnell, and krea:
- Load the Nunchaku transformer from a Hugging Face model-file path or local quantized asset path:
- Current/legacy examples:
NunchakuFluxTransformer2dModel.from_pretrained(transformer_path, torch_dtype=..., offload=...). - FLUX v2 examples:
NunchakuFluxTransformer2DModelV2.from_pretrained(transformer_path, torch_dtype=..., device=...).
- Current/legacy examples:
- Pass the loaded transformer into
PipelineClass.from_pretrained(base_model, transformer=transformer, torch_dtype=...). - Use CUDA by default. Use
torch.bfloat16on Ampere/Ada/Hopper/Blackwell unless the task or GPU requires FP16. On Turing GPUs usetorch.float16, calltransformer.set_attention_impl("nunchaku-fp16")when available, and enable CPU offload if VRAM is tight. - Keep LoRA/adapters/cache/qencoder details out of this sub-skill; route those to sibling sub-skills for
lora-and-adaptersorperformance-and-memory.
Safe defaults
- Transformer asset: a single
.safetensors/.sftpath such asnunchaku-tech/nunchaku-flux.1-dev/svdq-int4_r32-flux.1-dev.safetensors, or a local path supplied by the user. - Precision selection: prefer
nunchaku.utils.get_precision()when constructing public examples; it returnsfp4on Blackwell-class devices andint4otherwise. - Device:
cudaunless the caller explicitly asks for a device id such ascuda:1. - Offload: for
NunchakuFluxTransformer2dModel,offload=Truecan be passed to transformer loading and paired with Diffusers sequential CPU offload. ForNunchakuFluxTransformer2DModelV2, source inspection showsfrom_pretrained(..., offload=True)raisesNotImplementedError; rely on Diffusers pipeline offload or choose the non-V2 class when transformer-level offload is required. - Metadata: only the non-V2
NunchakuFluxTransformer2dModel.from_pretrained(..., return_metadata=True)path is documented in source as returning(transformer, metadata). Always unpack it explicitly and toleratemetadata is Nonefor legacy directory-style loading.
Bundled files
references/flux-workflows.md— model-family routing table, class choices, example call patterns, and API caveats.references/troubleshooting.md— common loading, dtype/device/offload, Turing, model access, and CUDA failure diagnoses.scripts/flux_minimal_template.py— parameterized one-image FLUX template for installednunchakuenvironments.
Minimal command template
python scripts/flux_minimal_template.py \
--transformer nunchaku-tech/nunchaku-flux.1-dev/svdq-int4_r32-flux.1-dev.safetensors \
--base-model black-forest-labs/FLUX.1-dev \
--prompt "A cat holding a sign that says hello world" \
--output flux-output.png \
--dtype bf16 \
--device cuda
This command requires accessible model assets, a CUDA-capable Nunchaku installation, Diffusers, and any Hugging Face credentials required by the selected base or transformer models.
Verification candidates, not pre-run checks
Native source candidates for a verifier include tests/flux/test_flux_examples.py, selected tests/v1/flux/test_flux1_*.py cases, and representative examples/flux*.py or examples/v1/flux*.py scripts. Treat them as candidates only; this sub-skill was drafted without running repository-native tests, examples, or benchmarks.
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).