Skip to content

Commit d5bea15

Browse files
changing all examples that use fill50k. now contain --trust_remote_code in the command. store_true argument therefore default is false.
1 parent 839e9c8 commit d5bea15

File tree

15 files changed

+78
-37
lines changed

15 files changed

+78
-37
lines changed

docs/source/en/training/controlnet.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ export OUTPUT_DIR="path/to/save/model"
282282
accelerate launch train_controlnet.py \
283283
--pretrained_model_name_or_path=$MODEL_DIR \
284284
--output_dir=$OUTPUT_DIR \
285-
--dataset_name=fusing/fill50k \
285+
--dataset_name=fusing/fill50k \
286+
--trust_remote_code \
286287
--resolution=512 \
287288
--learning_rate=1e-5 \
288289
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
@@ -314,7 +315,8 @@ If you run into version conflicts with the plugin, try uninstalling and reinstal
314315
python3 train_controlnet_flax.py \
315316
--pretrained_model_name_or_path=$MODEL_DIR \
316317
--output_dir=$OUTPUT_DIR \
317-
--dataset_name=fusing/fill50k \
318+
--dataset_name=fusing/fill50k \
319+
--trust_remote_code \
318320
--resolution=512 \
319321
--learning_rate=1e-5 \
320322
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \

docs/source/en/training/t2i_adapters.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ export OUTPUT_DIR="path to save model"
179179
accelerate launch train_t2i_adapter_sdxl.py \
180180
--pretrained_model_name_or_path=$MODEL_DIR \
181181
--output_dir=$OUTPUT_DIR \
182-
--dataset_name=fusing/fill50k \
182+
--dataset_name=fusing/fill50k \
183+
--trust_remote_code \
183184
--mixed_precision="fp16" \
184185
--resolution=1024 \
185186
--learning_rate=1e-5 \

docs/source/ko/training/controlnet.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ export OUTPUT_DIR="path to save model"
9595
accelerate launch train_controlnet.py \
9696
--pretrained_model_name_or_path=$MODEL_DIR \
9797
--output_dir=$OUTPUT_DIR \
98-
--dataset_name=fusing/fill50k \
98+
--dataset_name=fusing/fill50k \
99+
--trust_remote_code \
99100
--resolution=512 \
100101
--learning_rate=1e-5 \
101102
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
@@ -117,7 +118,8 @@ export OUTPUT_DIR="path to save model"
117118
accelerate launch train_controlnet.py \
118119
--pretrained_model_name_or_path=$MODEL_DIR \
119120
--output_dir=$OUTPUT_DIR \
120-
--dataset_name=fusing/fill50k \
121+
--dataset_name=fusing/fill50k \
122+
--trust_remote_code \
121123
--resolution=512 \
122124
--learning_rate=1e-5 \
123125
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
@@ -139,7 +141,8 @@ export OUTPUT_DIR="path to save model"
139141
accelerate launch --mixed_precision="fp16" --multi_gpu train_controlnet.py \
140142
--pretrained_model_name_or_path=$MODEL_DIR \
141143
--output_dir=$OUTPUT_DIR \
142-
--dataset_name=fusing/fill50k \
144+
--dataset_name=fusing/fill50k \
145+
--trust_remote_code \
143146
--resolution=512 \
144147
--learning_rate=1e-5 \
145148
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
@@ -187,7 +190,8 @@ export OUTPUT_DIR="path to save model"
187190
accelerate launch train_controlnet.py \
188191
--pretrained_model_name_or_path=$MODEL_DIR \
189192
--output_dir=$OUTPUT_DIR \
190-
--dataset_name=fusing/fill50k \
193+
--dataset_name=fusing/fill50k \
194+
--trust_remote_code \
191195
--resolution=512 \
192196
--learning_rate=1e-5 \
193197
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
@@ -215,7 +219,8 @@ export OUTPUT_DIR="path to save model"
215219
accelerate launch train_controlnet.py \
216220
--pretrained_model_name_or_path=$MODEL_DIR \
217221
--output_dir=$OUTPUT_DIR \
218-
--dataset_name=fusing/fill50k \
222+
--dataset_name=fusing/fill50k \
223+
--trust_remote_code \
219224
--resolution=512 \
220225
--learning_rate=1e-5 \
221226
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
@@ -281,7 +286,8 @@ export OUTPUT_DIR="path to save model"
281286
accelerate launch train_controlnet.py \
282287
--pretrained_model_name_or_path=$MODEL_DIR \
283288
--output_dir=$OUTPUT_DIR \
284-
--dataset_name=fusing/fill50k \
289+
--dataset_name=fusing/fill50k \
290+
--trust_remote_code \
285291
--resolution=512 \
286292
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
287293
--validation_prompt "red circle with blue background" "cyan circle with brown floral background" \

