【已解决】“The Unity environment took too long to respond. Make sure that :\n“

运行环境

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

问题描述

在运行多进程并行训练时,Unity会有如下报错,此时程序卡死

"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.

怀疑有可能是没有关闭图形造成的.

解决方案

修改unity3d_env.py文件,目录在: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):
  • 修改no_graphicsno_graphics: bool = True,关闭图形输出
  • 修改timeout_wait,适当增加超时等待时间
  • 检查端口号是否被占用!!!
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值