Skip to content

Commit f32680e

Browse files
Merge pull request #2 from Sebastijan-Dominis/inference-and-monitoring
The main contribution are the two new pipelines - infer.py and monitor.py. The two pipelines enable model inference and monitoring, which now completes the model lifecycle. In writing these, some related and unrelated bugs were discovered as well. This branch includes many bug fixes, updated documentation, added tests, and some data and artifacts, so that the user can view expected outputs of relevant pipelines immediately, without running anything. Main README.md has been updated as well, and includes some new gifs.
2 parents b82fe24 + fc1e6a2 commit f32680e

718 files changed

Lines changed: 84061 additions & 57304 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ coverage.json
5050
*.py.cover
5151
.hypothesis/
5252
.pytest_cache/
53-
cover/
53+
/cover/
5454

5555
# Translations
5656
*.mo
5757
*.pot
5858

5959
# Django stuff:
60-
*.log
60+
# *.log
6161
local_settings.py
6262
db.sqlite3
6363
db.sqlite3-journal
6464

6565
# Flask stuff:
66-
instance/
66+
/instance/
6767
.webassets-cache
6868

6969
# Scrapy stuff:
@@ -74,7 +74,7 @@ docs/_build/
7474

7575
# PyBuilder
7676
.pybuilder/
77-
target/
77+
/target/
7878

7979
# Jupyter Notebook
8080
.ipynb_checkpoints
@@ -139,9 +139,9 @@ celerybeat.pid
139139
.env
140140
.envrc
141141
.venv
142-
env/
142+
/env/
143143
venv/
144-
ENV/
144+
/ENV/
145145
env.bak/
146146
venv.bak/
147147

@@ -212,16 +212,22 @@ __marimo__/
212212
.history/
213213

214214
# CatBoost model snapshot files
215-
catboost_info/
215+
/catboost_info/
216216

217217
# VSCodeCounter cache
218218
.vscodecounter/
219219

220220
# Failure management folder that helps deal with failed search and train runs by storing relevant information at runtime (best params from each search, training model snapshots) and deleting if the run is successful. Irrelevant for version control.
221221
/failure_management/
222222

223-
# Temporarily ignore all experiments, data, feature sets, and model registry files. These are all relevant for version control, but we want to temporarily ignore them while we work on the registry and experiment tracking features.
223+
# Ignore all experiments, data, feature sets, model registry & archive, predictions, and monitoring files, as well as log files.
224+
# These are all potentially relevant for version control, but we want to temporarily ignore them while we work
225+
# on the registry and experiment tracking features.
224226
/experiments/
225227
/data/
226228
/feature_store/
227-
/model_registry/
229+
/model_registry/
230+
/predictions/
231+
/monitoring/
232+
/orchestration_logs/
233+
/scripts_logs/

Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# For faster development iterations, consider using a local Conda environment on your machine with the
66
# same environment.yml file.
77

8-
# ===== Base image with GPU support =====
8+
# Base image with GPU support
99
FROM pytorch/pytorch:2.10.0-cuda12.8-cudnn9-runtime
1010
# NOTE: Uncomment the line below and comment out the line above only if you want to generate fake data.
1111
# For regular use, stick to the current image. If you use the image below, make sure to also uncomment
@@ -14,14 +14,14 @@ FROM pytorch/pytorch:2.10.0-cuda12.8-cudnn9-runtime
1414

1515
# FROM nvidia/cuda:12.8.0-runtime-ubuntu22.04
1616

17-
# ===== Set working directory =====
17+
# Set working directory
1818
WORKDIR /app
1919

20-
# ===== Timezone fix =====
20+
# Timezone fix
2121
ENV TZ=Europe/Zagreb
2222
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
2323

24-
# ===== Install Miniconda and Git =====
24+
# Install Miniconda and Git
2525
RUN apt-get update && apt-get install -y wget bzip2 git && \
2626
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \
2727
bash /tmp/miniconda.sh -b -p /opt/conda && \
@@ -31,14 +31,14 @@ RUN apt-get update && apt-get install -y wget bzip2 git && \
3131
# Add conda to PATH
3232
ENV PATH="/opt/conda/bin:$PATH"
3333

34-
# ===== Accept Conda Terms of Service =====
34+
# Accept Conda Terms of Service
3535
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \
3636
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
3737

38-
# ===== Copy environment.yml first for faster rebuilds =====
38+
# Copy environment.yml first for faster rebuilds
3939
COPY environment.yml /tmp/environment.yml
4040

41-
# ===== Create Conda environment =====
41+
# Create Conda environment
4242
# Create env
4343
RUN conda env create -f /tmp/environment.yml -n hotel_management
4444

@@ -61,10 +61,10 @@ COPY pyproject.toml .
6161
# Install rest
6262
RUN conda run -n hotel_management pip install -r /tmp/requirements.txt
6363