examples/controlnet/README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ export OUTPUT_DIR="path to save model"
6565
accelerate launch train_controlnet.py \
6666
--pretrained_model_name_or_path=$MODEL_DIR \
6767
--output_dir=$OUTPUT_DIR \
68-
--dataset_name=fusing/fill50k \
68+
--dataset_name=fusing/fill50k \
69+
--trust_remote_code \
6970
--resolution=512 \
7071
--learning_rate=1e-5 \
7172
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
7273
--validation_prompt "red circle with blue background" "cyan circle with brown floral background" \
73-
--train_batch_size=4 \
74-
--trust_remote_code
74+
--train_batch_size=4
7575
```
7676

7777
This default configuration requires ~38GB VRAM.
@@ -88,14 +88,14 @@ export OUTPUT_DIR="path to save model"
8888
accelerate launch train_controlnet.py \
8989
--pretrained_model_name_or_path=$MODEL_DIR \
9090
--output_dir=$OUTPUT_DIR \
91-
--dataset_name=fusing/fill50k \
91+
--dataset_name=fusing/fill50k \
92+
--trust_remote_code \
9293
--resolution=512 \
9394
--learning_rate=1e-5 \
9495
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
9596
--validation_prompt "red circle with blue background" "cyan circle with brown floral background" \
9697
--train_batch_size=1 \
97-
--gradient_accumulation_steps=4 \
98-
--trust_remote_code
98+
--gradient_accumulation_steps=4
9999
```
100100

101101
## Training with multiple GPUs
@@ -110,16 +110,16 @@ export OUTPUT_DIR="path to save model"
110110
accelerate launch --mixed_precision="fp16" --multi_gpu train_controlnet.py \
111111
--pretrained_model_name_or_path=$MODEL_DIR \
112112
--output_dir=$OUTPUT_DIR \
113-
--dataset_name=fusing/fill50k \
113+
--dataset_name=fusing/fill50k \
114+
--trust_remote_code \
114115
--resolution=512 \
115116
--learning_rate=1e-5 \
116117
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
117118
--validation_prompt "red circle with blue background" "cyan circle with brown floral background" \
118119
--train_batch_size=4 \
119120
--mixed_precision="fp16" \
120121
--tracker_project_name="controlnet-demo" \
121-
--report_to=wandb \
122-
--trust_remote_code
122+
--report_to=wandb
123123
```
124124

125125
## Example results
@@ -158,16 +158,16 @@ export OUTPUT_DIR="path to save model"
158158
accelerate launch train_controlnet.py \
159159
--pretrained_model_name_or_path=$MODEL_DIR \
160160
--output_dir=$OUTPUT_DIR \
161-
--dataset_name=fusing/fill50k \
161+
--dataset_name=fusing/fill50k \
162+
--trust_remote_code \
162163
--resolution=512 \
163164
--learning_rate=1e-5 \
164165
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
165166
--validation_prompt "red circle with blue background" "cyan circle with brown floral background" \
166167
--train_batch_size=1 \
167168
--gradient_accumulation_steps=4 \
168169
--gradient_checkpointing \
169-
--use_8bit_adam \
170-
--trust_remote_code
170+
--use_8bit_adam
171171
```
172172

173173
## Training on a 12 GB GPU
@@ -185,7 +185,8 @@ export OUTPUT_DIR="path to save model"
185185
accelerate launch train_controlnet.py \
186186
--pretrained_model_name_or_path=$MODEL_DIR \
187187
--output_dir=$OUTPUT_DIR \
188-
--dataset_name=fusing/fill50k \
188+
--dataset_name=fusing/fill50k \
189+
--trust_remote_code \
189190
--resolution=512 \
190191
--learning_rate=1e-5 \
191192
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
@@ -195,8 +196,7 @@ accelerate launch train_controlnet.py \
195196
--gradient_checkpointing \
196197
--use_8bit_adam \
197198
--enable_xformers_memory_efficient_attention \
198-
--set_grads_to_none \
199-
--trust_remote_code
199+
--set_grads_to_none
200200
```
201201

202202
When using `enable_xformers_memory_efficient_attention`, please make sure to install `xformers` by `pip install xformers`.
@@ -246,7 +246,8 @@ export OUTPUT_DIR="path to save model"
246246
accelerate launch train_controlnet.py \
247247
--pretrained_model_name_or_path=$MODEL_DIR \
248248
--output_dir=$OUTPUT_DIR \
249-
--dataset_name=fusing/fill50k \
249+
--dataset_name=fusing/fill50k \
250+
--trust_remote_code \
250251
--resolution=512 \
251252
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
252253
--validation_prompt "red circle with blue background" "cyan circle with brown floral background" \
@@ -255,8 +256,7 @@ accelerate launch train_controlnet.py \
255256
--gradient_checkpointing \
256257
--enable_xformers_memory_efficient_attention \
257258
--set_grads_to_none \
258-
--mixed_precision fp16 \
259-
--trust_remote_code
259+
--mixed_precision fp16
260260
```
261261

