Skip to content

Commit 7833ed9

Browse files
Improve model card for push_to_hub trainers (#8697)
* Improve trainer model cards * Update train_dreambooth_sd3.py * Update train_dreambooth_lora_sd3.py * add link to adapters loading doc * Update train_dreambooth_lora_sd3.py --------- Co-authored-by: Linoy Tsaban <[email protected]>
1 parent 85c4a32 commit 7833ed9

File tree

2 files changed

+33
-10
lines changed

2 files changed

+33
-10
lines changed

examples/dreambooth/train_dreambooth_lora_sd3.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,37 @@ def save_model_card(
101101
102102
## Model description
103103
104-
These are {repo_id} DreamBooth weights for {base_model}.
104+
These are {repo_id} DreamBooth LoRA weights for {base_model}.
105105
106-
The weights were trained using [DreamBooth](https://dreambooth.github.io/).
106+
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).
107107
108-
LoRA for the text encoder was enabled: {train_text_encoder}.
108+
Was LoRA for the text encoder enabled? {train_text_encoder}.
109109
110110
## Trigger words
111111
112-
You should use {instance_prompt} to trigger the image generation.
112+
You should use `{instance_prompt}` to trigger the image generation.
113113
114114
## Download model
115115
116-
[Download]({repo_id}/tree/main) them in the Files & versions tab.
116+
[Download the *.safetensors LoRA]({repo_id}/tree/main) in the Files & versions tab.
117+
118+
## Use it with the [🧨 diffusers library](https://github.com/huggingface/diffusers)
119+
120+
```py
121+
from diffusers import AutoPipelineForText2Image
122+
import torch
123+
pipeline = AutoPipelineForText2Image.from_pretrained('stabilityai/stable-diffusion-3-medium-diffusers', torch_dtype=torch.float16).to('cuda')
124+
pipeline.load_lora_weights('{repo_id}', weight_name='pytorch_lora_weights.safetensors')
125+
image = pipeline('{validation_prompt if validation_prompt else instance_prompt}').images[0]
126+
```
127+
128+
### Use it with UIs such as AUTOMATIC1111, Comfy UI, SD.Next, Invoke
129+
130+
- **LoRA**: download **[`diffusers_lora_weights.safetensors` here 💾](/{repo_id}/blob/main/diffusers_lora_weights.safetensors)**.
131+
- Rename it and place it on your `models/Lora` folder.
132+
- On AUTOMATIC1111, load the LoRA by adding `<lora:your_new_name:1>` to your prompt. On ComfyUI just [load it as a regular LoRA](https://comfyanonymous.github.io/ComfyUI_examples/lora/).
133+
134+
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)
117135
118136
## License
119137

examples/dreambooth/train_dreambooth_sd3.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,22 @@ def save_model_card(
9595
9696
These are {repo_id} DreamBooth weights for {base_model}.
9797
98-
The weights were trained using [DreamBooth](https://dreambooth.github.io/).
98+
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).
9999
100-
Text encoder was fine-tuned: {train_text_encoder}.
100+
Was the text encoder fine-tuned? {train_text_encoder}.
101101
102102
## Trigger words
103103
104-
You should use {instance_prompt} to trigger the image generation.
104+
You should use `{instance_prompt}` to trigger the image generation.
105105
106-
## Download model
106+
## Use it with the [🧨 diffusers library](https://github.com/huggingface/diffusers)
107107
108-
[Download]({repo_id}/tree/main) them in the Files & versions tab.
108+
```py
109+
from diffusers import AutoPipelineForText2Image
110+
import torch
111+
pipeline = AutoPipelineForText2Image.from_pretrained('{repo_id}', torch_dtype=torch.float16).to('cuda')
112+
image = pipeline('{validation_prompt if validation_prompt else instance_prompt}').images[0]
113+
```
109114
110115
## License
111116

0 commit comments

Comments
 (0)