- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6.5k
create a script to train autoencoderkl #10605
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
Changes from 3 commits
cf94b6a
              dd3a0a3
              16e6786
              cdee155
              f37ffa7
              93c62c9
              dafd929
              041bdfb
              80d3979
              a636841
              dfb9e37
              ceec5f3
              ca62ba8
              e5f63bf
              2e348b8
              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 | 
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # AutoencoderKL training example | ||
|  | ||
| ## 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 | ||
| ``` | ||
|  | ||
|  | ||
| And initialize an [🤗Accelerate](https://github.com/huggingface/accelerate/) environment with: | ||
|  | ||
| ```bash | ||
| accelerate config | ||
| ``` | ||
|  | ||
| ## Training on ImageNet | ||
|  | ||
| ```bash | ||
| accelerate launch --multi_gpu --num_processes 4 --mixed_precision bf16 train_autoencoderkl.py \ | ||
|          | ||
| --pretrained_model_name_or_path stabilityai/sdxl-vae \ | ||
| --num_train_epochs 100 \ | ||
| --gradient_accumulation_steps 2 \ | ||
| --learning_rate 4.5e-6 \ | ||
| --lr_scheduler cosine \ | ||
| --report_to wandb \ | ||
| --mixed_precision bf16 \ | ||
| --train_data_dir /path/to/ImageNet/train \ | ||
| --validation_image ./image.png \ | ||
| 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. Where does it come from? 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. The validation images are randomly selected from the ImageNet validation set, consisting of eight images. Here, they are simply represented as an abstract ./image.png for illustrative purposes. | ||
| --decoder_only | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| accelerate>=0.16.0 | ||
| bitsandbytes | ||
| datasets | ||
| diffusers | ||
| huggingface_hub | ||
| lpips | ||
| numpy | ||
| packaging | ||
| Pillow | ||
| taming_transformers | ||
| torch | ||
| torchvision | ||
| tqdm | ||
| transformers | ||
| wandb | ||
| xformers | 
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.
Let's provide a smaller dataset here in the example.