当前位置:   article > 正文

【环境搭建:onnx模型部署】onnxruntime-gpu安装与测试(python)(1)_onnxruntime 安装

onnxruntime 安装

cuda==10.2

cudnn==8.0.3

onnxruntime-gpu==1.5.0 or 1.6.0

pip install onnxruntime-gpu==1.6.0



### 2.2 方法二:onnxruntime-gpu不依赖于本地主机上cuda和cudnn


在 conda 环境中安装,不依赖于 本地主机 上已安装的 cuda 和 cudnn 版本,灵活方便。这里,先说一下已经测试通过的组合:


* python3.6, cudatoolkit10.2.89, cudnn7.6.5, onnxruntime-gpu1.4.0
* python3.8, cudatoolkit11.3.1, cudnn8.2.1, onnxruntime-gpu1.14.1


如果需要其他的版本, 可以根据 onnxruntime-gpu, cuda, cudnn 三者对应关系自行组合测试。


下面,从创建conda环境,到实现在GPU上加速onnx模型推理进行举例。


#### 2.2.1 举例:创建onnxruntime-gpu==1.14.1的conda环境



  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

创建conda环境

conda create -n torch python=3.8

激活conda环境

source activate torch
conda install pytorch1.10.0 torchvision0.11.0 torchaudio0.10.0 cudatoolkit=11.3 -c pytorch -c conda-forge
conda install cudnn
8.2.1
pip install onnxruntime-gpu==1.14.1

pip install … (根据需求,安装其他的包)


#### 2.2.2 举例:实例测试


* 打开终端,输入 **watch -n 0.1 nvidia-smi**, 实时查看gpu使用情况

 ![](https://img-blog.csdnimg.cn/7ca
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/人工智能uu/article/detail/850049
推荐阅读
相关标签
  

闽ICP备14008679号