Course: Learning Agents (5.5)

That message means the python environment installed with Unreal is unable to find tensorboard, so no runs are being created. I would carefully walk through the tutorial again, it should still work.

Thanks for the path note: I will update that now.

BTW this whole process should be much easier with 5.6 as we added the ability to install tensorboard directly from the editor and not having to manually install it via pip.

1 Like

Hello I followed the tutorial completed every step but the editor freezes forever as soon as the node Run Training is executed


Once I click play or simulate unreal freezes and It doesn’t respond to mouse I can’t click stop play all I can do is kill the process from the task manager (I’m on windows 11) but the task manager doesn’t report the process as ā€œNot respondingā€.
I double checked everything and there is no error the inference mode works every pointer is valid and it happens regardless of how many agents I put.
It’s clearly something related to python please help

There should be a timeout if it is python related.

Have you waited ~30 seconds for the timeout to occur? Should give an error message if so.

1 Like

I tried to wait even for 10 min. I reduced to 1 agent and the iteration to 100. I even tried to run the training only once from begin play. Nothing as soon as the node is called no matter where everything freezes. The training is set by default on the GPU and I have a gaming laptop with I RTX 3060 so it can’t possibly a lack of requirement problem

Hi

I’m having an issue with getting the Learning to Drive (5.5) tutorial to work on my MacBook Pro (M1 Max, 32 GB, Sonoma 14.5) with the source build of UE5.5.3. Edits I’ve made to the source code include:

  1. Adding the following to train_ppo.py:60 (per @FlameTheory’s post)
elif torch.backends.mps.is_available():
           device = 'mps'
  1. Changing LearningExternalTrainer.cpp:720 to FPlatformProcess::Sleep(30.0f); and LearningSocketTraining.cpp:49 to if (Socket.Wait(ESocketWaitConditions::WaitForRead, FTimespan(30000))) // 1 millisecond(per @FlameTheory 's post)

Additionally, I have followed @p34c_'s post and set the Socket Settings Timeout to 30.0.

After doing these steps, I saw that the 32 vehicles started to move incrementally for around 30 seconds until all of the sudden they vehicles started moving much faster and started crashing into walls. This chaos started to happen when I received the following log messages:

LogLearning: Display: Subprocess: /Users/billymazotti/Documents/Unreal Projects/LearningToDrive/Intermediate/PipInstall/lib/python3.11/site-packages/torch/autograd/__init__.py:251: UserWarning: The operator 'aten::sgn.out' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/mps/MPSFallback.mm:13.)
LogLearning: Display: Subprocess:   Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
LogLearning: Display: Subprocess: validateComputeFunctionArguments:1077: failed assertion `Compute Function(gather_kernel_1): the offset into the buffer src_ that is bound at buffer index 0 must be a multiple of 4 but was set to 1.'
LogLearning: Error: PPOTrainer_0: Error waiting for policy from trainer: Unexpected communication received. Check log for additional errors.
LogLearning: Display: PPOTrainer_0: Stopping training...
LogLearning: Error: PPOTrainer_0: Training has failed. Check log for errors.
LogLearning: Error: PPOTrainer_0: Training has failed. Check log for errors.
LogLearning: Error: PPOTrainer_0: Training has failed. Check log for errors.

It seems like the torch error I’m getting is related to this GitHub post. I just checked and it looks like I’m using torch 2.3.1; perhaps I need any upgrade??? Any thoughts what I might be doing wrong?

I don’t understand how this things are possible the plugin comes with his own version of python and all the machine learning libraries already installed how can it be that I work on someone and doesn’t on someone else, there are no prerequisite or python installation tutorials

With the release of UE 5.5, there have been some changes related to Imitation Learning. To ensure everything works correctly, you’ll need to add the following:

2 Likes

Hello, I think I might have found a code issue. I’m not entirely sure if the two lines of code I selected are problematic, but the parameter RelativeAngle within this function doesn’t seem to serve any purpose.

Engine version: 5.5.3

On line 2089, RelativeAngle is used. I’m not sure that I see a problem with the sin and cos.

Let me know if you think I’m wrong.

Sorry for my unclear wording. I think the ā€˜Angle’ parameter on lines 2090 and 2091 should be replaced with ā€˜LocalAngle’. Otherwise, the ā€˜RelativeAngle’ argument won’t influence the calculations in ā€˜MakeContinousObservationFromArrayView’ at line 2119.

1 Like

Do I need to install Python on my computer before I do this tutorial?
I’m currently working on Windows and have never installed or used Python.

1 Like

No, Unreal comes with a python environment which is used for the tutorial.

Thanks for following up! I think you are right. I will have this fixed on Main soon and for 5.6.

1 Like

Hi! will models created with Learning Agents 5.4 be usable in 5.5? thanks

I believe that should be the case, but there may be some change I am forgetting which would cause you an issue. Best to give it a try and see.

1 Like

Hey @Deathcalibur , I was wondering with the current implementation of the Learning Agents 5.5 have you seen examples of anyone attempting to use a different RL algorithm with the plugin? The PPO one included works very well, however, I was hoping to implement a DDPG or SAC algorithm in its place.
Thank!

Not yet. I imagine they are difficult to implement without making changes to the codebase.

We have successfully implemented a variant of PPO for our internal usage and the ā€œbring your own algorithmā€ worked well for that.

Hello. Thank you for this fantastic course. I am extremely new to the whole ML/DL domain and have only a subtle understanding of NNs, but I have a theoretical (probably) question. I don’t ask for a thorough explanation because it’d probably take one to read me a year-long university course of ML, so a short answer with some hints what to look up on the subject would be enough.

So the question is why does just adding lookahead observations of the track improves the outcome of the training? I mean I don’t get the relation so far, because from what I understand, actions, rewards and completions are all executed/gathered disregarding the observation (at least in the provided BP samples). I can only guess that track spline lookahead locations and directions make training more complex and in this case complexity is good to a certain point but how does it affect the inferred actions?

I’m not sure I understand your understanding fully but I’ll explain how I think about it.

The agent is learning a function (the neural network) called the policy which transforms observations into actions. The agent uses the reward to train the policy.

Prior to adding the lookahead observations, the agent doesn’t have any information about the shape of the road that is coming ahead, so it can’t learn how to take a turn differently from a straightaway. Once we add the lookahead, the agent can ā€œseeā€ the shape of the road and can adjust its behavior to anticipate turns sooner, etc.

Hope this helps.

Hey Brendan, Thank you again for your consistent responses on this forum. It really helps a lot. The question I have for today is if I wanted to collect speed and trajectories of the RL agents how would I best go about collecting it? I’m hoping to use it as a labeled figure and/or use for a distribution/ I figured that the information is stored in some structure within the plugin but thought I should ask for clarification.