fix last commit on gpt_vocab_init add vocab.id_to_token.resize(vocab.token_to_id.size());
This commit is contained in:
parent
25ef27c6bc
commit
78b964eb1e
1 changed files with 1 additions and 0 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue