☰
YOLO12复现报错
2026/9/25 2:44:26 网站建设 项目流程

参考文章:

YOLOv12快速复现部署&训练测试_yolov12复现-CSDN博客https://blog.csdn.net/WhiffeYF/article/details/145866853

运行这个命令时报错

报错内容:ERROR: flash_attn-2.7.3+cu11torch2.2cxx11abiFALSE-cp311-cp311-linux_x86_64.whl is not a supported wheel on this platform.
原因:安装的flash_attn预编译 Wheel 文件与当前 Python 环境的平台、Python 版本、CUDA 版本或 PyTorch 版本不兼容。
分别运行命令:

python -V

python

>>>import torch
>>> print(torch.version.cuda)

>>> print(torch.__version__)

得到​​ Python 3.12.3;CUDA 12.1;​​PyTorch 2.3.0+cu21;

所以一开始的配置是不对的,PyTorch 2.3.0就对不上了

重开一个实例,PyTorch 2.2.0 ,CUDA为11.8

因为安装原文中的flash_attn包,对应的CUDA 版本必须是11.x。

=========================================================================

关于原环境CUDA12.1,要找到对应的包进行下载,因为网络原因,一直下载失败,以下内容为参考。

1、可以尝试不安装flash_attn包,参考文章:

Windows系统下安装运行YOLOv12所需的flash_attn 包教程_assertionerror: import flashattention error! pleas-CSDN博客https://blog.csdn.net/Anperlanch/article/details/145760623

2、尝试不更改配置(CUDA12.1),正确安装,首先删除前三行,运行命令:
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 -f https://mirrors.aliyun.com/pytorch-wheels/cu121


进入社区预编译,参考文章:Python|flash_attn 安装方法_flash-attn-CSDN博客

Linux版本:Releases · Dao-AILab/flash-attention,例如找到Linux版本

flash_attn-2.7.4.post1+cu12torch2.3cxx11abiFALSE-cp312-cp312-linux_x86_64.whl

可以直接运行(下面这个是模板,要输入对应的文件名,下载较慢):

wget https://github.com/Dao-AILab/flash-attention/releases/download/v2.x.x/flash_attn-xxxxxxx-linux_x86_64.whl

Windows版本:Releases · kingbri1/flash-attention

注意这是Windows版本哦(暂时用不上),运行命令:
wget https://github.com/kingbri1/flash-attention/releases/download/v2.5.9.post1/flash_attn-2.5.9.post1+cu122torch2.3.1cxx11abiFALSE-cp311-cp311-win_amd64.whl

再运行:pip install -r requirements.txt

报错:ERROR: Could not find a version that satisfies the requirement onnxruntime==1.15.1 (from versions: 1.17.0, 1.17.1, 1.17.3, 1.18.0, 1.18.1, 1.19.0, 1.19.2, 1.20.0, 1.20.1, 1.21.0, 1.21.1, 1.22.0, 1.22.1)
ERROR: No matching distribution found for onnxruntime==1.15.1


是因为onnxruntime==1.15.1这个版本的包较旧,建议requirements.txt改为下面这样:

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询