diff --git a/docker-compose.yml b/docker-compose.yml index f8b6d6498..794e6ecbc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ volumes: minio_data: driver: local node_modules: + ml_backend_model_cache: services: django: &django @@ -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 + # Hugging Face and torch downloads survive container rebuilds; the first start downloads the models. + - ml_backend_model_cache:/root/.cache ports: - "2005:2000" networks: diff --git a/processing_services/README.md b/processing_services/README.md index 48bb254e7..cf61c8315 100644 --- a/processing_services/README.md +++ b/processing_services/README.md @@ -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.