Saving and Restoring Ray run confusion

Hello, I am currently using Ray for hyperparam tuning. I want to save a HyperOpt run so that if I have time later, I can resume tuning from where I left off with new trials / samples. I see that HyperOpt has a save and restore functionality. I use this, and I print out hpopt_trials.trials to see if after restoring and running new trails, the trial count accumulates. It doesn’t. I’m wondering if this is expected behavior?

I.e, in the second code block from these Ray docs, shouldn’t hpopt_trials.trials at the end be trails from tuner1+tuner2?

Right now I have search_alg.save(“./my-checkpoint.pkl”) after tuner.fit(), and at the beginning of my project I have search_alg.restore(“./my-checkpoint.pkl”). After I restore and test hpopt_trials, it is always the # of trials from the previous run (no accumulation across trials). Any help is much appreciated. (Ray 2.2.0)

Hi rjs24, welcome to the Ray community. For your Ray Tune config, in the second script, if you ask Ray Tune for the same total number of samples (num_samples) that you already finished before, no new trials are ever requested, so the length of trials stays the same.

num_samples is cumulative per Tune run. It tells Tune how many distinct hyper‑parameter sets to evaluate in this particular run, not “how many more to add.” which is my understanding from reading the docs. From the docs: calling the tuner with num_samples=10 means “run ten trials in this experiment”.

So I think if you want to add more you can just increase num_samples by like 100 (or X) every time you restore, maybe that will add the amount you want?