I have ml-agents up and running. When I run mlagents-learn from the command line, and play the game from the Unity Editor - everything works fine (the agent trains). But when I build the game and try to run mlagents on the executable - no training is preformed.
In fact, I believe the python script is getting stuck - I think it runs the game, but never returns to continue executing the code. I have checked this by writing a simple python script to open the game and debug it:
from mlagents_envs.environment import UnityEnvironment
env = UnityEnvironment(file_name=path)
print("yay")
I ran this code on my executable, and the print command was never reached.
I know the problem isn’t with python, because I managed to get it to work with executables I found online:
- Basic: ttps://storage.googleapis.com/mlagents-test-environments/1.0.0/windows/Basic.zip
- Pyramids: ttps://drive.google.com/file/d/1mHt0ds1i1fn3N5mDvSjEms10iq5OR4Cm/view?usp=drive_link
In addition, I know the problem is not with the game, because I ran into these problems also with the 3DBall example, and the very simple ball and plane example (Making a New Learning Environment - Unity ML-Agents Toolkit). Same problem each time: Training works in the editor, but not with the executable.
I suspect something is wrong with the build process, but I don’t know what. I followed the instructions here: Using an Environment Executable - Unity ML-Agents Toolkit
I have selected “Run In Background” in the Player Settings, I have tried with and without “Development Build” - all without success.
After hours spent on this issue, I decided to try my luck with posting a bug…
Any help will be appriciated!
The training stuck:
Environment:
- Unity Version: I have tried with 2022.3.7f1, and with 6000.0.31f1
- OS + version: Windows 10.
- ML-Agents version: latest
develop
branch from source - branch 22, mlagents 1.1.0 - Enviroment: 3DBall and simple example