Skip to content

Commit

Permalink
server : fix verbose check
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Sep 13, 2024
1 parent 0d0dc11 commit ff3b380
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,7 @@ gpt_params_context gpt_params_parser_init(gpt_params & params, llama_example ex,
}
));
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.",
[](gpt_params & params, int value) {
params.verbosity = value;
Expand Down
6 changes: 4 additions & 2 deletions examples/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2304,7 +2304,9 @@ int main(int argc, char ** argv) {

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
server_context ctx_server;
Expand Down Expand Up @@ -2830,7 +2832,7 @@ int main(int argc, char ** argv) {
if (!stream) {
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
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);
}, [&](const json & error_data) {
res_error(res, error_data);
Expand Down
1 change: 1 addition & 0 deletions examples/server/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ static json format_final_response_oaicompat(const json & request, const json & r
{"id", completion_id}
};

// extra fields for debugging purposes
if (verbose) {
res["__verbose"] = result;
}
Expand Down

0 comments on commit ff3b380

Please sign in to comment.