From cc309fd4061384b90ad9161565bc23d0c6936029 Mon Sep 17 00:00:00 2001 From: Raushan Turganbay Date: Thu, 8 Feb 2024 20:38:29 +0500 Subject: [PATCH] pass kwargs in stopping criteria list (#28927) --- src/transformers/generation/stopping_criteria.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformers/generation/stopping_criteria.py b/src/transformers/generation/stopping_criteria.py index 18764ac94d9129..ca3e8509644081 100644 --- a/src/transformers/generation/stopping_criteria.py +++ b/src/transformers/generation/stopping_criteria.py @@ -129,7 +129,7 @@ def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwa class StoppingCriteriaList(list): @add_start_docstrings(STOPPING_CRITERIA_INPUTS_DOCSTRING) def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool: - return any(criteria(input_ids, scores) for criteria in self) + return any(criteria(input_ids, scores, **kwargs) for criteria in self) @property def max_length(self) -> Optional[int]: