From c2f61b53cea6f4c9ed7f89d7b7770f614174bfa4 Mon Sep 17 00:00:00 2001 From: Ella Charlaix Date: Tue, 9 Jan 2024 15:18:44 +0100 Subject: [PATCH] fix format --- optimum/intel/openvino/modeling_base.py | 5 +++-- optimum/intel/openvino/modeling_base_seq2seq.py | 2 +- optimum/intel/openvino/modeling_decoder.py | 2 +- optimum/intel/openvino/modeling_seq2seq.py | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/optimum/intel/openvino/modeling_base.py b/optimum/intel/openvino/modeling_base.py index d6c168d401..d6f46aee9e 100644 --- a/optimum/intel/openvino/modeling_base.py +++ b/optimum/intel/openvino/modeling_base.py @@ -22,8 +22,9 @@ from huggingface_hub import hf_hub_download from openvino import Core, convert_model from openvino._offline_transformations import apply_moc_transformations, compress_model_transformation -from transformers import PretrainedConfig, GenerationConfig +from transformers import GenerationConfig, PretrainedConfig from transformers.file_utils import add_start_docstrings +from transformers.generation import GenerationMixin from optimum.exporters.onnx import OnnxConfig from optimum.modeling_base import OptimizedModel @@ -31,7 +32,7 @@ from ...exporters.openvino import export, main_export from ..utils.import_utils import is_nncf_available from .utils import ONNX_WEIGHTS_NAME, OV_XML_FILE_NAME, _print_compiled_model_properties -from transformers.generation import GenerationMixin + core = Core() diff --git a/optimum/intel/openvino/modeling_base_seq2seq.py b/optimum/intel/openvino/modeling_base_seq2seq.py index 1790bc3dee..4870e331ed 100644 --- a/optimum/intel/openvino/modeling_base_seq2seq.py +++ b/optimum/intel/openvino/modeling_base_seq2seq.py @@ -21,7 +21,7 @@ import openvino from huggingface_hub import hf_hub_download from openvino._offline_transformations import apply_moc_transformations, compress_model_transformation -from transformers import PretrainedConfig, GenerationConfig +from transformers import GenerationConfig, PretrainedConfig from transformers.file_utils import add_start_docstrings from ...exporters.openvino import main_export diff --git a/optimum/intel/openvino/modeling_decoder.py b/optimum/intel/openvino/modeling_decoder.py index b5dde5e638..8f9c36d457 100644 --- a/optimum/intel/openvino/modeling_decoder.py +++ b/optimum/intel/openvino/modeling_decoder.py @@ -25,6 +25,7 @@ from openvino.runtime import Core, Tensor, Type from transformers import AutoModelForCausalLM, PretrainedConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward +from transformers.generation import GenerationMixin from transformers.modeling_outputs import CausalLMOutputWithPast from optimum.utils import NormalizedConfigManager @@ -33,7 +34,6 @@ from ..utils.modeling_utils import MULTI_QUERY_ATTN_MODELS from .modeling import _TOKENIZER_FOR_DOC, INPUTS_DOCSTRING, MODEL_START_DOCSTRING, OVModel from .utils import ONNX_WEIGHTS_NAME, OV_XML_FILE_NAME, STR_TO_OV_TYPE -from transformers.generation import GenerationMixin logger = logging.getLogger(__name__) diff --git a/optimum/intel/openvino/modeling_seq2seq.py b/optimum/intel/openvino/modeling_seq2seq.py index b26932c41d..432533840b 100644 --- a/optimum/intel/openvino/modeling_seq2seq.py +++ b/optimum/intel/openvino/modeling_seq2seq.py @@ -32,13 +32,13 @@ WhisperForConditionalGeneration, ) from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward +from transformers.generation import GenerationMixin from transformers.generation.logits_process import WhisperTimeStampLogitsProcessor from transformers.modeling_outputs import BaseModelOutput, Seq2SeqLMOutput from transformers.models.whisper.tokenization_whisper import TASK_IDS, TO_LANGUAGE_CODE from .modeling_base_seq2seq import OVBaseModelForSeq2SeqLM from .utils import _print_compiled_model_properties -from transformers.generation import GenerationMixin if TYPE_CHECKING: