|
| 1 | +# Model Engine |
| 2 | + |
| 3 | +The Model Engine is an API server that allows users to create, deploy, edit, |
| 4 | +and delete machine learning endpoints. It consists of two main architectural |
| 5 | +components: |
| 6 | + |
| 7 | +- The [gateway](./model_engine_server/entrypoints/start_fastapi_server.py) |
| 8 | + provides a REST API for users to interact with. The routes of the REST API are |
| 9 | + defined in [`model_engine_server.api`](./model_engine_server/api). |
| 10 | +- The [`model_engine_server.service_builder`](./model_engine_server/service_builder) |
| 11 | + package is the part of the code that creates the inference pods. It is the |
| 12 | + endpoint builder. When we do a `POST` request to `/endpoints`, this gets run. |
| 13 | + It gets run when users create or edit endpoints with `[POST,PUT] /v1/model-endpoints` |
| 14 | + |
| 15 | +There are two other microservices: |
| 16 | + |
| 17 | +- The [kubernetes cache](./model_engine_server/entrypoints/k8s_cache.py) |
| 18 | + stores endpoint metadata on Redis so that Model Engine does not overload the API |
| 19 | + server. |
| 20 | +- The celery autoscaler (link TBD) automatically scales |
| 21 | + the number of inference pods based on the number of requests for async endpoints. |
| 22 | + |
| 23 | +## Getting started |
| 24 | + |
| 25 | +Be sure to install the global `../requirements-dev.txt` first prior |
| 26 | +to any installations of requirements in this directory |
| 27 | +(`pip install -r ../requirements-dev.txt`), as well as the pre-commit hooks |
| 28 | +(`pre-commit install` in the `llm-engine` root folder). Then, install the |
| 29 | +requirements files and this folder as editable |
| 30 | + |
| 31 | +```bash |
| 32 | +pip install -r requirements.txt && \ |
| 33 | + pip install -r requirements-test.txt && \ |
| 34 | + pip install -r requirements_override.txt && \ |
| 35 | + pip install -e . |
| 36 | +``` |
| 37 | + |
| 38 | +Run `mypy . --install-types` to set up mypy. |
| 39 | + |
| 40 | +## Testing |
| 41 | + |
| 42 | +Most of the business logic in Model Engine should contain unit tests, located in |
| 43 | +[`tests/unit`](./tests/unit). To run the tests, run `pytest`. |
0 commit comments