def Wrapper(template_name, **kwargs): # Do a bit of hackery with scopes so that the current config scope used when # constructing the template is also used when the template is instantiated. saved_scopes = gin.current_scope() def GinWrapper(*args, **kwargs): with gin.config_scope(saved_scopes): return function(*args, **kwargs) return Template(template_name, GinWrapper, **kwargs)
def start_worker(): worker_fn = functools.partial( worker_utils.Worker, env_class=env_class, agent_class=agent_class, network_fn=network_fn, config=config, scope=gin.current_scope(), init_hooks=[], compress_episodes=False, ) if serialize_worker_fn: worker_fn = _cloudpickle().dumps(worker_fn) queue_in = mp.Queue() queue_out = mp.Queue() process = process_class( target=_target, args=(worker_fn, queue_in, queue_out, serialize_worker_fn), ) process.start() return (queue_in, queue_out)