-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[RLlib] Enhance ConnectorV2 ObservationPreprocessor
APIs (add multi-agent support; add episode
arg).
#54209
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] Enhance ConnectorV2 ObservationPreprocessor
APIs (add multi-agent support; add episode
arg).
#54209
Conversation
Signed-off-by: sven1977 <[email protected]>
…_redo_connector_v2
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
…_redo_connector_v2 Signed-off-by: sven1977 <[email protected]> # Conflicts: # rllib/connectors/common/add_states_from_episodes_to_batch.py # rllib/connectors/module_to_env/remove_single_ts_time_rank_from_batch.py
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
…_redo_connector_v2 Signed-off-by: sven1977 <[email protected]> # Conflicts: # doc/source/rllib/package_ref/index.rst
Signed-off-by: sven1977 <[email protected]>
…_redo_connector_v2
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
…_redo_connector_v2
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
…_redo_connector_v2
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
…_redo_connector_v2
Signed-off-by: sven1977 <[email protected]>
…_redo_connector_v2
…_redo_connector_v2
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
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.
Pull Request Overview
This PR enhances the ConnectorV2 ObservationPreprocessor APIs to add multi-agent support and introduces an extra episode argument to the preprocess function. Key changes include:
- Renaming the existing ObservationPreprocessor to SingleAgentObservationPreprocessor and adding a new MultiAgentObservationPreprocessor.
- Updating the preprocess method signature and call implementations to pass the corresponding episode object.
- Adjusting several connector components (e.g., numpy_to_tensor, add_time_dim_to_batch_and_zero_pad, add_states_from_episodes_to_batch) to safely handle cases when rl_module is None and updating documentation accordingly.
Reviewed Changes
Copilot reviewed 12 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
rllib/connectors/env_to_module/observation_preprocessor.py | Renamed and extended preprocessor APIs for single-agent and multi-agent setups. |
rllib/connectors/common/numpy_to_tensor.py | Removed the as_learner_connector parameter and added a conditional check on rl_module. |
rllib/connectors/common/add_time_dim_to_batch_and_zero_pad.py | Updated rl_module check to account for None values. |
rllib/connectors/common/add_states_from_episodes_to_batch.py | Updated rl_module check to account for None values. |
doc/source/rllib/*.rst | Updated documentation to include connector-v2 and related new APIs. |
Comments suppressed due to low confidence (2)
rllib/connectors/env_to_module/observation_preprocessor.py:162
- Consider implementing a proper 'set_observations' API for multi-agent episodes instead of relying on the single-agent workaround.
# TODO (sven): Implement set_observations API for multi-agent episodes.
rllib/connectors/common/numpy_to_tensor.py:60
- The removal of the 'as_learner_connector' parameter may affect users expecting that configuration. Ensure that the associated documentation and any dependent code reflect this change.
*,
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
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.
LGTM.
Signed-off-by: sven1977 <[email protected]>
…-agent support; add `episode` arg). (#54209) Signed-off-by: elliot-barn <[email protected]>
Enhance ConnectorV2
ObservationPreprocessor
APIs:episode
arg (so that for example rewards/actions can be added to an observation during preprocessing).Why are these changes needed?
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.