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

Add support for ONNX runtime #71

Merged
merged 2 commits into from
Dec 1, 2023
Merged

Conversation

antas-marcin
Copy link
Contributor

@antas-marcin antas-marcin commented Nov 24, 2023

This PR adds support for ONNX runtime.
Adds 5 models capable running using ONNX vectorizer:

  • BAAI/bge-small-en - 384d
  • BAAI/bge-small-en-v1.5 - 384d
  • BAAI/bge-base-en - 768d
  • BAAI/bge-base-en-v1.5 - 768d
  • sentence-transformers/all-MiniLM-L6-v2 - 384d

@antas-marcin antas-marcin requested a review from a team as a code owner November 24, 2023 07:44
@antas-marcin antas-marcin marked this pull request as draft November 24, 2023 07:44
@antas-marcin antas-marcin force-pushed the add-support-for-onnx-runtime branch 2 times, most recently from cd77973 to 5f57ea5 Compare November 30, 2023 21:20
@antas-marcin antas-marcin force-pushed the add-support-for-onnx-runtime branch from 5f57ea5 to 2436eeb Compare November 30, 2023 22:03
@antas-marcin antas-marcin force-pushed the add-support-for-onnx-runtime branch from f6dae49 to f5bbf90 Compare December 1, 2023 07:50
@antas-marcin antas-marcin marked this pull request as ready for review December 1, 2023 07:50
@antas-marcin antas-marcin changed the title Add support for ONNX AI models Add support for ONNX runtime Dec 1, 2023
Copy link
Contributor

@tsmith023 tsmith023 left a comment

Choose a reason for hiding this comment

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

LGTM :) Comments are only speculative and don't require changes!

def download_onnx_model(model_name: str, model_dir: str):
# Download model and tokenizer
onnx_path = Path(model_dir)
ort_model = ORTModelForFeatureExtraction.from_pretrained(model_name, from_transformers=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm surprised that this is the optimum.onnxruntime class to use for loading embedding models with ONNX but it seems to be used elsewhere for the same task

download.py Show resolved Hide resolved
@antas-marcin antas-marcin merged commit 1ebc017 into main Dec 1, 2023
26 checks passed
@antas-marcin antas-marcin deleted the add-support-for-onnx-runtime branch December 1, 2023 15:59
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