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

stable_baselines3_example script: import error #203

Closed ra9hur closed 1 month ago

ra9hur commented 1 month ago

Referring to the below script, https://github.com/edbeeching/godot_rl_agents/blob/main/examples/stable_baselines3_example.py

Raises an ImportError:

ImportError: cannot import name 'export_model_as_onnx' from 'godot_rl.wrappers.onnx.stable_baselines_export'

Executing the script after commenting the line works. Assume, this issue is related to,

84

105

This script is referred in Train AI in Godot (Tutorial).

While onnx_export gets supported, the line should be ignored. This is a very small change and I can create a pull request. Please let me know.

ra9hur commented 1 month ago

OK. Found a related response from @Ivan-267 on discord.


The name of the method changed in a GDRL update, you could try installing the latest version of GDRL using: pip install https://github.com/edbeeching/godot_rl_agents/archive/refs/heads/main.zip

If it doesn't work, you may need to uninstall first using: pip uninstall godot-rl

As an alternative to this, you could try using an older version of the sb3 example script without updating GDRL: https://github.com/edbeeching/godot_rl_agents/blob/ed8407f1323f9eabff7beef8a2ead5c923d1d6a3/examples/stable_baselines3_example.py


Uninstalling godot-rl and installing again works.