# Skopt \`resume\` incorrectly finished when trying to run more \`num\_samples\`

**URL:** <https://discuss.ray.io/t/skopt-resume-incorrectly-finished-when-trying-to-run-more-num-samples/2252>\
**Category:** Ray Tune\
**Created:** [May 21, 2021, 8:14pm UTC](https://discuss.ray.io/t/skopt-resume-incorrectly-finished-when-trying-to-run-more-num-samples/2252 "2021-05-21T20:14:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickvazz](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/nickvazz/32/1028_2.png) [@nickvazz](https://discuss.ray.io/u/nickvazz)\
**Post date:** [May 21, 2021, 8:14pm UTC](https://discuss.ray.io/t/skopt-resume-incorrectly-finished-when-trying-to-run-more-num-samples/2252/1 "2021-05-21T20:14:43Z")

</div>

Hi, I have started using ray.tune to run some optimizations and have been running into issues have the resume work properly.

```python
search_alg = SkOptSearch(
    metric='metric', 
    mode='min',
)

analysis = tune.run(
        func,
        config=tune_config,
        num_samples=20,
        search_alg=search_alg,
        raise_on_failed_trial=False,
        name='run_name',
        verbose=0,
        resume=False,
    )

```

And then trying to resume with more samples:

```python
search_alg = SkOptSearch(
    metric='metric', 
    mode='min',
)

analysis = tune.run(
        func,
        config=tune_config,
        num_samples=50,
        search_alg=search_alg,
        raise_on_failed_trial=False,
        name='run_name',
        verbose=0,
        resume=True,
    )

```

But it ends up thinking that the run has already finished. Am I doing something funky here?

---

<div class="post-metadata">

**Author:** ![rliaw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rliaw/32/24_2.png) [@rliaw](https://discuss.ray.io/u/rliaw)\
**Post date:** [May 21, 2021, 8:21pm UTC](https://discuss.ray.io/t/skopt-resume-incorrectly-finished-when-trying-to-run-more-num-samples/2252/2 "2021-05-21T20:21:40Z")

</div>

Hmm, would it be possible instead to try doing:

```auto
search_alg = SkOptSearch(
    metric='metric', 
    mode='min',
)

tune.run(func, search_alg=search_alg, ...)
search_alg.save("path")

```

Then upon restore:

```auto
search_alg2 = SkOptSearch(...)
search_alg2.restore("path")

tune.run(func, search_alg=search_alg2, ...)
```
