Skip to content

Commit

Permalink
fix server crashes (ggerganov#2076)
Browse files Browse the repository at this point in the history
  • Loading branch information
SlyEcho authored Jul 3, 2023
1 parent cc45a7f commit 1cf14cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ int main(int argc, char ** argv) {

while (llama.has_next_token) {
const completion_token_output token_with_probs = llama.doCompletion();
const std::string token_text = llama_token_to_str(llama.ctx, token_with_probs.tok);
const std::string token_text = token_with_probs.tok == -1 ? "" : llama_token_to_str(llama.ctx, token_with_probs.tok);

stop_pos = llama.findStoppingStrings(llama.generated_text,
token_text.size(), STOP_FULL);
Expand All @@ -933,7 +933,7 @@ int main(int argc, char ** argv) {

while (llama.has_next_token) {
const completion_token_output token_with_probs = llama.doCompletion();
const std::string token_text = llama_token_to_str(llama.ctx, token_with_probs.tok);
const std::string token_text = token_with_probs.tok == -1 ? "" : llama_token_to_str(llama.ctx, token_with_probs.tok);
if (llama.multibyte_pending > 0) {
continue;
}
Expand Down

0 comments on commit 1cf14cc

Please sign in to comment.