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 .
# 这个编译比较慢哈

最后应该会成功哒。

相关推荐
AI探索者5 小时前
LangGraph StateGraph 实战:状态机聊天机器人构建指南
python
AI探索者5 小时前
LangGraph 入门:构建带记忆功能的天气查询 Agent
python
FishCoderh7 小时前
Python自动化办公实战:批量重命名文件,告别手动操作
python
躺平大鹅7 小时前
Python函数入门详解(定义+调用+参数)
python
曲幽8 小时前
我用FastAPI接ollama大模型,差点被asyncio整崩溃(附对话窗口实战)
python·fastapi·web·async·httpx·asyncio·ollama
两万五千个小时11 小时前
落地实现 Anthropic Multi-Agent Research System
人工智能·python·架构
哈里谢顿14 小时前
Python 高并发服务限流终极方案:从原理到生产落地(2026 实战指南)
python
用户8356290780511 天前
无需 Office:Python 批量转换 PPT 为图片
后端·python
markfeng81 天前
Python+Django+H5+MySQL项目搭建
python·django
GinoWi1 天前
Chapter 2 - Python中的变量和简单的数据类型
python