pipelines-and-inference
Use Diffusers pipelines for loading, text-to-image, image-to-image, inpainting, control-conditioned inference, batching, callbacks, deterministic seeds, device/dtype/offload choices, and serving-safe invocation patterns.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- pipelines-and-inference
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Diffusers pipelines for loading, text-to-image, image-to-image, inpainting, control-conditioned inference, batching, callbacks, deterministic seeds, device/dtype/offload choices, and serving-safe invocation patterns.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/loading-and-runtime.md7.0 KB
- 参考文档references/pipeline-workflows.md8.7 KB
- 参考文档references/troubleshooting.md8.6 KB
- 脚本scripts/pipeline_env_check.py3.0 KB
- 脚本scripts/pipeline_invocation_template.py6.0 KB
03 SKILL.md 正文
Pipelines and Inference
Use this sub-skill when the task is about running or wiring Diffusers inference pipelines: loading checkpoints, choosing pipeline classes, passing prompts/images/masks/control images, batching, reproducibility, callbacks, device placement, memory/offload settings, or serving pipelines behind an API.
Route First
- For a new inference script, start with references/pipeline-workflows.md and choose the smallest pipeline family that matches the inputs: text-only, image-to-image, inpainting, or control-conditioned generation.
- For loading, offline/local operation, dtype, device placement, memory, and reproducibility decisions, use references/loading-and-runtime.md.
- For installation, optional dependencies, device/dtype mistakes, local file failures, API misuse, inpainting shape issues, callback errors, and server concurrency problems, use references/troubleshooting.md.
- For a safe environment sanity check, run
python scripts/pipeline_env_check.py --helporpython scripts/pipeline_env_check.py. - For a no-download invocation skeleton, run
python scripts/pipeline_invocation_template.py --help; add--allow-downloadonly when network/model downloads are intentional.
Boundaries
- Training and fine-tuning recipes belong to
training-recipes. - Scheduler algorithm trade-offs and custom scheduler design belong to
schedulers; this sub-skill only shows where to attach or clone a scheduler for inference. - LoRA, IP-Adapter, textual inversion, and adapter weight mechanics belong to
adapters-and-loaders; this sub-skill only routes control/image conditioning inputs at pipeline-call level. - Modular pipeline block authoring belongs to
modular-pipelines. - Checkpoint conversion, repo maintenance, and CLI conversion utilities belong to
conversion-and-maintenance.
Default Inference Checklist
- Import a concrete
AutoPipelineFor...class when task type is known, otherwise useDiffusionPipelinefor generic loading. - Load with
from_pretrained(model_or_path, **kwargs); uselocal_files_only=Truefor offline/local-only execution. - Choose device and dtype together: CPU uses default/float32; CUDA commonly uses
torch.float16ortorch.bfloat16; MPS usually loads then.to("mps")and may need memory-saving attention slicing. - Pass workflow-specific inputs by name:
prompt,image,mask_image,control_image,negative_prompt,height,width,strength,generator,callback_on_step_end. - Use a fresh
torch.Generator(device="cpu").manual_seed(seed)for repeatable single-image calls; use one generator per item for batched calls. - Treat output as a pipeline output object unless
return_dict=False; generated images are usually inresult.images.
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).