torch-examples
Plan and troubleshoot PyTorch DPM-Solver example workflows for DDPM, guided-diffusion, and ScoreSDE without running heavyweight checkpoints by default.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- torch-examples
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Plan and troubleshoot PyTorch DPM-Solver example workflows for DDPM, guided-diffusion, and ScoreSDE without running heavyweight checkpoints by default.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/ddpm-guided-workflows.md3.8 KB
- 参考文档references/score-sde-pytorch-workflows.md3.4 KB
- 参考文档references/troubleshooting.md3.2 KB
- 脚本scripts/build_torch_example_command.py4.1 KB
- 脚本scripts/validate_torch_options.py2.6 KB
03 SKILL.md 正文
PyTorch Examples
Use this sub-skill when a user asks how to adapt the repository's PyTorch example workflows: DDPM, improved-DDPM, classifier-guided diffusion, or ScoreSDE PyTorch sampling/evaluation with DPM-Solver.
When To Read
Read this for tasks that mention:
examples/ddpm_and_guided-diffusion,sample_type=dpmsolver++,--dpm_solver_order,--skip_type,--thresholding,--scale, or FID sampling commands.- ScoreSDE PyTorch configs,
sampling.method="dpm_solver",get_dpm_solver_sampler, CIFAR-10ddpmpp_deep_continuous, orconfigs/vp/cifar10_ddpmpp_deep_continuous.py. - PyTorch checkpoint/data/FID stats requirements for DPM-Solver examples.
Workflow
- Decide which PyTorch family owns the task:
- DDPM / guided-diffusion commands: read
references/ddpm-guided-workflows.md. - ScoreSDE PyTorch sampling: read
references/score-sde-pytorch-workflows.md.
- DDPM / guided-diffusion commands: read
- Use the root
../../references/solver-choice-guide.mdto choosesteps,order,method, andskip_type. - Build a safe command plan with
scripts/build_torch_example_command.pyinstead of copying a shell script with fixed GPU IDs or paths. - Validate DPM-Solver option combinations with
scripts/validate_torch_options.pybefore launching a full run. - Only run real examples after the user confirms checkpoint/stat files, datasets, GPU availability, output directory, and expected duration.
Common Command Families
DDPM / guided-diffusion CIFAR-10 style:
python main.py --config cifar10.yml --exp <workdir> --sample --fid \
--timesteps 10 --eta 0 --ni --skip_type logSNR \
--sample_type dpmsolver++ --dpm_solver_order 3 \
--dpm_solver_method multistep --dpm_solver_type dpmsolver
Guided ImageNet-style large-guidance family:
python main.py --config imagenet256_guided.yml --exp <workdir> --sample --fid \
--timesteps 20 --eta 0 --ni --skip_type time_uniform \
--sample_type dpmsolver++ --dpm_solver_order 2 \
--dpm_solver_method multistep --dpm_solver_type dpmsolver \
--scale 8.0 --thresholding
ScoreSDE PyTorch CIFAR-10 DPM-Solver sampler family:
python main.py --config configs/vp/cifar10_ddpmpp_deep_continuous.py \
--mode eval --workdir <workdir> \
--config.sampling.eps=1e-3 \
--config.sampling.method=dpm_solver \
--config.sampling.steps=10 \
--config.sampling.skip_type=logSNR \
--config.sampling.dpm_solver_order=3 \
--config.sampling.dpm_solver_method=singlestep \
--config.eval.batch_size=1000
Safety Notes
- Original sample commands assume external checkpoints and FID stats. Some checkpoint paths auto-download; others must be placed manually.
- The DDPM/guided example uses distributed PyTorch with NCCL and a port. Avoid launching it on CPU-only hosts or without explicit GPU selection.
- ScoreSDE PyTorch requirements include TensorFlow-related evaluation packages and can conflict with modern Python stacks. Prefer a separate environment for full example execution.
- FID and full sample generation are long-running and should not be used as a routine skill verification check.
Troubleshooting
Use references/troubleshooting.md for
PyTorch example-specific checkpoint, config, distributed launch, option, and FID
errors. Use the root ../../references/troubleshooting.md
for shared import/backend/schedule issues.
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).