ml-agents icon indicating copy to clipboard operation
ml-agents copied to clipboard

Unable to train the agent

Open puneets2811 opened this issue 8 years ago • 7 comments

Followed the steps from "https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Learning-Environment-Create-New.md" to create a car with 5 radars(as shown in the image) on the front bumper and controls - break, steer, accelerate. untitled_1

When I execute the "learn.py" script with the Unity executable of my environment in the same directory, the unity environment opens up but my agent does not move or learn anything and no errors appear. On the python console a constant reward of -1.000 is shown over the iterations.

puneets2811 avatar Mar 21 '18 06:03 puneets2811

Do you obtain the expected behavior when using the player brain ?

vincentpierre avatar Mar 21 '18 16:03 vincentpierre

Yes. If the player brain is set, and I move the car manually using the keyboard keys, the reward goes up.

puneets2811 avatar Mar 23 '18 04:03 puneets2811

Have you ensured rewards are present to encourage changes in behaviour....

Bakikii avatar Apr 12 '18 19:04 Bakikii

I have a similar problem. My environment runs fine and the player brain works perfectly, but the agent does not move at all during training. A couple errors happen repeatedly:

NullReferenceException: Object reference not set to an instance of an object EnemyAgent.AgentAction (System.Single[] vectorAction, System.String textAction) (at <36c59ff2250e45b19ec9332a93a4d0cd>:0) Agent.AgentStep () (at <36c59ff2250e45b19ec9332a93a4d0cd>:0) Academy.EnvironmentStep () (at <36c59ff2250e45b19ec9332a93a4d0cd>:0) Academy.FixedUpdate () (at <36c59ff2250e45b19ec9332a93a4d0cd>:0) Exception

and

ArgumentException: An item with the same key has already been added. System.ThrowHelper.ThrowArgumentException (System.ExceptionResource resource) (at <8cdd91c3618b427b905eb298374eee86>:0) System.Collections.Generic.Dictionary2[TKey,TValue].Insert (TKey key, TValue value, System.Boolean add) (at <8cdd91c3618b427b905eb298374eee86>:0) System.Collections.Generic.Dictionary2[TKey,TValue].Add (TKey key, TValue value) (at <8cdd91c3618b427b905eb298374eee86>:0) Brain.SendState (Agent agent, AgentInfo info) (at <36c59ff2250e45b19ec9332a93a4d0cd>:0) Agent.SendInfoToBrain () (at <36c59ff2250e45b19ec9332a93a4d0cd>:0) Agent.SendInfo () (at <36c59ff2250e45b19ec9332a93a4d0cd>:0) Academy.EnvironmentStep () (at <36c59ff2250e45b19ec9332a93a4d0cd>:0) Academy.FixedUpdate () (at <36c59ff2250e45b19ec9332a93a4d0cd>:0) Exception

The vectorAction that is passed in is full of NaN. I already tried decreasing the learning rate, which did not do anything.

BenM77 avatar May 15 '18 09:05 BenM77

@BenM77 Have you made sure your vector_observations are between -1 and 1 ? It seems it is a null problem, not a NaN problem, maybe the two are separate issues.

vincentpierre avatar May 15 '18 17:05 vincentpierre

Thank you for the discussion. We are closing this issue due to inactivity. Feel free to reopen it if you’d like to continue to discussion though.

xiaomaogy avatar Jun 16 '18 00:06 xiaomaogy

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.

lock[bot] avatar Jan 03 '20 08:01 lock[bot]