-
Notifications
You must be signed in to change notification settings - Fork 6.1k
[doc wip] literalinclude #2718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[doc wip] literalinclude #2718
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,25 +74,13 @@ To load a checkpoint to resume training, pass the argument `--resume_from_checkp | |
<pt> | ||
Launch the [PyTorch training script](https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image.py) for a fine-tuning run on the [Pokémon BLIP captions](https://huggingface.co/datasets/lambdalabs/pokemon-blip-captions) dataset like this: | ||
|
||
```bash | ||
export MODEL_NAME="CompVis/stable-diffusion-v1-4" | ||
export dataset_name="lambdalabs/pokemon-blip-captions" | ||
|
||
accelerate launch train_text_to_image.py \ | ||
--pretrained_model_name_or_path=$MODEL_NAME \ | ||
--dataset_name=$dataset_name \ | ||
--use_ema \ | ||
--resolution=512 --center_crop --random_flip \ | ||
--train_batch_size=1 \ | ||
--gradient_accumulation_steps=4 \ | ||
--gradient_checkpointing \ | ||
--mixed_precision="fp16" \ | ||
--max_train_steps=15000 \ | ||
--learning_rate=1e-05 \ | ||
--max_grad_norm=1 \ | ||
--lr_scheduler="constant" --lr_warmup_steps=0 \ | ||
--output_dir="sd-pokemon-model" | ||
``` | ||
<literalinclude> | ||
{"path": "../../../../examples/text_to_image/README.md", | ||
"language": "bash", | ||
"start-after": "accelerate_snippet_start", | ||
"end-before": "accelerate_snippet_end", | ||
Comment on lines
+80
to
+81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use the markers defined https://github.com/huggingface/diffusers/pull/2718/files#r1143348130 |
||
"dedent": 0} | ||
</literalinclude> | ||
|
||
To finetune on your own dataset, prepare the dataset according to the format required by 🤗 [Datasets](https://huggingface.co/docs/datasets/index). You can [upload your dataset to the Hub](https://huggingface.co/docs/datasets/image_dataset#upload-dataset-to-the-hub), or you can [prepare a local folder with your files](https://huggingface.co/docs/datasets/image_dataset#imagefolder). | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ If you have already cloned the repo, then you won't need to go through these ste | |
With `gradient_checkpointing` and `mixed_precision` it should be possible to fine tune the model on a single 24GB GPU. For higher `batch_size` and faster training it's better to use GPUs with >30GB memory. | ||
|
||
**___Note: Change the `resolution` to 768 if you are using the [stable-diffusion-2](https://huggingface.co/stabilityai/stable-diffusion-2) 768x768 model.___** | ||
|
||
<!-- accelerate_snippet_start --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use comment as a marker. In markdowns, you can use html style commenting |
||
```bash | ||
export MODEL_NAME="CompVis/stable-diffusion-v1-4" | ||
export dataset_name="lambdalabs/pokemon-blip-captions" | ||
|
@@ -71,6 +71,7 @@ accelerate launch --mixed_precision="fp16" train_text_to_image.py \ | |
--lr_scheduler="constant" --lr_warmup_steps=0 \ | ||
--output_dir="sd-pokemon-model" | ||
``` | ||
<!-- accelerate_snippet_end --> | ||
|
||
|
||
To run on your own training files prepare the dataset according to the format required by `datasets`, you can find the instructions for how to do that in this [document](https://huggingface.co/docs/datasets/v2.4.0/en/image_load#imagefolder-with-metadata). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is relative path to
examples/text_to_image/README.md
from perspective of current file, which isdocs/source/en/training/text2image.mdx