-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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] Add backward compatibility to MeanStdFilter to restore from older checkpoints. #30439
[RLlib] Add backward compatibility to MeanStdFilter to restore from older checkpoints. #30439
Conversation
…heckpoints. Signed-off-by: Simon Zehnder <[email protected]>
bece744
to
eb362bc
Compare
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.
Thanks for this contribution @simonsays1980 ! I actually changed the names here to make the code well readable but forgot about the compatibility.
) | ||
other.std_array = ( | ||
np.copy(self.std_array) if hasattr(self, "std_array") else np.copy(self._S) | ||
) |
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.
For reference, it was #27864 that made these changes. All changed attribute names seem to be covered here.
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.
Nit: A TODO that tells us to remove this additional code at some point. But it does not do any harm here either 😃
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 can add the nit :D
I also saw that we get often a DeprecationWarning
with this class which could be overcome probably by choosing ()
instead of None
in the shape
arguments of numpy
array ctors.
I could push that together into one smooth PR if needed
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.
Separate PRs for separate problems would be appreciated!
…ged 'shape=None' for 'shape=()' as interchangeability of 'None' and '()' will be deprecated and only '()' will stay. Signed-off-by: Simon Zehnder <[email protected]>
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
|
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! Thanks for the fix @simonsays1980 ! :)
…lder checkpoints. (#30439)
…lder checkpoints. (ray-project#30439) Signed-off-by: tmynn <[email protected]>
…heckpoints.
Why are these changes needed?
Restoring in
Ray 2.0.1
checkpoints from older versions whereMeanStdFilter
was used for training results in an error:AttributeError: other has no attribute named 'running_stats'
The same goes for
self.mean_array
andself.std_array
simply because these attributes were named differently.This PR adds some safeguarding for backwards compatibility. I tested this with my own checkpoints from
Ray 2.0.0
and it works.Related issue number
None. Faught with it, saw it, fixed it.
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.