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運行時推斷可以實現更快的客戶體驗和更低的成本,支持來自深度學習框架(如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
pip install onnxruntime
pip install onnxruntime-gpu
官方鏈接: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+
官方鏈接: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