fix(diffusers): keep negative_prompt unless negative embeds are set

The sd_embed branch dropped negative_prompt for every pipeline, which
discarded the user's negative prompt for Flux, where no negative embeds
are produced. Only drop it when negative_prompt_embeds is present, and
move the check to a helper that has unit tests.

Assisted-by: Claude Code:claude-sonnet-5-5
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto committed 2026-10-13 08:08:24 +00:00
1 parent 5e53f5aed5
commit 8dd91dde66
3 files changed
+38 -5

No files matched your search

+4 -4
View File
@@ -36,7 +36,7 @@ from diffusers_dynamic_loader import (
get_available_pipelines,
load_diffusers_pipeline,
)
from load_options import single_file_load_kwargs
from load_options import drop_negative_prompt_if_embedded, single_file_load_kwargs
# Import specific items still needed for special cases and safety checker
from diffusers import DiffusionPipeline, ControlNetModel
@@ -882,9 +882,9 @@ class BackendServicer(backend_pb2_grpc.BackendServicer):
prompt = prompt,
)
# remove negative_prompt that may have been added earlier from options to avoid conflict
# errors from passing both negative_prompt and negative_prompt_embeds
kwargs.pop('negative_prompt', None)
# negative_prompt conflicts with negative_prompt_embeds; pipelines that
# got no negative embeds (e.g. Flux) keep the user's negative prompt
drop_negative_prompt_if_embedded(kwargs)
image = self.pipe(
guidance_scale=self.cfg_scale,