You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I've been using Optuna successfully to run studies for one objective only. I've been trying a multi objective study but whatever I try I keep running into the same error. I'm writing here in hopes that someone might know if what I'm trying to do is possible or if I'm configuring something wrong.
I'm creating a study with a postgresql storage backend:
study = optuna.create_study(directions=["maximize", "maximize"], study_name=study_name, storage="posgresdb config")
I've also tried with TPESampler and with NSGAIISampler (and even a GPSampler) in different configurations but I always get the exact same error from bellow.
I run this over a number of processes in parallel ( for single objective i've ran 100 processes in parallel with no issues) with n_trials = 300. I have a big hyperparameter space that I'm working with and running in parallel is a must for me because of the time it would take to run this one at a time would be just unworkable.
Everything seems to run ok for the fist trial on each of the process but then on the 2nd trial this error is always raised:
[W 2025-06-15 23:51:48,779] Trial 149 failed with value None.
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/lib/python3.12/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
^^^^^^^^^^^^^^^^^^^
File "/home/nadejde/trading/optuna_trials.py", line 184, in run_optuna_process
study.optimize(objective, n_trials=n_trials, gc_after_trial=True)
File "/home/nadejde/trading/.venv/lib/python3.12/site-packages/optuna/study/study.py", line 475, in optimize
_optimize(
File "/home/nadejde/trading/.venv/lib/python3.12/site-packages/optuna/study/_optimize.py", line 63, in _optimize
_optimize_sequential(
File "/home/nadejde/trading/.venv/lib/python3.12/site-packages/optuna/study/_optimize.py", line 160, in _optimize_sequential
frozen_trial = _run_trial(study, func, catch)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nadejde/trading/.venv/lib/python3.12/site-packages/optuna/study/_optimize.py", line 248, in _run_trial
raise func_err
File "/home/nadejde/trading/.venv/lib/python3.12/site-packages/optuna/study/_optimize.py", line 197, in _run_trial
value_or_values = func(trial)
^^^^^^^^^^^
File "/home/nadejde/trading/optuna_trials.py", line 141, in objective
suggested_value = trial.suggest_categorical(key, values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nadejde/trading/.venv/lib/python3.12/site-packages/optuna/trial/_trial.py", line 402, in suggest_categorical
return self._suggest(name, CategoricalDistribution(choices=choices))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nadejde/trading/.venv/lib/python3.12/site-packages/optuna/trial/_trial.py", line 627, in _suggest
elif self._is_relative_param(name, distribution):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nadejde/trading/.venv/lib/python3.12/site-packages/optuna/trial/_trial.py", line 659, in _is_relative_param
if name not in self.relative_params:
^^^^^^^^^^^^^^^^^^^^
File "/home/nadejde/trading/.venv/lib/python3.12/site-packages/optuna/trial/_trial.py", line 71, in relative_params
self._relative_params = self.study.sampler.sample_relative(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nadejde/trading/.venv/lib/python3.12/site-packages/optuna/samplers/nsgaii/_sampler.py", line 269, in sample_relative
parent_population = self.get_parent_population(study, generation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nadejde/trading/.venv/lib/python3.12/site-packages/optuna/samplers/_ga/_base.py", line 174, in get_parent_population
return [trials[trial_id] for trial_id in cached_parent_population_ids]
~~~~~~^^^^^^^^^^
IndexError: list index out of range
I've tried running a single process for this and things seem to work fine as a single process. Is there any way to get the multi objective study to work over multiple processes please?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello. I've been using Optuna successfully to run studies for one objective only. I've been trying a multi objective study but whatever I try I keep running into the same error. I'm writing here in hopes that someone might know if what I'm trying to do is possible or if I'm configuring something wrong.
I'm creating a study with a postgresql storage backend:
study = optuna.create_study(directions=["maximize", "maximize"], study_name=study_name, storage="posgresdb config")
I've also tried with TPESampler and with NSGAIISampler (and even a GPSampler) in different configurations but I always get the exact same error from bellow.
I run this over a number of processes in parallel ( for single objective i've ran 100 processes in parallel with no issues) with n_trials = 300. I have a big hyperparameter space that I'm working with and running in parallel is a must for me because of the time it would take to run this one at a time would be just unworkable.
Everything seems to run ok for the fist trial on each of the process but then on the 2nd trial this error is always raised:
I've tried running a single process for this and things seem to work fine as a single process. Is there any way to get the multi objective study to work over multiple processes please?
Beta Was this translation helpful? Give feedback.
All reactions