Sohojoe/MarathonEnvsBaselines

Cannot 'play' trained model or use model in Unity 2.0.3, ml-agents v0.8

eandrews-dstl opened this issue · 1 comments

I am trying to train agents using different openAI baselines, for use in Unity. I got your original environments working, but I wanted to use the most up to date open AI baselines and ml-agents v0.8, so I have updated both of them and incorporated your code.

I successfully trained the Unity 3D ball example environment using:
python -m baselines.run_multiagent_unity --alg=ppo2 --env="\Lib\site-packages\mlagents\envs\envs\3dball\Unity Environment.exe" --num_timesteps=1e6 --save_path=\models\3dball_ppo2_1

However the file 3dball_ppo2_1 is not accepted by Unity's '3DBallLearningBrain' in the 'model' option.

When trying to play it using this command:
python -m baselines.run_unity --alg=ppo2 --env="\Lib\site-packages\mlagents\envs\envs\3dball\Unity Environment.exe" --num_timesteps=0 --load_path=\models\3dball_ppo2_1 --play

I get the error:
gym_unity.envs.unity_env.UnityGymException: The environment was launched as a single-agent environment, however there is more than one agent in the scene.

My aim is to get the model working with the most recent Unity and ml-agents, any help would be appreciated!

The error sounds like your environment has multiple instances of the brain. I was creating special run versions of the environment, 'hopper-run' etc, which only have 1 instance of the agent and are also set to frame sync

I don't think I ever got inference working from within Unity (i.e. using their brains) - This may be easier now that Unity switched to their new inference engine, however, we would need to figure out the conversion.