sort batch results (#6189)
This commit is contained in:
parent
10d49bce70
commit
86b907f82a
1 changed files with 6 additions and 0 deletions
6
llm/ext_server/server.cpp
vendored
6
llm/ext_server/server.cpp
vendored
|
@ -44,6 +44,7 @@
|
|||
#include <errhandlingapi.h>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
@ -1220,6 +1221,7 @@ struct llama_server_context
|
|||
|
||||
res.result_json = json
|
||||
{
|
||||
{"id", res.id},
|
||||
{"embedding", std::vector<float>(embd, embd + n_embd)},
|
||||
{"timings", slot.get_formated_timings()},
|
||||
};
|
||||
|
@ -3203,6 +3205,10 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
responses = result.result_json.value("results", std::vector<json>{result.result_json});
|
||||
std::sort(responses.begin(), responses.end(), [](const json& a, const json& b) {
|
||||
return a["id"] < b["id"];
|
||||
});
|
||||
|
||||
json embeddings = json::array();
|
||||
|
||||
int prompt_n = 0;
|
||||
|
|
Loading…
Reference in a new issue