diff options
author | AUTOMATIC <16777216c@gmail.com> | 2023-01-16 20:09:08 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2023-01-16 20:09:08 +0000 |
commit | e0e80050091ea7f58ae17c69f31d1b5de5e0ae20 (patch) | |
tree | 04680fb1ae1f709c477e998b326f147b2b1a9802 /modules/processing.py | |
parent | 9991967f40120b88a1dc925fdf7d747d5e016888 (diff) | |
download | stable-diffusion-webui-gfx803-e0e80050091ea7f58ae17c69f31d1b5de5e0ae20.tar.gz stable-diffusion-webui-gfx803-e0e80050091ea7f58ae17c69f31d1b5de5e0ae20.tar.bz2 stable-diffusion-webui-gfx803-e0e80050091ea7f58ae17c69f31d1b5de5e0ae20.zip |
make StableDiffusionProcessing class not hold a reference to shared.sd_model object
Diffstat (limited to 'modules/processing.py')
-rw-r--r-- | modules/processing.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/processing.py b/modules/processing.py index ab7b3b7d..9c3673de 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -94,7 +94,7 @@ def txt2img_image_conditioning(sd_model, x, width, height): return image_conditioning
-class StableDiffusionProcessing():
+class StableDiffusionProcessing:
"""
The first set of paramaters: sd_models -> do_not_reload_embeddings represent the minimum required to create a StableDiffusionProcessing
"""
@@ -102,7 +102,6 @@ class StableDiffusionProcessing(): if sampler_index is not None:
print("sampler_index argument for StableDiffusionProcessing does not do anything; use sampler_name", file=sys.stderr)
- self.sd_model = sd_model
self.outpath_samples: str = outpath_samples
self.outpath_grids: str = outpath_grids
self.prompt: str = prompt
@@ -156,6 +155,10 @@ class StableDiffusionProcessing(): self.all_subseeds = None
self.iteration = 0
+ @property
+ def sd_model(self):
+ return shared.sd_model
+
def txt2img_image_conditioning(self, x, width=None, height=None):
self.is_using_inpainting_conditioning = self.sd_model.model.conditioning_key in {'hybrid', 'concat'}
@@ -236,7 +239,6 @@ class StableDiffusionProcessing(): raise NotImplementedError()
def close(self):
- self.sd_model = None
self.sampler = None
@@ -471,7 +473,6 @@ def process_images(p: StableDiffusionProcessing) -> Processed: if k == 'sd_model_checkpoint':
sd_models.reload_model_weights() # make onchange call for changing SD model
- p.sd_model = shared.sd_model
if k == 'sd_vae':
sd_vae.reload_vae_weights() # make onchange call for changing VAE
|