mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
fix control img2img
This commit is contained in:
+23
-16
@@ -179,6 +179,7 @@ class StableDiffusionProcessing:
|
||||
self.all_subseeds = None
|
||||
self.clip_skip = clip_skip
|
||||
self.iteration = 0
|
||||
self.is_control = False
|
||||
self.is_hr_pass = False
|
||||
self.is_refiner_pass = False
|
||||
self.hr_force = False
|
||||
@@ -797,20 +798,9 @@ def validate_sample(tensor):
|
||||
return cast
|
||||
|
||||
|
||||
def process_images_inner(p: StableDiffusionProcessing) -> Processed:
|
||||
"""this is the main loop that both txt2img and img2img use; it calls func_init once inside all the scopes and func_sample once per batch"""
|
||||
|
||||
if type(p.prompt) == list:
|
||||
assert len(p.prompt) > 0
|
||||
else:
|
||||
assert p.prompt is not None
|
||||
|
||||
def process_init(p: StableDiffusionProcessing):
|
||||
seed = get_fixed_seed(p.seed)
|
||||
subseed = get_fixed_seed(p.subseed)
|
||||
if shared.backend == shared.Backend.ORIGINAL:
|
||||
modules.sd_hijack.model_hijack.apply_circular(p.tiling)
|
||||
modules.sd_hijack.model_hijack.clear_comments()
|
||||
comments = {}
|
||||
if type(p.prompt) == list:
|
||||
p.all_prompts = [shared.prompt_styles.apply_styles_to_prompt(x, p.styles) for x in p.prompt]
|
||||
else:
|
||||
@@ -827,15 +817,32 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
|
||||
p.all_subseeds = subseed
|
||||
else:
|
||||
p.all_subseeds = [int(subseed) + x for x in range(len(p.all_prompts))]
|
||||
if os.path.exists(shared.opts.embeddings_dir) and not p.do_not_reload_embeddings and shared.backend == shared.Backend.ORIGINAL:
|
||||
modules.sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=False)
|
||||
if p.scripts is not None and isinstance(p.scripts, modules.scripts.ScriptRunner):
|
||||
p.scripts.process(p)
|
||||
|
||||
|
||||
def process_images_inner(p: StableDiffusionProcessing) -> Processed:
|
||||
"""this is the main loop that both txt2img and img2img use; it calls func_init once inside all the scopes and func_sample once per batch"""
|
||||
|
||||
if type(p.prompt) == list:
|
||||
assert len(p.prompt) > 0
|
||||
else:
|
||||
assert p.prompt is not None
|
||||
|
||||
if shared.backend == shared.Backend.ORIGINAL:
|
||||
modules.sd_hijack.model_hijack.apply_circular(p.tiling)
|
||||
modules.sd_hijack.model_hijack.clear_comments()
|
||||
comments = {}
|
||||
infotexts = []
|
||||
output_images = []
|
||||
cached_uc = [None, None]
|
||||
cached_c = [None, None]
|
||||
|
||||
process_init(p)
|
||||
if os.path.exists(shared.opts.embeddings_dir) and not p.do_not_reload_embeddings and shared.backend == shared.Backend.ORIGINAL:
|
||||
modules.sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=False)
|
||||
if p.scripts is not None and isinstance(p.scripts, modules.scripts.ScriptRunner):
|
||||
p.scripts.process(p)
|
||||
|
||||
|
||||
def get_conds_with_caching(function, required_prompts, steps, cache):
|
||||
if cache[0] is not None and (required_prompts, steps) == cache[0]:
|
||||
return cache[1]
|
||||
|
||||
Reference in New Issue
Block a user