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] Issue 22625: MultiAgentBatch.timeslices() does not behave as expected. #22657

Conversation

ArturNiederfahrenhorst
Copy link
Contributor

Why are these changes needed?

MultiAgentBatch.timeslices() does not behave as expected. I returns non-information-batches for later slices and does not do the same for earlier slices.

timeit tells me that cur_slice.clear() is quicker than cur_slice = collections.defaultdict(SampleBatchBuilder).

Related issue number

Closes #22625

Checks

  • 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 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 :(

Copy link
Member

@gjoliver gjoliver left a comment

Choose a reason for hiding this comment

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

this is a nice fix.

@avnishn
Copy link
Member

avnishn commented Feb 25, 2022

Can we add a small test to prove that this does the fixes that you're attempting to make?

Copy link
Member

@avnishn avnishn left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link
Member

@gjoliver gjoliver left a comment

Choose a reason for hiding this comment

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

1 nit.
my favorite kind of PR. little code change, tons of tests :)

rllib/utils/test_utils.py Show resolved Hide resolved
rllib/policy/tests/test_multi_agent_batch.py Show resolved Hide resolved
@sven1977 sven1977 changed the title fix #22625 [RLlib] Issue 22625: MultiAgentBatch.timeslices() does not behave as expected. Mar 8, 2022
@sven1977 sven1977 merged commit c0ade5f into ray-project:master Mar 8, 2022
@ArturNiederfahrenhorst ArturNiederfahrenhorst deleted the fix-multiagentbatch-timeslices branch April 24, 2022 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] MultiAgentBatch.timeslices() does not behave as expected
4 participants