Skip to content

Commit e28419d

Browse files
Update sdxl reference pipeline to latest sdxl pipeline (#9938)
* Update sdxl reference community pipeline * Update README.md Add example images. * Style & quality * Use example images from huggingface documentation-images repository --------- Co-authored-by: Sayak Paul <[email protected]>
1 parent 4da42c2 commit e28419d

File tree

2 files changed

+518
-139
lines changed

2 files changed

+518
-139
lines changed

examples/community/README.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -2619,16 +2619,17 @@ for obj in range(bs):
26192619

26202620
### Stable Diffusion XL Reference
26212621

2622-
This pipeline uses the Reference. Refer to the [stable_diffusion_reference](https://github.com/huggingface/diffusers/blob/main/examples/community/README.md#stable-diffusion-reference).
2622+
This pipeline uses the Reference. Refer to the [Stable Diffusion Reference](https://github.com/huggingface/diffusers/blob/main/examples/community/README.md#stable-diffusion-reference) section for more information.
26232623

26242624
```py
26252625
import torch
2626-
from PIL import Image
2626+
# from diffusers import DiffusionPipeline
26272627
from diffusers.utils import load_image
2628-
from diffusers import DiffusionPipeline
26292628
from diffusers.schedulers import UniPCMultistepScheduler
26302629

2631-
input_image = load_image("https://hf.co/datasets/huggingface/documentation-images/resolve/main/diffusers/input_image_vermeer.png")
2630+
from .stable_diffusion_xl_reference import StableDiffusionXLReferencePipeline
2631+
2632+
input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl_reference_input_cat.jpg")
26322633

26332634
# pipe = DiffusionPipeline.from_pretrained(
26342635
# "stabilityai/stable-diffusion-xl-base-1.0",
@@ -2646,22 +2647,22 @@ pipe = StableDiffusionXLReferencePipeline.from_pretrained(
26462647
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
26472648

26482649
result_img = pipe(ref_image=input_image,
2649-
prompt="1girl",
2650+
prompt="a dog",
26502651
num_inference_steps=20,
26512652
reference_attn=True,
26522653
reference_adain=True).images[0]
26532654
```
26542655

26552656
Reference Image
26562657

2657-
![reference_image](https://hf.co/datasets/huggingface/documentation-images/resolve/main/diffusers/input_image_vermeer.png)
2658+
![reference_image](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl_reference_input_cat.jpg)
26582659

26592660
Output Image
26602661

2661-
`prompt: 1 girl`
2662+
`prompt: a dog`
26622663

2663-
`reference_attn=True, reference_adain=True, num_inference_steps=20`
2664-
![Output_image](https://github.com/zideliu/diffusers/assets/34944964/743848da-a215-48f9-ae39-b5e2ae49fb13)
2664+
`reference_attn=False, reference_adain=True, num_inference_steps=20`
2665+
![Output_image](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl_reference_adain_dog.png)
26652666

26662667
Reference Image
26672668
![reference_image](https://github.com/huggingface/diffusers/assets/34944964/449bdab6-e744-4fb2-9620-d4068d9a741b)
@@ -4696,4 +4697,4 @@ with torch.no_grad():
46964697
```
46974698

46984699
In the folder examples/pixart there is also a script that can be used to train new models.
4699-
Please check the script `train_controlnet_hf_diffusers.sh` on how to start the training.
4700+
Please check the script `train_controlnet_hf_diffusers.sh` on how to start the training.

0 commit comments

Comments
 (0)