optimum inference for summarization
See original GitHub issueWith reference to the blog: https://huggingface.co/blog/optimum-inference, I am able to do this:
from transformers import AutoTokenizer, pipeline
-from transformers import AutoModelForQuestionAnswering
+from optimum.onnxruntime import ORTModelForQuestionAnswering
-model = AutoModelForQuestionAnswering.from_pretrained("deepset/roberta-base-squad2") # pytorch checkpoint
+model = ORTModelForQuestionAnswering.from_pretrained("optimum/roberta-base-squad2") # onnx checkpoint
tokenizer = AutoTokenizer.from_pretrained("deepset/roberta-base-squad2")
optimum_qa = pipeline("question-answering", model=model, tokenizer=tokenizer)
question = "What's my name?"
context = "My name is Philipp and I live in Nuremberg."
pred = optimum_qa(question, context)
I need to do similar inference for summarization, for the following code:
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("sshleifer/distilbart-cnn-12-6")
model = AutoModelForSeq2SeqLM.from_pretrained("sshleifer/distilbart-cnn-12-6")
I get the following error:
>>> from optimum.onnxruntime import ORTModelForSeq2SeqLM
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'ORTModelForSeq2SeqLM' from 'optimum.onnxruntime' (/datadrive/shilpa/work/virtual_environments/venv_hf_optimum/lib/python3.9/site-packages/optimum/onnxruntime/__init__.py)
https://huggingface.co/docs/optimum/main/en/pipelines - mentions “text-generation” as one of the supported tasks, “summarization” i assumed comes under this category. Am I right?
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Accelerated Inference with Optimum and Transformers Pipelines
Inference has landed in Optimum with support for Hugging Face Transformers pipelines, including text-generation using ONNX Runtime.
Read more >Text summarization with Amazon SageMaker and Hugging Face
These tools provide you with faster implementation and testing of ML models to achieve your optimal outcomes. From the SageMaker Hugging Face ......
Read more >Setting up a Text Summarisation Project - Towards Data Science
The idea is to teach the model what summaries for abstracts of research papers look like by showing it many examples. Over time...
Read more >Looking Beyond Sentence-Level Natural Language Inference ...
In this work, we use the multiple-choice reading comprehension. (MCRC) and checking factual correctness of textual summarization (CFCS) tasks to ...
Read more >Inference Summary | Coursera
Inference : Summary ... Probabilistic Graphical Models 2: Inference ... algorithm relative to the optimum answer even if we can't get to the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Ierezell sorry not yet. I ll try to update this issue if we have a concrete timeline for it.
@ShilpaSangappa @Ierezell the
text2text-generation
,summarization
andtranslation
pipelines are finally supported as we merged #199