-
Notifications
You must be signed in to change notification settings - Fork 6k
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] Agent collector time complexity reduction #31693
Merged
gjoliver
merged 16 commits into
ray-project:master
from
ArturNiederfahrenhorst:agent_collector_improvement
Jan 19, 2023
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5bf1ec1
initial
ArturNiederfahrenhorst 6b7397b
lint
ArturNiederfahrenhorst cad2a50
fixes
ArturNiederfahrenhorst 017c949
ms instead of throughput
ArturNiederfahrenhorst 2ff4309
initial
ArturNiederfahrenhorst 1367a7e
minor fixes
ArturNiederfahrenhorst 3b6dfac
initial
ArturNiederfahrenhorst 78be16d
remove deepcopy and squeezes
ArturNiederfahrenhorst 6efeb3d
flip back connectors
ArturNiederfahrenhorst 138c317
revert sample_batch_test changes
ArturNiederfahrenhorst 87e226d
jun's comments
ArturNiederfahrenhorst bb296a5
jun's comment
ArturNiederfahrenhorst f63be95
jun's comment
ArturNiederfahrenhorst 60614a1
remove push units calls
ArturNiederfahrenhorst 9a08d5d
remove linter error artifact from rebase
ArturNiederfahrenhorst 28bed76
jun's comments
ArturNiederfahrenhorst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import random | ||
from collections import defaultdict | ||
import numpy as np | ||
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple | ||
|
||
from ray.rllib.env.base_env import _DUMMY_AGENT_ID | ||
|
@@ -295,7 +296,7 @@ def postprocess_episode( | |
|
||
if ( | ||
not pre_batch.is_single_trajectory() | ||
or len(set(pre_batch[SampleBatch.EPS_ID])) > 1 | ||
or len(np.unique(pre_batch[SampleBatch.EPS_ID])) > 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because of the above changes, EPS_IDs turn out to be np arrays as well, so set does not work here anymore. |
||
): | ||
raise ValueError( | ||
"Batches sent to postprocessing must only contain steps " | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, we shouldn't get rid of these? same below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized we actually don't need these after kourosh asked me about them -> #31693 (comment)
I just executed code from this pr and took the following screenshot just to make sure that the timer actually works as expected.
![Screenshot 2023-01-18 at 15 54 33](https://user-images.githubusercontent.com/9356806/213323120-ddc90bb1-5baa-4a64-bf98-285072353ad4.png)
When calling .mean(), the timer does not care of processed units - we don't need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh that's right, it's part of the with statements.