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

Unusable and does not match with token output from GPT-3 #9

Open
nullreferencez opened this issue Mar 11, 2022 · 6 comments
Open

Unusable and does not match with token output from GPT-3 #9

nullreferencez opened this issue Mar 11, 2022 · 6 comments

Comments

@nullreferencez
Copy link

When a character like “ is used it will give back a faulty output as shown below.

encode('“wrote jack a letter”');

[null,222,250, 42910,14509,257,3850,null,222,251]

Whereas on openai it will give the output as:

[447, 250, 42910, 14509, 257, 3850, 447, 251]

This can be triggered by other characters like █ and many more.

syonfox pushed a commit to syonfox/gptoken that referenced this issue Dec 25, 2022
It seems to work fine
@syonfox
Copy link

syonfox commented Dec 25, 2022

Hmm maybe somone else fixed that but it seems to work fine in the latest version see the added test
can probably close this

@syonfox
Copy link

syonfox commented Dec 25, 2022

@niieani
Copy link

niieani commented May 24, 2023

That's because this encoder is actually for the older models. Doesn't match up with gpt-3.5-turbo or gpt-4.
If you want better accuracy for these newer models, see my package that started off as a fork of this one: gpt-tokenizer.

@seyfer
Copy link

seyfer commented Sep 25, 2023

@niieani wdyt about this one? https://github.com/dqbd/tiktoken
is your implementation better?

@syonfox
Copy link

syonfox commented Sep 25, 2023

hmm i cant reproduce build looks promising though

syonfox#6

notable pros no ts :)
i think my build works
simple only one version
good enough estimation

@niieani
Copy link

niieani commented Sep 25, 2023

@seyfer Tiktoken JS looks good too. My gpt-tokenizer has a few extra features though that might be useful to you (like checking whether a given text is within the token limit or not).

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

4 participants