Merge branch 'dev' into automatic-color-inpaint

This commit is contained in:
Vladimir Mandic
2025-02-14 15:32:56 -05:00
committed by GitHub
3 changed files with 38 additions and 16 deletions
+10 -3
View File
@@ -1,8 +1,8 @@
# Change Log for SD.Next
## Update for 2025-02-13
## Update for 2025-02-14
### Highlight for 2025-02-13
### Highlight for 2025-02-14
We're back with another update with over 50 commits!
- Starting with massive UI update with full [localization](https://vladmandic.github.io/sdnext-docs/Locale/) for 8 languages
@@ -11,10 +11,12 @@ We're back with another update with over 50 commits!
- A lot of [outpainting](https://vladmandic.github.io/sdnext-docs/Outpaint/) goodies
- Support for new models: [AlphaVLLM Lumina 2](https://github.com/Alpha-VLLM/Lumina-Image-2.0) and [Ostris Flex.1-Alpha](https://huggingface.co/ostris/Flex.1-alpha)
- And new **Mixture-of-Diffusers** regional tiling pipeline
- Some changes to **prompt parsing** to allow more control as well as more flexibility when mouting SDNext server to custom URL
- Of course, cumulative fixes...
*...and more* - see [changelog](https://github.com/vladmandic/sdnext/blob/dev/CHANGELOG.md) for full details!
### Details for 2025-02-13
### Details for 2025-02-14
- **User Interface**
- **Hints**
@@ -77,6 +79,11 @@ We're back with another update with over 50 commits!
- **Text encoder**
add advanced per-model options for text encoder
set in *settings -> text encoder -> Optional*
- **Subpath**
allow setting additional mount subpath over which server url will be accessible
set in *settings -> user interface*
- **Prompt parsing**
better handling of prompt parsing when using masking char `\`
- **Fixes**
- update torch nightly urls
- docs/wiki always use relative links
+27 -12
View File
@@ -46,11 +46,19 @@ 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_attention_v2 = re.compile(r"""
\(|\[|\\\(|\\\[|\\|\\\\|
:([+-]?[.\d]+)|
\)|\]|\\\)|\\\]|
[^\(\)\[\]:]+|
:
\\\( | # Allow masked '\('
\\\) | # Allow masked '\)'
\\\: | # Allow masked '\:'
\\\[ | # Allow masked '\['
\\\] | # Allow masked '\]'
\\\\ | # Allow masked '\\'
\\ | # Removes '\'
\( | # Start '('
\[ | # Start '['
:([+-]?[.\d]+)\) | # Weight ':', followed by an optional sign and a number (integer or decimal), and then ')'
\) | # End ')'
\] | # End ']'
[^\\()\[\]:]+ | # Content matches any character except '\', '(', ')', '[', ']', ':'
""", re.X)
re_attention_v1 = re.compile(r"""
\\\(|
@@ -325,7 +333,7 @@ def parse_prompt_attention(text):
re_attention = re_attention_v1
whitespace = ''
else:
re_attention = re_attention_v1
re_attention = re_attention_v2
if native and opts.sd_textencder_linebreak:
text = text.replace('\n', ' BREAK ')
else:
@@ -335,7 +343,7 @@ def parse_prompt_attention(text):
def multiply_range(start_position, multiplier):
try:
for p in range(start_position, len(res)):
res[p][1] *= multiplier
res[p][1] = round(res[p][1] * multiplier, 3)
except Exception as e:
log(f'Prompt parser: {e}')
@@ -343,8 +351,14 @@ def parse_prompt_attention(text):
try:
section = m.group(0)
weight = m.group(1)
if section.startswith('\\'):
res.append([section[1:], 1.0])
# log.trace(f'Prompt: text="{text[m.start():m.end()]}" section="{section}" weight="{weight}"')
if len(section) == 0:
continue
elif section.startswith('\\'):
if len(res) > 0 and text[m.start()-1] != ' ':
res[-1][0] += section[1:] # append literal character to the last section
else:
res.append([section[1:], 1.0])
elif section == '(':
round_brackets.append(len(res))
elif section == '[':
@@ -377,9 +391,10 @@ def parse_prompt_attention(text):
# merge runs of identical weights
i = 0
while i + 1 < len(res):
if res[i][1] == res[i + 1][1]:
res[i][0] += whitespace + res[i + 1][0]
res.pop(i + 1)
if res[i][1] == res[i+1][1]:
sep = whitespace if res[i][0][-1].isalnum() else ''
res[i][0] += sep + res[i+1][0]
res.pop(i+1)
else:
i += 1
debug(f'Prompt: parser="{opts.prompt_attention}" {res}')
+1 -1
Submodule wiki updated: 068dbdabc3...5c16be8493