Skip to content

Commit

Permalink
[RLlib; Off-policy] Add episode sampling to EpisodeReplayBuffer. (r…
Browse files Browse the repository at this point in the history
…ay-project#47500)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
  • Loading branch information
simonsays1980 authored and ujjawal-khare committed Oct 15, 2024
1 parent 2db5aa3 commit 9a17b88
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
7 changes: 0 additions & 7 deletions rllib/utils/replay_buffers/episode_replay_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ def sample(
include_infos: bool = False,
include_extra_model_outputs: bool = False,
sample_episodes: Optional[bool] = False,
finalize: bool = False,
**kwargs,
) -> Union[SampleBatchType, SingleAgentEpisode]:
"""Samples from a buffer in a randomized way.
Expand Down Expand Up @@ -263,7 +262,6 @@ def sample(
actual state of model e.g. action log-probabilities, etc.). If `True`,
the extra model outputs at the `"obs"` in the batch is included (the
timestep at which the action is computed).
finalize: If episodes should be finalized.
Returns:
Either a batch with transitions in each row or (if `return_episodes=True`)
Expand All @@ -281,7 +279,6 @@ def sample(
gamma=gamma,
include_infos=include_infos,
include_extra_model_outputs=include_extra_model_outputs,
finalize=finalize,
)
else:
return self._sample_batch(
Expand Down Expand Up @@ -427,7 +424,6 @@ def _sample_episodes(
gamma: float = 0.99,
include_infos: bool = False,
include_extra_model_outputs: bool = False,
finalize: bool = False,
**kwargs,
) -> List[SingleAgentEpisode]:
"""Samples episodes from a buffer in a randomized way.
Expand Down Expand Up @@ -472,7 +468,6 @@ def _sample_episodes(
actual state of model e.g. action log-probabilities, etc.). If `True`,
the extra model outputs at the `"obs"` in the batch is included (the
timestep at which the action is computed).
finalize: If episodes should be finalized.
Returns:
A list of 1-step long episodes containing all basic episode data and if
Expand Down Expand Up @@ -583,8 +578,6 @@ def _sample_episodes(
len_lookback_buffer=0,
t_started=episode_ts,
)
if finalize:
sampled_episode.finalize()
sampled_episodes.append(sampled_episode)

# Increment counter.
Expand Down
1 change: 0 additions & 1 deletion rllib/utils/replay_buffers/prioritized_episode_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ def sample(
gamma: float = 0.99,
include_infos: bool = False,
include_extra_model_outputs: bool = False,
finalize: bool = False,
**kwargs,
) -> SampleBatchType:
"""Samples from a buffer in a prioritized way.
Expand Down

0 comments on commit 9a17b88

Please sign in to comment.