Skip to content

Commit

Permalink
Merge branch 'master' into fix_CID_1568450
Browse files Browse the repository at this point in the history
  • Loading branch information
wangleis authored Dec 20, 2024
2 parents 723ba5a + 375ebd2 commit 0497b0b
Show file tree
Hide file tree
Showing 353 changed files with 3,863 additions and 1,002 deletions.
2 changes: 1 addition & 1 deletion .github/dockerfiles/docker_tag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pr-27597
pr-27882
6 changes: 5 additions & 1 deletion .github/dockerfiles/ov_build/fedora_29/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ FROM ${REGISTRY}/library/fedora:29

USER root

RUN yum update -y && yum install -y \
# dnf configuration
RUN echo "timeout=60" >> /etc/dnf/dnf.conf && \
echo "retries=10" >> /etc/dnf/dnf.conf

RUN dnf update -y && dnf install -y \
git \
curl \
python3 \
Expand Down
6 changes: 5 additions & 1 deletion .github/dockerfiles/ov_test/fedora_33/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ FROM ${REGISTRY}/library/fedora:33

USER root

RUN yum update -y && yum install -y \
# dnf configuration
RUN echo "timeout=60" >> /etc/dnf/dnf.conf && \
echo "retries=10" >> /etc/dnf/dnf.conf

RUN dnf update -y && dnf install -y \
git \
curl \
python3 \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fedora_29.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ jobs:
# install previous release version
mv /tmp/openvino-2023.repo /etc/yum.repos.d
yum install -y openvino
dnf install -y openvino
# install current version
yum install --allowerasing -y *.rpm
dnf install --allowerasing -y *.rpm
working-directory: ${{ env.RPM_PACKAGES_DIR }}

- name: Test RPM packages
Expand Down
8 changes: 4 additions & 4 deletions samples/js/node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion samples/js/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"args": "^5.0.3",
"eslint": "^8.39.0",
"https-proxy-agent": "^7.0.2",
"openvino-node": "^2024.5.0-0",
"openvino-node": "^2024.6.0",
"@napi-rs/canvas": "^0.1.59"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/bindings/js/node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/bindings/js/node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openvino-node",
"version": "2024.5.0-0",
"version": "2024.6.0",
"description": "OpenVINO™ utils for using from Node.js environment",
"repository": {
"url": "git+https://github.com/openvinotoolkit/openvino.git",
Expand Down Expand Up @@ -44,7 +44,6 @@
"tar-fs": "^3.0.4"
},
"binary": {
"version": "2024.5.0",
"module_path": "./bin/",
"remote_path": "./repositories/openvino/nodejs_bindings/{version}/{platform}/",
"package_name": "openvino_nodejs_bindings_{platform}_{version}_{arch}.tar.gz",
Expand Down
53 changes: 44 additions & 9 deletions src/bindings/python/src/openvino/_ov_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from typing import Any, Iterable, Union, Optional, Dict
from types import TracebackType
from typing import Any, Iterable, Union, Optional, Dict, Type
from pathlib import Path


Expand All @@ -21,30 +22,48 @@
)


class Model(ModelBase):
class Model:
def __init__(self, *args: Any, **kwargs: Any) -> None:
if args and not kwargs:
if isinstance(args[0], ModelBase):
super().__init__(args[0])
self.__model = ModelBase(args[0])
elif isinstance(args[0], Node):
super().__init__(*args)
self.__model = ModelBase(*args)
else:
super().__init__(*args)
self.__model = ModelBase(*args)
if args and kwargs:
super().__init__(*args, **kwargs)
self.__model = ModelBase(*args, **kwargs)
if kwargs and not args:
super().__init__(**kwargs)
self.__model = ModelBase(**kwargs)

def __getattr__(self, name: str) -> Any:
if self.__model is None:
raise AttributeError(f"'Model' object has no attribute '{name}' or attribute is no longer accessible.")
return getattr(self.__model, name)

def clone(self) -> "Model":
return Model(super().clone())
return Model(self.__model.clone())

def __copy__(self) -> "Model":
raise TypeError("Cannot copy 'openvino.runtime.Model'. Please, use deepcopy instead.")

def __deepcopy__(self, memo: Dict) -> "Model":
"""Returns a deepcopy of Model.
:return: A copy of Model.
:rtype: openvino.runtime.Model
"""
return Model(super().clone())
return Model(self.__model.clone())

def __enter__(self) -> "Model":
return self

def __exit__(self, exc_type: Type[BaseException], exc_value: BaseException, traceback: TracebackType) -> None:
del self.__model
self.__model = None

def __repr__(self) -> str:
return self.__model.__repr__()


class InferRequest(_InferRequestWrapper):
Expand Down Expand Up @@ -500,6 +519,8 @@ def read_model(
config: Optional[dict] = None
) -> Model:
config = {} if config is None else config
if isinstance(model, Model):
model = model._Model__model

if isinstance(weights, Tensor):
return Model(super().read_model(model, weights))
Expand Down Expand Up @@ -543,6 +564,8 @@ def compile_model(
:return: A compiled model.
:rtype: openvino.runtime.CompiledModel
"""
if isinstance(model, Model):
model = model._Model__model
if weights is None:
if device_name is None:
return CompiledModel(
Expand All @@ -562,6 +585,16 @@ def compile_model(
weights=weights,
)

def query_model(
self,
model: Model,
device_name: str,
config: Optional[dict] = None,
) -> dict:
return super().query_model(model._Model__model,
device_name,
{} if config is None else config, )

def import_model(
self,
model_stream: bytes,
Expand Down Expand Up @@ -637,4 +670,6 @@ def compile_model(
"""
core = Core()
if isinstance(model, Model):
model = model._Model__model
return core.compile_model(model, device_name, {} if config is None else config)
2 changes: 1 addition & 1 deletion src/bindings/python/src/openvino/frontend/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from openvino._pyopenvino import FrontEnd as FrontEndBase
from openvino._pyopenvino import FrontEndManager as FrontEndManagerBase
from openvino._pyopenvino import InputModel
from openvino.runtime import Model
from openvino import Model


class FrontEnd(FrontEndBase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import jax.core
from openvino.frontend.jax.py_jax_frontend import _FrontEndJaxDecoder as Decoder
from openvino.runtime import PartialShape, Type as OVType, OVAny
from openvino import PartialShape, Type as OVType, OVAny
from openvino.frontend.jax.utils import jax_array_to_ov_const, get_ov_type_for_value, \
ivalue_to_constant, param_to_constants

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/src/openvino/frontend/jax/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import jax.numpy as jnp
import numpy as np
from openvino.frontend.jax.passes import filter_element, filter_ivalue, filter_param
from openvino.runtime import op, Type as OVType, Shape, OVAny
from openvino import op, Type as OVType, Shape, OVAny

numpy_to_ov_type_map = {
np.float32: OVType.f32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from openvino.frontend.pytorch.py_pytorch_frontend import _FrontEndPytorchDecoder as Decoder
from openvino.frontend.pytorch.py_pytorch_frontend import _Type as DecoderType
from openvino.runtime import PartialShape, Type as OVType, OVAny, Shape
from openvino import PartialShape, Type as OVType, OVAny, Shape
from openvino.frontend.pytorch.utils import make_constant, fetch_attr, pt_to_ov_type_map, torch_tensor_to_ov_const

logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from torch._decomp import decomposition_table, get_decompositions

from openvino.frontend import FrontEndManager
from openvino.runtime import Core, Type, PartialShape
from openvino import Core, Type, PartialShape
from openvino.frontend.pytorch.ts_decoder import TorchScriptPythonDecoder
from openvino.frontend.pytorch.torchdynamo import decompositions
from openvino.frontend.pytorch.torchdynamo.decompositions import get_aot_decomposition_list, get_inf_decomposition_list
Expand All @@ -27,7 +27,7 @@
from openvino.frontend.pytorch.torchdynamo.compile import cached_model_name, openvino_compile_cached_model
from openvino.frontend.pytorch.torchdynamo.backend_utils import _get_cache_dir, _get_device, _get_model_caching, _get_decompositions, _get_aot_autograd

from openvino.runtime import Core, Type, PartialShape
from openvino import Core, Type, PartialShape

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# mypy: ignore-errors

from typing import Optional, Any
from openvino.runtime import Core
from openvino import Core


def _get_device(options) -> Optional[Any]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from openvino.frontend import FrontEndManager
from openvino.frontend.pytorch.fx_decoder import TorchFXPythonDecoder
from openvino.runtime import Core, Type, PartialShape, serialize
from openvino import Core, Type, PartialShape, serialize
from openvino.frontend.pytorch.torchdynamo.backend_utils import _get_cache_dir, _get_device, _get_config, _is_cache_dir_in_config

from typing import Callable, Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from openvino.frontend.pytorch.fx_decoder import TorchFXPythonDecoder
from openvino.frontend.pytorch.torchdynamo.partition import Partitioner
from openvino.frontend.pytorch.torchdynamo.compile import openvino_compile
from openvino.runtime import Core, Type, PartialShape
from openvino import Core, Type, PartialShape
from openvino.frontend.pytorch.torchdynamo.backend_utils import _get_cache_dir, _get_device, _get_aot_autograd

from typing import Callable, Optional, Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from openvino.frontend.pytorch.py_pytorch_frontend import _FrontEndPytorchDecoder as Decoder
from openvino.frontend.pytorch.py_pytorch_frontend import _Type as DecoderType
from openvino.runtime import op, PartialShape, Type as OVType, OVAny
from openvino import op, PartialShape, Type as OVType, OVAny
from openvino.frontend.pytorch.utils import (
ivalue_to_constant,
get_value_from_getattr,
Expand All @@ -15,7 +15,7 @@
convert_quantized_tensor,
graph_has_ops,
)
from openvino.runtime import opset11 as ops
from openvino import opset11 as ops
from openvino.frontend.pytorch import quantized, patch_model
from openvino.frontend.pytorch.module_extension import ModuleExtension

Expand Down
4 changes: 2 additions & 2 deletions src/bindings/python/src/openvino/frontend/pytorch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import torch
import numpy as np

from openvino.runtime import op, Type as OVType, Shape, Tensor
from openvino.runtime import opset11 as ops
from openvino import op, Type as OVType, Shape, Tensor
from openvino import opset11 as ops


def make_constant(*args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import tensorflow as tf
from openvino.frontend.tensorflow.py_tensorflow_frontend import _FrontEndDecoderBase as DecoderBase
from openvino.runtime import PartialShape, Type, OVAny, Tensor
from openvino import PartialShape, Type, OVAny, Tensor


def tf_type_to_ov_type(tf_type_int):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import logging as log
import numpy as np
import sys
from openvino.runtime import PartialShape, Dimension, Type
from openvino import PartialShape, Dimension, Type
from packaging.version import parse, Version
from typing import List, Dict, Union

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/src/openvino/helpers/packing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np
from typing import Union
from openvino.runtime import Type, Shape
from openvino import Type, Shape


def pack_data(array: np.ndarray, type: Type) -> np.ndarray:
Expand Down
12 changes: 6 additions & 6 deletions src/bindings/python/src/openvino/opset1/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
import numpy as np
from functools import partial

from openvino.runtime import Node, PartialShape, Type
from openvino import Node, PartialShape, Type
from openvino.op import Constant, Parameter, tensor_iterator
from openvino.runtime.opset_utils import _get_node_factory
from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op
from openvino.runtime.utils.input_validation import (
from openvino.utils.node_factory import _get_node_factory
from openvino.utils.decorators import binary_op, nameable_op, unary_op
from openvino.utils.input_validation import (
check_valid_attributes,
is_non_negative_value,
is_positive_value,
)
from openvino.runtime.utils.node_factory import NodeFactory
from openvino.runtime.utils.types import (
from openvino.utils.node_factory import NodeFactory
from openvino.utils.types import (
NodeInput,
NumericData,
NumericType,
Expand Down
8 changes: 4 additions & 4 deletions src/bindings/python/src/openvino/opset10/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from functools import partial
from typing import List, Optional

from openvino.runtime import Node
from openvino.runtime.opset_utils import _get_node_factory
from openvino.runtime.utils.decorators import nameable_op
from openvino.runtime.utils.types import (
from openvino import Node
from openvino.utils.node_factory import _get_node_factory
from openvino.utils.decorators import nameable_op
from openvino.utils.types import (
NodeInput,
as_nodes,
as_node,
Expand Down
Loading

0 comments on commit 0497b0b

Please sign in to comment.