mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-11 08:17:03 +00:00
llama: update vendored code to commit 46e3556 (#8308)
This commit is contained in:
@@ -4,14 +4,15 @@ Date: Mon, 16 Sep 2024 15:53:14 -0700
|
||||
Subject: [PATCH] embeddings
|
||||
|
||||
---
|
||||
src/llama.cpp | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
src/llama-context.cpp | 2 +-
|
||||
src/llama.cpp | 6 ++++--
|
||||
2 files changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/llama.cpp b/src/llama.cpp
|
||||
index 626c3e3f..9e292c4f 100644
|
||||
--- a/src/llama.cpp
|
||||
+++ b/src/llama.cpp
|
||||
@@ -17419,7 +17419,7 @@ static size_t llama_output_reserve(llama_context & lctx, size_t n_outputs) {
|
||||
diff --git a/src/llama-context.cpp b/src/llama-context.cpp
|
||||
index 38a55fb2..b9c4a5bf 100644
|
||||
--- a/src/llama-context.cpp
|
||||
+++ b/src/llama-context.cpp
|
||||
@@ -475,7 +475,7 @@ size_t llama_output_reserve(struct llama_context & lctx, size_t n_outputs) {
|
||||
const auto n_embd = hparams.n_embd;
|
||||
|
||||
// TODO: use a per-batch flag for logits presence instead
|
||||
@@ -20,7 +21,11 @@ index 626c3e3f..9e292c4f 100644
|
||||
const bool has_embd = cparams.embeddings && (cparams.pooling_type == LLAMA_POOLING_TYPE_NONE);
|
||||
|
||||
const size_t logits_size = has_logits ? n_vocab*n_outputs_max : 0;
|
||||
@@ -17714,7 +17714,6 @@ static int llama_decode_internal(
|
||||
diff --git a/src/llama.cpp b/src/llama.cpp
|
||||
index ea78ea48..4eb3f6b9 100644
|
||||
--- a/src/llama.cpp
|
||||
+++ b/src/llama.cpp
|
||||
@@ -10876,7 +10876,6 @@ static int llama_decode_internal(
|
||||
res = nullptr;
|
||||
embd = nullptr;
|
||||
} else if (cparams.embeddings) {
|
||||
@@ -28,7 +33,7 @@ index 626c3e3f..9e292c4f 100644
|
||||
embd = nullptr;
|
||||
for (int i = ggml_graph_n_nodes(gf) - 1; i >= 0; --i) {
|
||||
if (strcmp(ggml_graph_node(gf, i)->name, "result_embd_pooled") == 0) {
|
||||
@@ -17722,11 +17721,15 @@ static int llama_decode_internal(
|
||||
@@ -10884,12 +10883,15 @@ static int llama_decode_internal(
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -37,7 +42,7 @@ index 626c3e3f..9e292c4f 100644
|
||||
embd = nullptr; // do not extract embeddings when not needed
|
||||
GGML_ASSERT(strcmp(res->name, "result_output") == 0 && "missing result_output tensor");
|
||||
}
|
||||
+
|
||||
|
||||
+ if (!cparams.causal_attn) {
|
||||
+ res = nullptr; // do not extract logits when not needed
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user