Views
No views yet
pip install -r requirements.txt1# Basic training (100 epochs, default parameters)
2python train.py
3
4# Custom training parameters
5python train.py --epochs 200 --batch-size 64 --lr 0.05 --plot
6
7# Resume from checkpoint
8python train.py --resume ./checkpoints/best_model.pth1from models.resnet import ResNet50
2
3# Create model for CIFAR-100 (100 classes)
4model = ResNet50(num_classes=100)
5
6# Forward pass
7import torch
8x = torch.randn(1, 3, 32, 32) # Batch of 1, 3 channels, 32x32 images
9output = model(x) # Shape: [1, 100]| Argument | Default | Description |
|---|---|---|
--epochs | 100 | Number of training epochs |
--batch-size | 128 | Batch size for training |
--lr | 0.1 | Learning rate |
--momentum | 0.9 | SGD momentum |
--weight-decay | 5e-4 | Weight decay for regularization |
--resume | "" | Path to checkpoint to resume from |
--save-dir | "./checkpoints" | Directory to save model checkpoints |
--plot | False | Generate training plots |
├── models/
│ ├── __init__.py
│ └── resnet.py # ResNet implementation
├── train.py # Training script
├── requirements.txt # Dependencies
└── README.md # This filecheckpoints/best_model.pth (highest test accuracy)checkpoints/checkpoint_epoch_X.pth (every 10 epochs)checkpoints/training_plots.png (if --plot flag used)