262262
## Performing inference with the trained ControlNet
@@ -382,7 +382,8 @@ And finally start the training
382382
python3 train_controlnet_flax.py \
383383
--pretrained_model_name_or_path=$MODEL_DIR \
384384
--output_dir=$OUTPUT_DIR \
385-
--dataset_name=fusing/fill50k \
385+
--dataset_name=fusing/fill50k \
386+
--trust_remote_code \
386387
--resolution=512 \
387388
--learning_rate=1e-5 \
388389
--validation_image "./conditioning_image_1.png" "./conditioning_image_2.png" \
@@ -395,8 +396,7 @@ python3 train_controlnet_flax.py \
395396
--tracker_project_name=$HUB_MODEL_ID \
396397
--num_train_epochs=11 \
397398
--push_to_hub \
398-
--hub_model_id=$HUB_MODEL_ID \
399-
--trust_remote_code
399+
--hub_model_id=$HUB_MODEL_ID
400400
```
401401

402402
Since we passed the `--push_to_hub` flag, it will automatically create a model repo under your huggingface account based on `$HUB_MODEL_ID`. By the end of training, the final checkpoint will be automatically stored on the hub. You can find an example model repo [here](https://huggingface.co/YiYiXu/fill-circle-controlnet).

examples/controlnet/README_flux.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ When running `accelerate config`, if we specify torch compile mode to True there
5858
## Custom Datasets
5959

6060
We support dataset formats:
61-
The original dataset is hosted in the [ControlNet repo](https://huggingface.co/lllyasviel/ControlNet/blob/main/training/fill50k.zip). We re-uploaded it to be compatible with `datasets` [here](https://huggingface.co/datasets/fusing/fill50k). Note that `datasets` handles dataloading within the training script. To use our example, add `--dataset_name=fusing/fill50k \` to the script and remove line `--jsonl_for_train` mentioned below.
61+
The original dataset is hosted in the [ControlNet repo](https://huggingface.co/lllyasviel/ControlNet/blob/main/training/fill50k.zip). We re-uploaded it to be compatible with `datasets` [here](https://huggingface.co/datasets/fusing/fill50k). Note that `datasets` handles dataloading within the training script. To use our example, add `--dataset_name=fusing/fill50k \
62+
--trust_remote_code \` to the script and remove line `--jsonl_for_train` mentioned below.
6263

6364

6465
We also support importing data from jsonl(xxx.jsonl),using `--jsonl_for_train` to enable it, here is a brief example of jsonl files:
@@ -84,7 +85,8 @@ we can define the num_layers, num_single_layers, which determines the size of th
8485
```bash
8586
accelerate launch train_controlnet_flux.py \
8687
--pretrained_model_name_or_path="black-forest-labs/FLUX.1-dev" \
87-
--dataset_name=fusing/fill50k \
88+
--dataset_name=fusing/fill50k \
89+
--trust_remote_code \
8890
--conditioning_image_column=conditioning_image \
8991
--image_column=image \
9092
--caption_column=text \

examples/controlnet/README_sdxl.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ export OUTPUT_DIR="path to save model"
6767
accelerate launch train_controlnet_sdxl.py \
6868
--pretrained_model_name_or_path=$MODEL_DIR \
6969
--output_dir=$OUTPUT_DIR \
70-
--dataset_name=fusing/fill50k \
70+
--dataset_name=fusing/fill50k \
71+
--trust_remote_code \
7172
--mixed_precision="fp16" \
7273
--resolution=1024 \
7374
--learning_rate=1e-5 \

examples/controlnet/train_controlnet.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,9 @@ def parse_args(input_args=None):
563563
),
564564
)
565565
parser.add_argument(
566-
"--trust_remote_code",
567-
action="store_true",
568-
help="Whether to trust and execute remote code for loading datasets.",
566+
"--trust_remote_code",
567+
action="store_true",
568+
help="Whether to trust and execute remote code for loading datasets.",
569569
)
570570

571571
if input_args is not None:

examples/controlnet/train_controlnet_flax.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,12 @@ def parse_args():
460460
)
461461
parser.add_argument("--local_rank", type=int, default=-1, help="For distributed training: local_rank")
462462

463+
parser.add_argument(
464+
"--trust_remote_code",
465+
action="store_true",
466+
help="Whether to trust and execute remote code for loading datasets.",
467+
)
468+
463469
args = parser.parse_args()
464470
args.output_dir = args.output_dir.replace("{timestamp}", time.strftime("%Y%m%d_%H%M%S"))
465471

examples/controlnet/train_controlnet_flux.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,11 @@ def parse_args(input_args=None):
641641
action="store_true",
642642
help="Enable model cpu offload and save memory.",
643643
)
644+
parser.add_argument(
645+
"--trust_remote_code",
646+
action="store_true",
647+
help="Whether to trust and execute remote code for loading datasets.",
648+
)
644649

645650
if input_args is not None:
646651
args = parser.parse_args(input_args)

examples/controlnet/train_controlnet_sd3.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
if is_wandb_available():
5959
import wandb
6060

61+
6162
# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
6263
check_min_version("0.33.0.dev0")
6364

0 commit comments

Comments
 (0)