Buckets:

|
download
raw
1.1 kB
# xFormers
We recommend [xFormers](https://github.com/facebookresearch/xformers) for both inference and training. In our tests, the optimizations performed in the attention blocks allow for both faster speed and reduced memory consumption.
Install xFormers from `pip`:
```bash
pip install xformers
```
> [!TIP]
> The xFormers `pip` package requires the latest version of PyTorch. If you need to use a previous version of PyTorch, then we recommend [installing xFormers from the source](https://github.com/facebookresearch/xformers#installing-xformers).
After xFormers is installed, you can use it with [set_attention_backend()](/docs/diffusers/v0.38.0/en/api/models/overview#diffusers.ModelMixin.set_attention_backend) as shown in the [Attention backends](./attention_backends) guide.
> [!WARNING]
> According to this [issue](https://github.com/huggingface/diffusers/issues/2234#issuecomment-1416931212), xFormers `v0.0.16` cannot be used for training (fine-tune or DreamBooth) in some GPUs. If you observe this problem, please install a development version as indicated in the issue comments.

Xet Storage Details

Size:
1.1 kB
·
Xet hash:
775d567c4fd48b4cd8a6e52dd3c20436385d7e4df1ef1adbca19f0bbe6114b92

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.