metadata
language:
- en
pipeline_tag: unconditional-image-generation
tags:
- Diffusion Models
- Stable Diffusion
- Perturbed-Attention Guidance
- PAG
Inpainting with Perturbed-Attention Guidance
This repository is based on Diffusers. The pipeline is a modification of StableDiffusionPipeline to support inpainting with Perturbed-Attention Guidance (PAG).
Quickstart
Loading Custom Piepline:
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-inpainting",
custom_pipeline="hyoungwoncho/sd_perturbed_attention_guidance_inpaint",
torch_dtype=torch.float16,
safety_checker=None
)
device="cuda"
pipe = pipe.to(device)
Inpainting with PAG:
output = pipe(
prompts,
image=init_image,
mask_image=mask_image,
num_inference_steps=50,
guidance_scale=0.0,
pag_scale=3.0,
pag_applied_layers_index=['u0']
).images[0]
Parameters
guidance_scale : gudiance scale of CFG (ex: 7.5)
pag_scale : gudiance scale of PAG (ex: 3.0)
pag_applied_layers_index : index of the layer to apply perturbation (ex: ['u0'])