sync_async_collector¶
- torchrl.trainers.helpers.sync_async_collector(env_fns: Union[Callable, List[Callable]], env_kwargs: Optional[Union[dict, List[dict]]], num_env_per_collector: Optional[int] = None, num_collectors: Optional[int] = None, **kwargs) MultiaSyncDataCollector [source]¶
Runs asynchronous collectors, each running synchronous environments.
Environment types can be identical or different. In the latter case, env_fns should be a list with all the creator fns for the various envs, and the policy should handle those envs in batch.
- Parameters:
env_fns – Callable (or list of Callables) returning an instance of EnvBase class.
env_kwargs – Optional. Dictionary (or list of dictionaries) containing the kwargs for the environment being created.
num_env_per_collector – Number of environments per data collector. The product num_env_per_collector * num_collectors should be less or equal to the number of workers available.
num_collectors – Number of data collectors to be run in parallel.
**kwargs – Other kwargs passed to the data collectors