tokenizer
spaGO
tokenizer | spaGO | |
---|---|---|
2 | 11 | |
228 | 1,693 | |
0.4% | - | |
4.3 | 0.0 | |
about 1 year ago | 4 months ago | |
Go | Go | |
MIT License | BSD 2-clause "Simplified" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
tokenizer
-
Understanding GPT Tokenizers
How I wish this post had appeared a few days earlier... I am writing on my own library for some agent experiments (in go, to make my life more interesting I guess), and knowing the number of tokens is important to implement a token buffer memory (as you approach the model's context window size, you prune enough messages from the beginning of the conversation that the whole thing keeps some given size, in tokens). While there's a nice native library in go for OpenAI models (https://github.com/tiktoken-go/tokenizer), the only library I found for Hugging Face models (and Claude, they published their tokenizer spec in the same JSON format) calls into HF's Rust implementation, which makes it challenging as a dependency in Go. What is more, any tokenizer needs to keep some representation of its vocabulary in memory. So, in the end I removed the true tokenizers, and ended up using an approximate version (just split it in on spaces and multiply by a factor I determined experimentally for the models I use using the real tokenizer, with a little extra for safety). If it turns out someone needs the real thing they can always provide their own token counter). I was actually rather happy with this result: I have less dependencies, and use less memory. But to get there I needed to do a deep dive too understand BPE tokenizers :)
(The library, if anyone is interested: https://github.com/ryszard/agency.)
- Pure Go implementation of OpenAI's tokenizer
spaGO
- Machine Learning
-
ml for text
Take a look into https://github.com/nlpodyssey/spago. If you don't need GPU processing it could fit your needs
- SpaGO: A ML library in pure Go
-
Why can't Go be popular for machine learning?
CGO? Too much overhead in calling C functions (in which you can wrap libtorch or TF C++ code). And too much struggling woth CUDA (actually all GPU stuff). But, there are interesting attempts: https://github.com/gorgonia/gorgonia (I love it most), https://github.com/sugarme/gotch (bindings to libtorch), https://github.com/nlpodyssey/spago.
- Run Hugging Face Models in Go
- Self-Contained Machine Learning and Natural Language Processing Library in Go
- Spice.ai – open-source, time series AI for developers
- Show HN: Experiments on Machine Translation in Pure Go
- Experiments on Machine Translation in pure Go!
What are some alternatives?
tiktoken - tiktoken is a fast BPE tokeniser for use with OpenAI's models.
go-nlp
llama.go - llama.go is like llama.cpp in pure Golang!
prose - :book: A Golang library for text processing, including tokenization, part-of-speech tagging, and named-entity extraction.
agency - Agency: Robust LLM Agent Management with Go
universal-translator - :speech_balloon: i18n Translator for Go/Golang using CLDR data + pluralization rules
sentences - A multilingual command line sentence tokenizer in Golang
go-i18n - Translate your Go program into multiple languages.
Constrained-Text-Genera
paicehusk - Golang implementation of the Paice/Husk Stemming Algorithm
tokenizer-go - A Go wrapper for GPT-3 token encode/decode. https://platform.openai.com/tokenizer
dpar - Neural network transition-based dependency parser (in Rust)