# Override \`num\_samples\` when restoring model

**URL:** <https://discuss.ray.io/t/override-num-samples-when-restoring-model/8393>\
**Category:** Ray Tune\
**Created:** [November 22, 2022, 1:52pm UTC](https://discuss.ray.io/t/override-num-samples-when-restoring-model/8393 "2022-11-22T13:52:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aRI0U](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@aRI0U](https://discuss.ray.io/u/aRI0U)\
**Post date:** [November 22, 2022, 1:52pm UTC](https://discuss.ray.io/t/override-num-samples-when-restoring-model/8393/1 "2022-11-22T13:52:51Z")

</div>

**How severe does this issue affect your experience of using Ray?**

- Medium: It contributes to significant difficulty to complete my task, but I can work around it.

Hi,

I am currently trying to finetune a model using Ray Tune and Optuna. Let’s say I have run an experiment of 10 runs that gave me an overview of what good hyperparameters but not good enough parameters. Is there a way to restore this experiment but increasing `num_samples` so that it keeps on looking for good hyperparameters but keeping the knowledge of the previous runs so that it does not lose this previous knowledge.

Does anyone has an idea how to do it? Thanks a lot

---

<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 22, 2022, 5:26pm UTC](https://discuss.ray.io/t/override-num-samples-when-restoring-model/8393/2 "2022-11-22T17:26:39Z")

</div>

Hi @aRI0U,

1. Here’s how you can restore a search algorithm and pass it into a new Tune experiment with more samples: [[Tune] Scope of `Tuner.restore()` functionality is unclear in docs · Issue #30223 · ray-project/ray · GitHub](https://github.com/ray-project/ray/issues/30223#issuecomment-1316303445). Currently, creating a new experiment is the only way to generate new samples - restoration is meant only for resuming an interrupted experiment and finishing the exact hyperparameter optimization job that was originally specified.

2. It’s also possible to take hyperparameters from a previous experiment as the starting point for a new one, by specifying `points_to_evaluate`. See this guide for an example: [Running Tune experiments with Optuna — Ray 2.1.0](https://docs.ray.io/en/latest/tune/examples/optuna_example.html#providing-an-initial-set-of-hyperparameters)

---

<div class="post-metadata">

**Author:** ![aRI0U](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@aRI0U](https://discuss.ray.io/u/aRI0U)\
**Post date:** [November 23, 2022, 1:35pm UTC](https://discuss.ray.io/t/override-num-samples-when-restoring-model/8393/3 "2022-11-23T13:35:42Z")

</div>

First solution you proposed is exactly what I was looking for, thanks!
