Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question I Can't MLLearn with Standalone build (mlagents-learn with --env with --num-envs={n} )

Discussion in 'ML-Agents' started by changdoc, Jun 24, 2024.

  1. changdoc

    changdoc

    Joined:
    Sep 20, 2017
    Posts:
    2
    Editor communicate with mlagents-learn doing well.
    But standalone build cannot communite with mlagents-learn.
    I Using ml-agent version. Release 21 (most recent version)

    I try to run mlagents-learn like this
    'mlagents-learn ./config/ppo/config.yaml --env=D:\workspace\nemosemo-client\Build\windows\Build --num-envs=2 --run-id=run_1'

    I can see the Player log got a error with grpc.
    This below log is that.

    Unexpected exception when trying to initialize communication: System.NotSupportedException: To marshal a managed method, please add an attribute named 'MonoPInvokeCallback' to the method definition. The method we're attempting to marshal is: Grpc.Core.Internal.NativeLogRedirector::HandleWrite
    at Grpc.Core.Internal.NativeLogRedirector.Redirect (Grpc.Core.Internal.NativeMethods native) [0x00000] in <00000000000000000000000000000000>:0
    at Grpc.Core.Internal.NativeExtension.Get () [0x00000] in <00000000000000000000000000000000>:0
    at Grpc.Core.GrpcEnvironment.GrpcNativeInit () [0x00000] in <00000000000000000000000000000000>:0
    at Grpc.Core.GrpcEnvironment..ctor () [0x00000] in <00000000000000000000000000000000>:0
    at Grpc.Core.GrpcEnvironment.AddRef () [0x00000] in <00000000000000000000000000000000>:0
    at Grpc.Core.Channel..ctor (System.String target, Grpc.Core.ChannelCredentials credentials, System.Collections.Generic.IEnumerable`1[T] options) [0x00000] in <00000000000000000000000000000000>:0
    at Grpc.Core.Channel..ctor (System.String target, Grpc.Core.ChannelCredentials credentials) [0x00000] in <00000000000000000000000000000000>:0
    at Unity.MLAgents.RpcCommunicator.Initialize (System.Int32 port, Unity.MLAgents.CommunicatorObjects.UnityOutputProto unityOutput, Unity.MLAgents.CommunicatorObjects.UnityInputProto& unityInput) [0x00000] in <00000000000000000000000000000000>:0
    at Unity.MLAgents.RpcCommunicator.Initialize (Unity.MLAgents.CommunicatorInitParameters initParameters, Unity.MLAgents.UnityRLInitParameters& initParametersOut) [0x00000] in <00000000000000000000000000000000>:0
    at Unity.MLAgents.Academy.InitializeEnvironment () [0x00000] in <00000000000000000000000000000000>:0
    at Unity.MLAgents.Academy..ctor () [0x00000] in <00000000000000000000000000000000>:0
    at Unity.MLAgents.Academy+<>c.<.cctor>b__85_0 () [0x00000] in <00000000000000000000000000000000>:0
    at System.Lazy`1[T].ViaFactory (System.Threading.LazyThreadSafetyMode mode) [0x00000] in <00000000000000000000000000000000>:0
    at System.Lazy`1[T].ExecutionAndPublication (System.LazyHelper executionAndPublication, System.Boolean useDefaultConstructor) [0x00000] in <00000000000000000000000000000000>:0
    at System.Lazy`1[T].get_Value () [0x00000] in <00000000000000000000000000000000>:0
    at Unity.MLAgents.Agent.LazyInitialize () [0x00000] in <00000000000000000000000000000000>:0


    I want to multiple agent mlagent-learn concurrent.
    but this error log stuck my learning. Can't found solution for this problem in google search or chatgpt.

    Help me please.
     
  2. changdoc

    changdoc

    Joined:
    Sep 20, 2017
    Posts:
    2