From d080bebcc6b46570f5ea40549ab4ef51dff7f3ee Mon Sep 17 00:00:00 2001 From: Douglas Hanley Date: Thu, 8 Feb 2024 23:03:33 -0600 Subject: [PATCH] hard-code token_type = 0 --- llama.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/llama.cpp b/llama.cpp index f58eb7c7b..13966a842 100644 --- a/llama.cpp +++ b/llama.cpp @@ -5746,14 +5746,13 @@ struct llm_build_context { struct ggml_tensor * inpL; // get input vectors with right size - struct ggml_tensor * inp_type = ggml_view_1d(ctx0, lctx.inp_type, n_tokens, 0); struct ggml_tensor * inp_pos = ggml_view_1d(ctx0, lctx.inp_pos, n_tokens, 0); struct ggml_tensor * inp_sum = ggml_view_1d(ctx0, lctx.inp_sum, n_tokens, 0); // construct input embeddings (token, type, position) inpL = llm_build_inp_embd(ctx0, hparams, batch, model.tok_embd, lctx.inp_tokens, lctx.inp_embd, cb); - inpL = ggml_add(ctx0, ggml_get_rows(ctx0, model.type_embd, inp_type), inpL); - inpL = ggml_add(ctx0, ggml_get_rows(ctx0, model.pos_embd, inp_pos), inpL); + inpL = ggml_add(ctx0, inpL, ggml_view_1d(ctx0, model.type_embd, n_embd, 0)); // since type = 0 + inpL = ggml_add(ctx0, inpL, ggml_get_rows(ctx0, model.pos_embd, inp_pos)); cb(inpL, "inp_embd", -1); // embed layer norm