Search Unity

Question IP and Port

Discussion in 'ML-Agents' started by InitusInteractive, Dec 7, 2022.

  1. InitusInteractive

    InitusInteractive

    Joined:
    Aug 16, 2018
    Posts:
    128
    Is there a way to target an endpoint that has the python and GPUs installed?

    I would rather dedicate a machine for the learning (python installed) and have a few machines free for modifications and testing the NN..

    I can connect to the ip and port on the learning server but how do I point the Unity agent to this server, there is obviously a default 127.0.0.0 or similar connection.. any ideas?
     
  2. GamerLordMat

    GamerLordMat

    Joined:
    Oct 10, 2019
    Posts:
    185
    IDK, but maybe just compile it and upload it to the server. Than you can execute it again locally
     
    InitusInteractive likes this.
  3. InitusInteractive

    InitusInteractive

    Joined:
    Aug 16, 2018
    Posts:
    128
    thanks but that's what I want to avoid.

    I have a few servers here I'd prefer to use as the python/MLagents syste, and a few machines I use for game dev.

    happy new year
     
    GamerLordMat likes this.
  4. hughperkins

    hughperkins

    Joined:
    Dec 3, 2022
    Posts:
    191
    If you can connect to your servers using ssh, you can use ssh tunnels. You can create tunnels in either direction (using `-L` or `-R`). The tunnel basically opens up a port on one end of the connection, which outputs stuff into the other machine. So you can create ports on your remote server that connect to mlagents-learn on your local machine.
     
    johntk003 likes this.
  5. GamerLordMat

    GamerLordMat

    Joined:
    Oct 10, 2019
    Posts:
    185
    Wish you a happy new year too!
    I have asked ChatGPT, it answered:

    To point the ML-Agents Unity Editor to an external server where mlagents-learn is installed, follow these steps:

    1. In the Unity Editor, go to "Edit > Project Settings > ML-Agents" to open the ML-Agents settings window.

    2. In the "Communication" section, select "External" as the communication mode.

    3. In the "Server Address" field, enter the address of the external server where mlagents-learn is installed. The address should be in the format <server_ip>:<port>, where server_ip is the IP address of the server and port is the port number that mlagents-learn is listening on.

    4. In the "Server Unity Version" field, enter the version of Unity that is installed on the external server.

    5. Click "Apply" to save the changes.

    6. In the Unity Editor, you can now use the ML-Agents menu to send and receive data from the external mlagents-learn server.
    otherwise:
    "I can connect to the ip and port on the learning server but how do I point the Unity agent to this server, there is obviously a default 127.0.0.0 or similar connection."
    You mean when training you used:
    --base-port BASE_PORT
    The starting port for environment communication. Each
    concurrent Unity environment instance will get
    assigned a port sequentially, starting from the base-
    port. Each instance will use the port (base_port +
    worker_id), where the worker_id is sequential IDs
    given to each instance from 0 to (num_envs - 1). Note
    that when training using the Editor rather than an
    executable, the base port will be ignored. (default:
    5005)
    I get what you want but I have no idea how to do it.
    The only idea I have is to mount a file from your computer (where you have it compiled) on to the server and then use on the server mlagents-learn. And then somehow get the the NNmodel back.

    Otherwise I let it train on my local machine with 6 instances and try the save checkpoint results out.