From 8b395cb8c44763326ade23b3e4aea46bdeddee72 Mon Sep 17 00:00:00 2001 From: &LED-M& <105789115+xledx@users.noreply.github.com> Date: Tue, 8 Sep 2026 09:44:27 +0900 Subject: [PATCH] fix: preserve BF16 embedding weights for get_rows --- src/model/common/ggml_block.hpp | 1 + src/model/te/clip.hpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/model/common/ggml_block.hpp b/src/model/common/ggml_block.hpp index cc0f69419..0b3cb8650 100644 --- a/src/model/common/ggml_block.hpp +++ b/src/model/common/ggml_block.hpp @@ -309,6 +309,7 @@ class Linear : public UnaryBlock { __STATIC_INLINE__ bool support_get_rows(ggml_type wtype) { switch (wtype) { case GGML_TYPE_F16: + case GGML_TYPE_BF16: case GGML_TYPE_Q8_0: case GGML_TYPE_Q5_1: case GGML_TYPE_Q5_0: diff --git a/src/model/te/clip.hpp b/src/model/te/clip.hpp index 441a26c2a..cac613eda 100644 --- a/src/model/te/clip.hpp +++ b/src/model/te/clip.hpp @@ -145,6 +145,10 @@ class CLIPEmbeddings : public GGMLBlock { params["position_embedding.weight"] = ggml_new_tensor_2d(ctx, position_wtype, embed_dim, num_positions); } + enum ggml_op param_usage_op(const std::string& name) const override { + return name == "token_embedding.weight" ? GGML_OP_GET_ROWS : GGML_OP_NONE; + } + public: CLIPEmbeddings(int64_t embed_dim, int64_t vocab_size = 49408,