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 ONNXRuntime support #157

Merged
merged 3 commits into from
Jun 18, 2020
Merged

Add ONNXRuntime support #157

merged 3 commits into from
Jun 18, 2020

Conversation

tanaysoni
Copy link
Contributor

@tanaysoni tanaysoni commented Jun 17, 2020

This PR adds the conversion of PyTorch BERT models to ONNX format for inference with ONNXRuntime.

Speed benchmarks: https://docs.google.com/spreadsheets/d/1ak9Cxj1zcNBDtjf7qn2j_ydKDDzpBgWiyJ7cO-7BPvA/edit#gid=0

Usage:

from haystack.reader.farm import FARMReader
from pathlib import Path

FARMReader.convert_to_onnx(
    model_name_or_path="deepset/bert-base-cased-squad2", optimize_for="gpu_tensor_core"
)  # exports the model to ./onnx-export dir
FARMReader(model_name_or_path=Path("onnx-export"))  # load the ONNX model

@tanaysoni tanaysoni changed the title WIP: Add ONNXRuntime support Add ONNXRuntime support Jun 18, 2020
@tanaysoni tanaysoni requested a review from tholor June 18, 2020 12:33
Copy link
Member

@tholor tholor left a comment

Choose a reason for hiding this comment

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

Looking good once the merge conflict is resolved

@datalee
Copy link

datalee commented Apr 10, 2021

support dpr model?

@Timoeller
Copy link
Contributor

Not yet, for this we would need the convert_to_onnx method defined in the AdaptiveModel implemented in the BiadaptiveModel

@akmalmasud96
Copy link

Hi,
is there support available for the EmbeddingRetrieval in onnx?

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.

None yet

5 participants