Buckets:

|
download
raw
963 Bytes
# xFormers
我们推荐在推理和训练过程中使用[xFormers](https://github.com/facebookresearch/xformers)。在我们的测试中,其对注意力模块的优化能同时提升运行速度并降低内存消耗。
通过`pip`安装xFormers:
```bash
pip install xformers
```
> [!TIP]
> xFormers的`pip`安装包需要最新版本的PyTorch。如需使用旧版PyTorch,建议[从源码安装xFormers](https://github.com/facebookresearch/xformers#installing-xformers)。
安装完成后,您可调用`enable_xformers_memory_efficient_attention()`来实现更快的推理速度和更低的内存占用,具体用法参见[此章节](memory#memory-efficient-attention)。
> [!WARNING]
> 根据[此问题](https://github.com/huggingface/diffusers/issues/2234#issuecomment-1416931212)反馈,xFormers `v0.0.16`版本在某些GPU上无法用于训练(微调或DreamBooth)。如遇此问题,请按照该issue评论区指引安装开发版本。

Xet Storage Details

Size:
963 Bytes
·
Xet hash:
ea9039da00d6d2e4ea11a9eae03336057507af2011c9ca1153cb82d0bebfa1dc

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