Search Unity

Question Potential Issue? [WARNING] Restarting worker[0] after 'Communicator has exited.'

Discussion in 'ML-Agents' started by Kiyodio, Feb 9, 2024.

  1. Kiyodio

    Kiyodio

    Joined:
    Sep 27, 2019
    Posts:
    4
    I've newly installed ML agents 3.0.0 or release 21, with python 3.10.3 as that is the only version that would install properly without numpy failing to install. Changing the numpy version to 1.23.0 to match some API shenanigans while doing "mlagents-learn --help"

    I've set up some behaviour parameters, as well as other related scripts as follows
    upload_2024-2-9_2-29-38.png

    I looked around a lot at other posts showing the same issue, none seem to have responded with a proper solution, so I hope I'll find one here.

    upload_2024-2-9_2-31-15.png

    I also really don't understand what this naming thing is with the behaviour name and some yaml name, if someone can explain that to me. Apparently that's supposed to fix the problem but I don't understand it, also this is just a test run so no brain is set up. What am I doing wrong?

    Even if this isn't fixable, please let me know if this could pose a serious threat to the general use of the project as I am using this for a university project.

    Edit: Yes, run in background is checked. This didn't solve anything.

    P.S. I think someone needs to seriously look into trying to install mlagents on Py 3.10.12 and doing exactly what the instructions say, because it always leads to error on a fresh install...
     
    Last edited: Feb 9, 2024
  2. Kiyodio

    Kiyodio

    Joined:
    Sep 27, 2019
    Posts:
    4
    Bump..
     
  3. smallg2023

    smallg2023

    Joined:
    Sep 2, 2018
    Posts:
    144
    restarting worker[0] usually happens if you press stop in unity while the command line is attempting to start the training (i.e. if you stop unity after submitting the command line)

    the yaml file needs to be in a specific folder so it's generally easier to just pass the path to it in the command line (you can do this in a normal string - mlagents-learn "folder/mybehaviour.yaml" --run-id=1)
    if you haven't created a yaml file then the message is normal and it will just use those default values as an attempt to still train
     
  4. Kiyodio

    Kiyodio

    Joined:
    Sep 27, 2019
    Posts:
    4
    Hi, thanks for you response, I have began running tests on my project using continuous actions but something seems strange. When I'm passing vector observations to my agent, all continuous actions stay at fixed values... This doesn't seem to be correct behaviour, and when there are no observations passed, the continuous actions change every so often.

    upload_2024-2-15_2-8-14.png

    Code (CSharp):
    1. public class DroneAgent : Agent
    2. {
    3.     public MonoBehaviour DroneController;
    4.  
    5.     private Vector3 radarAltitude;
    6.  
    7.     [SerializeField] private Transform seaLevelTransform;
    8.     //[SerializeField] private Transform radarAltitude;
    9.  
    10.     public delegate void ActionHandler(ActionBuffers actions);
    11.  
    12.     public event ActionHandler OnActionReceivedEvent;
    13.  
    14.     private void FixedUpdate(){
    15.         GetRadarAltitude();
    16.     }
    17.  
    18.     private void GetRadarAltitude(){
    19.         RaycastHit RAlt;
    20.         if(Physics.Raycast(transform.position,Vector3.down,out RAlt,2000)){
    21.             Debug.DrawRay(transform.position,Vector3.down * RAlt.distance,Color.magenta);
    22.             Debug.Log("Ground Contact, Height: " + RAlt.distance);
    23.  
    24.             radarAltitude = RAlt.point;
    25.         }
    26.         else{
    27.             Debug.DrawRay(transform.position,Vector3.down * RAlt.distance,Color.white);
    28.         }
    29.     }
    30.  
    31.     public override void CollectObservations(VectorSensor sensor)
    32.     {
    33.      
    34.      
    35.         sensor.AddObservation(transform.position);
    36.         sensor.AddObservation(radarAltitude);
    37.     }
    38.     public override void OnActionReceived(ActionBuffers actions)
    39.     {
    40.      
    41.         Debug.Log(actions.ContinuousActions[0]);
    42.         //Debug.Log(actions.ContinuousActions[1]);
    43.         //Debug.Log(actions.ContinuousActions[2]);
    44.         //base.OnActionReceived(actions);
    45.  
    46.         //OnActionReceivedEvent?.Invoke(actions);
    47.     }
    48. }
    Am I doing something wrong?

    Actions are passed to another controller which remaps continuous values to values used for control surfaces on the drone. I'm not sure if what i've done is right, so please correct me if ive done something stupid.

    Edit:
    Upon further investigation
    It appears the actions do occur and change within the first few seconds of running but then become constants...

    I dont get what Im doing wrong
     
    Last edited: Feb 15, 2024