diff --git a/llama-box/server.cpp b/llama-box/server.cpp index c129fad..6c5148e 100644 --- a/llama-box/server.cpp +++ b/llama-box/server.cpp @@ -936,7 +936,13 @@ struct server_context { } if (sd_params.model_alias.empty()) { - sd_params.model_alias = sd_params.model.substr(sd_params.model.find_last_of('/') + 1); + if (sd_params.model.find_last_of('/') != std::string::npos) { + sd_params.model_alias = sd_params.model.substr(sd_params.model.find_last_of('/') + 1); + } else if (sd_params.model.find_last_of('\\') != std::string::npos) { + sd_params.model_alias = sd_params.model.substr(sd_params.model.find_last_of('\\') + 1); + } else { + sd_params.model_alias = sd_params.model; + } } if (sd_params.sampling.strength <= 0.0f) { sd_params.sampling.strength = sd_ctx->get_default_strength(); @@ -977,7 +983,13 @@ struct server_context { /* LLAMA */ if (llm_params.model_alias.empty()) { - llm_params.model_alias = llm_params.model.substr(llm_params.model.find_last_of('/') + 1); + if (llm_params.model.find_last_of('/') != std::string::npos) { + llm_params.model_alias = llm_params.model.substr(llm_params.model.find_last_of('/') + 1); + } else if (llm_params.model.find_last_of('\\') != std::string::npos) { + llm_params.model_alias = llm_params.model.substr(llm_params.model.find_last_of('\\') + 1); + } else { + llm_params.model_alias = llm_params.model; + } } // load multimodal projection model @@ -3643,12 +3655,21 @@ struct server_context { if (sd_ctx != nullptr) { return json{ + {"max_batch_count", sd_params.max_batch_count}, + {"max_height", sd_params.sampling.height}, + {"max_width", sd_params.sampling.width}, + {"guidance", sd_params.sampling.guidance}, + {"strength", sd_params.sampling.strength}, {"sample_method", sd_sample_method_to_argument(sd_params.sampling.sample_method)}, {"sampling_steps", sd_params.sampling.sampling_steps}, + {"cfg_scale", sd_params.sampling.cfg_scale}, + {"slg_scale", sd_params.sampling.slg_scale}, + {"slg_skip_layers", sd_params.sampling.slg_skip_layers}, + {"slg_start", sd_params.sampling.slg_start}, + {"slg_end", sd_params.sampling.slg_end}, {"schedule_method", sd_schedule_to_argument(sd_params.sampling.schedule_method)}, - {"max_height", sd_params.sampling.height}, - {"max_width", sd_params.sampling.width}, - {"max_batch_count", sd_params.max_batch_count}, + {"negative_prompt", sd_params.sampling.negative_prompt}, + {"n_slot", llm_params.n_parallel}, }; } @@ -3663,6 +3684,8 @@ struct server_context { {"size", llama_model_size(llm_model)}, {"n_ctx", llama_n_ctx(llm_ctx)}, {"n_slot", llm_params.n_parallel}, + {"support_vision", llm_ctx_clip != nullptr}, + {"support_speculative", llm_ctx_draft != nullptr}, {"support_tool_calls", support_tool_calls}, }; } diff --git a/llama-box/stablediffusion.hpp b/llama-box/stablediffusion.hpp index ea51b8f..36ef925 100644 --- a/llama-box/stablediffusion.hpp +++ b/llama-box/stablediffusion.hpp @@ -26,7 +26,7 @@ struct stablediffusion_params_sampling { std::vector slg_skip_layers = {7, 8, 9}; float slg_start = 0.01; float slg_end = 0.2; - schedule_t schedule_method = DEFAULT; + schedule_t schedule_method = DISCRETE; std::string negative_prompt; float control_strength = 0.9f; bool control_canny = false; @@ -415,7 +415,7 @@ stablediffusion_context *common_sd_init_from_params(stablediffusion_params param stablediffusion_params_sampling wparams = params.sampling; wparams.sampling_steps = 1; // sample only once wparams.sample_method = EULER; - wparams.schedule_method = DEFAULT; + wparams.schedule_method = DISCRETE; stablediffusion_sampling_stream *stream = sc->generate_stream("a lovely cat", wparams); sc->sample_stream(stream); stablediffusion_generated_image img = sc->result_image_stream(stream);