Linking arguments after loading a data module? #15613
-
|
I have a lightning module (model) that needs an argument to come from the DataModule (eg. batch_size). This works great when I explicitly define the data module that needs to be used: class demo_cli(LightningCLI):
def add_arguments_to_parser(self, parser):
parser.link_arguments("data.batch_size", "model.batch_size")
cli = demo_cli(LightningModule, DataModule) If I however have multiple data modules, and attempt this, there appears to be no way to link arguments from DataModules loaded dynamically via the command line / config files as described in this section of the docs. Any ideas? cli = demo_cli(LightningModule, subclass_mode_data=True) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
The parser.link_arguments("data.init_args.batch_size", "model.batch_size") |
Beta Was this translation helpful? Give feedback.
The
link_argument's source and target keys follow the same structure as the config files. If only the data is in subclass mode, not the model, then the link would be as: