Skip to content

Commit

Permalink
Added config options to enable openvino configs
Browse files Browse the repository at this point in the history
  • Loading branch information
suryasidd committed Nov 8, 2023
1 parent a53f633 commit 68e2bd5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 68e2bd5

Please sign in to comment.