MLOps#
Twiga ships a production layer that closes the loop between model development and real-world deployment. The four modules below form a coherent MLOps stack that mirrors Twiga’s config-driven, Pydantic-first design principles.
Modules#
Installation#
Install the full MLOps stack with a single extra:
pip install twiga[mlops]
This pulls in MLflow, FastAPI, uvicorn, Evidently, and Prefect.
At a glance#
Module |
Class / function |
Responsibility |
|---|---|---|
|
|
MLflow experiment tracking |
|
|
Persist model + pipeline with versioned manifest |
|
|
Restore model + pipeline from checkpoint |
|
|
FastAPI REST API factory |
|
|
Checkpoint to forecaster loader |
|
|
Evidently drift & performance reports |
|
|
Prefect training orchestration |
|
|
Drift-triggered retraining |
twiga.mlops core API#
A small, Streamlit-free layer for workspace orchestration, dataset
transforms, storage, capture-data access, and the training model registry. Any
script or service can import it directly — from twiga.mlops import workspace
needs no Streamlit runtime.
Module |
Class / function |
Responsibility |
|---|---|---|
|
|
Create / load / reconfigure workspaces; returns data, no session state |
|
|
Pure dataset parsing, splitting, and config construction |
|
|
SQLite registry of workspaces (thread-safe writes) |
|
|
Per-workspace filesystem layout (dataset, mlruns, checkpoints, reports) |
|
|
Read and join captured production traffic; batch drift/performance |
|
|
Convenience wrappers over the MLflow tracking store |
|
|
Lazy model registry + per-run config construction |
|
|
Catalog DB / workspace root locations (override via |
Note
The multi-page Streamlit dashboard that drives this layer lives in
examples/mlops/ and is not shipped in the installed wheel — it is a
demo, like the notebooks under examples/tutorials/. Run it from a checkout:
pip install "twiga[mlops]" streamlit
cd examples/mlops
streamlit run app.py