From cc9cee8e9e7598bd280295f6264f36d3a9224006 Mon Sep 17 00:00:00 2001 From: Sergey Alirzaev Date: Thu, 6 Apr 2023 17:59:11 +0200 Subject: 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. --- examples/main/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/main') diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 453450a..67a34e6 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 { -- cgit v1.2.3