Nest struct token score inside gpt_vocab
This commit is contained in:
parent
ef792ae8bd
commit
34596530b2
1 changed files with 5 additions and 6 deletions
11
utils.h
11
utils.h
|
@ -52,16 +52,15 @@ std::string gpt_random_prompt(std::mt19937 & rng);
|
||||||
// Vocab utils
|
// Vocab utils
|
||||||
//
|
//
|
||||||
|
|
||||||
struct token_score {
|
|
||||||
using token_t = std::string;
|
|
||||||
token_t token;
|
|
||||||
float score;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct gpt_vocab {
|
struct gpt_vocab {
|
||||||
using id = int32_t;
|
using id = int32_t;
|
||||||
using token = std::string;
|
using token = std::string;
|
||||||
|
|
||||||
|
struct token_score {
|
||||||
|
token token;
|
||||||
|
float score;
|
||||||
|
};
|
||||||
|
|
||||||
std::unordered_map<token, id> token_to_id;
|
std::unordered_map<token, id> token_to_id;
|
||||||
std::vector<token_score> id_to_token;
|
std::vector<token_score> id_to_token;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue