Repository: Lightning-AI/pytorch-lightning

Issue:
Trainer add args doesn't add default root dir
## 🐛 Bug
1. When using `parser = Trainer.add_argparse_args(parser)`, it's supposed to put all Trainer's arguments in the argparse with default values. Though currently it doesn't add `default_root_dir` and you get the error:

```
'Namespace' object has no attribute 'default_root_dir'
```
It does add `default_save_path` which is deprecated.


### To Reproduce
#### Code Sample
```python
import argparse
from pytorch_lightning import Trainer

parser = argparse.ArgumentParser(description='demo')
parser = Trainer.add_argparse_args(parser)
args = parser.parse_args()

print(args.default_root_dir)
```

A similar unit test could also be made, if not there already.

### Environment

```
* CUDA:
        - GPU:
                - GeForce RTX 2080 Ti
                - GeForce RTX 2080 Ti
                - GeForce RTX 2080 Ti
                - GeForce RTX 2080 Ti
                - GeForce RTX 2080 Ti
                - GeForce RTX 2080 Ti
                - GeForce RTX 2080 Ti
                - GeForce RTX 2080 Ti
        - available:         True
        - version:           10.1
* Packages:
        - numpy:             1.18.1
        - pyTorch_debug:     False
        - pyTorch_version:   1.4.0
        - pytorch-lightning: 0.7.3
        - tensorboard:       2.2.0
        - tqdm:              4.45.0
* System:
        - OS:                Linux
        - architecture:
                - 64bit
                -
        - processor:         x86_64
        - python:            3.6.7
        - version:           #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019
```


Discussion:
Did you tried to update to 0.7.5. Maybe it is already solved.
Hi @olineumann, yes updating did resolve this. However, the `profiler` arg is now broken. The same demo code above with `profiler` gives the same error `'Namespace' object has no attribute 'profiler'`.
What do you mean 'with profiler'? Do you mean Trainer(..., profiler=True)? But you don't initialize a Trainer.

Running your code or this below didn't crash with any error on my machine.
```python
import argparse
from pytorch_lightning import Trainer

parser = argparse.ArgumentParser(description='demo')
trainer = Trainer(profiler=True)
parser = trainer.add_argparse_args(parser)
args = parser.parse_args()

print(args.default_root_dir)
```

Maybe you could post the complete error message from the python interpreter. 
`add_argparse_args ` is supposed to add the args from trainer to parser. But it doesn't do that for a few args. In this case `profiler`, previously the issue was for `default_root_dir`.

Try the following code by running:
`python demo.py --profiler True` or  other possibly accepted way `python demo.py --profiler`  with the following code:

```python
import argparse
from pytorch_lightning import Trainer

trainer = Trainer()
parser = argparse.ArgumentParser(description='demo')
parser = trainer.add_argparse_args(parser)
args = parser.parse_args()

print(args.profiler)

```


Any update?

Resolving patch:
diff --git a/pytorch_lightning/trainer/trainer.py b/pytorch_lightning/trainer/trainer.py
--- a/pytorch_lightning/trainer/trainer.py
+++ b/pytorch_lightning/trainer/trainer.py
@@ -124,7 +124,7 @@ def __init__(
             num_sanity_val_steps: int = 5,
             truncated_bptt_steps: Optional[int] = None,
             resume_from_checkpoint: Optional[str] = None,
-            profiler: Optional[BaseProfiler] = None,
+            profiler: Optional[Union[BaseProfiler, bool]] = None,
             benchmark: bool = False,
             reload_dataloaders_every_epoch: bool = False,
             auto_lr_find: Union[bool, str] = False,
@@ -574,6 +574,7 @@ def get_init_arguments_and_types(cls) -> List[Tuple[str, Tuple, Any]]:
              ('process_position', (<class 'int'>,), 0),
              ('profiler',
               (<class 'pytorch_lightning.profiler.profilers.BaseProfiler'>,
+               <class 'bool'>,
                <class 'NoneType'>),
               None),
              ...
@@ -612,6 +613,32 @@ def add_argparse_args(cls, parent_parser: ArgumentParser) -> ArgumentParser:
 
         Only arguments of the allowed types (str, float, int, bool) will
         extend the `parent_parser`.
+
+        Examples:
+            >>> import argparse
+            >>> import pprint
+            >>> parser = argparse.ArgumentParser()
+            >>> parser = Trainer.add_argparse_args(parser)
+            >>> args = parser.parse_args([])
+            >>> pprint.pprint(vars(args))  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
+            {...
+             'check_val_every_n_epoch': 1,
+             'checkpoint_callback': True,
+             'default_root_dir': None,
+             'distributed_backend': None,
+             'early_stop_callback': False,
+             ...
+             'logger': True,
+             'max_epochs': 1000,
+             'max_steps': None,
+             'min_epochs': 1,
+             'min_steps': None,
+             ...
+             'profiler': None,
+             'progress_bar_callback': True,
+             'progress_bar_refresh_rate': 1,
+             ...}
+
         """
         parser = ArgumentParser(parents=[parent_parser], add_help=False, )
 


Test patch: