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<int>::back() [_Tp = int, _Alloc = std::allocator<int>]: Assertion '!this->empty()' failed.
This commit is contained in:
Sergey Alirzaev 2023-04-06 17:59:11 +02:00 committed by GitHub
parent d2beca95dc
commit cc9cee8e9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -431,7 +431,7 @@ int main(int argc, char ** argv) {
} }
// end of text token // end of text token
if (embd.back() == llama_token_eos()) { if (!embd.empty() && embd.back() == llama_token_eos()) {
if (params.instruct) { if (params.instruct) {
is_interacting = true; is_interacting = true;
} else { } else {