Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.venv/
__pycache__/
.pytest_cache/
.ruff_cache/
*.py[cod]
.DS_Store
.env
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -r requirements-dev.txt
python -m pip install -r requirements/base.txt
python -m pip install -r requirements/dev.txt

- name: Lint
run: python -m ruff check .
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.venv/
__pycache__/
.pytest_cache/
.ruff_cache/
*.py[cod]
.env
.DS_Store
Expand Down
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
.PHONY: test train bench replay compose compose-prod smoke docker-build
.PHONY: lint compile test check train bench replay compose compose-prod smoke docker-build

lint:
python -m ruff check .

compile:
python -m compileall -q gateway worker training bench scripts tests

test:
python -m pytest -q

check: lint compile test

train:
python training/train_text_model.py

Expand All @@ -13,10 +21,10 @@ replay:
python bench/replay_traffic.py --seconds-per-stage 8 --rps 18

compose:
docker compose up --build
docker compose -f deploy/compose/docker-compose.yml up --build

compose-prod:
docker compose -f docker-compose.prod.yml up --build
docker compose -f deploy/compose/docker-compose.prod.yml up --build

smoke:
python scripts/smoke_check.py
Expand Down
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The first version runs a FastAPI gateway in front of a few model workers. The ga
```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -r requirements/base.txt

uvicorn worker.app.main:app --port 8011
WORKER_URLS=http://localhost:8011 uvicorn gateway.app.main:app --port 8000
Expand Down Expand Up @@ -45,7 +45,7 @@ python bench/replay_traffic.py --seconds-per-stage 8 --rps 18
## Docker

```bash
docker compose up --build
make compose
```

That starts Redis, one gateway, and two workers.
Expand All @@ -54,7 +54,7 @@ For a production-style local run:

```bash
cp .env.example .env
docker compose -f docker-compose.prod.yml up --build
make compose-prod
python scripts/smoke_check.py
```

Expand All @@ -69,6 +69,20 @@ keeps workers private and disables public worker failure controls.

Deployment and validation steps are in `docs/hosted-demo.md`.

## Repository layout

```text
gateway/ FastAPI gateway, routing, cache, metrics, dashboard
worker/ model worker service and exported model artifact
training/ MPS training and evaluation scripts
bench/ benchmark and replay scripts with saved results
scripts/ smoke checks and small operational helpers
tests/ unit tests for gateway, worker, model, and settings
docs/ architecture, deployment, report, and model card
deploy/compose/ local Docker Compose files
requirements/ runtime, development, and training dependency sets
```

## Benchmarks

The scenario runner starts local gateway and worker processes, sends load, then writes JSON and markdown results.
Expand Down Expand Up @@ -98,7 +112,7 @@ The worker can load a small trained text model artifact from `worker/app/artifac
On Apple Silicon, the training script uses PyTorch MPS. It refuses to run on CPU by default so a slow accidental CPU run fails fast.

```bash
pip install -r requirements-train.txt
pip install -r requirements/train.txt
python training/train_text_model.py
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ services:

worker-a:
build:
context: .
context: ../..
dockerfile: worker/Dockerfile
restart: unless-stopped
environment:
WORKER_ID: worker-a

worker-b:
build:
context: .
context: ../..
dockerfile: worker/Dockerfile
restart: unless-stopped
environment:
WORKER_ID: worker-b

gateway:
build:
context: .
context: ../..
dockerfile: gateway/Dockerfile
restart: unless-stopped
environment:
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml → deploy/compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:

worker-a:
build:
context: .
context: ../..
dockerfile: worker/Dockerfile
environment:
WORKER_ID: worker-a
Expand All @@ -15,7 +15,7 @@ services:

worker-b:
build:
context: .
context: ../..
dockerfile: worker/Dockerfile
environment:
WORKER_ID: worker-b
Expand All @@ -25,7 +25,7 @@ services:

gateway:
build:
context: .
context: ../..
dockerfile: gateway/Dockerfile
environment:
WORKER_URLS: http://worker-a:9000,http://worker-b:9000
Expand Down
2 changes: 1 addition & 1 deletion docs/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is the local demo flow I use to show the system moving.
Terminal 1:

```bash
docker compose up --build
make compose
```

Open:
Expand Down
2 changes: 1 addition & 1 deletion docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ModelMesh is still easiest to demo locally because the failure controls and traf

```bash
cp .env.example .env
docker compose -f docker-compose.prod.yml up --build
make compose-prod
python scripts/smoke_check.py
```

Expand Down
2 changes: 1 addition & 1 deletion gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

WORKDIR /app
COPY requirements.txt .
COPY requirements/base.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

COPY gateway ./gateway
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

WORKDIR /app
COPY requirements.txt .
COPY requirements/base.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

COPY worker ./worker
Expand Down