fix last commit on gpt_vocab_init add vocab.id_to_token.resize(vocab.token_to_id.size());

This commit is contained in:
Fabio Rossini Sluzala 2023-03-19 18:55:09 -03:00
parent 25ef27c6bc
commit 78b964eb1e
No known key found for this signature in database
GPG key ID: F9D569BBF49F437B

View file

@ -353,6 +353,7 @@ bool gpt_vocab_init(const std::string & fname, gpt_vocab & vocab) {
vocab.token_to_id = ::json_parse(fname); vocab.token_to_id = ::json_parse(fname);
vocab.id_to_token.resize(vocab.token_to_id.size());
for (const auto & kv : vocab.token_to_id) { for (const auto & kv : vocab.token_to_id) {
vocab.id_to_token[kv.second] = kv.first; vocab.id_to_token[kv.second] = kv.first;
} }