We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Bug: train_embedding fails when pytorch-lightning version is a release candit
## Bug description, how to reproduce and reason
When running the line
https://github.com/lightly-ai/lightly/blob/6cee517ff73ab8fd3d91cbd9aa379df2ae4eada7/lightly/embedding/_base.py#L88-L92
with a pytorch-lightning version with a release candidate (e.g. "1.2.0rc1"), the line fails with

```
  File "/Users/malteebnerlightly/Documents/GitHub/lightly/venv/lib/python3.8/site-packages/lightly/cli/train_cli.py", line 150, in train_cli
    return _train_cli(cfg)
  File "/Users/malteebnerlightly/Documents/GitHub/lightly/venv/lib/python3.8/site-packages/lightly/cli/train_cli.py", line 119, in _train_cli
    encoder.train_embedding(**cfg['trainer'])
  File "/Users/malteebnerlightly/Documents/GitHub/lightly/venv/lib/python3.8/site-packages/lightly/embedding/_base.py", line 89, in train_embedding
    pl_version = [int(v) for v in pl.__version__.split('.')]
  File "/Users/malteebnerlightly/Documents/GitHub/lightly/venv/lib/python3.8/site-packages/lightly/embedding/_base.py", line 89, in <listcomp>
    pl_version = [int(v) for v in pl.__version__.split('.')]
ValueError: invalid literal for int() with base 10: '0rc1'
```

To reproduce, run the following python code (failing):
```python
version = "1.2.0rc1"
pl_version = [int(v) for v in version.split('.')]
```
## Proposed solutions

### Option A:
Change the version checker to account for "rcX" in the version string.
### Option B:
Increase the minimum requirement for pytorch lightning and drop the version check.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `lightly/embedding/_base.py`
Content:
```
1 """ BaseEmbeddings """
2 
3 # Copyright (c) 2020. Lightly AG and its affiliates.
4 # All Rights Reserved
5 import os
6 import copy
7 
8 import pytorch_lightning as pl
9 import pytorch_lightning.core.lightning as lightning
10 import torch.nn as nn
11 
12 from lightly.embedding._callback import CustomModelCheckpoint
13 
14 
15 class BaseEmbedding(lightning.LightningModule):
16     """All trainable embeddings must inherit from BaseEmbedding.
17 
18     """
19 
20     def __init__(self,
21                  model,
22                  criterion,
23                  optimizer,
24                  dataloader,
25                  scheduler=None):
26         """ Constructor
27 
28         Args:
29             model: (torch.nn.Module)
30             criterion: (torch.nn.Module)
31             optimizer: (torch.optim.Optimizer)
32             dataloader: (torch.utils.data.DataLoader)
33 
34         """
35 
36         super(BaseEmbedding, self).__init__()
37         self.model = model
38         self.criterion = criterion
39         self.optimizer = optimizer
40         self.dataloader = dataloader
41         self.scheduler = scheduler
42         self.checkpoint = None
43         self.cwd = os.getcwd()
44 
45         self.checkpoint_callback = None
46         self.init_checkpoint_callback()
47 
48     def forward(self, x0, x1):
49         return self.model(x0, x1)
50 
51     def training_step(self, batch, batch_idx):
52 
53         # get the two image transformations
54         (x0, x1), _, _ = batch
55         # forward pass of the transformations
56         y0, y1 = self(x0, x1)
57         # calculate loss
58         loss = self.criterion(y0, y1)
59         # log loss and return
60         self.log('loss', loss)
61         return loss
62 
63     def configure_optimizers(self):
64         if self.scheduler is None:
65             return self.optimizer
66         else:
67             return [self.optimizer], [self.scheduler]
68 
69     def train_dataloader(self):
70         return self.dataloader
71 
72     def train_embedding(self, **kwargs):
73         """ Train the model on the provided dataset.
74 
75         Args:
76             **kwargs: pylightning_trainer arguments, examples include:
77                 min_epochs: (int) Minimum number of epochs to train
78                 max_epochs: (int) Maximum number of epochs to train
79                 gpus: (int) number of gpus to use
80 
81         Returns:
82             A trained encoder, ready for embedding datasets.
83 
84         """
85         # backwards compatability for old pytorch-lightning versions:
86         # they changed the way checkpoint callbacks are passed in v1.0.3
87         # -> do a simple version check
88         # TODO: remove when incrementing minimum requirement for pl
89         pl_version = [int(v) for v in pl.__version__.split('.')]
90         ok_version = [1, 0, 4]
91         deprecated_checkpoint_callback = \
92             all([pl_v >= ok_v for pl_v, ok_v in zip(pl_version, ok_version)])
93 
94         if deprecated_checkpoint_callback:
95             trainer = pl.Trainer(**kwargs,
96                                  callbacks=[self.checkpoint_callback])
97         else:
98             trainer = pl.Trainer(**kwargs,
99                                  checkpoint_callback=self.checkpoint_callback)
100 
101         trainer.fit(self)
102 
103         self.checkpoint = self.checkpoint_callback.best_model_path
104         self.checkpoint = os.path.join(self.cwd, self.checkpoint)
105 
106     def embed(self, *args, **kwargs):
107         """Must be implemented by classes which inherit from BaseEmbedding.
108 
109         """
110         raise NotImplementedError()
111 
112     def init_checkpoint_callback(self,
113                                  save_last=False,
114                                  save_top_k=0,
115                                  monitor='loss',
116                                  dirpath=None):
117         """Initializes the checkpoint callback.
118 
119         Args:
120             save_last:
121                 Whether or not to save the checkpoint of the last epoch.
122             save_top_k:
123                 Save the top_k model checkpoints.
124             monitor:
125                 Which quantity to monitor.
126             dirpath:
127                 Where to save the checkpoint.
128 
129         """
130         # initialize custom model checkpoint
131         self.checkpoint_callback = CustomModelCheckpoint()
132         self.checkpoint_callback.save_last = save_last
133         self.checkpoint_callback.save_top_k = save_top_k
134         self.checkpoint_callback.monitor = monitor
135 
136         dirpath = self.cwd if dirpath is None else dirpath
137         self.checkpoint_callback.dirpath = dirpath
138
```
--- 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()

