Skip to content

Enable detokenizing special tokens - #1596

Merged
abetlen merged 6 commits into
abetlen:mainfrom
benniekiss:detokenize_special
Aug 29, 2024
Merged

abetlen merged 6 commits into
abetlen:mainfrom
benniekiss:detokenize_special

Conversation

@benniekiss

Copy link
Copy Markdown
Contributor

I noticed that it was not possible to detokenize special tokens, such as the EOS token, when using Phi-3(.1). This PR makes sure that the special flag can be passed to the detokenize() method of both the LlamaTokenizer and the LlamaHFTokenizer

I also noticed that prev_tokens was not being used in the detokenize method of LlamaTokenizer, so this PR also adds that functionality based on LlamaHFTokenizer

@benniekiss

Copy link
Copy Markdown
Contributor Author

Hey @abetlen , when you get a chance, would you give this a review?

@abetlen

abetlen commented Aug 29, 2024

Copy link
Copy Markdown
Owner

Hey @benniekiss thank you for the contribution!

I reverted the changes to prev_token in the LlamaTokenizer and changed special to default to False everywhere to avoid any possible breaking changes. Hope this works for you!

@abetlen
abetlen merged commit d981d32 into abetlen:main Aug 29, 2024
@benniekiss

Copy link
Copy Markdown
Contributor Author

That's perfect! Thank you for taking the time to review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants