Skip to content

Pattern for specifying modules in argument parser versus CLI #12574

Discussion options

You must be logged in to vote

If you truly want to have both, you could do activation: Union[str, nn.Module] and use the literal_eval only if an str is received. But even if you do this, there is little reason to keep using add_model_specific_args since with LightningCLI you could also give an str instead of the class_path and init_args pair.

Regarding "i.e. putting the components together yourself, multiple optimizers, etc. which has a bit more flexibility" best if you give more details about what you want to do, and then see if it makes sense or not to use LightningCLI.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@laserkelvin
Comment options

@mauvilsa
Comment options

Answer selected by laserkelvin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment