'How to reload hydra config with enumerations

Is there a better way to reload a hydra config from an experiment with enumerations? Right now I reload it like so:

initialize_config_dir(config_dir=exp_dir, ".hydra"), job_name=config_name)
cfg = compose(config_name, overrides=overrides)
print(cfg.enum)
>>> ENUM1

But ENUM1 is actually an enumeration that normally loads as

>>> <SomeEnumClass.ENUM1: 'enum1'>

I am able to fix this by adding a configstore default to the experiment hydra file:

defaults:
  - base_config_cs

Which now results in

initialize_config_dir(config_dir=exp_dir, ".hydra"), job_name=config_name)
cfg = compose(config_name, overrides=overrides)
print(cfg.enum)
>>> <SomeEnumClass.ENUM1: 'enum1'>

Is there a better way to do this without adding this? Or can I add the default in the python code?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source