Skip to content

Commit 4bc157f

Browse files
Correct textual inversion readme (#3145)
* Update README.md * Apply suggestions from code review
1 parent f2df39f commit 4bc157f

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

examples/textual_inversion/README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,31 @@ accelerate config
3939

4040
### Cat toy example
4141

42-
You need to accept the model license before downloading or using the weights. In this example we'll use model version `v1-5`, so you'll need to visit [its card](https://huggingface.co/runwayml/stable-diffusion-v1-5), read the license and tick the checkbox if you agree.
43-
44-
You have to be a registered user in 🤗 Hugging Face Hub, and you'll also need to use an access token for the code to work. For more information on access tokens, please refer to [this section of the documentation](https://huggingface.co/docs/hub/security-tokens).
45-
46-
Run the following command to authenticate your token
42+
First, let's login so that we can upload the checkpoint to the Hub during training:
4743

4844
```bash
4945
huggingface-cli login
5046
```
5147

52-
If you have already cloned the repo, then you won't need to go through these steps.
48+
Now let's get our dataset. For this example we will use some cat images: https://huggingface.co/datasets/diffusers/cat_toy_example .
5349

54-
<br>
50+
Let's first download it locally:
5551

56-
Now let's get our dataset.Download 3-4 images from [here](https://drive.google.com/drive/folders/1fmJMs25nxS_rSNqS5hTcRdLem_YQXbq5) and save them in a directory. This will be our training data.
52+
```py
53+
from huggingface_hub import snapshot_download
5754

58-
And launch the training using
55+
local_dir = "./cat"
56+
snapshot_download("diffusers/cat_toy_example", local_dir=local_dir, repo_type="dataset", ignore_patterns=".gitattributes")
57+
```
58+
59+
This will be our training data.
60+
Now we can launch the training using
5961

6062
**___Note: Change the `resolution` to 768 if you are using the [stable-diffusion-2](https://huggingface.co/stabilityai/stable-diffusion-2) 768x768 model.___**
6163

6264
```bash
6365
export MODEL_NAME="runwayml/stable-diffusion-v1-5"
64-
export DATA_DIR="path-to-dir-containing-images"
66+
export DATA_DIR="./cat"
6567

6668
accelerate launch textual_inversion.py \
6769
--pretrained_model_name_or_path=$MODEL_NAME \
@@ -75,6 +77,7 @@ accelerate launch textual_inversion.py \
7577
--learning_rate=5.0e-04 --scale_lr \
7678
--lr_scheduler="constant" \
7779
--lr_warmup_steps=0 \
80+
--push_to_hub \
7881
--output_dir="textual_inversion_cat"
7982
```
8083

0 commit comments

Comments
 (0)