From: Sergey Alirzaev Date: Thu, 6 Apr 2023 15:59:11 +0000 (+0200) Subject: Do not crash when it has nothing to say. (#796) X-Git-Tag: gguf-v0.4.0~1006 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=cc9cee8e9e7598bd280295f6264f36d3a9224006;p=pkg%2Fggml%2Fsources%2Fllama.cpp Do not crash when it has nothing to say. (#796) Otherwise observing this in the interactive mode: /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/stl_vector.h:1230: reference std::vector::back() [_Tp = int, _Alloc = std::allocator]: Assertion '!this->empty()' failed. --- diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 453450a4..67a34e66 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -431,7 +431,7 @@ int main(int argc, char ** argv) { } // end of text token - if (embd.back() == llama_token_eos()) { + if (!embd.empty() && embd.back() == llama_token_eos()) { if (params.instruct) { is_interacting = true; } else {