Skip to content

Commit

Permalink
Fix openvino model inference for transformers >= v4.29.3 (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
echarlaix committed May 31, 2023
1 parent 7019728 commit 2c8eb3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion optimum/intel/openvino/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,17 @@
}


# workaround to enable compatibility between openvino models and transformers pipelines
class PreTrainedModel(OptimizedModel):
pass


@add_start_docstrings(
"""
Base OVModel class.
""",
)
class OVBaseModel(OptimizedModel):
class OVBaseModel(PreTrainedModel):
_AUTOMODELS_TO_TASKS = {cls_name: task for task, cls_name in TasksManager._TASKS_TO_AUTOMODELS.items()}
auto_model_class = None
export_feature = None
Expand Down
2 changes: 2 additions & 0 deletions optimum/intel/openvino/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def __init__(

self.compression_controller, self.model = create_compressed_model(self.model, nncf_config)
self.model_wrapped = self.model
# TODO : To deprecate once support transformers > 4.30.0
self.deepspeed = None

def _set_signature_columns_if_needed(self):
if self._signature_columns is None:
Expand Down

0 comments on commit 2c8eb3a

Please sign in to comment.