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
4 changes: 2 additions & 2 deletions .github/workflows/pre_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ jobs:
- "ubuntu-latest"
- "windows-latest"
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
runs-on: ${{ matrix.os }}
steps:
- *checkout
Expand Down Expand Up @@ -82,10 +82,10 @@ jobs:
- "ubuntu-24.04"
- "windows-2022"
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
name: unit & functional tests (${{ matrix.os }}, Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: detect-private-key

# Ruff version.
- repo: https://github.com/charliermarsh/ruff-pre-commit
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.2"
hooks:
# Run the linter.
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10
3.14
20 changes: 12 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build-backend = "hatchling.build"
[project]
name = "openvino_model_api"
version = "0.4.0.0"
requires-python = ">=3.10"
requires-python = ">=3.11"
authors = [
{name = "Intel(R) Corporation"},
]
Expand All @@ -20,11 +20,15 @@ maintainers = [
description = "Model API: model wrappers and pipelines for inference with OpenVINO"
readme = "README.md"
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.10"
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dependencies = [
"numpy>=1.16.6",
"onnxruntime",
"opencv-python-headless",
"openvino>=2025.3",
"pillow",
Expand Down Expand Up @@ -190,6 +194,9 @@ lint.ignore = [
lint.fixable = ["ALL"]
lint.unfixable = []

# Allow unused variables when underscore-prefixed.
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
Expand Down Expand Up @@ -217,11 +224,8 @@ exclude = [
# Same as Black.
line-length = 120

# Allow unused variables when underscore-prefixed.
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Assume Python 3.10.
target-version = "py310"
# Assume Python 3.11.
target-version = "py311"

# Allow imports relative to the "src" and "tests" directories.
src = ["src", "tests"]
Expand Down
5 changes: 2 additions & 3 deletions src/model_api/models/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import copy
import json
from itertools import starmap
from pathlib import Path
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -251,7 +250,7 @@ def get_multilabel_predictions(self, logits: np.ndarray) -> list[Label]:
labels_list = self.params.labels
labels = [labels_list[i] if labels_list else "" for i in indices]

return list(starmap(Label, zip(indices, labels, scores)))
return list(map(Label, indices, labels, scores))

def get_multiclass_predictions(self, outputs: dict) -> list[Label]:
axis = 1
Expand All @@ -265,7 +264,7 @@ def get_multiclass_predictions(self, outputs: dict) -> list[Label]:
labels_list = self.params.labels
labels = [labels_list[i] if labels_list else "" for i in indices]

return list(starmap(Label, zip(indices, labels, scores)))
return list(map(Label, indices, labels, scores))


def sigmoid_numpy(x: np.ndarray) -> np.ndarray:
Expand Down
3 changes: 1 addition & 2 deletions src/model_api/models/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,7 @@ def parameters(cls):
{
"agnostic_nms": BooleanValue(
description=(
"If True, the model is agnostic to the number of classes, "
"and all classes are considered as one"
"If True, the model is agnostic to the number of classes, and all classes are considered as one"
),
default_value=False,
),
Expand Down
3 changes: 1 addition & 2 deletions tests/accuracy/download_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ async def stream_file(client, url, filename, semaphore):

async def download_single_image(client, url, filename):
image = await client.get(url)
with Path(filename).open("wb") as im:
im.write(image.content)
Path(filename).write_bytes(image.content)


async def download_images(data_dir):
Expand Down
3 changes: 1 addition & 2 deletions tools/model_converter/model_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ def create_model(
elif "state_dict" in checkpoint:
# Cannot reconstruct architecture from state_dict alone
error_msg = (
"Checkpoint contains only state_dict. "
"Please specify the model class instead of torch.nn.Module"
"Checkpoint contains only state_dict. Please specify the model class instead of torch.nn.Module"
)
raise ValueError(error_msg)
else:
Expand Down
Loading