|
ember.cpp 0.1.0
C++ inference engine for Llama-family and paperkiln models (CPU, CUDA, WebAssembly)
|
#include <llama3_tokenizer.h>

Classes | |
| struct | Bigram |
| struct | Later |
| struct | Symbol |
Public Member Functions | |
| Tokenizer (std::vector< std::string > tokens, const std::vector< std::string > &merges, const std::vector< int32_t > &token_type, size_t max_digits=3) | |
| std::vector< int > | encode (const std::string &text) const |
| std::string | decode (const std::vector< int > &ids) const |
| size_t | size () const |
| const std::vector< std::string > & | tokens () const |
Private Member Functions | |
| void | encode_word (const std::string &word, std::vector< int > &out) const |
Static Private Member Functions | |
| static size_t | utf8_len (unsigned char c) |
Private Attributes | |
| std::vector< std::string > | tokens_ |
| size_t | max_digits_ = 3 |
| std::unordered_map< std::string, int > | id_ |
| std::unordered_map< std::string, int > | rank_ |
| std::vector< bool > | special_ |
| std::vector< int > | specials_ |
| std::unordered_map< std::string, unsigned char > | unbyte_ |
Definition at line 262 of file llama3_tokenizer.h.
|
inline |
Definition at line 268 of file llama3_tokenizer.h.
References a, microtorch::llama3::byte_to_unicode(), c, id_, j, rank_, special_, specials_, tokens_, and unbyte_.
Definition at line 320 of file llama3_tokenizer.h.
References id, j, special_, tokens_, unbyte_, and utf8_len().
Definition at line 288 of file llama3_tokenizer.h.
References microtorch::llama3::byte_encode(), encode_word(), id, j, max_digits_, out, specials_, microtorch::llama3::split_words(), text, and tokens_.
|
inlineprivate |
Definition at line 363 of file llama3_tokenizer.h.
References a, c, id_, j, n, microtorch::llama3::Tokenizer::Symbol::n, off, out, rank_, text, and utf8_len().
Referenced by encode().
|
inline |
|
inline |
Definition at line 343 of file llama3_tokenizer.h.
References c.
Referenced by decode(), and encode_word().
|
private |
Definition at line 414 of file llama3_tokenizer.h.
Referenced by encode_word(), and Tokenizer().
|
private |
Definition at line 413 of file llama3_tokenizer.h.
Referenced by encode().
|
private |
Definition at line 414 of file llama3_tokenizer.h.
Referenced by encode_word(), and Tokenizer().
|
private |
Definition at line 415 of file llama3_tokenizer.h.
Referenced by decode(), and Tokenizer().
|
private |
Definition at line 416 of file llama3_tokenizer.h.
Referenced by encode(), and Tokenizer().
|
private |
Definition at line 412 of file llama3_tokenizer.h.
Referenced by decode(), encode(), size(), Tokenizer(), and tokens().
Definition at line 417 of file llama3_tokenizer.h.
Referenced by decode(), and Tokenizer().