[DreamBooth](https://huggingface.co/papers/2208.12242) is a training technique that updates the entire diffusion model by training on just a few images of a subject or style. It works by associating a special word in the prompt with the example images.  
If you're training on a GPU with limited vRAM, you should try enabling the `gradient_checkpointing` and `mixed_precision` parameters in the training command. You can also reduce your memory footprint by using memory-efficient attention with [xFormers](../optimization/xformers). JAX/Flax training is also supported for efficient training on TPUs and GPUs, but it doesn't support gradient checkpointing or xFormers. You should have a GPU with >30GB of memory if you want to train faster with Flax.  
This guide will explore the [train_dreambooth.py](https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.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 .
```  
Navigate to the example folder with the training script and install the required dependencies for the script you're using:  
<hfoptions id="installation">
<hfoption id="PyTorch">  
```bash
cd examples/dreambooth
pip install -r requirements.txt
```  
</hfoption>
<hfoption id="Flax">  
```bash
cd examples/dreambooth
pip install -r requirements_flax.txt
```  
</hfoption>
</hfoptions>  
<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 script that are important for understanding how to modify it, but it doesn't cover every aspect of the script in detail. If you're interested in learning more, feel free to read through the [script](https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py) and let us know if you have any questions or concerns.  
</Tip>
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/training/dreambooth.md