We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Deprecate `create_multi_gpu_supervised_trainer` APIs
**Is your feature request related to a problem? Please describe.**
As we already set up MONAI workflow based on our own SupervisedTrainer, seems no need to keep the ignite trainer APIs which were developed at the beginning of the project.
Would be nice to deprecate them:
https://github.com/Project-MONAI/MONAI/blob/dev/monai/engines/multi_gpu_supervised_trainer.py

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `monai/engines/multi_gpu_supervised_trainer.py`
Content:
```
1 # Copyright (c) MONAI Consortium
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
5 #     http://www.apache.org/licenses/LICENSE-2.0
6 # Unless required by applicable law or agreed to in writing, software
7 # distributed under the License is distributed on an "AS IS" BASIS,
8 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 # See the License for the specific language governing permissions and
10 # limitations under the License.
11 
12 from __future__ import annotations
13 
14 from collections.abc import Callable, Sequence
15 from typing import TYPE_CHECKING
16 
17 import torch.nn
18 from torch.nn.parallel import DataParallel, DistributedDataParallel
19 from torch.optim.optimizer import Optimizer
20 
21 from monai.config import IgniteInfo
22 from monai.engines.utils import get_devices_spec
23 from monai.utils import min_version, optional_import
24 
25 create_supervised_trainer, _ = optional_import(
26     "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "create_supervised_trainer"
27 )
28 create_supervised_evaluator, _ = optional_import(
29     "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "create_supervised_evaluator"
30 )
31 _prepare_batch, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "_prepare_batch")
32 if TYPE_CHECKING:
33     from ignite.engine import Engine
34     from ignite.metrics import Metric
35 else:
36     Engine, _ = optional_import(
37         "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator"
38     )
39     Metric, _ = optional_import(
40         "ignite.metrics", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Metric", as_type="decorator"
41     )
42 
43 __all__ = ["create_multigpu_supervised_trainer", "create_multigpu_supervised_evaluator"]
44 
45 
46 def _default_transform(_x: torch.Tensor, _y: torch.Tensor, _y_pred: torch.Tensor, loss: torch.Tensor) -> float:
47     return loss.item()
48 
49 
50 def _default_eval_transform(
51     x: torch.Tensor, y: torch.Tensor, y_pred: torch.Tensor
52 ) -> tuple[torch.Tensor, torch.Tensor]:
53     return y_pred, y
54 
55 
56 def create_multigpu_supervised_trainer(
57     net: torch.nn.Module,
58     optimizer: Optimizer,
59     loss_fn: Callable,
60     devices: Sequence[str | torch.device] | None = None,
61     non_blocking: bool = False,
62     prepare_batch: Callable = _prepare_batch,
63     output_transform: Callable = _default_transform,
64     distributed: bool = False,
65 ) -> Engine:
66     """
67     Derived from `create_supervised_trainer` in Ignite.
68 
69     Factory function for creating a trainer for supervised models.
70 
71     Args:
72         net: the network to train.
73         optimizer: the optimizer to use.
74         loss_fn: the loss function to use.
75         devices: device(s) type specification (default: None).
76             Applies to both model and batches. None is all devices used, empty list is CPU only.
77         non_blocking: if True and this copy is between CPU and GPU, the copy may occur asynchronously
78             with respect to the host. For other cases, this argument has no effect.
79         prepare_batch: function that receives `batch`, `device`, `non_blocking` and outputs
80             tuple of tensors `(batch_x, batch_y)`.
81         output_transform: function that receives 'x', 'y', 'y_pred', 'loss' and returns value
82             to be assigned to engine's state.output after each iteration. Default is returning `loss.item()`.
83         distributed: whether convert model to `DistributedDataParallel`, if `True`, `devices` must contain
84             only 1 GPU or CPU for current distributed rank.
85 
86     Returns:
87         Engine: a trainer engine with supervised update function.
88 
89     Note:
90         `engine.state.output` for this engine is defined by `output_transform` parameter and is the loss
91         of the processed batch by default.
92     """
93 
94     devices_ = get_devices_spec(devices)
95     if distributed:
96         if len(devices_) > 1:
97             raise ValueError(f"for distributed training, `devices` must contain only 1 GPU or CPU, but got {devices_}.")
98         net = DistributedDataParallel(net, device_ids=devices_)
99     elif len(devices_) > 1:
100         net = DataParallel(net)
101 
102     return create_supervised_trainer(  # type: ignore[no-any-return]
103         net, optimizer, loss_fn, devices_[0], non_blocking, prepare_batch, output_transform
104     )
105 
106 
107 def create_multigpu_supervised_evaluator(
108     net: torch.nn.Module,
109     metrics: dict[str, Metric] | None = None,
110     devices: Sequence[str | torch.device] | None = None,
111     non_blocking: bool = False,
112     prepare_batch: Callable = _prepare_batch,
113     output_transform: Callable = _default_eval_transform,
114     distributed: bool = False,
115 ) -> Engine:
116     """
117     Derived from `create_supervised_evaluator` in Ignite.
118 
119     Factory function for creating an evaluator for supervised models.
120 
121     Args:
122         net: the model to train.
123         metrics: a map of metric names to Metrics.
124         devices: device(s) type specification (default: None).
125             Applies to both model and batches. None is all devices used, empty list is CPU only.
126         non_blocking: if True and this copy is between CPU and GPU, the copy may occur asynchronously
127             with respect to the host. For other cases, this argument has no effect.
128         prepare_batch: function that receives `batch`, `device`, `non_blocking` and outputs
129             tuple of tensors `(batch_x, batch_y)`.
130         output_transform: function that receives 'x', 'y', 'y_pred' and returns value
131             to be assigned to engine's state.output after each iteration. Default is returning `(y_pred, y,)`
132             which fits output expected by metrics. If you change it you should use `output_transform` in metrics.
133         distributed: whether convert model to `DistributedDataParallel`, if `True`, `devices` must contain
134             only 1 GPU or CPU for current distributed rank.
135 
136     Note:
137         `engine.state.output` for this engine is defined by `output_transform` parameter and is
138         a tuple of `(batch_pred, batch_y)` by default.
139 
140     Returns:
141         Engine: an evaluator engine with supervised inference function.
142     """
143 
144     devices_ = get_devices_spec(devices)
145 
146     if distributed:
147         net = DistributedDataParallel(net, device_ids=devices_)
148         if len(devices_) > 1:
149             raise ValueError(
150                 f"for distributed evaluation, `devices` must contain only 1 GPU or CPU, but got {devices_}."
151             )
152     elif len(devices_) > 1:
153         net = DataParallel(net)
154 
155     return create_supervised_evaluator(  # type: ignore[no-any-return]
156         net, metrics, devices_[0], non_blocking, prepare_batch, output_transform
157     )
158
```
--- 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/monai/engines/multi_gpu_supervised_trainer.py b/monai/engines/multi_gpu_supervised_trainer.py
--- a/monai/engines/multi_gpu_supervised_trainer.py
+++ b/monai/engines/multi_gpu_supervised_trainer.py
@@ -20,7 +20,7 @@
 
 from monai.config import IgniteInfo
 from monai.engines.utils import get_devices_spec
-from monai.utils import min_version, optional_import
+from monai.utils import deprecated, min_version, optional_import
 
 create_supervised_trainer, _ = optional_import(
     "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "create_supervised_trainer"
@@ -53,6 +53,11 @@
     return y_pred, y
 
 
+@deprecated(
+    since="1.1",
+    removed="1.3",
+    msg_suffix=("Native ignite engine lacks support of many MONAI features, please use `SupervisedTrainer` instead."),
+)
 def create_multigpu_supervised_trainer(
     net: torch.nn.Module,
     optimizer: Optimizer,
@@ -100,10 +105,23 @@
         net = DataParallel(net)
 
     return create_supervised_trainer(  # type: ignore[no-any-return]
-        net, optimizer, loss_fn, devices_[0], non_blocking, prepare_batch, output_transform
+        model=net,
+        optimizer=optimizer,
+        loss_fn=loss_fn,
+        device=devices_[0],
+        non_blocking=non_blocking,
+        prepare_batch=prepare_batch,
+        output_transform=output_transform,
     )
 
 
+@deprecated(
+    since="1.1",
+    removed="1.3",
+    msg_suffix=(
+        "Native ignite evaluator lacks support of many MONAI features, please use `SupervisedEvaluator` instead."
+    ),
+)
 def create_multigpu_supervised_evaluator(
     net: torch.nn.Module,
     metrics: dict[str, Metric] | None = None,
@@ -153,5 +171,10 @@
         net = DataParallel(net)
 
     return create_supervised_evaluator(  # type: ignore[no-any-return]
-        net, metrics, devices_[0], non_blocking, prepare_batch, output_transform
+        model=net,
+        metrics=metrics,
+        device=devices_[0],
+        non_blocking=non_blocking,
+        prepare_batch=prepare_batch,
+        output_transform=output_transform,
     )

{"golden_diff": "diff --git a/monai/engines/multi_gpu_supervised_trainer.py b/monai/engines/multi_gpu_supervised_trainer.py\n--- a/monai/engines/multi_gpu_supervised_trainer.py\n+++ b/monai/engines/multi_gpu_supervised_trainer.py\n@@ -20,7 +20,7 @@\n \n from monai.config import IgniteInfo\n from monai.engines.utils import get_devices_spec\n-from monai.utils import min_version, optional_import\n+from monai.utils import deprecated, min_version, optional_import\n \n create_supervised_trainer, _ = optional_import(\n     \"ignite.engine\", IgniteInfo.OPT_IMPORT_VERSION, min_version, \"create_supervised_trainer\"\n@@ -53,6 +53,11 @@\n     return y_pred, y\n \n \n+@deprecated(\n+    since=\"1.1\",\n+    removed=\"1.3\",\n+    msg_suffix=(\"Native ignite engine lacks support of many MONAI features, please use `SupervisedTrainer` instead.\"),\n+)\n def create_multigpu_supervised_trainer(\n     net: torch.nn.Module,\n     optimizer: Optimizer,\n@@ -100,10 +105,23 @@\n         net = DataParallel(net)\n \n     return create_supervised_trainer(  # type: ignore[no-any-return]\n-        net, optimizer, loss_fn, devices_[0], non_blocking, prepare_batch, output_transform\n+        model=net,\n+        optimizer=optimizer,\n+        loss_fn=loss_fn,\n+        device=devices_[0],\n+        non_blocking=non_blocking,\n+        prepare_batch=prepare_batch,\n+        output_transform=output_transform,\n     )\n \n \n+@deprecated(\n+    since=\"1.1\",\n+    removed=\"1.3\",\n+    msg_suffix=(\n+        \"Native ignite evaluator lacks support of many MONAI features, please use `SupervisedEvaluator` instead.\"\n+    ),\n+)\n def create_multigpu_supervised_evaluator(\n     net: torch.nn.Module,\n     metrics: dict[str, Metric] | None = None,\n@@ -153,5 +171,10 @@\n         net = DataParallel(net)\n \n     return create_supervised_evaluator(  # type: ignore[no-any-return]\n-        net, metrics, devices_[0], non_blocking, prepare_batch, output_transform\n+        model=net,\n+        metrics=metrics,\n+        device=devices_[0],\n+        non_blocking=non_blocking,\n+        prepare_batch=prepare_batch,\n+        output_transform=output_transform,\n     )\n", "issue": "Deprecate `create_multi_gpu_supervised_trainer` APIs\n**Is your feature request related to a problem? Please describe.**\r\nAs we already set up MONAI workflow based on our own SupervisedTrainer, seems no need to keep the ignite trainer APIs which were developed at the beginning of the project.\r\nWould be nice to deprecate them:\r\nhttps://github.com/Project-MONAI/MONAI/blob/dev/monai/engines/multi_gpu_supervised_trainer.py\n", "before_files": [{"content": "# Copyright (c) MONAI Consortium\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#     http://www.apache.org/licenses/LICENSE-2.0\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\nfrom __future__ import annotations\n\nfrom collections.abc import Callable, Sequence\nfrom typing import TYPE_CHECKING\n\nimport torch.nn\nfrom torch.nn.parallel import DataParallel, DistributedDataParallel\nfrom torch.optim.optimizer import Optimizer\n\nfrom monai.config import IgniteInfo\nfrom monai.engines.utils import get_devices_spec\nfrom monai.utils import min_version, optional_import\n\ncreate_supervised_trainer, _ = optional_import(\n    \"ignite.engine\", IgniteInfo.OPT_IMPORT_VERSION, min_version, \"create_supervised_trainer\"\n)\ncreate_supervised_evaluator, _ = optional_import(\n    \"ignite.engine\", IgniteInfo.OPT_IMPORT_VERSION, min_version, \"create_supervised_evaluator\"\n)\n_prepare_batch, _ = optional_import(\"ignite.engine\", IgniteInfo.OPT_IMPORT_VERSION, min_version, \"_prepare_batch\")\nif TYPE_CHECKING:\n    from ignite.engine import Engine\n    from ignite.metrics import Metric\nelse:\n    Engine, _ = optional_import(\n        \"ignite.engine\", IgniteInfo.OPT_IMPORT_VERSION, min_version, \"Engine\", as_type=\"decorator\"\n    )\n    Metric, _ = optional_import(\n        \"ignite.metrics\", IgniteInfo.OPT_IMPORT_VERSION, min_version, \"Metric\", as_type=\"decorator\"\n    )\n\n__all__ = [\"create_multigpu_supervised_trainer\", \"create_multigpu_supervised_evaluator\"]\n\n\ndef _default_transform(_x: torch.Tensor, _y: torch.Tensor, _y_pred: torch.Tensor, loss: torch.Tensor) -> float:\n    return loss.item()\n\n\ndef _default_eval_transform(\n    x: torch.Tensor, y: torch.Tensor, y_pred: torch.Tensor\n) -> tuple[torch.Tensor, torch.Tensor]:\n    return y_pred, y\n\n\ndef create_multigpu_supervised_trainer(\n    net: torch.nn.Module,\n    optimizer: Optimizer,\n    loss_fn: Callable,\n    devices: Sequence[str | torch.device] | None = None,\n    non_blocking: bool = False,\n    prepare_batch: Callable = _prepare_batch,\n    output_transform: Callable = _default_transform,\n    distributed: bool = False,\n) -> Engine:\n    \"\"\"\n    Derived from `create_supervised_trainer` in Ignite.\n\n    Factory function for creating a trainer for supervised models.\n\n    Args:\n        net: the network to train.\n        optimizer: the optimizer to use.\n        loss_fn: the loss function to use.\n        devices: device(s) type specification (default: None).\n            Applies to both model and batches. None is all devices used, empty list is CPU only.\n        non_blocking: if True and this copy is between CPU and GPU, the copy may occur asynchronously\n            with respect to the host. For other cases, this argument has no effect.\n        prepare_batch: function that receives `batch`, `device`, `non_blocking` and outputs\n            tuple of tensors `(batch_x, batch_y)`.\n        output_transform: function that receives 'x', 'y', 'y_pred', 'loss' and returns value\n            to be assigned to engine's state.output after each iteration. Default is returning `loss.item()`.\n        distributed: whether convert model to `DistributedDataParallel`, if `True`, `devices` must contain\n            only 1 GPU or CPU for current distributed rank.\n\n    Returns:\n        Engine: a trainer engine with supervised update function.\n\n    Note:\n        `engine.state.output` for this engine is defined by `output_transform` parameter and is the loss\n        of the processed batch by default.\n    \"\"\"\n\n    devices_ = get_devices_spec(devices)\n    if distributed:\n        if len(devices_) > 1:\n            raise ValueError(f\"for distributed training, `devices` must contain only 1 GPU or CPU, but got {devices_}.\")\n        net = DistributedDataParallel(net, device_ids=devices_)\n    elif len(devices_) > 1:\n        net = DataParallel(net)\n\n    return create_supervised_trainer(  # type: ignore[no-any-return]\n        net, optimizer, loss_fn, devices_[0], non_blocking, prepare_batch, output_transform\n    )\n\n\ndef create_multigpu_supervised_evaluator(\n    net: torch.nn.Module,\n    metrics: dict[str, Metric] | None = None,\n    devices: Sequence[str | torch.device] | None = None,\n    non_blocking: bool = False,\n    prepare_batch: Callable = _prepare_batch,\n    output_transform: Callable = _default_eval_transform,\n    distributed: bool = False,\n) -> Engine:\n    \"\"\"\n    Derived from `create_supervised_evaluator` in Ignite.\n\n    Factory function for creating an evaluator for supervised models.\n\n    Args:\n        net: the model to train.\n        metrics: a map of metric names to Metrics.\n        devices: device(s) type specification (default: None).\n            Applies to both model and batches. None is all devices used, empty list is CPU only.\n        non_blocking: if True and this copy is between CPU and GPU, the copy may occur asynchronously\n            with respect to the host. For other cases, this argument has no effect.\n        prepare_batch: function that receives `batch`, `device`, `non_blocking` and outputs\n            tuple of tensors `(batch_x, batch_y)`.\n        output_transform: function that receives 'x', 'y', 'y_pred' and returns value\n            to be assigned to engine's state.output after each iteration. Default is returning `(y_pred, y,)`\n            which fits output expected by metrics. If you change it you should use `output_transform` in metrics.\n        distributed: whether convert model to `DistributedDataParallel`, if `True`, `devices` must contain\n            only 1 GPU or CPU for current distributed rank.\n\n    Note:\n        `engine.state.output` for this engine is defined by `output_transform` parameter and is\n        a tuple of `(batch_pred, batch_y)` by default.\n\n    Returns:\n        Engine: an evaluator engine with supervised inference function.\n    \"\"\"\n\n    devices_ = get_devices_spec(devices)\n\n    if distributed:\n        net = DistributedDataParallel(net, device_ids=devices_)\n        if len(devices_) > 1:\n            raise ValueError(\n                f\"for distributed evaluation, `devices` must contain only 1 GPU or CPU, but got {devices_}.\"\n            )\n    elif len(devices_) > 1:\n        net = DataParallel(net)\n\n    return create_supervised_evaluator(  # type: ignore[no-any-return]\n        net, metrics, devices_[0], non_blocking, prepare_batch, output_transform\n    )\n", "path": "monai/engines/multi_gpu_supervised_trainer.py"}], "after_files": [{"content": "# Copyright (c) MONAI Consortium\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#     http://www.apache.org/licenses/LICENSE-2.0\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\nfrom __future__ import annotations\n\nfrom collections.abc import Callable, Sequence\nfrom typing import TYPE_CHECKING\n\nimport torch.nn\nfrom torch.nn.parallel import DataParallel, DistributedDataParallel\nfrom torch.optim.optimizer import Optimizer\n\nfrom monai.config import IgniteInfo\nfrom monai.engines.utils import get_devices_spec\nfrom monai.utils import deprecated, min_version, optional_import\n\ncreate_supervised_trainer, _ = optional_import(\n    \"ignite.engine\", IgniteInfo.OPT_IMPORT_VERSION, min_version, \"create_supervised_trainer\"\n)\ncreate_supervised_evaluator, _ = optional_import(\n    \"ignite.engine\", IgniteInfo.OPT_IMPORT_VERSION, min_version, \"create_supervised_evaluator\"\n)\n_prepare_batch, _ = optional_import(\"ignite.engine\", IgniteInfo.OPT_IMPORT_VERSION, min_version, \"_prepare_batch\")\nif TYPE_CHECKING:\n    from ignite.engine import Engine\n    from ignite.metrics import Metric\nelse:\n    Engine, _ = optional_import(\n        \"ignite.engine\", IgniteInfo.OPT_IMPORT_VERSION, min_version, \"Engine\", as_type=\"decorator\"\n    )\n    Metric, _ = optional_import(\n        \"ignite.metrics\", IgniteInfo.OPT_IMPORT_VERSION, min_version, \"Metric\", as_type=\"decorator\"\n    )\n\n__all__ = [\"create_multigpu_supervised_trainer\", \"create_multigpu_supervised_evaluator\"]\n\n\ndef _default_transform(_x: torch.Tensor, _y: torch.Tensor, _y_pred: torch.Tensor, loss: torch.Tensor) -> float:\n    return loss.item()\n\n\ndef _default_eval_transform(\n    x: torch.Tensor, y: torch.Tensor, y_pred: torch.Tensor\n) -> tuple[torch.Tensor, torch.Tensor]:\n    return y_pred, y\n\n\n@deprecated(\n    since=\"1.1\",\n    removed=\"1.3\",\n    msg_suffix=(\"Native ignite engine lacks support of many MONAI features, please use `SupervisedTrainer` instead.\"),\n)\ndef create_multigpu_supervised_trainer(\n    net: torch.nn.Module,\n    optimizer: Optimizer,\n    loss_fn: Callable,\n    devices: Sequence[str | torch.device] | None = None,\n    non_blocking: bool = False,\n    prepare_batch: Callable = _prepare_batch,\n    output_transform: Callable = _default_transform,\n    distributed: bool = False,\n) -> Engine:\n    \"\"\"\n    Derived from `create_supervised_trainer` in Ignite.\n\n    Factory function for creating a trainer for supervised models.\n\n    Args:\n        net: the network to train.\n        optimizer: the optimizer to use.\n        loss_fn: the loss function to use.\n        devices: device(s) type specification (default: None).\n            Applies to both model and batches. None is all devices used, empty list is CPU only.\n        non_blocking: if True and this copy is between CPU and GPU, the copy may occur asynchronously\n            with respect to the host. For other cases, this argument has no effect.\n        prepare_batch: function that receives `batch`, `device`, `non_blocking` and outputs\n            tuple of tensors `(batch_x, batch_y)`.\n        output_transform: function that receives 'x', 'y', 'y_pred', 'loss' and returns value\n            to be assigned to engine's state.output after each iteration. Default is returning `loss.item()`.\n        distributed: whether convert model to `DistributedDataParallel`, if `True`, `devices` must contain\n            only 1 GPU or CPU for current distributed rank.\n\n    Returns:\n        Engine: a trainer engine with supervised update function.\n\n    Note:\n        `engine.state.output` for this engine is defined by `output_transform` parameter and is the loss\n        of the processed batch by default.\n    \"\"\"\n\n    devices_ = get_devices_spec(devices)\n    if distributed:\n        if len(devices_) > 1:\n            raise ValueError(f\"for distributed training, `devices` must contain only 1 GPU or CPU, but got {devices_}.\")\n        net = DistributedDataParallel(net, device_ids=devices_)\n    elif len(devices_) > 1:\n        net = DataParallel(net)\n\n    return create_supervised_trainer(  # type: ignore[no-any-return]\n        model=net,\n        optimizer=optimizer,\n        loss_fn=loss_fn,\n        device=devices_[0],\n        non_blocking=non_blocking,\n        prepare_batch=prepare_batch,\n        output_transform=output_transform,\n    )\n\n\n@deprecated(\n    since=\"1.1\",\n    removed=\"1.3\",\n    msg_suffix=(\n        \"Native ignite evaluator lacks support of many MONAI features, please use `SupervisedEvaluator` instead.\"\n    ),\n)\ndef create_multigpu_supervised_evaluator(\n    net: torch.nn.Module,\n    metrics: dict[str, Metric] | None = None,\n    devices: Sequence[str | torch.device] | None = None,\n    non_blocking: bool = False,\n    prepare_batch: Callable = _prepare_batch,\n    output_transform: Callable = _default_eval_transform,\n    distributed: bool = False,\n) -> Engine:\n    \"\"\"\n    Derived from `create_supervised_evaluator` in Ignite.\n\n    Factory function for creating an evaluator for supervised models.\n\n    Args:\n        net: the model to train.\n        metrics: a map of metric names to Metrics.\n        devices: device(s) type specification (default: None).\n            Applies to both model and batches. None is all devices used, empty list is CPU only.\n        non_blocking: if True and this copy is between CPU and GPU, the copy may occur asynchronously\n            with respect to the host. For other cases, this argument has no effect.\n        prepare_batch: function that receives `batch`, `device`, `non_blocking` and outputs\n            tuple of tensors `(batch_x, batch_y)`.\n        output_transform: function that receives 'x', 'y', 'y_pred' and returns value\n            to be assigned to engine's state.output after each iteration. Default is returning `(y_pred, y,)`\n            which fits output expected by metrics. If you change it you should use `output_transform` in metrics.\n        distributed: whether convert model to `DistributedDataParallel`, if `True`, `devices` must contain\n            only 1 GPU or CPU for current distributed rank.\n\n    Note:\n        `engine.state.output` for this engine is defined by `output_transform` parameter and is\n        a tuple of `(batch_pred, batch_y)` by default.\n\n    Returns:\n        Engine: an evaluator engine with supervised inference function.\n    \"\"\"\n\n    devices_ = get_devices_spec(devices)\n\n    if distributed:\n        net = DistributedDataParallel(net, device_ids=devices_)\n        if len(devices_) > 1:\n            raise ValueError(\n                f\"for distributed evaluation, `devices` must contain only 1 GPU or CPU, but got {devices_}.\"\n            )\n    elif len(devices_) > 1:\n        net = DataParallel(net)\n\n    return create_supervised_evaluator(  # type: ignore[no-any-return]\n        model=net,\n        metrics=metrics,\n        device=devices_[0],\n        non_blocking=non_blocking,\n        prepare_batch=prepare_batch,\n        output_transform=output_transform,\n    )\n", "path": "monai/engines/multi_gpu_supervised_trainer.py"}]}