Skip to content

Commit e6f8328

Browse files
author
anyshu
committed
可用,后面需要优化性能
1 parent a67c81d commit e6f8328

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

tools/server/server-diffusion.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,6 @@ struct swa_checkpoint {
913913
std::vector<uint8_t> data;
914914
};
915915

916-
//last output chunk, sent when the generation is finished
917916
struct server_task_result_cmpl_final : server_task_result {
918917
int index = 0;
919918

@@ -4101,7 +4100,7 @@ struct server_context {
41014100

41024101
SRV_INF("Diffusion generation completed: n_generated=%d, generated_size=%zu, filtered_size=%zu, output_text_length=%zu\n",
41034102
n_generated, generated_tokens.size(), filtered_tokens.size(), output_text.size());
4104-
SRV_INF("Generated text preview (first 500 chars): %.500s\n", output_text.c_str());
4103+
SRV_INF("Generated text preview (first 1000 chars): %.1000s\n", output_text.c_str());
41054104

41064105
slot.generated_text = output_text;
41074106
slot.generated_tokens = filtered_tokens;
@@ -5534,15 +5533,12 @@ int main(int argc, char ** argv) {
55345533
OAICOMPAT_TYPE_NONE);
55355534
};
55365535

5537-
const auto handle_completions_oai = [&handle_completions_impl](const httplib::Request & req, httplib::Response & res) {
5536+
const auto handle_completions_oai = [&ctx_server,&handle_completions_impl](const httplib::Request & req, httplib::Response & res) {
55385537
json data = oaicompat_completion_params_parse(json::parse(req.body));
55395538
std::vector<raw_buffer> files; // dummy
55405539

55415540
// Check if this is a diffusion request by looking for diffusion-specific parameters
5542-
bool is_diffusion = data.contains("diffusion_steps") ||
5543-
data.contains("diffusion_algorithm") ||
5544-
data.contains("cfg_scale") ||
5545-
data.contains("visual_mode");
5541+
bool is_diffusion = llama_model_is_diffusion(ctx_server.model);
55465542

55475543
server_task_type task_type = is_diffusion ? SERVER_TASK_TYPE_DIFFUSION : SERVER_TASK_TYPE_COMPLETION;
55485544

@@ -5645,11 +5641,7 @@ int main(int argc, char ** argv) {
56455641
files);
56465642

56475643
// Check if this is a diffusion request by looking for diffusion-specific parameters
5648-
bool is_diffusion = data.contains("diffusion_steps") ||
5649-
data.contains("diffusion_algorithm") ||
5650-
data.contains("cfg_scale") ||
5651-
data.contains("visual_mode") ||
5652-
data.contains("max_length");
5644+
bool is_diffusion = llama_model_is_diffusion(ctx_server.model)
56535645

56545646
server_task_type task_type = is_diffusion ? SERVER_TASK_TYPE_DIFFUSION : SERVER_TASK_TYPE_COMPLETION;
56555647

0 commit comments

Comments
 (0)