From b5eaa0ccb42e301bec8c783f7e6ee87444e0072b Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Mon, 9 Oct 2023 15:42:12 -0400 Subject: [PATCH] fix samplers init --- CHANGELOG.md | 2 +- modules/images.py | 1 - modules/processing.py | 9 ++++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1260ac1fa..b0fd956fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -133,7 +133,7 @@ or even free speedups and quality improvements (regardless of which workflows yo - to enable search, make sure all models have set hash values *Models -> Valida -> Calculate hashes* - **LoRA** - - new unified LoRA handler for all LoRA types (lora, lyco, loha, lokr, locon, etc.) + - new unified LoRA handler for all LoRA types (lora, lyco, loha, lokr, locon, ia3, etc.) applies to both original and diffusers backend thanks @AI-Casanova for diffusers port - for *backend:original*, separate lyco handler has been removed diff --git a/modules/images.py b/modules/images.py index 929119c65..1c930b212 100644 --- a/modules/images.py +++ b/modules/images.py @@ -598,7 +598,6 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='jpg', i filename = filename[:max_name_len - max(4, len(extension))] params.filename = filename + extension txt_fullfn = f"{filename}.txt" if shared.opts.save_txt and len(exifinfo) > 0 else None - save_queue.put((params.image, filename, extension, params, exifinfo, txt_fullfn)) # actual save is executed in a thread that polls data from queue save_queue.join() diff --git a/modules/processing.py b/modules/processing.py index 69209fab1..1c926f7de 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -1029,7 +1029,8 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing): self.ops.append('txt2img') hypertile_set(self) self.sampler = modules.sd_samplers.create_sampler(self.sampler_name, self.sd_model) - self.sampler.initialize(self) + if hasattr(self.sampler, "initialize"): + self.sampler.initialize(self) x = create_random_tensors([4, self.height // 8, self.width // 8], seeds=seeds, subseeds=subseeds, subseed_strength=self.subseed_strength, seed_resize_from_h=self.seed_resize_from_h, seed_resize_from_w=self.seed_resize_from_w, p=self) samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x)) if not self.enable_hr or shared.state.interrupted or shared.state.skipped: @@ -1078,7 +1079,8 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing): self.ops.append('hires') devices.torch_gc() # GC now before running the next img2img to prevent running out of memory self.sampler = modules.sd_samplers.create_sampler(self.latent_sampler or self.sampler_name, self.sd_model) - self.sampler.initialize(self) + if hasattr(self.sampler, "initialize"): + self.sampler.initialize(self) samples = samples[:, :, self.truncate_y//2:samples.shape[2]-(self.truncate_y+1)//2, self.truncate_x//2:samples.shape[3]-(self.truncate_x+1)//2] noise = create_random_tensors(samples.shape[1:], seeds=seeds, subseeds=subseeds, subseed_strength=subseed_strength, p=self) modules.sd_models.apply_token_merging(self.sd_model, self.get_token_merging_ratio(for_hr=True)) @@ -1134,7 +1136,8 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing): if self.sampler_name == "PLMS": self.sampler_name = 'UniPC' self.sampler = modules.sd_samplers.create_sampler(self.sampler_name, self.sd_model) - self.sampler.initialize(self) + if hasattr(self.sampler, "initialize"): + self.sampler.initialize(self) if self.image_mask is not None: self.ops.append('inpaint')