We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG] TypeError: Can't instantiate abstract class MPS_Accelerator with abstract methods
**Describe the bug**
TypeError: Can't instantiate abstract class MPS_Accelerator with abstract methods handles_memory_backpressure, resolves_data_dependency, use_host_timers

**To Reproduce**
Steps to reproduce the behavior:
1. git clone https://github.com/OpenBMB/MiniCPM.git
2. follow setup step.
3. run `!bash lora_finetune.sh` via `lora_finetune.ipynb`

**Expected behavior**
runnable

**ds_report output**
Please run `ds_report` to give us details about your setup.

**Screenshots**
```
    class CudaEventTimer(object):
  File "/Users/katopz/git/MiniCPM/finetune/.venv/lib/python3.11/site-packages/deepspeed/utils/timer.py", line 33, in CudaEventTimer
    def __init__(self, start_event: get_accelerator().Event, end_event: get_accelerator().Event):
                                    ^^^^^^^^^^^^^^^^^
  File "/Users/katopz/git/MiniCPM/finetune/.venv/lib/python3.11/site-packages/deepspeed/accelerator/real_accelerator.py", line 184, in get_accelerator
    ds_accelerator = MPS_Accelerator()
                     ^^^^^^^^^^^^^^^^^
TypeError: Can't instantiate abstract class MPS_Accelerator with abstract methods handles_memory_backpressure, resolves_data_dependency, use_host_timers
```

**System info (please complete the following information):**
 - OS: macOS 14.2.1 (23C71)
 - metal
 - Python 3.11.7

**Launcher context**
deepspeed

**Docker context**
no

**Additional context**



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `accelerator/mps_accelerator.py`
Content:
```
1 # Copyright (c) Microsoft Corporation.
2 # SPDX-License-Identifier: Apache-2.0
3 
4 # DeepSpeed Team
5 
6 import torch
7 
8 from .abstract_accelerator import DeepSpeedAccelerator
9 
10 # During setup stage torch may not be installed, pass on no torch will
11 # allow op builder related API to be executed.
12 try:
13     import torch.mps
14 except ImportError:
15     pass
16 
17 
18 class MPS_Accelerator(DeepSpeedAccelerator):
19 
20     def __init__(self):
21         self._name = "mps"
22         self._communication_backend_name = None
23 
24     def is_synchronized_device(self):
25         return False
26 
27     # Device APIs
28     def device_name(self, device_index=None):
29         if device_index is None:
30             return "mps"
31         return "mps:{}".format(device_index)
32 
33     def device(self, device_index):
34         return torch.device("mps", index=0)
35 
36     def set_device(self, device_index):
37         return
38 
39     def current_device(self):
40         return torch.device("mps", index=0)
41 
42     def current_device_name(self):
43         return "mps:0"
44 
45     def device_count(self):
46         return 1
47 
48     def synchronize(self, device_index=None):
49         return torch.mps.synchronize()
50 
51     # RNG APIs
52     def random(self):
53         return torch.random
54 
55     def set_rng_state(self, new_state, device_index=None):
56         return torch.mps.set_rng_state(new_state)
57 
58     def get_rng_state(self, device_index=None):
59         return torch.mps.get_rng_state()
60 
61     def manual_seed(self, seed):
62         return torch.mps.manual_seed(seed)
63 
64     def manual_seed_all(self, seed):
65         return torch.mps.manual_seed(seed)
66 
67     def seed(self):
68         return torch.mps.seed()
69 
70     def initial_seed(self, seed):
71         return
72 
73     def default_generator(self, device_index):
74         return
75 
76     # Streams/Events
77     @property
78     def Stream(self):
79         return None
80 
81     def stream(self, stream):
82         return None
83 
84     def current_stream(self, device_index=None):
85         return None
86 
87     def default_stream(self, device_index=None):
88         return None
89 
90     @property
91     def Event(self):
92         return None
93 
94     # Memory management
95     def empty_cache(self):
96         return torch.mps.empty_cache()
97 
98     def memory_allocated(self, device_index=None):
99         return torch.mps.current_allocated_memory()
100 
101     def max_memory_allocated(self, device_index=None):
102         return torch.mps.driver_allocated_memory()
103 
104     def set_per_process_memory_fraction(self, fraction):
105         return torch.mps.set_per_process_memory_fraction(fraction)
106 
107     def reset_max_memory_allocated(self, device_index=None):
108         return
109 
110     def memory_cached(self, device_index=None):
111         return
112 
113     def max_memory_cached(self, device_index=None):
114         return
115 
116     def reset_max_memory_cached(self, device_index=None):
117         return
118 
119     def memory_stats(self, device_index=None):
120         return
121 
122     def reset_peak_memory_stats(self, device_index=None):
123         return
124 
125     def memory_reserved(self, device_index=None):
126         return
127 
128     def max_memory_reserved(self, device_index=None):
129         return
130 
131     def total_memory(self, device_index=None):
132         return
133 
134     def available_memory(self, device_index=None):
135         return
136 
137     # Data types
138     def is_bf16_supported(self):
139         return False
140 
141     def is_fp16_supported(self):
142         return False
143 
144     def supported_dtypes(self):
145         return [torch.float]
146 
147     # Misc
148     def amp(self):
149         return
150 
151     def is_available(self):
152         return hasattr(torch.backends, "mps") and torch.backends.mps.is_available()
153 
154     def range_push(self, msg):
155         return
156 
157     def range_pop(self):
158         return
159 
160     def lazy_call(self, callback):
161         return
162 
163     def communication_backend_name(self):
164         return self._communication_backend_name
165 
166     def is_triton_supported(self):
167         return False
168 
169     # Graph operations
170     def create_graph(self):
171         return None
172 
173     def capture_to_graph(self, graph, pool=None, stream=None):
174         from deepspeed.runtime.utils import noop_context
175         return noop_context()
176 
177     def replay_graph(self, graph):
178         return
179 
180     # Tensor operations
181     @property
182     def BFloat16Tensor(self):
183         return
184 
185     @property
186     def ByteTensor(self):
187         return
188 
189     @property
190     def DoubleTensor(self):
191         return
192 
193     @property
194     def FloatTensor(self):
195         return
196 
197     @property
198     def HalfTensor(self):
199         return
200 
201     @property
202     def IntTensor(self):
203         return
204 
205     @property
206     def LongTensor(self):
207         return
208 
209     def pin_memory(self, tensor, align_bytes=1):
210         return tensor.pin_memory()
211 
212     def is_pinned(self, tensor):
213         return tensor.is_pinned()
214 
215     def on_accelerator(self, tensor):
216         device_str = str(tensor.device)
217         if device_str.startswith("mps"):
218             return True
219         else:
220             return False
221 
222     def op_builder_dir(self):
223         try:
224             # is op_builder from deepspeed or a 3p version? this should only succeed if it's deepspeed
225             # if successful this also means we're doing a local install and not JIT compile path
226             from op_builder import __deepspeed__  # noqa: F401 # type: ignore
227 
228             return "op_builder"
229         except ImportError:
230             return "deepspeed.ops.op_builder"
231 
232     # create an instance of op builder, specified by class_name
233     def create_op_builder(self, op_name):
234         builder_class = self.get_op_builder(op_name)
235         if builder_class is not None:
236             return builder_class()
237         return None
238 
239     # return an op builder class, specified by class_name
240     def get_op_builder(self, class_name):
241         from deepspeed.ops.op_builder.cpu import NotImplementedBuilder
242 
243         return NotImplementedBuilder
244 
245     def build_extension(self):
246         from torch.utils.cpp_extension import BuildExtension
247 
248         return BuildExtension
249 
250     def export_envs(self):
251         return []
252
```
--- 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/accelerator/mps_accelerator.py b/accelerator/mps_accelerator.py
--- a/accelerator/mps_accelerator.py
+++ b/accelerator/mps_accelerator.py
@@ -24,6 +24,15 @@
     def is_synchronized_device(self):
         return False
 
