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

error showing studies #679

Open
MertensDev opened this issue Nov 3, 2023 · 2 comments
Open

error showing studies #679

MertensDev opened this issue Nov 3, 2023 · 2 comments
Labels
bug Something isn't working no-stale Exempt from stale bot

Comments

@MertensDev
Copy link

MertensDev commented Nov 3, 2023

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:[email protected]: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

@MertensDev MertensDev added the bug Something isn't working label Nov 3, 2023
@keisuke-umezawa keisuke-umezawa added the no-stale Exempt from stale bot label Nov 5, 2023
@contramundum53
Copy link
Member

contramundum53 commented Dec 20, 2023

@MertensDev Thanks for your bug report!
Could you give us the reproducible code for optimization? If you could make it shorter, that would be better.

@adjeiv
Copy link
Contributor

adjeiv commented Dec 24, 2023

I think optuna/optuna#5113 is relevant; I would guess you might be using a list rather than a dictionary for the parameters, which end up as the fixed_params that is expected to be a dictionary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-stale Exempt from stale bot
Projects
None yet
Development

No branches or pull requests

4 participants