Skip to content

Commit 917f7bf

Browse files
authored
fix: support --flow-shift for flux models with default pred (#913)
1 parent 48e0a28 commit 917f7bf

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

stable-diffusion.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -761,11 +761,14 @@ class StableDiffusionGGML {
761761
denoiser = std::make_shared<DiscreteFlowDenoiser>(shift);
762762
} else if (sd_version_is_flux(version)) {
763763
LOG_INFO("running in Flux FLOW mode");
764-
float shift = 1.0f; // TODO: validate
765-
for (auto pair : model_loader.tensor_storages_types) {
766-
if (pair.first.find("model.diffusion_model.guidance_in.in_layer.weight") != std::string::npos) {
767-
shift = 1.15f;
768-
break;
764+
float shift = sd_ctx_params->flow_shift;
765+
if (shift == INFINITY) {
766+
shift = 1.0f; // TODO: validate
767+
for (auto pair : model_loader.tensor_storages_types) {
768+
if (pair.first.find("model.diffusion_model.guidance_in.in_layer.weight") != std::string::npos) {
769+
shift = 1.15f;
770+
break;
771+
}
769772
}
770773
}
771774
denoiser = std::make_shared<FluxFlowDenoiser>(shift);

0 commit comments

Comments
 (0)