pytorch-training
What it does
The skill gives best practices for building reliable PyTorch training code. It is for developers writing or checking machine learning training scripts.
When to use it
- ✓When you write or review a PyTorch training loop.
- ✓When you want training runs to be reproducible and to keep the best model checkpoint.
- ✓When you need early stopping, a learning rate schedule, or efficient evaluation in PyTorch.
Skill link
https://github.com/aiming-lab/AutoResearchClaw/blob/main/researchclaw/skills/builtin/tooling/pytorch-training/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Review my PyTorch training script and make it reproducible, with early stopping and a learning rate schedule.”
5 new skills a week. 1 minute to read.
How it works
The agent checks the training code against a list of practices, such as fixed seeds, a data loader with workers and pinned memory, a learning rate scheduler, early stopping on a validation metric, and saving the best model.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
PyTorch Training Best Practice
- Use torch.manual_seed() for reproducibility (set for torch, numpy, random)
- Use DataLoader with num_workers>0 and pin_memory=True for GPU
- Enable cudnn.benchmark=True for fixed input sizes
- Use learning rate schedulers (CosineAnnealingLR or OneCycleLR)
- Implement early stopping based on validation metric
- Log metrics every epoch, save best model checkpoint
- Use torch.no_grad() for evaluation
- Clear gradients with optimizer.zero_grad(set_to_none=True) for efficiency
FAQ
What does reproducible mean here?
Fixing the random seeds for PyTorch, NumPy, and Python so that repeated runs give the same results.
Which learning rate schedules does it mention?
CosineAnnealingLR and OneCycleLR.
Does it cover evaluation code?
Yes. It advises using no-gradient mode during evaluation and clearing gradients efficiently.
Details
Original description by the author
Best practices for building robust PyTorch training loops. Use when generating or reviewing ML training code.
Popularity
- GitHub stars
- 15k
- Ranking position
- #11077
- License
- MIT
- Updated
- 8/19/2026
Comments
- …
More skills from this repository
a-evolve
15kHelps your agent improve over repeated runs by diagnosing failures, creating targeted skills from error patterns, and recording lessons for later use.
biology-biopython
15kHelps your agent work with DNA, RNA, and protein sequences using Biopython, including file parsing, sequence calculations, BLAST searches, and database access.
chemistry-rdkit
15kHelps your agent analyze molecules written as SMILES strings with RDKit, including descriptors, fingerprints, similarity, and substructure search.
hypothesis-formulation
15kHelps your agent turn an observation into testable hypotheses, with competing explanations and clear predictions that could prove them wrong.
Similar skills
pytorch-patterns
280kHelps your agent use PyTorch for machine learning models. It applies best practices for efficient model training and ensures reproducible results.
evm-token-decimals
280kHelps your agent avoid errors with decimal numbers across different blockchain networks. It ensures token values are accurate in transactions and calculations.
ito-inference
280kLets your agent check the availability of AI models for use. It connects the compute request with the ready model service.