# Loading experiment analysis from a different machine than the experiment was run with

**URL:** <https://discuss.ray.io/t/loading-experiment-analysis-from-a-different-machine-than-the-experiment-was-run-with/12397>\
**Category:** Ray Tune\
**Created:** [October 10, 2023, 3:29pm UTC](https://discuss.ray.io/t/loading-experiment-analysis-from-a-different-machine-than-the-experiment-was-run-with/12397 "2023-10-10T15:29:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![luzgui](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/luzgui/32/2281_2.png) [@luzgui](https://discuss.ray.io/u/luzgui)\
**Post date:** [October 10, 2023, 3:29pm UTC](https://discuss.ray.io/t/loading-experiment-analysis-from-a-different-machine-than-the-experiment-was-run-with/12397/1 "2023-10-10T15:29:58Z")

</div>

hello, I am training a PPO agent with RLlib in one machine using windows and then I copy the experiment folder to a different machine with Linux for testing purposes.

To get the analysis object I perform the following operation hoping to be able to get `get_best_trial()` and `get_best_checkpoint()` and thenafter be able to build the PPO algorithm from the checkpoint:

```auto
analysis_object = ExperimentAnalysis(Linux_experiment_path,
                                         default_metric=metric, 
                                         default_mode=mode)

```

However, `analysis_object` path always refers to the original windows path producing errors.

What is the proper workflow in this case?

---

<div class="post-metadata">

**Author:** ![fardinabbasi](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/fardinabbasi/32/5085_2.png) [@fardinabbasi](https://discuss.ray.io/u/fardinabbasi)\
**Post date:** [October 21, 2023, 1:16pm UTC](https://discuss.ray.io/t/loading-experiment-analysis-from-a-different-machine-than-the-experiment-was-run-with/12397/2 "2023-10-21T13:16:49Z")

</div>

same [issue](https://discuss.ray.io/t/restoring-agent-with-ray-tune/12525)!  
Please let me know if you find a solution.

---

<div class="post-metadata">

**Author:** ![justinvyu](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/justinvyu/32/4309_2.png) [@justinvyu](https://discuss.ray.io/u/justinvyu)\
**Post date:** [October 23, 2023, 6:57pm UTC](https://discuss.ray.io/t/loading-experiment-analysis-from-a-different-machine-than-the-experiment-was-run-with/12397/3 "2023-10-23T18:57:53Z")

</div>

This is a known issue that’s being tracked here: [[Train/Tune] Restore an experiment from a different machine/path · Issue #40585 · ray-project/ray · GitHub](https://github.com/ray-project/ray/issues/40585)

Targeting a fix for Ray 2.9, but will keep this thread updated if a nightly is available earlier for you to use. Thanks for raising this issue.

---

<div class="post-metadata">

**Author:** ![luzgui](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/luzgui/32/2281_2.png) [@luzgui](https://discuss.ray.io/u/luzgui)\
**Post date:** [October 23, 2023, 9:20pm UTC](https://discuss.ray.io/t/loading-experiment-analysis-from-a-different-machine-than-the-experiment-was-run-with/12397/4 "2023-10-23T21:20:50Z")

</div>

Thank you very much @justinvyu  
I am glad is something identified.  
I have been trying to solve this for days before advancing since If I started to train models on the remote machine I could not load checkpoints on my local machine and test analyse, etc

---

<div class="post-metadata">

**Author:** ![justinvyu](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/justinvyu/32/4309_2.png) [@justinvyu](https://discuss.ray.io/u/justinvyu)\
**Post date:** [November 3, 2023, 1:07am UTC](https://discuss.ray.io/t/loading-experiment-analysis-from-a-different-machine-than-the-experiment-was-run-with/12397/5 "2023-11-03T01:07:48Z")

</div>

This should be fixed in the nightly version of ray by this PR: [[tune/train] Restore Tuner and results properly from moved storage path by justinvyu · Pull Request #40647 · ray-project/ray · GitHub](https://github.com/ray-project/ray/pull/40647).

[https://docs.ray.io/en/latest/ray-overview/installation.html](https://docs.ray.io/en/latest/ray-overview/installation.html)

Let me know if you get the chance to try it out!

---

<div class="post-metadata">

**Author:** ![luzgui](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/luzgui/32/2281_2.png) [@luzgui](https://discuss.ray.io/u/luzgui)\
**Post date:** [November 4, 2023, 10:44am UTC](https://discuss.ray.io/t/loading-experiment-analysis-from-a-different-machine-than-the-experiment-was-run-with/12397/6 "2023-11-04T10:44:17Z")

</div>

Thank you very much. As soon as I try I will inform here.  
Best

---

<div class="post-metadata">

**Author:** ![lassefschmidt](https://avatars.discourse-cdn.com/v4/letter/l/34f0e0/32.png) [@lassefschmidt](https://discuss.ray.io/u/lassefschmidt)\
**Post date:** [December 5, 2023, 1:12pm UTC](https://discuss.ray.io/t/loading-experiment-analysis-from-a-different-machine-than-the-experiment-was-run-with/12397/7 "2023-12-05T13:12:16Z")

</div>

I face a similar issue. I created all my trials using ray 2.6.1 and could perfectly analyse them. Now I want to hand off the code to others but I see that no one can open my experiments. Even myself, when I create a new virtual environment, I cannot open the experiments anymore. (RuntimeError: Can’t return results as experiment has not been run, yet. Call `Tuner.fit()` to run the experiment first.)

Is there any workaround to this ? Tried opening the experiments using ray 2.6.1 and also the most recent 2.8.1 - same error each time.

Just re-running the experiments is not an option, so it would be quite painful to lose this data.

For reference, I am using this function to load a given experiment.

```auto
def open_validate_ray_experiment(experiment_path, trainable):
    # open & read experiment folder
    print(f"Loading results from {experiment_path}...")
    restored_tuner = tune.Tuner.restore(experiment_path, trainable = trainable, resume_unfinished = False)
    result_grid = restored_tuner.get_results()
    print("Done!\n")

    # Check if there have been errors
    if result_grid.errors:
        print(f"At least one of the {len(result_grid)} trials failed!")
    else:
        print(f"No errors! Number of terminated trials: {len(result_grid)}")
        
    return restored_tuner, result_grid

```

---

<div class="post-metadata">

**Author:** ![justinvyu](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/justinvyu/32/4309_2.png) [@justinvyu](https://discuss.ray.io/u/justinvyu)\
**Post date:** [January 4, 2024, 11:47pm UTC](https://discuss.ray.io/t/loading-experiment-analysis-from-a-different-machine-than-the-experiment-was-run-with/12397/8 "2024-01-04T23:47:20Z")

</div>

The PR above should apply to Ray 2.9+. Let me know if you’re able to upgrade and try it out @lassefschmidt
