Comments (4)
For instance, counting the special token "<|end_of_text|>" is wrong.
Are you inserting the string <|end_of_text|>
into normal input text and expecting it to be parsed as a special token? I have implemented the special tokens in a different manner. I wrote into the README an example of how to work with special tokens. Here is the example from README adapted into this particular token:
const tokens = []
tokens.push(llama3Tokenizer.getSpecialTokenId('<|end_of_text|>'))
console.log(tokens.length) // Count is one
I implemented it this way because I am not sure what to do with all these special tokens, and the official LLaMA 3 repo has similar Python implementation: https://github.com/meta-llama/llama3/blob/main/llama/tokenizer.py#L202-L229
Thinking more about this, maybe I should also parse the special tokens from normal input text?
It might be better to also visualize the token id in the website.
Thank you for the suggestion. I can see how there would be a need for this, though the website is just a quick demo for the library.
from llama3-tokenizer-js.
Got it! Makes much more sense now~!
from llama3-tokenizer-js.
I have now added the features you requested:
- Visualize token ids on the demo website
- Allow passing special tokens inside normal input text, no longer requiring any special function calls
from llama3-tokenizer-js.
@belladoreai Awesome! Thanks so much, I appreciate it!
from llama3-tokenizer-js.
Related Issues (5)
- Require ESM HOT 2
- Types do not match docs HOT 5
- Provide a UMD module HOT 5
- Chat Template Tokenization? HOT 1
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 llama3-tokenizer-js.