【已解决】运行onnxruntime-gpu时遇到RuntimeError问题

  1. 问题描述

在使用onnxruntime进行模型推理时希望使用GPU进行加速,但运行时出现RuntimeError
具体报错如下:
*************** EP Error ***************
EP Error D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:891 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasnt able to be loaded. Please install the correct version of CUDA andcuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.
when using ['CUDAExecutionProvider']
Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.

2. 解决问题都干了什么

  • 首先把cunda安装目录都添加到了path 环境变量里
  • 重新安装了onnxruntime-gpu   == 1.18.1 # 从原来的1.18.0===》更改为1.18.1,没啥用可能
  • 卸载了onnxruntime   == 1.18.0 ,运行报了新错误,pydoc.ErrorDuringImport: problem in cosyvoice.flow.flow_matching - ImportError: cannot import name 'InferenceSession' from 'onnxruntime' (unknown location)
  • 然后直接安装 onnxruntime-gpu  最新版 ,没有指定版本,默认是1.19.2,成功启动

其他可能有用:

  1. GPU型号与onnxruntime不兼容:你的显卡是NVIDIA GeForce RTX 4070,可能不在onnxruntime支持的GPU列表中。你可以查看onnxruntime的官方文档,确认你的GPU型号是否被支持。如果不支持,你可能需要降级你的GPU驱动或者更换一个受支持的GPU。
  2. CUDA\v11.8 + cudnn-windows-x86_64-8.9.7.29 + onnxruntime-gpu   == 1.18.1

3. 还遇到过问题,遇到的太多了,泪目,太难了

  • 显卡支持的cuda版本不支持
  • 一直报没有matcha这个模块

  • onnx-time这个版本不匹配

     

     

posted on   泰勒幂级数  阅读(735)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示