Comments (5)
You can create your own Encoding object by passing in a dict from token-bytes to the integer token value.
See this:
Line 10 in 4226a6c
You can see examples of the arguments passed to the constructor here:
tiktoken/tiktoken_ext/openai_public.py
Line 15 in 4226a6c
from tiktoken.
If you want to have your own encoding registered so that tiktoken.get_encoding(...)
works, you can create a new submodule under the tiktoken_ext
namespace. This ability to extend tiktoken's registry is currently undocumented. See
Line 22 in 4226a6c
from tiktoken.
Thank you so much for the swift reply! I'll have a try.
from tiktoken.
Sorry for "hijacking", this isssue, but feel it is related enough, instead of opening a separate issue.
When looking at https://huggingface.co/docs/tokenizers/api/added-tokens, what would be the best way, to (as much as possible) stay in-sync with the original tokenizer configs), when adding special tokens in tiktoken?
As to match, rstrip
, lstrip
and normalized
, for example. Understandable if not all is possible (yet) in tiktoken, but any further recommendations, as to what is possible currently and how, move current GPT2 based encoders, with added special tokens, to tiktoken, would be appreciated!
from tiktoken.
I've added more documentation for this over here: https://github.com/openai/tiktoken#extending-tiktoken
from tiktoken.
Related Issues (20)
- Combining marks and indic vowel marks within words are being split breaking all indic languages and most languages except English and CJKs HOT 4
- I need tiktoken win32 python3.8 version, can anyone provide it? HOT 1
- A character is splited into two tokens HOT 1
- gpt-4o tokenizer HOT 1
- Or
- GPT4o出现低级bug:发现最新token中的垃圾语料及实测GPT4o胡言乱语出现幻觉 HOT 3
- `o200k_base` pretokenizer - regex error? HOT 2
- Tiktoken educational BPE trainer takes long time to train with vocab size 30k HOT 2
- tiktoken 0.7.0 isn't compatible with python 3.11.* HOT 3
- Unknown encoding gpt2 HOT 1
- I want to modify the code in self._core_bpe.decode_bytes(tokens).decode("utf-8", errors=errors) HOT 1
- TikToken Tokenizer from scratch ?
- Support for GPT 4o HOT 1
- [FR] Add `--offline` HOT 3
- Send from DWG FastView(Android)
- Bunu uygulamaya göre ayarla
- 请问大家现在tiktok 退出了tiktok coin?
- RecursionError: maximum recursion depth exceeded while calling a Python object
- A HOT 1
- U
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 tiktoken.