talk : fix compile warning

This commit is contained in:
Georgi Gerganov 2023-11-10 13:54:02 +02:00
parent 728e1785f0
commit c99e290a7f
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -121,13 +121,13 @@ bool gpt2_model_load(const std::string & fname, gpt2_model & model, gpt_vocab &
return false; return false;
} }
std::string word; char word[129];
for (int i = 0; i < n_vocab; i++) { for (int i = 0; i < n_vocab; i++) {
uint32_t len; uint32_t len;
fin.read((char *) &len, sizeof(len)); fin.read((char *) &len, sizeof(len));
word[len] = '\0';
word.resize(len); fin.read((char *) word, len);
fin.read((char *) word.data(), len);
vocab.token_to_id[word] = i; vocab.token_to_id[word] = i;
vocab.id_to_token[i] = word; vocab.id_to_token[i] = word;