add BREAK keyword to end current text chunk and start the next

This commit is contained in:
AUTOMATIC
2023-01-15 22:29:53 +03:00
parent 205991df78
commit 8e2aeee4a1
2 changed files with 19 additions and 5 deletions

View File

@@ -274,6 +274,7 @@ re_attention = re.compile(r"""
:
""", re.X)
re_break = re.compile(r"\s*\bBREAK\b\s*", re.S)
def parse_prompt_attention(text):
"""
@@ -339,7 +340,11 @@ def parse_prompt_attention(text):
elif text == ']' and len(square_brackets) > 0:
multiply_range(square_brackets.pop(), square_bracket_multiplier)
else:
res.append([text, 1.0])
parts = re.split(re_break, text)
for i, part in enumerate(parts):
if i > 0:
res.append(["BREAK", -1])
res.append([part, 1.0])
for pos in round_brackets:
multiply_range(pos, round_bracket_multiplier)