From ad4c4f8b4f2db5538bd6f4e0acb0781532504f27 Mon Sep 17 00:00:00 2001 From: Joaquin Hui Gomez Date: Wed, 22 Apr 2026 16:50:49 +0100 Subject: [PATCH 1/2] generate: drop stale num_return_sequences warning on continuous batching path The continuous-batching branch warned that num_return_sequences was unsupported alongside num_beams, but generate_batch() already honors generation_config.num_return_sequences when expanding requests. The warning fires for any run that explicitly sets num_return_sequences even though the feature works, cluttering logs and misleading users. Drop the num_return_sequences half of the warning; keep the num_beams guard since beam search is still unsupported on the CB path. Fixes #45563 --- src/transformers/generation/utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/transformers/generation/utils.py b/src/transformers/generation/utils.py index 7439722c60b9..6ef30bc742a5 100644 --- a/src/transformers/generation/utils.py +++ b/src/transformers/generation/utils.py @@ -2303,12 +2303,10 @@ def generate( # others are ignored if synced_gpus is not None: logger.warning(f"synced_gpus is not ignored for continuous batching. Got {synced_gpus = }") - num_return_sequences = kwargs.get("num_return_sequences", 1) num_beams = kwargs.get("num_beams", 1) - if num_return_sequences > 1 or num_beams > 1: # FIXME: remove this once CB supports it (which is planned) + if num_beams > 1: # FIXME: remove this once CB supports num_beams (which is planned) logger.warning( - f"num_return_sequences and num_beams are not supported for continuous batching yet. " - f"Got {num_return_sequences = } and {num_beams = }. " + f"num_beams is not supported for continuous batching yet. Got {num_beams = }. " ) # switch to CB From bb1877221c011bedcf88f3cb6f70bc9645d64d5a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 23 Apr 2026 06:20:55 +0000 Subject: [PATCH 2/2] Apply repo consistency fixes --- setup.py | 2 +- src/transformers/generation/utils.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index d5daf2875bf8..2e6adca0315c 100644 --- a/setup.py +++ b/setup.py @@ -328,7 +328,7 @@ def run(self): setup( name="transformers", - version="5.6.0.dev0", # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots) + version="5.7.0.dev0", # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots) author="The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/transformers/graphs/contributors)", author_email="transformers@huggingface.co", description="Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.", diff --git a/src/transformers/generation/utils.py b/src/transformers/generation/utils.py index 6ef30bc742a5..388cef73566a 100644 --- a/src/transformers/generation/utils.py +++ b/src/transformers/generation/utils.py @@ -2305,9 +2305,7 @@ def generate( logger.warning(f"synced_gpus is not ignored for continuous batching. Got {synced_gpus = }") num_beams = kwargs.get("num_beams", 1) if num_beams > 1: # FIXME: remove this once CB supports num_beams (which is planned) - logger.warning( - f"num_beams is not supported for continuous batching yet. Got {num_beams = }. " - ) + logger.warning(f"num_beams is not supported for continuous batching yet. Got {num_beams = }. ") # switch to CB outputs = self.generate_batch(