fix samplers init

This commit is contained in:
Vladimir Mandic
2023-10-09 15:42:12 -04:00
parent d80890531c
commit b5eaa0ccb4
3 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -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
-1
View File
@@ -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()
+6 -3
View File
@@ -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')