From d02c4da483a656331f641224fe5da5f694580066 Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Mon, 21 Aug 2023 08:58:15 +0300 Subject: [PATCH] also prevent changing API options via override_settings --- modules/options.py | 4 ++-- modules/processing.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/options.py b/modules/options.py index 41d1b672c..758b1ce5f 100644 --- a/modules/options.py +++ b/modules/options.py @@ -116,7 +116,7 @@ class Options: return super(Options, self).__getattribute__(item) - def set(self, key, value, is_api=False): + def set(self, key, value, is_api=False, run_callbacks=True): """sets an option and calls its onchange callback, returning True if the option changed and False otherwise""" oldval = self.data.get(key, None) @@ -135,7 +135,7 @@ class Options: except RuntimeError: return False - if option.onchange is not None: + if run_callbacks and option.onchange is not None: try: option.onchange() except Exception as e: diff --git a/modules/processing.py b/modules/processing.py index d4926524f..e60cc92b0 100755 --- a/modules/processing.py +++ b/modules/processing.py @@ -709,7 +709,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed: sd_models.reload_model_weights() for k, v in p.override_settings.items(): - setattr(opts, k, v) + opts.set(k, v, is_api=True, run_callbacks=False) if k == 'sd_model_checkpoint': sd_models.reload_model_weights()