Unity-Technologies / ml-agents

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning.
https://unity.com/products/machine-learning-agents
Other
17.12k stars 4.15k forks source link

With the progress of training, FPS in the process of training decreased gradually #5461

Closed DeDao2333 closed 2 years ago

DeDao2333 commented 3 years ago

As the title describes, the FPS of my game has been decreasing linearly with the progress of training. I do not know the reason. And I made an experiment on official example called 3DBall, whose performance was okay, the FPS was stable...

I use the default configuration to train. Where can this problem be made, or what mechanism may cause this problem ?

Thank you in advanced !

IvailoManolov commented 3 years ago

I think this might be associated with a problem that I have discovered. I speculate a memory leak at least in my machine. Could you start your own training where the FPS dropped and monitor the memory usage of the program . You can simply use the profiler or open Task Manager , and see the memory used there. I simply write a sheet where I say for example : 7/19/2021 8:55 AM MemoryUsed -> 1GB 7/19/2021 9:23 AM MemoryUsed -> 4GB

If you see this kind of behavior there is a memory leak.Test it out and tell me when you are done.

ervteng commented 3 years ago

To second what has been said, it's almost certainly a memory leak. If 3DBall worked fine, it's most likely in your game. I'd check things like disabled gameobjects piling up somewhere.

DeDao2333 commented 3 years ago

@IvailoManolov Sorry for late reply ... Yes, I have the same situation as you. In my Game, the MemoryUsed has increased 1 MB per second approximately. But what bothers me most is that when I train my game, for example, it takes longer and longer time to train every 5W step. My solution now is to stop the training halfway, and then restart the training utilizing the resume command.

IvailoManolov commented 3 years ago

@DeDao2333 One issue that comes in my mind is that if you have a memory leak in your own piece of code. It is important to test if the memory leak is not a problem of the ML Lib you are using. Your program is increasing linearly ,this means that you most definitely might have a memory leak. Now the problem is , where it is ? If you share the code we can better tell if the problem is in you. It might be that the GC is kicking quite often and this blocks your thread.I believe that they are still not allowing the GC thread to run concurrently.If you share your script , I think people can help you a little bit more.

DeDao2333 commented 3 years ago

@IvailoManolov Sorry, the code with ML-agents was written by my colleague for the indie game of our company, not only several scripts, so I can not share the code ... The indie game we are making is complex far more complex than the official examples, especially the physical system, skin texture and so on, there are many details I don't know because I'm new here.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had activity in the last 28 days. It will be closed in the next 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

This issue has been automatically closed because it has not had activity in the last 42 days. If this issue is still valid, please ping a maintainer. Thank you for your contributions.

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.