aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrandom_thoughtss <random_thoughtss@proton.me>2022-10-20 04:46:13 +0000
committerrandom_thoughtss <random_thoughtss@proton.me>2022-10-20 04:46:13 +0000
commitaa7ff2a1972f3865883e10ba28c5414cdebe8e3b (patch)
tree1c3856b1805e03d443c9e47ddb8ba31f6b0c90ad
parentc418467c03db916c3e5312e6ac4a67365e196dbd (diff)
downloadstable-diffusion-webui-gfx803-aa7ff2a1972f3865883e10ba28c5414cdebe8e3b.tar.gz
stable-diffusion-webui-gfx803-aa7ff2a1972f3865883e10ba28c5414cdebe8e3b.tar.bz2
stable-diffusion-webui-gfx803-aa7ff2a1972f3865883e10ba28c5414cdebe8e3b.zip
Fixed non-square highres fix generation
-rw-r--r--modules/processing.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/processing.py b/modules/processing.py
index 684e5833..3caac25e 100644
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -541,10 +541,13 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
self.truncate_y = int(self.firstphase_height - firstphase_height_truncated) // opt_f
- def create_dummy_mask(self, x):
+ def create_dummy_mask(self, x, first_phase: bool = False):
if self.sampler.conditioning_key in {'hybrid', 'concat'}:
+ height = self.firstphase_height if first_phase else self.height
+ width = self.firstphase_width if first_phase else self.width
+
# The "masked-image" in this case will just be all zeros since the entire image is masked.
- image_conditioning = torch.zeros(x.shape[0], 3, self.height, self.width, device=x.device)
+ image_conditioning = torch.zeros(x.shape[0], 3, height, width, device=x.device)
image_conditioning = self.sd_model.get_first_stage_encoding(self.sd_model.encode_first_stage(image_conditioning))
# Add the fake full 1s mask to the first dimension.
@@ -567,7 +570,7 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
return samples
x = create_random_tensors([opt_C, self.firstphase_height // opt_f, self.firstphase_width // opt_f], 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.create_dummy_mask(x))
+ samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.create_dummy_mask(x, first_phase=True))
samples = samples[:, :, self.truncate_y//2:samples.shape[2]-self.truncate_y//2, self.truncate_x//2:samples.shape[3]-self.truncate_x//2]