[rllib, train] Add support for nested metrics in Result.get_best_checkpoint#58537
Conversation
…st_checkpoint` Signed-off-by: Mark Towers <mark@anyscale.com>
There was a problem hiding this comment.
Code Review
This pull request adds support for nested metrics in Result.get_best_checkpoint by using unflattened_lookup. The changes are correct and are accompanied by good tests covering nested metrics, different modes, and backward compatibility. I've suggested one improvement to the error message when an invalid metric is provided, to make it more helpful for users of nested metrics.
Signed-off-by: Mark Towers <mark@anyscale.com>
| import pyarrow | ||
|
|
||
| import ray | ||
| from ray._private.dict import unflattened_lookup |
There was a problem hiding this comment.
@justinvyu do we want to support this for Train V2 as well, or should we diverge for Tune?
There was a problem hiding this comment.
I'm ok to support this in Train. This is only needed if users self-report nested dicts.
Result.get_best_checkpointResult.get_best_checkpoint
| import pyarrow | ||
|
|
||
| import ray | ||
| from ray._private.dict import unflattened_lookup |
There was a problem hiding this comment.
I'm ok to support this in Train. This is only needed if users self-report nested dicts.
Co-authored-by: Justin Yu <justinvyu@anyscale.com> Signed-off-by: Mark Towers <mark.m.towers@gmail.com>
Signed-off-by: Mark Towers <mark@anyscale.com>
Result.get_best_checkpointResult.get_best_checkpoint
…ckpoint` (ray-project#58537) RLlib uses nested metric structure (like `"{ENV_RUNNER_RESULTS}/{EPISODE_RETURN_MEAN}"`) which `Result.get_best_checkpoint` doesn't support. Following `ResultGrid.get_best_result()` to use `unflattened_lookup`, I've added that to `get_best_checkpoint` along with testing for nested structures (and its backward compatibility) --------- Signed-off-by: Mark Towers <mark@anyscale.com> Signed-off-by: Mark Towers <mark.m.towers@gmail.com> Co-authored-by: Mark Towers <mark@anyscale.com> Co-authored-by: Justin Yu <justinvyu@anyscale.com>
…ckpoint` (ray-project#58537) RLlib uses nested metric structure (like `"{ENV_RUNNER_RESULTS}/{EPISODE_RETURN_MEAN}"`) which `Result.get_best_checkpoint` doesn't support. Following `ResultGrid.get_best_result()` to use `unflattened_lookup`, I've added that to `get_best_checkpoint` along with testing for nested structures (and its backward compatibility) --------- Signed-off-by: Mark Towers <mark@anyscale.com> Signed-off-by: Mark Towers <mark.m.towers@gmail.com> Co-authored-by: Mark Towers <mark@anyscale.com> Co-authored-by: Justin Yu <justinvyu@anyscale.com> Signed-off-by: YK <1811651+ykdojo@users.noreply.github.com>
…ckpoint` (ray-project#58537) RLlib uses nested metric structure (like `"{ENV_RUNNER_RESULTS}/{EPISODE_RETURN_MEAN}"`) which `Result.get_best_checkpoint` doesn't support. Following `ResultGrid.get_best_result()` to use `unflattened_lookup`, I've added that to `get_best_checkpoint` along with testing for nested structures (and its backward compatibility) --------- Signed-off-by: Mark Towers <mark@anyscale.com> Signed-off-by: Mark Towers <mark.m.towers@gmail.com> Co-authored-by: Mark Towers <mark@anyscale.com> Co-authored-by: Justin Yu <justinvyu@anyscale.com>
…ckpoint` (ray-project#58537) RLlib uses nested metric structure (like `"{ENV_RUNNER_RESULTS}/{EPISODE_RETURN_MEAN}"`) which `Result.get_best_checkpoint` doesn't support. Following `ResultGrid.get_best_result()` to use `unflattened_lookup`, I've added that to `get_best_checkpoint` along with testing for nested structures (and its backward compatibility) --------- Signed-off-by: Mark Towers <mark@anyscale.com> Signed-off-by: Mark Towers <mark.m.towers@gmail.com> Co-authored-by: Mark Towers <mark@anyscale.com> Co-authored-by: Justin Yu <justinvyu@anyscale.com> Signed-off-by: peterxcli <peterxcli@gmail.com>
Description
RLlib uses nested metric structure (like
"{ENV_RUNNER_RESULTS}/{EPISODE_RETURN_MEAN}") whichResult.get_best_checkpointdoesn't support.Following
ResultGrid.get_best_result()to useunflattened_lookup, I've added that toget_best_checkpointalong with testing for nested structures (and its backward compatibility)Reproduction script
Related issues
#57533