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

Support for gpt-turbo-3.5 cl100k_base encoding #6

Open
deepak-coding-art opened this issue Mar 19, 2023 · 5 comments
Open

Support for gpt-turbo-3.5 cl100k_base encoding #6

deepak-coding-art opened this issue Mar 19, 2023 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@deepak-coding-art
Copy link

Does the package support the cl100k_base encoding with is used in chat-gpt

@syonfox
Copy link
Owner

syonfox commented Mar 20, 2023

hello world
Encoded: [31373,995]

https://github.com/openai/tiktoken/blob/main/tests/test_simple_public.py

This matches the gpt2 encoding schema. SO it is probably not the same and we would need the updated vocab.bpe

and encoder map to support the new version this is probably also why the encoding length is off. I would say its probably fine to use for estimation but I would not rely on it for the more complicated models until We can find and implement the new version that is used for embeddings.

https://news.ycombinator.com/item?id=34008839

some more info on tokenizers used by openai

@syonfox
Copy link
Owner

syonfox commented Mar 20, 2023

TODO extract for 100k data from tokenizer, compile the rust lib to webasemably or reimplement in c++

I am going to put this on hold because it's a good enough approximation for front-end user input validation if we add a 5-10% buffer but it would be nice to have a js implementation of the new version. If anyone wants to help with that I would appreciate it. Even just building the python version and dumping the data so some json files ...

Thanks

@syonfox syonfox added enhancement New feature or request help wanted Extra attention is needed labels Mar 20, 2023
@syonfox
Copy link
Owner

syonfox commented Apr 17, 2023

7013e40

I have added the data from

https://community.openai.com/t/how-do-you-make-a-bpe-file-for-tokenizer/94752/13

https://github.com/blinkdata/c-tokenizer

We still need to process this into js and add a new Encoder.js

@dbjpanda
Copy link

Hi any update on this please?

@syonfox
Copy link
Owner

syonfox commented Sep 26, 2023

The repository linked jas a ts script for loading the vocab files

It's worth stealing some of the implementation as the js project looks relatively clean. just the tooling is a bit bloated

the encoding seems to be here

https://github.com/dqbd/tiktoken/blob/072dd12962cabeca67c5088e3d8a8d006af19482/scripts/ranks.ts#L5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants