AGENT SKILL

training-core

Build, convert, debug, and validate core Lightning training workflows with LightningModule, LightningDataModule, Trainer, callbacks, loggers, checkpointing, tuning, and reproducibility.

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

01 前言 Front Matter

name
training-core
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Build, convert, debug, and validate core Lightning training workflows with LightningModule, LightningDataModule, Trainer, callbacks, loggers, checkpointing, tuning, and reproducibility.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

Lightning Training Core

Use this sub-skill when the task is about standard lightning.pytorch training, validation, testing, prediction, callbacks, loggers, checkpointing, or converting raw PyTorch training loops to Lightning.

Start Here

  1. Import the public API with import lightning as L for new code, or import lightning.pytorch as pl when existing code already follows the pl convention.
  2. Put model math and steps in a LightningModule; put splits, transforms, and dataloaders in a LightningDataModule when data setup should be reusable.
  3. Let Trainer own the loop, device movement, precision, callbacks, logging, checkpointing, and fit/validate/test/predict orchestration.
  4. Use fast_dev_run=True or a tiny max_steps/limit_*_batches run before proposing longer training.
  5. Run scripts/lightning_smoke.py --help or a one-step CPU smoke run to validate imports and the core workflow.

Route Tasks

  • Core model code, datamodules, Trainer.fit, Trainer.validate, Trainer.test, Trainer.predict, callbacks, loggers, checkpointing, tuning, and reproducibility: use this sub-skill.
  • LightningCLI, YAML config, parser subclasses, --print_config, environment variable parsing, or config save behavior: route to ../cli-configuration/SKILL.md.
  • Fabric manual loops, Fabric.setup, fabric.backward, Fabric checkpoint IO, or expert-controlled PyTorch loops: route to ../fabric-expert-loops/SKILL.md.
  • Deep accelerator, strategy, FSDP, DeepSpeed, TPU, MPS, GPU, precision, launch, or cluster behavior: route to ../distributed-accelerators/SKILL.md.
  • Serving, export, pure prediction services, ONNX/TorchScript/TensorRT, or lightning.pytorch.serve: route to ../deployment-serving/SKILL.md.

References

  • references/api-reference.md: common API imports, signatures, Trainer options, module/datamodule hooks, callback/logger/checkpoint surfaces.
  • references/workflows.md: raw PyTorch conversion, standard train/eval/predict flows, checkpoint resume/load, tuning, reproducibility, validation steps.
  • references/troubleshooting.md: installation/import, optional dependencies, monitor/logging, checkpoints, dataloaders, Trainer misuse, and CPU/GPU boundary issues.
  • scripts/lightning_smoke.py: self-contained synthetic autoencoder smoke adapted from Lightning examples without downloads or source-repo dependencies.

Quick Validation

python sub-skills/training-core/scripts/lightning_smoke.py --help
python sub-skills/training-core/scripts/lightning_smoke.py --max-steps 1 --fast-dev-run

Expected signal: the help command prints CLI options; the one-step run imports Lightning and Torch, creates synthetic tensors, runs a tiny CPU Trainer.fit, then prints a LIGHTNING_SMOKE_OK summary. If Lightning is missing, follow references/troubleshooting.md before changing model code.

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