Skip to content

Conversation

@patrickvonplaten
Copy link
Contributor

@patrickvonplaten patrickvonplaten commented Jul 3, 2023

This PR was opened only to show that the default settings of SGM gives 1-to-1 the same results as the branch sd_xl (soon in "main"): huggingface/diffusers#3859

You can verify this as follows:

git clone https://github.com/patrickvonplaten/generative-models.git
git checkout same_result_diff

Then make sure to add the SD-XL checkpoint to the checkpoints folder under "./generative-models/checkpoints/sd_xl_base_0.9.safetensors". Then:

cd generative-models && python scripts/demo/sampling.py

This should generate an image that looks more or less like the following (results might vary depending on the GPU). The following image was created on a RTX4090:

000000000

Now you should get 1-to-1 the same result with diffusers. Simply do:

pip install git+https://github.com/huggingface/diffusers@sd_xl

and then run:

#!/usr/bin/env python3
from diffusers import DiffusionPipeline
from pytorch_lightning import seed_everything
import torch

pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-0.9", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
pipe.to("cuda")

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
seed_everything(0)
image = pipe(prompt=prompt).images[0]
image.save("/path/to/save")

which should give an image of the following:

aaa (1)

Note that when downloading the images you can see that they are not 100% identical but for the human eye one cannot make a difference.

@patrickvonplaten patrickvonplaten marked this pull request as draft July 3, 2023 12:41
@benjaminaubin
Copy link
Contributor

Thank you for the great comparison. I am closing this PR since it is not intended to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants