From 9000953cdcf1b716b7b3322b0f0b06559dcb2a3a Mon Sep 17 00:00:00 2001 From: Douglas Hanley Date: Wed, 16 Oct 2024 22:19:03 -0500 Subject: [PATCH] add metal backend (untested) --- gadget/compute.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gadget/compute.py b/gadget/compute.py index 505f41f..a4ad851 100644 --- a/gadget/compute.py +++ b/gadget/compute.py @@ -17,6 +17,7 @@ ggml_build_forward_expand, ggml_backend_cpu_init, ggml_backend_cuda_init, + ggml_backend_metal_init, ggml_backend_free, ggml_backend_alloc_ctx_tensors, ggml_backend_get_default_buffer_type, @@ -84,6 +85,9 @@ def create_backend(self, name): num = 0 if num is None else str(num) self.backend = ggml_backend_cuda_init(num) self.backend_type = 'cuda' + elif name == 'metal': + self.backend = ggml_backend_metal_init() + self.backend_type = 'metal' else: raise ValueError(f'unknown backend: {name}')