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

Using ONNX for inference in haystack #419

Closed
laifuchicago opened this issue Sep 22, 2020 · 3 comments
Closed

Using ONNX for inference in haystack #419

laifuchicago opened this issue Sep 22, 2020 · 3 comments
Assignees
Labels
type:feature New feature or request

Comments

@laifuchicago
Copy link

To Author:
After I converted my model to onnx, how can I use haystack Elasticsearch to do the inference? Or currently haystack does not support?

Jonathan Sung

@tholor
Copy link
Member

tholor commented Sep 22, 2020

Hey @laifuchicago ,

not yet, but we are on it :)
Should be available within the next sprint.

@tholor tholor added the type:feature New feature or request label Sep 22, 2020
@tholor tholor changed the title Can I use haystack Elasticsearch to do the onnx inference? Can I use haystack to do the onnx inference? Sep 22, 2020
@tholor tholor changed the title Can I use haystack to do the onnx inference? Using ONNX for inference in haystack Sep 22, 2020
@tholor
Copy link
Member

tholor commented Sep 22, 2020

Depends on deepset-ai/FARM#539

@tanaysoni
Copy link
Contributor

Hi @laifuchicago, with #438, you can use convert & use ONNX models for BERT, RoBERTa & XLM-RoBERTa.

Here's a sample code snippet to convert RoBERTa to ONNX format and create a FARMReader instance:

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

onnx_model_path = Path("roberta-onnx-model")
FARMReader.convert_to_onnx(model_name="deepset/roberta-base-squad2", output_path=onnx_model_path)

reader = FARMReader(onnx_model_path)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants