$npx skillfedfor your agent

pytorch-lightning

PyTorch Lightning transforms raw PyTorch code into clean, organized training workflows by handling device management, distributed strategies (DDP, FSDP, DeepSpeed), and logging automatically. Define your model as a LightningModule, pass it to Trainer with your data, and let the framework manage GPU/TPU switching, mixed precision, checkpointing, and callbacks—reducing typical training code from 40+ lines to 15.

PyTorch Lightning provides automatic GPU/TPU training with minimal boilerplate through a high-level Trainer API.

AI-generated summary based on this skill's SKILL.md

221,503 42,317 MITupdated by NousResearch

Decision gist · record as of 2026-07-28

PyTorch Lightning provides automatic GPU/TPU training with minimal boilerplate through a high-level Trainer API. PyTorch Lightning transforms raw PyTorch code into clean, organized training workflows by handling device management, distributed strategies (DDP, FSDP, DeepSpeed), and logging automatically. Define your model as a LightningModule, pass it to Trainer with your data, and let the framework manage GPU/TPU switching, mixed precision, checkpointing, and callbacks—reducing typical training code from 40+ lines to 15.

manual: git clone https://github.com/NousResearch/hermes-agent → cp -r hermes-agent/optional-skills/mlops/pytorch-lightning ~/.claude/skills/pytorch-lightning
optional-skills/mlops/pytorch-lightning/SKILL.md · version a46410e9

Use it when

  • PyTorch Lightning eliminates boilerplate by automating device management, mixed precision, checkpointing, and logging.
  • Yes, PyTorch Lightning supports GPU, CPU, and TPU through unified device abstraction.

Verify before relying

Read SKILL.md below before installing (4 files). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

NousResearch/hermes-agent/pytorch-lightning · repository language: Python

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How to use pytorch lightning for distributed training?

PyTorch Lightning handles distributed training through its Trainer class. Set the `strategy` parameter to 'ddp' (Distributed Data Parallel), 'fsdp' (Fully Sharded Data Parallel), or 'deepspeed' and specify `devices='auto'` or a device count. Lightning automatically manages process spawning, gradient synchronization, and communication across GPUs or nodes—no code changes needed to your LightningModule.

What does PyTorch Lightning do compared to raw PyTorch?

PyTorch Lightning eliminates boilerplate by automating device management, mixed precision, checkpointing, and logging. Instead of writing 40+ lines of training loop code with manual GPU handling and callback orchestration, you define a LightningModule, configure a Trainer with your desired settings (GPU count, precision, strategy), and call `trainer.fit()`. Lightning handles the rest.

Does PyTorch Lightning support GPU, CPU, and TPU?

Yes, PyTorch Lightning supports GPU, CPU, and TPU through unified device abstraction. Set `accelerator='gpu'`, `accelerator='cpu'`, or `accelerator='tpu'` in the Trainer, and optionally specify `devices='auto'` to use all available hardware. Your LightningModule code remains unchanged regardless of target hardware.

How do PyTorch Lightning callbacks enable early stopping?

PyTorch Lightning provides built-in callbacks like `EarlyStopping` that monitor validation metrics and halt training when no improvement occurs for a specified patience window. Pass callbacks to the Trainer: `trainer = Trainer(callbacks=[EarlyStopping(monitor='val_loss', patience=3)])`. Custom callbacks can also log metrics, save checkpoints, or adjust learning rates automatically.

Can PyTorch Lightning optimize memory and precision for large models?

PyTorch Lightning supports mixed precision training (fp16, bf16) via the `precision` parameter in Trainer, reducing memory footprint and accelerating computation. For very large models, use `strategy='fsdp'` (Fully Sharded Data Parallel) to shard parameters across devices, or integrate DeepSpeed for advanced memory optimization and gradient checkpointing.

What is a LightningModule and how do I structure training?

