赞
踩
安装flash-attn时build报错,或者即使安装成功,但却import不进来,可能是你安装的flash版本不一致!导致flash-attn安装错误。
可在下面的网页上下载对应版本的离线包再安装:
https://github.com/Dao-AILab/flash-attention/releases/
报错1
我build时的报错信息如下:
Failed to build flash-attn ERROR: Could not build wheels for flash-attn, which is required to install pyproject.toml-based projects
报错2
以及我换了其他不合适的版本即使安装成功后,在import的过程中报错:
ImportError: libcudart.so.11.0: cannot open shared object file: No such file or directory
网上找了一圈,怀疑可能是安装的版本不对。
上面贴的网页里面releases了很多版本,找到与自己环境匹配的版本下载,比如我的环境是:
python3.10
cuda_11.7
torch 2.0
下载的版本为:flash_attn-2.3.5+cu117torch2.0cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
注意:cxx有True和False两个版本,可以都试一下。我用的是cxxFALSE版本。
下载完之后,使用以下命令进行安装:
pip install flash_attn-2.3.5+cu117torch2.0cxx11abiFALSE-cp310-cp310-linux_x86_64.whl --no-build-isolation
问题解决!
Reference:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。