mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
add mod regional tiling
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -162,7 +162,10 @@ def parse_prompt(prompt):
|
||||
args = m.group(2)
|
||||
res[name].append(ExtraNetworkParams(items=args.split(":")))
|
||||
return ""
|
||||
prompt = re.sub(re_extra_net, found, prompt)
|
||||
if isinstance(prompt, list):
|
||||
prompt = [re.sub(re_extra_net, found, p) for p in prompt]
|
||||
else:
|
||||
prompt = re.sub(re_extra_net, found, prompt)
|
||||
return prompt, res
|
||||
|
||||
|
||||
|
||||
@@ -260,9 +260,10 @@ def process_init(p: StableDiffusionProcessing):
|
||||
else:
|
||||
p.all_subseeds = [int(subseed) + x for x in range(len(p.all_prompts))]
|
||||
if reset_prompts:
|
||||
p.all_prompts, p.all_negative_prompts = shared.prompt_styles.apply_styles_to_prompts(p.all_prompts, p.all_negative_prompts, p.styles, p.all_seeds)
|
||||
p.prompts = p.all_prompts[p.iteration * p.batch_size:(p.iteration+1) * p.batch_size]
|
||||
p.negative_prompts = p.all_negative_prompts[p.iteration * p.batch_size:(p.iteration+1) * p.batch_size]
|
||||
if not hasattr(p, 'keep_prompts'):
|
||||
p.all_prompts, p.all_negative_prompts = shared.prompt_styles.apply_styles_to_prompts(p.all_prompts, p.all_negative_prompts, p.styles, p.all_seeds)
|
||||
p.prompts = p.all_prompts[p.iteration * p.batch_size:(p.iteration+1) * p.batch_size]
|
||||
p.negative_prompts = p.all_negative_prompts[p.iteration * p.batch_size:(p.iteration+1) * p.batch_size]
|
||||
p.prompts, _ = extra_networks.parse_prompts(p.prompts)
|
||||
|
||||
|
||||
@@ -312,8 +313,9 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
|
||||
if shared.native:
|
||||
from modules import ipadapter
|
||||
ipadapter.apply(shared.sd_model, p)
|
||||
p.prompts = p.all_prompts[n * p.batch_size:(n+1) * p.batch_size]
|
||||
p.negative_prompts = p.all_negative_prompts[n * p.batch_size:(n+1) * p.batch_size]
|
||||
if not hasattr(p, 'keep_prompts'):
|
||||
p.prompts = p.all_prompts[n * p.batch_size:(n+1) * p.batch_size]
|
||||
p.negative_prompts = p.all_negative_prompts[n * p.batch_size:(n+1) * p.batch_size]
|
||||
p.seeds = p.all_seeds[n * p.batch_size:(n+1) * p.batch_size]
|
||||
p.subseeds = p.all_subseeds[n * p.batch_size:(n+1) * p.batch_size]
|
||||
if p.scripts is not None and isinstance(p.scripts, scripts.ScriptRunner):
|
||||
|
||||
@@ -428,6 +428,8 @@ def resize_hires(p, latents): # input=latents output=pil if not latent_upscaler
|
||||
|
||||
|
||||
def fix_prompts(p, prompts, negative_prompts, prompts_2, negative_prompts_2):
|
||||
if hasattr(p, 'keep_prompts'):
|
||||
return prompts, negative_prompts, prompts_2, negative_prompts_2
|
||||
if type(prompts) is str:
|
||||
prompts = [prompts]
|
||||
if type(negative_prompts) is str:
|
||||
|
||||
+2
-1
@@ -69,7 +69,7 @@ def apply_file_wildcards(prompt, replaced = [], not_found = [], recursion=0, see
|
||||
return check_wildcard_files(prompt, wildcard, files, file_only=False)
|
||||
|
||||
recursion += 1
|
||||
if not shared.opts.wildcards_enabled or recursion >= 10:
|
||||
if not shared.opts.wildcards_enabled or recursion >= 10 or not isinstance(prompt, str) or len(prompt) == 0:
|
||||
return prompt, replaced, not_found
|
||||
matches = re.findall(r'__(.*?)__', prompt, re.DOTALL)
|
||||
matches = [m for m in matches if m not in not_found]
|
||||
@@ -303,6 +303,7 @@ class StyleDatabase:
|
||||
prompt = apply_styles_to_prompt(prompt, [self.find_style(x).prompt for x in styles])
|
||||
prompt = apply_wildcards_to_prompt(prompt, [self.find_style(x).wildcards for x in styles], seeds[i])
|
||||
parsed_positive.append(prompt)
|
||||
for i in range(len(negatives)):
|
||||
prompt = negatives[i]
|
||||
prompt = apply_styles_to_prompt(prompt, [self.find_style(x).negative_prompt for x in styles])
|
||||
prompt = apply_wildcards_to_prompt(prompt, [self.find_style(x).wildcards for x in styles], seeds[i])
|
||||
|
||||
Reference in New Issue
Block a user