mjbuehler commited on
Commit
f2fdc6b
·
verified ·
1 Parent(s): 18a2164

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +45 -0
README.md CHANGED
@@ -158,3 +158,48 @@ image
158
 
159
 
160
  ![image/png](https://cdn-uploads.huggingface.co/production/uploads/623ce1c6b66fedf374859fe7/qFBQG-smW5W75MBaNwZcH.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
 
159
 
160
  ![image/png](https://cdn-uploads.huggingface.co/production/uploads/623ce1c6b66fedf374859fe7/qFBQG-smW5W75MBaNwZcH.png)
161
+
162
+ ## Fine-tuning script
163
+
164
+ Download this script: [SD3 DreamBooth-LoRA_Fine-Tune.ipynb](https://huggingface.co/lamm-mit/stable-diffusion-3-medium-leaf-inspired/resolve/main/SD3_DreamBooth-LoRA_Fine-Tune.ipynb)
165
+
166
+ You need to create a local folder ```leaf_concept_dir_SD3_12``` and add the leaf images (provided in this repository, see subfolder). The code will automatically download the training script. The training script can handle custom prompts associated with each image, which are generated using BLIP.
167
+
168
+ For instance, for the images used here, they are:
169
+
170
+ ```raw
171
+ ['<leaf microstructure>, a close up of a green plant with a lot of small holes',
172
+ '<leaf microstructure>, a close up of a leaf with a small insect on it',
173
+ '<leaf microstructure>, a close up of a plant with a lot of green leaves',
174
+ '<leaf microstructure>, a close up of a green plant with a yellow light',
175
+ '<leaf microstructure>, a close up of a green plant with a white center',
176
+ '<leaf microstructure>, arafed leaf with a white line on the center',
177
+ '<leaf microstructure>, a close up of a leaf with a yellow light shining through it',
178
+ '<leaf microstructure>, arafed image of a green plant with a yellow cross']
179
+ ```
180
+
181
+ The Parquet dataset generated during pre-calculation of embeddings is stored in the folder ```{data_df_path}```. It includes the image paths, embeddings, and a few other columns that are used by the training script.
182
+
183
+ Training then proceeds as:
184
+
185
+ ```raw
186
+ accelerate launch train_dreambooth_lora_sd3_miniature.py \
187
+ --pretrained_model_name_or_path="{pretrained_model_name_or_path}" \
188
+ --instance_data_dir="{instance_data_dir}" \
189
+ --data_df_path="{instance_output_dir_embed}" \
190
+ --output_dir="{instance_output_dir}" \
191
+ --mixed_precision="fp16" \
192
+ --instance_prompt="{instance_prompt}" \
193
+ --resolution=1024 \
194
+ --train_batch_size=1 \
195
+ --gradient_accumulation_steps=4 \
196
+ --gradient_checkpointing \
197
+ --learning_rate=1e-4 \
198
+ --lr_scheduler="constant" \
199
+ --weighting_scheme="logit_normal" \
200
+ --lr_warmup_steps=0 \
201
+ --use_8bit_adam \
202
+ --max_train_steps=500 \
203
+ --checkpointing_steps=500 \
204
+ --seed="3234290"
205
+ ```