Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Optuna 3.x to get rid of deprecation message #532

Closed
osma opened this issue Oct 7, 2021 · 4 comments · Fixed by #726
Closed

Update to Optuna 3.x to get rid of deprecation message #532

osma opened this issue Oct 7, 2021 · 4 comments · Fixed by #726
Assignees
Labels
Milestone

Comments

@osma
Copy link
Member

osma commented Oct 7, 2021

In recent versions of Annif (which use Optuna 2.8.0), running the annif hyperopt command with a --jobs parameter gives the following warning:

FutureWarning: `n_jobs` argument has been deprecated in v2.7.0. This feature will be removed in v4.0.0. See https://github.com/optuna/optuna/releases/tag/v2.7.0.

The Optuna documentation for the 2.7.0 release explains that process-based parallelism should be used instead (tutorial). But that would require a PostgreSQL or MySQL database (SQLite is possible but not recommended).

Another option is to keep using thread-level parallelism using ThreadPoolExecutor instead of the n_jobs parameter. That would be easier to implement at least.

@osma osma added the bug label Oct 7, 2021
@osma osma added this to the Short term milestone Oct 7, 2021
@osma
Copy link
Member Author

osma commented Feb 4, 2022

It seems that Optuna has decided to continue supporting the n_jobs parameter after all: optuna/optuna#2937
It is also possible that in the future it will become easier to run Optuna in parallel using real multiprocessing: optuna/optuna#2950

Both of these are on the Optuna version 3 roadmap.

So for now I think we should wait and see what happens on the Optuna side.

@osma osma modified the milestones: Short term, Long term Feb 4, 2022
@osma
Copy link
Member Author

osma commented Jan 30, 2023

Optuna 3 has been released (the current release is 3.1.0), the n_jobs option is still present, and even mentioned in the FAQ with the caveat that it's based on multi-threading which is hampered by the GIL. Process-based parallelism would probably be better, but that's a different story and issue.

I'll keep this issue open to remind us to update to Optuna 3.x, which should get rid of the deprecation message.

@osma osma changed the title Annif uses deprecated Optuna n_jobs parameter Update to Optuna 3.x to get rid of deprecation message Jan 30, 2023
@osma osma self-assigned this Jan 30, 2023
@juhoinkinen
Copy link
Member

In recent versions of Annif (which use Optuna 2.8.0), running the annif hyperopt command with a --jobs parameter gives the following warning:

FutureWarning: `n_jobs` argument has been deprecated in v2.7.0. This feature will be removed in v4.0.0. See https://github.com/optuna/optuna/releases/tag/v2.7.0.

When updating now to latest Optuna release, i.e. v3.3.0, the above is not shown, but a different one is:

FutureWarning: suggest_uniform has been deprecated in v3.0.0. This feature will be removed in v6.0.0. See https://github.com/optuna/optuna/releases/tag/v3.0.0. Use suggest_float instead.

When just updating to Optuna 3.3.0 unit tests pass. The migration guide tells that the (new) method trial.suggest_float(“x”, low, high) corresponds to the deprecated method trial.suggest_uniform(“x”, low, high).

@osma
Copy link
Member Author

osma commented Aug 14, 2023

The optuna/optuna#3930 tells that the (new) method trial.suggest_float(“x”, low, high) corresponds to the deprecated method trial.suggest_uniform(“x”, low, high).

Okay, let's switch to the new method then! I don't see why it wouldn't work.

@juhoinkinen juhoinkinen linked a pull request Aug 15, 2023 that will close this issue
@juhoinkinen juhoinkinen modified the milestones: Long term, 1.0 Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants