The [Wuerstchen](https://hf.co/papers/2306.00637) model drastically reduces computational costs by compressing the latent space by 42x, without compromising image quality and accelerating inference. During training, Wuerstchen uses two models (VQGAN + autoencoder) to compress the latents, and then a third model (text-conditioned latent diffusion model) is conditioned on this highly compressed space to generate an image.  
To fit the prior model into GPU memory and to speedup training, try enabling `gradient_accumulation_steps`, `gradient_checkpointing`, and `mixed_precision` respectively.  
This guide explores the [train_text_to_image_prior.py](https://github.com/huggingface/diffusers/blob/main/examples/wuerstchen/text_to_image/train_text_to_image_prior.py) script to help you become more familiar with it, and how you can adapt it for your own use-case.  
Before running the script, make sure you install the library from source:  
```bash
git clone https://github.com/huggingface/diffusers
cd diffusers
pip install .
```  
Then navigate to the example folder containing the training script and install the required dependencies for the script you're using:  
```bash
cd examples/wuerstchen/text_to_image
pip install -r requirements.txt
```  
<Tip>  
🤗 Accelerate is a library for helping you train on multiple GPUs/TPUs or with mixed-precision. It'll automatically configure your training setup based on your hardware and environment. Take a look at the 🤗 Accelerate [Quick tour](https://huggingface.co/docs/accelerate/quicktour) to learn more.  
</Tip>  
Initialize an 🤗 Accelerate environment:  
```bash
accelerate config
```  
To setup a default 🤗 Accelerate environment without choosing any configurations:  
```bash
accelerate config default
```  
Or if your environment doesn't support an interactive shell, like a notebook, you can use:  
```py
from accelerate.utils import write_basic_config

write_basic_config()
```  
Lastly, if you want to train a model on your own dataset, take a look at the [Create a dataset for training](create_dataset) guide to learn how to create a dataset that works with the training script.  
<Tip>  
The following sections highlight parts of the training scripts that are important for understanding how to modify it, but it doesn't cover every aspect of the [script](https://github.com/huggingface/diffusers/blob/main/examples/wuerstchen/text_to_image/train_text_to_image_prior.py) in detail. If you're interested in learning more, feel free to read through the scripts and let us know if you have any questions or concerns.  
</Tip>
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/training/wuerstchen.md