Commit c88dcc20 authored by space-nuko's avatar space-nuko
Browse files

UniPC does not support img2img (for now)

parent 21880eb9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -884,7 +884,7 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):

        shared.state.nextjob()

        img2img_sampler_name = 'DDIM'  # PLMS does not support img2img so we just silently switch ot DDIM
        img2img_sampler_name = 'DDIM'  # PLMS/UniPC does not support img2img so we just silently switch ot DDIM
        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]
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ def set_samplers():
    global samplers, samplers_for_img2img

    hidden = set(shared.opts.hide_samplers)
    hidden_img2img = set(shared.opts.hide_samplers + ['PLMS'])
    hidden_img2img = set(shared.opts.hide_samplers + ['PLMS', 'UniPC'])

    samplers = [x for x in all_samplers if x.name not in hidden]
    samplers_for_img2img = [x for x in all_samplers if x.name not in hidden_img2img]
+1 −1
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ class VanillaStableDiffusionSampler:
        self.nmask = p.nmask if hasattr(p, 'nmask') else None

    def adjust_steps_if_invalid(self, p, num_steps):
        if ((self.config.name == 'DDIM' or self.config.name == "UniPC") and p.ddim_discretize == 'uniform') or (self.config.name == 'PLMS'):
        if ((self.config.name == 'DDIM') and p.ddim_discretize == 'uniform') or (self.config.name == 'PLMS') or (self.config.name == 'UniPC'):
            valid_step = 999 / (1000 // num_steps)
            if valid_step == math.floor(valid_step):
                return int(valid_step) + 1