We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Scheduled workflow failed
Oh no, something went wrong in the scheduled workflow **PyTorch version tests with commit 98844bf82b963a429d22b09f650cb0af2023bf20**.
Please look into it:

https://github.com/pytorch/ignite/actions/runs/2923090334

Feel free to close this if this was just a one-off error.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ignite/metrics/gan/utils.py`
Content:
```
1 from typing import Callable, Optional, Union
2 
3 import torch
4 from packaging.version import Version
5 
6 from ignite.metrics.metric import Metric
7 
8 
9 class InceptionModel(torch.nn.Module):
10     r"""Inception Model pre-trained on the ImageNet Dataset.
11 
12     Args:
13         return_features: set it to `True` if you want the model to return features from the last pooling
14             layer instead of prediction probabilities.
15         device: specifies which device updates are accumulated on. Setting the
16             metric's device to be the same as your ``update`` arguments ensures the ``update`` method is
17             non-blocking. By default, CPU.
18     """
19 
20     def __init__(self, return_features: bool, device: Union[str, torch.device] = "cpu") -> None:
21         try:
22             from torchvision import models
23         except ImportError:
24             raise RuntimeError("This module requires torchvision to be installed.")
25         super(InceptionModel, self).__init__()
26         self._device = device
27         if Version(torch.__version__) <= Version("1.7.0"):
28             model_kwargs = {"pretrained": True}
29         else:
30             model_kwargs = {"weights": models.Inception_V3_Weights.DEFAULT}
31 
32         self.model = models.inception_v3(**model_kwargs).to(self._device)
33 
34         if return_features:
35             self.model.fc = torch.nn.Identity()
36         else:
37             self.model.fc = torch.nn.Sequential(self.model.fc, torch.nn.Softmax(dim=1))
38         self.model.eval()
39 
40     @torch.no_grad()
41     def forward(self, data: torch.Tensor) -> torch.Tensor:
42         if data.dim() != 4:
43             raise ValueError(f"Inputs should be a tensor of dim 4, got {data.dim()}")
44         if data.shape[1] != 3:
45             raise ValueError(f"Inputs should be a tensor with 3 channels, got {data.shape}")
46         if data.device != torch.device(self._device):
47             data = data.to(self._device)
48         return self.model(data)
49 
50 
51 class _BaseInceptionMetric(Metric):
52     def __init__(
53         self,
54         num_features: Optional[int],
55         feature_extractor: Optional[torch.nn.Module],
56         output_transform: Callable = lambda x: x,
57         device: Union[str, torch.device] = torch.device("cpu"),
58     ) -> None:
59 
60         if num_features is None:
61             raise ValueError("Argument num_features must be provided, if feature_extractor is specified.")
62 
63         if feature_extractor is None:
64             feature_extractor = torch.nn.Identity()
65 
66         if num_features <= 0:
67             raise ValueError(f"Argument num_features must be greater to zero, got: {num_features}")
68 
69         if not isinstance(feature_extractor, torch.nn.Module):
70             raise TypeError(
71                 f"Argument feature_extractor must be of type torch.nn.Module, got {type(self._feature_extractor)}"
72             )
73 
74         self._num_features = num_features
75         self._feature_extractor = feature_extractor.to(device)
76 
77         super(_BaseInceptionMetric, self).__init__(output_transform=output_transform, device=device)
78 
79     def _check_feature_shapes(self, samples: torch.Tensor) -> None:
80 
81         if samples.dim() != 2:
82             raise ValueError(f"feature_extractor output must be a tensor of dim 2, got: {samples.dim()}")
83 
84         if samples.shape[0] == 0:
85             raise ValueError(f"Batch size should be greater than one, got: {samples.shape[0]}")
86 
87         if samples.shape[1] != self._num_features:
88             raise ValueError(
89                 f"num_features returned by feature_extractor should be {self._num_features}, got: {samples.shape[1]}"
90             )
91 
92     def _extract_features(self, inputs: torch.Tensor) -> torch.Tensor:
93 
94         inputs = inputs.detach()
95 
96         if inputs.device != torch.device(self._device):
97             inputs = inputs.to(self._device)
98 
99         with torch.no_grad():
100             outputs = self._feature_extractor(inputs).to(self._device, dtype=torch.float64)
101         self._check_feature_shapes(outputs)
102 
103         return outputs
104
```
--- 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/ignite/metrics/gan/utils.py b/ignite/metrics/gan/utils.py
--- a/ignite/metrics/gan/utils.py
+++ b/ignite/metrics/gan/utils.py
@@ -19,12 +19,13 @@
 
     def __init__(self, return_features: bool, device: Union[str, torch.device] = "cpu") -> None:
         try:
+            import torchvision
             from torchvision import models
         except ImportError:
             raise RuntimeError("This module requires torchvision to be installed.")
         super(InceptionModel, self).__init__()
         self._device = device
-        if Version(torch.__version__) <= Version("1.7.0"):
+        if Version(torchvision.__version__) < Version("0.13.0"):
             model_kwargs = {"pretrained": True}
         else:
             model_kwargs = {"weights": models.Inception_V3_Weights.DEFAULT}

{"golden_diff": "diff --git a/ignite/metrics/gan/utils.py b/ignite/metrics/gan/utils.py\n--- a/ignite/metrics/gan/utils.py\n+++ b/ignite/metrics/gan/utils.py\n@@ -19,12 +19,13 @@\n \n     def __init__(self, return_features: bool, device: Union[str, torch.device] = \"cpu\") -> None:\n         try:\n+            import torchvision\n             from torchvision import models\n         except ImportError:\n             raise RuntimeError(\"This module requires torchvision to be installed.\")\n         super(InceptionModel, self).__init__()\n         self._device = device\n-        if Version(torch.__version__) <= Version(\"1.7.0\"):\n+        if Version(torchvision.__version__) < Version(\"0.13.0\"):\n             model_kwargs = {\"pretrained\": True}\n         else:\n             model_kwargs = {\"weights\": models.Inception_V3_Weights.DEFAULT}\n", "issue": "Scheduled workflow failed\nOh no, something went wrong in the scheduled workflow **PyTorch version tests with commit 98844bf82b963a429d22b09f650cb0af2023bf20**.\nPlease look into it:\n\nhttps://github.com/pytorch/ignite/actions/runs/2923090334\n\nFeel free to close this if this was just a one-off error.\n\n", "before_files": [{"content": "from typing import Callable, Optional, Union\n\nimport torch\nfrom packaging.version import Version\n\nfrom ignite.metrics.metric import Metric\n\n\nclass InceptionModel(torch.nn.Module):\n    r\"\"\"Inception Model pre-trained on the ImageNet Dataset.\n\n    Args:\n        return_features: set it to `True` if you want the model to return features from the last pooling\n            layer instead of prediction probabilities.\n        device: specifies which device updates are accumulated on. Setting the\n            metric's device to be the same as your ``update`` arguments ensures the ``update`` method is\n            non-blocking. By default, CPU.\n    \"\"\"\n\n    def __init__(self, return_features: bool, device: Union[str, torch.device] = \"cpu\") -> None:\n        try:\n            from torchvision import models\n        except ImportError:\n            raise RuntimeError(\"This module requires torchvision to be installed.\")\n        super(InceptionModel, self).__init__()\n        self._device = device\n        if Version(torch.__version__) <= Version(\"1.7.0\"):\n            model_kwargs = {\"pretrained\": True}\n        else:\n            model_kwargs = {\"weights\": models.Inception_V3_Weights.DEFAULT}\n\n        self.model = models.inception_v3(**model_kwargs).to(self._device)\n\n        if return_features:\n            self.model.fc = torch.nn.Identity()\n        else:\n            self.model.fc = torch.nn.Sequential(self.model.fc, torch.nn.Softmax(dim=1))\n        self.model.eval()\n\n    @torch.no_grad()\n    def forward(self, data: torch.Tensor) -> torch.Tensor:\n        if data.dim() != 4:\n            raise ValueError(f\"Inputs should be a tensor of dim 4, got {data.dim()}\")\n        if data.shape[1] != 3:\n            raise ValueError(f\"Inputs should be a tensor with 3 channels, got {data.shape}\")\n        if data.device != torch.device(self._device):\n            data = data.to(self._device)\n        return self.model(data)\n\n\nclass _BaseInceptionMetric(Metric):\n    def __init__(\n        self,\n        num_features: Optional[int],\n        feature_extractor: Optional[torch.nn.Module],\n        output_transform: Callable = lambda x: x,\n        device: Union[str, torch.device] = torch.device(\"cpu\"),\n    ) -> None:\n\n        if num_features is None:\n            raise ValueError(\"Argument num_features must be provided, if feature_extractor is specified.\")\n\n        if feature_extractor is None:\n            feature_extractor = torch.nn.Identity()\n\n        if num_features <= 0:\n            raise ValueError(f\"Argument num_features must be greater to zero, got: {num_features}\")\n\n        if not isinstance(feature_extractor, torch.nn.Module):\n            raise TypeError(\n                f\"Argument feature_extractor must be of type torch.nn.Module, got {type(self._feature_extractor)}\"\n            )\n\n        self._num_features = num_features\n        self._feature_extractor = feature_extractor.to(device)\n\n        super(_BaseInceptionMetric, self).__init__(output_transform=output_transform, device=device)\n\n    def _check_feature_shapes(self, samples: torch.Tensor) -> None:\n\n        if samples.dim() != 2:\n            raise ValueError(f\"feature_extractor output must be a tensor of dim 2, got: {samples.dim()}\")\n\n        if samples.shape[0] == 0:\n            raise ValueError(f\"Batch size should be greater than one, got: {samples.shape[0]}\")\n\n        if samples.shape[1] != self._num_features:\n            raise ValueError(\n                f\"num_features returned by feature_extractor should be {self._num_features}, got: {samples.shape[1]}\"\n            )\n\n    def _extract_features(self, inputs: torch.Tensor) -> torch.Tensor:\n\n        inputs = inputs.detach()\n\n        if inputs.device != torch.device(self._device):\n            inputs = inputs.to(self._device)\n\n        with torch.no_grad():\n            outputs = self._feature_extractor(inputs).to(self._device, dtype=torch.float64)\n        self._check_feature_shapes(outputs)\n\n        return outputs\n", "path": "ignite/metrics/gan/utils.py"}], "after_files": [{"content": "from typing import Callable, Optional, Union\n\nimport torch\nfrom packaging.version import Version\n\nfrom ignite.metrics.metric import Metric\n\n\nclass InceptionModel(torch.nn.Module):\n    r\"\"\"Inception Model pre-trained on the ImageNet Dataset.\n\n    Args:\n        return_features: set it to `True` if you want the model to return features from the last pooling\n            layer instead of prediction probabilities.\n        device: specifies which device updates are accumulated on. Setting the\n            metric's device to be the same as your ``update`` arguments ensures the ``update`` method is\n            non-blocking. By default, CPU.\n    \"\"\"\n\n    def __init__(self, return_features: bool, device: Union[str, torch.device] = \"cpu\") -> None:\n        try:\n            import torchvision\n            from torchvision import models\n        except ImportError:\n            raise RuntimeError(\"This module requires torchvision to be installed.\")\n        super(InceptionModel, self).__init__()\n        self._device = device\n        if Version(torchvision.__version__) < Version(\"0.13.0\"):\n            model_kwargs = {\"pretrained\": True}\n        else:\n            model_kwargs = {\"weights\": models.Inception_V3_Weights.DEFAULT}\n\n        self.model = models.inception_v3(**model_kwargs).to(self._device)\n\n        if return_features:\n            self.model.fc = torch.nn.Identity()\n        else:\n            self.model.fc = torch.nn.Sequential(self.model.fc, torch.nn.Softmax(dim=1))\n        self.model.eval()\n\n    @torch.no_grad()\n    def forward(self, data: torch.Tensor) -> torch.Tensor:\n        if data.dim() != 4:\n            raise ValueError(f\"Inputs should be a tensor of dim 4, got {data.dim()}\")\n        if data.shape[1] != 3:\n            raise ValueError(f\"Inputs should be a tensor with 3 channels, got {data.shape}\")\n        if data.device != torch.device(self._device):\n            data = data.to(self._device)\n        return self.model(data)\n\n\nclass _BaseInceptionMetric(Metric):\n    def __init__(\n        self,\n        num_features: Optional[int],\n        feature_extractor: Optional[torch.nn.Module],\n        output_transform: Callable = lambda x: x,\n        device: Union[str, torch.device] = torch.device(\"cpu\"),\n    ) -> None:\n\n        if num_features is None:\n            raise ValueError(\"Argument num_features must be provided, if feature_extractor is specified.\")\n\n        if feature_extractor is None:\n            feature_extractor = torch.nn.Identity()\n\n        if num_features <= 0:\n            raise ValueError(f\"Argument num_features must be greater to zero, got: {num_features}\")\n\n        if not isinstance(feature_extractor, torch.nn.Module):\n            raise TypeError(\n                f\"Argument feature_extractor must be of type torch.nn.Module, got {type(self._feature_extractor)}\"\n            )\n\n        self._num_features = num_features\n        self._feature_extractor = feature_extractor.to(device)\n\n        super(_BaseInceptionMetric, self).__init__(output_transform=output_transform, device=device)\n\n    def _check_feature_shapes(self, samples: torch.Tensor) -> None:\n\n        if samples.dim() != 2:\n            raise ValueError(f\"feature_extractor output must be a tensor of dim 2, got: {samples.dim()}\")\n\n        if samples.shape[0] == 0:\n            raise ValueError(f\"Batch size should be greater than one, got: {samples.shape[0]}\")\n\n        if samples.shape[1] != self._num_features:\n            raise ValueError(\n                f\"num_features returned by feature_extractor should be {self._num_features}, got: {samples.shape[1]}\"\n            )\n\n    def _extract_features(self, inputs: torch.Tensor) -> torch.Tensor:\n\n        inputs = inputs.detach()\n\n        if inputs.device != torch.device(self._device):\n            inputs = inputs.to(self._device)\n\n        with torch.no_grad():\n            outputs = self._feature_extractor(inputs).to(self._device, dtype=torch.float64)\n        self._check_feature_shapes(outputs)\n\n        return outputs\n", "path": "ignite/metrics/gan/utils.py"}]}