64-
# ===== Use the environment for all container commands =====
64+
# Use the environment for all container commands
6565
SHELL ["conda", "run", "-n", "hotel_management", "/bin/bash", "-c"]
6666

67-
# ===== Copy the code =====
67+
# Copy the code
6868
COPY ml ./ml
6969
COPY pipelines ./pipelines
7070
COPY scripts ./scripts
@@ -73,11 +73,11 @@ COPY ml_service ./ml_service
7373
# Install the package
7474
RUN conda run -n hotel_management pip install -e .
7575

76-
# ===== Expose ports =====
76+
# Expose ports
7777
EXPOSE 8000
7878
EXPOSE 8050
7979

80-
# ===== Run all services =====
80+
# Run all services
8181
CMD bash -c "\
8282
uvicorn ml_service.backend.main:app --reload --host 0.0.0.0 --port 8000 & \
8383
python -m ml_service.frontend.app --host 0.0.0.0 --port 8050 & \

README.md

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
- located in `data/raw/hotel_bookings/v1/2026-02-25T22-43-23_732dfdb7/data.csv`
1010
- originally from https://www.kaggle.com/datasets/mojtaba142/hotel-booking
1111
- Current architecture expanded to support many datasets.
12-
- The ml workflow covers everything from the registration of a raw data snapshot to model promotion.
12+
- The ml workflow covers everything from the registration of a raw data snapshot to model monitoring.
1313
> Note: the repo was previously named `hotel_management`, so you will see that name around the repo; renamed for clarity on what the project does
1414
1515
## Features
1616

17+
Pipelines for every part of the ml workflow:
1718
- Data preprocessing
1819
- Register raw data snapshots
1920
- Build interim and processed datasets
@@ -25,6 +26,25 @@
2526
- Model promotion
2627
- Includes model registry for staging and production
2728
- Archives past production models
29+
- Model inference
30+
- Model monitoring
31+
32+
Maximum **decoupling** of datasets, feature sets, and modeling
33+
- Datasets merge at runtime, using predefined configs and DAG for ordering
34+
- Feature sets merge at runtime using a predefined entity key
35+
- Models can use any snapshots of datasets and feature sets via snapshot bindings registry
36+
- Validation ensures consistency and predefined minimum row presence
37+
38+
Full **reproducibility**
39+
- Hashing and downstream validation of relevant `artifacts` and `configs`
40+
- Runtime info validation (hardware, git commit, environment...)
41+
42+
Code **quality** ensured by CI, which includes:
43+
- `ruff` checks
44+
- `mypy` checks (moderate strictness)
45+
- import layer checks
46+
- naming conventions checks
47+
- **1235 tests** -> fails if coverage drops below 90%
2848

2949
## Installation
3050

@@ -44,21 +64,33 @@ Two options:
4464

4565
See the [usage guide](docs/usage.md) for instructions on running the workflow.
4666

47-
### Usage examples (via `ml_service` and `Docker`):
67+
### Usage examples (via `ml_service`):
4868

49-
#### Pipelines
69+
#### Modeling Configs Writing, Validation, Saving, and Viewing
5070

51-
!["Gif portrayal of pipelines app from ml_service"](assets/gifs/ml_service_pipelines_v2.gif)
71+
!["Gif portrayal of writing modeling configs with ml_service"](assets/gifs/ml_service_modeling_configs_v3.gif)
5272

53-
#### Modeling Configs
73+
**Similar functionality exists for other supported configs**
5474

55-
!["Gif portrayal of modeling configs app from ml_service"](assets/gifs/ml_service_modeling_configs_v2.gif)
75+
#### Pipeline Running and Artifact Viewing
76+
77+
!["Gif portrayal of running a pipeline with ml_service"](assets/gifs/ml_service_pipelines_v3.gif)
78+
79+
**Similar functionality exists for scripts**
80+
81+
#### Documentation Reading in Browser
82+
83+
!["Gif portrayal of reading the docs with ml_service"](assets/gifs/ml_service_docs_v1.gif)
84+
85+
#### Directory Structure Viewing in Browser
86+
87+
["Gif portrayal of viewing directory structure with ml_service"](assets/gifs/ml_service_dir_viewer_v1.gif)
5688

5789
## Architecture
5890

5991
### Artifact Lineage (high-level overview)
6092

61-
![Artifact Lineage Diagram](docs/architecture/img/artifact_lineage_v2.png)
93+
![Artifact Lineage Diagram](docs/architecture/img/artifact_lineage_v3.png)
6294

6395
### Details
6496

248 KB
Loading

assets/gifs/ml_service_docs_v1.gif

1.82 MB
Loading
-508 KB
Binary file not shown.
522 KB
Loading
-242 KB
Binary file not shown.
676 KB
Loading
-42.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)