
Pytorch Training
Best practices for building robust PyTorch training loops.
Install
npx skills add aiming-lab/AutoResearchClaw --skill pytorch-training -g -a claude-code -y- Repository
- aiming-lab/AutoResearchClaw14.8k
- Category
- Data and ML
- Updated
- 3mo ago
- License
- MIT
- Context cost
- Lightabout 130 tokens
- Runs scripts
- No, instructions only
What it does
Best practices for building robust PyTorch training loops. Use when generating or reviewing ML training code.
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
