Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    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 Cannot use a folder of demonstrations for Imitation Learning

Discussion in 'ML-Agents' started by Ruddism, Jun 15, 2024.

  1. Ruddism

    Ruddism

    Joined:
    Feb 1, 2022
    Posts:
    2
    I am trying to create an agent to navigate a randomly generated maze and have been trying to record multiple demonstrations for my agent (as the maze is rarely ever the same) but when I enter the folder name into the .yml file, it only accepts one demonstration and gives me this error in the cmd prompt when I try enter the name of the folder, which is "Demos". It does not work when I enter the full path either or any other way I have tried. Please help me :(

    This is what I am typing into the command line.
    mlagents-learn config/NavigateMaze.yml --run-id=ImitationNavigation --force


    And this is the error message I am receiving whenever I try entering the folder path.


    File "X:\Unity\Projects\Production Project\venv\lib\site-packages\mlagents\trainers\demo_loader.py", line 214, in load_demonstration
    agent_info_action.ParseFromString(data[pos : pos + next_pos])
    google.protobuf.message.DecodeError: Error parsing message with type 'communicator_objects.AgentInfoActionPairProto'
     
  2. Ruddism

    Ruddism

    Joined:
    Feb 1, 2022
    Posts:
    2
    Apologies, here is the .yml file.


    Code (CSharp):
    1. default_settings: null
    2. behaviors:
    3.   Navigate Maze:
    4.     trainer_type: ppo
    5.     hyperparameters:
    6.       batch_size: 1024
    7.       buffer_size: 10240
    8.       learning_rate: 0.0003
    9.       beta: 0.005
    10.       epsilon: 0.2
    11.       lambd: 0.95
    12.       num_epoch: 3
    13.       shared_critic: false
    14.       learning_rate_schedule: linear
    15.       beta_schedule: linear
    16.       epsilon_schedule: linear
    17.     checkpoint_interval: 500000
    18.     network_settings:
    19.       normalize: false
    20.       hidden_units: 128
    21.       num_layers: 2
    22.       vis_encode_type: simple
    23.       memory: null
    24.       goal_conditioning_type: hyper
    25.       deterministic: false
    26.     reward_signals:
    27.       extrinsic:
    28.         gamma: 0.99
    29.         strength: 1.0
    30.       gail:
    31.         strength: 0.5
    32.        demo_path: Demos // I have also tried the full path from the file explorer, put \Demos, /Demos, Demos\*.demo but nothing works
    33.         network_settings:
    34.           normalize: false
    35.           hidden_units: 128
    36.           num_layers: 2
    37.           vis_encode_type: simple
    38.           memory: null
    39.           goal_conditioning_type: hyper
    40.           deterministic: false
    41.     init_path: null
    42.     keep_checkpoints: 5
    43.     even_checkpoints: false
    44.     max_steps: 1000000
    45.     time_horizon: 64
    46.     summary_freq: 50000
    47.     threaded: false
    48.     self_play: null
    49.     behavioral_cloning:
    50.         strength: 0.5
    51.         demo_path: Demos // The same with this too
    52. env_settings:
    53.   env_path: null
    54.   env_args: null
    55.   base_port: 5005
    56.   num_envs: 1
    57.   num_areas: 1
    58.   timeout_wait: 60
    59.   seed: -1
    60.   max_lifetime_restarts: 10
    61.   restarts_rate_limit_n: 1
    62.   restarts_rate_limit_period_s: 60
    63. engine_settings:
    64.   width: 84
    65.   height: 84
    66.   quality_level: 5
    67.   time_scale: 25
    68.   target_frame_rate: -1
    69.   capture_frame_rate: 60
    70.   no_graphics: false
    71. environment_parameters: null
    72. checkpoint_settings:
    73.   run_id: ppo
    74.   initialize_from: null
    75.   load_model: false
    76.   resume: false
    77.   force: false
    78.   train_model: false
    79.   inference: false
    80.   results_dir: results
    81. torch_settings:
    82.   device: null
    83. debug: false
    84.  
     
    Last edited: Jun 15, 2024