mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
fix segment delimiter
This commit is contained in:
@@ -34,7 +34,7 @@ plain: /([^\\\[\]():|]|\\.)+/
|
||||
""")
|
||||
re_clean = re.compile(r"^\W+", re.S)
|
||||
re_whitespace = re.compile(r"\s+", re.S)
|
||||
re_break = re.compile(r"\s*\bBREAK\b\s*", re.S)
|
||||
re_break = re.compile(r"\s*\bBREAK\b|##\s*", re.S)
|
||||
re_attention_v2 = re.compile(r"""
|
||||
\(|\[|\\\(|\\\[|\\|\\\\|
|
||||
:([+-]?[.\d]+)|
|
||||
@@ -336,13 +336,13 @@ def parse_prompt_attention(text):
|
||||
else:
|
||||
parts = re.split(re_break, text)
|
||||
for i, part in enumerate(parts):
|
||||
if i > 0:
|
||||
res.append(["BREAK", -1])
|
||||
if opts.prompt_attention == 'Full parser':
|
||||
part = re_clean.sub("", part)
|
||||
part = re_whitespace.sub(" ", part).strip()
|
||||
if len(part) == 0:
|
||||
continue
|
||||
if i > 0:
|
||||
res.append(["BREAK", -1])
|
||||
res.append([part, 1.0])
|
||||
for pos in round_brackets:
|
||||
multiply_range(pos, round_bracket_multiplier)
|
||||
@@ -366,7 +366,7 @@ if __name__ == "__main__":
|
||||
# import sys
|
||||
# sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
# input_text = "(upzero) (upone:1.1), ((uptwo:1.2)), [downzero], [downone:0.9], [[downtwo:0.8]], this is a test"
|
||||
input_text = 'a (white (lion:1.4)), cat [mouse] [tiger:0.8], (high) in a jungle'
|
||||
input_text = 'a (white (lion:1.4)), cat [mouse] [tiger:0.8], ##, (high) in a jungle'
|
||||
output_list = parse_prompt_attention(input_text)
|
||||
print('INPUT', input_text)
|
||||
print('OUTPUT', output_list)
|
||||
|
||||
@@ -162,7 +162,7 @@ class VanillaStableDiffusionSampler:
|
||||
num_steps = shared.opts.uni_pc_order
|
||||
valid_step = 999 / (1000 // num_steps)
|
||||
if valid_step == math.floor(valid_step):
|
||||
return int(valid_step) + 1
|
||||
return min(int(valid_step) + 1, num_steps)
|
||||
|
||||
return num_steps
|
||||
|
||||
|
||||
+3
-2
@@ -7,7 +7,7 @@ import urllib.request
|
||||
import gradio as gr
|
||||
import tqdm
|
||||
import requests
|
||||
from ldm.models.diffusion.ddpm import LatentDiffusion
|
||||
# from ldm.models.diffusion.ddpm import LatentDiffusion
|
||||
from modules import errors, ui_components, shared_items, cmd_args
|
||||
from modules.paths_internal import models_path, script_path, data_path, sd_configs_path, sd_default_config, sd_model_file, default_sd_model_file, extensions_dir, extensions_builtin_dir # pylint: disable=W0611
|
||||
import modules.interrogate
|
||||
@@ -769,5 +769,6 @@ class Shared(sys.modules[__name__].__class__):
|
||||
import modules.sd_models # pylint: disable=W0621
|
||||
modules.sd_models.model_data.set_sd_model(value)
|
||||
|
||||
sd_model: LatentDiffusion = None # this var is here just for IDE's type checking; it cannot be accessed because the class field above will be accessed instead
|
||||
# sd_model: LatentDiffusion = None # this var is here just for IDE's type checking; it cannot be accessed because the class field above will be accessed instead
|
||||
sd_model = None
|
||||
sys.modules[__name__].__class__ = Shared
|
||||
|
||||
Reference in New Issue
Block a user