3DBall First Run training error

Hi all,

I’m testing out ml-agents for the first time. I seem to have the installed the system correctly from what I can tell. Running the 3DBall scene according to the Getting Started guide (ml-agents/docs/Getting-Started.md at main · Unity-Technologies/ml-agents · GitHub) works just fine. Then, running the first training command, as instructed, I get an error that I can’t figure out (pasted below). The error suggests that the 3DBall.yaml file needs to have a brain name specified. I haven’t touched the default 3DBall.yaml file. It also says, unhelpfully, to refer to the config/trainer_config.yaml file. But that file does not exist in the downloaded repository. Does anyone know how to resolve this, or why this would be happening? Thank you!

Here is the terminal error (Unity ASCII art removed):
zachDuerMacBook:ml-agents zach$ mlagents-learn config/ppo/3DBall.yaml --run-id=first3DBallRun --force

Version information:

ml-agents: 0.16.0,

ml-agents-envs: 0.16.0,

Communicator API: 1.0.0,

TensorFlow: 1.12.0

2020-05-03 19:31:39 INFO [environment.py:201] Listening on port 5004. Start training by pressing the Play button in the Unity Editor.

2020-05-03 19:31:44 INFO [environment.py:111] Connected to Unity environment with package version 1.0.0-preview and communication version 1.0.0

2020-05-03 19:31:44 INFO [environment.py:342] Connected new brain:

3DBall?team=0

Traceback (most recent call last):

File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mlagents/trainers/trainer_controller.py”, line 175, in _create_trainer_and_manager

trainer = self.trainers[brain_name]

KeyError: ‘3DBall’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “/Library/Frameworks/Python.framework/Versions/3.6/bin/mlagents-learn”, line 11, in

sys.exit(main())

File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mlagents/trainers/learn.py”, line 554, in main

run_cli(parse_command_line())

File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mlagents/trainers/learn.py”, line 550, in run_cli

run_training(run_seed, options)

File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mlagents/trainers/learn.py”, line 407, in run_training

tc.start_learning(env_manager)

File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mlagents_envs/timers.py”, line 305, in wrapped

return func(*args, **kwargs)

File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mlagents/trainers/trainer_controller.py”, line 227, in start_learning

self._create_trainers_and_managers(env_manager, new_behavior_ids)

File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mlagents/trainers/trainer_controller.py”, line 213, in _create_trainers_and_managers

self._create_trainer_and_manager(env_manager, behavior_id)

File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mlagents/trainers/trainer_controller.py”, line 177, in _create_trainer_and_manager

trainer = self.trainer_factory.generate(brain_name)

File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mlagents/trainers/trainer_util.py”, line 61, in generate

self.multi_gpu,

File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mlagents/trainers/trainer_util.py”, line 100, in initialize_trainer

f’Trainer config must have either a “default” section, or a section for the brain name ({brain_name}). ’

mlagents.trainers.exception.TrainerConfigError: Trainer config must have either a “default” section, or a section for the brain name (3DBall). See config/trainer_config.yaml for an example.

AND here is the 3DBall.yaml file contents:
behaviors:
3DBall:
trainer: ppo
batch_size: 64
beta: 0.001
buffer_size: 12000
epsilon: 0.2
hidden_units: 128
lambd: 0.99
learning_rate: 0.0003
learning_rate_schedule: linear
max_steps: 5.0e5
memory_size: 128
normalize: true
num_epoch: 3
num_layers: 2
time_horizon: 1000
sequence_length: 64
summary_freq: 12000
use_recurrent: false
vis_encode_type: simple
reward_signals:
extrinsic:
strength: 1.0
gamma: 0.99

I wonder if it’s because the python files that were installed with the command “pip3 install mlagents” are old? Those are the ones that are being run. They are slightly different than the ones from the cloned github repository. Could this be an issue?

I tried uninstalling mlagents 0.16.0 and installing 0.15.1 and the correlated branch of the unity project from Github. Since that tree doesn’t have the same structure in the config folder, i created a ppo folder inside the config folder and copied the 3DBall.yaml file from the 0.16.0 branch into that folder in the 0.15.1 download. I got the same exact error. I’m struggling to figure out why I would be unique in encountering this problem, as I seem to have followed the instructions so directly.

Oh! I see. The python code, both 0.16.0 (which was the automatic install when I followed the instructions) and 0.15.1 do not correctly parse the 3Dball.yaml file, because it leads with “behaviors” before “3DBall” or “Default”. This became apparent when comparing it to the trainer_config.yaml file. I was actually able to correctly run it with that file on 0.15.1. I was also able to run it with the 3DBalll.yaml file by deleting “behaviors”. I’ll go back and try later with 0.16.0, but I’m guessing it will work. We’ll see.

So, that was the issue. If I’m correct, that means anyone following the instructions right now, which direct the user to use the the 3DBall.yaml file, which only exists in the 0.16.0 Unity project, and uses the 0.16.0 python code which cannot parse that correctly, will get an error. Can anyone confirm that?

Anyone, at least I can keep working through the tutorials now.

Hi @zachduer ,
There are some incompatibilities between 0.15.1 and 0.16.0 on the python side. You should definitely always keep the python configurations of the same python version together in order to ensure everything works well together.

Makes sense! If I’m not mistaken, the things I originally downloaded were both just the most recently published versions, so I assumed they’d work together. That was not the case.