Skip to main content
Get your first ML model trained and deployed quickly with this hands-on quickstart guide.

Prerequisites

Before you begin, ensure you have:
  • Python 3.10 or higher installed
  • Git installed on your system
  • Basic familiarity with command line operations
  • (Optional) Docker Desktop for containerization examples

Step 1: Clone the Repository

Clone the ML in Production Practice repository to your local machine:
git clone https://github.com/kyryl-opens-ml/ml-in-production-practice.git
cd ml-in-production-practice
The repository contains 8 self-contained modules. Each module has its own dependencies and can be explored independently.

Step 2: Set Up Your First Example

Let’s start with Module 3’s classic NLP example - a sentiment classification model using BERT.
1

Navigate to the classic example

cd module-3/classic-example
2

Create a virtual environment

python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
3

Install dependencies

pip install -r requirements.txt
This installs the necessary packages including transformers, datasets, accelerate, and wandb for experiment tracking.

Step 3: Download and Prepare Data

Load the SST-2 dataset (Stanford Sentiment Treebank) for sentiment analysis:
python -m classic_example.cli load-sst2-data --path-to-save ./data
This downloads and prepares the training and validation datasets in CSV format.
The SST-2 dataset contains movie reviews labeled as positive or negative, making it perfect for learning text classification.

Step 4: Train Your First Model

Train a BERT-based sentiment classifier with the pre-configured settings:
python -m classic_example.cli train --config-path ./conf/example.json
The training script will:
  • Load the pre-trained BERT model from Hugging Face
  • Fine-tune it on the SST-2 dataset
  • Save the trained model to the results/ directory
  • Generate training metrics and evaluation results
Training requires a GPU for reasonable performance. On a CPU, consider reducing the number of training samples in the config file.

Step 5: Run Inference

Test your trained model on new data:
python -m classic_example.cli run-inference-on-dataframe \
  --df-path ./data/test.csv \
  --model-load-path ./results \
  --result-path ./predictions.csv
Your predictions will be saved to predictions.csv with probability scores for each class.

Step 6: Serve Your Model

Deploy your model as a REST API using FastAPI:
1

Navigate to the serving module

cd ../../module-5/serving
2

Install serving dependencies

pip install -r ../requirements.txt
3

Start the FastAPI server

uvicorn fast_api:app --host 0.0.0.0 --port 8080
Your API will be available at http://localhost:8080
4

Test the API endpoint

curl -X POST "http://localhost:8080/predict" \
  -H "Content-Type: application/json" \
  -d '{"text": ["This movie is amazing!", "I did not enjoy this film."]}'
Expected response:
{
  "probs": [
    [0.05, 0.95],
    [0.85, 0.15]
  ]
}

What’s Next?

You’ve successfully trained and deployed your first ML model! Here’s what to explore next:

Environment Setup

Configure virtual environments, dependencies, and development tools

Module 1: Infrastructure

Learn Docker, Kubernetes, and CI/CD for ML systems

Module 4: Orchestration

Build ML pipelines with Airflow, Kubeflow, and Dagster

Module 7: Monitoring

Set up observability and data drift monitoring

Quick Tips

The examples integrate with W&B for logging metrics and artifacts:
export WANDB_PROJECT=ml-in-production-practice
export WANDB_API_KEY=your_api_key_here
Sign up for free at wandb.ai to track your experiments.
Deploy training jobs to Modal for GPU access:
pip install modal
modal token new
modal run run_training_job.py
This runs your training job on cloud GPUs without managing infrastructure.
Format and check code style across the repository:
ruff format .
ruff check .
Run tests with pytest:
pytest tests/

Getting Help

Discord Community

Ask questions and connect with other learners

Report an Issue

Found a bug or have a suggestion?

Course Page

Access the full course curriculum

DeepWiki

Community-maintained summaries of each module

Build docs developers (and LLMs) love