Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only override emphasis if actually used in prompt #15141

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions modules/infotext_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import gradio as gr
from modules.paths import data_path
from modules import shared, ui_tempdir, script_callbacks, processing, infotext_versions, images
from modules import shared, ui_tempdir, script_callbacks, processing, infotext_versions, images, prompt_parser
from PIL import Image

sys.modules['modules.generation_parameters_copypaste'] = sys.modules[__name__] # alias for old name
Expand Down Expand Up @@ -356,7 +356,10 @@ def parse_generation_parameters(x: str, skip_fields: list[str] | None = None):
if "Cache FP16 weight for LoRA" not in res and res["FP8 weight"] != "Disable":
res["Cache FP16 weight for LoRA"] = False

if "Emphasis" not in res:
prompt_attention = prompt_parser.parse_prompt_attention(prompt)
prompt_attention += prompt_parser.parse_prompt_attention(negative_prompt)
prompt_uses_emphasis = len(prompt_attention) != len([p for p in prompt_attention if p[1] == 1.0 or p[0] == 'BREAK'])
if "Emphasis" not in res and prompt_uses_emphasis:
res["Emphasis"] = "Original"

if "Refiner switch by sampling steps" not in res:
Expand Down
Loading