diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-06 10:25:51 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-06 10:25:51 +0000 |
commit | 57e8a11d17a6646fdf551320f5f714fba752987a (patch) | |
tree | 70be8362501850cb83417ca0f2886858459eac3b /modules/processing.py | |
parent | f9950da3e30e6c8e2993d1d69d6e5c26c6a56485 (diff) | |
download | stable-diffusion-webui-gfx803-57e8a11d17a6646fdf551320f5f714fba752987a.tar.gz stable-diffusion-webui-gfx803-57e8a11d17a6646fdf551320f5f714fba752987a.tar.bz2 stable-diffusion-webui-gfx803-57e8a11d17a6646fdf551320f5f714fba752987a.zip |
enable cond cache by default
Diffstat (limited to 'modules/processing.py')
-rw-r--r-- | modules/processing.py | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/modules/processing.py b/modules/processing.py index 7d21fb12..31745006 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -295,7 +295,7 @@ class StableDiffusionProcessing: self.sampler = None
self.c = None
self.uc = None
- if not opts.experimental_persistent_cond_cache:
+ if not opts.persistent_cond_cache:
StableDiffusionProcessing.cached_c = [None, None]
StableDiffusionProcessing.cached_uc = [None, None]
@@ -319,6 +319,21 @@ class StableDiffusionProcessing: self.all_prompts = [shared.prompt_styles.apply_styles_to_prompt(x, self.styles) for x in self.all_prompts]
self.all_negative_prompts = [shared.prompt_styles.apply_negative_styles_to_prompt(x, self.styles) for x in self.all_negative_prompts]
+ def cached_params(self, required_prompts, steps, extra_network_data):
+ """Returns parameters that invalidate the cond cache if changed"""
+
+ return (
+ required_prompts,
+ steps,
+ opts.CLIP_stop_at_last_layers,
+ shared.sd_model.sd_checkpoint_info,
+ extra_network_data,
+ opts.sdxl_crop_left,
+ opts.sdxl_crop_top,
+ self.width,
+ self.height,
+ )
+
def get_conds_with_caching(self, function, required_prompts, steps, caches, extra_network_data):
"""
Returns the result of calling function(shared.sd_model, required_prompts, steps)
@@ -332,17 +347,7 @@ class StableDiffusionProcessing: caches is a list with items described above.
"""
- cached_params = (
- required_prompts,
- steps,
- opts.CLIP_stop_at_last_layers,
- shared.sd_model.sd_checkpoint_info,
- extra_network_data,
- opts.sdxl_crop_left,
- opts.sdxl_crop_top,
- self.width,
- self.height,
- )
+ cached_params = self.cached_params(required_prompts, steps, extra_network_data)
for cache in caches:
if cache[0] is not None and cached_params == cache[0]:
@@ -1184,7 +1189,7 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing): super().close()
self.hr_c = None
self.hr_uc = None
- if not opts.experimental_persistent_cond_cache:
+ if not opts.persistent_cond_cache:
StableDiffusionProcessingTxt2Img.cached_hr_uc = [None, None]
StableDiffusionProcessingTxt2Img.cached_hr_c = [None, None]
|