Search Unity

KeyError when training with Curriculum

Discussion in 'ML-Agents' started by Twyth, Feb 4, 2020.

  1. Twyth

    Twyth

    Joined:
    Apr 27, 2017
    Posts:
    7
    Hey guys,
    I'm just trying to get my agent with curriculum training up and running. I am using ML-Agents 0.12.1
    In my scene I have an agent and a NavMeshAgent.

    To start the training, I use the command line from the docs:
    mlagents-learn config/trainer_config.yaml --curriculum=config/curricula/chaser/ --run-id=chaser-curriculum_test --train

    In the trainer_config.yaml I have defined the following parameters:

    ChaserLearning:
    use_curiosity: true
    summary_freq: 1000
    time_horizon: 128
    batch_size: 128
    buffer_size: 2048
    hidden_unity: 256
    beta: 1.0e-2
    max_steps: 1.0e6



    and I have created a folder in \ml-agents\config\curricula\ named chaser. In it is the file ChaserLearning.json.
    The file has the following values:


    {
    "measure" : "reward",
    "thresholds : [-0.1, 0.7, 1, 1.5, 1.7, 2],
    "min_lesson_length" : 80,
    "signal_smoothing" : true,
    "parameters" :
    {
    "speedMultiplicator" : [0.5, 0.75, 0.9, 1.0, 1.25, 1.5, 1.75]
    }
    }



    The BehaviourParameter Script in the Unity Editor is named chaser-Curriculum_test01
    When I start the training, I get the following error in the shell:

    KeyError: 'chaser-Curriculum_test01'
    I have attached a screenshot of the shell below.

    Inkedshell_LI.jpg

    Did I make a mistake somewhere, or is it because of the ML-Agents version?

    thanks in advance
     
    Last edited: Feb 4, 2020
  2. Twyth

    Twyth

    Joined:
    Apr 27, 2017
    Posts:
    7
    Nvm,

    I found my mistake. The Behaviour Name has to match the curriculum.json and the trainer_config.yaml Code Block.

    So, in this case instead of chaser-Curriculum_test01 it has to be ChaserLearning.
     
  3. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
    Glad you got it figured out. For what it's worth, the error handling and messaging around this got better in 0.13.0.
     
    Twyth likes this.
  4. Twyth

    Twyth

    Joined:
    Apr 27, 2017
    Posts:
    7
    I am currently writing my bachelor thesis on machine learning using the toolkit, so i wanted to stick with one version. This makes writing a bit easier and continuous.

    The documentation is also a bit unclear about the point that the behavior name also has an influence and is not only meant to find the .nn model.
    maybe the parameter behavior name could be added and clarified here.
    https://github.com/Unity-Technologi...Environment-Design-Agents.md#agent-properties
     
  5. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
    Sure, I can clarify that in the docs (and also the section on curriculum learning)
     
  6. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
  7. Twyth

    Twyth

    Joined:
    Apr 27, 2017
    Posts:
    7
    Thank you, appreciate it.