mirror of
https://github.com/mudler/LocalAI
synced 2026-04-21 13:27:21 +00:00
chore: ⬆️ Update leejet/stable-diffusion.cpp to c8fb3d245858d495be1f140efdcfaa0d49de41e5 (#8841)
* chore: ⬆️ update stable-diffusion.cpp to `c8fb3d245858d495be1f140efdcfaa0d49de41e5` Update stablediffusion-ggml to include fix for SD1 Pix2Pix issue (leejet/stable-diffusion.cpp#1329). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: localai-bot <localai-bot@noreply.github.com> * fix: address CI failures in stablediffusion update Signed-off-by: localai-bot <localai-bot@noreply.github.com> * fix: resolve remaining CI failures in stablediffusion update - Move flow_shift to global scope so gen_image() can access the value set during load_model() (was causing compilation error) - Fix sd_type_str array: TQ1_0 should be at index 34, TQ2_0 at index 35 to match upstream SD_TYPE_TQ1_0=34, SD_TYPE_TQ2_0=35 enum values Signed-off-by: localai-bot <localai-bot@noreply.github.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Signed-off-by: localai-bot <localai-bot@noreply.github.com> Co-authored-by: localai-bot <localai-bot@noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
364ad30a2f
commit
85e4871d4d
3 changed files with 13 additions and 11 deletions
|
|
@ -12,8 +12,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LE
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(gosd PUBLIC
|
target_include_directories(gosd PUBLIC
|
||||||
stable-diffusion.cpp
|
sources/stablediffusion-ggml.cpp/include
|
||||||
stable-diffusion.cpp/thirdparty
|
sources/stablediffusion-ggml.cpp/thirdparty
|
||||||
)
|
)
|
||||||
|
|
||||||
set_property(TARGET gosd PROPERTY CXX_STANDARD 17)
|
set_property(TARGET gosd PROPERTY CXX_STANDARD 17)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ JOBS?=$(shell nproc --ignore=1)
|
||||||
|
|
||||||
# stablediffusion.cpp (ggml)
|
# stablediffusion.cpp (ggml)
|
||||||
STABLEDIFFUSION_GGML_REPO?=https://github.com/leejet/stable-diffusion.cpp
|
STABLEDIFFUSION_GGML_REPO?=https://github.com/leejet/stable-diffusion.cpp
|
||||||
STABLEDIFFUSION_GGML_VERSION?=e411520407663e1ddf8ff2e5ed4ff3a116fbbc97
|
STABLEDIFFUSION_GGML_VERSION?=c8fb3d245858d495be1f140efdcfaa0d49de41e5
|
||||||
|
|
||||||
CMAKE_ARGS+=-DGGML_MAX_NAME=128
|
CMAKE_ARGS+=-DGGML_MAX_NAME=128
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,8 @@ const char* sample_method_str[] = {
|
||||||
"lcm",
|
"lcm",
|
||||||
"ddim_trailing",
|
"ddim_trailing",
|
||||||
"tcd",
|
"tcd",
|
||||||
|
"res_multistep",
|
||||||
|
"res_2s",
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(std::size(sample_method_str) == SAMPLE_METHOD_COUNT, "sample method mismatch");
|
static_assert(std::size(sample_method_str) == SAMPLE_METHOD_COUNT, "sample method mismatch");
|
||||||
|
|
@ -57,6 +59,7 @@ const char* schedulers[] = {
|
||||||
"smoothstep",
|
"smoothstep",
|
||||||
"kl_optimal",
|
"kl_optimal",
|
||||||
"lcm",
|
"lcm",
|
||||||
|
"bong_tangent",
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(std::size(schedulers) == SCHEDULER_COUNT, "schedulers mismatch");
|
static_assert(std::size(schedulers) == SCHEDULER_COUNT, "schedulers mismatch");
|
||||||
|
|
@ -118,10 +121,10 @@ constexpr const char* sd_type_str[] = {
|
||||||
"f64", // 28
|
"f64", // 28
|
||||||
"iq1_m", // 29
|
"iq1_m", // 29
|
||||||
"bf16", // 30
|
"bf16", // 30
|
||||||
nullptr, nullptr, nullptr, nullptr, // 31-34
|
nullptr, nullptr, nullptr, // 31-33
|
||||||
"tq1_0", // 35
|
"tq1_0", // 34
|
||||||
"tq2_0", // 36
|
"tq2_0", // 35
|
||||||
nullptr, nullptr, // 37-38
|
nullptr, nullptr, nullptr, // 36-38
|
||||||
"mxfp4" // 39
|
"mxfp4" // 39
|
||||||
};
|
};
|
||||||
static_assert(std::size(sd_type_str) == SD_TYPE_COUNT, "sd type mismatch");
|
static_assert(std::size(sd_type_str) == SD_TYPE_COUNT, "sd type mismatch");
|
||||||
|
|
@ -131,6 +134,7 @@ sd_ctx_t* sd_c;
|
||||||
// Moved from the context (load time) to generation time params
|
// Moved from the context (load time) to generation time params
|
||||||
scheduler_t scheduler = SCHEDULER_COUNT;
|
scheduler_t scheduler = SCHEDULER_COUNT;
|
||||||
sample_method_t sample_method = SAMPLE_METHOD_COUNT;
|
sample_method_t sample_method = SAMPLE_METHOD_COUNT;
|
||||||
|
float flow_shift = INFINITY;
|
||||||
|
|
||||||
// Storage for embeddings (needs to persist for the lifetime of ctx_params)
|
// Storage for embeddings (needs to persist for the lifetime of ctx_params)
|
||||||
static std::vector<sd_embedding_t> embedding_vec;
|
static std::vector<sd_embedding_t> embedding_vec;
|
||||||
|
|
@ -501,8 +505,6 @@ int load_model(const char *model, char *model_path, char* options[], int threads
|
||||||
bool chroma_use_dit_mask = true;
|
bool chroma_use_dit_mask = true;
|
||||||
bool chroma_use_t5_mask = false;
|
bool chroma_use_t5_mask = false;
|
||||||
int chroma_t5_mask_pad = 1;
|
int chroma_t5_mask_pad = 1;
|
||||||
float flow_shift = INFINITY;
|
|
||||||
|
|
||||||
fprintf(stderr, "parsing options: %p\n", options);
|
fprintf(stderr, "parsing options: %p\n", options);
|
||||||
|
|
||||||
// If options is not NULL, parse options
|
// If options is not NULL, parse options
|
||||||
|
|
@ -723,7 +725,6 @@ int load_model(const char *model, char *model_path, char* options[], int threads
|
||||||
ctx_params.chroma_use_dit_mask = chroma_use_dit_mask;
|
ctx_params.chroma_use_dit_mask = chroma_use_dit_mask;
|
||||||
ctx_params.chroma_use_t5_mask = chroma_use_t5_mask;
|
ctx_params.chroma_use_t5_mask = chroma_use_t5_mask;
|
||||||
ctx_params.chroma_t5_mask_pad = chroma_t5_mask_pad;
|
ctx_params.chroma_t5_mask_pad = chroma_t5_mask_pad;
|
||||||
ctx_params.flow_shift = flow_shift;
|
|
||||||
sd_ctx_t* sd_ctx = new_sd_ctx(&ctx_params);
|
sd_ctx_t* sd_ctx = new_sd_ctx(&ctx_params);
|
||||||
|
|
||||||
if (sd_ctx == NULL) {
|
if (sd_ctx == NULL) {
|
||||||
|
|
@ -872,6 +873,7 @@ int gen_image(sd_img_gen_params_t *p, int steps, char *dst, float cfg_scale, cha
|
||||||
p->sample_params.sample_method = sample_method;
|
p->sample_params.sample_method = sample_method;
|
||||||
p->sample_params.sample_steps = steps;
|
p->sample_params.sample_steps = steps;
|
||||||
p->sample_params.scheduler = scheduler;
|
p->sample_params.scheduler = scheduler;
|
||||||
|
p->sample_params.flow_shift = flow_shift;
|
||||||
|
|
||||||
int width = p->width;
|
int width = p->width;
|
||||||
int height = p->height;
|
int height = p->height;
|
||||||
|
|
@ -1089,7 +1091,7 @@ int gen_image(sd_img_gen_params_t *p, int steps, char *dst, float cfg_scale, cha
|
||||||
fprintf (stderr, "Data: %p\n", results[0].data);
|
fprintf (stderr, "Data: %p\n", results[0].data);
|
||||||
|
|
||||||
int ret = stbi_write_png(dst, results[0].width, results[0].height, results[0].channel,
|
int ret = stbi_write_png(dst, results[0].width, results[0].height, results[0].channel,
|
||||||
results[0].data, 0, NULL);
|
results[0].data, 0);
|
||||||
if (ret)
|
if (ret)
|
||||||
fprintf (stderr, "Saved resulting image to '%s'\n", dst);
|
fprintf (stderr, "Saved resulting image to '%s'\n", dst);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue