Skip to content

Commit a7f9325

Browse files
committed
dont crash when pooling_type is specified but in generation mode (possibly useful for server)
1 parent 632a718 commit a7f9325

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llama.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12343,7 +12343,7 @@ static void llama_set_inputs(llama_context & lctx, const llama_batch & batch) {
1234312343
}
1234412344
}
1234512345

12346-
if (cparams.pooling_type == LLAMA_POOLING_TYPE_MEAN) {
12346+
if (cparams.embeddings && cparams.pooling_type == LLAMA_POOLING_TYPE_MEAN) {
1234712347
const int64_t n_tokens = batch.n_tokens;
1234812348

1234912349
GGML_ASSERT(lctx.inp_mean);
@@ -12375,7 +12375,7 @@ static void llama_set_inputs(llama_context & lctx, const llama_batch & batch) {
1237512375
}
1237612376
}
1237712377

12378-
if (cparams.pooling_type == LLAMA_POOLING_TYPE_CLS) {
12378+
if (cparams.embeddings && cparams.pooling_type == LLAMA_POOLING_TYPE_CLS) {
1237912379
const int64_t n_tokens = batch.n_tokens;
1238012380

1238112381
GGML_ASSERT(lctx.inp_cls);
@@ -12396,7 +12396,7 @@ static void llama_set_inputs(llama_context & lctx, const llama_batch & batch) {
1239612396
}
1239712397
}
1239812398

12399-
if (cparams.pooling_type == LLAMA_POOLING_TYPE_LAST) {
12399+
if (cparams.embeddings && cparams.pooling_type == LLAMA_POOLING_TYPE_LAST) {
1240012400
const int64_t n_tokens = batch.n_tokens;
1240112401

1240212402
GGML_ASSERT(lctx.inp_cls);

0 commit comments

Comments
 (0)