Skip to content

Commit 7c369a6

Browse files
fix: add missing f-prefix in _normalize_token() error message
The error message was a plain string, causing {token!r} to be printed literally instead of interpolating the actual token value. This makes debugging stop_tokens / forbidden_tokens misconfigurations impossible. Fixes #658
1 parent 5621d2d commit 7c369a6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

gemma/gm/text/_sampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ def _normalize_token(tokenizer, token: str | int) -> int:
577577
token_id = tokenizer.encode(token)
578578
if len(token_id) != 1:
579579
raise ValueError(
580-
'Invalid token: {token!r}. `stop_token`s and `forbidden_token`s must'
580+
f'Invalid token: {token!r}. `stop_token`s and `forbidden_token`s must'
581581
' map to single token ids in the vocab.'
582582
)
583583
(token_id,) = token_id

0 commit comments

Comments
 (0)