]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
clip : use ggml_backend_buffer_is_host (#4205)
authorGeorgi Gerganov <redacted>
Fri, 29 Dec 2023 16:53:34 +0000 (18:53 +0200)
committerGeorgi Gerganov <redacted>
Fri, 29 Dec 2023 16:53:34 +0000 (18:53 +0200)
examples/llava/clip.cpp

index f9326a5cc3dff4c321f7f2b88e6ca46a66fe800d..6a731eeecbc4c9a30f29ef8aab11c7ba43ffe743 100644 (file)
@@ -598,11 +598,7 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
                 return nullptr;
             }
             int num_bytes = ggml_nbytes(cur);
-            if (ggml_backend_is_cpu(new_clip->backend)
-#ifdef GGML_USE_METAL
-            || ggml_backend_is_metal(new_clip->backend)
-#endif
-            ) {
+            if (ggml_backend_buffer_is_host(new_clip->params_buffer)) {
                 // for the CPU and Metal backend, we can read directly into the tensor
                 fin.read(reinterpret_cast<char *>(cur->data), num_bytes);
             } else {