Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved KeyError: '<Behaviour name>'

Discussion in 'ML-Agents' started by MrOCW, May 8, 2021.

  1. MrOCW

    MrOCW

    Joined:
    Feb 16, 2021
    Posts:
    51
    Hi all, trying curriculum learning with ML-Agents 0.9.1

    However, I've been getting this error after training for a while. Suspecting its during the curriculum change that this error occurs.

    Traceback (most recent call last):
    File "/home/student/anaconda3/envs/mlagents0.9.1/bin/mlagents-learn", line 8, in <module>
    sys.exit(main())
    File "/home/student/anaconda3/envs/mlagents0.9.1/lib/python3.6/site-packages/mlagents/trainers/learn.py", line 319, in main
    run_training(0, run_seed, options, Queue())
    File "/home/student/anaconda3/envs/mlagents0.9.1/lib/python3.6/site-packages/mlagents/trainers/learn.py", line 118, in run_training
    tc.start_learning(env, trainer_config)
    File "/home/student/anaconda3/envs/mlagents0.9.1/lib/python3.6/site-packages/mlagents/trainers/trainer_controller.py", line 300, in start_learning
    self.reset_env_if_ready(env_manager, global_step)
    File "/home/student/anaconda3/envs/mlagents0.9.1/lib/python3.6/site-packages/mlagents/trainers/trainer_controller.py", line 339, in reset_env_if_ready
    self._get_measure_vals(), reward_buff_sizes=reward_buff_sizes
    File "/home/student/anaconda3/envs/mlagents0.9.1/lib/python3.6/site-packages/mlagents/trainers/meta_curriculum.py", line 120, in increment_lessons
    measure_val = measure_vals[brain_name]
    KeyError: 'AgentBrain'

    My json file seems to be correct as well. I've also checked all the naming and it all matches up.
     
  2. andrewcoh_unity

    andrewcoh_unity

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    162
    Hi @MrOCW

    Can you share your yaml with the curriculum?
     
  3. MrOCW

    MrOCW

    Joined:
    Feb 16, 2021
    Posts:
    51
    Hi @andrewcoh_unity , it fixed itself after retyping everything. One suspicion i have is that using Ctrl+S to save after typing the parameter in Academy's Reset Parameters causes an issue where an invisible square matrix of
    1 0
    0 1
    to be appended to the back. I discovered this as I copy pasted the parameter name into the curriculum yaml file and it appeared in the text editor. I removed that strange matrix and the curriculum didnt work. I retyped the parameter name in the Academy without Ctrl+S at the end and it worked.
     
    andrewcoh_unity likes this.