Search code examples
fb-hydra

Confirm recursive instantiation will allow hierarchical object instantiation


I'd like to be able to write a yaml file something like:

runner:
    _target_: my_module.Runner
    lightning_module:
        _target_: my_module.MyLightingModule
        precision: 16
    data_module:
        _target_: my_module.MyDataModule
        training_data: s3://foo/bar.csv
        validation_data: s3://foo/bar_val.csv
        test_data: s3://foo/bar_tst.csv

and then in my program run this whole thing by doing simply:

runner = hydra.utils.instantiate(cfg)
runner.run()

I see there is a PR to enable recursive instantiation, ie https://github.com/facebookresearch/hydra/pull/989 Please can you confirm that this will enable the code/config above?

Also, what is intended release date for this merged PR?

(I feel kind of a little bit non-standard putting questions which are basically feature requests into stackoverflow, so if you have a better suggestion on where to put these, please let me know)


Solution

  • Go ahead and check-out Hydra from master and play with the recursive instantiation support to confirm for yourself.

    The docs for instantiate in the next version are here.

    There is no set date for 1.1. but it will be a while. At some point there will be some dev releases though. For now you can install from master.