Skip to content

fix(generation): remove stale warning for num_return_sequences in paged generate#45575

Closed
CodersAcademy006 wants to merge 1 commit intohuggingface:mainfrom
CodersAcademy006:fix/paged-generate-stale-num-return-sequences-warning
Closed

fix(generation): remove stale warning for num_return_sequences in paged generate#45575
CodersAcademy006 wants to merge 1 commit intohuggingface:mainfrom
CodersAcademy006:fix/paged-generate-stale-num-return-sequences-warning

Conversation

@CodersAcademy006
Copy link
Copy Markdown

Fixes #45563.

generate(..., cache_implementation=paged) incorrectly warned that num_return_sequences is unsupported for continuous batching. This warning is stale: generate_batch() already uses generation_config.num_return_sequences to expand the number of requests.

Changes: Split the guard in src/transformers/generation/utils.py — keep warning only for num_beams > 1 (beam search is genuinely unsupported), remove the warning for num_return_sequences.

Test plan:

  • generate(..., cache_implementation=paged, num_return_sequences=2) no longer emits warning
  • generate(..., cache_implementation=paged, num_beams=2) still emits warning

Reference: oleksii-tumanov@f7a939d

…ed generate

Closes huggingface#45563. generate_batch() already uses generation_config.num_return_sequences
to expand the number of requests, so warning that num_return_sequences is
unsupported for continuous batching is incorrect.

Split the check: keep the warning only for num_beams > 1 (beam search is
genuinely unsupported), remove it for num_return_sequences.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Paged generate() emits a stale warning for num_return_sequences

2 participants