51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

Python onnxruntime-gpu 指定 gpu 加载模型

在 onnxruntime python 库中可以加载在内存或者显存中,分别使用 cpu 和 gpu 进行推断运算,本文记录 onnxruntime 将模型加载到指定 gpu 的步骤。

安装 {#安装}

这里我们使用 1.18.0 的 onnx 库

指定 gpu 配置 {#指定-gpu-配置}

将需要加载模型的 gpu id 填入 device_id,需要用字符串类型

也有一种实现思路是在 Docker 内仅映射部分 gpu

参考资料 {#参考资料}



文章链接:
https://www.zywvvd.com/notes/study/deep-learning/deploy/onnx-percific-gpu/onnx-percific-gpu/

赞(0)
未经允许不得转载:工具盒子 » Python onnxruntime-gpu 指定 gpu 加载模型