server : fix verbose check
This commit is contained in:
parent
0d0dc11185
commit
ff3b3809d8
3 changed files with 6 additions and 3 deletions
|
@ -1961,7 +1961,7 @@ gpt_params_context gpt_params_parser_init(gpt_params & params, llama_example ex,
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
add_opt(llama_arg(
|
add_opt(llama_arg(
|
||||||
{"-lv", "--verbosity", "--log-verbosity"}, "THOLD",
|
{"-lv", "--verbosity", "--log-verbosity"}, "N",
|
||||||
"Set the verbosity threshold. Messages with a higher verbosity will be ignored.",
|
"Set the verbosity threshold. Messages with a higher verbosity will be ignored.",
|
||||||
[](gpt_params & params, int value) {
|
[](gpt_params & params, int value) {
|
||||||
params.verbosity = value;
|
params.verbosity = value;
|
||||||
|
|
|
@ -2304,7 +2304,9 @@ int main(int argc, char ** argv) {
|
||||||
|
|
||||||
gpt_init();
|
gpt_init();
|
||||||
|
|
||||||
const bool verbose = params.verbosity > 0;
|
// enabling this will output extra debug information in the HTTP responses from the server
|
||||||
|
// see format_final_response_oaicompat()
|
||||||
|
const bool verbose = params.verbosity > 9;
|
||||||
|
|
||||||
// struct that contains llama context and inference
|
// struct that contains llama context and inference
|
||||||
server_context ctx_server;
|
server_context ctx_server;
|
||||||
|
@ -2830,7 +2832,7 @@ int main(int argc, char ** argv) {
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
ctx_server.receive_cmpl_results(task_ids, [&](const std::vector<server_task_result> & results) {
|
ctx_server.receive_cmpl_results(task_ids, [&](const std::vector<server_task_result> & results) {
|
||||||
// multitask is never support in chat completion, there is only one result
|
// multitask is never support in chat completion, there is only one result
|
||||||
json result_oai = format_final_response_oaicompat(data, results[0].data, completion_id, verbose);
|
json result_oai = format_final_response_oaicompat(data, results[0].data, completion_id, /*.streaming =*/ false, verbose);
|
||||||
res_ok(res, result_oai);
|
res_ok(res, result_oai);
|
||||||
}, [&](const json & error_data) {
|
}, [&](const json & error_data) {
|
||||||
res_error(res, error_data);
|
res_error(res, error_data);
|
||||||
|
|
|
@ -408,6 +408,7 @@ static json format_final_response_oaicompat(const json & request, const json & r
|
||||||
{"id", completion_id}
|
{"id", completion_id}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// extra fields for debugging purposes
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
res["__verbose"] = result;
|
res["__verbose"] = result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue