Course: Learning Agents (5.5)

As far as I remember, the struct observation simply concatenates the child elements, so the neural network should end up the same or very similar in your example.

Hi,
I think the course leaves out an important detail in the IL part: the trainer file needs to be set to ā€œtrain_behavior_cloningā€ in the trainer process settings.

Otherwise, the python prcoess will try to run the default PPO trainer, and the ULearningAgentsImitationTrainer will not have sent the correct JSON config.

For Google, and for the next person trying to fix this, the subprocess will throw this error.

LogLearning: Display: Sending config signal…
LogLearning: Display: ImitationTrainer_8: Imitation Training Started
LogLearning: Display: ImitationTrainer_8: Sending / Receiving initial policy…
LogLearning: Display: Subprocess: Traceback (most recent call last):
LogLearning: Display: Subprocess: File ā€œC:\Epic Games\UE_5.5\Engine\Plugins\Experimental\LearningAgents\Content\Python\train.pyā€, line 53, in
LogLearning: Display: Subprocess: train(communicator.config, communicator)
LogLearning: Display: Subprocess: File ā€œC:\Epic Games\UE_5.5\Engine\Plugins\Experimental\LearningAgents\Content\Python\train_ppo.pyā€, line 30, in train
LogLearning: Display: Subprocess: ppo_config = config[ā€˜PPOSettings’]
LogLearning: Display: Subprocess: ~~~~~~^^^^^^^^^^^^^^^
LogLearning: Display: Subprocess: KeyError: ā€˜PPOSettings’

2 Likes

Just went through the course and everything was working until I got to the imitation training. For some reason, it can’t find the python executable:

LogLearning: Error: ImitationTrainer_0: Can’t find Python executable ā€œ../../../../../../Unreal/LearningToDrive/LearningToDrive/Intermediate/PipInstall/Scripts/python.exeā€.

BP_SportsCarManager is working fine, and able to spawn the python process. Both of them have the same settings in ā€œTrainer Process Settingsā€ and the trainer file name has been changed to: ā€œtrain_behavior_cloningā€ for imitation trainer.

What could be causing this error message? And why would it happen for imitation training only?

This is using 5.5.4.

Could somebody describe the available model/s?

Thank you so much! I got an inexplicable error here. It makes me unable to proceed. :heart_eyes:

@Deathcalibur Any notable updates to Learning Agents we should be aware of in 5.6?

The big news is we updated the python so that it’s possible to scale out training to ~100s of game processes in parallel.

Here’s the list:

  • Multi-Processed Training:
    We are able to easily spawn X number of Unreal processes and have them all communicating with a single python process to be able to improve training throughput.

  • Easy Tensorboard Installation
    Simply use the new ā€œTensorboardā€ plugin - no longer need to find the python env and manually install it via pip

  • MLflow
    Supports MLflow as an alternative to Tensorboard

  • Shared Memory on Mac

  • Action Modifiers
    Ability to modify the actions based on context. For example, mask invalid actions.

I don’t believe there are major breaking change with this tutorial and 5.6. I’ve been pretty busy working on a project so I haven’t taken the time to post 5.6 tutorial, which I’m sure is unfortunately confusing for some.

Thanks! Let me know if there are questions.

1 Like

@Deathcalibur

I’m not sure if this is helpful or not, I follow Joseph Suarez on X. He seems to be doing a lot of research into RL and how to make it faster from the ground up. I’m curious if any of that research could be of use to the Epic team or if you are already aware of the work. Anyhow, here is a recent article of his :slight_smile: Hopefully it’s of some use.

X RL Article

Joseph’s X Account

1 Like

Thanks for the update @Deathcalibur !

Could you provide some pointers on how to get Multi-Processed Training up and running?

1 Like

Hi, I followed the tutorial, and it worked well. Then I extended it by adding custom logic for rotating at the start and stopping at the end of a spline. However, before reaching the maximum reward, the agents seem to ā€œforgetā€ how to rotate. I’ve tried many adjustments (reward tuning, observations, parameters), but nothing has helped so far.

Any help would be appreciated!

Is there a 5.6 version of the tutorial ?
I can’t compile the GatherAgentObservation function in 5.6.
The ObsActor seems to be the problem for me. I tried to create it from the BP nodes (ā€œcreate variableā€, ā€œpromote to variableā€, then manually.
Anyone had it working in 5.6 ?
Thanks

1 Like

I haven’t updated the tutorial because I believe it should just work (could be wrong though). It’s a lot of effort to update the tutorial unfortunately and I’m rather busy. If there is more confirmed problems, then I might try to squeeze it in.

If you post a screenshot or something I might be able to help you figure out what’s wrong.

@FlameTheory
Take a look at this. It’s not really a turn crank solution. Mainly giving you the command line args needed to get setup with Docker.
Scaling Out with Learning Agents Tutorial.pdf (81.8 KB)

@tomhalpin8 I follow Joseph on X. His stuff is cool but I think most of it is not super applicable to UE games.

2 Likes

That was very helpful thank you!

I now have this working on macOS without the need for Docker. Here are the steps I took:

  1. Make a new project folder
  2. Copy over all the files from /Users/Shared/Epic Games/UE_5.6/Engine/Plugins/Experimental/LearningAgents/Content/Python and /Users/Shared/Epic Games/UE_5.6/Engine/Plugins/Experimental/NNERuntimeBasicCpu/Content/Python
  3. Create a new virtual environment: python3 -m venv venv
  4. Activate the venv: source venv/bin/activate
  5. Install numpy, tensorboard, torch, torchvision, torchaudio: pip install torch etc
  6. Start the server with: python3 train.py Training -l --nne-cpu-path nne_runtime_basic_cpu.py Socket 127.0.0.1:48491 output
  7. Make sure your UE project is setup to use sockets and external training
  8. Spawn as many instances as you like in new terminal windows with: /Users/Shared/Epic\ Games/UE_5.6/Engine/Binaries/Mac/UnrealEditor -Project=/Path/To/Your/Game.uproject MapName -game -nullrhi -nosound
1 Like

Yes perfect! Glad to hear it works on Mac. I do something similar on my Windows PC. I wrote a script to spawn X UE processes.

1 Like

Thanks a lot for your answer and my apologies for the very late reply (couldn’t find the time to open UE5 during the week).
I finally found what didn’t work for me when copy pasting the Gather Agent Observation function.
When you automatically create the ObsActor variable (right click on ā€œsetā€ node, or promote to variables in ā€œgetā€ nodes), it’s created with the type ā€œobject referenceā€, which is not compatible with all the nodes needing it.
So i had to manually change its type to ā€œactor object referenceā€, then it compiled.

1 Like