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

feat: Support for bge-reranker-v2-m3 #118

Merged
merged 3 commits into from
Sep 29, 2024

Conversation

rozgo
Copy link
Contributor

@rozgo rozgo commented Sep 29, 2024

This PR introduces support for the BGE Reranker V2 M3 model and enhances the flexibility of user-defined reranking models. Key changes include:

  1. Added BGERerankerV2M3 to the RerankerModel enum, supporting the "bge-reranker-v2-m3" model.

  2. Introduced OnnxSource enum to allow loading ONNX models from either memory or file:

    • OnnxSource::Memory(Vec<u8>)
    • OnnxSource::File(PathBuf)
  3. Updated UserDefinedRerankingModel to use OnnxSource instead of Vec<u8> for ONNX data.

  4. Modified TextRerank::try_new_from_user_defined() to handle both memory and file-based ONNX sources.

  5. Added support for additional files in RerankerModelInfo to accommodate models with multiple files (e.g., BGE Reranker V2 M3).

  6. Updated the reranking test to be more flexible with result ordering, as different models may produce slightly different rankings.

  7. Added a new test test_user_defined_reranking_large_model() to demonstrate loading and using the BGE Reranker V2 M3 model.

@Anush008
Copy link
Owner

Hi @rozgo. Thanks for contributing.
I am taking a look now.

src/reranking/init.rs Outdated Show resolved Hide resolved
Copy link
Owner

@Anush008 Anush008 left a comment

Choose a reason for hiding this comment

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

Thank you Alex.

Please feel free to add yourself to the authors list in the Cargo.toml.

@Anush008
Copy link
Owner

P.S. Please add the model to the list in the README.md.

@Anush008 Anush008 changed the title adds support for bge-reranker-v2-m3 feat: Support for bge-reranker-v2-m3 Sep 29, 2024
@Anush008 Anush008 merged commit bcd6304 into Anush008:main Sep 29, 2024
2 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 29, 2024
# [4.1.0](v4.0.0...v4.1.0) (2024-09-29)

### Features

* Support for bge-reranker-v2-m3 ([#118](#118)) ([bcd6304](bcd6304))

## [4.1.0](v4.0.0...v4.1.0) (2024-09-29)

### 🍕 Features

* Support for bge-reranker-v2-m3 ([#118](#118)) ([bcd6304](bcd6304))
Copy link

🎉 This PR is included in version 4.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants