浏览代码

llama: add patch to avoid errors on arrays of strigns

jmorganca 1 月之前
父节点
当前提交
554aed43bd
共有 2 个文件被更改,包括 21 次插入1 次删除
  1. 21 0
      llama/patches/0019-allow-arrays-of-strings.patch
  2. 0 1
      ml/backend/ggml/ggml/src/gguf.cpp

+ 21 - 0
llama/patches/0019-allow-arrays-of-strings.patch

@@ -0,0 +1,21 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: jmorganca <jmorganca@gmail.com>
+Date: Wed, 5 Mar 2025 17:41:07 -0800
+Subject: [PATCH] allow arrays of strings
+
+---
+ ggml/src/gguf.cpp | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/ggml/src/gguf.cpp b/ggml/src/gguf.cpp
+index ab13669c..9dfefd43 100644
+--- a/ggml/src/gguf.cpp
++++ b/ggml/src/gguf.cpp
+@@ -777,7 +777,6 @@ enum gguf_type gguf_get_arr_type(const struct gguf_context * ctx, int64_t key_id
+ 
+ const void * gguf_get_arr_data(const struct gguf_context * ctx, int64_t key_id) {
+     GGML_ASSERT(key_id >= 0 && key_id < gguf_get_n_kv(ctx));
+-    GGML_ASSERT(ctx->kv[key_id].get_type() != GGUF_TYPE_STRING);
+     return ctx->kv[key_id].data.data();
+ }
+ 

+ 0 - 1
ml/backend/ggml/ggml/src/gguf.cpp

@@ -777,7 +777,6 @@ enum gguf_type gguf_get_arr_type(const struct gguf_context * ctx, int64_t key_id
 
 const void * gguf_get_arr_data(const struct gguf_context * ctx, int64_t key_id) {
     GGML_ASSERT(key_id >= 0 && key_id < gguf_get_n_kv(ctx));
-    GGML_ASSERT(ctx->kv[key_id].get_type() != GGUF_TYPE_STRING);
     return ctx->kv[key_id].data.data();
 }