LightningCLI: add top-level argument #21021
adamjstewart
started this conversation in
General
Replies: 1 comment 3 replies
-
I got this working using: class MyLightningCLI(LightningCLI):
def init_parser(self, **kwargs):
parser = super().init_parser(**kwargs)
parser.add_argument('--version', action='version', version=f'%(prog)s {__version__}')
return parser I'm just wondering if this is the recommended solution or if there is an easier solution. This also seems to add the argument to all parsers and subparsers, not just the top-level parser. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm playing around with customizing
LightningCLI
according to https://lightning.ai/docs/pytorch/stable/cli/lightning_cli_expert.html. My code so far:It took me longer than I would like to admit to realize this, but this adds the flag to
myapp fit
, not tomyapp
.How would I add this argument to the top-level parser?
Beta Was this translation helpful? Give feedback.
All reactions