Nest struct token score inside gpt_vocab

This commit is contained in:
Fabio Rossini Sluzala 2023-03-20 21:28:14 -03:00
parent ef792ae8bd
commit 34596530b2
No known key found for this signature in database
GPG key ID: F9D569BBF49F437B

11
utils.h
View file

@ -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;
}; };