Comments (2)
Thank you very much!
Looking at the TikToken code, I finally understand what is going on. The encoding depends on the mode, not just on the model. I am using the text
mode (aka completion), and the encoding is p50k_base
. If I were to use the chat
mode instead, the encoding would be cl100k_base
.
Azure OpenAI offers gpt-35-turbo
in text
mode (while seemingly OpenAI does not, offering only chat
), this case is not listed in the TikToken code, but it stands to reason that it must also be p50k_base
.
from sharptoken.
Hello @vermorel !
Thanks for reaching out!!
I checked with original tiktoken library, here is it's result:
As far as I see, for model r50k_base, p50k_base, p50k_edit Number of tokens is 549, for model cl100k_base number of tokens is 219.
I double checked in the original tiktoken source code, "gpt-35-turbo" is mapped to "cl100k_base" model. Here is a proof: https://github.com/openai/tiktoken/blob/5d970c1100d3210b42497203d6b5c1e30cfda6cb/tiktoken/model.py#L10
So I would say that on the website that you shared. it uses model "..50k.." for "gpt3".
So I would say that SharpToken works correctly :)
Btw, I added your example to the testplan: https://github.com/dmitry-brazhenko/SharpToken/blob/main/SharpToken.Tests/data/TestPlans.txt
Please let me know if I am wrong :)
from sharptoken.
Related Issues (13)
- outdated lib Newtonsoft HOT 1
- gpt-3.5-turbo-16k Not Supported HOT 1
- Performance compared to TiktokenSharp, Tokenizer HOT 7
- Implement MODEL_PREFIX_FOR_ENCODING HOT 2
- New embedding models not recognized HOT 11
- Add Microsoft.SourceLink.GitHub to publish repo info/commit to nuget.org HOT 1
- GptEncoding thread-safe? HOT 4
- Anthropic (claude) support HOT 5
- cohere support
- o200k_base support HOT 1
- Gbt4o support
- Missing model name for 3.5 turbo Azure Deployment model HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sharptoken.