From c99e290a7fa67ff69239a6efc2d040c8383307f5 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Fri, 10 Nov 2023 13:54:02 +0200 Subject: [PATCH] talk : fix compile warning --- examples/talk/gpt-2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/talk/gpt-2.cpp b/examples/talk/gpt-2.cpp index a2319db6..8f9a3e93 100644 --- a/examples/talk/gpt-2.cpp +++ b/examples/talk/gpt-2.cpp @@ -121,13 +121,13 @@ bool gpt2_model_load(const std::string & fname, gpt2_model & model, gpt_vocab & return false; } - std::string word; + char word[129]; + for (int i = 0; i < n_vocab; i++) { uint32_t len; fin.read((char *) &len, sizeof(len)); - - word.resize(len); - fin.read((char *) word.data(), len); + word[len] = '\0'; + fin.read((char *) word, len); vocab.token_to_id[word] = i; vocab.id_to_token[i] = word;