Local Test — Inference Services
Build, run, and test a model server locally.
Steps
- Ensure a
.envfile exists in the repo root withPATH_TO_<MODEL>_MODEL=/local/path/to/model. - Build the image:
docker compose build <service>. - Start the service:
docker compose up <service>. - Once it's running, send a test request. The endpoint is
POST /v1/models/<model-name>:predictwhere<model-name>is theMODEL_NAMEenv var set for that service in docker-compose.yml. Checksrc/models/<service>/model_server/model.pyfor the expected input schema. Example for revert-risk language agnostic model:curl localhost:8080/v1/models/revertrisk-language-agnostic:predict -X POST -d '{"lang":"en","rev_id":12345}' -H "Content-type: application/json". - To stop:
Ctrl+Cordocker compose down.
Notes
- ARM Macs: If the service doesn't start, add
platform: linux/amd64to the service indocker-compose.yml. - The service listens on
localhost:8080by default. Check docker-compose.yml if the port is mapped differently. If:8080is already in use, stop the other service or remap the port. - Model files must be downloaded separately from
https://analytics.wikimedia.org/published/wmf-ml-models/and placed at the path referenced in.env. - To run detached:
docker compose up -d <service>. Logs:docker compose logs <service>.
Input
$ARGUMENTS — the docker-compose service name (e.g., revertrisk-language-agnostic, articlequality, reference-need).