Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions utf8_tokenizer/char_causal_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,10 @@ def _truncate_at_eos(

@staticmethod
def _get_generation_params(generation_config: GenerationConfig | None) -> tuple[int, int]:
"""Extract max_new_tokens and min_new_tokens from generation config."""
if generation_config is None:
generation_config = GenerationConfig()
"""Extract max_new_tokens and min_new_tokens from generation config.

A missing config behaves like a default one: getattr falls back to None either way.
"""
max_new_tokens = getattr(generation_config, 'max_new_tokens', None) or 50
min_new_tokens = getattr(generation_config, 'min_new_tokens', None) or 0
return max_new_tokens, min_new_tokens
Expand Down