Compare commits

...

5 Commits

Author SHA1 Message Date
leejet
0d9d5e0386 Merge branch 'master' into chroma_radiance 2025-10-24 00:33:45 +08:00
leejet
69b9511ce9 sync: update ggml 2025-10-24 00:32:45 +08:00
leejet
458c365e90 format code 2025-10-23 22:47:59 +08:00
leejet
27272efbd2 workaround: avoid ggml cuda error 2025-10-23 22:44:09 +08:00
stduhpf
917f7bfe99
fix: support --flow-shift for flux models with default pred (#913) 2025-10-23 21:35:18 +08:00
3 changed files with 19 additions and 7 deletions

2
ggml

@ -1 +1 @@
Subproject commit c538174d261d8172480f87efcfec8e69aac13ebb
Subproject commit 2d3876d554551d35c06dccc5852be50d5fd2a275

View File

@ -954,7 +954,16 @@ __STATIC_INLINE__ struct ggml_tensor* ggml_nn_linear(struct ggml_context* ctx,
if (scale != 1.f) {
x = ggml_scale(ctx, x, scale);
}
x = ggml_mul_mat(ctx, w, x);
if (x->ne[2] * x->ne[3] > 1024) {
// workaround: avoid ggml cuda error
int64_t ne2 = x->ne[2];
int64_t ne3 = x->ne[3];
x = ggml_reshape_2d(ctx, x, x->ne[0], x->ne[1] * x->ne[2] * x->ne[3]);
x = ggml_mul_mat(ctx, w, x);
x = ggml_reshape_4d(ctx, x, x->ne[0], x->ne[1] / ne2 / ne3, ne2, ne3);
} else {
x = ggml_mul_mat(ctx, w, x);
}
if (force_prec_f32) {
ggml_mul_mat_set_prec(x, GGML_PREC_F32);
}

View File

@ -765,11 +765,14 @@ public:
denoiser = std::make_shared<DiscreteFlowDenoiser>(shift);
} else if (sd_version_is_flux(version)) {
LOG_INFO("running in Flux FLOW mode");
float shift = 1.0f; // TODO: validate
for (auto pair : model_loader.tensor_storages_types) {
if (pair.first.find("model.diffusion_model.guidance_in.in_layer.weight") != std::string::npos) {
shift = 1.15f;
break;
float shift = sd_ctx_params->flow_shift;
if (shift == INFINITY) {
shift = 1.0f; // TODO: validate
for (auto pair : model_loader.tensor_storages_types) {
if (pair.first.find("model.diffusion_model.guidance_in.in_layer.weight") != std::string::npos) {
shift = 1.15f;
break;
}
}
}
denoiser = std::make_shared<FluxFlowDenoiser>(shift);