stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: vae support breaks inpainting hijack?

Open nagolinc opened this issue 2 years ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

When switching to inpainting model, I get the error

TypeError: DDPM.__init__() got an unexpected keyword argument 'finetune_keys'
Interrupted with signal 2 in <frame at 0x000001D197DC7E00, file 'E:\\img\\auto1112\\stable-diffusion-webui\\webui.py', line 105, code wait_on_server>

Steps to reproduce the problem

  1. Go to "stable diffusion checkpoint"
  2. Press "sd-v1-5-inpainting.ckpt"
  3. See error

What should have happened?

I can fix this by modifying sd_hijack_inpainting.py like so

class LatentInpaintDiffusion(LatentDiffusion):
    def __init__(
        self,
        concat_keys=("mask", "masked_image"),
        masked_image_key="masked_image",
        *args,
        **kwargs,
    ):
        #remove finetune from kwargs
        print('about to die')
        if 'finetune_keys' in kwargs:          #added these lines
            del kwargs['finetune_keys']      #to fix the bug

        super().__init__(*args, **kwargs)
        self.masked_image_key = masked_image_key
        assert self.masked_image_key in concat_keys
        self.concat_keys = concat_keys

Commit where the problem happens

c418467c03db916c3e5312e6ac4a67365e196dbd

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--deepdanbooru --xformers

Additional information, context and logs

No response

nagolinc avatar Oct 23 '22 12:10 nagolinc

I can confirm that the fix also allows loading the new 2.0 inpainting model without any issues.

Magnesus avatar Nov 27 '22 20:11 Magnesus

I can confirm that the fix also allows loading the new 2.0 inpainting model without any issues.

Can additionally confirm this fixes loading 2.0 inpainting model.

jyap808 avatar Dec 01 '22 05:12 jyap808

I can also confirm that this fixes the 2.0 inpainting model.

Anyone want to make a pull request?

enn-nafnlaus avatar Dec 11 '22 14:12 enn-nafnlaus

I can also confirm that the 2.0 inpainting model now works after adding those lines.

ogzander avatar Dec 15 '22 05:12 ogzander