Repository: Lightning-AI/pytorch-lightning
Pull request: Implement finalize for WandbLogger
## What does this PR do?

Fixes #3002


The checkpoint artifacts will be uploaded at the end of the run:
![image](https://user-images.githubusercontent.com/5495193/97101598-303f5480-169f-11eb-9f3f-4ad454304361.png)



Problem statement:
Checkpoint files location when WandbLogger 
I am trying to look for checkpoint files when using WandbLogger. However checkpoint files doesn't seem to be exist in wandb folder as well. This is despite the fact that log_model=True is setup in WandbLogger. Please help me on this, I am not sure if I am missing something on this.


OS is macOS Mojave. However I noticed the issue on Colab, didn't run on my local machine though.

Hints from issue discussion:
Hi! thanks for your contribution!, great first issue!
Hi, happy to help. Can you post 
1. the arguments you pass into your wandblogger
2. the output messages in the terminal from wandb
I just tested it running 2 epochs with the cpu_example, and for me it uploads at the end of the training.
Hi,

Below are the configuration details :

from pytorch_lightning.loggers import WandbLogger
wandb_logger = WandbLogger(name='SSCNN-Run-streamlit',project='limited_vocabulary_speech_recognition', log_model=True)

trainer = Trainer(max_epochs=2, gpus=1, logger = wandb_logger, progress_bar_refresh_rate = 20)

Output messages : 

GPU available: True, used: True
TPU available: False, using: 0 TPU cores
CUDA_VISIBLE_DEVICES: [0]
Logging results to Weights & Biases (Documentation).
Project page: https://app.wandb.ai/ksasi/limited_vocabulary_speech_recognition
Run page: https://app.wandb.ai/ksasi/limited_vocabulary_speech_recognition/runs/3pq6wolw
and the progress bar.
Any update on why the WandbLogger doesn't save checkpoints when `log_model=True` is set? Is there a workaround to log checkpoints to the correct wandb location easily?
Hi, I tested it and the last model is saved for me. See [colab](https://colab.research.google.com/drive/16d1uctGaw2y9KhGBlINNTsWpmlXdJwRW?usp=sharing#scrollTo=CxXtBfFrKYgA)
Ok, looked at it again. We are missing the `wandb.finish` call. I spotted that thanks to @borisdayma's notebook which makes the call at the end. Let me send a PR and you guys test it out?

Commit message: changelog

Patch to review:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8d979b41893f5..6765c15c2f1e6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,6 +35,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 
 - Fixed synchronization of best model path in `ddp_accelerator` ([#4323](https://github.com/PyTorchLightning/pytorch-lightning/pull/4323))
 
+- Fixed WandbLogger not uploading checkpoint artifacts at the end of training ([#4341](https://github.com/PyTorchLightning/pytorch-lightning/pull/4341))
+
 ## [1.0.3] - 2020-10-20
 
 ### Added
diff --git a/pytorch_lightning/loggers/wandb.py b/pytorch_lightning/loggers/wandb.py
index 4fe308ce28c44..3bbe03c384bd0 100644
--- a/pytorch_lightning/loggers/wandb.py
+++ b/pytorch_lightning/loggers/wandb.py
@@ -156,3 +156,7 @@ def name(self) -> Optional[str]:
     def version(self) -> Optional[str]:
         # don't create an experiment if we don't have one
         return self._experiment.id if self._experiment else self._id
+
+    def finalize(self, status: str) -> None:
+        if self._log_model:
+            wandb.save(os.path.join(self.save_dir, "*.ckpt"))


Code review comments:
diff_hunk: @@ -156,3 +156,7 @@ def name(self) -> Optional[str]:
     def version(self) -> Optional[str]:
         # don't create an experiment if we don't have one
         return self._experiment.id if self._experiment else self._id
+
+    def finalize(self, status: str) -> None:
+        if self._log_model:
path: pytorch_lightning/loggers/wandb.py
text: @user1:
```suggestion
        # upload all checkpoints from saving dir
        if self._log_model:
```