Ray在调用agent.train()
的过程中保存了一堆检查点。我如何知道哪个检查点是最适合加载代理的检查点?有没有像tune-analysis-output.get_best_checkpoint(path, mode="max")
这样的函数来探索检查点上不同的加载可能性?
发布于 2021-08-10 05:16:04
正如在https://discuss.ray.io/t/ray-restore-checkpoint-in-rllib/3186/2中回答的那样,您可以使用:
analysis = tune.Analysis(experiment_path) # can also be the result of `tune.run()`
trial_logdir = analysis.get_best_logdir(metric="metric", mode="max") # Can also just specify trial dir directly
checkpoints = analysis.get_trial_checkpoints_paths(trial_logdir) # Returns tuples of (logdir, metric)
best_checkpoint = analysis.get_best_checkpoint(trial_logdir, metric="metric", mode="max")
请参阅https://docs.ray.io/en/master/tune/api_docs/analysis.html#id1
https://stackoverflow.com/questions/68726188
复制