From 88ab347d3ce0082ae6d44f36a423de786b46c330 Mon Sep 17 00:00:00 2001 From: Zhenhuan Liu Date: Thu, 22 Sep 2022 10:19:45 -0700 Subject: [PATCH] Update readme and default hyperparameters. --- examples/dreambooth/README.md | 36 ++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/examples/dreambooth/README.md b/examples/dreambooth/README.md index 5d6f3b9eb9..97a318b38a 100644 --- a/examples/dreambooth/README.md +++ b/examples/dreambooth/README.md @@ -38,26 +38,48 @@ Now let's get our dataset. Download images from [here](https://drive.google.com/ And launch the training using +```bash +export MODEL_NAME="CompVis/stable-diffusion-v1-4" +export INSTANCE_DIR="path-to-instance-images" +export OUTPUT_DIR="path-to-save-model" + +python train_dreambooth.py \ + --pretrained_model_name_or_path=$MODEL_NAME --use_auth_token \ + --instance_data_dir=$INSTANCE_DIR \ + --output_dir=$OUTPUT_DIR \ + --instance_prompt="a photo of sks dog" \ + --resolution=512 \ + --train_batch_size=1 \ + --gradient_accumulation_steps=1 \ + --learning_rate=5e-6 \ + --lr_scheduler="constant" \ + --lr_warmup_steps=0 \ + --max_train_steps=400 +``` + +Training with prior-preservation loss using ```bash export MODEL_NAME="CompVis/stable-diffusion-v1-4" export INSTANCE_DIR="path-to-instance-images" export CLASS_DIR="path-to-class-images" +export OUTPUT_DIR="path-to-save-model" python train_dreambooth.py \ --pretrained_model_name_or_path=$MODEL_NAME --use_auth_token \ --instance_data_dir=$INSTANCE_DIR \ --class_data_dir=$CLASS_DIR \ + --output_dir=$OUTPUT_DIR \ + --with_prior_preservation \ + --instance_prompt="a photo of sks dog" \ + --class_prompt="a photo of dog" \ --resolution=512 \ - --train_batch_size=4 \ + --train_batch_size=1 \ --gradient_accumulation_steps=1 \ - --learning_rate=1e-5 \ + --learning_rate=5e-6 \ --lr_scheduler="constant" \ --lr_warmup_steps=0 \ - --output_dir="dreambooth_dog" \ - --instance_prompt="a photo of sks dog" \ - --class_prompt="a photo of dog" - --num_class_images=1000 \ - --max_train_steps=3000 + --num_class_images=200 \ + --max_train_steps=1000 ```