Skip to content

Commit

Permalink
export part poc
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova committed Jun 24, 2024
1 parent 3ec8166 commit e710da5
Showing 3 changed files with 1 addition and 7 deletions.
5 changes: 0 additions & 5 deletions optimum/exporters/openvino/model_configs.py
Original file line number Diff line number Diff line change
@@ -15,8 +15,6 @@
from copy import deepcopy
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
from optimum.exporters.onnx.base import ConfigBehavior
import logging
logger = logging.getLogger(__name__)

from packaging import version
from transformers import PretrainedConfig
@@ -836,7 +834,6 @@ def patch_model_for_export(
class WhisperOpenVINOConfig(WhisperOnnxConfig):
def __init__(self, config: PretrainedConfig, task: str = "feature-extraction", int_dtype: str = "int64", float_dtype: str = "fp32", use_past: bool = False, use_past_in_inputs: bool = False, behavior: ConfigBehavior = ConfigBehavior.MONOLITH, preprocessors: Optional[List[Any]] = None, legacy: bool = False, stateful: bool = False):
self.stateful = stateful
logger.warn(f"config stateful: {self.stateful}")
super().__init__(config, task, int_dtype, float_dtype, use_past, use_past_in_inputs, behavior, preprocessors, legacy)


@@ -847,12 +844,10 @@ def _create_dummy_input_generator_classes(self, **kwargs) -> List[DummyInputGene
forces the other generators to use the same batch size, meaning they will all produce inputs of the same batch
size. Override this method for custom behavior.
"""
logger.warn(f"config stateful: {self.stateful}")
if self.stateful:
if "encoder_sequence_length" not in kwargs:
sequence_len = kwargs.get("sequence_length", DEFAULT_DUMMY_SHAPES["sequence_length"])
kwargs["encoder_sequence_length"] = sequence_len + 2
logger.warn(kwargs)
return super()._create_dummy_input_generator_classes(**kwargs)

def with_behavior(
1 change: 0 additions & 1 deletion optimum/exporters/openvino/stateful.py
Original file line number Diff line number Diff line change
@@ -196,7 +196,6 @@ def ensure_export_task_support_stateful(task: str, is_encoder_decoder:bool = Fal
)

is_stateful = task.endswith("-with-past") and task.replace("-with-past", "") in _ENCODER_DECODER_TASKS_WITH_PAST
log.warn(f"is_stateful {is_stateful}")
return is_stateful


2 changes: 1 addition & 1 deletion optimum/intel/openvino/modeling_base_seq2seq.py
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ def _save_pretrained(self, save_directory: Union[str, Path]):
"""
src_files = [self.encoder_model, self.decoder_model]
dst_file_names = [OV_ENCODER_NAME, OV_DECODER_NAME]
if self.use_cache:
if self.decoder_with_past_model is not None:
src_files.append(self.decoder_with_past_model)
dst_file_names.append(OV_DECODER_WITH_PAST_NAME)

0 comments on commit e710da5

Please sign in to comment.