pytorch-lightning

pytorch-lightning is a skill for Claude Code from ualberta-rcg/drac-agent-skills. It costs 72 tokens per session (1,627 once invoked), scanned A, original, MIT.

A framework for organising PyTorch machine-learning code into reusable training, data, and evaluation components. PyTorch is a Python library for building and training neural networks; this framework also describes multi-GPU and multi-computer training setups.

In plain words
What is it for?
Use it to define neural-network training modules, data modules, callbacks, metric logging, and distributed training across GPUs or cluster nodes.
Why use it?
It reduces repeated training-loop and experiment setup code while leaving the underlying PyTorch model available for direct control. It also provides a consistent structure for running training jobs on Slurm clusters.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the community-science plugin — 10 skills shipped together

Good fit Use it to define neural-network training modules, data modules, callbacks, metric logging, and distributed training across GPUs or cluster nodes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ualberta-rcg/drac-agent-skills/pytorch-lightning
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ualberta-rcg/drac-agent-skills --skill pytorch-lightning
Clone the repo
git clone --depth 1 https://github.com/ualberta-rcg/drac-agent-skills

Made for: Claude Code.

Or install community-science, the plugin that ships this one along with the rest of its 10 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pytorch-lightning

README.md
[![agentmods](https://agentmods.dev/badge/skills/ualberta-rcg/drac-agent-skills/pytorch-lightning/github.svg)](https://agentmods.dev/skills/ualberta-rcg/drac-agent-skills/pytorch-lightning)
Your own site
<a href="https://agentmods.dev/skills/ualberta-rcg/drac-agent-skills/pytorch-lightning"><img src="https://agentmods.dev/badge/skills/ualberta-rcg/drac-agent-skills/pytorch-lightning/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pytorch-lightning

Your own site · 80×15
<a href="https://agentmods.dev/skills/ualberta-rcg/drac-agent-skills/pytorch-lightning"><img src="https://agentmods.dev/badge/skills/ualberta-rcg/drac-agent-skills/pytorch-lightning.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,627 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00072 $0.01627
Opus 5.5 $0.00029 $0.00651
Sonnet 5.5 $0.00014 $0.00325
Haiku 4.5 $0.00007 $0.00163

Measured 6d ago against content hash 9ccb80152e51, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pytorch-lightning scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

community-skills/skills/pytorch-lightning/SKILL.md · 132 lines

How it starts

The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PyTorch Lightning

Organize PyTorch training, evaluation, and multi-GPU/multi-node scaling without boilerplate while preserving full PyTorch control. Use import lightning as L from the lightning package (do not mix lightning and pytorch_lightning class namespaces in the same project).

Installation

# Alliance / CVMFS wheelhouse (inside a Slurm job or salloc venv on $SCRATCH)
pip install --no-index lightning torchmetrics
# Standard Python venv
pip install "lightning==2.6.6" torchmetrics

Core Architecture

1. LightningModule — Model & Optimization Contract

import lightning as L
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchmetrics.classification import BinaryAUROC


class ClassifierModule(L.LightningModule):
    def __init__(self, in_features: int, hidden_dim: int = 128, lr: float = 1e-3):
        super().__init__()
        self.save_hyperparameters()
        self.net = nn.Sequential(
            nn.Linear(in_features, hidden_dim),
            nn.GELU(),
            nn.Linear(hidden_dim, 1),
        )
        self.val_auroc = BinaryAUROC()

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        return self.net(x).squeeze(-1)

    def training_step(self, batch, batch_idx):
        x, y = batch
        logits = self(x)
        loss = F.binary_cross_entropy_with_logits(logits, y.float())
        self.log("train/loss", loss, prog_bar=True, on_step=True, on_epoch=True)
        return loss

    def validation_step(self, batch, batch_idx):
        x, y = batch
        logits = self(x)
        loss = F.binary_cross_entropy_with_logits(logits, y.float())
        self.val_auroc.update(torch.sigmoid(logits), y.int())
        # sync_dist=True reduces scalar losses across DDP ranks; TorchMetrics syncs its own state.
        self.log("val/loss", loss, prog_bar=True, sync_dist=True)
        self.log("val/auroc", self.val_auroc, prog_bar=True, on_epoch=True)

    def configure_optimizers(self):
        optimizer = torch.optim.AdamW(self.parameters(), lr=self.hparams.lr, weight_decay=1e-2)
        scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer, T_max=self.trainer.estimated_stepping_batches)
        return {"optimizer": optimizer, "lr_scheduler": {"scheduler": scheduler, "interval": "step"}}

Read the full file on GitHub · 132 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 132 lines · 72 tokens per session scan A 9ccb80152e51

Subscribe to this mod's changes

pytorch-lightning is a skill published in the GitHub repository ualberta-rcg/drac-agent-skills (2 stars, last pushed 7d ago), licensed MIT. It adds 72 tokens to every session and 1,627 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-25.

Related

pytorch-lightning compared with skills from other repositories

pytorch-lightning next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
pytorch-lightningualberta-rcg/drac-agent-skillsSkill27d agoMITA72Claude Code
pytorch-patternsaffaan-m/ECCSkill314kyesterdayMITA32Claude Code, Kiro
optimize-for-gpuK-Dense-AI/scientific-agent-skillsSkill59kyesterdayMITA151Claude Code, Codex
accelerateNousResearch/hermes-agentSkill267ktodayMITA13Claude Code, Codex
developing-genkit-pythongoogle/skillsSkill25ktodayApache-2.0A96Claude Code, Codex
marimo-pairmarimo-team/marimoSkill24ktodayApache-2.0A57Claude Code, Codex
cudnn-installNVIDIA/skillsSkill4.2ktodayApache-2.0A49Claude Code, Codex