You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/controlnet/README.md
+96Lines changed: 96 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -267,3 +267,99 @@ image = pipe(
267
267
268
268
image.save("./output.png")
269
269
```
270
+
271
+
## Training with Flax/JAX
272
+
273
+
For faster training on TPUs and GPUs you can leverage the flax training example. Follow the instructions above to get the model and dataset before running the script.
274
+
275
+
### Running on Google Cloud TPU
276
+
277
+
See below for commands to set up a TPU VM(`--accelerator-type v4-8`). For more details about how to set up and use TPUs, refer to [Cloud docs for single VM setup](https://cloud.google.com/tpu/docs/run-calculation-jax).
278
+
279
+
First create a single TPUv4-8 VM and connect to it:
We encourage you to store or share your model with the community. To use huggingface hub, please login to your Hugging Face account, or ([create one](https://huggingface.co/docs/diffusers/main/en/training/hf.co/join) if you don’t have one already):
331
+
332
+
```
333
+
huggingface-cli login
334
+
```
335
+
336
+
Make sure you have the `MODEL_DIR`,`OUTPUT_DIR` and `HUB_MODEL_ID` environment variables set. The `OUTPUT_DIR` and `HUB_MODEL_ID` variables specify where to save the model to on the Hub:
--validation_prompt "red circle with blue background" "cyan circle with brown floral background" \
355
+
--validation_steps=1000 \
356
+
--train_batch_size=2 \
357
+
--revision="non-ema" \
358
+
--from_pt \
359
+
--report_to="wandb" \
360
+
--max_train_steps=10000 \
361
+
--push_to_hub \
362
+
--hub_model_id=$HUB_MODEL_ID
363
+
```
364
+
365
+
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).
0 commit comments