stable-diffusion
Use DPM-Solver with latent Stable Diffusion workflows, including DPMSolverSampler adaptation, txt2img command planning, inversion/editing concepts, and checkpoint/backend troubleshooting.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- stable-diffusion
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use DPM-Solver with latent Stable Diffusion workflows, including DPMSolverSampler adaptation, txt2img command planning, inversion/editing concepts, and checkpoint/backend troubleshooting.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/dpmsolver-sampler-adapter.md3.1 KB
- 参考文档references/stable-diffusion-workflows.md3.1 KB
- 参考文档references/troubleshooting.md3.0 KB
- 脚本scripts/build_sd_dpm_command.py2.2 KB
- 脚本scripts/stable_diffusion_dpmsolver_sampler.py5.3 KB
03 SKILL.md 正文
Stable Diffusion
Use this sub-skill when a user asks how this repository accelerates latent
Stable Diffusion sampling with DPM-Solver or how to adapt the repository's
DPMSolverSampler pattern into another latent-diffusion codebase.
When To Read
Read this for tasks that mention:
txt2img.py --dpm_solver, Stable Diffusion with DPM-Solver, 20-25 step Stable Diffusion sampling, or the original latent-diffusion scripts.DPMSolverSampler,stochastic_encode,encode, inversion for DiffEdit, inpainting/editing, orcorrecting_xt_fnin a latent sampler.- Stable Diffusion checkpoint/config placement, safety checker/watermarking, GPU memory, or model-license constraints in this example family.
Workflow
- Read
references/stable-diffusion-workflows.mdfor command families, model asset requirements, and DPM-Solver settings. - Read
references/dpmsolver-sampler-adapter.mdwhen adapting the sampler class to a latent-diffusion model object. - Use
scripts/build_sd_dpm_command.pyto construct a command plan without launching image generation. - Use
scripts/stable_diffusion_dpmsolver_sampler.pyas a bundled, self-contained adapter template when a project already has a compatible latent diffusion model object. - Route direct Hugging Face Diffusers scheduler questions to a Diffusers skill instead of translating everything through this legacy latent-diffusion adapter.
Default Stable Diffusion Sampling Family
python scripts/txt2img.py \
--prompt "a photograph of an astronaut riding a horse" \
--dpm_solver \
--ddim_steps 25 \
--scale 7.5
The original example uses the same --ddim_steps argument name for the number
of DPM-Solver steps when --dpm_solver is selected.
Sampler Defaults
The adapter builds a discrete schedule from the model's alphas_cumprod, wraps
model.apply_model with classifier-free guidance, and calls the PyTorch
DPM-Solver++ path:
DPM_Solver(model_fn, noise_schedule, algorithm_type="dpmsolver++")
Recommended defaults:
skip_type="time_uniform"method="multistep"order=2lower_order_final=True- 20-25 steps for common text-to-image usage
Do not enable dynamic thresholding for Stable Diffusion latents.
Safety Notes
- Stable Diffusion checkpoints may be gated, licensed, unsafe for some uses, or absent. Confirm asset availability and intended use before running.
- Real generation requires substantial GPU memory for classic latent-diffusion code. CPU execution is not a practical verification check.
- Safety checker and watermark dependencies can download models or require optional packages in the original script.
- DiffEdit/inpainting notebooks are evidence for workflows, not safe default commands.
Troubleshooting
Read references/troubleshooting.md for
Stable Diffusion-specific checkpoint, config, sampler, safety checker, memory,
DiffEdit, and command issues. Shared solver settings live in
../../references/solver-choice-guide.md.
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).