当前位置:网站首页>[resolved] "the unity environment took too long to respond. make sure that: \n“

[resolved] "the unity environment took too long to respond. make sure that: \n“

2022-06-23 06:29:00 Bungehurst

Running environment

  • Anaconda 4.12.0
  • Python 3.6.13
  • Pytorch 1.10.2
  • Ray 1.10.0
  • mlagents 0.28.0
  • mpi4py 3.0.3

Problem description

When running multi process parallel training ,Unity There will be an error as follows , The program is stuck at this time

"The Unity environment took too long to respond. Make sure that :\n"
mlagents_envs.exception.UnityTimeOutException: The Unity environment took too long to respond. Make sure that :
	 The environment does not need user interaction to launch
	 The Agents' Behavior Parameters > Behavior Type is set to "Default" The environment and the Python interface have compatible versions. If you're running on a headless server without graphics support, turn off display by either passing --no-graphics option or build your Unity executable as server build.

The suspicion may be caused by not closing the graphics .

Solution

modify unity3d_env.py file , Directory in :anaconda3/envs/<env_name>/lib/python3.6/site-packages/ray/rllib/env/wrappers/unity3d_env.py.

 def __init__(self,
                 file_name: str = None,
                 port: Optional[int] = None,
                 seed: int = 0,
                 no_graphics: bool = True,
                 timeout_wait: int = 500,
                 episode_horizon: int = 1000):
  • modify no_graphics by no_graphics: bool = True, Turn off drawing output
  • modify timeout_wait, Appropriately increase the timeout waiting time
原网站

版权声明
本文为[Bungehurst]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206230443223221.html