tune style and prompt balance

This commit is contained in:
lvmin 2023-09-10 12:45:54 -07:00
parent c585ef23c4
commit c4125c3b6b
5 changed files with 19 additions and 6 deletions

View File

@ -1 +1 @@
version = '1.0.59'
version = '1.0.60'

View File

@ -59,7 +59,8 @@ def worker():
n_txt = apply_style_negative(style_selction, negative_prompt)
n_cond = pipeline.process_prompt(n_txt)
outputs.append(['preview', (9, 'Encoding positive text ...', None)])
p_txt = apply_style_positive(style_selction, prompt)
p_txt_a, p_txt_b = apply_style_positive(style_selction, prompt)
p_txt = p_txt_a + p_txt_b
p_cond = pipeline.process_prompt(p_txt)
for i in range(image_number):
@ -76,9 +77,13 @@ def worker():
for i in range(image_number):
outputs.append(['preview', (5, f'Preparing positive text #{i + 1} ...', None)])
current_seed = seed + i
p_txt = pipeline.expand_txt(prompt, current_seed)
print(f'Expanded positive prompt: \n\n{p_txt}\n\n')
p_txt = apply_style_positive(style_selction, p_txt)
p_txt_a, p_txt_b = apply_style_positive(style_selction, prompt)
p_txt_e = pipeline.expand_txt(p_txt_a, current_seed)
print(f'Expanded prompt: \n\n{p_txt_e}\n\n')
p_txt = p_txt_e + p_txt_b
tasks.append(dict(
prompt=prompt,
negative_prompt=negative_prompt,

View File

@ -6,6 +6,7 @@ from modules.path import fooocus_expansion_path
fooocus_magic_split = [
', extremely',
', trending',
', with',
', perfect',
', intricate',
'. The',

View File

@ -961,7 +961,10 @@ aspect_ratios = {str(v[0]) + '×' + str(v[1]): v for k, v in SD_XL_BASE_RATIOS.i
def apply_style_positive(style, txt):
p, n = styles.get(style, default_style)
return p.replace('{prompt}', txt)
ps = p.split('{prompt}')
if len(ps) != 2:
return txt, ''
return ps[0] + txt, ps[1]
def apply_style_negative(style, txt):

View File

@ -1,3 +1,7 @@
### 1.0.60
* Tune the balance between style and Prompt Expansion.
### 1.0.56
* Begin to use magic split.