A professional showcase project demonstrating ML/MLOps skills with a unified CI/CD pipeline for multiple model types.
# Start monitoring stack
make monitoring-up
# Access services
open http://localhost:8000/docs # API documentation
open http://localhost:9090 # Prometheus
open http://localhost:3000 # Grafana (admin/admin)
# Generate test traffic
python scripts/generate_traffic.pyML API (FastAPI)
β /metrics
Prometheus (scraping)
β queries
Grafana (dashboards)
See Monitoring Guide for details.
This project demonstrates:
- β Unified ML Framework: Abstract base class for consistent model handling
- β
Two Model Types:
- CNN Classifier (MNIST, ~50K parameters)
- RAG System (ChromaDB + Claude)
- β Complete CI/CD Pipeline: Automated testing, validation, and deployment
- β Code Quality: Black, Flake8, MyPy, pytest with >80% coverage
- β Containerization: Multi-stage Docker builds
- β Performance Monitoring: Automated benchmarks and thresholds
Perfect for: Showcasing MLOps skills in job applications for ML Engineer / MLOps roles.
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β BaseMLModel (Abstract) β
β - train() - predict() - evaluate() β
β - save() - load() - get_metrics() β
ββββββββββββββββ¬βββββββββββββββββββββββ¬ββββββββββββ
β β
βββββββββΌβββββββββ βββββββββΌβββββββββββ
β CNNClassifier β β RAGSystem β
β β β β
β β’ TinyConvNet β β β’ SentenceT5 β
β β’ MNIST β β β’ ChromaDB β
β β’ PyTorch β β β’ Claude API β
ββββββββββββββββββ ββββββββββββββββββββ
Unified Interface β Both models implement the same abstract base class, allowing the CI/CD pipeline to handle them identically.
- Python 3.10+
- Anthropic API key (for RAG system)
# Clone repository
git clone https://github.com/ChengYuChuan/ml-cicd-showcase.git
cd ml-cicd-showcase
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# For development
pip install -r requirements-dev.txt
# Set up API key
echo "ANTHROPIC_API_KEY=your_key_here" > .env# Run all tests
pytest tests/ -v
# Run specific model tests
pytest tests/test_cnn.py -v
pytest tests/test_rag.py -v
# Run with coverage
pytest tests/ --cov=src --cov-report=htmlfrom src.models.cnn_classifier import CNNClassifier
from src.config import CNNConfig
# Configure and train
config = CNNConfig(num_epochs=3, batch_size=64)
model = CNNClassifier(config)
# Train on MNIST
metrics = model.train()
print(f"Accuracy: {metrics['accuracy']:.4f}")
# Save model
model.save_model("models/cnn_mnist.pth")
# Make predictions
import torch
sample = torch.randn(1, 1, 28, 28)
prediction = model.predict(sample)from src.models.rag_system import RAGSystem
from src.config import RAGConfig
# Initialize RAG
config = RAGConfig()
rag = RAGSystem(config)
# Ingest documents
documents = [
"Python is a programming language.",
"Machine learning uses data to improve.",
]
rag.ingest_documents(documents)
# Query the system
result = rag.predict("What is Python?")
print(f"Answer: {result['answer']}")
print(f"Context: {result['context']}")tests/
βββ conftest.py # Shared fixtures
βββ test_cnn.py # CNN-specific tests
βββ test_rag.py # RAG-specific tests
βββ test_integration.py # Cross-model tests
# All tests
pytest tests/ -v
# Specific test file
pytest tests/test_cnn.py -v
# With coverage
pytest tests/ --cov=src --cov-report=term-missing
# Skip slow tests
pytest tests/ -m "not slow"
# Run only fast tests in CI
pytest tests/ -m "not slow" --maxfail=1-
Code Quality (< 2 min)
- Black formatting
- Flake8 linting
- MyPy type checking
- isort import sorting
-
CNN Tests (< 5 min)
- Unit tests
- Training validation
- Performance thresholds (>85% accuracy)
-
RAG Tests (< 3 min)
- Unit tests
- Retrieval quality validation
- API integration tests
-
Integration Tests (< 5 min)
- Cross-model compatibility
- End-to-end workflows
- Coverage report generation
-
Docker Build (< 3 min)
- Multi-stage build
- Image testing
- Artifact upload
-
Benchmarks (< 5 min)
- Performance metrics
- Latency measurements
- Model size validation
| Model | Metric | Threshold | Current |
|---|---|---|---|
| CNN | Accuracy | >85% | ~95% |
| CNN | Latency | <100ms | ~15ms |
| CNN | Size | <1MB | ~0.2MB |
| RAG | Precision | >30% | ~60% |
| RAG | Latency | <5s | ~2s |
# Build all stages
docker-compose build
# Development environment
docker-compose run ml-dev
# Run tests in Docker
docker-compose run ml-test
# Production deployment
docker-compose up ml-prod# Build image
docker build -t ml-cicd-showcase .
# Run tests
docker run --rm ml-cicd-showcase pytest tests/ -v
# Interactive shell
docker run -it --rm ml-cicd-showcase /bin/bash- Architecture: TinyConvNet (~50K parameters)
- Dataset: MNIST (60K train, 10K test)
- Training Time: ~3 min (3 epochs, CPU)
- Test Accuracy: ~95%
- Inference: ~15ms per image
- Model Size: 0.2MB
- Embedding: all-MiniLM-L6-v2 (80MB)
- Vector DB: ChromaDB (local)
- LLM: Claude Sonnet 4
- Retrieval: ~30ms per query
- Generation: ~2s per answer
- Precision: ~60% on test queries
ml-cicd-showcase/
βββ .github/
β βββ workflows/
β βββ ci.yml # CI/CD pipeline
βββ src/
β βββ models/
β β βββ base_model.py # Abstract base class
β β βββ cnn_classifier.py # CNN implementation
β β βββ rag_system.py # RAG implementation
β βββ utils/
β β βββ metrics.py # Utility functions
β βββ config.py # Configuration management
βββ tests/
β βββ conftest.py # pytest fixtures
β βββ test_cnn.py # CNN tests
β βββ test_rag.py # RAG tests
β βββ test_integration.py # Integration tests
βββ data/
β βββ sample_images/ # Sample data
β βββ knowledge_base/ # RAG documents
βββ models/ # Saved models
βββ docker/
β βββ Dockerfile
β βββ docker-compose.yml
βββ pyproject.toml # Modern Python config
βββ requirements.txt # Core dependencies
βββ requirements-dev.txt # Dev dependencies
βββ README.md
Why: Different model types (CNN vs RAG) can use the same CI/CD pipeline
How: Abstract BaseMLModel class with standardized methods
Benefit: Easy to add new models without changing infrastructure
Why: GitHub Actions has limited compute and time How: TinyConvNet (<50K params) instead of ResNet18 (11M params) Benefit: Tests complete in <5 minutes instead of >30 minutes
Why: Different environments need different settings How: Dataclass-based configs (CNNConfig, RAGConfig) Benefit: Type-safe, easy to test, environment-specific
Why: Catch bugs before deployment How: Unit, integration, and performance tests with >80% coverage Benefit: Confidence in code quality and model performance
pre-commit install
pre-commit run --all-files# Format code
black src/ tests/
isort src/ tests/
# Check formatting
black --check src/ tests/
flake8 src/ tests/
mypy src/- Create new model class inheriting from
BaseMLModel - Implement required methods:
train(),predict(),evaluate() - Add configuration dataclass in
config.py - Create test file in
tests/ - Pipeline automatically handles it! π
- Add DVC for data/model versioning
- Implement model registry (MLflow)
- Add more model types (transformer, GNN)
- Set up automated deployment
- Add performance monitoring dashboard
- Implement A/B testing framework
This is a showcase project for job applications. If you'd like to suggest improvements:
- Fork the repository
- Create a feature branch
- Make your changes
- Ensure tests pass
- Submit a pull request
MIT License - see LICENSE file for details.
Your Name
- GitHub: @ChengYuChuan
- LinkedIn: ChengYuChuan
- Email: ChengYuChuan82@gmail.com
This project demonstrates:
β MLOps Best Practices: CI/CD, testing, containerization, monitoring β Software Engineering: Clean code, design patterns, type hints, documentation β ML Knowledge: Model selection, training, evaluation, optimization β Production Ready: Error handling, logging, performance monitoring β Modern Tools: GitHub Actions, Docker, pytest, type hints, pre-commit hooks
Time Investment: ~1 week (as planned) β Lines of Code: ~2000+ (production quality) Test Coverage: >80% Documentation: Comprehensive
Tech Stack:
- Languages: Python 3.10
- ML Frameworks: PyTorch, Sentence Transformers
- Vector DB: ChromaDB
- LLM: Claude (Anthropic)
- Testing: pytest, pytest-cov
- CI/CD: GitHub Actions
- Containerization: Docker, docker-compose
- Code Quality: Black, Flake8, MyPy, isort, pre-commit
Questions? Feel free to reach out or open an issue!