Search Unity

Question Prevent trying to connect to trainer

Discussion in 'ML-Agents' started by nraw, Jan 8, 2023.

  1. nraw

    nraw

    Joined:
    Feb 6, 2015
    Posts:
    3
    Hi there!

    I've trained my model and everything works beautifully, but when the first player joins the game, the Academy.cs tries to connect to the trainer environment. As I only want to use it for inference, can I skip this step somehow?

    The game gets frozen until the script releases it.
     
  2. hughperkins

    hughperkins

    Joined:
    Dec 3, 2022
    Posts:
    191
    I think the trainer is literally only used for training, not for inference? For inference, you take the .onnx file, that is the result of training, and drop it into your agent, as the 'brain' I think?
     
  3. nraw

    nraw

    Joined:
    Feb 6, 2015
    Posts:
    3
    Indeed, that is the case.

    Like I said, it all works completely fine and the inference is done through the .onnx network file.

    It's just that when the first player spawns, the code checks whether the trainer is available and when it times out there's a log that says "Trainer not available on port whatever, will only perform inference" which is what I want anyway, but I'd like to stop the check as well.
     
  4. hughperkins

    hughperkins

    Joined:
    Dec 3, 2022
    Posts:
    191
    Oh, I see. Did you try? :

    Code (csharp):
    1.  
    2. CommunicatorFactory.Enabled = false;
    3.