prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  ModelCheckpoint Filepath Doesn't Use Logger Save Dir
  # 🐛 Bug
  
  Not sure if this is intended, but the model checkpoint isn't using the same directory as the logger, even if the logger exists. I would have expected this line [here](https://github.com/PyTorchLightning/pytorch-lightning/blob/588ad8377167c0b7d29cf4f362dbf42015f7568d/pytorch_lightning/trainer/callback_config.py#L28) to be `self.logger.save_dir` instead of `self.default_save_path`. 
  
  Thank you,
  -Collin
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pytorch_lightning/trainer/callback_config.py`
  Content:
  ```
  1 import os
  2 from abc import ABC
  3 
  4 from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping
  5 
  6 
  7 class TrainerCallbackConfigMixin(ABC):
  8 
  9     def __init__(self):
  10         # this is just a summary on variables used in this abstract class,
  11         #  the proper values/initialisation should be done in child class
  12         self.default_save_path = None
  13         self.save_checkpoint = None
  14         self.slurm_job_id = None
  15 
  16     def configure_checkpoint_callback(self):
  17         """
  18         Weight path set in this priority:
  19         Checkpoint_callback's path (if passed in).
  20         User provided weights_saved_path
  21         Otherwise use os.getcwd()
  22         """
  23         if self.checkpoint_callback is True:
  24             # init a default one
  25             if self.logger is not None:
  26                 ckpt_path = os.path.join(
  27                     self.default_save_path,
  28                     self.logger.name,
  29                     f'version_{self.logger.version}',
  30                     "checkpoints"
  31                 )
  32             else:
  33                 ckpt_path = os.path.join(self.default_save_path, "checkpoints")
  34 
  35             self.checkpoint_callback = ModelCheckpoint(
  36                 filepath=ckpt_path
  37             )
  38         elif self.checkpoint_callback is False:
  39             self.checkpoint_callback = None
  40 
  41         if self.checkpoint_callback:
  42             # set the path for the callbacks
  43             self.checkpoint_callback.save_function = self.save_checkpoint
  44 
  45             # if checkpoint callback used, then override the weights path
  46             self.weights_save_path = self.checkpoint_callback.filepath
  47 
  48         # if weights_save_path is still none here, set to current working dir
  49         if self.weights_save_path is None:
  50             self.weights_save_path = self.default_save_path
  51 
  52     def configure_early_stopping(self, early_stop_callback):
  53         if early_stop_callback is True:
  54             self.early_stop_callback = EarlyStopping(
  55                 monitor='val_loss',
  56                 patience=3,
  57                 strict=True,
  58                 verbose=True,
  59                 mode='min'
  60             )
  61             self.enable_early_stop = True
  62         elif early_stop_callback is None:
  63             self.early_stop_callback = EarlyStopping(
  64                 monitor='val_loss',
  65                 patience=3,
  66                 strict=False,
  67                 verbose=False,
  68                 mode='min'
  69             )
  70             self.enable_early_stop = True
  71         elif not early_stop_callback:
  72             self.early_stop_callback = None
  73             self.enable_early_stop = False
  74         else:
  75             self.early_stop_callback = early_stop_callback
  76             self.enable_early_stop = True
  77
  ```
  --- 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/pytorch_lightning/trainer/callback_config.py b/pytorch_lightning/trainer/callback_config.py
  --- a/pytorch_lightning/trainer/callback_config.py
  +++ b/pytorch_lightning/trainer/callback_config.py
  @@ -23,8 +23,11 @@
           if self.checkpoint_callback is True:
               # init a default one
               if self.logger is not None:
  +                save_dir = (getattr(self.logger, 'save_dir', None) or
  +                            getattr(self.logger, '_save_dir', None) or
  +                            self.default_save_path)
                   ckpt_path = os.path.join(
  -                    self.default_save_path,
  +                    save_dir,
                       self.logger.name,
                       f'version_{self.logger.version}',
                       "checkpoints"
  
verification_info: {"golden_diff": "diff --git a/pytorch_lightning/trainer/callback_config.py b/pytorch_lightning/trainer/callback_config.py\n--- a/pytorch_lightning/trainer/callback_config.py\n+++ b/pytorch_lightning/trainer/callback_config.py\n@@ -23,8 +23,11 @@\n         if self.checkpoint_callback is True:\n             # init a default one\n             if self.logger is not None:\n+                save_dir = (getattr(self.logger, 'save_dir', None) or\n+                            getattr(self.logger, '_save_dir', None) or\n+                            self.default_save_path)\n                 ckpt_path = os.path.join(\n-                    self.default_save_path,\n+                    save_dir,\n                     self.logger.name,\n                     f'version_{self.logger.version}',\n                     \"checkpoints\"\n", "issue": "ModelCheckpoint Filepath Doesn't Use Logger Save Dir\n# \ud83d\udc1b Bug\r\n\r\nNot sure if this is intended, but the model checkpoint isn't using the same directory as the logger, even if the logger exists. I would have expected this line [here](https://github.com/PyTorchLightning/pytorch-lightning/blob/588ad8377167c0b7d29cf4f362dbf42015f7568d/pytorch_lightning/trainer/callback_config.py#L28) to be `self.logger.save_dir` instead of `self.default_save_path`. \r\n\r\nThank you,\r\n-Collin\n", "before_files": [{"content": "import os\nfrom abc import ABC\n\nfrom pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping\n\n\nclass TrainerCallbackConfigMixin(ABC):\n\n    def __init__(self):\n        # this is just a summary on variables used in this abstract class,\n        #  the proper values/initialisation should be done in child class\n        self.default_save_path = None\n        self.save_checkpoint = None\n        self.slurm_job_id = None\n\n    def configure_checkpoint_callback(self):\n        \"\"\"\n        Weight path set in this priority:\n        Checkpoint_callback's path (if passed in).\n        User provided weights_saved_path\n        Otherwise use os.getcwd()\n        \"\"\"\n        if self.checkpoint_callback is True:\n            # init a default one\n            if self.logger is not None:\n                ckpt_path = os.path.join(\n                    self.default_save_path,\n                    self.logger.name,\n                    f'version_{self.logger.version}',\n                    \"checkpoints\"\n                )\n            else:\n                ckpt_path = os.path.join(self.default_save_path, \"checkpoints\")\n\n            self.checkpoint_callback = ModelCheckpoint(\n                filepath=ckpt_path\n            )\n        elif self.checkpoint_callback is False:\n            self.checkpoint_callback = None\n\n        if self.checkpoint_callback:\n            # set the path for the callbacks\n            self.checkpoint_callback.save_function = self.save_checkpoint\n\n            # if checkpoint callback used, then override the weights path\n            self.weights_save_path = self.checkpoint_callback.filepath\n\n        # if weights_save_path is still none here, set to current working dir\n        if self.weights_save_path is None:\n            self.weights_save_path = self.default_save_path\n\n    def configure_early_stopping(self, early_stop_callback):\n        if early_stop_callback is True:\n            self.early_stop_callback = EarlyStopping(\n                monitor='val_loss',\n                patience=3,\n                strict=True,\n                verbose=True,\n                mode='min'\n            )\n            self.enable_early_stop = True\n        elif early_stop_callback is None:\n            self.early_stop_callback = EarlyStopping(\n                monitor='val_loss',\n                patience=3,\n                strict=False,\n                verbose=False,\n                mode='min'\n            )\n            self.enable_early_stop = True\n        elif not early_stop_callback:\n            self.early_stop_callback = None\n            self.enable_early_stop = False\n        else:\n            self.early_stop_callback = early_stop_callback\n            self.enable_early_stop = True\n", "path": "pytorch_lightning/trainer/callback_config.py"}], "after_files": [{"content": "import os\nfrom abc import ABC\n\nfrom pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping\n\n\nclass TrainerCallbackConfigMixin(ABC):\n\n    def __init__(self):\n        # this is just a summary on variables used in this abstract class,\n        #  the proper values/initialisation should be done in child class\n        self.default_save_path = None\n        self.save_checkpoint = None\n        self.slurm_job_id = None\n\n    def configure_checkpoint_callback(self):\n        \"\"\"\n        Weight path set in this priority:\n        Checkpoint_callback's path (if passed in).\n        User provided weights_saved_path\n        Otherwise use os.getcwd()\n        \"\"\"\n        if self.checkpoint_callback is True:\n            # init a default one\n            if self.logger is not None:\n                save_dir = (getattr(self.logger, 'save_dir', None) or\n                            getattr(self.logger, '_save_dir', None) or\n                            self.default_save_path)\n                ckpt_path = os.path.join(\n                    save_dir,\n                    self.logger.name,\n                    f'version_{self.logger.version}',\n                    \"checkpoints\"\n                )\n            else:\n                ckpt_path = os.path.join(self.default_save_path, \"checkpoints\")\n\n            self.checkpoint_callback = ModelCheckpoint(\n                filepath=ckpt_path\n            )\n        elif self.checkpoint_callback is False:\n            self.checkpoint_callback = None\n\n        if self.checkpoint_callback:\n            # set the path for the callbacks\n            self.checkpoint_callback.save_function = self.save_checkpoint\n\n            # if checkpoint callback used, then override the weights path\n            self.weights_save_path = self.checkpoint_callback.filepath\n\n        # if weights_save_path is still none here, set to current working dir\n        if self.weights_save_path is None:\n            self.weights_save_path = self.default_save_path\n\n    def configure_early_stopping(self, early_stop_callback):\n        if early_stop_callback is True:\n            self.early_stop_callback = EarlyStopping(\n                monitor='val_loss',\n                patience=3,\n                strict=True,\n                verbose=True,\n                mode='min'\n            )\n            self.enable_early_stop = True\n        elif early_stop_callback is None:\n            self.early_stop_callback = EarlyStopping(\n                monitor='val_loss',\n                patience=3,\n                strict=False,\n                verbose=False,\n                mode='min'\n            )\n            self.enable_early_stop = True\n        elif not early_stop_callback:\n            self.early_stop_callback = None\n            self.enable_early_stop = False\n        else:\n            self.early_stop_callback = early_stop_callback\n            self.enable_early_stop = True\n", "path": "pytorch_lightning/trainer/callback_config.py"}]}