From 75357d3ff36a870730afc17a6a9ab3affcc6c050 Mon Sep 17 00:00:00 2001 From: Ilyas Moutawwakil <57442720+IlyasMoutawwakil@users.noreply.github.com> Date: Fri, 5 Jul 2024 16:37:42 +0200 Subject: [PATCH] Pin library name to transformers for feature extraction (#804) --- optimum/intel/ipex/modeling_base.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/optimum/intel/ipex/modeling_base.py b/optimum/intel/ipex/modeling_base.py index 5a53445469..b9f9a708da 100644 --- a/optimum/intel/ipex/modeling_base.py +++ b/optimum/intel/ipex/modeling_base.py @@ -232,6 +232,7 @@ def _from_pretrained( model = TasksManager.get_model_from_task( task, model_id, + library_name="transformers", trust_remote_code=trust_remote_code, torch_dtype=torch_dtype, _commit_hash=commit_hash, @@ -267,6 +268,7 @@ def forward( input_ids: torch.Tensor, attention_mask: torch.Tensor, token_type_ids: torch.Tensor = None, + position_ids: torch.Tensor = None, **kwargs, ): inputs = { @@ -277,6 +279,9 @@ def forward( if "token_type_ids" in self.input_names: inputs["token_type_ids"] = token_type_ids + if "position_ids" in self.input_names: + inputs["position_ids"] = position_ids + outputs = self._call_model(**inputs) if isinstance(outputs, dict): model_output = ModelOutput(**outputs)