PyTorch Lightning Training
Orchestra-Research/AI-Research-SKILLs
Shows how to organize PyTorch training with Lightning's LightningModule and Trainer, covering validation, DDP, callbacks and learning-rate scheduling.
Organizes PyTorch training code into LightningModules, DataModules and Trainers, with multi-GPU strategies, callbacks and logging configured.
$ npx skills add davila7/claude-code-templates --skill pytorch-lightning -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install davila7/claude-code-templates pytorch-lightning --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/davila7/claude-code-templates.git skills-src && mkdir -p .claude/skills && cp -r skills-src/cli-tool/components/skills/scientific/pytorch-lightning .claude/skills/pytorch-lightning && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "pytorch-lightning" agent skill from https://github.com/davila7/claude-code-templates/tree/main/cli-tool/components/skills/scientific/pytorch-lightning into .claude/skills/pytorch-lightning/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytorch-lightning", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/davila7/claude-code-templates/tree/main/cli-tool/components/skills/scientific/pytorch-lightningType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add davila7/claude-code-templates --skill pytorch-lightning -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install davila7/claude-code-templates pytorch-lightning --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/davila7/claude-code-templates.git skills-src && mkdir -p .agents/skills && cp -r skills-src/cli-tool/components/skills/scientific/pytorch-lightning .agents/skills/pytorch-lightning && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "pytorch-lightning" agent skill from https://github.com/davila7/claude-code-templates/tree/main/cli-tool/components/skills/scientific/pytorch-lightning into .agents/skills/pytorch-lightning/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytorch-lightning", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add davila7/claude-code-templates --skill pytorch-lightning -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install davila7/claude-code-templates pytorch-lightning --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/davila7/claude-code-templates.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/cli-tool/components/skills/scientific/pytorch-lightning .cursor/skills/pytorch-lightning && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "pytorch-lightning" agent skill from https://github.com/davila7/claude-code-templates/tree/main/cli-tool/components/skills/scientific/pytorch-lightning into .cursor/skills/pytorch-lightning/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytorch-lightning", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/davila7/claude-code-templates.git --path cli-tool/components/skills/scientific/pytorch-lightning--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add davila7/claude-code-templates --skill pytorch-lightning -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install davila7/claude-code-templates pytorch-lightning --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/davila7/claude-code-templates.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/cli-tool/components/skills/scientific/pytorch-lightning .gemini/skills/pytorch-lightning && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "pytorch-lightning" agent skill from https://github.com/davila7/claude-code-templates/tree/main/cli-tool/components/skills/scientific/pytorch-lightning into .gemini/skills/pytorch-lightning/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytorch-lightning", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install davila7/claude-code-templates pytorch-lightningInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add davila7/claude-code-templates --skill pytorch-lightning -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/davila7/claude-code-templates.git skills-src && mkdir -p .github/skills && cp -r skills-src/cli-tool/components/skills/scientific/pytorch-lightning .github/skills/pytorch-lightning && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "pytorch-lightning" agent skill from https://github.com/davila7/claude-code-templates/tree/main/cli-tool/components/skills/scientific/pytorch-lightning into .github/skills/pytorch-lightning/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytorch-lightning", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add davila7/claude-code-templates --skill pytorch-lightning -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install davila7/claude-code-templates pytorch-lightning --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/davila7/claude-code-templates.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/cli-tool/components/skills/scientific/pytorch-lightning .opencode/skills/pytorch-lightning && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "pytorch-lightning" agent skill from https://github.com/davila7/claude-code-templates/tree/main/cli-tool/components/skills/scientific/pytorch-lightning into .opencode/skills/pytorch-lightning/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytorch-lightning", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
pytorch-lightningOrganizes PyTorch training code into LightningModules, DataModules and Trainers, with multi-GPU strategies, callbacks and logging configured.
PyTorch Lightning cuts training boilerplate while keeping control of the model. The skill shows the agent how to split a model into a LightningModule's six sections (initialization, training, validation, test and prediction steps, and optimizer configuration), and how to wrap data handling in a LightningDataModule with prepare_data, setup and the train, validation and test dataloaders.
The Trainer handles device management, mixed precision, gradient accumulation and clipping, checkpointing, early stopping and progress bars, and can run on several GPUs or TPUs with DDP, FSDP or DeepSpeed strategies. Callbacks and logging, including W&B and TensorBoard, are covered in reference notes. Three template scripts, `scripts/template_lightning_module.py`, `scripts/template_datamodule.py` and `scripts/quick_trainer_setup.py`, give starting points.
7 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 14680ec. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Ships 3 files in scripts/ (Python), which the agent can run.
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
PyTorch Lightning Training Setup loads about 1.7k tokens when it runs, and up to ~27k if it reads all its reference files. Until then it costs about 73 tokens; SKILL.md has 551 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.
The full file from davila7/claude-code-templates at commit 14680ec, republished under its MIT licence (© davila7). 551 words, ~1,652 tokens.
.claude/skills/pytorch-lightning/SKILL.md (or your agent's skills folder). This skill also uses 10 other files; get the full folder from GitHub.PyTorch Lightning is a deep learning framework that organizes PyTorch code to eliminate boilerplate while maintaining full flexibility. Automate training workflows, multi-device orchestration, and implement best practices for neural network training and scaling across multiple GPUs/TPUs.
This skill should be used when:
Organize PyTorch models into six logical sections:
__init__() and setup()training_step(batch, batch_idx)validation_step(batch, batch_idx)test_step(batch, batch_idx)predict_step(batch, batch_idx)configure_optimizers()Quick template reference: See scripts/template_lightning_module.py for a complete boilerplate.
Detailed documentation: Read references/lightning_module.md for comprehensive method documentation, hooks, properties, and best practices.
The Trainer automates the training loop, device management, gradient operations, and callbacks. Key features:
Quick setup reference: See scripts/quick_trainer_setup.py for common Trainer configurations.
Detailed documentation: Read references/trainer.md for all parameters, methods, and configuration options.
Encapsulate all data processing steps in a reusable class:
prepare_data() - Download and process data (single-process)setup() - Create datasets and apply transforms (per-GPU)train_dataloader() - Return training DataLoaderval_dataloader() - Return validation DataLoadertest_dataloader() - Return test DataLoaderQuick template reference: See scripts/template_datamodule.py for a complete boilerplate.
Detailed documentation: Read references/data_module.md for method details and usage patterns.
Add custom functionality at specific training hooks without modifying your LightningModule. Built-in callbacks include:
Detailed documentation: Read references/callbacks.md for built-in callbacks and custom callback creation.
Integrate with multiple logging platforms:
Log metrics using self.log("metric_name", value) in any LightningModule method.
Detailed documentation: Read references/logging.md for logger setup and configuration.
Choose the right strategy based on model size:
Configure with: Trainer(strategy="ddp", accelerator="gpu", devices=4)
Detailed documentation: Read references/distributed_training.md for strategy comparison and configuration.
self.device instead of .cuda()self.save_hyperparameters() in __init__()self.log() for automatic aggregation across devicesseed_everything() and Trainer(deterministic=True)Trainer(fast_dev_run=True) to test with 1 batchDetailed documentation: Read references/best_practices.md for common patterns and pitfalls.
Define model:
class MyModel(L.LightningModule):
def __init__(self):
super().__init__()
self.save_hyperparameters()
self.model = YourNetwork()
def training_step(self, batch, batch_idx):
x, y = batch
loss = F.cross_entropy(self.model(x), y)
self.log("train_loss", loss)
return loss
def configure_optimizers(self):
return torch.optim.Adam(self.parameters())Prepare data:
# Option 1: Direct DataLoaders
train_loader = DataLoader(train_dataset, batch_size=32)
# Option 2: LightningDataModule (recommended for reusability)
dm = MyDataModule(batch_size=32)Train:
trainer = L.Trainer(max_epochs=10, accelerator="gpu", devices=2)
trainer.fit(model, train_loader) # or trainer.fit(model, datamodule=dm)Executable Python templates for common PyTorch Lightning patterns:
template_lightning_module.py - Complete LightningModule boilerplatetemplate_datamodule.py - Complete LightningDataModule boilerplatequick_trainer_setup.py - Common Trainer configuration examplesDetailed documentation for each PyTorch Lightning component:
lightning_module.md - Comprehensive LightningModule guide (methods, hooks, properties)trainer.md - Trainer configuration and parametersdata_module.md - LightningDataModule patterns and methodscallbacks.md - Built-in and custom callbackslogging.md - Logger integrations and usagedistributed_training.md - DDP, FSDP, DeepSpeed comparison and setupbest_practices.md - Common patterns, tips, and pitfalls© davila7, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 10 other files (scripts, references) in cli-tool/components/skills/scientific/pytorch-lightning of davila7/claude-code-templates.
Open the folder on GitHubat commit 14680ec
We found 22 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 14 other GitHub owners. This page covers the copy in davila7/claude-code-templates, which our catalogue first saw on October 7, 2026.
PyTorch Lightning Training Setup next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| PyTorch Lightning Training Setup this skilldavila7/claude-code-templates | 32k | 14 repos | ~1.7k | Automated safety check: Pass | MIT | |
| PyTorch Lightning TrainingOrchestra-Research/AI-Research-SKILLs | 13k | 7 repos | ~2.3k | Automated safety check: Pass | MIT | |
| Ray Train Distributed TrainingOrchestra-Research/AI-Research-SKILLs | 13k | 3 repos | ~2.7k | Automated safety check: Pass | MIT | |
| GPU OptimizerMathews-Tom/armory | 328 | — | ~3.5k | Automated safety check: Notes | MIT | |
| Cuda Index Widthpytorch/pytorch | 104k | — | ~1.6k | Automated safety check: Pass | Custom licence | |
| Liger Kernel Devlinkedin/Liger-Kernel | 6.6k | — | ~799 | Automated safety check: Pass | BSD-2-Clause |
Orchestra-Research/AI-Research-SKILLs
Shows how to organize PyTorch training with Lightning's LightningModule and Trainer, covering validation, DDP, callbacks and learning-rate scheduling.
Orchestra-Research/AI-Research-SKILLs
Scales PyTorch, TensorFlow and Hugging Face training from a single GPU to multi-node clusters with Ray Train, including Ray Tune sweeps and checkpoint recovery.
Mathews-Tom/armory
GPU optimization for consumer NVIDIA GPUs (8-24GB VRAM) covering mixed precision, gradient checkpointing, XGBoost GPU, CuPy/cuDF migration, and torch.compile.
pytorch/pytorch
Choose 32-bit vs 64-bit index math in PyTorch CUDA kernels. An agent skill from pytorch/pytorch.
linkedin/Liger-Kernel
Develops production-ready Triton kernels for Liger Kernel. An agent skill from linkedin/Liger-Kernel.
open-infra-skills/infra-skills
Profiles, benchmarks and tunes AI training workloads on Moore Threads MUSA GPUs with a measurement-first process that keeps model behavior unchanged.
davila7/claude-code-templates
Runs web-grounded searches through Perplexity's Sonar models over OpenRouter for current events, recent literature and cited facts beyond the model's training cutoff.
davila7/claude-code-templates
Analyzes Neuropixels recordings from SpikeGLX or Open Ephys through preprocessing, drift correction, Kilosort4 spike sorting, quality metrics and curation.
davila7/claude-code-templates
Supplies LaTeX templates and formatting rules for journals, conferences, posters, and grant proposals, then can check a draft against them.
davila7/claude-code-templates
Analyzes a brand's existing writing to lock in a consistent voice, then builds SEO blog posts and platform-specific social content around it.
davila7/claude-code-templates
Guides corrective and preventive action (CAPA) work in a quality management system, from initiation and root cause analysis through effectiveness verification.
davila7/claude-code-templates
Senior FDA consultant and specialist for medical device companies including HIPAA compliance and requirement management.
Works with
Categories
Organizes PyTorch training code into LightningModules, DataModules and Trainers, with multi-GPU strategies, callbacks and logging configured. PyTorch Lightning cuts training boilerplate while keeping control of the model. The skill shows the agent how to split a model into a LightningModule's six sections (initialization, training, validation, test and prediction steps, and optimizer configuration), and how to wrap data handling in a LightningDataModule with prepare_data, setup and the train, validation and test dataloaders.
PyTorch Lightning Training Setup fits situations like: restructuring a plain PyTorch training loop into a LightningModule; configuring a Trainer for multi-GPU or TPU training; putting dataset loading and splits into a reusable DataModule; adding checkpointing, early stopping and logging to a training run.
Run `npx skills add davila7/claude-code-templates --skill pytorch-lightning -a claude-code`. Or copy the skill folder (cli-tool/components/skills/scientific/pytorch-lightning in davila7/claude-code-templates) into .claude/skills/pytorch-lightning in your project. Claude Code loads it when a task matches its description.
Run `npx skills add davila7/claude-code-templates --skill pytorch-lightning -a codex`. Or copy the skill folder (cli-tool/components/skills/scientific/pytorch-lightning in davila7/claude-code-templates) into .agents/skills/pytorch-lightning in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add davila7/claude-code-templates --skill pytorch-lightning -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pytorch-lightning, .gemini/skills/pytorch-lightning, .github/skills/pytorch-lightning and .opencode/skills/pytorch-lightning in your project.
Going by SKILL.md and its folder, PyTorch Lightning Training Setup needs Python for the scripts in its folder. Our summary lists: PyTorch and PyTorch Lightning installed; Multiple GPUs or TPUs for distributed runs (optional).
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.
PyTorch Lightning Training Setup is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.7k tokens (SKILL.md is roughly 6.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 26k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with PyTorch Lightning Training Setup: PyTorch Lightning Training (Orchestra-Research/AI-Research-SKILLs, 13k stars), Ray Train Distributed Training (Orchestra-Research/AI-Research-SKILLs, 13k stars), GPU Optimizer (Mathews-Tom/armory, 328 stars) and Cuda Index Width (pytorch/pytorch, 104k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
davila7 (a GitHub user) maintains it in davila7/claude-code-templates, which has 32,463 GitHub stars. The repository holds 477 skills in this directory. The repository was last updated on October 8, 2026.
Source: davila7/claude-code-templates on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.