Skip to content

Commit f8c1f36

Browse files
authored
fix(embed): mark all tokens as output to suppress llama.cpp 'overriding' INFO (#2208) (#2212)
1 parent f774690 commit f8c1f36

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- feat: Update llama.cpp to ggerganov/llama.cpp@5d6f18a63 and sync Python bindings
1111
- fix: Correct batched embedding outputs for multi-sequence `embed()` calls by @Anai-Guo in #2205
1212
- fix: Configure embedding contexts with enough sequence slots for batched `embed()` calls
13+
- fix: Mark all embedding input tokens as outputs to avoid llama.cpp override warnings by @Anai-Guo in #2212
1314

1415
## [0.3.22]
1516

‎llama_cpp/llama.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,13 @@ def embed(
10401040

10411041
# get pooling information
10421042
pooling_type = self.pooling_type()
1043-
logits_all = pooling_type == llama_cpp.LLAMA_POOLING_TYPE_NONE
1043+
# In embedding mode every input token must be marked as an output, regardless of
1044+
# pooling type. llama.cpp would otherwise override per-token `logits[i]` and emit
1045+
# "embeddings required but some input tokens were not marked as outputs ->
1046+
# overriding" once per input. Pooling NONE vs MEAN/CLS only changes how the
1047+
# per-token outputs are read back (see decode_batch below), not whether they are
1048+
# produced. See abetlen/llama-cpp-python#2208.
1049+
logits_all = True
10441050

10451051
if self.context_params.embeddings is False:
10461052
raise RuntimeError(

0 commit comments

Comments
 (0)