We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Fix Flash CI (special examples failing)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `flash_examples/integrations/learn2learn/image_classification_imagenette_mini.py`
Content:
```
1 # Copyright The PyTorch Lightning team.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 # adapted from https://github.com/learnables/learn2learn/blob/master/examples/vision/protonet_miniimagenet.py#L154
16 
17 """## Train file https://www.dropbox.com/s/9g8c6w345s2ek03/mini-imagenet-cache-train.pkl?dl=1
18 
19 ## Validation File
20 https://www.dropbox.com/s/ip1b7se3gij3r1b/mini-imagenet-cache-validation.pkl?dl=1
21 
22 Followed by renaming the pickle files
23 cp './mini-imagenet-cache-train.pkl?dl=1' './mini-imagenet-cache-train.pkl'
24 cp './mini-imagenet-cache-validation.pkl?dl=1' './mini-imagenet-cache-validation.pkl'
25 """
26 
27 import warnings
28 from dataclasses import dataclass
29 from typing import Tuple, Union
30 
31 import kornia.augmentation as Ka
32 import kornia.geometry as Kg
33 import learn2learn as l2l
34 import torch
35 import torchvision.transforms as T
36 
37 import flash
38 from flash.core.data.io.input import DataKeys
39 from flash.core.data.io.input_transform import InputTransform
40 from flash.core.data.transforms import ApplyToKeys, kornia_collate
41 from flash.image import ImageClassificationData, ImageClassifier
42 
43 warnings.simplefilter("ignore")
44 
45 # download MiniImagenet
46 train_dataset = l2l.vision.datasets.MiniImagenet(root="./", mode="train", download=False)
47 val_dataset = l2l.vision.datasets.MiniImagenet(root="./", mode="validation", download=False)
48 
49 
50 @dataclass
51 class ImageClassificationInputTransform(InputTransform):
52 
53     image_size: Tuple[int, int] = (196, 196)
54     mean: Union[float, Tuple[float, float, float]] = (0.485, 0.456, 0.406)
55     std: Union[float, Tuple[float, float, float]] = (0.229, 0.224, 0.225)
56 
57     def per_sample_transform(self):
58         return T.Compose(
59             [
60                 ApplyToKeys(
61                     DataKeys.INPUT,
62                     T.Compose(
63                         [
64                             T.ToTensor(),
65                             Kg.Resize((196, 196)),
66                             # SPATIAL
67                             Ka.RandomHorizontalFlip(p=0.25),
68                             Ka.RandomRotation(degrees=90.0, p=0.25),
69                             Ka.RandomAffine(degrees=1 * 5.0, shear=1 / 5, translate=1 / 20, p=0.25),
70                             Ka.RandomPerspective(distortion_scale=1 / 25, p=0.25),
71                             # PIXEL-LEVEL
72                             Ka.ColorJitter(brightness=1 / 30, p=0.25),  # brightness
73                             Ka.ColorJitter(saturation=1 / 30, p=0.25),  # saturation
74                             Ka.ColorJitter(contrast=1 / 30, p=0.25),  # contrast
75                             Ka.ColorJitter(hue=1 / 30, p=0.25),  # hue
76                             Ka.RandomMotionBlur(kernel_size=2 * (4 // 3) + 1, angle=1, direction=1.0, p=0.25),
77                             Ka.RandomErasing(scale=(1 / 100, 1 / 50), ratio=(1 / 20, 1), p=0.25),
78                         ]
79                     ),
80                 ),
81                 ApplyToKeys(DataKeys.TARGET, torch.as_tensor),
82             ]
83         )
84 
85     def train_per_sample_transform(self):
86         return T.Compose(
87             [
88                 ApplyToKeys(
89                     DataKeys.INPUT,
90                     T.Compose(
91                         [
92                             T.ToTensor(),
93                             T.Resize(self.image_size),
94                             T.Normalize(self.mean, self.std),
95                             T.RandomHorizontalFlip(),
96                             T.ColorJitter(),
97                             T.RandomAutocontrast(),
98                             T.RandomPerspective(),
99                         ]
100                     ),
101                 ),
102                 ApplyToKeys("target", torch.as_tensor),
103             ]
104         )
105 
106     def per_batch_transform_on_device(self):
107         return ApplyToKeys(
108             DataKeys.INPUT,
109             Ka.RandomHorizontalFlip(p=0.25),
110         )
111 
112     def collate(self):
113         return kornia_collate
114 
115 
116 # construct datamodule
117 
118 datamodule = ImageClassificationData.from_tensors(
119     train_data=train_dataset.x,
120     train_targets=torch.from_numpy(train_dataset.y.astype(int)),
121     val_data=val_dataset.x,
122     val_targets=torch.from_numpy(val_dataset.y.astype(int)),
123     train_transform=ImageClassificationInputTransform,
124     val_transform=ImageClassificationInputTransform,
125     batch_size=1,
126 )
127 
128 model = ImageClassifier(
129     backbone="resnet18",
130     training_strategy="prototypicalnetworks",
131     training_strategy_kwargs={
132         "epoch_length": 10 * 16,
133         "meta_batch_size": 1,
134         "num_tasks": 200,
135         "test_num_tasks": 2000,
136         "ways": datamodule.num_classes,
137         "shots": 1,
138         "test_ways": 5,
139         "test_shots": 1,
140         "test_queries": 15,
141     },
142     optimizer=torch.optim.Adam,
143     learning_rate=0.001,
144 )
145 
146 trainer = flash.Trainer(
147     max_epochs=1,
148     gpus=1,
149     precision=16,
150 )
151 
152 trainer.finetune(model, datamodule=datamodule, strategy="no_freeze")
153
```
--- 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/flash_examples/integrations/learn2learn/image_classification_imagenette_mini.py b/flash_examples/integrations/learn2learn/image_classification_imagenette_mini.py
--- a/flash_examples/integrations/learn2learn/image_classification_imagenette_mini.py
+++ b/flash_examples/integrations/learn2learn/image_classification_imagenette_mini.py
@@ -146,6 +146,7 @@
 trainer = flash.Trainer(
     max_epochs=1,
     gpus=1,
+    accelerator="gpu",
     precision=16,
 )

