Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Academy.Instance.MaxStepCount != Python console output

Discussion in 'ML-Agents' started by BotAcademy, Jun 11, 2020.

  1. BotAcademy

    BotAcademy

    Joined:
    May 15, 2020
    Posts:
    32
    Hey guys,

    one of my subscribers just asked me the following question:

    "
    I want to display the Step count (which is outputted in the command line) to the game screen. So for this, I did use the value given by the academy code as [Academy.Instance.TotalStepCount] but while training this value doesn't match with the value which is outputted in cmd. Do you have any idea why is this happening or am I accessing the wrong value?
    "

    I tried it myself with MLAgents Release 1 and 3 by:
    1. loading the 3DBall example environment
    2. creating an empty game object
    3. Adding a script to the game object
    4. Adding two lines to the script
    4.1 using Unity.MLAgents;
    4.2 print(Academy.Instance.TotalStepCount); // in the update loop

    And indeed, the values differ. When the MaxStepCount is at around 5-6k in Unity, it prints the 12k step message on the console.
    Interestingly, changing the decision period affects the difference too. If I change the decision period from 5 to 1 the MaxStepCount is at around 1k in Unity when it prints the 12k step message on the console. My understanding is that the MaxStepCount is not related to the decision period if "Take actions between decisions" is ticked and that the python connector uses the TotalStepCount value.

    Could someone please clarify this?
     
    dhyeythumar likes this.
  2. dhyeythumar

    dhyeythumar

    Joined:
    Mar 15, 2020
    Posts:
    7
    Yes, can someone please give the information on this?
     
  3. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,796
    I'll flag this for the team, and pass along any guidance they have!
     
  4. BotAcademy

    BotAcademy

    Joined:
    May 15, 2020
    Posts:
    32