diff --git a/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend_utils.py b/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend_utils.py index 3cdfab5393392a..f45c2b29975521 100644 --- a/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend_utils.py +++ b/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend_utils.py @@ -44,3 +44,7 @@ def _get_model_caching(options) -> Optional[Any]: return options["model_caching"] else: return os.getenv("OPENVINO_TORCH_MODEL_CACHING") + +def _get_config(options) -> Optional[Any]: + if options is not None and "config" in options: + return options["config"] \ No newline at end of file diff --git a/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/compile.py b/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/compile.py index c6ca13cf9f80c8..6fe8264f9832d2 100644 --- a/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/compile.py +++ b/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/compile.py @@ -15,7 +15,7 @@ from openvino.frontend import FrontEndManager from openvino.frontend.pytorch.fx_decoder import TorchFXPythonDecoder from openvino.runtime import Core, Type, PartialShape, serialize -from openvino.frontend.pytorch.torchdynamo.backend_utils import _get_cache_dir, _get_device +from openvino.frontend.pytorch.torchdynamo.backend_utils import _get_cache_dir, _get_device, _get_config from typing import Callable, Optional @@ -65,6 +65,12 @@ def openvino_compile_cached_model(cached_model_path, *example_inputs, options): core.set_property({'CACHE_DIR': _get_cache_dir(options) + '/blob'}) + config = _get_config(options) + + if config: + for config_name, value in config.items(): + core.set_property({config_name: value}) + compiled_model = core.compile_model(om, _get_device(options)) return compiled_model