Changed convert-pt-to-ggml.py to use .tiktoken tokenizer files #725
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes my issue #724
Changed the way vocabulary is read and converted to ggml. Used the same code as in original tiktoken library.
The resulting ggml files are the same as ones downloaded from huggingface. For multilingual exactly the same, for en only there is a difference of 17 bytes, due to the difference in whisper's vocab files.
In the old vocab.json there are 50257 tokens, the last one
<|endoftext|>
with index 50256. In the new gpt2.tiktoken there are only 50256 tokens, the endoftext is removed. 4 bytes for the int storing string length + 13 bytes for the string itself = 17 byte difference. It doesn't seem to make a difference in the model output anyway, not sure why this token was in the vocab.json previously, since it is probably a special token.I have only tested with tiny models, but the only change is in the tokenizer so it should work for all the others.