hyoungwoncho's picture
Update README.md
b8f0ab3 verified
|
raw
history blame
1.06 kB
metadata
language:
  - en
pipeline_tag: unconditional-image-generation
tags:
  - Diffusion Models
  - Stable Diffusion
  - Perturbed-Attention Guidance
  - PAG

Perturbed-Attention Guidance

This repository is based on Diffusers. StableDiffusionPAGPipeline is a modification of StableDiffusionPipeline to support Perturbed-Attention Guidance (PAG).

Quickstart

Load StableDiffusionPAGPipeline as below:

pipe = StableDiffusionPipeline.from_pretrained(
    "runwayml/stable-diffusion-v1-5",
    custom_pipeline="hyoungwoncho/sd_perturbed_attention_guidance",
    torch_dtype=torch.float16,
    safety_checker=None
)

Sampling:

output_baseline = pipe(
        prompts,
        width=512,
        height=512,
        num_inference_steps=50,
        guidance_scale=0.0,
        pag_scale=4.5,
        pag_applied_layers_index=pag_applied_layers_index
    ).images

Parameters:

pag_scale : gudiance scale of PAG (ex: 4.5) pag_applied_layers_index = index of the layer to apply perturbation (ex: ['m0'])