
Modern ML Cookiecutter
July 29, 2025
Featured
python machine-learning cookiecutter template nlp speech vision pytorch transformers
π A modality-aware, end-to-end template for modern machine learning projects covering NLP, Speech, and Vision with best-in-class models and researcher-friendly configuration.
β¨ Features
- π― Multi-Modal Support: Choose from NLP (DistilBERT), Speech (Whisper), or Vision (ViT) with optimized configurations
- β‘ Fast Dependency Management: Uses uv for lightning-fast package management
- π§ ML-Centric Configuration: Researcher-friendly parameter names (
epochs
notnum_train_epochs
) - π₯οΈ Mac MPS Support: Optimized for Apple Silicon with Metal Performance Shaders
- βοΈ Local & Cloud Training: Seamless training with Hugging Face Accelerate locally or SkyPilot in the cloud
- π Production-Ready Serving: High-performance model serving with LitServe
- π Experiment Tracking: Optional integration with tracelet
- π§ Type-Safe Configuration: Pydantic-based settings with modality-aware validation
π― Supported Modalities
Modality | Task | Model | Dataset | Key Libraries |
---|---|---|---|---|
NLP | Text Classification | DistilBERT | IMDB | transformers, datasets |
Speech | ASR (Speech-to-Text) | Whisper | Common Voice | transformers, librosa, torchaudio |
Speech | TTS (Text-to-Speech) | CSM (Sesame) | Conversational | transformers, CSM |
Vision | Image Classification | Vision Transformer | CIFAR-10 | torchvision, PIL, opencv |
π Quick Start
Generate a new project with a single command:
# Using cruft (recommended for template updates)
uvx cruft create https://github.com/prassanna-ravishankar/cookiecutter-modern-ml
# Using cookiecutter directly
cookiecutter https://github.com/prassanna-ravishankar/cookiecutter-modern-ml
Choose your modality (NLP, Speech, Vision) and start training with uv run task train
.
π§ Whatβs Included
Pre-configured Tools
- uv: Ultra-fast Python package management
- Transformers: State-of-the-art models for all modalities
- Accelerate: Multi-device training (CUDA/MPS/CPU)
- LitServe: High-performance model serving
- Polars: Fast data processing (not pandas)
- Pydantic: Type-safe configuration management
- Ruff: Fast Python linter and formatter
- Pytest: Testing framework
Design Philosophy
- Simplicity over Features: Avoid over-engineering, focus on researcher needs
- ML-Centric: Parameter names and structure match ML research conventions
- Modality-Aware: Each domain (NLP/Speech/Vision) has optimized defaults
- Modern Tooling: Latest best practices (uv, Polars, LitServe, Pydantic)
- Mac-First: Optimized for Apple Silicon development
The template automatically optimizes for your hardware (Mac MPS, CUDA, or CPU) and includes cloud training support with SkyPilot for easy scaling to production workloads.