From e6dbeb2060dc9ceea7d05c7aca1b3e2f055edbc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?apolin=C3=A1rio?= Date: Tue, 25 Jun 2024 08:09:09 -0500 Subject: [PATCH 1/5] Improve trainer model cards --- examples/dreambooth/train_dreambooth_sd3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/dreambooth/train_dreambooth_sd3.py b/examples/dreambooth/train_dreambooth_sd3.py index c8f2fb1ac61b..5b5b038432cc 100644 --- a/examples/dreambooth/train_dreambooth_sd3.py +++ b/examples/dreambooth/train_dreambooth_sd3.py @@ -95,13 +95,13 @@ def save_model_card( These are {repo_id} DreamBooth weights for {base_model}. -The weights were trained using [DreamBooth](https://dreambooth.github.io/). +The weights were trained using [DreamBooth](https://dreambooth.github.io/) with the [SD3 diffusers trainer](https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/README_sd3.md). Text encoder was fine-tuned: {train_text_encoder}. ## Trigger words -You should use {instance_prompt} to trigger the image generation. +You should use `{instance_prompt}` to trigger the image generation. ## Download model From 28a7ca50607a23b17965eae4d8df090bb6b0673b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?apolin=C3=A1rio?= Date: Tue, 25 Jun 2024 08:16:53 -0500 Subject: [PATCH 2/5] Update train_dreambooth_sd3.py --- examples/dreambooth/train_dreambooth_sd3.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/dreambooth/train_dreambooth_sd3.py b/examples/dreambooth/train_dreambooth_sd3.py index 5b5b038432cc..9a72294c20bd 100644 --- a/examples/dreambooth/train_dreambooth_sd3.py +++ b/examples/dreambooth/train_dreambooth_sd3.py @@ -95,17 +95,22 @@ def save_model_card( These are {repo_id} DreamBooth weights for {base_model}. -The weights were trained using [DreamBooth](https://dreambooth.github.io/) with the [SD3 diffusers trainer](https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/README_sd3.md). +The weights were trained using [DreamBooth](https://dreambooth.github.io/) with the [SD3 diffusers trainer](https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/README_sd3.md). -Text encoder was fine-tuned: {train_text_encoder}. +Was the text encoder fine-tuned? {train_text_encoder}. ## Trigger words You should use `{instance_prompt}` to trigger the image generation. -## Download model +## Use it with the [🧨 diffusers library](https://github.com/huggingface/diffusers) -[Download]({repo_id}/tree/main) them in the Files & versions tab. +```py +from diffusers import AutoPipelineForText2Image +import torch +pipeline = AutoPipelineForText2Image.from_pretrained('{repo_id}', torch_dtype=torch.float16).to('cuda') +image = pipeline('{validation_prompt if validation_prompt else instance_prompt}').images[0] +``` ## License From 9be6da50dba14fa8d7c2d228a9f8c8ec7ddc250e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?apolin=C3=A1rio?= Date: Tue, 25 Jun 2024 08:19:58 -0500 Subject: [PATCH 3/5] Update train_dreambooth_lora_sd3.py --- .../dreambooth/train_dreambooth_lora_sd3.py | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/examples/dreambooth/train_dreambooth_lora_sd3.py b/examples/dreambooth/train_dreambooth_lora_sd3.py index 2c66c341f78f..a24cb71b173e 100644 --- a/examples/dreambooth/train_dreambooth_lora_sd3.py +++ b/examples/dreambooth/train_dreambooth_lora_sd3.py @@ -101,19 +101,35 @@ def save_model_card( ## Model description -These are {repo_id} DreamBooth weights for {base_model}. +These are {repo_id} DreamBooth LoRA weights for {base_model}. -The weights were trained using [DreamBooth](https://dreambooth.github.io/). +The weights were trained using [DreamBooth](https://dreambooth.github.io/) with the [SD3 diffusers trainer](https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/README_sd3.md). -LoRA for the text encoder was enabled: {train_text_encoder}. +Was LoRA for the text encoder enabled? {train_text_encoder}. ## Trigger words -You should use {instance_prompt} to trigger the image generation. +You should use `{instance_prompt}` to trigger the image generation. ## Download model -[Download]({repo_id}/tree/main) them in the Files & versions tab. +[Download the *.safensors LoRA]({repo_id}/tree/main) in the Files & versions tab. + +## Use it with the [🧨 diffusers library](https://github.com/huggingface/diffusers) + +```py +from diffusers import AutoPipelineForText2Image +import torch +pipeline = AutoPipelineForText2Image.from_pretrained('stabilityai/stable-diffusion-3-medium-diffusers', torch_dtype=torch.float16).to('cuda') +pipeline.load_lora_weights('{repo_id}', weight_name='pytorch_lora_weights.safetensors') +image = pipeline('{validation_prompt if validation_prompt else instance_prompt}').images[0] +``` + +### Use it with UIs such as AUTOMATIC1111, Comfy UI, SD.Next, Invoke + +- **LoRA**: download **[`diffusers_lora_weights.safetensors` here 💾](/{repo_id}/blob/main/diffusers_lora_weights.safetensors)**. + - Rename it and place it on your `models/Lora` folder. + - On AUTOMATIC1111, load the LoRA by adding `` to your prompt. On ComfyUI just [load it as a regular LoRA](https://comfyanonymous.github.io/ComfyUI_examples/lora/). ## License From 56e3e464dd3dd37e951c0b22788aeeeb8e5257d3 Mon Sep 17 00:00:00 2001 From: Linoy Tsaban <57615435+linoytsaban@users.noreply.github.com> Date: Wed, 26 Jun 2024 18:01:27 +0300 Subject: [PATCH 4/5] add link to adapters loading doc --- examples/dreambooth/train_dreambooth_lora_sd3.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/dreambooth/train_dreambooth_lora_sd3.py b/examples/dreambooth/train_dreambooth_lora_sd3.py index a24cb71b173e..40e1a958efbd 100644 --- a/examples/dreambooth/train_dreambooth_lora_sd3.py +++ b/examples/dreambooth/train_dreambooth_lora_sd3.py @@ -131,6 +131,8 @@ def save_model_card( - Rename it and place it on your `models/Lora` folder. - On AUTOMATIC1111, load the LoRA by adding `` to your prompt. On ComfyUI just [load it as a regular LoRA](https://comfyanonymous.github.io/ComfyUI_examples/lora/). +For more details, including weighting, merging and fusing LoRAs, check the [documentation on loading LoRAs in diffusers](https://huggingface.co/docs/diffusers/main/en/using-diffusers/loading_adapters) + ## License Please adhere to the licensing terms as described [here](https://huggingface.co/stabilityai/stable-diffusion-3-medium/blob/main/LICENSE). From 0582fc1bbc4f34e4787306dc4dc7fe2188b90141 Mon Sep 17 00:00:00 2001 From: Linoy Tsaban <57615435+linoytsaban@users.noreply.github.com> Date: Thu, 27 Jun 2024 10:57:53 +0300 Subject: [PATCH 5/5] Update train_dreambooth_lora_sd3.py --- examples/dreambooth/train_dreambooth_lora_sd3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/dreambooth/train_dreambooth_lora_sd3.py b/examples/dreambooth/train_dreambooth_lora_sd3.py index 40e1a958efbd..fe2720047198 100644 --- a/examples/dreambooth/train_dreambooth_lora_sd3.py +++ b/examples/dreambooth/train_dreambooth_lora_sd3.py @@ -113,7 +113,7 @@ def save_model_card( ## Download model -[Download the *.safensors LoRA]({repo_id}/tree/main) in the Files & versions tab. +[Download the *.safetensors LoRA]({repo_id}/tree/main) in the Files & versions tab. ## Use it with the [🧨 diffusers library](https://github.com/huggingface/diffusers)