Skip to content

Commit a1bfaa5

Browse files
committed
add pooling to qwen2
1 parent 9d16cd1 commit a1bfaa5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

llama.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8212,6 +8212,7 @@ struct llm_build_context {
82128212
cb(cur, "result_embd_pooled", -1);
82138213
} break;
82148214
case LLAMA_POOLING_TYPE_CLS:
8215+
case LLAMA_POOLING_TYPE_LAST:
82158216
{
82168217
cur = ggml_get_rows(ctx0, cur, inp_cls);
82178218
cb(cur, "result_embd_pooled", -1);
@@ -8738,8 +8739,11 @@ struct llm_build_context {
87388739
// inp_pos - contains the positions
87398740
struct ggml_tensor * inp_pos = build_inp_pos();
87408741

8741-
// inp_cls - contains the CLS/SEP token
8742-
struct ggml_tensor * inp_cls = build_inp_cls();
8742+
struct ggml_tensor * inp_cls = nullptr;
8743+
if (cparams.embeddings) {
8744+
// inp_cls - contains the CLS/SEP token
8745+
inp_cls = build_inp_cls();
8746+
}
87438747

87448748
// KQ_mask (mask for 1 head, it will be broadcasted to all heads)
87458749
struct ggml_tensor * KQ_mask = build_inp_KQ_mask();

0 commit comments

Comments
 (0)