Skip to content

Commit c99e290

Browse files
committed
talk : fix compile warning
1 parent 728e178 commit c99e290

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/talk/gpt-2.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ bool gpt2_model_load(const std::string & fname, gpt2_model & model, gpt_vocab &
121121
return false;
122122
}
123123

124-
std::string word;
124+
char word[129];
125+
125126
for (int i = 0; i < n_vocab; i++) {
126127
uint32_t len;
127128
fin.read((char *) &len, sizeof(len));
128-
129-
word.resize(len);
130-
fin.read((char *) word.data(), len);
129+
word[len] = '\0';
130+
fin.read((char *) word, len);
131131

132132
vocab.token_to_id[word] = i;
133133
vocab.id_to_token[i] = word;

0 commit comments

Comments
 (0)