Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Reranker example #598

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

srv1n
Copy link

@srv1n srv1n commented Dec 8, 2024

The parent llama.cpp repo recently added support for reranking.

This PR

  • Adds a rerank example
  • adds a new pooling type called rank( matches with llama.cpp implementation) in params
  • initialized_logits made public in llamabatch

Validated against all examples in the llama.cpp and BGE-reranker-v2-m3 and all rerank scores match.

Please review, make edits and feel free to commit. Thank you for the awesome repo!

Copy link
Contributor

@MarcusDunn MarcusDunn left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks for the PR.

my only question is, why did you make initialized_logits public?

@MarcusDunn
Copy link
Contributor

MarcusDunn commented Dec 8, 2024

also, is the submodule up to date enough to support this? yes it is.

@srv1n
Copy link
Author

srv1n commented Dec 9, 2024

I was trying to match it as closely with the original llama.cpp repo. Specifically the batch decode treats pooling type none and the other pooling types differently. .

I initially started off trying to modify the embedding example to match the original repo ( since reranking in llama.cpp is built into the examples/embedding.cpp ).

Its actually not being used in the reranking (since pooling is set to rank), but does it make sense to leave it public so we could use it with pooling type none if required?

@MarcusDunn
Copy link
Contributor

sorry for the late reply!

I would prefer we keep it private unless it is required to have a feature work.

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