AGENT SKILL

dpm-solver

Use DPM-Solver and DPM-Solver++ single-file samplers for diffusion ODE sampling, PyTorch/JAX integration, ScoreSDE/DDPM examples, and Stable Diffusion acceleration.

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

01 前言 Front Matter

name
dpm-solver
license
MIT
metadata
{ "disco-role": "operating" }
description
Use DPM-Solver and DPM-Solver++ single-file samplers for diffusion ODE sampling, PyTorch/JAX integration, ScoreSDE/DDPM examples, and Stable Diffusion acceleration.
disable-model-invocation
true

02 资源文件 8

03 SKILL.md 正文

DPM-Solver

Use this skill when a task asks how to integrate, configure, debug, or adapt the DPM-Solver / DPM-Solver++ samplers from Cheng Lu et al.'s dpm-solver project. The repository is a source-code distribution rather than a normal PyPI package: the durable user-facing artifacts are the single-file PyTorch and JAX solver modules plus example integrations for DDPM/guided-diffusion, ScoreSDE, and Stable Diffusion.

Start Here

  1. Identify whether the user wants direct solver API integration, a PyTorch example workflow, a JAX ScoreSDE workflow, or Stable Diffusion sampling acceleration.
  2. If they need code, prefer the bundled implementation copies in scripts/dpm_solver_pytorch.py and scripts/dpm_solver_jax.py instead of relying on an original checkout.
  3. Use references/solver-choice-guide.md before recommending algorithm_type, order, method, steps, skip_type, thresholding, or denoising settings.
  4. Run scripts/check_dpm_solver_environment.py when imports, PyTorch/JAX availability, CUDA visibility, or a tiny numerical smoke test are uncertain.
  5. Treat full image generation, pretrained checkpoints, FID evaluation, Stable Diffusion weights, dataset downloads, and multi-GPU training as opt-in: they are network-, credential-, GPU-, memory-, and time-sensitive.
  6. Read references/repo-provenance.md before refreshing this skill against a newer source snapshot.

Route By Task

User task Read
Copy DPM-Solver into custom code, wrap a diffusion model, choose noise schedules, inspect API signatures, run tiny smoke tests sub-skills/core-api/SKILL.md
Adapt DDPM, guided-diffusion, ScoreSDE PyTorch sampling commands, configs, checkpoints, or DPM-Solver flags sub-skills/torch-examples/SKILL.md
Use the JAX ScoreSDE integration, understand JAX-specific solver differences, pmap/device behavior, or JAX caveats sub-skills/jax-examples/SKILL.md
Add DPM-Solver to latent Stable Diffusion, plan txt2img --dpm_solver, use the sampler adapter, or troubleshoot model-weight/runtime constraints sub-skills/stable-diffusion/SKILL.md

Key Operating Facts

  • Direct use imports NoiseScheduleVP, model_wrapper, and DPM_Solver from the PyTorch or JAX module.
  • NoiseScheduleVP(schedule="discrete", betas=...) or NoiseScheduleVP(schedule="discrete", alphas_cumprod=...) converts a discrete diffusion schedule to continuous time labels in (0, 1].
  • NoiseScheduleVP(schedule="linear", continuous_beta_0=0.1, continuous_beta_1=20.) covers continuous VP SDEs used by ScoreSDE-style examples. The bundled JAX module also exposes schedule="cosine"; the root PyTorch file does not, while the Stable Diffusion nested copy does.
  • PyTorch DPM_Solver(..., algorithm_type="dpmsolver++") selects data prediction internally and is the common default for guided sampling. The JAX API uses predict_x0=True for the DPM-Solver++-style path.
  • method="multistep", order=2, skip_type="time_uniform", and roughly 20-25 steps are the Stable Diffusion / large-guidance default family.
  • method="singlestep" or method="multistep" with order 3 is the common exploration path for unconditional or lightly guided sampling.
  • correcting_x0_fn="dynamic_thresholding" is for pixel-space guided sampling; do not use dynamic thresholding for latent-space Stable Diffusion.

Installation And Import Baseline

There is no root package metadata. For custom code, copy one bundled solver file into the target project or keep it on PYTHONPATH and install only the backend needed by that file:

python -m pip install torch        # for dpm_solver_pytorch.py
python -m pip install jax jaxlib   # for dpm_solver_jax.py CPU use

Minimal PyTorch import and smoke check:

python scripts/check_dpm_solver_environment.py --backend torch --smoke

Minimal JAX import and smoke check:

python scripts/check_dpm_solver_environment.py --backend jax --smoke

Root References And Tools

Safety And Scope Boundaries

  • Do not start model downloads, dataset downloads, FID computation, Stable Diffusion generation, notebook execution, or multi-GPU sampling unless the user explicitly approves the cost and runtime.
  • Do not assume a CUDA, ROCm, MPS, TPU, or JAX accelerator backend is available; run a backend probe and use CPU only for tiny API smoke tests unless real generation is requested.
  • Do not route Hugging Face diffusers scheduler API tasks here when the user is using the diffusers package directly; prefer a Diffusers-specific skill for DPMSolverMultistepScheduler pipelines.
  • Do not tell future agents to run original repository examples. If a workflow is useful, use this skill's distilled references and bundled command builders.
  • Keep Stable Diffusion safety, license, checkpoint, and gated-weight requirements explicit when constructing commands.

Verification Expectations

Start with the smallest safe checks: import the backend, construct a linear noise schedule, run a zero-model sample on a tiny tensor, and validate planned command arguments without loading checkpoints. Full native example parity is blocked by external checkpoints/datasets and should be recorded as skipped or opt-in unless the user provides the assets and hardware.

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