A LightningModule is a PyTorch nn.Module subclass that organizes your model, optimizer, and training logic into standardized methods: `forward()`, `training_step()`, `validation_step()`, and `configure_optimizers()`. Pass it to a Trainer with your DataLoader, call `trainer.fit()`, and Lightning orchestrates the training loop, validation, checkpointing, and logging automatically.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

PyTorch Lightning - High-Level Training Framework

Quick start

PyTorch Lightning organizes PyTorch code to eliminate boilerplate while maintaining flexibility.

Installation:

pip install lightning

Convert PyTorch to Lightning (3 steps):

```python import lightning as L import torch from torch import nn from torch.utils.data import DataLoader, Dataset

Step 1: Define LightningModule (organize your PyTorch code)

class LitModel(L.LightningModule): def init(self, hidden_size=128): super().init() self.model = nn.Sequential( nn.Linear(28 * 28, hidden_size), nn.ReLU(), nn.Linear(hidden_size, 10) )

def training_step(self, batch, batch_idx):
    x, y = batch
    y_hat =

(truncated - see the full file via the links below)

File tree — 4 files
optional-skills/mlops/pytorch-lightning/SKILL.md
optional-skills/mlops/pytorch-lightning/references/callbacks.md
optional-skills/mlops/pytorch-lightning/references/distributed.md
optional-skills/mlops/pytorch-lightning/references/hyperparameter-tuning.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Set up clean, organized PyTorch training loops with automatic GPU/TPU support”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

pytorch-lightning
by K-Dense-AI · K-Dense-AI/scientific-agent-skills

PyTorch Lightning eliminates boilerplate by structuring PyTorch models into LightningModules with built-in support for multi-device training, callbacks, and experiment tracking. Configure Trainers for distributed strategies like DDP and FSDP, organize data pipelines with LightningDataModules, and integrate logging via TensorBoard, Weights & Biases, or MLflow.

MITupdated Jul 2026
★ 31,940repo stars
pytorch-lightning
by foryourhealth111-pixel · foryourhealth111-pixel/Vibe-Skills

PyTorch Lightning eliminates boilerplate by structuring PyTorch projects into reusable LightningModules, automated Trainers, and data pipelines. Scale training across multiple GPUs or TPUs using strategies like DDP, FSDP, and DeepSpeed, with built-in support for callbacks, experiment logging, and best practices.

Apache-2.0updated Jul 2026
★ 2,494repo stars
ai-ml-engineer
by nahisaho · nahisaho/MUSUBI

This copilot guides you through machine learning workflows—from model design and data preparation through training, evaluation, and production deployment. It covers supervised and unsupervised learning, deep learning, NLP, computer vision, and LLM applications, with structured dialogue to clarify your project needs and constraints.

MITfor claude-codedocs in Japaneseupdated Jan 2026
★ 66repo stars
Deep Learning
by pluginagentmarketplace · pluginagentmarketplace/custom-plugin-data-engineer

Master production-grade deep learning using PyTorch, covering neural architectures, transformer models, and optimization techniques. Learn training best practices including mixed precision, gradient management, and deployment strategies for real-world applications.

no license declared → metadata onlyupdated Jan 2026
★ 4repo stars
ML Model Training
by aj-geddes · aj-geddes/useful-ai-prompts

ML Model Training guides you through building and optimizing machine learning models across three major frameworks. Learn data preparation, feature engineering, algorithm selection, and hyperparameter tuning with practical examples for classification, regression, and clustering.

MITupdated Mar 2026
★ 299repo stars
scrapling
by NousResearch · NousResearch/hermes-agent

scrapling enables automated data extraction from sites defended by Cloudflare and similar anti-scraping systems. It uses sophisticated evasion methods to bypass protection layers and retrieve content that would otherwise be inaccessible to standard scrapers. Ideal for researchers and developers who need reliable access to protected web data.

MITupdated Jul 2026
★ 221,503repo stars

More skills Computer Vision (MIT)

Tags
neural-network-traininggpu-accelerationmodel-scalingexperiment-trackingtraining-automationml-engineeringreproducibility-frameworkhardware-abstractionbatch-processingdeep-learning-ops