mat490 / Godot-ONNX-AI-Models-Loaders

Godot does not have a native tool to read pre-trained AI models in any format. This repository contains the project for a GDExtension to read and use pre-trained models stored in ONNX files.
1 stars 0 forks source link

onnxruntime uses gpu #2

Open juntaosun opened 2 weeks ago

juntaosun commented 2 weeks ago

I noticed that your code loads the onnx model and uses the CPU by default. You can add the following code to support gpu loading model and inference, which will be much faster than cpu.

Use GPU:

OrtSessionOptionsAppendExecutionProvider_CUDA(session_options, 0);
session = new Ort::Session(env, model_path_w.c_str(), session_options);

Hope you can add some examples of doing onnx model inference in Godot, thanks !

mat490 commented 1 week ago

You're right. I thank you very much for your contribution, I have been busy but these days I will work to implement it correctly. And I will try to make some examples of doing onnx model inference in Godot. 😁