flash-attention总是安装失败

大家有时候在执行下面命令安装flash-attention的时候经常会报错

bash 复制代码
pip install flash-attn --no-build-isolation

遇到这种情况,可以从源码进行安装

bash 复制代码
git clone https://github.com/Dao-AILab/flash-attention.git
cd flash-attention
# RTX 4090的话就是8.9
export TORCH_CUDA_ARCH_LIST="8.9"
rm -rf build flash_attn.egg-info dist
export TMPDIR=$PWD/tmp
mkdir -p $TMPDIR
git checkout v2.5.7
# 这个过程会比较久,10minutes左右
pip install --no-build-isolation -e .
bash 复制代码
# 安装fused_mlp_lib
# 在flash-attention目录下
cd csrc/fused_dense_lib
pip install --no-build-isolation .
bash 复制代码
# 安装layer_form
# 在flash-attention目录下
cd csrc/layer_norm
pip install --no-build-isolation .
# 这个编译比较慢哈

最后应该会成功哒。

相关推荐
前端精髓8 小时前
结构化输出with_structured_output(抽卡)
python·langchain
尹人入圣9 小时前
目前热门的IP驱动产业新场景新工具
网络·python·网络协议·tcp/ip
Nuanyt9 小时前
Agent 学习笔记(下篇三):上线工程、进阶选择与操作界面(Stage 7 / 7.5 / 8 + 延伸路线)
笔记·python·学习·memory·aiagent·harness
吴卫斌9 小时前
定投ETF实战指南(四):行业/主题ETF——定投的“进攻端“
开发语言·python·股票·量化
2601_9679873710 小时前
Python——入门级(定义功能def函数)
python·函数·可变参数·默认参数·关键字参数
专注仿真12 小时前
梯度提升类(XFBoost)算法详解与代码实例
开发语言·人工智能·python·算法·大模型训练·控制算法
外收内放12 小时前
Python基础语法练习题(75)
开发语言·python·学习
黑十13 小时前
PyTorch 报 “no CUDA GPUs are available“ 怎么办?3 步排查
服务器·网络·人工智能·pytorch·python
threelab14 小时前
开源图片去水印代码
python
taller_200015 小时前
【012】数据类型入门: Excel 数据到 Python 值的转换
python·excel·pie·py