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

[SOLVED] Anyone got 0.6 ML Agents examples to train?

Discussion in 'ML-Agents' started by rz_0lento, Dec 15, 2018.

  1. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I upgraded ML Agents to 0.6 (which just got released on github) but I'm having this really weird issue with it. Unity Editor does connect the 3DBall example to the training backend, it looks like it starts running and editor itself looks like it's training but training backend actually sits still there. It doesn't consume any CPU and it doesn't give any middle stats on current progress. I got same issue with all the other provided ML Agents examples I tried.

    Then... here comes the weirdest part:

    I manually upgraded Puppo from 0.5 to 0.6 and I actually can train and run it with trained brain just fine! (even on 2019.1 alpha) This baffles me, how come Puppo works but no actual ML agent example shipped with 0.6 ML Agents?

    Edit: figured it out - it was a silly mistake. Examples had actual platforms setup for player and not for the learning brain :D. It started working after manually swapping them.
     
    Last edited: Dec 15, 2018
  2. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    I'm having the same problem
    How to run and train 3DBall?
    mlagents-learn config/trainer_config.yaml --run-id=unity-volume/3DBall/3DBall --train

    The manual is not clear. I make a post asking for fixing.

    I'm a Windows user
    I do not know where to make the .exe build in first place.
    The correct build path must be ?
    ml-agents-master\unity-volume\3DBall\3DBall.exe ?

    Also now in Unity 2018.3 the build name is the project of the name.
    And the UnitySDK has a project name that can be different from Scene examples.
    Making a build in 2018.3 the build name will be the name of the Project.
    So can just rename the build .exe and _Data folder to 3DBall.exe and 3DBall_Data as a workaround?
     
    Last edited: Jan 15, 2019
  3. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    @AlanMattano, the main issue for me was that each platform was preset to be player controlled, there wasn't single learning brain on the sample scene (same issue on every other sample scene I tried). I dunno if this is an oversight or on purpose but it's confusing when you don't quite understand at first why training starts but doesn't progress :)
     
  4. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Since is a Prefab, probably are expecting that you modify that instead of the game object. But probably this issue is now more clear for Ai beginners since Unity 2018.3 has this new prefab system. Looking the documentation:

    The section:

    probably must be: "you must update the Platform prefab "

    Actually I'm trying

    mlagents-learn config/trainer_config.yaml --train


    And then I hit [>] play button in the editor. Is starting but I get an editor console message


    UnityAgentsException: Vector Observation size mismatch between continuous agent Agent Brain and brain AiBrain. Was Expecting 1 but received 0.
    MLAgents.Agent.SendInfoToBrain () (at Assets/ML-Agents/Scripts/Agent.cs:580)
    MLAgents.Agent.SendInfo () (at Assets/ML-Agents/Scripts/Agent.cs:984)
    MLAgents.Academy.EnvironmentStep () (at Assets/ML-Agents/Scripts/Academy.cs:583)
    MLAgents.Academy.FixedUpdate () (at Assets/ML-Agents/Scripts/Academy.cs:611)
     
  5. sadowlight123

    sadowlight123

    Joined:
    Jun 24, 2016
    Posts:
    5
    managed to solve it? I am having the same issue :
    mlagents-learn config\trainer_config.yaml --env=envs\Unity Environment.exe --run-id=models --train
    does not even start.
     
  6. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    In my case, there wasn't learning brain running in the Unity scene which made this happen. Of course you could have different reasons for it to fail.

    Btw, we have #machine-learning channel on the Official Unity Discord with ML-Agents users if you need more help on getting it running :)
     
  7. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501