Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the ONNX output values #11

Open
yaelatletl opened this issue May 3, 2023 · 3 comments
Open

Using the ONNX output values #11

yaelatletl opened this issue May 3, 2023 · 3 comments

Comments

@yaelatletl
Copy link
Collaborator

From edbeeching/godot_rl_agents#23

@edbeeching I've been trying to implement the ONNX model to directly handle the agents, but it's a bit obscure.
I was actually able to relate the outputs from the model to the outputs from the checkpoint and training.

Godot recieves:setting action 4 content: {jump:0, move:[-0.965605], turn:[-1]}
ONNX outputs: {output:[1.830403, -1.823679, -0.965604, -2.522008, -1.960869, -2.00579], state_outs:[0]}

Godot recieves: setting action 7 content: {jump:1, move:[-1], turn:[0.057112]}
ONNX outputs: {output:[-0.059597, 0.059326, -1.319151, -1.642016, 0.057112, -1.164303], state_outs:[0]}

Godot recieves: setting action 9 content: {jump:0, move:[-0.582598], turn:[-0.251385]}
ONNX outputs: {output:[3.487688, -3.483186, -0.582597, -2.297049, -0.251385, -2.50098], state_outs:[0]}
The index 2 relates to move and index 4 relates to turn, but I can't wrap my head around the other values, question here is, what are the other values supposed to mean? Which one represents jump?

I'm not sure if the output is complete, but the results are deterministic and coherent so far, so maybe there's something I'm missing? Any advice would be appreciated

@edbeeching
Copy link
Owner

Hey, did you try the sb3 models in the latest version of the repo? I did not test the rllib export much.

@GeorgeS2019
Copy link

GeorgeS2019 commented May 17, 2023

Done :-)

https://github.com/edbeeching/godot_rl_agents_examples/blob/main/examples/BallChase/addons/godot_rl_agents/onnx/csharp/ONNXInference.cs

@yaelatletl
Are u only using GDScript in Godot.

Now that in 0.5 version, it is possible to export ONNX, that means one could consume the ONNX using ML.NET in Godot

@edbeeching
Will you be interested to encourage users to have examples in Godot using C# and use ML.NET or ONNX Runtime to consume these exported ONNX from python?

@hakuhan
Copy link

hakuhan commented Jun 2, 2024

Are u only using GDScript in Godot.

I created a fork: https://github.com/hakuhan/godot_rl_agents_plugin which using gdextension to load onnx model (By loading ONNXRuntime libs). I compiled/tested/pushed linux version of gdextension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants