-
Notifications
You must be signed in to change notification settings - Fork 7k
[RLlib] Cleanup examples folder #14: Add example script for how to resume a tune.Tuner.fit() experiment from a checkpoint. #45681
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
Conversation
Signed-off-by: sven1977 <[email protected]>
…nup_examples_folder_14_continue_training_from_checkpoint
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
simonsays1980
left a comment
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. Invaluable example for users!
| tuner = tune.Tuner( | ||
| trainable=config.algo_class, | ||
| param_space=config, | ||
| run_config=air.RunConfig( |
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.
In regard to the future deprecation of air: Can we use ray.train.RunConfig here instead?
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.
done
| param_space=config, | ||
| run_config=air.RunConfig( | ||
| callbacks=tune_callbacks, | ||
| checkpoint_config=air.CheckpointConfig( |
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.
Same here: can we use ray.train.CheckpointConfig?
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.
done
| results = tuner.fit() | ||
| experiment_name = Path(results.experiment_path).name | ||
|
|
||
| # Extract the latest checkpoint from the results and confirm it's the right one. |
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.
Let's state this comment differently. The get_best_result gets us only in this specific setup and only with a checkpoint frequency of 1 the latest checkpoint, otherwise we get the one with the highest episode_return_mean from whenever this happened.
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.
Ah, good catch! Yes, in this example, we should probably just use the last checkpoint, not necessarily the best. ...
| # TODO (simon): Change to -800 once the metrics are fixed. Currently | ||
| # the combined return is not correctly computed. | ||
| f"{ENV_RUNNER_RESULTS}/episode_return_mean": -400, | ||
| f"{ENV_RUNNER_RESULTS}/{EPISODE_RETURN_MEAN}": -800, |
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.
Great catch!
Signed-off-by: sven1977 <[email protected]>
…nup_examples_folder_14_continue_training_from_checkpoint
Signed-off-by: sven1977 <[email protected]>
…r how to resume a tune.Tuner.fit() experiment from a checkpoint. (ray-project#45681) Signed-off-by: Richard Liu <[email protected]>
Cleanup examples folder #14: Add example script for how to resume a tune.Tuner.fit() experiment from a checkpoint.
MetricsLogger.peek()(keyinstead of*keyto unify signature with all the other methods ofMetricsLogger).Why are these changes needed?
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.