[RLlib] Fix device check in Learner.#53706
Merged
sven1977 merged 4 commits intoray-project:masterfrom Jun 13, 2025
Merged
Conversation
Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the device check in the Learner by switching the validation from the "obs" column to the "rewards" column, ensuring that the correct device property is checked for training data.
- Updated the import to include the Columns constant.
- Replaced "obs" with Columns.REWARDS in the device check condition.
Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
sven1977
approved these changes
Jun 13, 2025
Contributor
sven1977
left a comment
There was a problem hiding this comment.
LGTM! Thanks for the fix @simonsays1980 !
elliot-barn
pushed a commit
that referenced
this pull request
Jun 18, 2025
elliot-barn
pushed a commit
that referenced
this pull request
Jul 2, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why are these changes needed?
In the
Learneris is checked, if the training batch is already on the correct device. For this it is checked, if"obs"column of the batch is anumpyarray orThis can throw an exception, if the observations are no an array-type (e.g.
gym.spaces.Dict,gym.spaces.Tuple). This PR fixes this by switching the column of the batch to be checked to a simpler one, namely the"rewards"(which are always of simple vector format).Related issue number
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.