Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Update Tokenizer Overrides Handling in models.py #1549

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mhenrichsen
Copy link
Collaborator

Example:

tokenizer_overrides:
  - 28006: <|im_start|>
  - 28007: <|im_end|>

Description:

This PR introduces an enhancement to the way we handle tokenizer overrides in our models.py file.

Previously, the code did not account for the possibility of a token override not being found in the tokenizer's special tokens. This could potentially lead to silent failures where an override is skipped without any indication to the user.

The updated code now includes a check for each key in the cfg.tokenizer_overrides dictionary within the tokenizer.all_special_tokens list. If a match is found, the corresponding token's content is updated with the override value.

This change ensures that our tokenizer correctly applies all specified overrides, improving the robustness and reliability of our tokenization process.

@mhenrichsen mhenrichsen changed the title Update Tokenizer Overrides Handling in models.py MOCK: Update Tokenizer Overrides Handling in models.py Apr 19, 2024
@mhenrichsen mhenrichsen changed the title MOCK: Update Tokenizer Overrides Handling in models.py Draft: Update Tokenizer Overrides Handling in models.py Apr 19, 2024
Copy link
Collaborator

@winglian winglian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!! this was on my todo list too.

@NanoCode012
Copy link
Collaborator

Could a unit test be added for this?

@winglian
Copy link
Collaborator

@mhenrichsen played around with this today. The tokenizer seems to be frozen, especially for llama 3 where this would be more useful.

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.

None yet

3 participants