[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6MAX201CVX2YGSB5AQDB226":3,"skill-same:01M6MAX201CVX2YGSB5AQDB226":89},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":40,"linkOnly":41,"markdownContent":42,"markdownBody":43,"frontMatter":44,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":54,"repositoryHtmlUrl":55,"repositoryHomepageUrl":56,"ownerHtmlUrl":57,"ownerBlogUrl":58,"ownerDescription":59,"updatedAt":60,"install":61,"resources":74},"01M6MAX201CVX2YGSB5AQDB226","pytorch-lightning-distributed",null,"High-level PyTorch framework with Trainer class, automatic distributed training (DDP\u002FFSDP\u002FDeepSpeed), callbacks system, and minimal boilerplate. Scales from laptop to supercomputer with same code. Use when you want clean training loops with built-in best practices.","hashgraph-online\u002Fawesome-codex-plugins","hashgraph-online","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F160371962?v=4","01M6CNB6NRJVNNGN14TR01Q6D3","HOL (Hashgraph Online)","01M6JT1HSKKG9V68KQAQGBA7XP",1571,"MIT","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fpytorch-lightning-distributed\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"pytorch","distributed","pytorch lightning distributed","lightning","pytorch lightning","when","automatic","you","loops","Scalable","Callbacks","High-Level API","Training Framework","DDP","FSDP","clean","api","Transformers","framework","code","training","2026-11-10 10:12:30",false,"---\nname: pytorch-lightning-distributed\ndescription: High-level PyTorch framework with Trainer class, automatic distributed training (DDP\u002FFSDP\u002FDeepSpeed), callbacks system, and minimal boilerplate. Scales from laptop to supercomputer with same code. Use when you want clean training loops with built-in best practices.\nlicense: MIT\nmetadata:\n  version: 1.0.0\n  category: ml-training\n  maintainer: Kalaris Labs\n  tags: PyTorch Lightning, Training Framework, Distributed Training, DDP, FSDP, DeepSpeed, High-Level API, Callbacks, Best Practices, Scalable\n  dependencies: lightning, torch, transformers\n---\n\n# PyTorch Lightning - High-Level Training Framework\n\n## Quick start\n\nPyTorch Lightning organizes PyTorch code to eliminate boilerplate while maintaining flexibility.\n\n**Installation**:\n```bash\npip install lightning\n```\n\n**Convert PyTorch to Lightning** (3 steps):\n\n```python\nimport lightning as L\nimport torch\nfrom torch import nn\nfrom torch.utils.data import DataLoader, Dataset\n\n# Step 1: Define LightningModule (organize your PyTorch code)\nclass LitModel(L.LightningModule):\n    def __init__(self, hidden_size=128):\n        super().__init__()\n        self.model = nn.Sequential(\n            nn.Linear(28 * 28, hidden_size),\n            nn.ReLU(),\n            nn.Linear(hidden_size, 10)\n        )\n\n    def training_step(self, batch, batch_idx):\n        x, y = batch\n        y_hat = self.model(x)\n        loss = nn.functional.cross_entropy(y_hat, y)\n        self.log('train_loss', loss)  # Auto-logged to TensorBoard\n        return loss\n\n    def configure_optimizers(self):\n        return torch.optim.Adam(self.parameters(), lr=1e-3)\n\n# Step 2: Create data\ntrain_loader = DataLoader(train_dataset, batch_size=32)\n\n# Step 3: Train with Trainer (handles everything else!)\ntrainer = L.Trainer(max_epochs=10, accelerator='gpu', devices=2)\nmodel = LitModel()\ntrainer.fit(model, train_loader)\n```\n\n**That's it!** Trainer handles:\n- GPU\u002FTPU\u002FCPU switching\n- Distributed training (DDP, FSDP, DeepSpeed)\n- Mixed precision (FP16, BF16)\n- Gradient accumulation\n- Checkpointing\n- Logging\n- Progress bars\n\n## Common workflows\n\n### Workflow 1: From PyTorch to Lightning\n\n**Original PyTorch code**:\n```python\nmodel = MyModel()\noptimizer = torch.optim.Adam(model.parameters())\nmodel.to('cuda')\n\nfor epoch in range(max_epochs):\n    for batch in train_loader:\n        batch = batch.to('cuda')\n        optimizer.zero_grad()\n        loss = model(batch)\n        loss.backward()\n        optimizer.step()\n```\n\n**Lightning version**:\n```python\nclass LitModel(L.LightningModule):\n    def __init__(self):\n        super().__init__()\n        self.model = MyModel()\n\n    def training_step(self, batch, batch_idx):\n        loss = self.model(batch)  # No .to('cuda') needed!\n        return loss\n\n    def configure_optimizers(self):\n        return torch.optim.Adam(self.parameters())\n\n# Train\ntrainer = L.Trainer(max_epochs=10, accelerator='gpu')\ntrainer.fit(LitModel(), train_loader)\n```\n\n**Benefits**: 40+ lines → 15 lines, no device management, automatic distributed\n\n### Workflow 2: Validation and testing\n\n```python\nclass LitModel(L.LightningModule):\n    def __init__(self):\n        super().__init__()\n        self.model = MyModel()\n\n    def training_step(self, batch, batch_idx):\n        x, y = batch\n        y_hat = self.model(x)\n        loss = nn.functional.cross_entropy(y_hat, y)\n        self.log('train_loss', loss)\n        return loss\n\n    def validation_step(self, batch, batch_idx):\n        x, y = batch\n        y_hat = self.model(x)\n        val_loss = nn.functional.cross_entropy(y_hat, y)\n        acc = (y_hat.argmax(dim=1) == y).float().mean()\n        self.log('val_loss', val_loss)\n        self.log('val_acc', acc)\n\n    def test_step(self, batch, batch_idx):\n        x, y = batch\n        y_hat = self.model(x)\n        test_loss = nn.functional.cross_entropy(y_hat, y)\n        self.log('test_loss', test_loss)\n\n    def configure_optimizers(self):\n        return torch.optim.Adam(self.parameters(), lr=1e-3)\n\n# Train with validation\ntrainer = L.Trainer(max_epochs=10)\ntrainer.fit(model, train_loader, val_loader)\n\n# Test\ntrainer.test(model, test_loader)\n```\n\n**Automatic features**:\n- Validation runs every epoch by default\n- Metrics logged to TensorBoard\n- Best model checkpointing based on val_loss\n\n### Workflow 3: Distributed training (DDP)\n\n```python\n# Same code as single GPU!\nmodel = LitModel()\n\n# 8 GPUs with DDP (automatic!)\ntrainer = L.Trainer(\n    accelerator='gpu',\n    devices=8,\n    strategy='ddp'  # Or 'fsdp', 'deepspeed'\n)\n\ntrainer.fit(model, train_loader)\n```\n\n**Launch**:\n```bash\n# Single command, Lightning handles the rest\npython train.py\n```\n\n**No changes needed**:\n- Automatic data distribution\n- Gradient synchronization\n- Multi-node support (just set `num_nodes=2`)\n\n### Workflow 4: Callbacks for monitoring\n\n```python\nfrom lightning.pytorch.callbacks import ModelCheckpoint, EarlyStopping, LearningRateMonitor\n\n# Create callbacks\ncheckpoint = ModelCheckpoint(\n    monitor='val_loss',\n    mode='min',\n    save_top_k=3,\n    filename='model-{epoch:02d}-{val_loss:.2f}'\n)\n\nearly_stop = EarlyStopping(\n    monitor='val_loss',\n    patience=5,\n    mode='min'\n)\n\nlr_monitor = LearningRateMonitor(logging_interval='epoch')\n\n# Add to Trainer\ntrainer = L.Trainer(\n    max_epochs=100,\n    callbacks=[checkpoint, early_stop, lr_monitor]\n)\n\ntrainer.fit(model, train_loader, val_loader)\n```\n\n**Result**:\n- Auto-saves best 3 models\n- Stops early if no improvement for 5 epochs\n- Logs learning rate to TensorBoard\n\n### Workflow 5: Learning rate scheduling\n\n```python\nclass LitModel(L.LightningModule):\n    # ... (training_step, etc.)\n\n    def configure_optimizers(self):\n        optimizer = torch.optim.Adam(self.parameters(), lr=1e-3)\n\n        # Cosine annealing\n        scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(\n            optimizer,\n            T_max=100,\n            eta_min=1e-5\n        )\n\n        return {\n            'optimizer': optimizer,\n            'lr_scheduler': {\n                'scheduler': scheduler,\n                'interval': 'epoch',  # Update per epoch\n                'frequency': 1\n            }\n        }\n\n# Learning rate auto-logged!\ntrainer = L.Trainer(max_epochs=100)\ntrainer.fit(model, train_loader)\n```\n\n## When to use vs alternatives\n\n**Use PyTorch Lightning when**:\n- Want clean, organized code\n- Need production-ready training loops\n- Switching between single GPU, multi-GPU, TPU\n- Want built-in callbacks and logging\n- Team collaboration (standardized structure)\n\n**Key advantages**:\n- **Organized**: Separates research code from engineering\n- **Automatic**: DDP, FSDP, DeepSpeed with 1 line\n- **Callbacks**: Modular training extensions\n- **Reproducible**: Less boilerplate = fewer bugs\n- **Tested**: 1M+ downloads\u002Fmonth, battle-tested\n\n**Use alternatives instead**:\n- **Accelerate**: Minimal changes to existing code, more flexibility\n- **Ray Train**: Multi-node orchestration, hyperparameter tuning\n- **Raw PyTorch**: Maximum control, learning purposes\n- **Keras**: TensorFlow ecosystem\n\n## Common issues\n\n**Issue: Loss not decreasing**\n\nCheck data and model setup:\n```python\n# Add to training_step\ndef training_step(self, batch, batch_idx):\n    if batch_idx == 0:\n        print(f\"Batch shape: {batch[0].shape}\")\n        print(f\"Labels: {batch[1]}\")\n    loss = ...\n    return loss\n```\n\n**Issue: Out of memory**\n\nReduce batch size or use gradient accumulation:\n```python\ntrainer = L.Trainer(\n    accumulate_grad_batches=4,  # Effective batch = batch_size × 4\n    precision='bf16'  # Or 'fp16', reduces memory 50%\n)\n```\n\n**Issue: Validation not running**\n\nEnsure you pass val_loader:\n```python\n# WRONG\ntrainer.fit(model, train_loader)\n\n# CORRECT\ntrainer.fit(model, train_loader, val_loader)\n```\n\n**Issue: DDP spawns multiple processes unexpectedly**\n\nLightning auto-detects GPUs. Explicitly set devices:\n```python\n# Test on CPU first\ntrainer = L.Trainer(accelerator='cpu', devices=1)\n\n# Then GPU\ntrainer = L.Trainer(accelerator='gpu', devices=1)\n```\n\n## Advanced topics\n\n**Callbacks**: See [references\u002Fcallbacks.md](references\u002Fcallbacks.md) for EarlyStopping, ModelCheckpoint, custom callbacks, and callback hooks.\n\n**Distributed strategies**: See [references\u002Fdistributed.md](references\u002Fdistributed.md) for DDP, FSDP, DeepSpeed ZeRO integration, multi-node setup.\n\n**Hyperparameter tuning**: See [references\u002Fhyperparameter-tuning.md](references\u002Fhyperparameter-tuning.md) for integration with Optuna, Ray Tune, and WandB sweeps.\n\n## Hardware requirements\n\n- **CPU**: Works (good for debugging)\n- **Single GPU**: Works\n- **Multi-GPU**: DDP (default), FSDP, or DeepSpeed\n- **Multi-node**: DDP, FSDP, DeepSpeed\n- **TPU**: Supported (8 cores)\n- **Apple MPS**: Supported\n\n**Precision options**:\n- FP32 (default)\n- FP16 (V100, older GPUs)\n- BF16 (A100\u002FH100, recommended)\n- FP8 (H100)\n\n## Resources\n\n- Docs: https:\u002F\u002Flightning.ai\u002Fdocs\u002Fpytorch\u002Fstable\u002F\n- GitHub: https:\u002F\u002Fgithub.com\u002FLightning-AI\u002Fpytorch-lightning ⭐ 29,000+\n- Version: 2.5.5+\n- Examples: https:\u002F\u002Fgithub.com\u002FLightning-AI\u002Fpytorch-lightning\u002Ftree\u002Fmaster\u002Fexamples\n- Discord: https:\u002F\u002Fdiscord.gg\u002Flightning-ai\n- Used by: Kaggle winners, research labs, production teams\n\n## Agent operating procedure\n\n1. **Check the environment.** Check GPU type, memory and driver\u002FCUDA versions (`nvidia-smi`), framework versions, and dataset location and size.\n2. **Pin down the inputs.** Confirm formats, identifiers and parameters from the data or the user. Ask rather than guess any value that changes the result.\n3. **Run a small version first.** Do a smoke run: tiny model or subset, few steps, and confirm loss decreases and checkpoints save.\n4. **Execute the full task** using the instructions and references above.\n5. **Validate the result.** Track metrics on held-out data, compare against a baseline, and record seeds, configs and hardware.\n6. **Report.** State what was run (versions, commands, parameters), what was checked, and what is still uncertain.\n\n| If this happens | Do this |\n|---|---|\n| CUDA out-of-memory | Reduce batch size, enable gradient accumulation\u002Fcheckpointing or mixed precision, or shard the model. |\n| Loss is NaN or diverges | Lower the learning rate, check data for invalid values, and enable gradient clipping. |\n| A function, flag or endpoint in these instructions is missing in the installed version | Check the installed version's own documentation (`help()`, `--help`, official docs), adapt, and tell the user. Never invent an API. |\n| A required input, identifier or parameter is ambiguous | Ask the user, or state the assumption explicitly before running. |\n\n**Integrity rules**\n\n- Never fabricate results, parameters, identifiers, citations or statistics. If something cannot be run or verified, say so plainly.\n- Never claim training results without logs; estimate compute cost before launching large jobs.\n- Treat version-specific details here as possibly outdated: confirm them against the official documentation for the installed version.\n- Ask before actions that cost money, consume shared GPUs or cloud quota, touch personal or patient data, or cannot be undone.\n\n## Related skills\n\n- `pytorch-lightning`: Organizes PyTorch training code with the lightning package (PyTorch Lightning): LightningModule, LightningDataModule, Trainer, callbacks su…\n- `ray-train`: Distributed training orchestration across clusters.\n- `huggingface-accelerate`: Wraps existing PyTorch training scripts with HuggingFace Accelerate (Accelerator class, accelerate config, accelerate launch) so the same c…\n","# PyTorch Lightning - High-Level Training Framework\n\n## Quick start\n\nPyTorch Lightning organizes PyTorch code to eliminate boilerplate while maintaining flexibility.\n\n**Installation**:\n```bash\npip install lightning\n```\n\n**Convert PyTorch to Lightning** (3 steps):\n\n```python\nimport lightning as L\nimport torch\nfrom torch import nn\nfrom torch.utils.data import DataLoader, Dataset\n\n# Step 1: Define LightningModule (organize your PyTorch code)\nclass LitModel(L.LightningModule):\n    def __init__(self, hidden_size=128):\n        super().__init__()\n        self.model = nn.Sequential(\n            nn.Linear(28 * 28, hidden_size),\n            nn.ReLU(),\n            nn.Linear(hidden_size, 10)\n        )\n\n    def training_step(self, batch, batch_idx):\n        x, y = batch\n        y_hat = self.model(x)\n        loss = nn.functional.cross_entropy(y_hat, y)\n        self.log('train_loss', loss)  # Auto-logged to TensorBoard\n        return loss\n\n    def configure_optimizers(self):\n        return torch.optim.Adam(self.parameters(), lr=1e-3)\n\n# Step 2: Create data\ntrain_loader = DataLoader(train_dataset, batch_size=32)\n\n# Step 3: Train with Trainer (handles everything else!)\ntrainer = L.Trainer(max_epochs=10, accelerator='gpu', devices=2)\nmodel = LitModel()\ntrainer.fit(model, train_loader)\n```\n\n**That's it!** Trainer handles:\n- GPU\u002FTPU\u002FCPU switching\n- Distributed training (DDP, FSDP, DeepSpeed)\n- Mixed precision (FP16, BF16)\n- Gradient accumulation\n- Checkpointing\n- Logging\n- Progress bars\n\n## Common workflows\n\n### Workflow 1: From PyTorch to Lightning\n\n**Original PyTorch code**:\n```python\nmodel = MyModel()\noptimizer = torch.optim.Adam(model.parameters())\nmodel.to('cuda')\n\nfor epoch in range(max_epochs):\n    for batch in train_loader:\n        batch = batch.to('cuda')\n        optimizer.zero_grad()\n        loss = model(batch)\n        loss.backward()\n        optimizer.step()\n```\n\n**Lightning version**:\n```python\nclass LitModel(L.LightningModule):\n    def __init__(self):\n        super().__init__()\n        self.model = MyModel()\n\n    def training_step(self, batch, batch_idx):\n        loss = self.model(batch)  # No .to('cuda') needed!\n        return loss\n\n    def configure_optimizers(self):\n        return torch.optim.Adam(self.parameters())\n\n# Train\ntrainer = L.Trainer(max_epochs=10, accelerator='gpu')\ntrainer.fit(LitModel(), train_loader)\n```\n\n**Benefits**: 40+ lines → 15 lines, no device management, automatic distributed\n\n### Workflow 2: Validation and testing\n\n```python\nclass LitModel(L.LightningModule):\n    def __init__(self):\n        super().__init__()\n        self.model = MyModel()\n\n    def training_step(self, batch, batch_idx):\n        x, y = batch\n        y_hat = self.model(x)\n        loss = nn.functional.cross_entropy(y_hat, y)\n        self.log('train_loss', loss)\n        return loss\n\n    def validation_step(self, batch, batch_idx):\n        x, y = batch\n        y_hat = self.model(x)\n        val_loss = nn.functional.cross_entropy(y_hat, y)\n        acc = (y_hat.argmax(dim=1) == y).float().mean()\n        self.log('val_loss', val_loss)\n        self.log('val_acc', acc)\n\n    def test_step(self, batch, batch_idx):\n        x, y = batch\n        y_hat = self.model(x)\n        test_loss = nn.functional.cross_entropy(y_hat, y)\n        self.log('test_loss', test_loss)\n\n    def configure_optimizers(self):\n        return torch.optim.Adam(self.parameters(), lr=1e-3)\n\n# Train with validation\ntrainer = L.Trainer(max_epochs=10)\ntrainer.fit(model, train_loader, val_loader)\n\n# Test\ntrainer.test(model, test_loader)\n```\n\n**Automatic features**:\n- Validation runs every epoch by default\n- Metrics logged to TensorBoard\n- Best model checkpointing based on val_loss\n\n### Workflow 3: Distributed training (DDP)\n\n```python\n# Same code as single GPU!\nmodel = LitModel()\n\n# 8 GPUs with DDP (automatic!)\ntrainer = L.Trainer(\n    accelerator='gpu',\n    devices=8,\n    strategy='ddp'  # Or 'fsdp', 'deepspeed'\n)\n\ntrainer.fit(model, train_loader)\n```\n\n**Launch**:\n```bash\n# Single command, Lightning handles the rest\npython train.py\n```\n\n**No changes needed**:\n- Automatic data distribution\n- Gradient synchronization\n- Multi-node support (just set `num_nodes=2`)\n\n### Workflow 4: Callbacks for monitoring\n\n```python\nfrom lightning.pytorch.callbacks import ModelCheckpoint, EarlyStopping, LearningRateMonitor\n\n# Create callbacks\ncheckpoint = ModelCheckpoint(\n    monitor='val_loss',\n    mode='min',\n    save_top_k=3,\n    filename='model-{epoch:02d}-{val_loss:.2f}'\n)\n\nearly_stop = EarlyStopping(\n    monitor='val_loss',\n    patience=5,\n    mode='min'\n)\n\nlr_monitor = LearningRateMonitor(logging_interval='epoch')\n\n# Add to Trainer\ntrainer = L.Trainer(\n    max_epochs=100,\n    callbacks=[checkpoint, early_stop, lr_monitor]\n)\n\ntrainer.fit(model, train_loader, val_loader)\n```\n\n**Result**:\n- Auto-saves best 3 models\n- Stops early if no improvement for 5 epochs\n- Logs learning rate to TensorBoard\n\n### Workflow 5: Learning rate scheduling\n\n```python\nclass LitModel(L.LightningModule):\n    # ... (training_step, etc.)\n\n    def configure_optimizers(self):\n        optimizer = torch.optim.Adam(self.parameters(), lr=1e-3)\n\n        # Cosine annealing\n        scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(\n            optimizer,\n            T_max=100,\n            eta_min=1e-5\n        )\n\n        return {\n            'optimizer': optimizer,\n            'lr_scheduler': {\n                'scheduler': scheduler,\n                'interval': 'epoch',  # Update per epoch\n                'frequency': 1\n            }\n        }\n\n# Learning rate auto-logged!\ntrainer = L.Trainer(max_epochs=100)\ntrainer.fit(model, train_loader)\n```\n\n## When to use vs alternatives\n\n**Use PyTorch Lightning when**:\n- Want clean, organized code\n- Need production-ready training loops\n- Switching between single GPU, multi-GPU, TPU\n- Want built-in callbacks and logging\n- Team collaboration (standardized structure)\n\n**Key advantages**:\n- **Organized**: Separates research code from engineering\n- **Automatic**: DDP, FSDP, DeepSpeed with 1 line\n- **Callbacks**: Modular training extensions\n- **Reproducible**: Less boilerplate = fewer bugs\n- **Tested**: 1M+ downloads\u002Fmonth, battle-tested\n\n**Use alternatives instead**:\n- **Accelerate**: Minimal changes to existing code, more flexibility\n- **Ray Train**: Multi-node orchestration, hyperparameter tuning\n- **Raw PyTorch**: Maximum control, learning purposes\n- **Keras**: TensorFlow ecosystem\n\n## Common issues\n\n**Issue: Loss not decreasing**\n\nCheck data and model setup:\n```python\n# Add to training_step\ndef training_step(self, batch, batch_idx):\n    if batch_idx == 0:\n        print(f\"Batch shape: {batch[0].shape}\")\n        print(f\"Labels: {batch[1]}\")\n    loss = ...\n    return loss\n```\n\n**Issue: Out of memory**\n\nReduce batch size or use gradient accumulation:\n```python\ntrainer = L.Trainer(\n    accumulate_grad_batches=4,  # Effective batch = batch_size × 4\n    precision='bf16'  # Or 'fp16', reduces memory 50%\n)\n```\n\n**Issue: Validation not running**\n\nEnsure you pass val_loader:\n```python\n# WRONG\ntrainer.fit(model, train_loader)\n\n# CORRECT\ntrainer.fit(model, train_loader, val_loader)\n```\n\n**Issue: DDP spawns multiple processes unexpectedly**\n\nLightning auto-detects GPUs. Explicitly set devices:\n```python\n# Test on CPU first\ntrainer = L.Trainer(accelerator='cpu', devices=1)\n\n# Then GPU\ntrainer = L.Trainer(accelerator='gpu', devices=1)\n```\n\n## Advanced topics\n\n**Callbacks**: See [references\u002Fcallbacks.md](references\u002Fcallbacks.md) for EarlyStopping, ModelCheckpoint, custom callbacks, and callback hooks.\n\n**Distributed strategies**: See [references\u002Fdistributed.md](references\u002Fdistributed.md) for DDP, FSDP, DeepSpeed ZeRO integration, multi-node setup.\n\n**Hyperparameter tuning**: See [references\u002Fhyperparameter-tuning.md](references\u002Fhyperparameter-tuning.md) for integration with Optuna, Ray Tune, and WandB sweeps.\n\n## Hardware requirements\n\n- **CPU**: Works (good for debugging)\n- **Single GPU**: Works\n- **Multi-GPU**: DDP (default), FSDP, or DeepSpeed\n- **Multi-node**: DDP, FSDP, DeepSpeed\n- **TPU**: Supported (8 cores)\n- **Apple MPS**: Supported\n\n**Precision options**:\n- FP32 (default)\n- FP16 (V100, older GPUs)\n- BF16 (A100\u002FH100, recommended)\n- FP8 (H100)\n\n## Resources\n\n- Docs: https:\u002F\u002Flightning.ai\u002Fdocs\u002Fpytorch\u002Fstable\u002F\n- GitHub: https:\u002F\u002Fgithub.com\u002FLightning-AI\u002Fpytorch-lightning ⭐ 29,000+\n- Version: 2.5.5+\n- Examples: https:\u002F\u002Fgithub.com\u002FLightning-AI\u002Fpytorch-lightning\u002Ftree\u002Fmaster\u002Fexamples\n- Discord: https:\u002F\u002Fdiscord.gg\u002Flightning-ai\n- Used by: Kaggle winners, research labs, production teams\n\n## Agent operating procedure\n\n1. **Check the environment.** Check GPU type, memory and driver\u002FCUDA versions (`nvidia-smi`), framework versions, and dataset location and size.\n2. **Pin down the inputs.** Confirm formats, identifiers and parameters from the data or the user. Ask rather than guess any value that changes the result.\n3. **Run a small version first.** Do a smoke run: tiny model or subset, few steps, and confirm loss decreases and checkpoints save.\n4. **Execute the full task** using the instructions and references above.\n5. **Validate the result.** Track metrics on held-out data, compare against a baseline, and record seeds, configs and hardware.\n6. **Report.** State what was run (versions, commands, parameters), what was checked, and what is still uncertain.\n\n| If this happens | Do this |\n|---|---|\n| CUDA out-of-memory | Reduce batch size, enable gradient accumulation\u002Fcheckpointing or mixed precision, or shard the model. |\n| Loss is NaN or diverges | Lower the learning rate, check data for invalid values, and enable gradient clipping. |\n| A function, flag or endpoint in these instructions is missing in the installed version | Check the installed version's own documentation (`help()`, `--help`, official docs), adapt, and tell the user. Never invent an API. |\n| A required input, identifier or parameter is ambiguous | Ask the user, or state the assumption explicitly before running. |\n\n**Integrity rules**\n\n- Never fabricate results, parameters, identifiers, citations or statistics. If something cannot be run or verified, say so plainly.\n- Never claim training results without logs; estimate compute cost before launching large jobs.\n- Treat version-specific details here as possibly outdated: confirm them against the official documentation for the installed version.\n- Ask before actions that cost money, consume shared GPUs or cloud quota, touch personal or patient data, or cannot be undone.\n\n## Related skills\n\n- `pytorch-lightning`: Organizes PyTorch training code with the lightning package (PyTorch Lightning): LightningModule, LightningDataModule, Trainer, callbacks su…\n- `ray-train`: Distributed training orchestration across clusters.\n- `huggingface-accelerate`: Wraps existing PyTorch training scripts with HuggingFace Accelerate (Accelerator class, accelerate config, accelerate launch) so the same c…\n",{"name":5,"license":15,"metadata":45,"description":7},{"tags":46,"version":47,"category":48,"maintainer":49,"dependencies":50},"PyTorch Lightning, Training Framework, Distributed Training, DDP, FSDP, DeepSpeed, High-Level API, Callbacks, Best Practices, Scalable","1.0.0","ml-training","Kalaris Labs","lightning, torch, transformers","main","2b63f856ce19c2a797929cacabd9e0fc936812fa","plugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fpytorch-lightning-distributed",490,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins","https:\u002F\u002Fhol.org\u002Fplugins\u002Fbest-codex-plugins","https:\u002F\u002Fgithub.com\u002Fhashgraph-online","https:\u002F\u002Fhol.org","Open-source standards and developer tools for interoperable AI agents: discovery, identity, communication, payments, privacy and security.","2026-11-14 02:12:02",{"source":8,"skillName":5,"commands":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add hashgraph-online\u002Fawesome-codex-plugins --skill pytorch-lightning-distributed",{"tool":67,"command":68},"bunx","bunx skills add hashgraph-online\u002Fawesome-codex-plugins --skill pytorch-lightning-distributed",{"tool":70,"command":71},"pnpm","pnpm dlx skills add hashgraph-online\u002Fawesome-codex-plugins --skill pytorch-lightning-distributed","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fpytorch-lightning-distributed\u002FSKILL.md",true,[75,81,85],{"path":76,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Fcallbacks.md","REFERENCE","参考文档",12031,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fpytorch-lightning-distributed\u002Freferences\u002Fcallbacks.md",{"path":82,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Fdistributed.md",10818,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fpytorch-lightning-distributed\u002Freferences\u002Fdistributed.md",{"path":86,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Fhyperparameter-tuning.md",12517,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fpytorch-lightning-distributed\u002Freferences\u002Fhyperparameter-tuning.md",[90,99,106,113,138,163],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":94,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":98},"01M746ZWACVKMZ1BJXJZHYJSSX","migrate-to-e2e","Moves an existing Playwright, Cypress, Selenium, Appium, Detox, Maestro, or TesterArmy suite to e2e one slice at a time, with the old suite running beside the new one until each ported test is proven. Keeps a MIGRATION.md progress file so any later session resumes where the last stopped. Optionally plants a defect to show both suites catch it. Use for \u002Fmigrate-to-e2e, \"migrate our tests to e2e\", \"port these Maestro flows\", \"move our TesterArmy tests\", or when a project has an e2e config and an older suite still running.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Ftester-army\u002Fe2e\u002Fskills\u002Fmigrate-to-e2e\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":94,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":98},"01M746ZPTAX1Q0FBKAB1CYND7E","e2e","Writes, runs, and debugs end-to-end tests for web and mobile apps with e2e, the agentic test runner, which mixes agent.act goals with exact locator assertions on a Playwright browser or an iOS or Android device. Also drives a project's running app live over the e2e MCP server to look at a screen, check a UI change, take a screenshot or record a video, and try a locator; and runs bug bashes, parallel e2e explore runs with each bug proven by a repro test. Use when a project depends on e2e or has an e2e.config.ts, when asked for end-to-end, browser, mobile, or agentic UI tests, to check a change in the running app, to QA or bug bash an app or branch, or when an e2e run fails.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Ftester-army\u002Fe2e\u002Fskills\u002Fe2e\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":94,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":98},"01M746ZJN784HVHMDP9MQGCSGG","create-verification-skill","Generate a project-local verify-\u003Capp> skill on top of e2e, so any coding agent can launch the app, check it is worth driving, exercise a feature the way a user does, keep evidence, and bug bash it. Writes the skill, a feature map with one explore charter per feature, and proves it once. Use for \u002Fcreate-verification-skill, \"make a verification skill for this repo\", or when a project has no scripted way to prove UI behavior.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Ftester-army\u002Fe2e\u002Fskills\u002Fcreate-verification-skill\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":94,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":40},"01M716A6ETNB9B1SQ3GXZC75VR","deja-search","deja-vu memory — search the user's past AI coding sessions with the deja CLI. Holds what they already settled and never wrote into the repo (naming rules, banned or already-tried tools, required checks before merge, preferred values, who owns what). Use before your first edit in a task, before you call a change done or ready to merge, before you recommend a tool, library, design or reviewer, before re-debugging an error that may already be solved, when they say 'didn't we fix this before', 'what did we decide about X' or 'I already have that', and before telling them something on this machine does not exist.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fvshulcz\u002Fdeja-vu\u002Fskills\u002Fdeja-search\u002FSKILL.md",[],[120,121,122,123,124,125,126,127,128,129,130,24,26,131,132,133,134,135,136,137],"search","deja search","never","error","ready","memory","re","decide","fix","design","debugging","done","reviewer","io","change","cli","merge","past",{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":94,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":40},"01M716A3J2W5SENSE9VGMXB375","deja-reflect","End-of-session reflection and memory curation with deja-vu. Review what was decided, what commands broke and what repaired them, and record durable project rules or decisions with deja remember so the next session starts with them.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fvshulcz\u002Fdeja-vu\u002Fskills\u002Fdeja-reflect\u002FSKILL.md",[],[145,146,147,133,148,149,150,151,152,153,154,155,156,157,125,158,159,160,161,162],"deja reflect","reflect","review","with","record","github","next","https","node","Rules","decisions","brew","remember","project rules","project","session","end","reflection",{"skillNo":164,"name":165,"nameZh":6,"description":166,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":94,"licenseFileUrl":6,"sourceHtmlUrl":167,"categories":168,"keywords":180,"publishedAt":40},"01M715T3RR4BAYSR57HPPTJ0PF","revid","Make, edit, export and post AI videos with Revid (revid.ai) through the Revid MCP server. Use whenever the user wants a short-form or long-form video made (from an idea, a script, a URL, an article, a PDF, a tweet, a product page, their own clips, or a song), wants to find what is going viral on TikTok, YouTube, Instagram or X before making something, wants to edit or re-export an existing Revid project, generate a standalone AI image or clip, make a series episode, or publish and schedule a finished video to connected social accounts. Covers setup (hosted MCP with OAuth, or an API key), the 36 tools, credits, polling and the rules for publishing. Routes to the more specific revid-* skills when one fits.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Ftmakersas\u002Frevid-skills\u002Fskills\u002Frevid\u002FSKILL.md",[169,174,177],{"categoryNo":170,"categoryName":171,"taxonomyType":172,"taxonomyTypeDesc":173},"01JBSEEDCAT000000000000016","图像与多媒体","SCENARIO","使用场景",{"categoryNo":175,"categoryName":176,"taxonomyType":172,"taxonomyTypeDesc":173},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":178,"categoryName":179,"taxonomyType":172,"taxonomyTypeDesc":173},"01JBSEEDCAT000000000000010","后端与接口",[165,181,182,183,184,185,186,159,187,126,188,189,190,191,24,192,193,194,35,195],"URL","Video","short-form","standalone","PDF","viral","tiktok","short","social","MCP","song","image","mcp server","schedule","publish"]