Starter template for your Machine Learning/AI projects.
Features:
dvcfor data versioning and pipeline management (reproducibility)FastAPIfor serving the modeluvpackage managerrufffor linting and formattingpytestfor testinglogurufor loggingDockerfor containerization
Make sure you have uv installed.
Clone the repository:
git clone git@github.com:mlexpertio/ml-project-template.git .
cd ml-project-templateInstall Python:
uv python install 3.12.8Create and activate a virtual environment:
uv venv
source .venv/bin/activateInstall dependencies:
uv syncInstall package in editable mode:
uv pip install -e .Install pre-commit hooks:
uv run pre-commit installThe 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 evaluateStart the FastAPI server:
uv run python app.pyTest the API:
curl -X POST "http://localhost:8000/predict" \
-H "Content-Type: application/json" \
-d '{"text": "lets launch now"}'uv run pytestThe 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