在安装flash attention2的过程中,采了好多坑。因此记录一个帖子,写一下怎么安装flash attention 2。
首先,确认自己环境里的各个配置版本是啥,比如我的环境中:
python:3.10.0
cuda: 12.1
torch:2.5.1
然后,去flash attention 2的github官网,找对应的版本,网页链接:https://github.com/Dao-AILab/flash-attention/tags
然后开始找你对应的版本,黄框要和你的环境对应:

然后,我这边没有直接从官网下,而是找到对应版本后,在终端下载:
bash
pip install flash-attn==2.7.4.post1 --no-build-isolation
下载完毕后,运行,看效果:
