-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedOpen to be worked onOpen to be worked on
Description
🐛 Bug
https://github.com/PyTorchLightning/pytorch-lightning/blob/7114c2d570e689cdddc6d321ad29189d54184743/pytorch_lightning/utilities/argparse.py#L157-L160 will override the parent_parser so the sub parser will not work as expected. Please see the code in reproduce section.
I think the current version from master with use_argument_group=True will fix this. https://github.com/PyTorchLightning/pytorch-lightning/blob/efce2b77779467884df9a3d9c16c3176ea81a650/pytorch_lightning/utilities/argparse.py#L190-L197
Please reproduce using the BoringModel
To Reproduce
in a cli.py file
import argparse
import pytorch_lightning as pl
parser = argparse.ArgumentParser("")
sub_parsers = parser.add_subparsers()
train_parser = sub_parsers.add_parser("train")
train_parser.add_argument("--seed")
train_parser = pl.Trainer.add_argparse_args(train_parser)
args = parser.parse_args()Run python cli.py train --help will not show the training flags for Trainer
Expected behavior
Run python cli.py train --help show the training flags for Trainer
Environment
- PyTorch Version (e.g., 1.0): 1.7.0
- OS (e.g., Linux): MacOS Big Sur 11.2.3
- How you installed PyTorch (
conda,pip, source): conda - Python version: 3.7.10
Additional context
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedOpen to be worked onOpen to be worked on