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

Train ML-Agents on built binary without using --env

Discussion in 'ML-Agents' started by frieldhelm446, Apr 24, 2021.

  1. frieldhelm446

    frieldhelm446

    Joined:
    Sep 27, 2020
    Posts:
    28
    Is it possible to train ml-agents on the built game (so outside the editor) without having the game binary being launched by ml-agents by specifying the --env variable. For example, the game gets to a particular scene in the game where the agents are trained.
     
  2. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
    This isn't something we support right now - if you don't specify --env, mlagents-learn will assume that you're trying to connect to the editor, and only launch one environment that tries to connect on port 5004 by default.

    I'm not sure how this would work in practice - currently the Unity plugin tries to connect to the trainer on a port when it starts up, but if that's no available, it uses inference. You could potentially destroy and recreate the Academy instance whenever you wanted to try reconnecting, but that assumes you have a trainer running and listening on the right port too. You'd also probably need to use a very long timeout on the trainer side, since it will likely be waiting for a long time for something to connect to it.
     
    frieldhelm446 likes this.