Unity-Technologies / obstacle-tower-env

Obstacle Tower Environment
Apache License 2.0
540 stars 124 forks source link

UnityGymException may be triggered inside _check_agents() #120

Closed MarcoMeter closed 4 years ago

MarcoMeter commented 4 years ago

Hi @awjuliani

I came across another bug.

Inside the function _check_agents() it may happen that n_agents equals 0 and therefore triggers the exception. It is not clear to me yet what causes this bug.

To reproduce it, I have to run a lot of episodes to eventually stumble on this behavior. If I train my PPO agent using 16 environment instances, I get this exception very frequently. If I comment out that exception, my training program keeps running without further issues from the first sight. I cannot state yet that there are no side effects to this potential fix.

edit: This happens during the last step right on episode termination.

edit 2: I think the solution is to use len(terminal_info) instead of len(info) upon the step at episode termination.

edit 3: Created pull request.

awjuliani commented 4 years ago

Thanks for pointing this out and providing a fix. I'll close this issue now.