AGENT SKILL

core-api

Use the DPM-Solver PyTorch and JAX single-file APIs directly: noise schedules, model wrappers, solver settings, inversion/noising helpers, and tiny validation checks.

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

01 前言 Front Matter

name
core-api
license
MIT
metadata
{ "disco-role": "operating" }
description
Use the DPM-Solver PyTorch and JAX single-file APIs directly: noise schedules, model wrappers, solver settings, inversion/noising helpers, and tiny validation checks.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

Core API

Use this sub-skill when a user wants to copy DPM-Solver into custom diffusion code, wrap their own model, choose solver settings, debug API calls, or run a small backend smoke test without executing the repository's large examples.

When To Read

Read this sub-skill for tasks that mention:

  • NoiseScheduleVP, model_wrapper, DPM_Solver, sample, inverse, or add_noise.
  • Discrete beta schedules, alphas_cumprod, continuous VP SDE schedules, or log-SNR time steps.
  • algorithm_type="dpmsolver" versus "dpmsolver++", JAX predict_x0, solver order, skip_type, method, denoise_to_zero, or dynamic thresholding.
  • A custom PyTorch or JAX diffusion model that should sample in 10-25 function evaluations.

Workflow

  1. Choose the backend file:
  2. Read references/api-reference.md for exact signatures, backend differences, and minimal integration skeletons.
  3. Read ../../references/solver-choice-guide.md before recommending order/method/step settings.
  4. Use references/noise-schedules-and-wrappers.md when converting a model's training-time labels or parameterization to the continuous-time noise prediction interface.
  5. Run one bundled smoke script before deeper debugging:
  6. If the user needs DDPM, ScoreSDE, or Stable Diffusion commands, route to the corresponding sibling sub-skill instead of expanding this page.

Recommended Direct PyTorch Skeleton

import torch
from dpm_solver_pytorch import NoiseScheduleVP, model_wrapper, DPM_Solver

# `model(x, t_input, **kwargs)` must return the model's prediction.
noise_schedule = NoiseScheduleVP(schedule="discrete", betas=betas)
model_fn = model_wrapper(
    model,
    noise_schedule,
    model_type="noise",
    guidance_type="uncond",
    model_kwargs=model_kwargs,
)
solver = DPM_Solver(model_fn, noise_schedule, algorithm_type="dpmsolver++")
sample = solver.sample(
    x_T,
    steps=20,
    order=2,
    skip_type="time_uniform",
    method="multistep",
)

Recommended Direct JAX Skeleton

import jax.numpy as jnp
from dpm_solver_jax import NoiseScheduleVP, model_wrapper, DPM_Solver

noise_schedule = NoiseScheduleVP(schedule="linear", continuous_beta_0=0.1, continuous_beta_1=20.0)
model_fn = model_wrapper(model, noise_schedule, model_type="noise", guidance_type="uncond")
solver = DPM_Solver(model_fn, noise_schedule, predict_x0=False)
sample = solver.sample(x_T, steps=20, order=3, skip_type="time_uniform", method="singlestep")

Common Decisions

  • Use schedule="discrete" with betas or alphas_cumprod when adapting a DDPM-style model trained on integer time labels.
  • Use schedule="linear" for continuous VP SDE / ScoreSDE-like integration.
  • In PyTorch, algorithm_type="dpmsolver++" is the DPM-Solver++ path; in JAX, use predict_x0=True for the comparable data-prediction solver path.
  • Use order 2 for large guidance scales and order 3 for unconditional or lightly guided sampling.
  • Use return_intermediate=True only in PyTorch and only for non-adaptive methods.
  • Use PyTorch inverse and add_noise for inversion/editing workflows; the root JAX file does not expose equivalent public helpers.

Troubleshooting

Read references/troubleshooting.md for API misuse, tensor shape, dynamic thresholding, JAX classifier-free guidance, and schedule conversion failures. Read the root ../../references/troubleshooting.md for install/backend/checkpoint issues shared with examples.

Boundaries

  • Do not run the original repository examples from this sub-skill.
  • Do not promise sample quality without a known-good high-step baseline and a matching noise schedule.
  • Do not recommend JAX model_type="score", classifier-free guidance, or thresholding=True in the unpatched root JAX file without warning about the verified compatibility caveats.
  • Do not apply dynamic thresholding to latent-space Stable Diffusion latents.

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