mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-28 17:18:49 -04:00
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:
3 files changed
+38
-5
No files matched your search
@@ -5,3 +5,14 @@ def single_file_load_kwargs(original_config_file: str, from_single_file: bool) -
|
||||
if from_single_file and original_config_file:
|
||||
return {"original_config_file": original_config_file}
|
||||
return {}
|
||||
|
||||
|
||||
def drop_negative_prompt_if_embedded(kwargs: dict) -> dict:
|
||||
"""Remove negative_prompt from pipeline kwargs when negative_prompt_embeds is set.
|
||||
|
||||
Diffusers rejects both being passed together. Pipelines without negative
|
||||
embeddings keep the user's negative prompt.
|
||||
"""
|
||||
if "negative_prompt_embeds" in kwargs:
|
||||
kwargs.pop("negative_prompt", None)
|
||||
return kwargs
|
||||
Reference in new issue
Block a user