{"golden_diff": "diff --git a/flash_examples/integrations/learn2learn/image_classification_imagenette_mini.py b/flash_examples/integrations/learn2learn/image_classification_imagenette_mini.py\n--- a/flash_examples/integrations/learn2learn/image_classification_imagenette_mini.py\n+++ b/flash_examples/integrations/learn2learn/image_classification_imagenette_mini.py\n@@ -146,6 +146,7 @@\n trainer = flash.Trainer(\n     max_epochs=1,\n     gpus=1,\n+    accelerator=\"gpu\",\n     precision=16,\n )\n", "issue": "Fix Flash CI (special examples failing)\n\n", "before_files": [{"content": "# Copyright The PyTorch Lightning team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# adapted from https://github.com/learnables/learn2learn/blob/master/examples/vision/protonet_miniimagenet.py#L154\n\n\"\"\"## Train file https://www.dropbox.com/s/9g8c6w345s2ek03/mini-imagenet-cache-train.pkl?dl=1\n\n## Validation File\nhttps://www.dropbox.com/s/ip1b7se3gij3r1b/mini-imagenet-cache-validation.pkl?dl=1\n\nFollowed by renaming the pickle files\ncp './mini-imagenet-cache-train.pkl?dl=1' './mini-imagenet-cache-train.pkl'\ncp './mini-imagenet-cache-validation.pkl?dl=1' './mini-imagenet-cache-validation.pkl'\n\"\"\"\n\nimport warnings\nfrom dataclasses import dataclass\nfrom typing import Tuple, Union\n\nimport kornia.augmentation as Ka\nimport kornia.geometry as Kg\nimport learn2learn as l2l\nimport torch\nimport torchvision.transforms as T\n\nimport flash\nfrom flash.core.data.io.input import DataKeys\nfrom flash.core.data.io.input_transform import InputTransform\nfrom flash.core.data.transforms import ApplyToKeys, kornia_collate\nfrom flash.image import ImageClassificationData, ImageClassifier\n\nwarnings.simplefilter(\"ignore\")\n\n# download MiniImagenet\ntrain_dataset = l2l.vision.datasets.MiniImagenet(root=\"./\", mode=\"train\", download=False)\nval_dataset = l2l.vision.datasets.MiniImagenet(root=\"./\", mode=\"validation\", download=False)\n\n\n@dataclass\nclass ImageClassificationInputTransform(InputTransform):\n\n    image_size: Tuple[int, int] = (196, 196)\n    mean: Union[float, Tuple[float, float, float]] = (0.485, 0.456, 0.406)\n    std: Union[float, Tuple[float, float, float]] = (0.229, 0.224, 0.225)\n\n    def per_sample_transform(self):\n        return T.Compose(\n            [\n                ApplyToKeys(\n                    DataKeys.INPUT,\n                    T.Compose(\n                        [\n                            T.ToTensor(),\n                            Kg.Resize((196, 196)),\n                            # SPATIAL\n                            Ka.RandomHorizontalFlip(p=0.25),\n                            Ka.RandomRotation(degrees=90.0, p=0.25),\n                            Ka.RandomAffine(degrees=1 * 5.0, shear=1 / 5, translate=1 / 20, p=0.25),\n                            Ka.RandomPerspective(distortion_scale=1 / 25, p=0.25),\n                            # PIXEL-LEVEL\n                            Ka.ColorJitter(brightness=1 / 30, p=0.25),  # brightness\n                            Ka.ColorJitter(saturation=1 / 30, p=0.25),  # saturation\n                            Ka.ColorJitter(contrast=1 / 30, p=0.25),  # contrast\n                            Ka.ColorJitter(hue=1 / 30, p=0.25),  # hue\n                            Ka.RandomMotionBlur(kernel_size=2 * (4 // 3) + 1, angle=1, direction=1.0, p=0.25),\n                            Ka.RandomErasing(scale=(1 / 100, 1 / 50), ratio=(1 / 20, 1), p=0.25),\n                        ]\n                    ),\n                ),\n                ApplyToKeys(DataKeys.TARGET, torch.as_tensor),\n            ]\n        )\n\n    def train_per_sample_transform(self):\n        return T.Compose(\n            [\n                ApplyToKeys(\n                    DataKeys.INPUT,\n                    T.Compose(\n                        [\n                            T.ToTensor(),\n                            T.Resize(self.image_size),\n                            T.Normalize(self.mean, self.std),\n                            T.RandomHorizontalFlip(),\n                            T.ColorJitter(),\n                            T.RandomAutocontrast(),\n                            T.RandomPerspective(),\n                        ]\n                    ),\n                ),\n                ApplyToKeys(\"target\", torch.as_tensor),\n            ]\n        )\n\n    def per_batch_transform_on_device(self):\n        return ApplyToKeys(\n            DataKeys.INPUT,\n            Ka.RandomHorizontalFlip(p=0.25),\n        )\n\n    def collate(self):\n        return kornia_collate\n\n\n# construct datamodule\n\ndatamodule = ImageClassificationData.from_tensors(\n    train_data=train_dataset.x,\n    train_targets=torch.from_numpy(train_dataset.y.astype(int)),\n    val_data=val_dataset.x,\n    val_targets=torch.from_numpy(val_dataset.y.astype(int)),\n    train_transform=ImageClassificationInputTransform,\n    val_transform=ImageClassificationInputTransform,\n    batch_size=1,\n)\n\nmodel = ImageClassifier(\n    backbone=\"resnet18\",\n    training_strategy=\"prototypicalnetworks\",\n    training_strategy_kwargs={\n        \"epoch_length\": 10 * 16,\n        \"meta_batch_size\": 1,\n        \"num_tasks\": 200,\n        \"test_num_tasks\": 2000,\n        \"ways\": datamodule.num_classes,\n        \"shots\": 1,\n        \"test_ways\": 5,\n        \"test_shots\": 1,\n        \"test_queries\": 15,\n    },\n    optimizer=torch.optim.Adam,\n    learning_rate=0.001,\n)\n\ntrainer = flash.Trainer(\n    max_epochs=1,\n    gpus=1,\n    precision=16,\n)\n\ntrainer.finetune(model, datamodule=datamodule, strategy=\"no_freeze\")\n", "path": "flash_examples/integrations/learn2learn/image_classification_imagenette_mini.py"}], "after_files": [{"content": "# Copyright The PyTorch Lightning team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# adapted from https://github.com/learnables/learn2learn/blob/master/examples/vision/protonet_miniimagenet.py#L154\n\n\"\"\"## Train file https://www.dropbox.com/s/9g8c6w345s2ek03/mini-imagenet-cache-train.pkl?dl=1\n\n## Validation File\nhttps://www.dropbox.com/s/ip1b7se3gij3r1b/mini-imagenet-cache-validation.pkl?dl=1\n\nFollowed by renaming the pickle files\ncp './mini-imagenet-cache-train.pkl?dl=1' './mini-imagenet-cache-train.pkl'\ncp './mini-imagenet-cache-validation.pkl?dl=1' './mini-imagenet-cache-validation.pkl'\n\"\"\"\n\nimport warnings\nfrom dataclasses import dataclass\nfrom typing import Tuple, Union\n\nimport kornia.augmentation as Ka\nimport kornia.geometry as Kg\nimport learn2learn as l2l\nimport torch\nimport torchvision.transforms as T\n\nimport flash\nfrom flash.core.data.io.input import DataKeys\nfrom flash.core.data.io.input_transform import InputTransform\nfrom flash.core.data.transforms import ApplyToKeys, kornia_collate\nfrom flash.image import ImageClassificationData, ImageClassifier\n\nwarnings.simplefilter(\"ignore\")\n\n# download MiniImagenet\ntrain_dataset = l2l.vision.datasets.MiniImagenet(root=\"./\", mode=\"train\", download=False)\nval_dataset = l2l.vision.datasets.MiniImagenet(root=\"./\", mode=\"validation\", download=False)\n\n\n@dataclass\nclass ImageClassificationInputTransform(InputTransform):\n\n    image_size: Tuple[int, int] = (196, 196)\n    mean: Union[float, Tuple[float, float, float]] = (0.485, 0.456, 0.406)\n    std: Union[float, Tuple[float, float, float]] = (0.229, 0.224, 0.225)\n\n    def per_sample_transform(self):\n        return T.Compose(\n            [\n                ApplyToKeys(\n                    DataKeys.INPUT,\n                    T.Compose(\n                        [\n                            T.ToTensor(),\n                            Kg.Resize((196, 196)),\n                            # SPATIAL\n                            Ka.RandomHorizontalFlip(p=0.25),\n                            Ka.RandomRotation(degrees=90.0, p=0.25),\n                            Ka.RandomAffine(degrees=1 * 5.0, shear=1 / 5, translate=1 / 20, p=0.25),\n                            Ka.RandomPerspective(distortion_scale=1 / 25, p=0.25),\n                            # PIXEL-LEVEL\n                            Ka.ColorJitter(brightness=1 / 30, p=0.25),  # brightness\n                            Ka.ColorJitter(saturation=1 / 30, p=0.25),  # saturation\n                            Ka.ColorJitter(contrast=1 / 30, p=0.25),  # contrast\n                            Ka.ColorJitter(hue=1 / 30, p=0.25),  # hue\n                            Ka.RandomMotionBlur(kernel_size=2 * (4 // 3) + 1, angle=1, direction=1.0, p=0.25),\n                            Ka.RandomErasing(scale=(1 / 100, 1 / 50), ratio=(1 / 20, 1), p=0.25),\n                        ]\n                    ),\n                ),\n                ApplyToKeys(DataKeys.TARGET, torch.as_tensor),\n            ]\n        )\n\n    def train_per_sample_transform(self):\n        return T.Compose(\n            [\n                ApplyToKeys(\n                    DataKeys.INPUT,\n                    T.Compose(\n                        [\n                            T.ToTensor(),\n                            T.Resize(self.image_size),\n                            T.Normalize(self.mean, self.std),\n                            T.RandomHorizontalFlip(),\n                            T.ColorJitter(),\n                            T.RandomAutocontrast(),\n                            T.RandomPerspective(),\n                        ]\n                    ),\n                ),\n                ApplyToKeys(\"target\", torch.as_tensor),\n            ]\n        )\n\n    def per_batch_transform_on_device(self):\n        return ApplyToKeys(\n            DataKeys.INPUT,\n            Ka.RandomHorizontalFlip(p=0.25),\n        )\n\n    def collate(self):\n        return kornia_collate\n\n\n# construct datamodule\n\ndatamodule = ImageClassificationData.from_tensors(\n    train_data=train_dataset.x,\n    train_targets=torch.from_numpy(train_dataset.y.astype(int)),\n    val_data=val_dataset.x,\n    val_targets=torch.from_numpy(val_dataset.y.astype(int)),\n    train_transform=ImageClassificationInputTransform,\n    val_transform=ImageClassificationInputTransform,\n    batch_size=1,\n)\n\nmodel = ImageClassifier(\n    backbone=\"resnet18\",\n    training_strategy=\"prototypicalnetworks\",\n    training_strategy_kwargs={\n        \"epoch_length\": 10 * 16,\n        \"meta_batch_size\": 1,\n        \"num_tasks\": 200,\n        \"test_num_tasks\": 2000,\n        \"ways\": datamodule.num_classes,\n        \"shots\": 1,\n        \"test_ways\": 5,\n        \"test_shots\": 1,\n        \"test_queries\": 15,\n    },\n    optimizer=torch.optim.Adam,\n    learning_rate=0.001,\n)\n\ntrainer = flash.Trainer(\n    max_epochs=1,\n    gpus=1,\n    accelerator=\"gpu\",\n    precision=16,\n)\n\ntrainer.finetune(model, datamodule=datamodule, strategy=\"no_freeze\")\n", "path": "flash_examples/integrations/learn2learn/image_classification_imagenette_mini.py"}]}