prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  CPU/GPU Template
  
  
  ## 🐛 Bug
  
  The GPU or CPU template do not run currently on master after changes including the setup hook. 
  
  ```
  python -m pl_examples.basic_examples.gpu_template --gpus 4 --distributed_backend ddp
  python -m pl_examples.basic_examples.cpu_template
  ```
  
  CPU Template Error:
  ```
  Traceback (most recent call last):
    File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
      "__main__", mod_spec)
    File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
      exec(code, run_globals)
    File "/home/anthony/Downloads/pytorch-lightning/pl_examples/basic_examples/cpu_template.py", line 53, in <module>
      main(args)
    File "/home/anthony/Downloads/pytorch-lightning/pl_examples/basic_examples/cpu_template.py", line 34, in main
      trainer.fit(model)
    File "/home/anthony/Downloads/pytorch-lightning/pytorch_lightning/trainer/trainer.py", line 952, in fit
      self.run_pretrain_routine(model)
    File "/home/anthony/Downloads/pytorch-lightning/pytorch_lightning/trainer/trainer.py", line 1063, in run_pretrain_routine
      self.reset_val_dataloader(ref_model)
    File "/home/anthony/Downloads/pytorch-lightning/pytorch_lightning/trainer/data_loading.py", line 331, in reset_val_dataloader
      self._reset_eval_dataloader(model, 'val')
    File "/home/anthony/Downloads/pytorch-lightning/pytorch_lightning/trainer/data_loading.py", line 253, in _reset_eval_dataloader
      dataloaders = self.request_dataloader(getattr(model, f'{mode}_dataloader'))
    File "/home/anthony/Downloads/pytorch-lightning/pytorch_lightning/trainer/data_loading.py", line 352, in request_dataloader
      dataloader = dataloader_fx()
    File "/home/anthony/Downloads/pytorch-lightning/pl_examples/models/lightning_template.py", line 158, in val_dataloader
      return DataLoader(self.mnist_test, batch_size=self.batch_size, num_workers=4)
    File "/home/anthony/.cache/pypoetry/virtualenvs/robotics-zp-60jGk-py3.6/lib/python3.6/site-packages/torch/nn/modules/module.py", line 594, in __getattr__
      type(self).__name__, name))
  AttributeError: 'LightningTemplateModel' object has no attribute 'mnist_test'
  ```
  GPU Template Error:
  ```
    File "/home/anthony/Downloads/pytorch-lightning/pl_examples/models/lightning_template.py", line 64, in __init__
      self.c_d1_drop = nn.Dropout(self.drop_prob)
    File "/home/anthony/.cache/pypoetry/virtualenvs/robotics-zp-60jGk-py3.6/lib/python3.6/site-packages/torch/nn/modules/dropout.py", line 10, in __init__
      if p < 0 or p > 1:
  TypeError: '<' not supported between instances of 'Namespace' and 'int'
  ```
  
  ### Environment
  
  
  * CUDA:
          - GPU:
                  - GeForce RTX 2080 Ti
                  - GeForce RTX 2080 Ti
                  - GeForce RTX 2080 Ti
                  - GeForce RTX 2080 Ti
          - available:         True
          - version:           10.2
  * Packages:
          - numpy:             1.18.4
          - pyTorch_debug:     False
          - pyTorch_version:   1.5.0
          - pytorch-lightning: 0.8.0
          - tensorboard:       2.2.1
          - tqdm:              4.46.0
  * System:
          - OS:                Linux
          - architecture:
                  - 64bit
                  - ELF
          - processor:         x86_64
          - python:            3.6.8
          - version:           #44~18.04.2-Ubuntu SMP Thu Apr 23 14:27:18 UTC 2020
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pl_examples/basic_examples/gpu_template.py`
  Content:
  ```
  1 """
  2 Runs a model on a single node across multiple gpus.
  3 """
  4 import os
  5 from argparse import ArgumentParser
  6 
  7 import numpy as np
  8 import torch
  9 
  10 import pytorch_lightning as pl
  11 from pl_examples.models.lightning_template import LightningTemplateModel
  12 
  13 SEED = 2334
  14 torch.manual_seed(SEED)
  15 np.random.seed(SEED)
  16 
  17 
  18 def main(hparams):
  19     """
  20     Main training routine specific for this project
  21     :param hparams:
  22     """
  23     # ------------------------
  24     # 1 INIT LIGHTNING MODEL
  25     # ------------------------
  26     model = LightningTemplateModel(hparams)
  27 
  28     # ------------------------
  29     # 2 INIT TRAINER
  30     # ------------------------
  31     trainer = pl.Trainer(
  32         max_epochs=hparams.epochs,
  33         gpus=hparams.gpus,
  34         distributed_backend=hparams.distributed_backend,
  35         precision=16 if hparams.use_16bit else 32,
  36     )
  37 
  38     # ------------------------
  39     # 3 START TRAINING
  40     # ------------------------
  41     trainer.fit(model)
  42 
  43 
  44 if __name__ == '__main__':
  45     # ------------------------
  46     # TRAINING ARGUMENTS
  47     # ------------------------
  48     # these are project-wide arguments
  49 
  50     root_dir = os.path.dirname(os.path.realpath(__file__))
  51     parent_parser = ArgumentParser(add_help=False)
  52 
  53     # gpu args
  54     parent_parser.add_argument(
  55         '--gpus',
  56         type=int,
  57         default=2,
  58         help='how many gpus'
  59     )
  60     parent_parser.add_argument(
  61         '--distributed_backend',
  62         type=str,
  63         default='dp',
  64         help='supports three options dp, ddp, ddp2'
  65     )
  66     parent_parser.add_argument(
  67         '--use_16bit',
  68         dest='use_16bit',
  69         action='store_true',
  70         help='if true uses 16 bit precision'
  71     )
  72 
  73     # each LightningModule defines arguments relevant to it
  74     parser = LightningTemplateModel.add_model_specific_args(parent_parser, root_dir)
  75     hyperparams = parser.parse_args()
  76 
  77     # ---------------------
  78     # RUN TRAINING
  79     # ---------------------
  80     main(hyperparams)
  81
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/pl_examples/basic_examples/gpu_template.py b/pl_examples/basic_examples/gpu_template.py
  --- a/pl_examples/basic_examples/gpu_template.py
  +++ b/pl_examples/basic_examples/gpu_template.py
  @@ -23,7 +23,7 @@
       # ------------------------
       # 1 INIT LIGHTNING MODEL
       # ------------------------
  -    model = LightningTemplateModel(hparams)
  +    model = LightningTemplateModel(**vars(hparams))
   
       # ------------------------
       # 2 INIT TRAINER
  @@ -61,7 +61,7 @@
           '--distributed_backend',
           type=str,
           default='dp',
  -        help='supports three options dp, ddp, ddp2'
  +        help='supports four options dp, ddp, ddp2, ddp_spawn'
       )
       parent_parser.add_argument(
           '--use_16bit',
  
verification_info: {"golden_diff": "diff --git a/pl_examples/basic_examples/gpu_template.py b/pl_examples/basic_examples/gpu_template.py\n--- a/pl_examples/basic_examples/gpu_template.py\n+++ b/pl_examples/basic_examples/gpu_template.py\n@@ -23,7 +23,7 @@\n     # ------------------------\n     # 1 INIT LIGHTNING MODEL\n     # ------------------------\n-    model = LightningTemplateModel(hparams)\n+    model = LightningTemplateModel(**vars(hparams))\n \n     # ------------------------\n     # 2 INIT TRAINER\n@@ -61,7 +61,7 @@\n         '--distributed_backend',\n         type=str,\n         default='dp',\n-        help='supports three options dp, ddp, ddp2'\n+        help='supports four options dp, ddp, ddp2, ddp_spawn'\n     )\n     parent_parser.add_argument(\n         '--use_16bit',\n", "issue": "CPU/GPU Template\n\r\n\r\n## \ud83d\udc1b Bug\r\n\r\nThe GPU or CPU template do not run currently on master after changes including the setup hook. \r\n\r\n```\r\npython -m pl_examples.basic_examples.gpu_template --gpus 4 --distributed_backend ddp\r\npython -m pl_examples.basic_examples.cpu_template\r\n```\r\n\r\nCPU Template Error:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python3.6/runpy.py\", line 193, in _run_module_as_main\r\n    \"__main__\", mod_spec)\r\n  File \"/usr/lib/python3.6/runpy.py\", line 85, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/home/anthony/Downloads/pytorch-lightning/pl_examples/basic_examples/cpu_template.py\", line 53, in <module>\r\n    main(args)\r\n  File \"/home/anthony/Downloads/pytorch-lightning/pl_examples/basic_examples/cpu_template.py\", line 34, in main\r\n    trainer.fit(model)\r\n  File \"/home/anthony/Downloads/pytorch-lightning/pytorch_lightning/trainer/trainer.py\", line 952, in fit\r\n    self.run_pretrain_routine(model)\r\n  File \"/home/anthony/Downloads/pytorch-lightning/pytorch_lightning/trainer/trainer.py\", line 1063, in run_pretrain_routine\r\n    self.reset_val_dataloader(ref_model)\r\n  File \"/home/anthony/Downloads/pytorch-lightning/pytorch_lightning/trainer/data_loading.py\", line 331, in reset_val_dataloader\r\n    self._reset_eval_dataloader(model, 'val')\r\n  File \"/home/anthony/Downloads/pytorch-lightning/pytorch_lightning/trainer/data_loading.py\", line 253, in _reset_eval_dataloader\r\n    dataloaders = self.request_dataloader(getattr(model, f'{mode}_dataloader'))\r\n  File \"/home/anthony/Downloads/pytorch-lightning/pytorch_lightning/trainer/data_loading.py\", line 352, in request_dataloader\r\n    dataloader = dataloader_fx()\r\n  File \"/home/anthony/Downloads/pytorch-lightning/pl_examples/models/lightning_template.py\", line 158, in val_dataloader\r\n    return DataLoader(self.mnist_test, batch_size=self.batch_size, num_workers=4)\r\n  File \"/home/anthony/.cache/pypoetry/virtualenvs/robotics-zp-60jGk-py3.6/lib/python3.6/site-packages/torch/nn/modules/module.py\", line 594, in __getattr__\r\n    type(self).__name__, name))\r\nAttributeError: 'LightningTemplateModel' object has no attribute 'mnist_test'\r\n```\r\nGPU Template Error:\r\n```\r\n  File \"/home/anthony/Downloads/pytorch-lightning/pl_examples/models/lightning_template.py\", line 64, in __init__\r\n    self.c_d1_drop = nn.Dropout(self.drop_prob)\r\n  File \"/home/anthony/.cache/pypoetry/virtualenvs/robotics-zp-60jGk-py3.6/lib/python3.6/site-packages/torch/nn/modules/dropout.py\", line 10, in __init__\r\n    if p < 0 or p > 1:\r\nTypeError: '<' not supported between instances of 'Namespace' and 'int'\r\n```\r\n\r\n### Environment\r\n\r\n\r\n* CUDA:\r\n        - GPU:\r\n                - GeForce RTX 2080 Ti\r\n                - GeForce RTX 2080 Ti\r\n                - GeForce RTX 2080 Ti\r\n                - GeForce RTX 2080 Ti\r\n        - available:         True\r\n        - version:           10.2\r\n* Packages:\r\n        - numpy:             1.18.4\r\n        - pyTorch_debug:     False\r\n        - pyTorch_version:   1.5.0\r\n        - pytorch-lightning: 0.8.0\r\n        - tensorboard:       2.2.1\r\n        - tqdm:              4.46.0\r\n* System:\r\n        - OS:                Linux\r\n        - architecture:\r\n                - 64bit\r\n                - ELF\r\n        - processor:         x86_64\r\n        - python:            3.6.8\r\n        - version:           #44~18.04.2-Ubuntu SMP Thu Apr 23 14:27:18 UTC 2020\r\n\r\n\n", "before_files": [{"content": "\"\"\"\nRuns a model on a single node across multiple gpus.\n\"\"\"\nimport os\nfrom argparse import ArgumentParser\n\nimport numpy as np\nimport torch\n\nimport pytorch_lightning as pl\nfrom pl_examples.models.lightning_template import LightningTemplateModel\n\nSEED = 2334\ntorch.manual_seed(SEED)\nnp.random.seed(SEED)\n\n\ndef main(hparams):\n    \"\"\"\n    Main training routine specific for this project\n    :param hparams:\n    \"\"\"\n    # ------------------------\n    # 1 INIT LIGHTNING MODEL\n    # ------------------------\n    model = LightningTemplateModel(hparams)\n\n    # ------------------------\n    # 2 INIT TRAINER\n    # ------------------------\n    trainer = pl.Trainer(\n        max_epochs=hparams.epochs,\n        gpus=hparams.gpus,\n        distributed_backend=hparams.distributed_backend,\n        precision=16 if hparams.use_16bit else 32,\n    )\n\n    # ------------------------\n    # 3 START TRAINING\n    # ------------------------\n    trainer.fit(model)\n\n\nif __name__ == '__main__':\n    # ------------------------\n    # TRAINING ARGUMENTS\n    # ------------------------\n    # these are project-wide arguments\n\n    root_dir = os.path.dirname(os.path.realpath(__file__))\n    parent_parser = ArgumentParser(add_help=False)\n\n    # gpu args\n    parent_parser.add_argument(\n        '--gpus',\n        type=int,\n        default=2,\n        help='how many gpus'\n    )\n    parent_parser.add_argument(\n        '--distributed_backend',\n        type=str,\n        default='dp',\n        help='supports three options dp, ddp, ddp2'\n    )\n    parent_parser.add_argument(\n        '--use_16bit',\n        dest='use_16bit',\n        action='store_true',\n        help='if true uses 16 bit precision'\n    )\n\n    # each LightningModule defines arguments relevant to it\n    parser = LightningTemplateModel.add_model_specific_args(parent_parser, root_dir)\n    hyperparams = parser.parse_args()\n\n    # ---------------------\n    # RUN TRAINING\n    # ---------------------\n    main(hyperparams)\n", "path": "pl_examples/basic_examples/gpu_template.py"}], "after_files": [{"content": "\"\"\"\nRuns a model on a single node across multiple gpus.\n\"\"\"\nimport os\nfrom argparse import ArgumentParser\n\nimport numpy as np\nimport torch\n\nimport pytorch_lightning as pl\nfrom pl_examples.models.lightning_template import LightningTemplateModel\n\nSEED = 2334\ntorch.manual_seed(SEED)\nnp.random.seed(SEED)\n\n\ndef main(hparams):\n    \"\"\"\n    Main training routine specific for this project\n    :param hparams:\n    \"\"\"\n    # ------------------------\n    # 1 INIT LIGHTNING MODEL\n    # ------------------------\n    model = LightningTemplateModel(**vars(hparams))\n\n    # ------------------------\n    # 2 INIT TRAINER\n    # ------------------------\n    trainer = pl.Trainer(\n        max_epochs=hparams.epochs,\n        gpus=hparams.gpus,\n        distributed_backend=hparams.distributed_backend,\n        precision=16 if hparams.use_16bit else 32,\n    )\n\n    # ------------------------\n    # 3 START TRAINING\n    # ------------------------\n    trainer.fit(model)\n\n\nif __name__ == '__main__':\n    # ------------------------\n    # TRAINING ARGUMENTS\n    # ------------------------\n    # these are project-wide arguments\n\n    root_dir = os.path.dirname(os.path.realpath(__file__))\n    parent_parser = ArgumentParser(add_help=False)\n\n    # gpu args\n    parent_parser.add_argument(\n        '--gpus',\n        type=int,\n        default=2,\n        help='how many gpus'\n    )\n    parent_parser.add_argument(\n        '--distributed_backend',\n        type=str,\n        default='dp',\n        help='supports four options dp, ddp, ddp2, ddp_spawn'\n    )\n    parent_parser.add_argument(\n        '--use_16bit',\n        dest='use_16bit',\n        action='store_true',\n        help='if true uses 16 bit precision'\n    )\n\n    # each LightningModule defines arguments relevant to it\n    parser = LightningTemplateModel.add_model_specific_args(parent_parser, root_dir)\n    hyperparams = parser.parse_args()\n\n    # ---------------------\n    # RUN TRAINING\n    # ---------------------\n    main(hyperparams)\n", "path": "pl_examples/basic_examples/gpu_template.py"}]}