ray.rllib.evaluation.sampler.AsyncSampler.__init__#

AsyncSampler.__init__(*, worker: RolloutWorker, env: ray.rllib.env.base_env.BaseEnv, clip_rewards: Union[bool, float], rollout_fragment_length: int, count_steps_by: str = 'env_steps', callbacks: DefaultCallbacks, multiple_episodes_in_batch: bool = False, normalize_actions: bool = True, clip_actions: bool = False, observation_fn: Optional[ObservationFunction] = None, sample_collector_class: Optional[Type[ray.rllib.evaluation.collectors.sample_collector.SampleCollector]] = None, render: bool = False, blackhole_outputs: bool = False, policies=None, policy_mapping_fn=None, preprocessors=None, obs_filters=None, tf_sess=None, no_done_at_end=- 1, horizon=- 1, soft_horizon=- 1)[source]#

Initializes an AsyncSampler instance.

Parameters
  • worker – The RolloutWorker that will use this Sampler for sampling.

  • env – Any Env object. Will be converted into an RLlib BaseEnv.

  • clip_rewards – True for +/-1.0 clipping, actual float value for +/- value clipping. False for no clipping.

  • rollout_fragment_length – The length of a fragment to collect before building a SampleBatch from the data and resetting the SampleBatchBuilder object.

  • count_steps_by – One of “env_steps” (default) or “agent_steps”. Use “agent_steps”, if you want rollout lengths to be counted by individual agent steps. In a multi-agent env, a single env_step contains one or more agent_steps, depending on how many agents are present at any given time in the ongoing episode.

  • multiple_episodes_in_batch – Whether to pack multiple episodes into each batch. This guarantees batches will be exactly rollout_fragment_length in size.

  • normalize_actions – Whether to normalize actions to the action space’s bounds.

  • clip_actions – Whether to clip actions according to the given action_space’s bounds.

  • blackhole_outputs – Whether to collect samples, but then not further process or store them (throw away all samples).

  • observation_fn – Optional multi-agent observation func to use for preprocessing observations.

  • sample_collector_class – An optional SampleCollector sub-class to use to collect, store, and retrieve environment-, model-, and sampler data.

  • render – Whether to try to render the environment after each step.