Skip to content

fix: correct stop_sequence -> stop_sequences typo in _continuous_greedy_until#1300

Open
RudrenduPaul wants to merge 1 commit into
huggingface:mainfrom
RudrenduPaul:fix/stop-sequences-typo-888
Open

fix: correct stop_sequence -> stop_sequences typo in _continuous_greedy_until#1300
RudrenduPaul wants to merge 1 commit into
huggingface:mainfrom
RudrenduPaul:fix/stop-sequences-typo-888

Conversation

@RudrenduPaul

Copy link
Copy Markdown

Closes #888

What this PR does

Fixes a typo in TransformersModel._continuous_greedy_until where the code
read split[0].stop_sequence (singular) instead of split[0].stop_sequences
(plural). The Doc/request object only defines a stop_sequences field
(src/lighteval/tasks/requests.py), so the singular access either raises an
AttributeError or silently returns None depending on the object type,
breaking stop-sequence handling for continuous batching generation.

Root cause

src/lighteval/models/transformers/transformers_model.py, inside
_continuous_greedy_until, builds stop_tokens from the first item in the
batch:

# before
stop_tokens = split[0].stop_sequence

# after
stop_tokens = split[0].stop_sequences

The correct attribute name (stop_sequences) is already used consistently
elsewhere in the same file (e.g. _generate uses
batch[0].stop_sequences), confirming this was a one-off typo rather than
an intentional different field.

Change

Single-line fix in src/lighteval/models/transformers/transformers_model.py
(line 561). No other file references the typo'd singular form, so this is
the only place that needed updating.

Verification

  • Confirmed stop_sequences (plural) is the actual field defined on the
    request/Doc object in src/lighteval/tasks/requests.py.
  • Confirmed via grep that no other code path in
    transformers_model.py references the singular .stop_sequence typo.
  • ruff format --check and ruff check both pass on the changed file.

Note: Claude Code was used to assist in drafting this fix. All changes were reviewed by the submitter.

The Doc/request object exposes stop_sequences (plural), so split[0].stop_sequence
raised an AttributeError when continuous batching generation tried to read stop
tokens.

Fixes huggingface#888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] : Typo in _continuous_greedy_until causes error with stop_sequence field

1 participant