It’s straightforward to parallelize optuna.study.Study.optimize()
.
If you want to manually execute Optuna optimization:
start an RDB server (this example uses MySQL)
create a study with
--storage
argumentshare the study among multiple nodes and processes
Of course, you can use Kubernetes as in the kubernetes examples.
To just see how parallel optimization works in Optuna, check the below video.
Create a StudyYou can create a study using optuna create-study
command. Alternatively, in Python script you can use optuna.create_study()
.
$ mysql -u root -e "CREATE DATABASE IF NOT EXISTS example" $ optuna create-study --study-name "distributed-example" --storage "mysql://root@localhost/example" [I 2020-07-21 13:43:39,642] A new study created with name: distributed-example
Then, write an optimization script. Let’s assume that foo.py
contains the following code.
import optuna def objective(trial): x = trial.suggest_float("x", -10, 10) return (x - 2) ** 2 if __name__ == "__main__": study = optuna.load_study( study_name="distributed-example", storage="mysql://root@localhost/example" ) study.optimize(objective, n_trials=100)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4