What problem does it solve?
This Skill helps you avoid common PyTorch failures (non-reproducible results, device-specific bugs, shape mistakes, broken training/eval behavior, and fragile checkpointing) by standardizing correct patterns for real training pipelines.
Core Features & Use Cases
- Device-agnostic development: Ensures your models and tensors move correctly across CPU/GPU without hardcoding
.cuda() or device assumptions.
- Reproducibility controls: Provides a complete seeding approach to make experiments repeatable.
- Correct model & training structure: Guides clean
nn.Module design, explicit tensor shape management, and safe train/eval switching.
- Production-minded training loops: Covers mixed precision (AMP), gradient clipping, and efficient validation with
torch.no_grad() and model.eval().
- Efficient data pipelines & checkpointing: Shows custom
Dataset/collate_fn patterns, optimized DataLoader settings, and resumable checkpoints with optimizer state.
Quick Start
Use the pytorch-patterns skill to review or rewrite a PyTorch training script so it uses device-agnostic code, reproducible seeding, correct train/eval modes, efficient data loading, and resumable checkpoints.