sample#
- OfflineSingleAgentEnvRunner.sample(*, num_timesteps: int = None, num_episodes: int = None, explore: bool = None, random_actions: bool = False, force_reset: bool = False) List[SingleAgentEpisode][source]#
Samples from environments and writes data to disk.
Samples like
SingleAgentEnvRunner.sample()and adds the samples to a buffer. Ifconfig.output_max_rows_per_fileis set, writes the buffer toconfig.outputonce it holds that many rows. Otherwise, writes the samples on every call.- Parameters:
num_timesteps (int) – The minimum number of timesteps to sample during this call. Only one of
num_timestepsornum_episodesmay be provided.num_episodes (int) – The minimum number of episodes to sample during this call. Only one of
num_timestepsornum_episodesmay be provided.explore (bool) – Whether to compute actions with the RLModule’s
forward_exploration()method, instead offorward_inference(). If None, uses theexploresetting from the config.random_actions (bool) – Whether to sample actions randomly from the env’s action space, instead of computing them with the RLModule.
force_reset (bool) – Whether to force-reset all vectorized environments before sampling.
- Returns:
The sampled episodes, as
SingleAgentEnvRunner.sample()returns them.- Return type: