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 does not currently support recursive instantiation. This is planned for the next major version though, follow this issue .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.