Starter template for your Machine Learning/AI projects.
Features:
dvc
for data versioning and pipeline management (reproducibility)FastAPI
for serving the modeluv
package managerruff
for linting and formattingpytest
for testingloguru
for loggingDocker
for containerization
Make sure you have uv
installed.
Clone the repository:
git clone git@github.com:mlexpertio/ml-project-template.git .
cd ml-project-template
Install Python:
uv python install 3.12.8
Create and activate a virtual environment:
uv venv
source .venv/bin/activate
Install dependencies:
uv sync
Install package in editable mode:
uv pip install -e .
Install pre-commit hooks:
uv run pre-commit install
The project contains three different stages defined in dvc.yaml
.
- Create a dataset from the raw data:
uv run dvc repro build-dataset
- Train a model using the dataset:
uv run dvc repro train-model
- Evaluate the model using the test dataset:
uv run dvc repro evaluate
Start the FastAPI server:
uv run python app.py
Test the API:
curl -X POST "http://localhost:8000/predict" \
-H "Content-Type: application/json" \
-d '{"text": "lets launch now"}'
uv run pytest
The template includes a Dockerfile
to build a Docker image:
docker build -t prophet:latest .
Run the Docker container:
docker run -d -p 8000:8000 --name prophet prophet:latest