Skip to content

Add support for JinaAI Re-Rankers V1 #582

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

Merged
merged 13 commits into from
Apr 29, 2025
Merged

Add support for JinaAI Re-Rankers V1 #582

merged 13 commits into from
Apr 29, 2025

Conversation

alvarobartt
Copy link
Member

@alvarobartt alvarobartt commented Apr 14, 2025

What does this PR do?

This PR adds the JinaBertClassificationHead in order to support the JinaBERT re-ranking models as e.g. jinaai/jina-reranker-v1-turbo-en. Note that JinaBERT's classification head is exactly the same as standard BERT's.

Warning

This PR is not yet ready to be merged, as there seem to be some discrepancies between the Sentence Transformers and ONNX outputs (those are aligned), but the outputs for the default Candle backend is not, meaning that there may be something off somewhere. Also it has yet only been tested on CPU and MPS devices, CUDA support is still missing / pending.

In order to test the enabled models, please refer the the following revisions (until those are merged):

cargo run --release --features candle,http --no-default-features -- --model-id jinaai/jina-reranker-v1-turbo-en --revision refs/pr/13 --dtype float32
cargo run --release --features candle,http --no-default-features -- --model-id jinaai/jina-reranker-v1-tiny-en --revision refs/pr/11 --dtype float32

Fixes #579

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline, Pull Request section?
  • Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the documentation guidelines, and here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@alvarobartt alvarobartt marked this pull request as ready for review April 15, 2025 15:50
@alvarobartt alvarobartt requested review from Narsil and McPatate and removed request for McPatate April 16, 2025 16:50
@alvarobartt alvarobartt changed the title Add support for JinaAI Re-rankers Add support for JinaAI Re-Rankers V1 Apr 29, 2025
@CoolFish88
Copy link

Hello @Narsil,

I managed to test the proposed changes in this PR and they solve the previous limitations.
I was wondering if you have some bandwidth to review this PR such that the solution can be merged into the main branch.

Thanks for the continued support in developing and maintaining this service!

Copy link
Collaborator

@Narsil Narsil left a comment

Choose a reason for hiding this comment

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

LGTM

@Narsil Narsil merged commit 251d7d3 into main Apr 29, 2025
14 checks passed
@Narsil Narsil deleted the jina-reranker branch April 29, 2025 11:19
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.

Error: could not create backend -> jinaai/jina-reranker-v1-turbo-en
3 participants