# Simple save() and load() interface for ray checkpoint

**URL:** <https://discuss.ray.io/t/simple-save-and-load-interface-for-ray-checkpoint/8697>\
**Category:** Checkpointing, Restoring\
**Created:** [December 18, 2022, 7:05pm UTC](https://discuss.ray.io/t/simple-save-and-load-interface-for-ray-checkpoint/8697 "2022-12-18T19:05:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhh210](https://avatars.discourse-cdn.com/v4/letter/z/ce73a5/32.png) [@zhh210](https://discuss.ray.io/u/zhh210)\
**Post date:** [December 18, 2022, 7:05pm UTC](https://discuss.ray.io/t/simple-save-and-load-interface-for-ray-checkpoint/8697/1 "2022-12-18T19:05:35Z")

</div>

Pytorch offers a very simple interface `torch.save()` and `torch.load()` to interact with checkpoints without requiring any knowledge about `config` or `env`. This is very useful when the checkpoint was saved by some legacy env/config that are no longer accessible. It appears that the ray checkpoints do have configs saved but when trying to use the `.restore()` method ray still requires to explicitly input env/config as arguments. Is it possible for ray to provide a simpler interface as what torch does?

---

<div class="post-metadata">

**Author:** ![amogkam](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/amogkam/32/17_2.png) [@amogkam](https://discuss.ray.io/u/amogkam)\
**Post date:** [December 20, 2022, 3:28am UTC](https://discuss.ray.io/t/simple-save-and-load-interface-for-ray-checkpoint/8697/2 "2022-12-20T03:28:32Z")

</div>

Thanks for the feedback @zhh210!

Could you elaborate more on what env and config you are talking about here?

I’m all for making the interface simpler- it would help if you could provide code snippets on what you’d like to do vs. how it’s currently being done with Ray Checkpoints to paint this picture more clearly.

---

<div class="post-metadata">

**Author:** ![zhh210](https://avatars.discourse-cdn.com/v4/letter/z/ce73a5/32.png) [@zhh210](https://discuss.ray.io/u/zhh210)\
**Post date:** [December 20, 2022, 10:19pm UTC](https://discuss.ray.io/t/simple-save-and-load-interface-for-ray-checkpoint/8697/6 "2022-12-20T22:19:29Z")

</div>

Thanks @amogkam. The interface has evolved a lot and I was referring to this legacy [issue](https://github.com/ray-project/ray/issues/8827) on github. I just found the improvement is actually in the recent release in [Ray 2.2.0](https://docs.ray.io/en/latest/rllib/rllib-training.html#basic-python-api)

> from ray.rllib.algorithms.algorithm import Algorithm  
> algo = Algorithm.from\_checkpoint(checkpoint\_path)

which is easier than the older Ray version that needs specifying explicitly the `config` and `env`:

> from ray.rllib.algorithms.ppo import PPO  
> algo = PPO(config=config, env=env\_class)  
> algo.restore(checkpoint\_path)

---

<div class="post-metadata">

**Author:** ![amogkam](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/amogkam/32/17_2.png) [@amogkam](https://discuss.ray.io/u/amogkam)\
**Post date:** [December 21, 2022, 11:28pm UTC](https://discuss.ray.io/t/simple-save-and-load-interface-for-ray-checkpoint/8697/7 "2022-12-21T23:28:21Z")

</div>

Ah got it, this is specially referring to RLlib checkpoints.

Glad that you find the new interface easier!
