Unverified Commit 6a6dfe1c authored by Patrick von Platen's avatar Patrick von Platen Committed by GitHub
Browse files

Rename (#4294)

* up

* Apply suggestions from code review

* Apply suggestions from code review

* up
parent b83bdce4
...@@ -26,8 +26,8 @@ The abstract of the paper is the following: ...@@ -26,8 +26,8 @@ The abstract of the paper is the following:
### Available checkpoints: ### Available checkpoints:
- *Text-to-Image (1024x1024 resolution)*: [stabilityai/stable-diffusion-xl-base-0.9](https://huggingface.co/stabilityai/stable-diffusion-xl-base-0.9) with [`StableDiffusionXLPipeline`] - *Text-to-Image (1024x1024 resolution)*: [stabilityai/stable-diffusion-xl-base-1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0) with [`StableDiffusionXLPipeline`]
- *Image-to-Image / Refiner (1024x1024 resolution)*: [stabilityai/stable-diffusion-xl-refiner-0.9](https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-0.9) with [`StableDiffusionXLImg2ImgPipeline`] - *Image-to-Image / Refiner (1024x1024 resolution)*: [stabilityai/stable-diffusion-xl-refiner-1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0) with [`StableDiffusionXLImg2ImgPipeline`]
## Usage Example ## Usage Example
...@@ -50,7 +50,7 @@ from diffusers import StableDiffusionXLPipeline ...@@ -50,7 +50,7 @@ from diffusers import StableDiffusionXLPipeline
import torch import torch
pipe = StableDiffusionXLPipeline.from_pretrained( pipe = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-0.9", torch_dtype=torch.float16, variant="fp16", use_safetensors=True "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
) )
pipe.to("cuda") pipe.to("cuda")
...@@ -68,7 +68,7 @@ from diffusers import StableDiffusionXLImg2ImgPipeline ...@@ -68,7 +68,7 @@ from diffusers import StableDiffusionXLImg2ImgPipeline
from diffusers.utils import load_image from diffusers.utils import load_image
pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained( pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-refiner-0.9", torch_dtype=torch.float16, variant="fp16", use_safetensors=True "stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
) )
pipe = pipe.to("cuda") pipe = pipe.to("cuda")
url = "https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/aa_xl/000000009.png" url = "https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/aa_xl/000000009.png"
...@@ -88,7 +88,7 @@ from diffusers import StableDiffusionXLInpaintPipeline ...@@ -88,7 +88,7 @@ from diffusers import StableDiffusionXLInpaintPipeline
from diffusers.utils import load_image from diffusers.utils import load_image
pipe = StableDiffusionXLInpaintPipeline.from_pretrained( pipe = StableDiffusionXLInpaintPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-0.9", torch_dtype=torch.float16, variant="fp16", use_safetensors=True "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
) )
pipe.to("cuda") pipe.to("cuda")
...@@ -104,8 +104,8 @@ image = pipe(prompt=prompt, image=init_image, mask_image=mask_image, num_inferen ...@@ -104,8 +104,8 @@ image = pipe(prompt=prompt, image=init_image, mask_image=mask_image, num_inferen
### Refining the image output ### Refining the image output
In addition to the [base model checkpoint](https://huggingface.co/stabilityai/stable-diffusion-xl-base-0.9), In addition to the [base model checkpoint](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0),
StableDiffusion-XL also includes a [refiner checkpoint](huggingface.co/stabilityai/stable-diffusion-xl-refiner-0.9) StableDiffusion-XL also includes a [refiner checkpoint](huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0)
that is specialized in denoising low-noise stage images to generate images of improved high-frequency quality. that is specialized in denoising low-noise stage images to generate images of improved high-frequency quality.
This refiner checkpoint can be used as a "second-step" pipeline after having run the base checkpoint to improve This refiner checkpoint can be used as a "second-step" pipeline after having run the base checkpoint to improve
image quality. image quality.
...@@ -149,12 +149,12 @@ from diffusers import DiffusionPipeline ...@@ -149,12 +149,12 @@ from diffusers import DiffusionPipeline
import torch import torch
base = DiffusionPipeline.from_pretrained( base = DiffusionPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-0.9", torch_dtype=torch.float16, variant="fp16", use_safetensors=True "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
) )
pipe.to("cuda") pipe.to("cuda")
refiner = DiffusionPipeline.from_pretrained( refiner = DiffusionPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-refiner-0.9", "stabilityai/stable-diffusion-xl-refiner-1.0",
text_encoder_2=base.text_encoder_2, text_encoder_2=base.text_encoder_2,
vae=base.vae, vae=base.vae,
torch_dtype=torch.float16, torch_dtype=torch.float16,
...@@ -219,7 +219,7 @@ The ensemble-of-experts method works well on all available schedulers! ...@@ -219,7 +219,7 @@ The ensemble-of-experts method works well on all available schedulers!
#### 2.) Refining the image output from fully denoised base image #### 2.) Refining the image output from fully denoised base image
In standard [`StableDiffusionImg2ImgPipeline`]-fashion, the fully-denoised image generated of the base model In standard [`StableDiffusionImg2ImgPipeline`]-fashion, the fully-denoised image generated of the base model
can be further improved using the [refiner checkpoint](huggingface.co/stabilityai/stable-diffusion-xl-refiner-0.9). can be further improved using the [refiner checkpoint](huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0).
For this, you simply run the refiner as a normal image-to-image pipeline after the "base" text-to-image For this, you simply run the refiner as a normal image-to-image pipeline after the "base" text-to-image
pipeline. You can leave the outputs of the base model in latent space. pipeline. You can leave the outputs of the base model in latent space.
...@@ -229,12 +229,12 @@ from diffusers import DiffusionPipeline ...@@ -229,12 +229,12 @@ from diffusers import DiffusionPipeline
import torch import torch
pipe = DiffusionPipeline.from_pretrained( pipe = DiffusionPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-0.9", torch_dtype=torch.float16, variant="fp16", use_safetensors=True "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
) )
pipe.to("cuda") pipe.to("cuda")
refiner = DiffusionPipeline.from_pretrained( refiner = DiffusionPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-refiner-0.9", "stabilityai/stable-diffusion-xl-refiner-1.0",
text_encoder_2=pipe.text_encoder_2, text_encoder_2=pipe.text_encoder_2,
vae=pipe.vae, vae=pipe.vae,
torch_dtype=torch.float16, torch_dtype=torch.float16,
...@@ -267,12 +267,12 @@ from diffusers import StableDiffusionXLInpaintPipeline ...@@ -267,12 +267,12 @@ from diffusers import StableDiffusionXLInpaintPipeline
from diffusers.utils import load_image from diffusers.utils import load_image
pipe = StableDiffusionXLInpaintPipeline.from_pretrained( pipe = StableDiffusionXLInpaintPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-0.9", torch_dtype=torch.float16, variant="fp16", use_safetensors=True "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
) )
pipe.to("cuda") pipe.to("cuda")
refiner = StableDiffusionXLInpaintPipeline.from_pretrained( refiner = StableDiffusionXLInpaintPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-refiner-0.9", "stabilityai/stable-diffusion-xl-refiner-1.0",
text_encoder_2=pipe.text_encoder_2, text_encoder_2=pipe.text_encoder_2,
vae=pipe.vae, vae=pipe.vae,
torch_dtype=torch.float16, torch_dtype=torch.float16,
...@@ -321,12 +321,12 @@ from diffusers import StableDiffusionXLPipeline, StableDiffusionXLImg2ImgPipelin ...@@ -321,12 +321,12 @@ from diffusers import StableDiffusionXLPipeline, StableDiffusionXLImg2ImgPipelin
import torch import torch
pipe = StableDiffusionXLPipeline.from_single_file( pipe = StableDiffusionXLPipeline.from_single_file(
"./sd_xl_base_0.9.safetensors", torch_dtype=torch.float16, variant="fp16", use_safetensors=True "./sd_xl_base_1.0.safetensors", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
) )
pipe.to("cuda") pipe.to("cuda")
refiner = StableDiffusionXLImg2ImgPipeline.from_single_file( refiner = StableDiffusionXLImg2ImgPipeline.from_single_file(
"./sd_xl_refiner_0.9.safetensors", torch_dtype=torch.float16, use_safetensors=True, variant="fp16" "./sd_xl_refiner_1.0.safetensors", torch_dtype=torch.float16, use_safetensors=True, variant="fp16"
) )
refiner.to("cuda") refiner.to("cuda")
``` ```
...@@ -399,7 +399,7 @@ from diffusers import StableDiffusionXLPipeline ...@@ -399,7 +399,7 @@ from diffusers import StableDiffusionXLPipeline
import torch import torch
pipe = StableDiffusionXLPipeline.from_pretrained( pipe = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-0.9", torch_dtype=torch.float16, variant="fp16", use_safetensors=True "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
) )
pipe.to("cuda") pipe.to("cuda")
......
...@@ -61,7 +61,7 @@ wget https://huggingface.co/datasets/huggingface/documentation-images/resolve/ma ...@@ -61,7 +61,7 @@ wget https://huggingface.co/datasets/huggingface/documentation-images/resolve/ma
Then run `huggingface-cli login` to log into your Hugging Face account. This is needed to be able to push the trained ControlNet parameters to Hugging Face Hub. Then run `huggingface-cli login` to log into your Hugging Face account. This is needed to be able to push the trained ControlNet parameters to Hugging Face Hub.
```bash ```bash
export MODEL_DIR="stabilityai/stable-diffusion-xl-base-0.9" export MODEL_DIR="stabilityai/stable-diffusion-xl-base-1.0"
export OUTPUT_DIR="path to save model" export OUTPUT_DIR="path to save model"
accelerate launch train_controlnet_sdxl.py \ accelerate launch train_controlnet_sdxl.py \
...@@ -98,7 +98,7 @@ from diffusers import StableDiffusionXLControlNetPipeline, ControlNetModel, UniP ...@@ -98,7 +98,7 @@ from diffusers import StableDiffusionXLControlNetPipeline, ControlNetModel, UniP
from diffusers.utils import load_image from diffusers.utils import load_image
import torch import torch
base_model_path = "stabilityai/stable-diffusion-xl-base-0.9" base_model_path = "stabilityai/stable-diffusion-xl-base-1.0"
controlnet_path = "path to controlnet" controlnet_path = "path to controlnet"
controlnet = ControlNetModel.from_pretrained(controlnet_path, torch_dtype=torch.float16) controlnet = ControlNetModel.from_pretrained(controlnet_path, torch_dtype=torch.float16)
......
...@@ -231,7 +231,7 @@ These are controlnet weights trained on {base_model} with new type of conditioni ...@@ -231,7 +231,7 @@ These are controlnet weights trained on {base_model} with new type of conditioni
## License ## License
[SDXL 0.9 Research License](https://huggingface.co/stabilityai/stable-diffusion-xl-base-0.9/blob/main/LICENSE.md) [SDXL 1.0 License](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/LICENSE.md)
""" """
with open(os.path.join(repo_folder, "README.md"), "w") as f: with open(os.path.join(repo_folder, "README.md"), "w") as f:
f.write(yaml + model_card) f.write(yaml + model_card)
......
...@@ -76,7 +76,7 @@ This will also allow us to push the trained LoRA parameters to the Hugging Face ...@@ -76,7 +76,7 @@ This will also allow us to push the trained LoRA parameters to the Hugging Face
Now, we can launch training using: Now, we can launch training using:
```bash ```bash
export MODEL_NAME="stabilityai/stable-diffusion-xl-base-0.9" export MODEL_NAME="stabilityai/stable-diffusion-xl-base-1.0"
export INSTANCE_DIR="dog" export INSTANCE_DIR="dog"
export OUTPUT_DIR="lora-trained-xl" export OUTPUT_DIR="lora-trained-xl"
...@@ -127,7 +127,7 @@ image = pipe("A picture of a sks dog in a bucket", num_inference_steps=25).image ...@@ -127,7 +127,7 @@ image = pipe("A picture of a sks dog in a bucket", num_inference_steps=25).image
image.save("sks_dog.png") image.save("sks_dog.png")
``` ```
We can further refine the outputs with the [Refiner](https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-0.9): We can further refine the outputs with the [Refiner](https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0):
```python ```python
from huggingface_hub.repocard import RepoCard from huggingface_hub.repocard import RepoCard
...@@ -145,7 +145,7 @@ pipe.load_lora_weights(lora_model_id) ...@@ -145,7 +145,7 @@ pipe.load_lora_weights(lora_model_id)
# Load the refiner. # Load the refiner.
refiner = StableDiffusionXLImg2ImgPipeline.from_pretrained( refiner = StableDiffusionXLImg2ImgPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-refiner-0.9", torch_dtype=torch.float16, use_safetensors=True, variant="fp16" "stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtype=torch.float16, use_safetensors=True, variant="fp16"
) )
refiner.to("cuda") refiner.to("cuda")
......
...@@ -97,7 +97,7 @@ Special VAE used for training: {vae_path}. ...@@ -97,7 +97,7 @@ Special VAE used for training: {vae_path}.
## License ## License
[SDXL 0.9 Research License](https://huggingface.co/stabilityai/stable-diffusion-xl-base-0.9/blob/main/LICENSE.md) [SDXL 1.0 License](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/LICENSE.md)
""" """
with open(os.path.join(repo_folder, "README.md"), "w") as f: with open(os.path.join(repo_folder, "README.md"), "w") as f:
f.write(yaml + model_card) f.write(yaml + model_card)
......
...@@ -15,7 +15,7 @@ training procedure while being faithful to the [original implementation](https:/ ...@@ -15,7 +15,7 @@ training procedure while being faithful to the [original implementation](https:/
Refer to the original InstructPix2Pix training example for installing the dependencies. Refer to the original InstructPix2Pix training example for installing the dependencies.
You will also need to get access of SDXL by filling the [form](https://huggingface.co/stabilityai/stable-diffusion-xl-base-0.9). You will also need to get access of SDXL by filling the [form](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0).
### Toy example ### Toy example
...@@ -26,7 +26,7 @@ Configure environment variables such as the dataset identifier and the Stable Di ...@@ -26,7 +26,7 @@ Configure environment variables such as the dataset identifier and the Stable Di
checkpoint: checkpoint:
```bash ```bash
export MODEL_NAME="stabilityai/stable-diffusion-xl-base-0.9" export MODEL_NAME="stabilityai/stable-diffusion-xl-base-1.0"
export DATASET_ID="fusing/instructpix2pix-1000-samples" export DATASET_ID="fusing/instructpix2pix-1000-samples"
``` ```
...@@ -51,7 +51,7 @@ with Weights and Biases. You can enable this feature with `report_to="wandb"`: ...@@ -51,7 +51,7 @@ with Weights and Biases. You can enable this feature with `report_to="wandb"`:
```bash ```bash
python train_instruct_pix2pix_xl.py \ python train_instruct_pix2pix_xl.py \
--pretrained_model_name_or_path=stabilityai/stable-diffusion-xl-base-0.9 \ --pretrained_model_name_or_path=stabilityai/stable-diffusion-xl-base-1.0 \
--dataset_name=$DATASET_ID \ --dataset_name=$DATASET_ID \
--use_ema \ --use_ema \
--enable_xformers_memory_efficient_attention \ --enable_xformers_memory_efficient_attention \
...@@ -80,7 +80,7 @@ for running distributed training with `accelerate`. Here is an example command: ...@@ -80,7 +80,7 @@ for running distributed training with `accelerate`. Here is an example command:
```bash ```bash
accelerate launch --mixed_precision="fp16" --multi_gpu train_instruct_pix2pix.py \ accelerate launch --mixed_precision="fp16" --multi_gpu train_instruct_pix2pix.py \
--pretrained_model_name_or_path=stabilityai/stable-diffusion-xl-base-0.9 \ --pretrained_model_name_or_path=stabilityai/stable-diffusion-xl-base-1.0 \
--dataset_name=$DATASET_ID \ --dataset_name=$DATASET_ID \
--use_ema \ --use_ema \
--enable_xformers_memory_efficient_attention \ --enable_xformers_memory_efficient_attention \
......
...@@ -50,7 +50,7 @@ EXAMPLE_DOC_STRING = """ ...@@ -50,7 +50,7 @@ EXAMPLE_DOC_STRING = """
>>> from diffusers import StableDiffusionXLPipeline >>> from diffusers import StableDiffusionXLPipeline
>>> pipe = StableDiffusionXLPipeline.from_pretrained( >>> pipe = StableDiffusionXLPipeline.from_pretrained(
... "stabilityai/stable-diffusion-xl-base-0.9", torch_dtype=torch.float16 ... "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16
... ) ... )
>>> pipe = pipe.to("cuda") >>> pipe = pipe.to("cuda")
......
...@@ -52,7 +52,7 @@ EXAMPLE_DOC_STRING = """ ...@@ -52,7 +52,7 @@ EXAMPLE_DOC_STRING = """
>>> from diffusers.utils import load_image >>> from diffusers.utils import load_image
>>> pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained( >>> pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
... "stabilityai/stable-diffusion-xl-refiner-0.9", torch_dtype=torch.float16 ... "stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtype=torch.float16
... ) ... )
>>> pipe = pipe.to("cuda") >>> pipe = pipe.to("cuda")
>>> url = "https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/aa_xl/000000009.png" >>> url = "https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/aa_xl/000000009.png"
......
...@@ -47,7 +47,7 @@ EXAMPLE_DOC_STRING = """ ...@@ -47,7 +47,7 @@ EXAMPLE_DOC_STRING = """
>>> from diffusers.utils import load_image >>> from diffusers.utils import load_image
>>> pipe = StableDiffusionXLInpaintPipeline.from_pretrained( >>> pipe = StableDiffusionXLInpaintPipeline.from_pretrained(
... "stabilityai/stable-diffusion-xl-base-0.9", ... "stabilityai/stable-diffusion-xl-base-1.0",
... torch_dtype=torch.float16, ... torch_dtype=torch.float16,
... variant="fp16", ... variant="fp16",
... use_safetensors=True, ... use_safetensors=True,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment