Windows系统直接pip 安装flash-attn是非常慢的,不过有大佬编译好了windows版本,我们可以直接拿来用。
项目地址:https://github.com/bdashore3/flash-attention/releases

先pip list,看看你的torch版本是哪个,你的是哪个版本,就选哪个版本flash-attn
比如说,我是torch2.4.0,我的python版本是3.10,也就是
flash_attn-2.7.1.post1+cu124torch2.4.0cxx11abiFALSE-cp310-cp310-win_amd64.whl
你也可以查看其它的Assets,查看更多版本列表
鼠标右键点击这一项,选择复制链接地址
然后在命令窗口里输入:
pip install https://github.com/bdashore3/flash-attention/releases/download/v2.7.1.post1/flash_attn-2.7.1.post1+cu124torch2.4.0cxx11abiFALSE-cp310-cp310-win_amd64.whl
这样安装就会很快了