ray.rllib.evaluation.sampler.SyncSampler.__init__#

SyncSampler.__init__(*, worker: RolloutWorker, env: BaseEnv, clip_rewards: 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: ObservationFunction | None = None, sample_collector_class: Type[SampleCollector] | None = None, render: bool = False, policies=None, policy_mapping_fn=None, preprocessors=None, obs_filters=None, tf_sess=None, horizon=-1, soft_horizon=-1, no_done_at_end=-1)[source]#

Initializes a SyncSampler 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.

  • callbacks – The Callbacks object to use when episode events happen during rollout.

  • 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.

  • 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.