Skip to content

Commit

Permalink
avoid import onnx in modeling_base and stateful
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova committed Dec 4, 2024
1 parent e26f516 commit 97e9141
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion optimum/exporters/openvino/stateful.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import openvino as ov
from openvino.runtime import opset13
from optimum.exporters import TasksManager
from optimum.intel.utils.import_utils import _openvino_version, is_openvino_version, is_transformers_version

from .utils import MULTI_MODAL_TEXT_GENERATION_MODELS
Expand Down Expand Up @@ -192,6 +191,8 @@ def ensure_stateful_is_available(warn=True):


def ensure_export_task_support_stateful(task: str):
from optimum.exporters import TasksManager

task = TasksManager.map_from_synonym(task)
return task in ["text-generation-with-past"]

Expand Down
4 changes: 2 additions & 2 deletions optimum/intel/openvino/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from transformers.generation import GenerationMixin
from transformers.utils import is_offline_mode

from optimum.exporters.onnx import OnnxConfig
from optimum.exporters.base import ExportConfig
from optimum.modeling_base import FROM_PRETRAINED_START_DOCSTRING, OptimizedModel

from ...exporters.openvino import export, main_export
Expand Down Expand Up @@ -623,7 +623,7 @@ def _to_load(
cls,
model,
config: PretrainedConfig,
onnx_config: OnnxConfig,
onnx_config: ExportConfig,
token: Optional[Union[bool, str]] = None,
revision: Optional[str] = None,
force_download: bool = False,
Expand Down

0 comments on commit 97e9141

Please sign in to comment.