Lightning-AI / pytorch-lightning

Pretrain, finetune and deploy AI models on multiple GPUs, TPUs with zero code changes.

Home Page:https://lightning.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamically link arguments in `LightningCLI`?

EthanMarx opened this issue · comments

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

cc @Borda @carmocca @mauvilsa

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 a compute_fn that depending on the selected subclass returns particular values, which would then be set to the target.

Ah. That first point is what I'm looking for! Thanks for the clarification!