mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-03-12 08:29:50 +00:00
Apply emphasis mode changes immediately (#2423)
Previously emphasis mode changes applied only on model load. Also added handling for mode 'None' (literal interpretation), which previously gave results identical to mode 'Ignore'.
This commit is contained in:
@@ -4,6 +4,8 @@ from collections import namedtuple
|
||||
from backend.text_processing import parsing, emphasis
|
||||
from backend import memory_management
|
||||
|
||||
from modules.shared import opts
|
||||
|
||||
|
||||
PromptChunkFix = namedtuple('PromptChunkFix', ['offset', 'embedding'])
|
||||
|
||||
@@ -21,7 +23,7 @@ class T5TextProcessingEngine:
|
||||
self.text_encoder = text_encoder.transformer
|
||||
self.tokenizer = tokenizer
|
||||
|
||||
self.emphasis = emphasis.get_current_option(emphasis_name)()
|
||||
self.emphasis = emphasis.get_current_option(opts.emphasis)()
|
||||
self.min_length = min_length
|
||||
self.id_end = 1
|
||||
self.id_pad = 0
|
||||
@@ -64,7 +66,7 @@ class T5TextProcessingEngine:
|
||||
return z
|
||||
|
||||
def tokenize_line(self, line):
|
||||
parsed = parsing.parse_prompt_attention(line)
|
||||
parsed = parsing.parse_prompt_attention(line, self.emphasis.name)
|
||||
|
||||
tokenized = self.tokenize([text for text, _ in parsed])
|
||||
|
||||
@@ -111,6 +113,8 @@ class T5TextProcessingEngine:
|
||||
zs = []
|
||||
cache = {}
|
||||
|
||||
self.emphasis = emphasis.get_current_option(opts.emphasis)()
|
||||
|
||||
for line in texts:
|
||||
if line in cache:
|
||||
line_z_values = cache[line]
|
||||
|
||||
Reference in New Issue
Block a user