Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RLlib; Offline RL] Add support to directly read from episodes. #46865

Merged

Conversation

simonsays1980
Copy link
Collaborator

@simonsays1980 simonsays1980 commented Jul 30, 2024

Why are these changes needed?

The Offline RL API in the new stack will soon support recording capabilities (see #46818) that allow direclty storing RLlib's episodes (i.e. SingleAgentEpisodes). In regard to this upcoming change this PR proposes a direct episode readfing option for the OfflinePreLearner that can skip the _map_to_episodes step in the map_batches dta pipeline and therefore increase training speed.

Related issue number

Relates to #46818

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: simonsays1980 <[email protected]>
…matted commit merely for securing the work.

Signed-off-by: simonsays1980 <[email protected]>
…' and 'MARWILTorchPolicy', fixed imports and tested MARWIL on non-recurrent policies.

Signed-off-by: simonsays1980 <[email protected]>
Signed-off-by: simonsays1980 <[email protected]>
Signed-off-by: simonsays1980 <[email protected]>
… to 'OfflineData'. Set return to reach higher for tuned example.

Signed-off-by: simonsays1980 <[email protected]>
Signed-off-by: simonsays1980 <[email protected]>
… in linting and building.

Signed-off-by: simonsays1980 <[email protected]>
Signed-off-by: simonsays1980 <[email protected]>
…nectors request finalized episodes.

Signed-off-by: simonsays1980 <[email protected]>
…g as this was giving an error when 'MARWILOfflinePreLearner' tried to call a value function unneeded by BC. Deprecated hybrid stack.

Signed-off-by: simonsays1980 <[email protected]>
…. BC depends now fully on MARWIL.

Signed-off-by: simonsays1980 <[email protected]>
rllib/BUILD Outdated Show resolved Hide resolved
# TODO (simon): episodes are only needed for logging here.
return {"batch": [batch]}

def _compute_gae_from_episodes(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance we can share this code with PPO's?

Create a utility function in PPO folder (e.g. algorithms/ppo/utils.py), then import and use this same function for MARWIL.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the question I have: DO we really need the complete code? Or can we get rid of either the batch or episodes in their when considering MARWIL and the offline learning pipeline?

Copy link
Contributor

@sven1977 sven1977 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now! Thanks for this PR @simonsays1980 !

@sven1977 sven1977 enabled auto-merge (squash) August 8, 2024 10:42
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Aug 8, 2024
@github-actions github-actions bot disabled auto-merge August 9, 2024 09:21
@sven1977 sven1977 merged commit 936427f into ray-project:master Aug 12, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants