# Rllib use checkpoint to run my simulation

**URL:** <https://discuss.ray.io/t/rllib-use-checkpoint-to-run-my-simulation/8421>\
**Category:** Configure Algorithm, Training, Evaluation, Scaling\
**Created:** [November 24, 2022, 2:28am UTC](https://discuss.ray.io/t/rllib-use-checkpoint-to-run-my-simulation/8421 "2022-11-24T02:28:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wangjunhe8127](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/wangjunhe8127/32/3329_2.png) [@wangjunhe8127](https://discuss.ray.io/u/wangjunhe8127)\
**Post date:** [November 24, 2022, 2:28am UTC](https://discuss.ray.io/t/rllib-use-checkpoint-to-run-my-simulation/8421/1 "2022-11-24T02:28:36Z")

</div>

Hi, I want to know that when i get a checkpoint, then how can i use it in my simulation?  
and ,I want to know that can i use pytorch:model.load() from checkpoint files?  
Thank you very much~

---

<div class="post-metadata">

**Author:** ![arturn](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/arturn/32/2096_2.png) [@arturn](https://discuss.ray.io/u/arturn)\
**Post date:** [November 30, 2022, 9:50pm UTC](https://discuss.ray.io/t/rllib-use-checkpoint-to-run-my-simulation/8421/2 "2022-11-30T21:50:39Z")

</div>

There are several methods to restore from checkpoint, but they never involve model.load() on the surface, only under the hood.

```auto
my_restored_policy = Policy.from_checkpoint("/tmp/my_policy_checkpoint")

# Use the restored policy for serving actions.
obs = np.array([1, 2, 3]) 
action = my_restored_policy.compute_single_action(obs)

```

You can do something like this. Or like this:

```auto
tuner = tune.Tuner(
        [...]
    )
    results = tuner.fit()
    checkpoint = results.get_best_result().checkpoint
    algo = Algorithm.from_checkpoint(checkpoint)

```
