aboutsummaryrefslogtreecommitdiff
path: root/modules/processing.py
diff options
context:
space:
mode:
authorinvincibledude <>2023-01-21 23:14:59 +0300
committerinvincibledude <>2023-01-21 23:14:59 +0300
commit3bd898b6ce94f34bcc7685672f0e4318d2d86b33 (patch)
treeef4d0e75fe6878a89c8bab77cb1bb6e25b584cb5 /modules/processing.py
parentf53527f7786575fe60da0223bd63ea3f0a06a754 (diff)
First test of different sampler for hi-res fix
Diffstat (limited to 'modules/processing.py')
-rw-r--r--modules/processing.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/processing.py b/modules/processing.py
index 6e6371a1..b3206f80 100644
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -710,7 +710,7 @@ def old_hires_fix_first_pass_dimensions(width, height):
class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
sampler = None
- def __init__(self, enable_hr: bool = False, denoising_strength: float = 0.75, firstphase_width: int = 0, firstphase_height: int = 0, hr_scale: float = 2.0, hr_upscaler: str = None, hr_second_pass_steps: int = 0, hr_resize_x: int = 0, hr_resize_y: int = 0, **kwargs):
+ def __init__(self, enable_hr: bool = False, denoising_strength: float = 0.75, firstphase_width: int = 0, firstphase_height: int = 0, hr_scale: float = 2.0, hr_upscaler: str = None, hr_second_pass_steps: int = 0, hr_resize_x: int = 0, hr_resize_y: int = 0, hr_sampler: int = 0, **kwargs):
super().__init__(**kwargs)
self.enable_hr = enable_hr
self.denoising_strength = denoising_strength
@@ -721,6 +721,7 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
self.hr_resize_y = hr_resize_y
self.hr_upscale_to_x = hr_resize_x
self.hr_upscale_to_y = hr_resize_y
+ self.hr_sampler = hr_sampler
if firstphase_width != 0 or firstphase_height != 0:
self.hr_upscale_to_x = self.width
@@ -862,6 +863,10 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
shared.state.nextjob()
img2img_sampler_name = self.sampler_name if self.sampler_name != 'PLMS' else 'DDIM' # PLMS does not support img2img so we just silently switch ot DDIM
+
+ if self.hr_sampler != 0 and sd_samplers.samplers[self.hr_sampler].name != 'PLMS':
+ img2img_sampler_name = sd_samplers.samplers[self.hr_sampler].name
+
self.sampler = sd_samplers.create_sampler(img2img_sampler_name, self.sd_model)
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]