edbeeching / godot_rl_agents

An Open Source package that allows video game creators, AI researchers and hobbyists the opportunity to learn complex behaviors for their Non Player Characters or agents
MIT License
942 stars 69 forks source link

onnx not working #115

Closed hvven closed 1 year ago

hvven commented 1 year ago

The example I'm using is BallChase Training with just gdrl works well. Though when I try to use the onnx that came with the project it doesn't work.

I tried the following file paths:

I tried it with JumperHard and it doesn't work there too. This is a macOS m2 though I tried this in Windows and it still doesn't work.

dotnet --version 6.0.410 godot: 4.1.beta2.mono (tried 4.0.3.mono)

Is there any additional dependencies that I have to download to make it working?

Here's the video of the error. https://github.com/edbeeching/godot_rl_agents/assets/132185397/b0bbda8f-1b08-468d-8bd9-9b6373973099

(Also I couldn't ask help in the discord server because I couldn't find the invite link. (Is there even one?))

edbeeching commented 1 year ago

Hi, here is the link for the discord

The path should just be BallChase.onnx, but it seems you have tried that.

The issue may be due to you GPU type, is it an AMD GPU? Perhaps this PR on the plugin will resolve the issue?

hvven commented 1 year ago

The Windows laptop has an RTX 3060 though I couldn't test it with the PR yet.

I used the BallChase example from the PR with macOS m2, and it says "OS not supported" but it works! Well, after a few seconds the ball stops going for the goal and moves back and forth repeatedly but I guess that's my problem. Thanks a lot for the help, I really appreciate it!

Ivan-267 commented 1 year ago

Hello,

I've just made another commit to the repo: https://github.com/edbeeching/godot_rl_agents_examples/pull/6/commits/c25275ca38bf2e30498d588cdeb7d7b65dd6aa91 where I changed the "OSX" part to also check for the new enum instead of the integer value.

Now in case of the system being detected as "OSX" it will try to use "CoreML". The code mentions that this needs testing, so it may or may not work now. If possible please re-test to check if the newest commit still works. If it doesn't work yet, perhaps it can be changed to use the CPU.

Edit: If the message was "OS not supported", it's probably not detected as "OSX" so my changes will likely not affect the message. By detected I mean the name that Godot returns if you print the value of OS.GetName() is probably not "OSX" in this case.

hvven commented 1 year ago

Sorry, my bad, I didn't provide any extra information of the message. Here's the video testing BallChase with macOS.

https://github.com/edbeeching/godot_rl_agents/assets/132185397/57e71d34-3bcf-43c9-9848-bc36b478cc65

Also somehow testing the same thing in Windows (RTX 3060) doesn't work at all, though it's probably just my computer being weird.

edbeeching commented 1 year ago

I am glad you got it running.

As for the agent's behavior, I have seen this before. Where it gets stuck behind a wall and bobs back and forth, essentially a local minima. Perhaps more training would resolve this, or a memory-based agent.

I will close the issue for now, but let me know if you resolve the problem with running the onnx model on your Windows machine, as I am sure others will face the same problem in the future.