From 32319e1c1afb25803b026b323c797a3d302e6f07 Mon Sep 17 00:00:00 2001 From: Haoming Date: Mon, 10 Feb 2025 13:53:12 +0800 Subject: [PATCH] fix missing Emphasis infotext --- modules/processing.py | 3 +++ modules/sd_hijack_clip.py | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/processing.py b/modules/processing.py index 92c3582cc..4bf46bb66 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -763,6 +763,9 @@ def create_infotext(p, all_prompts, all_seeds, all_subseeds, comments=None, iter prompt_text = p.main_prompt if use_main_prompt else all_prompts[index] negative_prompt = p.main_negative_prompt if use_main_prompt else all_negative_prompts[index] + if any(x for x in [prompt_text, negative_prompt] if "(" in x or "[" in x): + p.extra_generation_params["Emphasis"] = opts.emphasis + uses_ensd = opts.eta_noise_seed_delta != 0 if uses_ensd: uses_ensd = sd_samplers_common.is_sampler_using_eta_noise_seed_delta(p) diff --git a/modules/sd_hijack_clip.py b/modules/sd_hijack_clip.py index a479148fc..c5a961883 100644 --- a/modules/sd_hijack_clip.py +++ b/modules/sd_hijack_clip.py @@ -202,7 +202,7 @@ class TextConditionalModel(torch.nn.Module): Returns a tensor with shape of (B, T, C), where B is length of the array; T is length, in tokens, of texts (including padding) - T will be a multiple of 77; and C is dimensionality of each token - for SD1 it's 768, for SD2 it's 1024, and for SDXL it's 1280. An example shape returned by this function can be: (2, 77, 768). - For SDXL, instead of returning one tensor avobe, it returns a tuple with two: the other one with shape (B, 1280) with pooled values. + For SDXL, instead of returning one tensor above, it returns a tuple with two: the other one with shape (B, 1280) with pooled values. Webui usually sends just one text at a time through this function - the only time when texts is an array with more than one element is when you do prompt editing: "a picture of a [cat:dog:0.4] eating ice cream" """ @@ -242,9 +242,6 @@ class TextConditionalModel(torch.nn.Module): hashes.append(self.hijack.extra_generation_params.get("TI hashes")) self.hijack.extra_generation_params["TI hashes"] = ", ".join(hashes) - if any(x for x in texts if "(" in x or "[" in x) and opts.emphasis != "Original": - self.hijack.extra_generation_params["Emphasis"] = opts.emphasis - if self.return_pooled: return torch.hstack(zs), zs[0].pooled else: