Skip to content

Commit 8cbc4be

Browse files
author
anon
committed
clear logit_bias between requests + print
1 parent 6025476 commit 8cbc4be

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

examples/server/server.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ json format_generation_settings(llama_server_context &llama) {
559559
{ "n_keep", llama.params.n_keep },
560560
{ "ignore_eos", ignore_eos },
561561
{ "stream", llama.stream },
562+
{ "logit_bias", llama.params.logit_bias },
562563
};
563564
}
564565

@@ -650,10 +651,10 @@ bool parse_options_completion(json body, llama_server_context& llama, Response &
650651
} else {
651652
llama.params.seed = time(NULL);
652653
}
654+
655+
llama.params.logit_bias.clear();
653656
if (!body["ignore_eos"].is_null() && body["ignore_eos"].get<bool>()) {
654657
llama.params.logit_bias[llama_token_eos()] = -INFINITY;
655-
} else {
656-
llama.params.logit_bias.erase(llama_token_eos());
657658
}
658659
if (body["logit_bias"].is_array()) {
659660
int n_vocab = llama_n_vocab(llama.ctx);
@@ -665,6 +666,7 @@ bool parse_options_completion(json body, llama_server_context& llama, Response &
665666
}
666667
}
667668
}
669+
668670
if (!body["prompt"].is_null()) {
669671
llama.params.prompt = body["prompt"].get<std::string>();
670672
} else {
@@ -673,6 +675,7 @@ bool parse_options_completion(json body, llama_server_context& llama, Response &
673675
res.status = 400;
674676
return false;
675677
}
678+
676679
llama.params.antiprompt.clear();
677680
if (!body["stop"].is_null()) {
678681
const auto stop = body["stop"].get<std::vector<std::string>>();

0 commit comments

Comments
 (0)