Add add_end_token to the Gemma Tokenizer
Llama3 Tokenizer was updated to support add_end_token in tokenize_messages to support correct generation https://github.com/pytorch/torchtune/pull/1494. These changes need to be made for gemma.
Changes:
- Update tokenize_message to use add_start_tokens and add_end_tokens like in https://github.com/pytorch/torchtune/pull/1494
- Replace add_eos with add_end_tokens and update tokenize_messages as in https://github.com/pytorch/torchtune/pull/1494
- In call update tokens, mask = self.tokenize_messages(messages) to tokens, mask = self.tokenize_messages(messages, add_end_tokens=not inference)
/assign
Hey, I'll try to work on this : )
I took a look and I think this is already done apparently. But we are using add_eos instead of add_end_tokens. If that's a problem I can raise an issue.
Hi, I took a look and opened a PR for this: https://github.com/meta-pytorch/torchtune/pull/2969
Hi, I'd like to work on this good first issue if it's still available.
The changes needed are clear from the Llama3 tokenizer PR #1494:
- Update
tokenize_messageto useadd_start_tokens/add_end_tokensparameters - Replace
add_eoswithadd_end_tokensand updatetokenize_messagesaccordingly - In
__call__, update totokens, mask = self.tokenize_messages(messages, add_end_tokens=not inference)
Could I be assigned? I'll keep the changes consistent with the Llama3 tokenizer pattern and add tests for the inference vs. training paths.
@pbontrager — I missed that @ofeliacode already has PR #2969 open for this. Withdrawing my earlier comment — I'll review the PR and leave any feedback there instead.