option to disable ((())) and [[[]]]

This commit is contained in:
AUTOMATIC 2022-09-02 00:30:49 +03:00
parent 0a85f1afff
commit b90feb02aa

@ -229,6 +229,7 @@ class Options:
"enable_pnginfo": OptionInfo(True, "Save text information about generation parameters as chunks to png files"), "enable_pnginfo": OptionInfo(True, "Save text information about generation parameters as chunks to png files"),
"font": OptionInfo("arial.ttf", "Font for image grids that have text"), "font": OptionInfo("arial.ttf", "Font for image grids that have text"),
"prompt_matrix_add_to_start": OptionInfo(True, "In prompt matrix, add the variable combination of text to the start of the prompt, rather than the end"), "prompt_matrix_add_to_start": OptionInfo(True, "In prompt matrix, add the variable combination of text to the start of the prompt, rather than the end"),
"enable_emphasis": OptionInfo(True, "Use (text) to make model pay more attention to text text and [text] to make it pay less attention")
} }
def __init__(self): def __init__(self):
@ -702,7 +703,7 @@ class StableDiffusionModelHijack:
word_embeddings = {} word_embeddings = {}
word_embeddings_checksums = {} word_embeddings_checksums = {}
fixes = None fixes = None
comments = None comments = []
dir_mtime = None dir_mtime = None
def load_textual_inversion_embeddings(self, dirname, model): def load_textual_inversion_embeddings(self, dirname, model):
@ -810,7 +811,7 @@ class FrozenCLIPEmbedderWithCustomWords(torch.nn.Module):
possible_matches = self.hijack.ids_lookup.get(token, None) possible_matches = self.hijack.ids_lookup.get(token, None)
mult_change = self.token_mults.get(token) mult_change = self.token_mults.get(token) if opts.enable_emphasis else None
if mult_change is not None: if mult_change is not None:
mult *= mult_change mult *= mult_change
elif possible_matches is None: elif possible_matches is None:
@ -2001,7 +2002,7 @@ else:
sd_model = sd_model.to(device) sd_model = sd_model.to(device)
model_hijack = StableDiffusionModelHijack() model_hijack = StableDiffusionModelHijack()
#model_hijack.hijack(sd_model) model_hijack.hijack(sd_model)
with open(os.path.join(script_path, "style.css"), "r", encoding="utf8") as file: with open(os.path.join(script_path, "style.css"), "r", encoding="utf8") as file:
css = file.read() css = file.read()