Hi! I am interested in that feature as well, do you have any tips on where to start to implement it?
I looked at tune.config_parser but I couldn’t find where it is handling the grid search part.
Thanks!
I am also interested to hear more about this. The short way to save config with sweep options, would be just to store it in a python file and load it from there.
Any better solution?
Hey @MaximeBouton, thanks for your interest in implementing a solution!
ray.tune.search.variant_generator.generate_variants might be a good place to start:
@DeveloperAPI
def generate_variants(
unresolved_spec: Dict,
constant_grid_search: bool = False,
random_state: "RandomState" = None,
) -> Generator[Tuple[Dict, Dict], None, None]:
"""Generates variants from a spec (dict) with unresolved values.
There are two types of unresolved values:
Grid search: These define a grid search over values. For example, the
following grid search values in a spec will produce six distinct
variants in combination:
"activation": grid_search(["relu", "tanh"])
"learning_rate": grid_search([1e-3, 1e-4, 1e-5])
...
Yields:
(Dict of resolved variables, Spec object)
"""
In particular, it looks grid search is handled in _try_resolve:
def _try_resolve(v) -> Tuple[bool, Any]:
...
elif isinstance(v, dict) and len(v) == 1 and "grid_search" in v:
# Grid search values
grid_values = v["grid_search"]
return False, Categorical(grid_values).grid()
...