Skip to content

Commit 71bf10b

Browse files
author
anyshu
committed
清理
1 parent f18b627 commit 71bf10b

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

tools/server/server-diffusion.cpp

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@
1111
#include "mtmd.h"
1212
#include "mtmd-helper.h"
1313

14-
#include <limits.h>
15-
#include <algorithm>
16-
#include <cmath>
17-
#include <cstring>
18-
#include <limits>
19-
#include <random>
20-
#include <string>
21-
#include <vector>
22-
2314
// mime type for sending response
2415
#define MIMETYPE_JSON "application/json; charset=utf-8"
2516

@@ -3594,7 +3585,6 @@ struct server_context {
35943585
}
35953586

35963587
// TODO: support memory-less logits computation
3597-
// Allow diffusion tasks to proceed as they handle logits differently
35983588
if (slot.need_logits() && !llama_get_memory(ctx) && slot.task_type != SERVER_TASK_TYPE_DIFFUSION) {
35993589
slot.release();
36003590
send_error(slot, "the current context does not logits computation. skipping", ERROR_TYPE_SERVER);
@@ -5411,6 +5401,8 @@ int main(int argc, char ** argv) {
54115401
const std::function<bool()> & is_connection_closed,
54125402
httplib::Response & res,
54135403
oaicompat_type oaicompat) -> void {
5404+
5405+
type = llama_model_is_diffusion(ctx_server.model) ? SERVER_TASK_TYPE_DIFFUSION : type;
54145406
GGML_ASSERT(type == SERVER_TASK_TYPE_COMPLETION || type == SERVER_TASK_TYPE_INFILL || type == SERVER_TASK_TYPE_DIFFUSION);
54155407

54165408
auto completion_id = gen_chatcmplid();
@@ -5532,17 +5524,11 @@ int main(int argc, char ** argv) {
55325524
OAICOMPAT_TYPE_NONE);
55335525
};
55345526

5535-
const auto handle_completions_oai = [&ctx_server,&handle_completions_impl](const httplib::Request & req, httplib::Response & res) {
5527+
const auto handle_completions_oai = [&handle_completions_impl](const httplib::Request & req, httplib::Response & res) {
55365528
json data = oaicompat_completion_params_parse(json::parse(req.body));
55375529
std::vector<raw_buffer> files; // dummy
5538-
5539-
// Check if this is a diffusion request by looking for diffusion-specific parameters
5540-
bool is_diffusion = llama_model_is_diffusion(ctx_server.model);
5541-
5542-
server_task_type task_type = is_diffusion ? SERVER_TASK_TYPE_DIFFUSION : SERVER_TASK_TYPE_COMPLETION;
5543-
55445530
handle_completions_impl(
5545-
task_type,
5531+
SERVER_TASK_TYPE_COMPLETION,
55465532
data,
55475533
files,
55485534
req.is_connection_closed,
@@ -5639,13 +5625,8 @@ int main(int argc, char ** argv) {
56395625
ctx_server.oai_parser_opt,
56405626
files);
56415627

5642-
// Check if this is a diffusion request by looking for diffusion-specific parameters
5643-
bool is_diffusion = llama_model_is_diffusion(ctx_server.model);
5644-
5645-
server_task_type task_type = is_diffusion ? SERVER_TASK_TYPE_DIFFUSION : SERVER_TASK_TYPE_COMPLETION;
5646-
56475628
handle_completions_impl(
5648-
task_type,
5629+
SERVER_TASK_TYPE_COMPLETION,
56495630
data,
56505631
files,
56515632
req.is_connection_closed,

0 commit comments

Comments
 (0)