Skip to content

Commit 7062dd8

Browse files
authored
llama-context: only warn on pooling_type when user specified (ggml-org#16674)
The unexpeced pooling_type warning was incorrectly shown when users did not specify the --pooling-type parameter. In this case, the parameter defaults to `LLAMA_POOLING_TYPE_UNSPECIFIED (-1)`, and the code automatically applies the model's default pooling type. Example of spurious warning: ``` $ llama-embedding -hf ggml-org/bge-m3-Q8_0-GGUF -p "hello" ... llama_init_from_model: model default pooling_type is [2], but [-1] was specified ... ``` This fix ensures the warning only appears when users explicitly specify a pooling type that differs from the model's default (e.g., using --pooling-type mean on a model that expects CLS pooling).
1 parent 0398752 commit 7062dd8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/llama-context.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2346,7 +2346,8 @@ llama_context * llama_init_from_model(
23462346
return nullptr;
23472347
}
23482348

2349-
if (params.pooling_type != model->hparams.pooling_type) {
2349+
if (params.pooling_type != LLAMA_POOLING_TYPE_UNSPECIFIED &&
2350+
params.pooling_type != model->hparams.pooling_type) {
23502351
//user-specified pooling-type is different from the model default
23512352
LLAMA_LOG_WARN("%s: model default pooling_type is [%d], but [%d] was specified\n", __func__,
23522353
model->hparams.pooling_type, params.pooling_type);

0 commit comments

Comments
 (0)