Skip to content
Open
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
7 changes: 5 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ volumes:
minio_data:
driver: local
node_modules:
ml_backend_model_cache:

services:
django: &django
Expand Down Expand Up @@ -187,9 +188,11 @@ services:

ml_backend:
build:
context: ./processing_services/minimal
context: ./processing_services/example
volumes:
- ./processing_services/minimal/:/app
- ./processing_services/example/:/app
Comment on lines 191 to +193

Copilot AI Nov 18, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example service uses ML models (transformers, PyTorch) that download models on first use. Consider adding cache volumes to avoid re-downloading models on container restarts:

volumes:
  - ./processing_services/example/:/app
  - ./processing_services/example/huggingface_cache:/root/.cache/huggingface
  - ./processing_services/example/pytorch_cache:/root/.cache/torch

This is similar to the configuration in processing_services/example/docker-compose.yml and would improve startup performance after the initial model download.

Copilot uses AI. Check for mistakes.
# Hugging Face and torch downloads survive container rebuilds; the first start downloads the models.
- ml_backend_model_cache:/root/.cache
ports:
- "2005:2000"
networks:
Expand Down
4 changes: 2 additions & 2 deletions processing_services/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ In this directory, we define locally-run processing services as FastAPI apps. A
- `/process`: receives source images and existing detections via a `PipelineRequest` and returns a `PipelineResponse` containing detections

`processing_services` contains 2 apps:
- `example`: demos how to add custom pipelines/algorithms.
- `minimal`: a simple ML backend for basic testing of the processing service API. This minimal app also runs within the main Antenna docker compose stack.
- `example`: demos how to add custom pipelines/algorithms with real models. It runs as `ml_backend` in the main Antenna docker compose stack for local development, so jobs there produce real detections and classifications. The first job downloads the models (about 3.6 GB for the zero-shot pipelines; about a minute on a fast connection) into the `ml_backend_model_cache` volume, which keeps them across rebuilds; `docker volume rm` it to download again.
- `minimal`: a simple ML backend with no models and fixed outputs, for testing the processing service API. The CI stack (`docker-compose.ci.yml`) uses it, and it can be started next to the main stack with `docker compose -f processing_services/docker-compose.yml up -d ml_backend_minimal`.

If your goal is to run an ML backend locally, simply copy the `example` app and follow the steps below.

Expand Down
Loading