schedulers
Select, configure, swap, serialize, and troubleshoot Diffusers schedulers, timesteps, sigmas, and noise schedules for inference and tests.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- schedulers
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Select, configure, swap, serialize, and troubleshoot Diffusers schedulers, timesteps, sigmas, and noise schedules for inference and tests.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/scheduler-reference.md11.5 KB
- 参考文档references/troubleshooting.md9.8 KB
- 脚本scripts/scheduler_smoke.py5.6 KB
03 SKILL.md 正文
Schedulers
Use this sub-skill when a task mentions Diffusers schedulers, samplers, DDIM, DDPM, Euler, DPM-Solver, DPM++, Karras, AYS, timestep spacing, custom timesteps, custom sigmas, prediction_type, rescale_betas_zero_snr, set_timesteps, scheduler.step, or scheduler config round-trips.
Route first
- Full pipeline loading, prompt execution, model downloads, device maps, and image generation belong to the pipelines/inference skill; return here for scheduler choice and configuration.
- Training loop use of schedulers and model training arguments belong to training recipes; this skill covers inference and scheduler-focused tests.
- Model architecture changes and prediction heads are not scheduler tasks; only set
prediction_typehere when it is known to match the checkpoint. - Packaging a whole pipeline belongs elsewhere, but this skill owns scheduler-only
from_config,from_pretrained, andsave_pretrainedbehavior.
Default workflow
- Inspect the current scheduler with
type(pipe.scheduler).__name__,dict(pipe.scheduler.config), and important fields such asprediction_type,timestep_spacing,num_train_timesteps, and sigma options. - Pick the scheduler for the sampling goal: DPM-Solver multistep for fast high-quality inference, Euler/Euler ancestral for Euler-style sampler parity, DDIM for deterministic DDIM loops, DDPM for DDPM/noise-addition parity, or model-specific schedulers for FlowMatch, LCM, TCD, video, or distilled checkpoints.
- Swap an already loaded pipeline with
NewScheduler.from_config(pipe.scheduler.config, explicit_overrides...); load a scheduler config from a model directory or Hub repo withNewScheduler.from_pretrained(model_id_or_dir, subfolder="scheduler"). - Always pass explicit overrides for behavior the user cares about, especially
prediction_type,timestep_spacing,rescale_betas_zero_snr, solver options, and sigma conversion flags. - Before manual stepping, call
scheduler.set_timesteps(...); in denoising loops callscheduler.scale_model_input(sample, timestep)before the model and consumescheduler.step(...).prev_sample. - Validate a swap with a tiny deterministic CPU tensor, finite-output checks, and a config printout before running full inference.
Quick choices
- Replace DDIM with Euler while preserving compatible config:
from diffusers import EulerDiscreteScheduler
pipe.scheduler = EulerDiscreteScheduler.from_config(
pipe.scheduler.config,
prediction_type=pipe.scheduler.config.prediction_type,
timestep_spacing="trailing",
)
- Use DPM++ 2M SDE Karras-style inference:
from diffusers import DPMSolverMultistepScheduler
pipe.scheduler = DPMSolverMultistepScheduler.from_config(
pipe.scheduler.config,
algorithm_type="sde-dpmsolver++",
solver_order=2,
use_karras_sigmas=True,
)
- Use zero terminal SNR only for compatible models, commonly
v_predictioncheckpoints:
pipe.scheduler = type(pipe.scheduler).from_config(
pipe.scheduler.config,
prediction_type="v_prediction",
rescale_betas_zero_snr=True,
timestep_spacing="trailing",
)
image = pipe(prompt, guidance_rescale=0.7).images[0]
References
- Scheduler API and workflow details: references/scheduler-reference.md
- Failure diagnosis and fixes: references/troubleshooting.md
- Local validation helper: scripts/scheduler_smoke.py
Safe validation
Run the bundled helper after installing Diffusers and Torch:
python path/to/sub-skills/schedulers/scripts/scheduler_smoke.py --help
python path/to/sub-skills/schedulers/scripts/scheduler_smoke.py
Expected signals: common scheduler imports succeed; constructor and step signatures print; short set_timesteps schedules are produced; tiny CPU step checks return finite tensors; and common misuse checks raise the expected errors.
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).