Compatibility fix with Hydra 1.1#3722
Conversation
96cb8ce to
a1333f1
Compare
| ) | ||
|
|
||
| super().__init__(cfg.optimizer) | ||
| super().__init__(getattr(cfg, "optimizer", None)) |
There was a problem hiding this comment.
This fails in some tests on Hydra 1.1 due to an OmegaConf 2.1 change making access to non existing fields behave like it does for objects and dicts (raises an exception).
|
will this have any effect on external configs (--config-dir + --config-name)? if not lgtm |
|
Not supposed to. |
|
@alexeib, can we get this merged soon? |
|
sure, can you just make diff from this? merging happens through fbcode, not here |
|
@jieru-hu has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
Hi! This line could be changed to |
|
@omry Could you please confirm if fairseq works with hydra-core==1.1? |
|
@rsxdalv, Nope. I am no longer involved with either. |
One of the changes in Hydra 1.1 is that the default composition order is changing.
This is documented here.
In Hydra 1.1, a config is overriding values introduced by the defaults list while in Hydra 1.0 - the defaults list was overriding the values in the config.
fairseq is currently depending on the previous behavior:
The class
FairseqConfigdefines config values, and it's expecting them to be overridden by the defaults list.This result in a different config being created when running
fairseq_cli/hydra_train.pywith Hydra 1.0 and with 1.1.Hydra 1.1 introduced the
_self_keyword in the defaults list to control the composition order. In order to achieve the behavior of Hydra 1.0,_self_should be added as the first item in the defaults list.To allow for a smoother migration, Hydra 1.0 is ignoring
_self_starting from 1.0.7 (previous versions will issue an error).This diff adds
_self_as the first item in the defaults list the fairseq config, and introduce a dependency a Hydra 1.0 version that is equal or newer to 1.0.7.Testing:
I ensured that the following yield the same composed config:
Default config with Hydra 1.0.6, 1.0.7 and 1.1.0
examples/wav2vec/config/finetuning/base_10h.yamlwith Hydra 1.0.6, 1.0.7 and 1.1.0.This can be achieved by outputing the generated config using
--cfg joband compating the outputs.