pl.Trainer.add_argparse_args() does not work with argparse subparsers
🐛 Bug

  
    
      pytorch-lightning/pytorch_lightning/utilities/argparse.py
    
    
        Lines 157 to 160
      in
      7114c2d
    
  
  
    

        
          
           parser = ArgumentParser( 
        

        
          
               parents=[parent_parser], 
        

        
          
               add_help=False, 
        

        
          
           ) 
        
    
  

 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. 
  
    
      pytorch-lightning/pytorch_lightning/utilities/argparse.py
    
    
        Lines 190 to 197
      in
      efce2b7
    
  
  
    

        
          
           if use_argument_group: 
        

        
          
               group_name = get_abbrev_qualified_cls_name(cls) 
        

        
          
               parser = parent_parser.add_argument_group(group_name) 
        

        
          
           else: 
        

        
          
               parser = ArgumentParser( 
        

        
          
                   parents=[parent_parser], 
        

        
          
                   add_help=False, 
        

        
          
               ) 
        
    
  


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