From 6b0486c216d639257b48f7c0b0bb01358bdbc765 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Sun, 9 Mar 2025 11:29:08 -0700 Subject: [PATCH] duplicate token_embd to output --- ml/backend/ggml/ggml.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ml/backend/ggml/ggml.go b/ml/backend/ggml/ggml.go index 9ff4446b3..b4efe9da4 100644 --- a/ml/backend/ggml/ggml.go +++ b/ml/backend/ggml/ggml.go @@ -240,6 +240,9 @@ func New(r *os.File, params ml.BackendParams) (ml.Backend, error) { switch { case contains(t.Name, "position_embd", "token_embd", "token_norm_embd", "token_types"): createTensor(tensor{source: t}, input.bts) + if _, ok := meta.Tensors().GroupLayers()["output"]; !ok && t.Name == "token_embd.weight" { + createTensor(tensor{source: t, target: "output.weight"}, output.bts) + } case contains(t.Name, "cls", "output", "output_norm"): createTensor(tensor{source: t}, output.bts) case strings.HasPrefix(t.Name, "v.") || strings.HasPrefix(t.Name, "mm."):