예제 #1
0
파일: unity.py 프로젝트: c-w-m/slm-lab
 def __init__(self, name):
     worker_id = int(f'{os.getpid()}{int(ps.unique_id())}'[-4:])
     super().__init__(get_env_path(name),
                      worker_id,
                      no_graphics=not util.to_render(),
                      multiagent=True)
     self.num_envs = self.number_agents
예제 #2
0
파일: unity.py 프로젝트: colllin/SLM-Lab
 def __init__(self, spec):
     super().__init__(spec)
     util.set_attr(self, self.env_spec, ['unity'])
     worker_id = int(f'{os.getpid()}{self.e+int(ps.unique_id())}'[-4:])
     seed = ps.get(spec, 'meta.random_seed')
     # TODO update Unity ml-agents to use seed=seed below
     self.u_env = UnityEnvironment(file_name=get_env_path(self.name), worker_id=worker_id)
     self.patch_gym_spaces(self.u_env)
     self._set_attr_from_u_env(self.u_env)
     assert self.max_t is not None
     logger.info(util.self_desc(self))
예제 #3
0
    def __init__(self, spec, e=None, env_space=None):
        super(UnityEnv, self).__init__(spec, e, env_space)
        util.set_attr(self, self.env_spec, ['unity'])
        worker_id = int(f'{os.getpid()}{self.e+int(ps.unique_id())}'[-4:])
        self.u_env = UnityEnvironment(file_name=get_env_path(self.name), worker_id=worker_id)
        self.patch_gym_spaces(self.u_env)
        self._set_attr_from_u_env(self.u_env)
        if env_space is None:  # singleton mode
            pass
        else:
            self.space_init(env_space)

        logger.info(util.self_desc(self))
예제 #4
0
def test_get_env_path():
    assert 'node_modules/slm-env-3dball/build/3dball' in get_env_path(
        '3dball')