Unverified Commit 79132145 authored by Raushan Turganbay's avatar Raushan Turganbay Committed by GitHub
Browse files

Fix: remove `pad token id` in pipeline forward arguments (#30285)

parent df964384
...@@ -888,11 +888,6 @@ class Pipeline(_ScikitCompat, PushToHubMixin): ...@@ -888,11 +888,6 @@ class Pipeline(_ScikitCompat, PushToHubMixin):
if self.model.can_generate(): if self.model.can_generate():
self.model.generation_config.update(**task_specific_params.get(task)) self.model.generation_config.update(**task_specific_params.get(task))
self.call_count = 0
self._batch_size = kwargs.pop("batch_size", None)
self._num_workers = kwargs.pop("num_workers", None)
self._preprocess_params, self._forward_params, self._postprocess_params = self._sanitize_parameters(**kwargs)
# Pipelines calling `generate`: if the tokenizer has a pad token but the model doesn't, set it in the # Pipelines calling `generate`: if the tokenizer has a pad token but the model doesn't, set it in the
# forward params so that `generate` is aware of the pad token. # forward params so that `generate` is aware of the pad token.
if ( if (
...@@ -901,7 +896,12 @@ class Pipeline(_ScikitCompat, PushToHubMixin): ...@@ -901,7 +896,12 @@ class Pipeline(_ScikitCompat, PushToHubMixin):
and self.tokenizer.pad_token_id is not None and self.tokenizer.pad_token_id is not None
and self.model.generation_config.pad_token_id is None and self.model.generation_config.pad_token_id is None
): ):
self._forward_params["pad_token_id"] = self.tokenizer.pad_token_id kwargs["pad_token_id"] = self.tokenizer.pad_token_id
self.call_count = 0
self._batch_size = kwargs.pop("batch_size", None)
self._num_workers = kwargs.pop("num_workers", None)
self._preprocess_params, self._forward_params, self._postprocess_params = self._sanitize_parameters(**kwargs)
if self.image_processor is None and self.feature_extractor is not None: if self.image_processor is None and self.feature_extractor is not None:
if isinstance(self.feature_extractor, BaseImageProcessor): if isinstance(self.feature_extractor, BaseImageProcessor):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment