This repository contains the complete implementation of a simple Convolutional Neural Network (CNN) for MNIST digit classification with a complete CI/CD pipeline using GitHub Actions.
graph LR
A[Data Preparation] --> B[Training]
B --> C[Model Evaluation]
C --> D[Model Artifacts]
D --> E[GitHub Actions Pipeline]
- Model Type: CNN
- First Conv Layer : 1 in_channel, 4 out_channel, 3x3 kernels, padding=1
- Second Conv Layer : 6 channels, 3x3 kernels, padding=1
- Maxpooling Layer that reduces the dimesnion to 7x7x8
- First Fully Connected Layer : 392 --> 16
- Second Fully Connected Layer : 16 --> 10
- ReLU activations are used throughout
torch>=2.0.0 torchvision>=0.15.0 numpy>=1.24.0 pandas>=2.0.0 scikit-learn>=1.2.0 matplotlib>=3.7.0
- Clone the repository
git clone [your-repo-url]
cd [repo-name]- Install dependencies
pip install -r requirements.txt
Run the training script:
python src/train.py
Training parameters can be configured in config.yaml:
- Batch size: 32
- Learning rate: 0.001
- Epochs: 10
Execute tests:
python src/test.py
The ML pipeline is automated using GitHub Actions and consists of the following steps:
-
Setup Environment
- Checkout code
- Setup Python
- Install dependencies
-
Training
- Load and preprocess data
- Train model
- Save model artifacts
-
Testing
- Run unit tests
- Validate model performance
- Generate metrics
-
Artifact Management
- Save trained model
- Store evaluation metrics
- Upload artifacts
name: ML Training Pipeline on: [push] jobs: train: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 - name: Install dependencies run: pip install -r requirements.txt - name: Train model run: python src/train.py - name: Test model run: python src/test.py
├── .github/
│ └── workflows/
│ └── ml-pipeline.yml
├── src/
│ ├── train.py
│ ├── test.py
│ └── utils.py
├── data/
│ ├── raw/
│ └── processed/
├── models/
│ └── saved_models/
├── config.yaml
├── requirements.txt
└── README.md