Skip to content

error showing studies #679

Description

@MertensDev

Description

Starting the dashboard works fine, both with sqlite and mysql.
When I open the dashboard in the browser i see

Failed to fetch study (reason=internal server error)

The logs show the following:

Exception: 'list' object has no attribute 'get'
  File "/Users/username/projects/project/.env/lib/python3.9/site-packages/optuna_dashboard/_bottle_util.py", line 31, in decorated
    response_body = view(*args, **kwargs)

  File "/Users/username/projects/project/.env/lib/python3.9/site-packages/optuna_dashboard/_app.py", line 227, in get_study_detail
    return serialize_study_detail(

  File "/Users/username/projects/project/.env/lib/python3.9/site-packages/optuna_dashboard/_serializer.py", line 152, in serialize_study_detail
    serialized["trials"] = [

  File "/Users/username/projects/project/.env/lib/python3.9/site-packages/optuna_dashboard/_serializer.py", line 153, in <listcomp>
    serialize_frozen_trial(summary._study_id, trial, system_attrs) for trial in trials

  File "/Users/username/projects/project/.env/lib/python3.9/site-packages/optuna_dashboard/_serializer.py", line 240, in serialize_frozen_trial
    "fixed_params": [

  File "/Users/username/projects/project/.env/lib/python3.9/site-packages/optuna_dashboard/_serializer.py", line 241, in <listcomp>
    {"name": param_name, "param_external_value": str(fixed_params.get(param_name, None))}

How to Reproduce

  1. Optuna's objective function is
def tpe_objective_fn(trial, observations):
    num_steps = observations["lb"].shape[0]
    num_heat_sources = observations["lb"].shape[1]
    lb = observations["lb"].flatten()
    ub = observations["ub"].flatten()
    chosen_parameters = []
    for step in range(num_steps):
        for idx in range(num_heat_sources):
            chosen_parameters.append(
                trial.suggest_float(f"tech_param_{step}_{idx}", lb[idx], ub[idx])
            )

    cost = cost_function(
        chosen_parameters,
        num_steps,
    )
    return cost
  1. Run optuna-dashboard with optuna-dashboard mysql://user:password@127.0.0.1:3307/optuna
  2. Open http://127.0.0.1:8080/ page.
  3. An error occurs.

Python version

3.9.6

Optuna version

3.4.0

optuna-dashboard version or git revision

0.13.0

Web browser

Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingno-staleExempt from stale bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions