Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
86b907f8
Unverified
Commit
86b907f8
authored
Aug 05, 2024
by
royjhan
Committed by
GitHub
Aug 05, 2024
Browse files
sort batch results (#6189)
parent
10d49bce
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
llm/ext_server/server.cpp
llm/ext_server/server.cpp
+6
-0
No files found.
llm/ext_server/server.cpp
View file @
86b907f8
...
@@ -44,6 +44,7 @@
...
@@ -44,6 +44,7 @@
#include <errhandlingapi.h>
#include <errhandlingapi.h>
#endif
#endif
#include <algorithm>
#include <cstddef>
#include <cstddef>
#include <thread>
#include <thread>
#include <chrono>
#include <chrono>
...
@@ -1220,6 +1221,7 @@ struct llama_server_context
...
@@ -1220,6 +1221,7 @@ struct llama_server_context
res
.
result_json
=
json
res
.
result_json
=
json
{
{
{
"id"
,
res
.
id
},
{
"embedding"
,
std
::
vector
<
float
>
(
embd
,
embd
+
n_embd
)},
{
"embedding"
,
std
::
vector
<
float
>
(
embd
,
embd
+
n_embd
)},
{
"timings"
,
slot
.
get_formated_timings
()},
{
"timings"
,
slot
.
get_formated_timings
()},
};
};
...
@@ -3203,6 +3205,10 @@ int main(int argc, char **argv) {
...
@@ -3203,6 +3205,10 @@ int main(int argc, char **argv) {
}
}
responses
=
result
.
result_json
.
value
(
"results"
,
std
::
vector
<
json
>
{
result
.
result_json
});
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
();
json
embeddings
=
json
::
array
();
int
prompt_n
=
0
;
int
prompt_n
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment