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

Question Train 2 or more Unity projects simultaneously

Discussion in 'ML-Agents' started by TulioMMo, Feb 21, 2022.

  1. TulioMMo

    TulioMMo

    Joined:
    Dec 30, 2020
    Posts:
    29
    Hi everyone,

    I am trying to train 2 (or more) projects simultaneously in Unity ML-Agents, but have received the warning: "Couldn't start socket communication because worker number 0 is still in use". I read that by using the command "--worker-id=" and setting that to some value other than "0", it would work out just fine. However I get another warning: "unrecognized arguments: --worker-id=1".

    This bug has been found before (https://github.com/Unity-Technologies/ml-agents/issues/5653), but so far I haven't found a way to go around it.. Can someone please help?

    I am using ml-agents version: 0.26.0

    Many thanks!
     
    Last edited: Feb 21, 2022
  2. TulioMMo

    TulioMMo

    Joined:
    Dec 30, 2020
    Posts:
    29
  3. TulioMMo

    TulioMMo

    Joined:
    Dec 30, 2020
    Posts:
    29
    Sorry, problem was not solved. I managed to train two projects by running one training session in Unity Editor and another with a built environment executable.

    Trying a third simultaneous training session gives the error message:

    "mlagents_envs.exception.UnityWorkerInUseException: Couldn't start socket communication because worker number Couldn't start socket communication because worker number 0 is still in use. You may need to manually close a previously opened environment or use a different worker number. is still in use. You may need to manually close a previously opened environment or use a different worker number."

    Is there some way to change the work number?

    Many thanks..
     
    Haneferd likes this.
  4. WaxyMcRivers

    WaxyMcRivers

    Joined:
    May 9, 2016
    Posts:
    59
    You can change the base port number in the command line. The base port is set to 5004 by default.

    type mlagents-learn --h to get a list of all the CLI Args

    PS: you can do something similar with tensorboard - change the port number so you can see multiple projects results
     
    Haneferd and TulioMMo like this.
  5. TulioMMo

    TulioMMo

    Joined:
    Dec 30, 2020
    Posts:
    29
    Many thanks! changing the base port number did the trick. :)
     
    Haneferd and WaxyMcRivers like this.