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

Classes | |
| struct | Bigram |
| struct | Lower |
| struct | Symbol |
Public Member Functions | |
| SpmTokenizer (std::vector< std::string > tokens, std::vector< float > scores, std::vector< int32_t > types, bool add_space_prefix) | |
| std::vector< int > | encode (const std::string &text) const |
| std::string | decode (const std::vector< int > &ids) const |
| size_t | size () const |
Private Member Functions | |
| int | lookup (const std::string &s) const |
| void | encode_fragment (const std::string &text, std::vector< int > &out) const |
Static Private Member Functions | |
| static std::string | escape (const std::string &s) |
Private Attributes | |
| std::vector< std::string > | tokens_ |
| std::vector< float > | scores_ |
| std::vector< int32_t > | types_ |
| bool | add_space_prefix_ |
| std::unordered_map< std::string, int > | id_ |
| std::vector< int > | specials_ |
| int | byte_id_ [256] |
Static Private Attributes | |
| static constexpr int32_t | kUnknown = 2 |
| static constexpr int32_t | kControl = 3 |
| static constexpr int32_t | kUserDefined = 4 |
| static constexpr int32_t | kByte = 6 |
| static constexpr const char * | kSpace = "\xe2\x96\x81" |
Definition at line 30 of file spm_tokenizer.h.
|
inline |
Definition at line 32 of file spm_tokenizer.h.
References a, byte_id_, id_, j, kControl, kUnknown, kUserDefined, scores_, specials_, tokens_, and types_.
Definition at line 102 of file spm_tokenizer.h.
Definition at line 56 of file spm_tokenizer.h.
References add_space_prefix_, encode_fragment(), escape(), id, j, off, out, specials_, text, and tokens_.
|
inlineprivate |
Definition at line 159 of file spm_tokenizer.h.
References byte_id_, id, index, j, lookup(), n, ember::SpmTokenizer::Symbol::n, off, out, p, scores_, and text.
Referenced by encode().
Definition at line 129 of file spm_tokenizer.h.
Referenced by encode().
|
inline |
|
private |
Definition at line 217 of file spm_tokenizer.h.
Referenced by encode().
|
private |
Definition at line 220 of file spm_tokenizer.h.
Referenced by encode_fragment(), and SpmTokenizer().
|
private |
Definition at line 218 of file spm_tokenizer.h.
Referenced by lookup(), and SpmTokenizer().
Definition at line 126 of file spm_tokenizer.h.
Referenced by decode().
Definition at line 126 of file spm_tokenizer.h.
Referenced by SpmTokenizer().
Definition at line 127 of file spm_tokenizer.h.
Definition at line 126 of file spm_tokenizer.h.
Referenced by SpmTokenizer().
Definition at line 126 of file spm_tokenizer.h.
Referenced by SpmTokenizer().
|
private |
Definition at line 215 of file spm_tokenizer.h.
Referenced by encode_fragment(), and SpmTokenizer().
|
private |
Definition at line 219 of file spm_tokenizer.h.
Referenced by encode(), and SpmTokenizer().
|
private |
Definition at line 214 of file spm_tokenizer.h.
Referenced by decode(), encode(), size(), and SpmTokenizer().
|
private |
Definition at line 216 of file spm_tokenizer.h.
Referenced by decode(), and SpmTokenizer().