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
2 changes: 1 addition & 1 deletion .github/workflows/pre_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
- name: Install dependencies
run: |
uv sync --locked --extra tests --extra ovms
uv sync --locked --extra tests
- name: Run python unit tests
run: |
uv run pytest tests/unit --cov
30 changes: 1 addition & 29 deletions .github/workflows/test_precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,13 @@ jobs:
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
- name: Install dependencies
run: |
uv sync --locked --extra tests --extra ovms --extra-index-url https://download.pytorch.org/whl/cpu
uv sync --locked --extra tests --extra-index-url https://download.pytorch.org/whl/cpu
- name: Prepare test data
run: |
uv run python tests/precommit/prepare_data.py -d data -p tests/precommit/public_scope.json
- name: Run test
run: |
uv run pytest --data=./data tests/functional
serving_api:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
python-version: ["3.10", "3.11", "3.13"]
runs-on: ${{ matrix.os }}
steps:
- name: Set up docker for macOS
if: startsWith(matrix.os, 'macos-1')
run: |
brew install colima docker
colima start
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
- name: serving_api
run: |
uv sync --locked --extra tests --extra ovms
uv run python tests/precommit/prepare_data.py -d data -p tests/precommit/public_scope.json
uv run python -c "from model_api.models import DetectionModel; DetectionModel.create_model('./data/otx_models/detection_model_with_xai_head.xml').save('ovms_models/ssd_mobilenet_v1_fpn_coco/1/ssd_mobilenet_v1_fpn_coco.xml')"
docker run -d --rm -v $GITHUB_WORKSPACE/ovms_models/:/models -p 8000:8000 openvino/model_server:latest --model_path /models/ssd_mobilenet_v1_fpn_coco/ --model_name ssd_mobilenet_v1_fpn_coco --rest_port 8000 --log_level DEBUG --target_device CPU
uv run python examples/serving_api/run.py data/coco128/images/train2017/000000000009.jpg # detects 4 objects
Zizmor-Scan-PR:
runs-on: ubuntu-latest
permissions:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,3 @@ docs/source/_build/
.vscode/

data/
ovms_models/
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

## Introduction

Model API is a set of wrapper classes for particular tasks and model architectures, simplifying data preprocess and postprocess as well as routine procedures (model loading, asynchronous execution, etc.). It is aimed at simplifying end-to-end model inference for different deployment scenarios, including local execution and serving. The Model API is based on the OpenVINO inference API.
Model API is a set of wrapper classes for particular tasks and model architectures, simplifying data preprocess and postprocess as well as routine procedures (model loading, asynchronous execution, etc.). It is aimed at simplifying end-to-end model inference. The Model API is based on the OpenVINO inference API.

## How it works

Expand All @@ -35,7 +35,6 @@ Training Extensions embed all the metadata required for inference into model fil

- Python API
- Synchronous and asynchronous inference
- Local inference and serving through the rest API
- Model preprocessing embedding for faster inference

## Installation
Expand All @@ -48,7 +47,6 @@ Training Extensions embed all the metadata required for inference into model fil
from model_api.models import Model

# Create a model wrapper from a compatible model generated by OpenVINO Training Extensions
# Use URL to work with OVMS-served model, e.g. "localhost:9000/models/ssdlite_mobilenet_v2"
model = Model.create_model("model.xml")

# Run synchronous inference locally
Expand All @@ -60,7 +58,7 @@ print(f"Inference result: {result}")

## Prepare a model for `InferenceAdapter`

There are usecases when it is not possible to modify an internal `ov::Model` and it is hidden behind `InferenceAdapter`. For example the model can be served using [OVMS](https://github.com/openvinotoolkit/model_server). `create_model()` can construct a model from a given `InferenceAdapter`. That approach assumes that the model in `InferenceAdapter` was already configured by `create_model()` called with a string (a path or a model name). It is possible to prepare such model:
There are usecases when it is not possible to modify an internal `ov::Model` and it is hidden behind `InferenceAdapter`. `create_model()` can construct a model from a given `InferenceAdapter`. That approach assumes that the model in `InferenceAdapter` was already configured by `create_model()` called with a string (a path or a model name). It is possible to prepare such model:

```python
model = DetectionModel.create_model("~/.cache/omz/public/ssdlite_mobilenet_v2/FP16/ssdlite_mobilenet_v2.xml")
Expand Down
5 changes: 0 additions & 5 deletions docs/source/adapters/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
[todo]
:::

:::{grid-item-card} Ovms Adapter
:link: ./ovms_adapter
:link-type: doc

[todo]
:::
:::{grid-item-card} Onnx Adapter
Expand Down Expand Up @@ -45,6 +41,5 @@
./inference_adapter
./onnx_adapter
./openvino_adapter
./ovms_adapter
./utils
```
8 changes: 0 additions & 8 deletions docs/source/adapters/ovms_adapter.md

This file was deleted.

40 changes: 0 additions & 40 deletions examples/serving_api/README.md

This file was deleted.

34 changes: 0 additions & 34 deletions examples/serving_api/run.py

This file was deleted.

3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ dependencies = [
]

[project.optional-dependencies]
ovms = [
"tritonclient[http]<2.59",
]
tests = [
"pre-commit",
"httpx",
Expand Down
14 changes: 1 addition & 13 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,13 @@ The following tasks can be solved with wrappers usage:

Model API wrappers are executor-agnostic, meaning it does not implement the specific model inference or model loading, instead it can be used with different executors having the implementation of common interface methods in adapter class respectively.

Currently, `OpenvinoAdapter` and `OVMSAdapter` are supported.
Currently, `OpenvinoAdapter` and `ONNXRuntimeAdapter` are supported.

### OpenVINO Adapter

`OpenvinoAdapter` hides the OpenVINO™ toolkit API, which allows Model API wrappers launching with models represented in Intermediate Representation (IR) format.
It accepts a path to either `xml` model file or `onnx` model file.

### OpenVINO Model Server Adapter

`OVMSAdapter` hides the OpenVINO Model Server python client API, which allows Model API wrappers launching with models served by OVMS.

Refer to **[`OVMSAdapter`](adapters/ovms_adapter.md)** to learn about running demos with OVMS.

For using OpenVINO Model Server Adapter you need to install the package with extra module:

```sh
pip install <omz_dir>/demos/common/python[ovms]
```

### ONNXRuntime Adapter

`ONNXRuntimeAdapter` hides the ONNXRuntime, which Model API wrappers launching with models represented in ONNX format.
Expand Down
2 changes: 0 additions & 2 deletions src/model_api/adapters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@

from .onnx_adapter import ONNXRuntimeAdapter
from .openvino_adapter import OpenvinoAdapter, create_core, get_user_config
from .ovms_adapter import OVMSAdapter
from .utils import INTERPOLATION_TYPES, RESIZE_TYPES, InputTransform, Layout

__all__ = [
"create_core",
"get_user_config",
"Layout",
"OpenvinoAdapter",
"OVMSAdapter",
"ONNXRuntimeAdapter",
"RESIZE_TYPES",
"InputTransform",
Expand Down
59 changes: 0 additions & 59 deletions src/model_api/adapters/ovms_adapter.md

This file was deleted.

Loading