From 7c6c849bd6ff333ab57b6108e4a9bfd7d88bac42 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Tue, 25 Jun 2024 12:29:07 -0400 Subject: [PATCH] fix zero params extensions --- CHANGELOG.md | 6 +++-- modules/scripts.py | 63 ++++++++++++++++++++-------------------------- wiki | 2 +- 3 files changed, 32 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dabe7b159..a5422c9e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ # Change Log for SD.Next -## Update for 2024-06-24 +## Update for 2024-06-25 -- enable `florence` VLM for all platforms, thanks @lshqqytiger! +- enable `florence` VLM for all platforms, thanks @lshqqytiger! +- fix executing extensions with zero params +- fix nncf for lora, thanks @Disty0! ## Update for 2024-06-23 diff --git a/modules/scripts.py b/modules/scripts.py index 87a25a56b..3dbeffb3f 100644 --- a/modules/scripts.py +++ b/modules/scripts.py @@ -489,10 +489,9 @@ class ScriptRunner: s = ScriptSummary('before-process') for script in self.alwayson_scripts: try: - args = p.script_args[script.args_from:script.args_to] - if len(args) == 0: - continue - script.before_process(p, *args, **kwargs) + if (script.args_to > 0) and (script.args_to >= script.args_from): + args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) + script.before_process(p, *args, **kwargs) except Exception as e: errors.display(e, f"Error running before process: {script.filename}") s.record(script.title()) @@ -502,10 +501,9 @@ class ScriptRunner: s = ScriptSummary('process') for script in self.alwayson_scripts: try: - args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) - if len(args) == 0: - continue - script.process(p, *args, **kwargs) + if (script.args_to > 0) and (script.args_to >= script.args_from): + args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) + script.process(p, *args, **kwargs) except Exception as e: errors.display(e, f'Running script process: {script.filename}') s.record(script.title()) @@ -516,10 +514,9 @@ class ScriptRunner: processed = None for script in self.alwayson_scripts: try: - args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) - if len(args) == 0: - continue - processed = script.process_images(p, *args, **kwargs) + if (script.args_to > 0) and (script.args_to >= script.args_from): + args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) + processed = script.process_images(p, *args, **kwargs) except Exception as e: errors.display(e, f'Running script process images: {script.filename}') s.record(script.title()) @@ -530,10 +527,9 @@ class ScriptRunner: s = ScriptSummary('before-process-batch') for script in self.alwayson_scripts: try: - args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) - if len(args) == 0: - continue - script.before_process_batch(p, *args, **kwargs) + if (script.args_to > 0) and (script.args_to >= script.args_from): + args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) + script.before_process_batch(p, *args, **kwargs) except Exception as e: errors.display(e, f'Running script before process batch: {script.filename}') s.record(script.title()) @@ -543,10 +539,9 @@ class ScriptRunner: s = ScriptSummary('process-batch') for script in self.alwayson_scripts: try: - args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) - if len(args) == 0: - continue - script.process_batch(p, *args, **kwargs) + if (script.args_to > 0) and (script.args_to >= script.args_from): + args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) + script.process_batch(p, *args, **kwargs) except Exception as e: errors.display(e, f'Running script process batch: {script.filename}') s.record(script.title()) @@ -556,10 +551,9 @@ class ScriptRunner: s = ScriptSummary('postprocess') for script in self.alwayson_scripts: try: - args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) - if len(args) == 0: - continue - script.postprocess(p, processed, *args) + if (script.args_to > 0) and (script.args_to >= script.args_from): + args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) + script.postprocess(p, processed, *args) except Exception as e: errors.display(e, f'Running script postprocess: {script.filename}') s.record(script.title()) @@ -569,10 +563,9 @@ class ScriptRunner: s = ScriptSummary('postprocess-batch') for script in self.alwayson_scripts: try: - args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) - if len(args) == 0: - continue - script.postprocess_batch(p, *args, images=images, **kwargs) + if (script.args_to > 0) and (script.args_to >= script.args_from): + args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) + script.postprocess_batch(p, *args, images=images, **kwargs) except Exception as e: errors.display(e, f'Running script before postprocess batch: {script.filename}') s.record(script.title()) @@ -582,10 +575,9 @@ class ScriptRunner: s = ScriptSummary('postprocess-batch-list') for script in self.alwayson_scripts: try: - args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) - if len(args) == 0: - continue - script.postprocess_batch_list(p, pp, *args, **kwargs) + if (script.args_to > 0) and (script.args_to >= script.args_from): + args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) + script.postprocess_batch_list(p, pp, *args, **kwargs) except Exception as e: errors.display(e, f'Running script before postprocess batch list: {script.filename}') s.record(script.title()) @@ -595,10 +587,9 @@ class ScriptRunner: s = ScriptSummary('postprocess-image') for script in self.alwayson_scripts: try: - args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) - if len(args) == 0: - continue - script.postprocess_image(p, pp, *args) + if (script.args_to > 0) and (script.args_to >= script.args_from): + args = p.per_script_args.get(script.title(), p.script_args[script.args_from:script.args_to]) + script.postprocess_image(p, pp, *args) except Exception as e: errors.display(e, f'Running script postprocess image: {script.filename}') s.record(script.title()) diff --git a/wiki b/wiki index 12211be1a..bfa10111e 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 12211be1a363f915f3e564933f065f1c86bbc397 +Subproject commit bfa10111e792140bca54c1480d6547b54752e761