training-and-configs
Author, inspect, adapt, and troubleshoot config-driven training and model construction for diffusion and autoencoding workflows in generative-models.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- training-and-configs
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Author, inspect, adapt, and troubleshoot config-driven training and model construction for diffusion and autoencoding workflows in generative-models.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md10.2 KB
- 参考文档references/configuration.md10.0 KB
- 参考文档references/troubleshooting.md9.7 KB
- 参考文档references/workflows.md9.1 KB
- 脚本scripts/inspect_training_config.py20.6 KB
03 SKILL.md 正文
Training and Configs
Use this sub-skill when a task involves main.py --base, OmegaConf dotlist overrides, instantiate_from_config, DiffusionEngine training configs, AutoencodingEngine, GeneralConditioner, toy MNIST configs, USER placeholders, resume behavior, or Lightning callbacks/log directories.
Do not use this sub-skill for inference execution, checkpoint sampling, UI demos, or watermarking. Route SDXL/API inference tasks to ../inference-api/SKILL.md, video sampling scripts to ../video-sampling/SKILL.md, and demos or watermarking to ../demos-and-watermarking/SKILL.md.
What This Covers
- Build and inspect
model,data, andlightningYAML sections for config-driven training. - Trace nested
target/paramsobjects that will be consumed byinstantiate_from_config. - Adapt diffusion configs around
DiffusionEngine, denoisers, samplers, losses, conditioners, and first-stage autoencoders. - Adapt autoencoding configs around
AutoencodingEngineand legacyAutoencoderKLwrappers. - Reason about
main.pymerge order, CLI overrides, trainer defaults, logging, callbacks, and resume semantics. - Validate configs statically without starting training, downloading checkpoints, or probing GPUs.
Fast Static Check
Use the bundled helper for safe inspection before any training command:
python sub-skills/training-and-configs/scripts/inspect_training_config.py \
--config path/to/base.yaml \
--dotlist lightning.trainer.devices=0 model.params.sampler_config.params.num_steps=10
Add --json when another tool needs structured output. The helper parses and merges config files, reports top-level sections, target paths, placeholders, likely missing target keys, data assumptions, resume/name conflicts, and a command template. It never imports training modules, instantiates models, downloads datasets, loads checkpoints, or calls the trainer.
Required Mental Model
main.py treats YAML as the source of truth. It loads every --base config from left to right, builds an OmegaConf dotlist from unknown CLI tokens, merges the dotlist last, pops lightning out of the project config, and then instantiates config.model and config.data by calling instantiate_from_config on each object.
Every object meant for instantiate_from_config needs:
target: dotted.import.Path
params:
key: value
target resolves to a Python object and params are passed as keyword arguments. Missing target usually fails with KeyError: Expected key target to instantiate. Import typos fail later when the module/class path cannot be imported.
Reference Map
references/configuration.mdexplains schema patterns, merge rules, target paths, placeholders, and safe overrides.references/api-reference.mdrecords config-facing signatures and important target classes verified againstsgmversion0.1.0.references/workflows.mdgives safe authoring, adaptation, resume, and validation workflows.references/troubleshooting.mdmaps common symptoms to recoveries.scripts/inspect_training_config.pyprovides executable static validation help.
Safety Rules
- Prefer static inspection over
main.pyfor validation; even--train false --no-test truecan still instantiate model/data objects and call data preparation. - Do not recommend long training, checkpoint downloads, webdataset reads, or MNIST/CIFAR downloads as verification.
- Treat
CKPT_PATH,DATA_PATH,USERcomments, and dataset shard URLs as placeholders until a human supplies local values. - Keep
--nameand--resumemutually exclusive; use--resume_from_checkpointwith--nameonly when intentionally creating a new log folder from a checkpoint. - Assume GPU defaults unless
lightning.trainer.acceleratorandlightning.trainer.devicesare explicitly reviewed.
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).