]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
model-loader : support bool array sliding window pattern (#18850)
authorSigbjørn Skjæret <redacted>
Thu, 15 Jan 2026 09:12:46 +0000 (10:12 +0100)
committerGitHub <redacted>
Thu, 15 Jan 2026 09:12:46 +0000 (10:12 +0100)
src/llama-model-loader.cpp

index e66febaa021b6b20c8121b38fb8e6f1c6d4c20c1..300a322c51ccd7ac859b5dcc89b6a86d392fb93a 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "ggml.h"
 
+#include <algorithm>
 #include <array>
 #include <cinttypes>
 #include <cstring>
@@ -344,6 +345,7 @@ namespace GGUFMeta {
             GGUFMeta::GKV<GGUFMeta::ArrayInfo>::get_kv(ctx, kid);
 
         switch (arr_info.gt) {
+            case GGUF_TYPE_BOOL:
             case GGUF_TYPE_UINT32:
             case GGUF_TYPE_INT32:   GGML_ASSERT((std::is_same<T,     int32_t>::value) ||
                                                 (std::is_same<T,    uint32_t>::value)); break;
@@ -365,7 +367,13 @@ namespace GGUFMeta {
                 result[i] = value;
             }
         } else {
-            std::copy((const T*)arr_info.data, (const T *)arr_info.data + arr_info.length, result.begin());
+            if (arr_info.gt == GGUF_TYPE_BOOL) {
+                std::transform((const bool *)arr_info.data, (const bool *)arr_info.data + arr_info.length, result.begin(), [](bool x) {
+                    return static_cast<T>(x);
+                });
+            } else {
+                std::copy((const T*)arr_info.data, (const T *)arr_info.data + arr_info.length, result.begin());
+            }
         }
 
         return true;