Skip to content

Commit

Permalink
Update utils.py (#1256)
Browse files Browse the repository at this point in the history
  • Loading branch information
philschmid authored Jan 22, 2024
1 parent 222d275 commit a3c5b71
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions trl/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,10 @@ def setup_chat_format(
model.resize_token_embeddings(
len(tokenizer), pad_to_multiple_of=resize_to_multiple_of if resize_to_multiple_of is not None else None
)
# Make sure to update the generation config to use the new eos & bos token
if getattr(model, "generation_config", None) is not None:
model.generation_config.bos_token_id = tokenizer.bos_token_id
model.generation_config.eos_token_id = tokenizer.eos_token_id
model.generation_config.pad_token_id = tokenizer.pad_token_id

return model, tokenizer

0 comments on commit a3c5b71

Please sign in to comment.