Every character (code point) is a token, looked up in a character list; unknown characters become the unknown token.
More...
#include <tokenizer_components.hpp>
|
| | CharModel (std::vector< std::string > chars, const std::string &unk_token) |
| |
| std::vector< ModelToken > | tokenize (std::string_view piece) const override |
| |
| std::optional< int64_t > | token_to_id (std::string_view token) const override |
| |
| std::optional< std::string > | id_to_token (int64_t id) const override |
| |
| int64_t | vocab_size () const override |
| | One more than the largest id the model can produce.
|
| |
| virtual | ~TokenModel ()=default |
| |
Every character (code point) is a token, looked up in a character list; unknown characters become the unknown token.
◆ CharModel()
| pulsatrix::CharModel::CharModel |
( |
std::vector< std::string > |
chars, |
|
|
const std::string & |
unk_token |
|
) |
| |
- Parameters
-
| chars | One UTF-8 character per entry, by id. |
- Exceptions
-
| std::invalid_argument | if an entry isn't one character, repeats, or unk_token isn't among them. |
◆ id_to_token()
| std::optional< std::string > pulsatrix::CharModel::id_to_token |
( |
int64_t |
id | ) |
const |
|
overridevirtual |
◆ token_to_id()
| std::optional< int64_t > pulsatrix::CharModel::token_to_id |
( |
std::string_view |
token | ) |
const |
|
overridevirtual |
◆ tokenize()
| std::vector< ModelToken > pulsatrix::CharModel::tokenize |
( |
std::string_view |
piece | ) |
const |
|
overridevirtual |
◆ vocab_size()
| int64_t pulsatrix::CharModel::vocab_size |
( |
| ) |
const |
|
inlineoverridevirtual |
The documentation for this class was generated from the following file: