process_one
This commit is contained in:
parent
172c4bc09f
commit
a9e979977a
|
@ -509,6 +509,9 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
|
||||||
if len(prompts) == 0:
|
if len(prompts) == 0:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if p.scripts is not None:
|
||||||
|
p.scripts.process_one(p)
|
||||||
|
|
||||||
with devices.autocast():
|
with devices.autocast():
|
||||||
uc = prompt_parser.get_learned_conditioning(shared.sd_model, len(prompts) * [p.negative_prompt], p.steps)
|
uc = prompt_parser.get_learned_conditioning(shared.sd_model, len(prompts) * [p.negative_prompt], p.steps)
|
||||||
c = prompt_parser.get_multicond_learned_conditioning(shared.sd_model, prompts, p.steps)
|
c = prompt_parser.get_multicond_learned_conditioning(shared.sd_model, prompts, p.steps)
|
||||||
|
|
|
@ -70,6 +70,13 @@ class Script:
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def process_one(self, p, *args):
|
||||||
|
"""
|
||||||
|
Same as process(), but called for every iteration
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
def postprocess(self, p, processed, *args):
|
def postprocess(self, p, processed, *args):
|
||||||
"""
|
"""
|
||||||
This function is called after processing ends for AlwaysVisible scripts.
|
This function is called after processing ends for AlwaysVisible scripts.
|
||||||
|
@ -294,6 +301,15 @@ class ScriptRunner:
|
||||||
print(f"Error running process: {script.filename}", file=sys.stderr)
|
print(f"Error running process: {script.filename}", file=sys.stderr)
|
||||||
print(traceback.format_exc(), file=sys.stderr)
|
print(traceback.format_exc(), file=sys.stderr)
|
||||||
|
|
||||||
|
def process_one(self, p):
|
||||||
|
for script in self.alwayson_scripts:
|
||||||
|
try:
|
||||||
|
script_args = p.script_args[script.args_from:script.args_to]
|
||||||
|
script.process_one(p, *script_args)
|
||||||
|
except Exception:
|
||||||
|
print(f"Error running process_one: {script.filename}", file=sys.stderr)
|
||||||
|
print(traceback.format_exc(), file=sys.stderr)
|
||||||
|
|
||||||
def postprocess(self, p, processed):
|
def postprocess(self, p, processed):
|
||||||
for script in self.alwayson_scripts:
|
for script in self.alwayson_scripts:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue