0


【已解决】onnx无法找到CUDA的路径

报错

RuntimeError: D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:857 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set bu
t 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.

问题分析

onnx找到了gpu,但是还是不能调用

解决办法

  1. 先检查一下cudnn的环境变量配置是否正确,如果不正确,先看看怎么安装cudnn

  2. 接下来是环境变量没问题的情况

     环境变量没问题的话,一般就是cudnn和cuda以及onnx的版本不匹配
    
     版本匹配看这里
    
     查看好自己cudnn和cuda对应onnx版本后,输入这个
    
pip install onnxruntime-gpu==what_you_want_version --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
what_you_want_version

换成你需要的版本,如我是cuda12.x以及cudnn8.x

    那么就是

pip install onnxruntime-gpu==1.18.1 --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/


本文转载自: https://blog.csdn.net/2202_75832991/article/details/140550441
版权归原作者 烟花节 所有, 如有侵权,请联系我们删除。

“【已解决】onnx无法找到CUDA的路径”的评论:

还没有评论