```

diff --git a/lightly/embedding/_base.py b/lightly/embedding/_base.py
--- a/lightly/embedding/_base.py
+++ b/lightly/embedding/_base.py
@@ -82,21 +82,8 @@
             A trained encoder, ready for embedding datasets.
 
         """
-        # backwards compatability for old pytorch-lightning versions:
-        # they changed the way checkpoint callbacks are passed in v1.0.3
-        # -> do a simple version check
-        # TODO: remove when incrementing minimum requirement for pl
-        pl_version = [int(v) for v in pl.__version__.split('.')]
-        ok_version = [1, 0, 4]
-        deprecated_checkpoint_callback = \
-            all([pl_v >= ok_v for pl_v, ok_v in zip(pl_version, ok_version)])
-
-        if deprecated_checkpoint_callback:
-            trainer = pl.Trainer(**kwargs,
-                                 callbacks=[self.checkpoint_callback])
-        else:
-            trainer = pl.Trainer(**kwargs,
-                                 checkpoint_callback=self.checkpoint_callback)
+
+        trainer = pl.Trainer(**kwargs, callbacks=[self.checkpoint_callback])
 
         trainer.fit(self)

{"golden_diff": "diff --git a/lightly/embedding/_base.py b/lightly/embedding/_base.py\n--- a/lightly/embedding/_base.py\n+++ b/lightly/embedding/_base.py\n@@ -82,21 +82,8 @@\n             A trained encoder, ready for embedding datasets.\n \n         \"\"\"\n-        # backwards compatability for old pytorch-lightning versions:\n-        # they changed the way checkpoint callbacks are passed in v1.0.3\n-        # -> do a simple version check\n-        # TODO: remove when incrementing minimum requirement for pl\n-        pl_version = [int(v) for v in pl.__version__.split('.')]\n-        ok_version = [1, 0, 4]\n-        deprecated_checkpoint_callback = \\\n-            all([pl_v >= ok_v for pl_v, ok_v in zip(pl_version, ok_version)])\n-\n-        if deprecated_checkpoint_callback:\n-            trainer = pl.Trainer(**kwargs,\n-                                 callbacks=[self.checkpoint_callback])\n-        else:\n-            trainer = pl.Trainer(**kwargs,\n-                                 checkpoint_callback=self.checkpoint_callback)\n+\n+        trainer = pl.Trainer(**kwargs, callbacks=[self.checkpoint_callback])\n \n         trainer.fit(self)\n", "issue": "Bug: train_embedding fails when pytorch-lightning version is a release candit\n## Bug description, how to reproduce and reason\r\nWhen running the line\r\nhttps://github.com/lightly-ai/lightly/blob/6cee517ff73ab8fd3d91cbd9aa379df2ae4eada7/lightly/embedding/_base.py#L88-L92\r\nwith a pytorch-lightning version with a release candidate (e.g. \"1.2.0rc1\"), the line fails with\r\n\r\n```\r\n  File \"/Users/malteebnerlightly/Documents/GitHub/lightly/venv/lib/python3.8/site-packages/lightly/cli/train_cli.py\", line 150, in train_cli\r\n    return _train_cli(cfg)\r\n  File \"/Users/malteebnerlightly/Documents/GitHub/lightly/venv/lib/python3.8/site-packages/lightly/cli/train_cli.py\", line 119, in _train_cli\r\n    encoder.train_embedding(**cfg['trainer'])\r\n  File \"/Users/malteebnerlightly/Documents/GitHub/lightly/venv/lib/python3.8/site-packages/lightly/embedding/_base.py\", line 89, in train_embedding\r\n    pl_version = [int(v) for v in pl.__version__.split('.')]\r\n  File \"/Users/malteebnerlightly/Documents/GitHub/lightly/venv/lib/python3.8/site-packages/lightly/embedding/_base.py\", line 89, in <listcomp>\r\n    pl_version = [int(v) for v in pl.__version__.split('.')]\r\nValueError: invalid literal for int() with base 10: '0rc1'\r\n```\r\n\r\nTo reproduce, run the following python code (failing):\r\n```python\r\nversion = \"1.2.0rc1\"\r\npl_version = [int(v) for v in version.split('.')]\r\n```\r\n## Proposed solutions\r\n\r\n### Option A:\r\nChange the version checker to account for \"rcX\" in the version string.\r\n### Option B:\r\nIncrease the minimum requirement for pytorch lightning and drop the version check.\n", "before_files": [{"content": "\"\"\" BaseEmbeddings \"\"\"\n\n# Copyright (c) 2020. Lightly AG and its affiliates.\n# All Rights Reserved\nimport os\nimport copy\n\nimport pytorch_lightning as pl\nimport pytorch_lightning.core.lightning as lightning\nimport torch.nn as nn\n\nfrom lightly.embedding._callback import CustomModelCheckpoint\n\n\nclass BaseEmbedding(lightning.LightningModule):\n    \"\"\"All trainable embeddings must inherit from BaseEmbedding.\n\n    \"\"\"\n\n    def __init__(self,\n                 model,\n                 criterion,\n                 optimizer,\n                 dataloader,\n                 scheduler=None):\n        \"\"\" Constructor\n\n        Args:\n            model: (torch.nn.Module)\n            criterion: (torch.nn.Module)\n            optimizer: (torch.optim.Optimizer)\n            dataloader: (torch.utils.data.DataLoader)\n\n        \"\"\"\n\n        super(BaseEmbedding, self).__init__()\n        self.model = model\n        self.criterion = criterion\n        self.optimizer = optimizer\n        self.dataloader = dataloader\n        self.scheduler = scheduler\n        self.checkpoint = None\n        self.cwd = os.getcwd()\n\n        self.checkpoint_callback = None\n        self.init_checkpoint_callback()\n\n    def forward(self, x0, x1):\n        return self.model(x0, x1)\n\n    def training_step(self, batch, batch_idx):\n\n        # get the two image transformations\n        (x0, x1), _, _ = batch\n        # forward pass of the transformations\n        y0, y1 = self(x0, x1)\n        # calculate loss\n        loss = self.criterion(y0, y1)\n        # log loss and return\n        self.log('loss', loss)\n        return loss\n\n    def configure_optimizers(self):\n        if self.scheduler is None:\n            return self.optimizer\n        else:\n            return [self.optimizer], [self.scheduler]\n\n    def train_dataloader(self):\n        return self.dataloader\n\n    def train_embedding(self, **kwargs):\n        \"\"\" Train the model on the provided dataset.\n\n        Args:\n            **kwargs: pylightning_trainer arguments, examples include:\n                min_epochs: (int) Minimum number of epochs to train\n                max_epochs: (int) Maximum number of epochs to train\n                gpus: (int) number of gpus to use\n\n        Returns:\n            A trained encoder, ready for embedding datasets.\n\n        \"\"\"\n        # backwards compatability for old pytorch-lightning versions:\n        # they changed the way checkpoint callbacks are passed in v1.0.3\n        # -> do a simple version check\n        # TODO: remove when incrementing minimum requirement for pl\n        pl_version = [int(v) for v in pl.__version__.split('.')]\n        ok_version = [1, 0, 4]\n        deprecated_checkpoint_callback = \\\n            all([pl_v >= ok_v for pl_v, ok_v in zip(pl_version, ok_version)])\n\n        if deprecated_checkpoint_callback:\n            trainer = pl.Trainer(**kwargs,\n                                 callbacks=[self.checkpoint_callback])\n        else:\n            trainer = pl.Trainer(**kwargs,\n                                 checkpoint_callback=self.checkpoint_callback)\n\n        trainer.fit(self)\n\n        self.checkpoint = self.checkpoint_callback.best_model_path\n        self.checkpoint = os.path.join(self.cwd, self.checkpoint)\n\n    def embed(self, *args, **kwargs):\n        \"\"\"Must be implemented by classes which inherit from BaseEmbedding.\n\n        \"\"\"\n        raise NotImplementedError()\n\n    def init_checkpoint_callback(self,\n                                 save_last=False,\n                                 save_top_k=0,\n                                 monitor='loss',\n                                 dirpath=None):\n        \"\"\"Initializes the checkpoint callback.\n\n        Args:\n            save_last:\n                Whether or not to save the checkpoint of the last epoch.\n            save_top_k:\n                Save the top_k model checkpoints.\n            monitor:\n                Which quantity to monitor.\n            dirpath:\n                Where to save the checkpoint.\n\n        \"\"\"\n        # initialize custom model checkpoint\n        self.checkpoint_callback = CustomModelCheckpoint()\n        self.checkpoint_callback.save_last = save_last\n        self.checkpoint_callback.save_top_k = save_top_k\n        self.checkpoint_callback.monitor = monitor\n\n        dirpath = self.cwd if dirpath is None else dirpath\n        self.checkpoint_callback.dirpath = dirpath\n", "path": "lightly/embedding/_base.py"}], "after_files": [{"content": "\"\"\" BaseEmbeddings \"\"\"\n\n# Copyright (c) 2020. Lightly AG and its affiliates.\n# All Rights Reserved\nimport os\nimport copy\n\nimport pytorch_lightning as pl\nimport pytorch_lightning.core.lightning as lightning\nimport torch.nn as nn\n\nfrom lightly.embedding._callback import CustomModelCheckpoint\n\n\nclass BaseEmbedding(lightning.LightningModule):\n    \"\"\"All trainable embeddings must inherit from BaseEmbedding.\n\n    \"\"\"\n\n    def __init__(self,\n                 model,\n                 criterion,\n                 optimizer,\n                 dataloader,\n                 scheduler=None):\n        \"\"\" Constructor\n\n        Args:\n            model: (torch.nn.Module)\n            criterion: (torch.nn.Module)\n            optimizer: (torch.optim.Optimizer)\n            dataloader: (torch.utils.data.DataLoader)\n\n        \"\"\"\n\n        super(BaseEmbedding, self).__init__()\n        self.model = model\n        self.criterion = criterion\n        self.optimizer = optimizer\n        self.dataloader = dataloader\n        self.scheduler = scheduler\n        self.checkpoint = None\n        self.cwd = os.getcwd()\n\n        self.checkpoint_callback = None\n        self.init_checkpoint_callback()\n\n    def forward(self, x0, x1):\n        return self.model(x0, x1)\n\n    def training_step(self, batch, batch_idx):\n\n        # get the two image transformations\n        (x0, x1), _, _ = batch\n        # forward pass of the transformations\n        y0, y1 = self(x0, x1)\n        # calculate loss\n        loss = self.criterion(y0, y1)\n        # log loss and return\n        self.log('loss', loss)\n        return loss\n\n    def configure_optimizers(self):\n        if self.scheduler is None:\n            return self.optimizer\n        else:\n            return [self.optimizer], [self.scheduler]\n\n    def train_dataloader(self):\n        return self.dataloader\n\n    def train_embedding(self, **kwargs):\n        \"\"\" Train the model on the provided dataset.\n\n        Args:\n            **kwargs: pylightning_trainer arguments, examples include:\n                min_epochs: (int) Minimum number of epochs to train\n                max_epochs: (int) Maximum number of epochs to train\n                gpus: (int) number of gpus to use\n\n        Returns:\n            A trained encoder, ready for embedding datasets.\n\n        \"\"\"\n\n        trainer = pl.Trainer(**kwargs, callbacks=[self.checkpoint_callback])\n\n        trainer.fit(self)\n\n        self.checkpoint = self.checkpoint_callback.best_model_path\n        self.checkpoint = os.path.join(self.cwd, self.checkpoint)\n\n    def embed(self, *args, **kwargs):\n        \"\"\"Must be implemented by classes which inherit from BaseEmbedding.\n\n        \"\"\"\n        raise NotImplementedError()\n\n    def init_checkpoint_callback(self,\n                                 save_last=False,\n                                 save_top_k=0,\n                                 monitor='loss',\n                                 dirpath=None):\n        \"\"\"Initializes the checkpoint callback.\n\n        Args:\n            save_last:\n                Whether or not to save the checkpoint of the last epoch.\n            save_top_k:\n                Save the top_k model checkpoints.\n            monitor:\n                Which quantity to monitor.\n            dirpath:\n                Where to save the checkpoint.\n\n        \"\"\"\n        # initialize custom model checkpoint\n        self.checkpoint_callback = CustomModelCheckpoint()\n        self.checkpoint_callback.save_last = save_last\n        self.checkpoint_callback.save_top_k = save_top_k\n        self.checkpoint_callback.monitor = monitor\n\n        dirpath = self.cwd if dirpath is None else dirpath\n        self.checkpoint_callback.dirpath = dirpath\n", "path": "lightly/embedding/_base.py"}]}