Skip to content

Upgrading Optuna from v2.x.x to v3.0.0 #2162

@himkt

Description

@himkt

Sorry but it is not a feature request.

Related: optuna/optuna#2941

Summary

Thank you for integrating Optuna, hyperparameter optimization library. We, Optuna dev-team, are working on the next major version of the library Optuna v3. In Optuna v3, we will deprecate distributions used in:

from optuna.distributions import (
BaseDistribution,
CategoricalChoiceType,
CategoricalDistribution,
DiscreteUniformDistribution,
IntLogUniformDistribution,
IntUniformDistribution,
LogUniformDistribution,
UniformDistribution,
)

We will introduce FloatDistribution and IntDistribution. So distributions in hydra_optuna_sweeper will have to be updated:

  • UniformDistribution(low, high) => FloatDistribution(low, high)
  • DiscreteUniformDistribution(low, high, q) => FloatDistribution(low, high, step)
  • LogUniformDistribution(low, high) => FloatDistribution(low, high, log=True)
  • IntUniformDistribution(low, high) => IntDistribution(low, high)
  • IntUniformDistribution(low, high, step) => IntDistribution(low, high, step)
  • IntLogUniformDistribution(low, high) => IntDistribution(low, high, log=True)

Now hydra optuna plugin installs the latest Optuna. Users will see the deprecation warnings in the Optuna v3 release. #2163 restricts the constraint to avoid such warnings. Note that it doesn't mean Optuna v3 is imcompatible with Optuna v2. It only shows warnings and deprecated distributions are internally converted to appropriate distributions.

root@b9ffe3ebef50:/work/plugins/hydra_optuna_sweeper# python example/sphere.py --multirun
/work/plugins/hydra_optuna_sweeper/hydra_plugins/hydra_optuna_sweeper/_impl.py:109: FutureWarning: DiscreteUniformDistribution 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 :class:`~optuna.distributions.FloatDistribution` instead.
  return DiscreteUniformDistribution(value.start, value.stop, value.step)
[I 2022-04-20 06:13:41,041] A new study created in memory with name: sphere
[2022-04-20 06:13:41,042][HYDRA] Study name: sphere
[2022-04-20 06:13:41,043][HYDRA] Storage: None
[2022-04-20 06:13:41,043][HYDRA] Sampler: TPESampler
[2022-04-20 06:13:41,043][HYDRA] Directions: ['minimize']

Motivation

I open this issue to let hydra developers know about our next major release.
And also, I will open a PR to add a version constraint to avoid installing Optuna v3.

We will back here when the release is available.

If you have some concerns or questions, please feel free to contact Optuna dev-team.
🔗 optuna/optuna#2941

Additional context

Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions