Convert any SD model into inpaint model
github.comAUTOMATIC1111/stable-diffusion-webui/blob/master/modules/sd_hijack_inpainting.pyimport os
import torch

from einops import repeat
from omegaconf import ListConfig

import ldm.models.diffusion.ddpm
import ldm.models.diffusion.ddim
import ldm.models.diffusion.plms

from ldm.models.diffusion.ddpm import LatentDiffusion
from ldm.models.diffusion.plms import PLMSSampler
from ldm.models.diffusion.ddim import DDIMSampler, noise_like


@torch.no_grad()
def p_sample_plms(self, x, c, t, index, repeat_noise=False, use_original_steps=False, quantize_denoised=False,
                  temperature=1., noise_dropout=0., score_corrector=None, corrector_kwargs=None,
                  unconditional_guidance_scale=1., unconditional_conditioning=None, old_eps=None, t_next=None, dynamic_threshold=None):
    b, *_, device = *x.shape, x.deviceThis file has been truncated.show originalAutomatic 1111 has an ability to hijack any model for inpainting.Has anyone achieved it using diffusers?
2023-03-18T20:36:42Z
What is this feature and how do I use it?
2023-03-20T23:55:43Z
We explicitly don’t support generic hijacking of pipelines for inpainting, but more than happy to merge community pipelines in line with it