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

Unexpected Ċ, Ġ and D characters with Llama 3.3 Instruct 70b #142

Closed
lemmi opened this issue Dec 9, 2024 · 4 comments
Closed

Unexpected Ċ, Ġ and D characters with Llama 3.3 Instruct 70b #142

lemmi opened this issue Dec 9, 2024 · 4 comments

Comments

@lemmi
Copy link
Contributor

lemmi commented Dec 9, 2024

This has been reported before in #99, but the suggested fix to replace all characters causes an error:

Traceback (most recent call last):
  File "/home/llama/distributed-llama/converter/convert-tokenizer-hf.py", line 83, in <module>
    resolver.resolve()
  File "/home/llama/distributed-llama/converter/convert-tokenizer-hf.py", line 61, in resolve
    return self.resolvePreTrainedTokenizerFast()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/llama/distributed-llama/converter/convert-tokenizer-hf.py", line 26, in resolvePreTrainedTokenizerFast
    assert(tokenizer['model']['vocab'][token] == i)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

Using a tokenizer from another llama model seems to work, but I'm not sure it actually maps correctly in every case.

One thing I found was this:

Spaces are converted in a special character (the Ġ ) in the tokenizer prior to BPE splitting mostly to avoid digesting spaces since the standard BPE algorithm used spaces in its process (this can seem a bit hacky but was in the original GPT2 tokenizer implementation by OpenAI).

@b4rtaz
Copy link
Owner

b4rtaz commented Dec 9, 2024

Hello @lemmi,

this is a well-known problem. So far, I have solved it by manually replacing characters in the source file (like Ġ => ) before the convertion.

@b4rtaz
Copy link
Owner

b4rtaz commented Feb 14, 2025

You can now download a new tokenizer from Hugging Face. Updated tokenizers don’t have this problem.

@b4rtaz b4rtaz closed this as completed Feb 14, 2025
@lemmi
Copy link
Contributor Author

lemmi commented Feb 15, 2025

Looks good so far, thank you :)

@b4rtaz
Copy link
Owner

b4rtaz commented Feb 16, 2025

@lemmi I would recommend upgrading Distributed Llama; there were a lot of fixes in the tokenizer implementation.

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

No branches or pull requests

2 participants