diff --git a/gemma/gm/text/_sampler.py b/gemma/gm/text/_sampler.py index 944671a3..df14eecc 100644 --- a/gemma/gm/text/_sampler.py +++ b/gemma/gm/text/_sampler.py @@ -572,7 +572,7 @@ def _normalize_token(tokenizer, token: str | int) -> int: token_id = tokenizer.encode(token) if len(token_id) != 1: raise ValueError( - 'Invalid token: {token!r}. `stop_token`s and `forbidden_token`s must' + f'Invalid token: {token!r}. `stop_token`s and `forbidden_token`s must' ' map to single token ids in the vocab.' ) (token_id,) = token_id diff --git a/gemma/research/t5gemma/sampling.py b/gemma/research/t5gemma/sampling.py index 84a16ac4..85415f36 100644 --- a/gemma/research/t5gemma/sampling.py +++ b/gemma/research/t5gemma/sampling.py @@ -510,7 +510,7 @@ def _normalize_token(tokenizer, token: str | int) -> int: token_id = tokenizer.encode(token) if len(token_id) != 1: raise ValueError( - 'Invalid forbidden token: {token!r}. Forbidden tokens must map to' + f'Invalid forbidden token: {token!r}. Forbidden tokens must map to' ' single token ids in the vocab.' ) (token_id,) = token_id