The following works:
trainer = pl.Trainer(early_stop_callback=hydra.utils.instantiate(cfg.callbacks.early_stopping),
**cfg.trainer)
But it makes early_stopping
a required parameter. Is there a better way or a way to specify all this in the configuration with something similar to the following?
$ cat trainer.yaml
trainer:
cls: pytorch_lightning.Trainer
params:
early_stop_callback: instantiate(cfg.callbacks.early_stopping)
So that I can do:
trainer = hydra.utils.instantiate(cfg.trainer)
Hydra 1.1.0 (2021-06-09) now supports recursive instantiation, see the CHANGELOG, and in particular this issue.