AGENT SKILL

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

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 --help or python scripts/pipeline_env_check.py.
  • For a no-download invocation skeleton, run python scripts/pipeline_invocation_template.py --help; add --allow-download only 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

  1. Import a concrete AutoPipelineFor... class when task type is known, otherwise use DiffusionPipeline for generic loading.
  2. Load with from_pretrained(model_or_path, **kwargs); use local_files_only=True for offline/local-only execution.
  3. Choose device and dtype together: CPU uses default/float32; CUDA commonly uses torch.float16 or torch.bfloat16; MPS usually loads then .to("mps") and may need memory-saving attention slicing.
  4. Pass workflow-specific inputs by name: prompt, image, mask_image, control_image, negative_prompt, height, width, strength, generator, callback_on_step_end.
  5. Use a fresh torch.Generator(device="cpu").manual_seed(seed) for repeatable single-image calls; use one generator per item for batched calls.
  6. Treat output as a pipeline output object unless return_dict=False; generated images are usually in result.images.

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