前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Python ONNX-GPU 使用记录

Python ONNX-GPU 使用记录

作者头像
为为为什么
发布2022-08-05 15:26:28
9840
发布2022-08-05 15:26:28
举报
文章被收录于专栏:又见苍岚又见苍岚

Microsoft 和合作伙伴社区创建了 ONNX 作为表示机器学习模型的开放标准。 许多框架(包括 TensorFlow、PyTorch、SciKit-Learn、Keras、Chainer、MXNet、MATLAB 和 SparkML)中的模型都可以导出或转换为标准 ONNX 格式。 模型采用 ONNX 格式后,可在各种平台和设备上运行。 本文记录Python 平台 ONNX-GPU 相关内容。

简介

ONNX Runtime是一个跨平台的推理和训练机器学习加速器。

支持Linux和Windows平台CPU和GPU运算,对mac和手机终端也有相应支持。

System

CPU

GPU

EPs

Windows

https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=9

https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=10

https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=47

Linux

https://dev.azure.com/onnxruntime/onnxruntime/_build/latest ?definitionId=11 https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=64 https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=110 https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=78 https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=86

https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=12 https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=45 https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=140 https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=84

https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=110 https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=108

Mac

https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=13 https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=65

Android

https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=53

iOS

https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=134

WebAssembly

https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=161

  • ONNX Runtime inference

ONNX运行时推断可以实现更快的客户体验和更低的成本,支持来自深度学习框架(如PyTorch和TensorFlow/Keras)的模型,以及经典的机器学习库(如scikit learn、LightGBM、XGBoost等)。ONNX运行时与不同的硬件、驱动程序和操作系统兼容,并通过在适用的情况下利用硬件加速器以及图形优化和转换提供最佳性能。

官方文档:https://www.onnxruntime.ai/docs/#onnx-runtime-for-inferencing

ONNX Runtime training

通过对现有PyTorch培训脚本进行单行添加,ONNX Runtime培训可加快多节点NVIDIA GPU上变压器模型的模型培训时间。

官方文档:https://www.onnxruntime.ai/docs/#onnx-runtime-for-training

安装

  • 在Python下安装,CPU版:
代码语言:javascript
复制
pip install onnxruntime

  • 在Python下安装,GPU版:
代码语言:javascript
复制
pip install onnxruntime-gpu

版本要求

onnx与onnxruntime版本关系

官方链接:https://github.com/microsoft/onnxruntime/blob/master/docs/Versioning.md#version-matrix

ONNX Runtime release version

ONNX release version

ONNX opset version

ONNX ML opset version

Supported ONNX IR version

Windows ML Availability

1.8.0

1.8 down to 1.2

13

2

7

Windows AI 1.8+

1.7.0

1.8 down to 1.2

13

2

7

Windows AI 1.7+

1.6.0

1.8 down to 1.2

13

2

7

Windows AI 1.6+

1.5.3

1.7 down to 1.2

12

2

7

Windows AI 1.5+

1.5.2

1.7 down to 1.2

12

2

7

Windows AI 1.5+

1.5.1

1.7 down to 1.2

12

2

7

Windows AI 1.5+

1.4.0

1.7 down to 1.2

12

2

7

Windows AI 1.4+

1.3.1

1.7 down to 1.2

12

2

7

Windows AI 1.4+

1.3.0

1.7 down to 1.2

12

2

7

Windows AI 1.3+

1.2.0 1.1.2 1.1.1 1.1.0

1.6 down to 1.2

11

2

6

Windows AI 1.3+

1.0.0

1.6 down to 1.2

11

2

6

Windows AI 1.3+

0.5.0

1.5 down to 1.2

10

1

5

Windows AI 1.3+

0.4.0

1.5 down to 1.2

10

1

5

Windows AI 1.3+

0.3.1 0.3.0

1.4 down to 1.2

9

1

3

Windows 10 2004+

0.2.1 0.2.0

1.3 down to 1.2

8

1

3

Windows 10 1903+

0.1.5 0.1.4

1.3 down to 1.2

8

1

3

Windows 10 1809+

onnxruntime 与 CUDA cuDNN版本要求

官方链接:https://www.onnxruntime.ai/docs/reference/execution-providers/CUDA-ExecutionProvider.html#requirements

ONNX Runtime

CUDA

cuDNN

Notes

1.8

11.0.3

8.0.4 (Linux) 8.0.2.39 (Windows)

libcudart 11.0.221 libcufft 10.2.1.245 libcurand 10.2.1.245 libcublasLt 11.2.0.252 libcublas 11.2.0.252 libcudnn 8.0.4 libcupti.so 2020.1.1

1.7

11.0.3

8.0.4 (Linux) 8.0.2.39 (Windows)

libcudart 11.0.221 libcufft 10.2.1.245 libcurand 10.2.1.245 libcublasLt 11.2.0.252 libcublas 11.2.0.252 libcudnn 8.0.4

1.5-1.6

10.2

8.0.3

CUDA 11 can be built from source

1.2-1.4

10.1

7.6.5

Requires cublas10-10.2.1.243; cublas 10.1.x will not work

1.0-1.1

10.0

7.6.4

CUDA versions from 9.1 up to 10.1, and cuDNN versions from 7.1 up to 7.4 should also work with Visual Studio 2017

参考资料

本文参与?腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021年5月28日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客?前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与?腾讯云自媒体分享计划? ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 简介
  • 安装
  • 版本要求
    • onnx与onnxruntime版本关系
      • onnxruntime 与 CUDA cuDNN版本要求
      • 参考资料
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
      http://www.vxiaotou.com