Skip to content

add llama_get_pooling_type function#6862

Merged
ggerganov merged 2 commits intoggml-org:masterfrom
iamlemec:get-pooling-type
Apr 24, 2024
Merged

add llama_get_pooling_type function#6862
ggerganov merged 2 commits intoggml-org:masterfrom
iamlemec:get-pooling-type

Conversation

@iamlemec
Copy link
Copy Markdown
Collaborator

This allows the user to inspect the realized value of the context's pooling_type. In cases where UNSPECIFIED is passed as the context parameter, this helps identify the default pooling type coming from the model. This is useful because, depending on the pooling type, different values for logits in the batch may need to be passed and the embeddings outputs are of different size (and require different functions to access).

Comment thread llama.h Outdated
LLAMA_API enum llama_rope_type llama_rope_type (const struct llama_model * model);
LLAMA_API enum llama_vocab_type llama_vocab_type (const struct llama_model * model);
LLAMA_API enum llama_rope_type llama_rope_type (const struct llama_model * model);
LLAMA_API enum llama_pooling_type llama_pooling_type(const struct llama_context * model);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move up next to the other llama_context functions

Suggested change
LLAMA_API enum llama_pooling_type llama_pooling_type(const struct llama_context * model);
LLAMA_API enum llama_pooling_type llama_pooling_type(const struct llama_context * ctx);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the argument name. Moved up higher, but didn't seem like aligning signature was worth it.

@ggerganov ggerganov merged commit b4e4b8a into ggml-org:master Apr 24, 2024
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
* add llama_get_pooling_type function

* fix argument name, move with ctx funcs
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
* add llama_get_pooling_type function

* fix argument name, move with ctx funcs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants