From 961173064d596ddc56fcd40119652e85c8118364 Mon Sep 17 00:00:00 2001 From: Sayak Paul Date: Fri, 28 Jul 2023 01:28:36 +0530 Subject: [PATCH] Honor the SDXL 1.0 licensing from the training scripts. (#4319) * honor the original license. * train_instruct_pix2pix_xl -> train_instruct_pix2pix_sdxl --- examples/controlnet/train_controlnet_sdxl.py | 7 +------ examples/dreambooth/train_dreambooth_lora_sdxl.py | 6 +----- examples/instruct_pix2pix/README_sdxl.md | 8 ++++---- ...truct_pix2pix_xl.py => train_instruct_pix2pix_sdxl.py} | 0 4 files changed, 6 insertions(+), 15 deletions(-) rename examples/instruct_pix2pix/{train_instruct_pix2pix_xl.py => train_instruct_pix2pix_sdxl.py} (100%) diff --git a/examples/controlnet/train_controlnet_sdxl.py b/examples/controlnet/train_controlnet_sdxl.py index dfe12e3527..6be07a3805 100644 --- a/examples/controlnet/train_controlnet_sdxl.py +++ b/examples/controlnet/train_controlnet_sdxl.py @@ -210,7 +210,7 @@ def save_model_card(repo_id: str, image_logs=None, base_model=str, repo_folder=N yaml = f""" --- -license: creativeml-openrail-m +license: openrail++ base_model: {base_model} tags: - stable-diffusion-xl @@ -227,12 +227,7 @@ inference: true These are controlnet weights trained on {base_model} with new type of conditioning. {img_str} """ - model_card += """ -## License - -[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: f.write(yaml + model_card) diff --git a/examples/dreambooth/train_dreambooth_lora_sdxl.py b/examples/dreambooth/train_dreambooth_lora_sdxl.py index 38db36e5b6..443f2d25a7 100644 --- a/examples/dreambooth/train_dreambooth_lora_sdxl.py +++ b/examples/dreambooth/train_dreambooth_lora_sdxl.py @@ -73,7 +73,7 @@ def save_model_card( yaml = f""" --- -license: creativeml-openrail-m +license: openrail++ base_model: {base_model} instance_prompt: {prompt} tags: @@ -94,10 +94,6 @@ These are LoRA adaption weights for {base_model}. The weights were trained on {p LoRA for the text encoder was enabled: {train_text_encoder}. Special VAE used for training: {vae_path}. - -## License - -[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: f.write(yaml + model_card) diff --git a/examples/instruct_pix2pix/README_sdxl.md b/examples/instruct_pix2pix/README_sdxl.md index 8e3e6c8812..db3267b18d 100644 --- a/examples/instruct_pix2pix/README_sdxl.md +++ b/examples/instruct_pix2pix/README_sdxl.md @@ -4,9 +4,9 @@ [Stable Diffusion XL](https://huggingface.co/papers/2307.01952) (or SDXL) is the latest image generation model that is tailored towards more photorealistic outputs with more detailed imagery and composition compared to previous SD models. It leverages a three times larger UNet backbone. The increase of model parameters is mainly due to more attention blocks and a larger cross-attention context as SDXL uses a second text encoder. -The `train_instruct_pix2pix_xl.py` script shows how to implement the training procedure and adapt it for Stable Diffusion XL. +The `train_instruct_pix2pix_sdxl.py` script shows how to implement the training procedure and adapt it for Stable Diffusion XL. -***Disclaimer: Even though `train_instruct_pix2pix_xl.py` implements the InstructPix2Pix +***Disclaimer: Even though `train_instruct_pix2pix_sdxl.py` implements the InstructPix2Pix training procedure while being faithful to the [original implementation](https://github.com/timothybrooks/instruct-pix2pix) we have only tested it on a [small-scale dataset](https://huggingface.co/datasets/fusing/instructpix2pix-1000-samples). This can impact the end results. For better results, we recommend longer training runs with a larger dataset. [Here](https://huggingface.co/datasets/timbrooks/instructpix2pix-clip-filtered) you can find a large dataset for InstructPix2Pix training.*** ## Running locally with PyTorch @@ -33,7 +33,7 @@ export DATASET_ID="fusing/instructpix2pix-1000-samples" Now, we can launch training: ```bash -python train_instruct_pix2pix_xl.py \ +python train_instruct_pix2pix_sdxl.py \ --pretrained_model_name_or_path=$MODEL_NAME \ --dataset_name=$DATASET_ID \ --enable_xformers_memory_efficient_attention \ @@ -50,7 +50,7 @@ Additionally, we support performing validation inference to monitor training pro with Weights and Biases. You can enable this feature with `report_to="wandb"`: ```bash -python train_instruct_pix2pix_xl.py \ +python train_instruct_pix2pix_sdxl.py \ --pretrained_model_name_or_path=stabilityai/stable-diffusion-xl-base-1.0 \ --dataset_name=$DATASET_ID \ --use_ema \ diff --git a/examples/instruct_pix2pix/train_instruct_pix2pix_xl.py b/examples/instruct_pix2pix/train_instruct_pix2pix_sdxl.py similarity index 100% rename from examples/instruct_pix2pix/train_instruct_pix2pix_xl.py rename to examples/instruct_pix2pix/train_instruct_pix2pix_sdxl.py