Dynamically link arguments in `LightningCLI`?
EthanMarx opened this issue · comments
Ethan Marx commented
Description & Motivation
Is it possible to dynamically link arguments in the LightningCLI
, say, depending on the module or datamodule subclass that is specified in a config file or at the command line?
Pitch
No response
Alternatives
No response
Additional context
No response
Mauricio Villegas commented
Maybe more details are needed, since dynamically is a rather general term. Some dynamic linking that already work:
- When the target of a link is a parameter in a subclass, the link is only applied if the selected subclass have such parameter, otherwise the link is ignored.
- A link can have as source an entire subclass block. And links can have a
compute_fn
, see link_arguments. Thus, it is possible to implement acompute_fn
that depending on the selected subclass returns particular values, which would then be set to the target.
Ethan Marx commented
Ah. That first point is what I'm looking for! Thanks for the clarification!