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

Open
lemmi opened this issue Dec 9, 2024 · 1 comment
Open

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

lemmi opened this issue Dec 9, 2024 · 1 comment

Comments

@lemmi
Copy link

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.

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