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 tests for OfflineSingleAgentEnvRunner. #47133

Merged
merged 4 commits into from
Aug 15, 2024

Conversation

simonsays1980
Copy link
Collaborator

@simonsays1980 simonsays1980 commented Aug 14, 2024

Why are these changes needed?

This PR adds tests to check, if recording of agents works properly. Recording is managed by the OfflineSingleAgentEnvRunner that uses ray.data to write files to disk.

This test suite tests:

  • If writing to episodes works,
  • If writing to columns works,
  • If writing to compressed columns works.

Related issue number

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: simonsays1980 <simon.zehnder@gmail.com>
Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
@sven1977 sven1977 changed the title [RLlib; Offline RL] - Add tests for OfflineSingleAgentEnvRunner. [RLlib; Offline RL] Add tests for OfflineSingleAgentEnvRunner. Aug 15, 2024
@sven1977 sven1977 marked this pull request as ready for review August 15, 2024 09:36
…to the docstrings in 'AlgorithmConfig' in regard to column compression.

Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
@@ -1598,6 +1598,13 @@ py_test(
srcs = ["offline/estimators/tests/test_dr_learning.py"],
)

py_test(
Copy link
Contributor

Choose a reason for hiding this comment

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

awesome!

super nit: let's keep test cases alphabetically ordered (within their category), so let's move this below the next record (test_offline_data).

@@ -2456,7 +2456,9 @@ def offline_data(
to define the output data format when recording.
input_compress_columns: What input columns are compressed with LZ4 in the
input data. If data is stored in `RLlib`'s `SingleAgentEpisode` (
`MultiAgentEpisode` not supported, yet).
`MultiAgentEpisode` not supported, yet). Note,
`rllib.core.columns.Columns.OBS` will also try to decompress
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome. Thanks for clarifying this for the users. Makes perfect sense that they won't have to specify NEXT_OBS explicitly.

@@ -2513,7 +2515,8 @@ def offline_data(
output_config: Arguments accessible from the IOContext for configuring
custom output.
output_compress_columns: What sample batch columns to LZ4 compress in the
output data.
output data. Note, `rllib.core.columns.Columns.OBS` will also compress
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -193,7 +193,7 @@ def sample(
getattr(samples_ds, self.output_write_method)(
path.as_posix(), **self.output_write_method_kwargs
)
logger.info("Wrote samples to storage.")
logger.info(f"Wrote samples to storage at {path}")
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -250,7 +250,6 @@ def convert(sample, space):
return sample

episodes = []
# TODO (simon): Give users possibility to provide a custom schema.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

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.

Awesome PR! Thanks for following up on these test cases @simonsays1980 .

@sven1977 sven1977 enabled auto-merge (squash) August 15, 2024 11:44
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Aug 15, 2024
@sven1977 sven1977 merged commit 50d44cc into ray-project:master Aug 15, 2024
7 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