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

Cant create new brain model

Discussion in 'ML-Agents' started by attamanbaranovsky, Mar 10, 2020.

  1. attamanbaranovsky

    attamanbaranovsky

    Joined:
    Feb 11, 2020
    Posts:
    23
    Hello,
    Help me pls. I try to figure out how to use mlagents but i have issue while train the new agent.
    Everything runs good till i start play mode. its spamed a lot of errors

    NullReferenceException: Object reference not set to an instance of an object
    MLAgents.InferenceBrain.ModelRunner.DecideBatch () (at C:/MLProject/com.unity.ml-agents/Runtime/InferenceBrain/ModelRunner.cs:163)
    MLAgents.BarracudaPolicy.DecideAction () (at C:/MLProject/com.unity.ml-agents/Runtime/Policy/BarracudaPolicy.cs:52)
    MLAgents.Agent.DecideAction () (at C:/MLProject/com.unity.ml-agents/Runtime/Agent.cs:813)
    MLAgents.Academy.EnvironmentStep () (at C:/MLProject/com.unity.ml-agents/Runtime/Academy.cs:397)
    MLAgents.AcademyFixedUpdateStepper.FixedUpdate () (at C:/MLProject/com.unity.ml-agents/Runtime/Academy.cs:32)


    I gues it is cause i dont have the model setted to behaviour parameters, couse i dont have it, and if i understand correctly unity says that i still can train it.
    upload_2020-3-10_22-38-43.png

    I havent found ways to create the model. And in training mode it dont want to be created.
    it is what the anaconda promt displays
    upload_2020-3-10_22-40-46.png

    I am using Unity 2018.4.8
     
  2. simonini_thomas

    simonini_thomas

    Joined:
    Apr 30, 2015
    Posts:
    33
    Hi,
    It's not very clear if you want to train the agent?
    You said "And in training mode it dont want to be created."

    "I havent found ways to create the model." In fact to create a model you need to train your agent.
     
  3. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
    Hi,
    You need to set the Behavior Type to "Default" in order to get it to train. You currently have it set to "Inference Only" which means it will try to use the model, but there's no model to use.

    This is something we need to handle better though.
     
  4. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
    The internal tracking number for this is MLA-762
     
  5. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
    There's no "fix" for this (since you're trying to do two mutually exclusive things), but I improved the warning message in the Inspector, and we now throw a custom exception if you try to do this (instead of hitting the NullReferenceException later). The changes will be in the next release; the pull request is here https://github.com/Unity-Technologies/ml-agents/pull/3617