"tests/vscode:/vscode.git/clone" did not exist on "dd65ee211ea5ec1c876d323c4387f066bee41a77"
Unverified Commit 4bc157ff authored by Patrick von Platen's avatar Patrick von Platen Committed by GitHub
Browse files

Correct textual inversion readme (#3145)

* Update README.md

* Apply suggestions from code review
parent f2df39fa
...@@ -39,29 +39,31 @@ accelerate config ...@@ -39,29 +39,31 @@ accelerate config
### Cat toy example ### Cat toy example
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. First, let's login so that we can upload the checkpoint to the Hub during training:
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).
Run the following command to authenticate your token
```bash ```bash
huggingface-cli login huggingface-cli login
``` ```
If you have already cloned the repo, then you won't need to go through these steps. Now let's get our dataset. For this example we will use some cat images: https://huggingface.co/datasets/diffusers/cat_toy_example .
<br> Let's first download it locally:
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. ```py
from huggingface_hub import snapshot_download
And launch the training using local_dir = "./cat"
snapshot_download("diffusers/cat_toy_example", local_dir=local_dir, repo_type="dataset", ignore_patterns=".gitattributes")
```
This will be our training data.
Now we can launch the training using
**___Note: Change the `resolution` to 768 if you are using the [stable-diffusion-2](https://huggingface.co/stabilityai/stable-diffusion-2) 768x768 model.___** **___Note: Change the `resolution` to 768 if you are using the [stable-diffusion-2](https://huggingface.co/stabilityai/stable-diffusion-2) 768x768 model.___**
```bash ```bash
export MODEL_NAME="runwayml/stable-diffusion-v1-5" export MODEL_NAME="runwayml/stable-diffusion-v1-5"
export DATA_DIR="path-to-dir-containing-images" export DATA_DIR="./cat"
accelerate launch textual_inversion.py \ accelerate launch textual_inversion.py \
--pretrained_model_name_or_path=$MODEL_NAME \ --pretrained_model_name_or_path=$MODEL_NAME \
...@@ -75,6 +77,7 @@ accelerate launch textual_inversion.py \ ...@@ -75,6 +77,7 @@ accelerate launch textual_inversion.py \
--learning_rate=5.0e-04 --scale_lr \ --learning_rate=5.0e-04 --scale_lr \
--lr_scheduler="constant" \ --lr_scheduler="constant" \
--lr_warmup_steps=0 \ --lr_warmup_steps=0 \
--push_to_hub \
--output_dir="textual_inversion_cat" --output_dir="textual_inversion_cat"
``` ```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment