【PyTorch】模型部署

Backto PyTorch Index

最佳實踐 Best Practice

2020-07-03

Server/Nvidia :C++ / TensorRT
Mobile/Non-Nvidia : TVM

技術路徑 Paths

TorchScript-Libtorch / offcial C++ frontend

官方推薦和主代碼演進的方向

The PyTorch team is betting heavily on TorchScript/libtorch as the path for going from research to production. Our ideal workflow is for the user to prototype in Python/PyTorch eager, convert to TorchScript, then use our compiler infrastructure to optimize and potentially lower your model to specialized hardware.

Pro: 官方出品,覆蓋面廣
Con:當前主要是從 Python 到 C++ 的轉寫,利用的是C++語言的加速特性。而更爲關鍵的硬件加速涉及不多。

TVM

在這裏插入圖片描述
在這裏插入圖片描述

在這裏插入圖片描述

TVM 需要已知輸入 Tensor 的 dimensions,所以一般是作爲JIT 使用,確實是比官方 JIT 要快。
但還是那個問題,無法激發硬件的性能。

TensorRT

Nvidia 官方出品,閉源,暴力。
官方轉換組件: torch2trt, 官方提供了在 Jetson Nano 和 Xavier 平臺上的測試,提速可謂暴力十足。

在這裏插入圖片描述


Ref

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章