Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions examples/vae/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
# Training a VAE

Creating a training image set is [described in a different document](https://huggingface.co/docs/datasets/image_process#image-datasets).

## Installing the dependencies

Before running the scripts, make sure to install the library's training dependencies:

**Important**

To make sure you can successfully run the latest versions of the example scripts, we highly recommend **installing from source** and keeping the install up to date as we update the example scripts frequently and install some example-specific requirements. To do this, execute the following steps in a new virtual environment:
```bash
git clone https://github.com/huggingface/diffusers
cd diffusers
pip install .
```

Then cd in the example folder and run
```bash
pip install -r requirements.txt
```

## Training

The command to train a VAE model on a custom dataset (`DATASET_NAME`):

```bash
python train_vae.py --mixed_precision="no" \
--pretrained_model_name_or_path="stabilityai/stable-diffusion-2-1" \
--dataset_name="<DATASET_NAME>" \
--train_batch_size=1 \
--gradient_accumulation_steps=4 \
--gradient_checkpointing

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
--gradient_checkpointing
--gradient_checkpointing \

--report_to="wandb"
```


## Using the VAE


1 change: 1 addition & 0 deletions examples/vae/requirements.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
lpips
Loading