Views
No views yet
1from diffusers import StableDiffusionXLPipeline
2
3pipe = StableDiffusionXLPipeline.from_pretrained(
4 "stabilityai/stable-diffusion-xl-base-1.0",
5 custom_pipeline="multimodalart/sdxl_perturbed_attention_guidance",
6 torch_dtype=torch.float16
7)
8
9device="cuda"
10pipe = pipe.to(device)
1output = pipe(
2 "",
3 num_inference_steps=50,
4 guidance_scale=0.0,
5 pag_scale=5.0,
6 pag_applied_layers=['mid']
7 ).images
1output = pipe(
2 "the spirit of a tamagotchi wandering in the city of Vienna",
3 num_inference_steps=25,
4 guidance_scale=4.0,
5 pag_scale=3.0,
6 pag_applied_layers=['mid']
7 ).imagesguidance_scale : guidance scale of CFG (ex: 7.5)pag_scale : guidance scale of PAG (ex: 4.0)pag_applied_layers: layer to apply perturbation (ex: ['mid'])pag_applied_layers_index : index of the layers to apply perturbation (ex: ['m0', 'm1'])