Run Locally: the Repository, Ollama and the Parts Colab Cannot Run
Everything in the lessons runs in Colab. This page is for three other things: running the lessons on your own computer, using Ollama, and the parts of the course that need real servers, containers or more hardware than a notebook has (Docker, Docker Compose, Kubernetes, an Airflow server, GitHub Actions, Triton, more than one GPU). It is the course's one "run locally" page.
Status. The Python pins on this page were read from PyPI and resolved together in a dry run on 24 October 2026 (Python 3.12, Linux, wheels only); see NOTES.md for what that check could and could not include. The Ollama facts were read on its library page that day. Docker, Compose, Kubernetes, Airflow, GitHub Actions, Triton, vLLM and multi-GPU runs were not run in the course; each lesson that uses them gives the exact commands from the official documentation on the day it is written, and says so.
1. Install
- Python 3.12 (3.13 also works) from python.org. Older than 3.12 will not work: the pinned numpy, xgboost and shap need 3.12. Check with
python --version(on some systemspython3 --version). - Git from git-scm.com. DVC (Module 5) and the run records (Module 6) use it.
- A code editor. VS Code with the Python and Jupyter extensions is a good choice; others work the same way.
- Docker Desktop (or Docker Engine with the Compose plugin) from docs.docker.com/get-docker, for Module 2 (the image), Module 9 (the service stack) and the capstone.
- Ollama, only for Modules 12 and 13, from ollama.com/download. Download the course's model once, in a terminal:
ollama pull llama3.2:3bThat is a download of about 2.0 GB (Ollama's library page, 24 October 2026).
2. Create the project folder
mkdir kestrel
cd kestrel
git init
python -m venv .venvSwitch the virtual environment on:
# macOS and Linux
source .venv/bin/activate
# Windows (PowerShell)
.venv\Scripts\Activate.ps1Create requirements.txt with the course's pins (the Module 1 lab writes the same file):
numpy==2.5.4
pandas==3.1.0
scipy==1.18.1
scikit-learn==1.9.1
lightgbm==4.7.0
xgboost==3.4.1
statsmodels==0.15.0
imbalanced-learn==0.14.2
umap-learn==0.5.12
torch==2.14.1
torchvision==0.29.1
lightning==2.6.6
transformers==5.20.2
huggingface-hub==2.3.0
datasets==5.1.0
peft==0.21.2
accelerate==1.15.0
mlflow==3.17.2
optuna==5.0.0
pandera==0.34.1
prefect==3.9.0
dvc==3.67.1
duckdb==2.0.0
pyarrow==25.0.1
fastavro==1.13.1
protobuf==7.36.2
onnx==1.23.2
onnxruntime==1.31.0
skl2onnx==1.20.0
onnxmltools==1.16.0
fastapi==0.150.0
httpx==0.28.1
uvicorn==0.54.0
pydantic==2.14.1
redis==8.1.0
fakeredis==2.40.0
evidently==0.7.23
shap==0.54.1
fairlearn==0.15.0
pytest==9.1.1
hypothesis==6.170.9
line-profiler==5.1.0
langchain==1.4.7
langchain-core==1.7.0
langchain-groq==1.1.3
langchain-google-genai==4.4.2
langchain-ollama==1.1.0
python-dotenv==1.2.4Then install:
pip install -r requirements.txtCode walkthrough
- Each line pins one library to the version the course used. Three are deliberately not the newest:
pyarrowstays below 26 because MLflow requires it,fastapistays below 0.151 because Prefect requires it, andhuggingface-hub2.3.0 is the newest and is accepted by transformers and datasets. - Feast and lifelines are left out: both require pandas below 3. Module 5 lesson 4 describes Feast and builds the join by hand; to try Feast, use its own environment (
pip install feast==0.67.0 pandas==2.3.3in a second virtual environment); Module 3 lesson 2's survival card does not need lifelines. - Every pin except dvc resolved together in a dry run on 24 October 2026; dvc depends on a package that ships only as source code, which pip builds on install. If pip reports a conflict on your system, keep the pins of the libraries the current module uses and let pip choose the rest.
3. Keys on your own computer (Modules 12 and 13 only)
Ollama needs no key. For Groq or Gemini, create a file named .env in the project folder:
GROQ_API_KEY=paste-your-key-here
GOOGLE_API_KEY=paste-your-key-hereand add these two lines at the very top of the setup cell:
from dotenv import load_dotenv
load_dotenv()Code walkthrough
load_dotenv()reads.envand puts each line into the environment, which is where LangChain looks for keys. The setup cell'sifblock then finds the key already set and skips the Colab-only part.
Never share .env or commit it to Git; the Module 1 lab puts it in .gitignore.
4. Run the lessons
Open the folder in your editor and create a notebook, for example module-03-lesson-1.ipynb. Select the .venv Python when asked. Paste each code block into a cell and run it, as in Colab. Skip the %pip install cells, because you installed the libraries already, and set PROVIDER = "ollama" in the setup cell if you are using Ollama. %%writefile cells work in Jupyter as in Colab. Lines starting with ! (such as !python -m pytest -q) work in a notebook; in a terminal, type the command without the !.
On a Mac, LightGBM and PyTorch together can crash with an OpenMP error, because each can bring its own copy of the OpenMP library (recorded in this series for FAISS and PyTorch; not yet seen with LightGBM). If it happens, set these in the terminal before starting Python or your editor:
export KMP_DUPLICATE_LIB_OK=TRUE
export OMP_NUM_THREADS=1The first tells OpenMP to accept the second copy; it is a workaround, not a fix. The second keeps it to one thread, which slows training but is fine for Kestrel's data.
5. Tools that need a server (not run in the course)
| Tool | Module | What the lesson gives | In Colab instead |
|---|---|---|---|
| MLflow tracking server and UI | 6, 10 | mlflow ui (the local web page) and a server with a database backend, from MLflow's docs | a local SQLite store (sqlite:///mlflow.db); runs read with the Python API |
| Prefect server UI | 5, 10 | prefect server start, from Prefect's docs | flows run in-process (the pilot confirms) |
| Airflow, Dagster | 5 | Airflow's and Dagster's local quick starts, described | Prefect |
| Spark, Kafka, dbt | 5 | local quick starts, described | DuckDB and pandas on the sample |
| Evidently UI | 11 | the local UI, from Evidently's docs | Evidently reports saved as HTML |
| lakeFS | 5 | described | DVC with a local remote |
Each lesson gives the commands from the official docs on the day it is written, and says they were not run.
6. Containers: Docker and Docker Compose (Modules 2, 9 and the capstone; not run in the course)
The Module 2 lesson writes a Dockerfile for the scoring service; the Module 9 lab writes a docker-compose.yml that starts what Colab replaces with in-process stand-ins:
| Service | Image (from the project's docs, tag checked when the lab is written) | Replaces in Colab |
|---|---|---|
api | built from the repository's Dockerfile (FastAPI under uvicorn, ONNX Runtime) | TestClient |
redis | the official Redis image | fakeredis |
mlflow | an MLflow server | the local SQLite store |
Start, check and stop it with:
docker compose up -d
docker compose ps
docker compose downCode walkthrough
docker compose up -dbuilds what needs building and starts every service in the background.docker compose pslists the services and whether each is running.docker compose downstops and removes them.
Until the Module 9 lab is written, this table is the plan, not a tested stack.
7. Kubernetes (Modules 2 and 9; not run in the course)
Module 2 lesson 2 explains what Kubernetes does; Module 9 lesson 2 explains autoscaling a scoring service on it. Both describe a local cluster with kind (Kubernetes in Docker) and give manifests, with commands from the official docs on the day they are written. Nothing in the course depends on a running cluster.
8. GitHub Actions (Modules 2 and 10; not run in the course)
The workflow files .github/workflows/ci.yml (Module 2) and .github/workflows/model-ci.yml (Module 10) run on GitHub, not in Colab or on your computer. Push the repository to GitHub and open the Actions tab to see them run. Run the same steps locally first with pytest -q and the gate script, so the workflow only repeats what already passed.
9. GPUs: one, several, and the serving stacks (Modules 7, 8, 9 and 12; not run in the course)
- One GPU: a free Colab T4 is enough for every GPU-optional path in the course (course-guide/02, section 2).
- Several GPUs: Module 7 lesson 2 runs DDP in two CPU processes in Colab, and gives the
torchruncommands for several GPUs and several machines from the PyTorch docs, not run. - Triton and TensorRT (Modules 8 and 9): NVIDIA's inference server and optimiser. Both need NVIDIA GPUs; TensorRT's PyPI page lists its licence as Proprietary. Described from NVIDIA's docs, not run.
- vLLM and SGLang (Module 12): serve open-weight language models on GPUs behind an OpenAI-compatible API. vLLM 0.32.0 (18 October 2026) and SGLang 0.5.22 (16 October 2026) are the versions on PyPI on 24 October 2026. Module 12 lesson 2 gives the serve command and a client call from each project's documentation, and says they were not run.
10. From notebook cells to a project
In a job you would not keep code in notebook cells. The course grows one repository, kestrel/, with the package kestrel/, plus pipelines/, service/, evals/, tests/, docs/, reports/ and artifacts/. The project page (03-kestrel.md) lists which module adds which file. By the capstone, make all in the repository rebuilds the data, the model, the benchmark and the reports from a commit.