Skip to content

Commit 85e4871

Browse files
localai-botlocalai-botclaude
authored
chore: ⬆️ Update leejet/stable-diffusion.cpp to c8fb3d245858d495be1f140efdcfaa0d49de41e5 (mudler#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>
1 parent 364ad30 commit 85e4871

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

backend/go/stablediffusion-ggml/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LE
1212
endif()
1313

1414
target_include_directories(gosd PUBLIC
15-
stable-diffusion.cpp
16-
stable-diffusion.cpp/thirdparty
15+
sources/stablediffusion-ggml.cpp/include
16+
sources/stablediffusion-ggml.cpp/thirdparty
1717
)
1818

1919
set_property(TARGET gosd PROPERTY CXX_STANDARD 17)

backend/go/stablediffusion-ggml/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ JOBS?=$(shell nproc --ignore=1)
88

99
# stablediffusion.cpp (ggml)
1010
STABLEDIFFUSION_GGML_REPO?=https://github.com/leejet/stable-diffusion.cpp
11-
STABLEDIFFUSION_GGML_VERSION?=e411520407663e1ddf8ff2e5ed4ff3a116fbbc97
11+
STABLEDIFFUSION_GGML_VERSION?=c8fb3d245858d495be1f140efdcfaa0d49de41e5
1212

1313
CMAKE_ARGS+=-DGGML_MAX_NAME=128
1414

backend/go/stablediffusion-ggml/gosd.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const char* sample_method_str[] = {
4141
"lcm",
4242
"ddim_trailing",
4343
"tcd",
44+
"res_multistep",
45+
"res_2s",
4446
};
4547

4648
static_assert(std::size(sample_method_str) == SAMPLE_METHOD_COUNT, "sample method mismatch");
@@ -57,6 +59,7 @@ const char* schedulers[] = {
5759
"smoothstep",
5860
"kl_optimal",
5961
"lcm",
62+
"bong_tangent",
6063
};
6164

6265
static_assert(std::size(schedulers) == SCHEDULER_COUNT, "schedulers mismatch");
@@ -118,10 +121,10 @@ constexpr const char* sd_type_str[] = {
118121
"f64", // 28
119122
"iq1_m", // 29
120123
"bf16", // 30
121-
nullptr, nullptr, nullptr, nullptr, // 31-34
122-
"tq1_0", // 35
123-
"tq2_0", // 36
124-
nullptr, nullptr, // 37-38
124+
nullptr, nullptr, nullptr, // 31-33
125+
"tq1_0", // 34
126+
"tq2_0", // 35
127+
nullptr, nullptr, nullptr, // 36-38
125128
"mxfp4" // 39
126129
};
127130
static_assert(std::size(sd_type_str) == SD_TYPE_COUNT, "sd type mismatch");
@@ -131,6 +134,7 @@ sd_ctx_t* sd_c;
131134
// Moved from the context (load time) to generation time params
132135
scheduler_t scheduler = SCHEDULER_COUNT;
133136
sample_method_t sample_method = SAMPLE_METHOD_COUNT;
137+
float flow_shift = INFINITY;
134138

135139
// Storage for embeddings (needs to persist for the lifetime of ctx_params)
136140
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
501505
bool chroma_use_dit_mask = true;
502506
bool chroma_use_t5_mask = false;
503507
int chroma_t5_mask_pad = 1;
504-
float flow_shift = INFINITY;
505-
506508
fprintf(stderr, "parsing options: %p\n", options);
507509

508510
// If options is not NULL, parse options
@@ -723,7 +725,6 @@ int load_model(const char *model, char *model_path, char* options[], int threads
723725
ctx_params.chroma_use_dit_mask = chroma_use_dit_mask;
724726
ctx_params.chroma_use_t5_mask = chroma_use_t5_mask;
725727
ctx_params.chroma_t5_mask_pad = chroma_t5_mask_pad;
726-
ctx_params.flow_shift = flow_shift;
727728
sd_ctx_t* sd_ctx = new_sd_ctx(&ctx_params);
728729

729730
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
872873
p->sample_params.sample_method = sample_method;
873874
p->sample_params.sample_steps = steps;
874875
p->sample_params.scheduler = scheduler;
876+
p->sample_params.flow_shift = flow_shift;
875877

876878
int width = p->width;
877879
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
10891091
fprintf (stderr, "Data: %p\n", results[0].data);
10901092

10911093
int ret = stbi_write_png(dst, results[0].width, results[0].height, results[0].channel,
1092-
results[0].data, 0, NULL);
1094+
results[0].data, 0);
10931095
if (ret)
10941096
fprintf (stderr, "Saved resulting image to '%s'\n", dst);
10951097
else

0 commit comments

Comments
 (0)