Epistimio / hydra_orion_sweeper

Hydra Sweeper Plugin for Orion
7 stars 2 forks source link

Key error in PB2 with hydra. #16

Closed d3sm0 closed 1 year ago

d3sm0 commented 1 year ago

How to replicate: replace gridsearch with pb2 in the repo example.

Error:

 values = [trial.params[key] for key in self.space.keys()]
KeyError: 'optimizer.lr'

https://github.com/Epistimio/orion/blob/06e6be9fc9021a15c9dd45e4a4361a85dcfc0016/src/orion/algo/pbt/pb2.py#L292

The parsed space from hydra returns optimizer.lr but trial.params is a dict {optimizer:{lr:value}} hence the key error.

Delaunay commented 1 year ago

Which version of orion are you using ?

d3sm0 commented 1 year ago
~pip show orion
Name: orion
Version: 0.2.6
Summary: Asynchronous [black-box] Optimization
Home-page: https://github.com/epistimio/orion
Author: Epistímio
Author-email: xavier.bouthillier@umontreal.ca
License: BSD-3-Clause
Location: /home/d3sm0/.venvs/torch_env/lib/python3.10/site-packages
Requires: AppDirs, cloudpickle, falcon, falcon-cors, filelock, gitpython, gunicorn, joblib, kaleido, numpy, pandas, plotly, psutil, pymongo, pytest, PyYAML, requests, scikit-learn, scikit-optimize, scipy, tabulate
Required-by: hydra-orion-sweeper
Delaunay commented 1 year ago

PB2 works on the CI, I am not sure where your issue is coming from, but it is not from the plugin

https://github.com/Epistimio/hydra_orion_sweeper/pull/17