This commit is contained in:
lllyasviel
2024-01-27 19:37:33 -08:00
parent 20f1fb6c0b
commit 848f28af6e
3 changed files with 56 additions and 7 deletions

View File

@@ -186,6 +186,14 @@ class Script:
"""
pass
def process_before_every_sampling(self, p, *args, **kwargs):
"""
Similar to process(), called before every sampling.
If you use high-res fix, this will be called two times.
"""
pass
def process_batch(self, p, *args, **kwargs):
"""
Same as process(), but called for every batch.
@@ -809,6 +817,14 @@ class ScriptRunner:
except Exception:
errors.report(f"Error running process_batch: {script.filename}", exc_info=True)
def process_before_every_sampling(self, p, **kwargs):
for script in self.alwayson_scripts:
try:
script_args = p.script_args[script.args_from:script.args_to]
script.process_before_every_sampling(p, *script_args, **kwargs)
except Exception:
errors.report(f"Error running process_before_every_sampling: {script.filename}", exc_info=True)
def postprocess(self, p, processed):
for script in self.alwayson_scripts:
try: