在 onnxruntime python 库中可以加载在内存或者显存中,分别使用 cpu 和 gpu 进行推断运算,本文记录 onnxruntime 将模型加载到指定 gpu 的步骤。
安装 {#安装}
这里我们使用 1.18.0 的 onnx 库
指定 gpu 配置 {#指定-gpu-配置}
将需要加载模型的 gpu id 填入 device_id,需要用字符串类型
也有一种实现思路是在 Docker 内仅映射部分 gpu
参考资料 {#参考资料}
- https://blog.csdn.net/weixin_41449637/article/details/116486847
- https://github.com/cap-ntu/ML-Model-CI/issues/37
文章链接:
https://www.zywvvd.com/notes/study/deep-learning/deploy/onnx-percific-gpu/onnx-percific-gpu/