+    def use_host_timers(self):
+        return self.is_synchronized_device()
+
+    def resolves_data_dependency(self):
+        return self.is_synchronized_device()
+
+    def handles_memory_backpressure(self):
+        return self.is_synchronized_device()
+
     # Device APIs
     def device_name(self, device_index=None):
         if device_index is None:

{"golden_diff": "diff --git a/accelerator/mps_accelerator.py b/accelerator/mps_accelerator.py\n--- a/accelerator/mps_accelerator.py\n+++ b/accelerator/mps_accelerator.py\n@@ -24,6 +24,15 @@\n     def is_synchronized_device(self):\n         return False\n \n+    def use_host_timers(self):\n+        return self.is_synchronized_device()\n+\n+    def resolves_data_dependency(self):\n+        return self.is_synchronized_device()\n+\n+    def handles_memory_backpressure(self):\n+        return self.is_synchronized_device()\n+\n     # Device APIs\n     def device_name(self, device_index=None):\n         if device_index is None:\n", "issue": "[BUG] TypeError: Can't instantiate abstract class MPS_Accelerator with abstract methods\n**Describe the bug**\r\nTypeError: Can't instantiate abstract class MPS_Accelerator with abstract methods handles_memory_backpressure, resolves_data_dependency, use_host_timers\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. git clone https://github.com/OpenBMB/MiniCPM.git\r\n2. follow setup step.\r\n3. run `!bash lora_finetune.sh` via `lora_finetune.ipynb`\r\n\r\n**Expected behavior**\r\nrunnable\r\n\r\n**ds_report output**\r\nPlease run `ds_report` to give us details about your setup.\r\n\r\n**Screenshots**\r\n```\r\n    class CudaEventTimer(object):\r\n  File \"/Users/katopz/git/MiniCPM/finetune/.venv/lib/python3.11/site-packages/deepspeed/utils/timer.py\", line 33, in CudaEventTimer\r\n    def __init__(self, start_event: get_accelerator().Event, end_event: get_accelerator().Event):\r\n                                    ^^^^^^^^^^^^^^^^^\r\n  File \"/Users/katopz/git/MiniCPM/finetune/.venv/lib/python3.11/site-packages/deepspeed/accelerator/real_accelerator.py\", line 184, in get_accelerator\r\n    ds_accelerator = MPS_Accelerator()\r\n                     ^^^^^^^^^^^^^^^^^\r\nTypeError: Can't instantiate abstract class MPS_Accelerator with abstract methods handles_memory_backpressure, resolves_data_dependency, use_host_timers\r\n```\r\n\r\n**System info (please complete the following information):**\r\n - OS: macOS 14.2.1 (23C71)\r\n - metal\r\n - Python 3.11.7\r\n\r\n**Launcher context**\r\ndeepspeed\r\n\r\n**Docker context**\r\nno\r\n\r\n**Additional context**\r\n\r\n\n", "before_files": [{"content": "# Copyright (c) Microsoft Corporation.\n# SPDX-License-Identifier: Apache-2.0\n\n# DeepSpeed Team\n\nimport torch\n\nfrom .abstract_accelerator import DeepSpeedAccelerator\n\n# During setup stage torch may not be installed, pass on no torch will\n# allow op builder related API to be executed.\ntry:\n    import torch.mps\nexcept ImportError:\n    pass\n\n\nclass MPS_Accelerator(DeepSpeedAccelerator):\n\n    def __init__(self):\n        self._name = \"mps\"\n        self._communication_backend_name = None\n\n    def is_synchronized_device(self):\n        return False\n\n    # Device APIs\n    def device_name(self, device_index=None):\n        if device_index is None:\n            return \"mps\"\n        return \"mps:{}\".format(device_index)\n\n    def device(self, device_index):\n        return torch.device(\"mps\", index=0)\n\n    def set_device(self, device_index):\n        return\n\n    def current_device(self):\n        return torch.device(\"mps\", index=0)\n\n    def current_device_name(self):\n        return \"mps:0\"\n\n    def device_count(self):\n        return 1\n\n    def synchronize(self, device_index=None):\n        return torch.mps.synchronize()\n\n    # RNG APIs\n    def random(self):\n        return torch.random\n\n    def set_rng_state(self, new_state, device_index=None):\n        return torch.mps.set_rng_state(new_state)\n\n    def get_rng_state(self, device_index=None):\n        return torch.mps.get_rng_state()\n\n    def manual_seed(self, seed):\n        return torch.mps.manual_seed(seed)\n\n    def manual_seed_all(self, seed):\n        return torch.mps.manual_seed(seed)\n\n    def seed(self):\n        return torch.mps.seed()\n\n    def initial_seed(self, seed):\n        return\n\n    def default_generator(self, device_index):\n        return\n\n    # Streams/Events\n    @property\n    def Stream(self):\n        return None\n\n    def stream(self, stream):\n        return None\n\n    def current_stream(self, device_index=None):\n        return None\n\n    def default_stream(self, device_index=None):\n        return None\n\n    @property\n    def Event(self):\n        return None\n\n    # Memory management\n    def empty_cache(self):\n        return torch.mps.empty_cache()\n\n    def memory_allocated(self, device_index=None):\n        return torch.mps.current_allocated_memory()\n\n    def max_memory_allocated(self, device_index=None):\n        return torch.mps.driver_allocated_memory()\n\n    def set_per_process_memory_fraction(self, fraction):\n        return torch.mps.set_per_process_memory_fraction(fraction)\n\n    def reset_max_memory_allocated(self, device_index=None):\n        return\n\n    def memory_cached(self, device_index=None):\n        return\n\n    def max_memory_cached(self, device_index=None):\n        return\n\n    def reset_max_memory_cached(self, device_index=None):\n        return\n\n    def memory_stats(self, device_index=None):\n        return\n\n    def reset_peak_memory_stats(self, device_index=None):\n        return\n\n    def memory_reserved(self, device_index=None):\n        return\n\n    def max_memory_reserved(self, device_index=None):\n        return\n\n    def total_memory(self, device_index=None):\n        return\n\n    def available_memory(self, device_index=None):\n        return\n\n    # Data types\n    def is_bf16_supported(self):\n        return False\n\n    def is_fp16_supported(self):\n        return False\n\n    def supported_dtypes(self):\n        return [torch.float]\n\n    # Misc\n    def amp(self):\n        return\n\n    def is_available(self):\n        return hasattr(torch.backends, \"mps\") and torch.backends.mps.is_available()\n\n    def range_push(self, msg):\n        return\n\n    def range_pop(self):\n        return\n\n    def lazy_call(self, callback):\n        return\n\n    def communication_backend_name(self):\n        return self._communication_backend_name\n\n    def is_triton_supported(self):\n        return False\n\n    # Graph operations\n    def create_graph(self):\n        return None\n\n    def capture_to_graph(self, graph, pool=None, stream=None):\n        from deepspeed.runtime.utils import noop_context\n        return noop_context()\n\n    def replay_graph(self, graph):\n        return\n\n    # Tensor operations\n    @property\n    def BFloat16Tensor(self):\n        return\n\n    @property\n    def ByteTensor(self):\n        return\n\n    @property\n    def DoubleTensor(self):\n        return\n\n    @property\n    def FloatTensor(self):\n        return\n\n    @property\n    def HalfTensor(self):\n        return\n\n    @property\n    def IntTensor(self):\n        return\n\n    @property\n    def LongTensor(self):\n        return\n\n    def pin_memory(self, tensor, align_bytes=1):\n        return tensor.pin_memory()\n\n    def is_pinned(self, tensor):\n        return tensor.is_pinned()\n\n    def on_accelerator(self, tensor):\n        device_str = str(tensor.device)\n        if device_str.startswith(\"mps\"):\n            return True\n        else:\n            return False\n\n    def op_builder_dir(self):\n        try:\n            # is op_builder from deepspeed or a 3p version? this should only succeed if it's deepspeed\n            # if successful this also means we're doing a local install and not JIT compile path\n            from op_builder import __deepspeed__  # noqa: F401 # type: ignore\n\n            return \"op_builder\"\n        except ImportError:\n            return \"deepspeed.ops.op_builder\"\n\n    # create an instance of op builder, specified by class_name\n    def create_op_builder(self, op_name):\n        builder_class = self.get_op_builder(op_name)\n        if builder_class is not None:\n            return builder_class()\n        return None\n\n    # return an op builder class, specified by class_name\n    def get_op_builder(self, class_name):\n        from deepspeed.ops.op_builder.cpu import NotImplementedBuilder\n\n        return NotImplementedBuilder\n\n    def build_extension(self):\n        from torch.utils.cpp_extension import BuildExtension\n\n        return BuildExtension\n\n    def export_envs(self):\n        return []\n", "path": "accelerator/mps_accelerator.py"}], "after_files": [{"content": "# Copyright (c) Microsoft Corporation.\n# SPDX-License-Identifier: Apache-2.0\n\n# DeepSpeed Team\n\nimport torch\n\nfrom .abstract_accelerator import DeepSpeedAccelerator\n\n# During setup stage torch may not be installed, pass on no torch will\n# allow op builder related API to be executed.\ntry:\n    import torch.mps\nexcept ImportError:\n    pass\n\n\nclass MPS_Accelerator(DeepSpeedAccelerator):\n\n    def __init__(self):\n        self._name = \"mps\"\n        self._communication_backend_name = None\n\n    def is_synchronized_device(self):\n        return False\n\n    def use_host_timers(self):\n        return self.is_synchronized_device()\n\n    def resolves_data_dependency(self):\n        return self.is_synchronized_device()\n\n    def handles_memory_backpressure(self):\n        return self.is_synchronized_device()\n\n    # Device APIs\n    def device_name(self, device_index=None):\n        if device_index is None:\n            return \"mps\"\n        return \"mps:{}\".format(device_index)\n\n    def device(self, device_index):\n        return torch.device(\"mps\", index=0)\n\n    def set_device(self, device_index):\n        return\n\n    def current_device(self):\n        return torch.device(\"mps\", index=0)\n\n    def current_device_name(self):\n        return \"mps:0\"\n\n    def device_count(self):\n        return 1\n\n    def synchronize(self, device_index=None):\n        return torch.mps.synchronize()\n\n    # RNG APIs\n    def random(self):\n        return torch.random\n\n    def set_rng_state(self, new_state, device_index=None):\n        return torch.mps.set_rng_state(new_state)\n\n    def get_rng_state(self, device_index=None):\n        return torch.mps.get_rng_state()\n\n    def manual_seed(self, seed):\n        return torch.mps.manual_seed(seed)\n\n    def manual_seed_all(self, seed):\n        return torch.mps.manual_seed(seed)\n\n    def seed(self):\n        return torch.mps.seed()\n\n    def initial_seed(self, seed):\n        return\n\n    def default_generator(self, device_index):\n        return\n\n    # Streams/Events\n    @property\n    def Stream(self):\n        return None\n\n    def stream(self, stream):\n        return None\n\n    def current_stream(self, device_index=None):\n        return None\n\n    def default_stream(self, device_index=None):\n        return None\n\n    @property\n    def Event(self):\n        return None\n\n    # Memory management\n    def empty_cache(self):\n        return torch.mps.empty_cache()\n\n    def memory_allocated(self, device_index=None):\n        return torch.mps.current_allocated_memory()\n\n    def max_memory_allocated(self, device_index=None):\n        return torch.mps.driver_allocated_memory()\n\n    def set_per_process_memory_fraction(self, fraction):\n        return torch.mps.set_per_process_memory_fraction(fraction)\n\n    def reset_max_memory_allocated(self, device_index=None):\n        return\n\n    def memory_cached(self, device_index=None):\n        return\n\n    def max_memory_cached(self, device_index=None):\n        return\n\n    def reset_max_memory_cached(self, device_index=None):\n        return\n\n    def memory_stats(self, device_index=None):\n        return\n\n    def reset_peak_memory_stats(self, device_index=None):\n        return\n\n    def memory_reserved(self, device_index=None):\n        return\n\n    def max_memory_reserved(self, device_index=None):\n        return\n\n    def total_memory(self, device_index=None):\n        return\n\n    def available_memory(self, device_index=None):\n        return\n\n    # Data types\n    def is_bf16_supported(self):\n        return False\n\n    def is_fp16_supported(self):\n        return False\n\n    def supported_dtypes(self):\n        return [torch.float]\n\n    # Misc\n    def amp(self):\n        return\n\n    def is_available(self):\n        return hasattr(torch.backends, \"mps\") and torch.backends.mps.is_available()\n\n    def range_push(self, msg):\n        return\n\n    def range_pop(self):\n        return\n\n    def lazy_call(self, callback):\n        return\n\n    def communication_backend_name(self):\n        return self._communication_backend_name\n\n    def is_triton_supported(self):\n        return False\n\n    # Graph operations\n    def create_graph(self):\n        return None\n\n    def capture_to_graph(self, graph, pool=None, stream=None):\n        from deepspeed.runtime.utils import noop_context\n        return noop_context()\n\n    def replay_graph(self, graph):\n        return\n\n    # Tensor operations\n    @property\n    def BFloat16Tensor(self):\n        return\n\n    @property\n    def ByteTensor(self):\n        return\n\n    @property\n    def DoubleTensor(self):\n        return\n\n    @property\n    def FloatTensor(self):\n        return\n\n    @property\n    def HalfTensor(self):\n        return\n\n    @property\n    def IntTensor(self):\n        return\n\n    @property\n    def LongTensor(self):\n        return\n\n    def pin_memory(self, tensor, align_bytes=1):\n        return tensor.pin_memory()\n\n    def is_pinned(self, tensor):\n        return tensor.is_pinned()\n\n    def on_accelerator(self, tensor):\n        device_str = str(tensor.device)\n        if device_str.startswith(\"mps\"):\n            return True\n        else:\n            return False\n\n    def op_builder_dir(self):\n        try:\n            # is op_builder from deepspeed or a 3p version? this should only succeed if it's deepspeed\n            # if successful this also means we're doing a local install and not JIT compile path\n            from op_builder import __deepspeed__  # noqa: F401 # type: ignore\n\n            return \"op_builder\"\n        except ImportError:\n            return \"deepspeed.ops.op_builder\"\n\n    # create an instance of op builder, specified by class_name\n    def create_op_builder(self, op_name):\n        builder_class = self.get_op_builder(op_name)\n        if builder_class is not None:\n            return builder_class()\n        return None\n\n    # return an op builder class, specified by class_name\n    def get_op_builder(self, class_name):\n        from deepspeed.ops.op_builder.cpu import NotImplementedBuilder\n\n        return NotImplementedBuilder\n\n    def build_extension(self):\n        from torch.utils.cpp_extension import BuildExtension\n\n        return BuildExtension\n\n    def export_envs(self):\n        return []\n", "path": "accelerator/mps_accelerator.py"}]}