Shortcuts

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.

../../_images/aafig-8621270533bb6c98244a6fe726e49583c7be9adf.svg

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

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources