pytorch-lightning
Skill by K-Dense-AI
Guides an AI assistant through PyTorch Lightning, a framework that organizes PyTorch training code. Aimed at developers and researchers building and scaling neural network training.
Install pytorch-lightning
Built from the published package, never by AI.
git clone --depth 1 https://github.com/K-Dense-AI/scientific-agent-skills /tmp/scientific-agent-skills && mkdir -p ~/.claude/skills && cp -r /tmp/scientific-agent-skills/skills/pytorch-lightning ~/.claude/skills/pytorch-lightningRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/K-Dense-AI/scientific-agent-skills /tmp/scientific-agent-skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/scientific-agent-skills/skills/pytorch-lightning ~/.gemini/antigravity-cli/skills/pytorch-lightningAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The pytorch-lightning skill gives an AI assistant guidance on PyTorch Lightning, a framework that organizes PyTorch code into LightningModules and automates training with a Trainer. It covers LightningDataModules for data pipelines, callbacks such as ModelCheckpoint and EarlyStopping, and logging to CSV, Weights & Biases, MLflow, Comet and TensorBoard when optional packages are installed. It also covers distributed training with DDP, FSDP and DeepSpeed.
The skill points to reference documents and template scripts for modules, Trainers and data modules, and includes a CPU smoke test. It targets the Lightning 2.6.6 release and Python 3.10 or later. It is intended for developers and researchers who train neural networks with PyTorch and want to scale them across GPUs or TPUs.
Written from the project's SKILL.md and checked against it.
What it can do
- LightningModule definitionOrganizes PyTorch models into training, validation, test, prediction and optimizer sections.
- Trainer configurationSets up multi-GPU or TPU training with strategy selection, mixed precision and checkpointing.
- LightningDataModuleGroups data download, setup and dataloaders into one reusable class.
- CallbacksAdds ModelCheckpoint, EarlyStopping, LearningRateMonitor and BatchSizeFinder to training runs.
- Experiment loggingLogs metrics with self.log to CSV, W&B, MLflow, Comet or TensorBoard.
- Distributed trainingChooses DDP, FSDP or DeepSpeed based on measured memory pressure and throughput.
- Best practicesCovers device-agnostic code, hyperparameter saving, reproducibility and debugging with fast_dev_run.
What you need
- Python 3.10 or later
- lightning 2.6.6 with a compatible PyTorch
- CUDA hardware for DDP, FSDP or DeepSpeed
- Optional logger packages such as wandb or mlflow
- Credentials and network access for online logging services
Try asking
- Write a LightningModule for a simple classifier with training and validation steps
- Configure a Trainer for 4 GPUs with DDP and mixed precision
- Add ModelCheckpoint and EarlyStopping callbacks to my Lightning training script
Good to know
- GPU, TPU, multi-node and online logger examples are not executed training validation.
- NeptuneLogger was removed in Lightning 2.6.4.
- Final DDP evaluation can duplicate padded samples.
- fast_dev_run disables much of the checkpoint and callback behavior.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/pytorch-lightning/SKILL.md, skills/pytorch-lightning/scripts/quick_trainer_setup.py, skills/pytorch-lightning/scripts/template_datamodule.py, skills/pytorch-lightning/scripts/template_lightning_module.py. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
Allowed tools: Read Write Edit Bash
-
SKILL.md10 KB -
references/best_practices.md5 KB -
references/callbacks.md5 KB -
references/data_module.md5 KB -
references/distributed_training.md7 KB
Show all 11 files
-
references/lightning_module.md6 KB -
references/logging.md8 KB -
references/trainer.md6 KB -
scripts/quick_trainer_setup.py14 KB -
scripts/template_datamodule.py7 KB -
scripts/template_lightning_module.py6 KB
Alternatives to pytorch-lightning
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
pytorch-lightning: common questions
Which Lightning version does this skill cover?
It targets Lightning 2.6.6. The source says CPU tests used Python 3.11, Torch 2.14.1 and Lightning 2.6.6.
Does it support Neptune logging?
No. The source says NeptuneLogger was removed in Lightning 2.6.4 because the Neptune service shut down on March 5, 2026.
Which distributed training strategies are covered?
DDP, FSDP and DeepSpeed are covered. The source advises choosing among them using measured memory and throughput rather than a fixed parameter-count threshold.
How do I install pytorch-lightning?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is pytorch-lightning free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is pytorch-lightning safe to use?
It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to pytorch-lightning?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
