import{S as $m,i as km,s as wm,e as r,k as h,w as v,t as m,M as xm,c as a,d as o,m as f,a as i,x as T,h as p,b as x,G as e,g as k,y as b,q as M,o as q,B as O,v as vm,L as D}from"../../chunks/vendor-hf-doc-builder.js";import{T as io}from"../../chunks/Tip-hf-doc-builder.js";import{D as F}from"../../chunks/Docstring-hf-doc-builder.js";import{C as R}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Z}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as L}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Tm(j){let s,$,d,u,_;return{c(){s=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=r("code"),u=m("Module"),_=m(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=a(l,"CODE",{});var y=i(d);u=p(y,"Module"),y.forEach(o),_=p(l,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),l.forEach(o)},m(n,l){k(n,s,l),e(s,$),e(s,d),e(d,u),e(s,_)},d(n){n&&o(s)}}}function bm(j){let s,$,d,u,_;return u=new R({props:{code:`from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForFeatureExtraction
import torch

tokenizer = AutoTokenizer.from_pretrained("optimum/all-MiniLM-L6-v2")
model = ORTModelForFeatureExtraction.from_pretrained("optimum/all-MiniLM-L6-v2")

inputs = tokenizer("My name is Philipp and I live in Germany.", return_tensors="pt")

outputs = model(**inputs)
logits = outputs.logits
list(logits.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForFeatureExtraction
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/all-MiniLM-L6-v2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForFeatureExtraction.from_pretrained(<span class="hljs-string">&quot;optimum/all-MiniLM-L6-v2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;My name is Philipp and I live in Germany.&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(logits.shape)`}}),{c(){s=r("p"),$=m("Example of feature extraction:"),d=h(),v(u.$$.fragment)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Example of feature extraction:"),l.forEach(o),d=f(n),T(u.$$.fragment,n)},m(n,l){k(n,s,l),e(s,$),k(n,d,l),b(u,n,l),_=!0},p:D,i(n){_||(M(u.$$.fragment,n),_=!0)},o(n){q(u.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(d),O(u,n)}}}function Mm(j){let s,$,d,u,_,n,l,y;return l=new R({props:{code:`from transformers import AutoTokenizer, pipeline
from optimum.onnxruntime import ORTModelForFeatureExtraction

tokenizer = AutoTokenizer.from_pretrained("optimum/all-MiniLM-L6-v2")
model = ORTModelForFeatureExtraction.from_pretrained("optimum/all-MiniLM-L6-v2")
onnx_extractor = pipeline("feature-extraction", model=model, tokenizer=tokenizer)

text = "My name is Philipp and I live in Germany."
pred = onnx_extractor(text)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForFeatureExtraction

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/all-MiniLM-L6-v2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForFeatureExtraction.from_pretrained(<span class="hljs-string">&quot;optimum/all-MiniLM-L6-v2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_extractor = pipeline(<span class="hljs-string">&quot;feature-extraction&quot;</span>, model=model, tokenizer=tokenizer)

<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;My name is Philipp and I live in Germany.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pred = onnx_extractor(text)`}}),{c(){s=r("p"),$=m("Example using "),d=r("code"),u=m("transformers.pipeline"),_=m(":"),n=h(),v(l.$$.fragment)},l(c){s=a(c,"P",{});var w=i(s);$=p(w,"Example using "),d=a(w,"CODE",{});var E=i(d);u=p(E,"transformers.pipeline"),E.forEach(o),_=p(w,":"),w.forEach(o),n=f(c),T(l.$$.fragment,c)},m(c,w){k(c,s,w),e(s,$),e(s,d),e(d,u),e(s,_),k(c,n,w),b(l,c,w),y=!0},p:D,i(c){y||(M(l.$$.fragment,c),y=!0)},o(c){q(l.$$.fragment,c),y=!1},d(c){c&&o(s),c&&o(n),O(l,c)}}}function qm(j){let s,$,d,u,_;return{c(){s=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=r("code"),u=m("Module"),_=m(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=a(l,"CODE",{});var y=i(d);u=p(y,"Module"),y.forEach(o),_=p(l,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),l.forEach(o)},m(n,l){k(n,s,l),e(s,$),e(s,d),e(d,u),e(s,_)},d(n){n&&o(s)}}}function Om(j){let s,$,d,u,_;return u=new R({props:{code:`from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForQuestionAnswering
import torch

tokenizer = AutoTokenizer.from_pretrained("optimum/roberta-base-squad2")
model = ORTModelForQuestionAnswering.from_pretrained("optimum/roberta-base-squad2")

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"
inputs = tokenizer(question, text, return_tensors="pt")
start_positions = torch.tensor([1])
end_positions = torch.tensor([3])

outputs = model(**inputs, start_positions=start_positions, end_positions=end_positions)
start_scores = outputs.start_logits
end_scores = outputs.end_logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/roberta-base-squad2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;optimum/roberta-base-squad2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>question, text = <span class="hljs-string">&quot;Who was Jim Henson?&quot;</span>, <span class="hljs-string">&quot;Jim Henson was a nice puppet&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>start_positions = torch.tensor([<span class="hljs-number">1</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>end_positions = torch.tensor([<span class="hljs-number">3</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, start_positions=start_positions, end_positions=end_positions)
<span class="hljs-meta">&gt;&gt;&gt; </span>start_scores = outputs.start_logits
<span class="hljs-meta">&gt;&gt;&gt; </span>end_scores = outputs.end_logits`}}),{c(){s=r("p"),$=m("Example of question answering:"),d=h(),v(u.$$.fragment)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Example of question answering:"),l.forEach(o),d=f(n),T(u.$$.fragment,n)},m(n,l){k(n,s,l),e(s,$),k(n,d,l),b(u,n,l),_=!0},p:D,i(n){_||(M(u.$$.fragment,n),_=!0)},o(n){q(u.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(d),O(u,n)}}}function ym(j){let s,$,d,u,_,n,l,y;return l=new R({props:{code:`from transformers import AutoTokenizer, pipeline
from optimum.onnxruntime import ORTModelForQuestionAnswering

tokenizer = AutoTokenizer.from_pretrained("optimum/roberta-base-squad2")
model = ORTModelForQuestionAnswering.from_pretrained("optimum/roberta-base-squad2")
onnx_qa = pipeline("question-answering", model=model, tokenizer=tokenizer)

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"
pred = onnx_qa(question, text)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/roberta-base-squad2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;optimum/roberta-base-squad2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_qa = pipeline(<span class="hljs-string">&quot;question-answering&quot;</span>, model=model, tokenizer=tokenizer)

<span class="hljs-meta">&gt;&gt;&gt; </span>question, text = <span class="hljs-string">&quot;Who was Jim Henson?&quot;</span>, <span class="hljs-string">&quot;Jim Henson was a nice puppet&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pred = onnx_qa(question, text)`}}),{c(){s=r("p"),$=m("Example using "),d=r("code"),u=m("transformers.pipeline"),_=m(":"),n=h(),v(l.$$.fragment)},l(c){s=a(c,"P",{});var w=i(s);$=p(w,"Example using "),d=a(w,"CODE",{});var E=i(d);u=p(E,"transformers.pipeline"),E.forEach(o),_=p(w,":"),w.forEach(o),n=f(c),T(l.$$.fragment,c)},m(c,w){k(c,s,w),e(s,$),e(s,d),e(d,u),e(s,_),k(c,n,w),b(l,c,w),y=!0},p:D,i(c){y||(M(l.$$.fragment,c),y=!0)},o(c){q(l.$$.fragment,c),y=!1},d(c){c&&o(s),c&&o(n),O(l,c)}}}function jm(j){let s,$,d,u,_;return{c(){s=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=r("code"),u=m("Module"),_=m(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=a(l,"CODE",{});var y=i(d);u=p(y,"Module"),y.forEach(o),_=p(l,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),l.forEach(o)},m(n,l){k(n,s,l),e(s,$),e(s,d),e(d,u),e(s,_)},d(n){n&&o(s)}}}function Em(j){let s,$,d,u,_;return u=new R({props:{code:`from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSequenceClassification
import torch

tokenizer = AutoTokenizer.from_pretrained("optimum/distilbert-base-uncased-finetuned-sst-2-english")
model = ORTModelForSequenceClassification.from_pretrained("optimum/distilbert-base-uncased-finetuned-sst-2-english")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")

outputs = model(**inputs)
logits = outputs.logits
list(logits.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForSequenceClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/distilbert-base-uncased-finetuned-sst-2-english&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;optimum/distilbert-base-uncased-finetuned-sst-2-english&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(logits.shape)`}}),{c(){s=r("p"),$=m("Example of single-label classification:"),d=h(),v(u.$$.fragment)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Example of single-label classification:"),l.forEach(o),d=f(n),T(u.$$.fragment,n)},m(n,l){k(n,s,l),e(s,$),k(n,d,l),b(u,n,l),_=!0},p:D,i(n){_||(M(u.$$.fragment,n),_=!0)},o(n){q(u.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(d),O(u,n)}}}function Rm(j){let s,$,d,u,_,n,l,y;return l=new R({props:{code:`from transformers import AutoTokenizer, pipeline
from optimum.onnxruntime import ORTModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("optimum/distilbert-base-uncased-finetuned-sst-2-english")
model = ORTModelForSequenceClassification.from_pretrained("optimum/distilbert-base-uncased-finetuned-sst-2-english")
onnx_classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)

text = "Hello, my dog is cute"
pred = onnx_classifier(text)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/distilbert-base-uncased-finetuned-sst-2-english&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;optimum/distilbert-base-uncased-finetuned-sst-2-english&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_classifier = pipeline(<span class="hljs-string">&quot;text-classification&quot;</span>, model=model, tokenizer=tokenizer)

<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pred = onnx_classifier(text)`}}),{c(){s=r("p"),$=m("Example using "),d=r("code"),u=m("transformers.pipelines"),_=m(":"),n=h(),v(l.$$.fragment)},l(c){s=a(c,"P",{});var w=i(s);$=p(w,"Example using "),d=a(w,"CODE",{});var E=i(d);u=p(E,"transformers.pipelines"),E.forEach(o),_=p(w,":"),w.forEach(o),n=f(c),T(l.$$.fragment,c)},m(c,w){k(c,s,w),e(s,$),e(s,d),e(d,u),e(s,_),k(c,n,w),b(l,c,w),y=!0},p:D,i(c){y||(M(l.$$.fragment,c),y=!0)},o(c){q(l.$$.fragment,c),y=!1},d(c){c&&o(s),c&&o(n),O(l,c)}}}function Fm(j){let s,$,d,u,_,n,l,y;return l=new R({props:{code:`from transformers import AutoTokenizer, pipeline
from optimum.onnxruntime import ORTModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("optimum/distilbert-base-uncased-mnli")
model = ORTModelForSequenceClassification.from_pretrained("optimum/distilbert-base-uncased-mnli")
onnx_z0 = pipeline("zero-shot-classification", model=model, tokenizer=tokenizer)

sequence_to_classify = "Who are you voting for in 2020?"
candidate_labels = ["Europe", "public health", "politics", "elections"]
pred = onnx_z0(sequence_to_classify, candidate_labels, multi_class=True)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/distilbert-base-uncased-mnli&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;optimum/distilbert-base-uncased-mnli&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_z0 = pipeline(<span class="hljs-string">&quot;zero-shot-classification&quot;</span>, model=model, tokenizer=tokenizer)

<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_to_classify = <span class="hljs-string">&quot;Who are you voting for in 2020?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>candidate_labels = [<span class="hljs-string">&quot;Europe&quot;</span>, <span class="hljs-string">&quot;public health&quot;</span>, <span class="hljs-string">&quot;politics&quot;</span>, <span class="hljs-string">&quot;elections&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>pred = onnx_z0(sequence_to_classify, candidate_labels, multi_class=<span class="hljs-literal">True</span>)`}}),{c(){s=r("p"),$=m("Example using zero-shot-classification "),d=r("code"),u=m("transformers.pipelines"),_=m(":"),n=h(),v(l.$$.fragment)},l(c){s=a(c,"P",{});var w=i(s);$=p(w,"Example using zero-shot-classification "),d=a(w,"CODE",{});var E=i(d);u=p(E,"transformers.pipelines"),E.forEach(o),_=p(w,":"),w.forEach(o),n=f(c),T(l.$$.fragment,c)},m(c,w){k(c,s,w),e(s,$),e(s,d),e(d,u),e(s,_),k(c,n,w),b(l,c,w),y=!0},p:D,i(c){y||(M(l.$$.fragment,c),y=!0)},o(c){q(l.$$.fragment,c),y=!1},d(c){c&&o(s),c&&o(n),O(l,c)}}}function zm(j){let s,$,d,u,_;return{c(){s=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=r("code"),u=m("Module"),_=m(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=a(l,"CODE",{});var y=i(d);u=p(y,"Module"),y.forEach(o),_=p(l,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),l.forEach(o)},m(n,l){k(n,s,l),e(s,$),e(s,d),e(d,u),e(s,_)},d(n){n&&o(s)}}}function Cm(j){let s,$,d,u,_;return u=new R({props:{code:`from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForTokenClassification
import torch

tokenizer = AutoTokenizer.from_pretrained("optimum/bert-base-NER")
model = ORTModelForTokenClassification.from_pretrained("optimum/bert-base-NER")

inputs = tokenizer("My name is Philipp and I live in Germany.", return_tensors="pt")

outputs = model(**inputs)
logits = outputs.logits
list(logits.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForTokenClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/bert-base-NER&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForTokenClassification.from_pretrained(<span class="hljs-string">&quot;optimum/bert-base-NER&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;My name is Philipp and I live in Germany.&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(logits.shape)`}}),{c(){s=r("p"),$=m("Example of token classification:"),d=h(),v(u.$$.fragment)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Example of token classification:"),l.forEach(o),d=f(n),T(u.$$.fragment,n)},m(n,l){k(n,s,l),e(s,$),k(n,d,l),b(u,n,l),_=!0},p:D,i(n){_||(M(u.$$.fragment,n),_=!0)},o(n){q(u.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(d),O(u,n)}}}function Am(j){let s,$,d,u,_,n,l,y;return l=new R({props:{code:`from transformers import AutoTokenizer, pipeline
from optimum.onnxruntime import ORTModelForTokenClassification

tokenizer = AutoTokenizer.from_pretrained("optimum/bert-base-NER")
model = ORTModelForTokenClassification.from_pretrained("optimum/bert-base-NER")
onnx_ner = pipeline("token-classification", model=model, tokenizer=tokenizer)

text = "My name is Philipp and I live in Germany."
pred = onnx_ner(text)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForTokenClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/bert-base-NER&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForTokenClassification.from_pretrained(<span class="hljs-string">&quot;optimum/bert-base-NER&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_ner = pipeline(<span class="hljs-string">&quot;token-classification&quot;</span>, model=model, tokenizer=tokenizer)

<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;My name is Philipp and I live in Germany.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pred = onnx_ner(text)`}}),{c(){s=r("p"),$=m("Example using "),d=r("code"),u=m("transformers.pipelines"),_=m(":"),n=h(),v(l.$$.fragment)},l(c){s=a(c,"P",{});var w=i(s);$=p(w,"Example using "),d=a(w,"CODE",{});var E=i(d);u=p(E,"transformers.pipelines"),E.forEach(o),_=p(w,":"),w.forEach(o),n=f(c),T(l.$$.fragment,c)},m(c,w){k(c,s,w),e(s,$),e(s,d),e(d,u),e(s,_),k(c,n,w),b(l,c,w),y=!0},p:D,i(c){y||(M(l.$$.fragment,c),y=!0)},o(c){q(l.$$.fragment,c),y=!1},d(c){c&&o(s),c&&o(n),O(l,c)}}}function Sm(j){let s,$,d,u,_;return{c(){s=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=r("code"),u=m("Module"),_=m(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=a(l,"CODE",{});var y=i(d);u=p(y,"Module"),y.forEach(o),_=p(l,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),l.forEach(o)},m(n,l){k(n,s,l),e(s,$),e(s,d),e(d,u),e(s,_)},d(n){n&&o(s)}}}function Pm(j){let s,$,d,u,_;return u=new R({props:{code:`from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained("optimum/gpt2")
model = ORTModelForCausalLM.from_pretrained("optimum/gpt2")

inputs = tokenizer("My name is Philipp and I live in Germany.", return_tensors="pt")

gen_tokens = model.generate(**inputs,do_sample=True,temperature=0.9, min_length=20,max_length=20)
tokenizer.batch_decode(gen_tokens)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForCausalLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;optimum/gpt2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;My name is Philipp and I live in Germany.&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>gen_tokens = model.generate(**inputs,do_sample=<span class="hljs-literal">True</span>,temperature=<span class="hljs-number">0.9</span>, min_length=<span class="hljs-number">20</span>,max_length=<span class="hljs-number">20</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(gen_tokens)`}}),{c(){s=r("p"),$=m("Example of text generation:"),d=h(),v(u.$$.fragment)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Example of text generation:"),l.forEach(o),d=f(n),T(u.$$.fragment,n)},m(n,l){k(n,s,l),e(s,$),k(n,d,l),b(u,n,l),_=!0},p:D,i(n){_||(M(u.$$.fragment,n),_=!0)},o(n){q(u.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(d),O(u,n)}}}function Nm(j){let s,$,d,u,_,n,l,y;return l=new R({props:{code:`from transformers import AutoTokenizer, pipeline
from optimum.onnxruntime import ORTModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("optimum/gpt2")
model = ORTModelForCausalLM.from_pretrained("optimum/gpt2")
onnx_gen = pipeline("text-generation", model=model, tokenizer=tokenizer)

text = "My name is Philipp and I live in Germany."
gen = onnx_gen(text)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;optimum/gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_gen = pipeline(<span class="hljs-string">&quot;text-generation&quot;</span>, model=model, tokenizer=tokenizer)

<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;My name is Philipp and I live in Germany.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>gen = onnx_gen(text)`}}),{c(){s=r("p"),$=m("Example using "),d=r("code"),u=m("transformers.pipelines"),_=m(":"),n=h(),v(l.$$.fragment)},l(c){s=a(c,"P",{});var w=i(s);$=p(w,"Example using "),d=a(w,"CODE",{});var E=i(d);u=p(E,"transformers.pipelines"),E.forEach(o),_=p(w,":"),w.forEach(o),n=f(c),T(l.$$.fragment,c)},m(c,w){k(c,s,w),e(s,$),e(s,d),e(d,u),e(s,_),k(c,n,w),b(l,c,w),y=!0},p:D,i(c){y||(M(l.$$.fragment,c),y=!0)},o(c){q(l.$$.fragment,c),y=!1},d(c){c&&o(s),c&&o(n),O(l,c)}}}function Im(j){let s,$,d,u,_;return{c(){s=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=r("code"),u=m("Module"),_=m(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=a(l,"CODE",{});var y=i(d);u=p(y,"Module"),y.forEach(o),_=p(l,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),l.forEach(o)},m(n,l){k(n,s,l),e(s,$),e(s,d),e(d,u),e(s,_)},d(n){n&&o(s)}}}function Lm(j){let s,$,d,u,_;return u=new R({props:{code:`from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("optimum/t5-small")
model = ORTModelForSeq2SeqLM.from_pretrained("optimum/t5-small")

inputs = tokenizer("My name is Eustache and I like to", return_tensors="pt")

gen_tokens = model.generate(**inputs)
outputs = tokenizer.batch_decode(gen_tokens)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForSeq2SeqLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/t5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;optimum/t5-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;My name is Eustache and I like to&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>gen_tokens = model.generate(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = tokenizer.batch_decode(gen_tokens)`}}),{c(){s=r("p"),$=m("Example of text generation:"),d=h(),v(u.$$.fragment)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Example of text generation:"),l.forEach(o),d=f(n),T(u.$$.fragment,n)},m(n,l){k(n,s,l),e(s,$),k(n,d,l),b(u,n,l),_=!0},p:D,i(n){_||(M(u.$$.fragment,n),_=!0)},o(n){q(u.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(d),O(u,n)}}}function Dm(j){let s,$,d,u,_,n,l,y;return l=new R({props:{code:`from transformers import AutoTokenizer, pipeline
from optimum.onnxruntime import ORTModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("optimum/t5-small")
model = ORTModelForSeq2SeqLM.from_pretrained("optimum/t5-small")
onnx_translation = pipeline("translation_en_to_de", model=model, tokenizer=tokenizer)

text = "My name is Eustache."
pred = onnx_translation(text)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForSeq2SeqLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/t5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;optimum/t5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_translation = pipeline(<span class="hljs-string">&quot;translation_en_to_de&quot;</span>, model=model, tokenizer=tokenizer)

<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;My name is Eustache.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pred = onnx_translation(text)`}}),{c(){s=r("p"),$=m("Example using "),d=r("code"),u=m("transformers.pipeline"),_=m(":"),n=h(),v(l.$$.fragment)},l(c){s=a(c,"P",{});var w=i(s);$=p(w,"Example using "),d=a(w,"CODE",{});var E=i(d);u=p(E,"transformers.pipeline"),E.forEach(o),_=p(w,":"),w.forEach(o),n=f(c),T(l.$$.fragment,c)},m(c,w){k(c,s,w),e(s,$),e(s,d),e(d,u),e(s,_),k(c,n,w),b(l,c,w),y=!0},p:D,i(c){y||(M(l.$$.fragment,c),y=!0)},o(c){q(l.$$.fragment,c),y=!1},d(c){c&&o(s),c&&o(n),O(l,c)}}}function Hm(j){let s,$,d,u,_;return{c(){s=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=r("code"),u=m("Module"),_=m(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=a(l,"CODE",{});var y=i(d);u=p(y,"Module"),y.forEach(o),_=p(l,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),l.forEach(o)},m(n,l){k(n,s,l),e(s,$),e(s,d),e(d,u),e(s,_)},d(n){n&&o(s)}}}function Xm(j){let s,$,d,u,_;return u=new R({props:{code:`from transformers import AutoFeatureExtractor
from optimum.onnxruntime import ORTModelForImageClassification
import torch

tokenizer = AutoFeatureExtractor.from_pretrained("optimum/vit-base-patch16-224")
model = ORTModelForImageClassification.from_pretrained("optimum/vit-base-patch16-224")

inputs = tokenizer("My name is Philipp and I live in Germany.", return_tensors="pt")

outputs = model(**inputs)
logits = outputs.logits
list(logits.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;optimum/vit-base-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForImageClassification.from_pretrained(<span class="hljs-string">&quot;optimum/vit-base-patch16-224&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;My name is Philipp and I live in Germany.&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(logits.shape)`}}),{c(){s=r("p"),$=m("Example of feature extraction:"),d=h(),v(u.$$.fragment)},l(n){s=a(n,"P",{});var l=i(s);$=p(l,"Example of feature extraction:"),l.forEach(o),d=f(n),T(u.$$.fragment,n)},m(n,l){k(n,s,l),e(s,$),k(n,d,l),b(u,n,l),_=!0},p:D,i(n){_||(M(u.$$.fragment,n),_=!0)},o(n){q(u.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(d),O(u,n)}}}function Qm(j){let s,$,d,u,_,n,l,y;return l=new R({props:{code:`from transformers import AutoFeatureExtractor, pipeline
from optimum.onnxruntime import ORTModelForImageClassification

tokenizer = AutoFeatureExtractor.from_pretrained("optimum/vit-base-patch16-224")
model = ORTModelForImageClassification.from_pretrained("optimum/vit-base-patch16-224")
onnx_extractor = pipeline("feature-extraction", model=model, tokenizer=tokenizer)

text = "My name is Philipp and I live in Germany."
pred = onnx_extractor(text)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor, pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForImageClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;optimum/vit-base-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForImageClassification.from_pretrained(<span class="hljs-string">&quot;optimum/vit-base-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_extractor = pipeline(<span class="hljs-string">&quot;feature-extraction&quot;</span>, model=model, tokenizer=tokenizer)

<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;My name is Philipp and I live in Germany.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pred = onnx_extractor(text)`}}),{c(){s=r("p"),$=m("Example using "),d=r("code"),u=m("transformers.pipeline"),_=m(":"),n=h(),v(l.$$.fragment)},l(c){s=a(c,"P",{});var w=i(s);$=p(w,"Example using "),d=a(w,"CODE",{});var E=i(d);u=p(E,"transformers.pipeline"),E.forEach(o),_=p(w,":"),w.forEach(o),n=f(c),T(l.$$.fragment,c)},m(c,w){k(c,s,w),e(s,$),e(s,d),e(d,u),e(s,_),k(c,n,w),b(l,c,w),y=!0},p:D,i(c){y||(M(l.$$.fragment,c),y=!0)},o(c){q(l.$$.fragment,c),y=!1},d(c){c&&o(s),c&&o(n),O(l,c)}}}function Wm(j){let s,$,d,u,_,n,l,y,c,w,E,Ds,lo,Hs,Xs,Vn,he,ze,wo,gt,Qs,xo,Ws,Jn,H,Bs,vo,Gs,Vs,To,Js,Us,bo,Ks,Ys,Mo,Zs,er,Un,_t,Kn,te,tr,qo,or,nr,Oo,sr,rr,Yn,$t,Zn,fe,Ce,yo,kt,ar,jo,ir,es,K,lr,mo,mr,pr,wt,dr,cr,Eo,ur,hr,ts,xt,os,ge,Ae,Ro,vt,fr,Fo,gr,ns,po,_r,ss,Tt,rs,_e,Se,zo,bt,$r,Co,kr,as,J,Mt,wr,qt,xr,Ao,vr,Tr,br,Pe,Ot,Mr,yt,qr,So,Or,yr,jr,Ne,jt,Er,Po,Rr,is,$e,Ie,No,Et,Fr,Io,zr,ls,C,Rt,Cr,Lo,Ar,Sr,Ft,Pr,Do,Nr,Ir,Lr,Ho,Dr,Hr,X,zt,Xr,ke,Qr,Xo,Wr,Br,Qo,Gr,Vr,Jr,Le,Ur,De,Kr,He,ms,we,Xe,Wo,Ct,Yr,Bo,Zr,ps,A,At,ea,Go,ta,oa,St,na,Vo,sa,ra,aa,Jo,ia,la,Q,Pt,ma,xe,pa,Uo,da,ca,Ko,ua,ha,fa,Qe,ga,We,_a,Be,ds,ve,Ge,Yo,Nt,$a,Zo,ka,cs,S,It,wa,en,xa,va,Lt,Ta,tn,ba,Ma,qa,on,Oa,ya,z,Dt,ja,Te,Ea,nn,Ra,Fa,sn,za,Ca,Aa,Ve,Sa,Je,Pa,Ue,Na,Ke,us,be,Ye,rn,Ht,Ia,an,La,hs,P,Xt,Da,ln,Ha,Xa,Qt,Qa,mn,Wa,Ba,Ga,pn,Va,Ja,W,Wt,Ua,Me,Ka,dn,Ya,Za,cn,ei,ti,oi,Ze,ni,et,si,tt,fs,qe,ot,un,Bt,ri,hn,ai,gs,N,Gt,ii,fn,li,mi,Vt,pi,gn,di,ci,ui,_n,hi,fi,B,Jt,gi,Oe,_i,$n,$i,ki,kn,wi,xi,vi,nt,Ti,st,bi,rt,_s,ye,at,wn,Ut,Mi,xn,qi,$s,ee,Kt,Oi,vn,yi,ji,G,Yt,Ei,je,Ri,Tn,Fi,zi,bn,Ci,Ai,Si,it,Pi,lt,Ni,mt,ks,Ee,pt,Mn,Zt,Ii,qn,Li,ws,I,eo,Di,On,Hi,Xi,to,Qi,yn,Wi,Bi,Gi,jn,Vi,Ji,V,oo,Ui,Re,Ki,En,Yi,Zi,Rn,el,tl,ol,dt,nl,ct,sl,ut,xs;return n=new Z({}),gt=new Z({}),_t=new R({props:{code:`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")

onnx_qa = pipeline("question-answering",model=model,tokenizer=tokenizer)

question = "What's my name?"
context = "My name is Philipp and I live in Nuremberg."
pred = onnx_qa(question, context)`,highlighted:`from transformers import AutoTokenizer, pipeline
<span class="hljs-deletion">-from transformers import AutoModelForQuestionAnswering</span>
<span class="hljs-addition">+from optimum.onnxruntime import ORTModelForQuestionAnswering</span>

<span class="hljs-deletion">-model = AutoModelForQuestionAnswering.from_pretrained(&quot;deepset/roberta-base-squad2&quot;) # pytorch checkpoint</span>
<span class="hljs-addition">+model = ORTModelForQuestionAnswering.from_pretrained(&quot;optimum/roberta-base-squad2&quot;) # onnx checkpoint</span>
tokenizer = AutoTokenizer.from_pretrained(&quot;deepset/roberta-base-squad2&quot;)

onnx_qa = pipeline(&quot;question-answering&quot;,model=model,tokenizer=tokenizer)

question = &quot;What&#x27;s my name?&quot;
context = &quot;My name is Philipp and I live in Nuremberg.&quot;
pred = onnx_qa(question, context)`}}),$t=new R({props:{code:`from transformers import AutoTokenizer, pipeline
from optimum.onnxruntime import ORTModelForSequenceClassification

model = ORTModelForSequenceClassification.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english", from_transformers=True)
tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")

onnx_classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)

result = onnx_classifier("This is a great model")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForSequenceClassification

<span class="hljs-comment"># Load the model from the hub and export it to the ONNX format</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>, from_transformers=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>)

<span class="hljs-comment"># Create a pipeline</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_classifier = pipeline(<span class="hljs-string">&quot;text-classification&quot;</span>, model=model, tokenizer=tokenizer)

<span class="hljs-meta">&gt;&gt;&gt; </span>result = onnx_classifier(<span class="hljs-string">&quot;This is a great model&quot;</span>)
[{<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;POSITIVE&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9998838901519775</span>}]`}}),kt=new Z({}),xt=new R({props:{code:`from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSequenceClassification

model = ORTModelForSequenceClassification.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english", from_transformers=True)
tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")

model.save_pretrained("a_local_path_for_convert_onnx_model")
tokenizer.save_pretrained("a_local_path_for_convert_onnx_model")

model.push_to_hub("a_local_path_for_convert_onnx_model", repository_id="my-onnx-repo", use_auth_token=True)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForSequenceClassification

<span class="hljs-comment"># Load the model from the hub and export it to the ONNX format</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>, from_transformers=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>)

<span class="hljs-comment"># Save the converted model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.save_pretrained(<span class="hljs-string">&quot;a_local_path_for_convert_onnx_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.save_pretrained(<span class="hljs-string">&quot;a_local_path_for_convert_onnx_model&quot;</span>)

<span class="hljs-comment"># Push the onnx model to HF Hub</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.push_to_hub(<span class="hljs-string">&quot;a_local_path_for_convert_onnx_model&quot;</span>, repository_id=<span class="hljs-string">&quot;my-onnx-repo&quot;</span>, use_auth_token=<span class="hljs-literal">True</span>)`}}),vt=new Z({}),Tt=new R({props:{code:`from transformers import AutoTokenizer, pipeline
from optimum.onnxruntime import ORTModelForSeq2SeqLM

model = ORTModelForSeq2SeqLM.from_pretrained("t5-small", from_transformers=True)
tokenizer = AutoTokenizer.from_pretrained("t5-small")

onnx_translation = pipeline("translation_en_to_fr", model=model, tokenizer=tokenizer)

result = onnx_translation("My name is Eustache")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTModelForSeq2SeqLM

<span class="hljs-comment"># Load the model from the hub and export it to the ONNX format</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;t5-small&quot;</span>, from_transformers=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;t5-small&quot;</span>)

<span class="hljs-comment"># Create a pipeline</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_translation = pipeline(<span class="hljs-string">&quot;translation_en_to_fr&quot;</span>, model=model, tokenizer=tokenizer)

<span class="hljs-meta">&gt;&gt;&gt; </span>result = onnx_translation(<span class="hljs-string">&quot;My name is Eustache&quot;</span>)
[{<span class="hljs-string">&#x27;translation_text&#x27;</span>: <span class="hljs-string">&#x27;Mon nom est Eustache&#x27;</span>}]`}}),bt=new Z({}),Mt=new F({props:{name:"class optimum.onnxruntime.ORTModel",anchor:"optimum.onnxruntime.ORTModel",parameters:[{name:"model",val:" = None"},{name:"config",val:" = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L82"}}),Ot=new F({props:{name:"load_model",anchor:"optimum.onnxruntime.ORTModel.load_model",parameters:[{name:"path",val:": typing.Union[str, pathlib.Path]"},{name:"provider",val:" = None"}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModel.load_model.path",description:`<strong>path</strong> (<code>str</code> or <code>Path</code>) &#x2014;
Directory from which to load the model.`,name:"path"},{anchor:"optimum.onnxruntime.ORTModel.load_model.provider(str,",description:`<strong>provider(<code>str</code>,</strong> <em>optional</em>) &#x2014;
ONNX Runtime provider to use for loading the model. Defaults to <code>CPUExecutionProvider</code>.`,name:"provider(str,"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L122"}}),jt=new F({props:{name:"to",anchor:"optimum.onnxruntime.ORTModel.to",parameters:[{name:"device",val:""}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L110"}}),Et=new Z({}),Rt=new F({props:{name:"class optimum.onnxruntime.ORTModelForFeatureExtraction",anchor:"optimum.onnxruntime.ORTModelForFeatureExtraction",parameters:[{name:"model",val:" = None"},{name:"config",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForFeatureExtraction.config",description:`<strong>config</strong> (<code>transformers.PretrainedConfig</code>) &#x2014; <a href="https://huggingface.co/docs/transformers/main_classes/configuration#transformers.PretrainedConfig" rel="nofollow">PretrainedConfig</a> is the Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <code>from_pretrained()</code> method to load the model weights.`,name:"config"},{anchor:"optimum.onnxruntime.ORTModelForFeatureExtraction.model",description:'<strong>model</strong> (<code>onnxruntime.InferenceSession</code>) &#x2014; <a href="https://onnxruntime.ai/docs/api/python/api_summary.html#inferencesession" rel="nofollow">onnxruntime.InferenceSession</a> is the main class used to run a model. Check out the <a href="/docs/optimum/pr_279/en/onnxruntime/modeling_ort#optimum.onnxruntime.ORTModel.load_model">load_model()</a> method for more information.',name:"model"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L320"}}),zt=new F({props:{name:"forward",anchor:"optimum.onnxruntime.ORTModelForFeatureExtraction.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForFeatureExtraction.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.
Indices can be obtained using <a href="https://huggingface.co/docs/transformers/autoclass_tutorial#autotokenizer" rel="nofollow"><code>AutoTokenizer</code></a>.
See <a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.encode" rel="nofollow"><code>PreTrainedTokenizer.encode</code></a> and
<a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.__call__" rel="nofollow"><code>PreTrainedTokenizer.__call__</code></a> for details.
<a href="https://huggingface.co/docs/transformers/glossary#input-ids" rel="nofollow">What are input IDs?</a>`,name:"input_ids"},{anchor:"optimum.onnxruntime.ORTModelForFeatureExtraction.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#attention-mask" rel="nofollow">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"optimum.onnxruntime.ORTModelForFeatureExtraction.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>sentence A</strong>,</li>
<li>0 for tokens that are <strong>sentence B</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#token-type-ids" rel="nofollow">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L334"}}),Le=new io({props:{$$slots:{default:[Tm]},$$scope:{ctx:j}}}),De=new L({props:{anchor:"optimum.onnxruntime.ORTModelForFeatureExtraction.forward.example",$$slots:{default:[bm]},$$scope:{ctx:j}}}),He=new L({props:{anchor:"optimum.onnxruntime.ORTModelForFeatureExtraction.forward.example-2",$$slots:{default:[Mm]},$$scope:{ctx:j}}}),Ct=new Z({}),At=new F({props:{name:"class optimum.onnxruntime.ORTModelForQuestionAnswering",anchor:"optimum.onnxruntime.ORTModelForQuestionAnswering",parameters:[{name:"model",val:" = None"},{name:"config",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForQuestionAnswering.config",description:`<strong>config</strong> (<code>transformers.PretrainedConfig</code>) &#x2014; <a href="https://huggingface.co/docs/transformers/main_classes/configuration#transformers.PretrainedConfig" rel="nofollow">PretrainedConfig</a> is the Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <code>from_pretrained()</code> method to load the model weights.`,name:"config"},{anchor:"optimum.onnxruntime.ORTModelForQuestionAnswering.model",description:'<strong>model</strong> (<code>onnxruntime.InferenceSession</code>) &#x2014; <a href="https://onnxruntime.ai/docs/api/python/api_summary.html#inferencesession" rel="nofollow">onnxruntime.InferenceSession</a> is the main class used to run a model. Check out the <a href="/docs/optimum/pr_279/en/onnxruntime/modeling_ort#optimum.onnxruntime.ORTModel.load_model">load_model()</a> method for more information.',name:"model"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L405"}}),Pt=new F({props:{name:"forward",anchor:"optimum.onnxruntime.ORTModelForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.
Indices can be obtained using <a href="https://huggingface.co/docs/transformers/autoclass_tutorial#autotokenizer" rel="nofollow"><code>AutoTokenizer</code></a>.
See <a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.encode" rel="nofollow"><code>PreTrainedTokenizer.encode</code></a> and
<a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.__call__" rel="nofollow"><code>PreTrainedTokenizer.__call__</code></a> for details.
<a href="https://huggingface.co/docs/transformers/glossary#input-ids" rel="nofollow">What are input IDs?</a>`,name:"input_ids"},{anchor:"optimum.onnxruntime.ORTModelForQuestionAnswering.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#attention-mask" rel="nofollow">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"optimum.onnxruntime.ORTModelForQuestionAnswering.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>sentence A</strong>,</li>
<li>0 for tokens that are <strong>sentence B</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#token-type-ids" rel="nofollow">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L419"}}),Qe=new io({props:{$$slots:{default:[qm]},$$scope:{ctx:j}}}),We=new L({props:{anchor:"optimum.onnxruntime.ORTModelForQuestionAnswering.forward.example",$$slots:{default:[Om]},$$scope:{ctx:j}}}),Be=new L({props:{anchor:"optimum.onnxruntime.ORTModelForQuestionAnswering.forward.example-2",$$slots:{default:[ym]},$$scope:{ctx:j}}}),Nt=new Z({}),It=new F({props:{name:"class optimum.onnxruntime.ORTModelForSequenceClassification",anchor:"optimum.onnxruntime.ORTModelForSequenceClassification",parameters:[{name:"model",val:" = None"},{name:"config",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForSequenceClassification.config",description:`<strong>config</strong> (<code>transformers.PretrainedConfig</code>) &#x2014; <a href="https://huggingface.co/docs/transformers/main_classes/configuration#transformers.PretrainedConfig" rel="nofollow">PretrainedConfig</a> is the Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <code>from_pretrained()</code> method to load the model weights.`,name:"config"},{anchor:"optimum.onnxruntime.ORTModelForSequenceClassification.model",description:'<strong>model</strong> (<code>onnxruntime.InferenceSession</code>) &#x2014; <a href="https://onnxruntime.ai/docs/api/python/api_summary.html#inferencesession" rel="nofollow">onnxruntime.InferenceSession</a> is the main class used to run a model. Check out the <a href="/docs/optimum/pr_279/en/onnxruntime/modeling_ort#optimum.onnxruntime.ORTModel.load_model">load_model()</a> method for more information.',name:"model"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L505"}}),Dt=new F({props:{name:"forward",anchor:"optimum.onnxruntime.ORTModelForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.
Indices can be obtained using <a href="https://huggingface.co/docs/transformers/autoclass_tutorial#autotokenizer" rel="nofollow"><code>AutoTokenizer</code></a>.
See <a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.encode" rel="nofollow"><code>PreTrainedTokenizer.encode</code></a> and
<a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.__call__" rel="nofollow"><code>PreTrainedTokenizer.__call__</code></a> for details.
<a href="https://huggingface.co/docs/transformers/glossary#input-ids" rel="nofollow">What are input IDs?</a>`,name:"input_ids"},{anchor:"optimum.onnxruntime.ORTModelForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#attention-mask" rel="nofollow">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"optimum.onnxruntime.ORTModelForSequenceClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>sentence A</strong>,</li>
<li>0 for tokens that are <strong>sentence B</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#token-type-ids" rel="nofollow">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L520"}}),Ve=new io({props:{$$slots:{default:[jm]},$$scope:{ctx:j}}}),Je=new L({props:{anchor:"optimum.onnxruntime.ORTModelForSequenceClassification.forward.example",$$slots:{default:[Em]},$$scope:{ctx:j}}}),Ue=new L({props:{anchor:"optimum.onnxruntime.ORTModelForSequenceClassification.forward.example-2",$$slots:{default:[Rm]},$$scope:{ctx:j}}}),Ke=new L({props:{anchor:"optimum.onnxruntime.ORTModelForSequenceClassification.forward.example-3",$$slots:{default:[Fm]},$$scope:{ctx:j}}}),Ht=new Z({}),Xt=new F({props:{name:"class optimum.onnxruntime.ORTModelForTokenClassification",anchor:"optimum.onnxruntime.ORTModelForTokenClassification",parameters:[{name:"model",val:" = None"},{name:"config",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForTokenClassification.config",description:`<strong>config</strong> (<code>transformers.PretrainedConfig</code>) &#x2014; <a href="https://huggingface.co/docs/transformers/main_classes/configuration#transformers.PretrainedConfig" rel="nofollow">PretrainedConfig</a> is the Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <code>from_pretrained()</code> method to load the model weights.`,name:"config"},{anchor:"optimum.onnxruntime.ORTModelForTokenClassification.model",description:'<strong>model</strong> (<code>onnxruntime.InferenceSession</code>) &#x2014; <a href="https://onnxruntime.ai/docs/api/python/api_summary.html#inferencesession" rel="nofollow">onnxruntime.InferenceSession</a> is the main class used to run a model. Check out the <a href="/docs/optimum/pr_279/en/onnxruntime/modeling_ort#optimum.onnxruntime.ORTModel.load_model">load_model()</a> method for more information.',name:"model"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L591"}}),Wt=new F({props:{name:"forward",anchor:"optimum.onnxruntime.ORTModelForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.
Indices can be obtained using <a href="https://huggingface.co/docs/transformers/autoclass_tutorial#autotokenizer" rel="nofollow"><code>AutoTokenizer</code></a>.
See <a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.encode" rel="nofollow"><code>PreTrainedTokenizer.encode</code></a> and
<a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.__call__" rel="nofollow"><code>PreTrainedTokenizer.__call__</code></a> for details.
<a href="https://huggingface.co/docs/transformers/glossary#input-ids" rel="nofollow">What are input IDs?</a>`,name:"input_ids"},{anchor:"optimum.onnxruntime.ORTModelForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#attention-mask" rel="nofollow">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"optimum.onnxruntime.ORTModelForTokenClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>sentence A</strong>,</li>
<li>0 for tokens that are <strong>sentence B</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#token-type-ids" rel="nofollow">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L605"}}),Ze=new io({props:{$$slots:{default:[zm]},$$scope:{ctx:j}}}),et=new L({props:{anchor:"optimum.onnxruntime.ORTModelForTokenClassification.forward.example",$$slots:{default:[Cm]},$$scope:{ctx:j}}}),tt=new L({props:{anchor:"optimum.onnxruntime.ORTModelForTokenClassification.forward.example-2",$$slots:{default:[Am]},$$scope:{ctx:j}}}),Bt=new Z({}),Gt=new F({props:{name:"class optimum.onnxruntime.ORTModelForCausalLM",anchor:"optimum.onnxruntime.ORTModelForCausalLM",parameters:[{name:"model",val:" = None"},{name:"config",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForCausalLM.config",description:`<strong>config</strong> (<code>transformers.PretrainedConfig</code>) &#x2014; <a href="https://huggingface.co/docs/transformers/main_classes/configuration#transformers.PretrainedConfig" rel="nofollow">PretrainedConfig</a> is the Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <code>from_pretrained()</code> method to load the model weights.`,name:"config"},{anchor:"optimum.onnxruntime.ORTModelForCausalLM.model",description:'<strong>model</strong> (<code>onnxruntime.InferenceSession</code>) &#x2014; <a href="https://onnxruntime.ai/docs/api/python/api_summary.html#inferencesession" rel="nofollow">onnxruntime.InferenceSession</a> is the main class used to run a model. Check out the <a href="/docs/optimum/pr_279/en/onnxruntime/modeling_ort#optimum.onnxruntime.ORTModel.load_model">load_model()</a> method for more information.',name:"model"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L674"}}),Jt=new F({props:{name:"forward",anchor:"optimum.onnxruntime.ORTModelForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.
Indices can be obtained using <a href="https://huggingface.co/docs/transformers/autoclass_tutorial#autotokenizer" rel="nofollow"><code>AutoTokenizer</code></a>.
See <a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.encode" rel="nofollow"><code>PreTrainedTokenizer.encode</code></a> and
<a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.__call__" rel="nofollow"><code>PreTrainedTokenizer.__call__</code></a> for details.
<a href="https://huggingface.co/docs/transformers/glossary#input-ids" rel="nofollow">What are input IDs?</a>`,name:"input_ids"},{anchor:"optimum.onnxruntime.ORTModelForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#attention-mask" rel="nofollow">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"optimum.onnxruntime.ORTModelForCausalLM.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>sentence A</strong>,</li>
<li>0 for tokens that are <strong>sentence B</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#token-type-ids" rel="nofollow">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L698"}}),nt=new io({props:{$$slots:{default:[Sm]},$$scope:{ctx:j}}}),st=new L({props:{anchor:"optimum.onnxruntime.ORTModelForCausalLM.forward.example",$$slots:{default:[Pm]},$$scope:{ctx:j}}}),rt=new L({props:{anchor:"optimum.onnxruntime.ORTModelForCausalLM.forward.example-2",$$slots:{default:[Nm]},$$scope:{ctx:j}}}),Ut=new Z({}),Kt=new F({props:{name:"class optimum.onnxruntime.ORTModelForSeq2SeqLM",anchor:"optimum.onnxruntime.ORTModelForSeq2SeqLM",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_seq2seq.py#L536"}}),Yt=new F({props:{name:"forward",anchor:"optimum.onnxruntime.ORTModelForSeq2SeqLM.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"encoder_outputs",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForSeq2SeqLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code>) &#x2014;
Indices of input sequence tokens in the vocabulary of shape <code>(batch_size, encoder_sequence_length)</code>.`,name:"input_ids"},{anchor:"optimum.onnxruntime.ORTModelForSeq2SeqLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code>) &#x2014;
Mask to avoid performing attention on padding token indices, of shape
<code>(batch_size, encoder_sequence_length)</code>. Mask values selected in <code>[0, 1]</code>.`,name:"attention_mask"},{anchor:"optimum.onnxruntime.ORTModelForSeq2SeqLM.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary of shape <code>(batch_size, decoder_sequence_length)</code>.`,name:"decoder_input_ids"},{anchor:"optimum.onnxruntime.ORTModelForSeq2SeqLM.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>torch.FloatTensor</code>) &#x2014;
The encoder <code>last_hidden_state</code> of shape <code>(batch_size, encoder_sequence_length, hidden_size)</code>.`,name:"encoder_outputs"},{anchor:"optimum.onnxruntime.ORTModelForSeq2SeqLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor), *optional*)</code> &#x2014;
Contains the precomputed key and value hidden states of the attention blocks used to speed up decoding.
The tuple is of length <code>config.n_layers</code> with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, decoder_sequence_length, embed_size_per_head)</code> and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.`,name:"past_key_values"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_seq2seq.py#L545"}}),it=new io({props:{$$slots:{default:[Im]},$$scope:{ctx:j}}}),lt=new L({props:{anchor:"optimum.onnxruntime.ORTModelForSeq2SeqLM.forward.example",$$slots:{default:[Lm]},$$scope:{ctx:j}}}),mt=new L({props:{anchor:"optimum.onnxruntime.ORTModelForSeq2SeqLM.forward.example-2",$$slots:{default:[Dm]},$$scope:{ctx:j}}}),Zt=new Z({}),eo=new F({props:{name:"class optimum.onnxruntime.ORTModelForImageClassification",anchor:"optimum.onnxruntime.ORTModelForImageClassification",parameters:[{name:"model",val:" = None"},{name:"config",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForImageClassification.config",description:`<strong>config</strong> (<code>transformers.PretrainedConfig</code>) &#x2014; <a href="https://huggingface.co/docs/transformers/main_classes/configuration#transformers.PretrainedConfig" rel="nofollow">PretrainedConfig</a> is the Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <code>from_pretrained()</code> method to load the model weights.`,name:"config"},{anchor:"optimum.onnxruntime.ORTModelForImageClassification.model",description:'<strong>model</strong> (<code>onnxruntime.InferenceSession</code>) &#x2014; <a href="https://onnxruntime.ai/docs/api/python/api_summary.html#inferencesession" rel="nofollow">onnxruntime.InferenceSession</a> is the main class used to run a model. Check out the <a href="/docs/optimum/pr_279/en/onnxruntime/modeling_ort#optimum.onnxruntime.ORTModel.load_model">load_model()</a> method for more information.',name:"model"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L792"}}),oo=new F({props:{name:"forward",anchor:"optimum.onnxruntime.ORTModelForImageClassification.forward",parameters:[{name:"pixel_values",val:": Tensor"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForImageClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.
Indices can be obtained using <a href="https://huggingface.co/docs/transformers/autoclass_tutorial#autotokenizer" rel="nofollow"><code>AutoTokenizer</code></a>.
See <a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.encode" rel="nofollow"><code>PreTrainedTokenizer.encode</code></a> and
<a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizerBase.__call__" rel="nofollow"><code>PreTrainedTokenizer.__call__</code></a> for details.
<a href="https://huggingface.co/docs/transformers/glossary#input-ids" rel="nofollow">What are input IDs?</a>`,name:"input_ids"},{anchor:"optimum.onnxruntime.ORTModelForImageClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#attention-mask" rel="nofollow">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"optimum.onnxruntime.ORTModelForImageClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>sentence A</strong>,</li>
<li>0 for tokens that are <strong>sentence B</strong>.
<a href="https://huggingface.co/docs/transformers/glossary#token-type-ids" rel="nofollow">What are token type IDs?</a></li>
</ul>`,name:"token_type_ids"}],source:"https://github.com/huggingface/optimum/blob/vr_279/src/optimum/onnxruntime/modeling_ort.py#L806"}}),dt=new io({props:{$$slots:{default:[Hm]},$$scope:{ctx:j}}}),ct=new L({props:{anchor:"optimum.onnxruntime.ORTModelForImageClassification.forward.example",$$slots:{default:[Xm]},$$scope:{ctx:j}}}),ut=new L({props:{anchor:"optimum.onnxruntime.ORTModelForImageClassification.forward.example-2",$$slots:{default:[Qm]},$$scope:{ctx:j}}}),{c(){s=r("meta"),$=h(),d=r("h1"),u=r("a"),_=r("span"),v(n.$$.fragment),l=h(),y=r("span"),c=m("Optimum Inference with ONNX Runtime"),w=h(),E=r("p"),Ds=m(`Optimum is a utility package for building and running inference with accelerated runtime like ONNX Runtime.
Optimum can be used to load optimized models from the `),lo=r("a"),Hs=m("Hugging Face Hub"),Xs=m(` and create pipelines
to run accelerated inference without rewriting your APIs.`),Vn=h(),he=r("h2"),ze=r("a"),wo=r("span"),v(gt.$$.fragment),Qs=h(),xo=r("span"),Ws=m("Switching from Transformers to Optimum Inference"),Jn=h(),H=r("p"),Bs=m("The Optimum Inference models are API compatible with Hugging Face Transformers models. This means you can just replace your "),vo=r("code"),Gs=m("AutoModelForXxx"),Vs=m(" class with the corresponding "),To=r("code"),Js=m("ORTModelForXxx"),Us=m(" class in "),bo=r("code"),Ks=m("optimum"),Ys=m(". For example, this is how you can use a question answering model in "),Mo=r("code"),Zs=m("optimum"),er=m(":"),Un=h(),v(_t.$$.fragment),Kn=h(),te=r("p"),tr=m("Optimum Inference also includes methods to convert vanilla Transformers models to optimized ones. Simply pass "),qo=r("code"),or=m("from_transformers=True"),nr=m(" to the "),Oo=r("code"),sr=m("from_pretrained()"),rr=m(" method, and your model will be loaded and converted to ONNX on-the-fly:"),Yn=h(),v($t.$$.fragment),Zn=h(),fe=r("h3"),Ce=r("a"),yo=r("span"),v(kt.$$.fragment),ar=h(),jo=r("span"),ir=m("Working with the Hugging Face Model Hub"),es=h(),K=r("p"),lr=m("The Optimum model classes like "),mo=r("a"),mr=m("ORTModelForSequenceClassification"),pr=m(" are integrated with the "),wt=r("a"),dr=m("Hugging Face Model Hub"),cr=m(`, which means you can not only
load model from the Hub, but also push your models to the Hub with `),Eo=r("code"),ur=m("push_to_hub()"),hr=m(` method. Below is an example which downloads a vanilla Transformers model
from the Hub and converts it to an optimum onnxruntime model and pushes it back into a new repository.`),ts=h(),v(xt.$$.fragment),os=h(),ge=r("h2"),Ae=r("a"),Ro=r("span"),v(vt.$$.fragment),fr=h(),Fo=r("span"),gr=m("Export and inference of sequence-to-sequence models"),ns=h(),po=r("p"),_r=m(`Sequence-to-sequence (Seq2Seq) models, that generate a new sequence from an input, can also be used when running inference with ONNX Runtime. When Seq2Seq models are exported to the ONNX format, they are decomposed into three parts that are later combined during inference.
Those three parts consist of the encoder, the \u201Cdecoder\u201D (which actually consists of the decoder with the language modeling head), and the \u201Cdecoder\u201D with pre-computed key/values as additional inputs.
This specific export comes from the fact that during the first pass, the decoder has no pre-computed key/values hidden-states, while during the rest of the generation past key/values will be used to speed up sequential decoding.
Here is an example on how you can export a T5 model to the ONNX format and run inference for a translation task:`),ss=h(),v(Tt.$$.fragment),rs=h(),_e=r("h2"),Se=r("a"),zo=r("span"),v(bt.$$.fragment),$r=h(),Co=r("span"),kr=m("ORTModel"),as=h(),J=r("div"),v(Mt.$$.fragment),wr=h(),qt=r("p"),xr=m(`Base ORTModel class for implementing models using ONNX Runtime. The ORTModel implements generic methods for interacting
with the Hugging Face Hub as well as exporting vanilla transformers models to ONNX using `),Ao=r("code"),vr=m("transformers.onnx"),Tr=m(` toolchain.
The ORTModel implements additionally generic methods for optimizing and quantizing Onnx models.`),br=h(),Pe=r("div"),v(Ot.$$.fragment),Mr=h(),yt=r("p"),qr=m("Loads an ONNX Inference session with a given provider. Default provider is "),So=r("code"),Or=m("CPUExecutionProvider"),yr=m(" to match the default behaviour in PyTorch/TensorFlow/JAX."),jr=h(),Ne=r("div"),v(jt.$$.fragment),Er=h(),Po=r("p"),Rr=m("Changes the ONNX Runtime provider according to the device."),is=h(),$e=r("h2"),Ie=r("a"),No=r("span"),v(Et.$$.fragment),Fr=h(),Io=r("span"),zr=m("ORTModelForFeatureExtraction"),ls=h(),C=r("div"),v(Rt.$$.fragment),Cr=h(),Lo=r("p"),Ar=m("Onnx Model with a MaskedLMOutput for feature-extraction tasks."),Sr=h(),Ft=r("p"),Pr=m("This model inherits from [~"),Do=r("code"),Nr=m("onnxruntime.modeling_ort.ORTModel"),Ir=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),Lr=h(),Ho=r("p"),Dr=m("Feature Extraction model for ONNX."),Hr=h(),X=r("div"),v(zt.$$.fragment),Xr=h(),ke=r("p"),Qr=m("The "),Xo=r("code"),Wr=m("ORTModelForFeatureExtraction"),Br=m(" forward method, overrides the "),Qo=r("code"),Gr=m("__call__"),Vr=m(" special method."),Jr=h(),v(Le.$$.fragment),Ur=h(),v(De.$$.fragment),Kr=h(),v(He.$$.fragment),ms=h(),we=r("h2"),Xe=r("a"),Wo=r("span"),v(Ct.$$.fragment),Yr=h(),Bo=r("span"),Zr=m("ORTModelForQuestionAnswering"),ps=h(),A=r("div"),v(At.$$.fragment),ea=h(),Go=r("p"),ta=m("Onnx Model with a QuestionAnsweringModelOutput for extractive question-answering tasks like SQuAD."),oa=h(),St=r("p"),na=m("This model inherits from [~"),Vo=r("code"),sa=m("onnxruntime.modeling_ort.ORTModel"),ra=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),aa=h(),Jo=r("p"),ia=m("Question Answering model for ONNX."),la=h(),Q=r("div"),v(Pt.$$.fragment),ma=h(),xe=r("p"),pa=m("The "),Uo=r("code"),da=m("ORTModelForQuestionAnswering"),ca=m(" forward method, overrides the "),Ko=r("code"),ua=m("__call__"),ha=m(" special method."),fa=h(),v(Qe.$$.fragment),ga=h(),v(We.$$.fragment),_a=h(),v(Be.$$.fragment),ds=h(),ve=r("h2"),Ge=r("a"),Yo=r("span"),v(Nt.$$.fragment),$a=h(),Zo=r("span"),ka=m("ORTModelForSequenceClassification"),cs=h(),S=r("div"),v(It.$$.fragment),wa=h(),en=r("p"),xa=m(`Onnx Model with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.`),va=h(),Lt=r("p"),Ta=m("This model inherits from [~"),tn=r("code"),ba=m("onnxruntime.modeling_ort.ORTModel"),Ma=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),qa=h(),on=r("p"),Oa=m("Sequence Classification model for ONNX."),ya=h(),z=r("div"),v(Dt.$$.fragment),ja=h(),Te=r("p"),Ea=m("The "),nn=r("code"),Ra=m("ORTModelForSequenceClassification"),Fa=m(" forward method, overrides the "),sn=r("code"),za=m("__call__"),Ca=m(" special method."),Aa=h(),v(Ve.$$.fragment),Sa=h(),v(Je.$$.fragment),Pa=h(),v(Ue.$$.fragment),Na=h(),v(Ke.$$.fragment),us=h(),be=r("h2"),Ye=r("a"),rn=r("span"),v(Ht.$$.fragment),Ia=h(),an=r("span"),La=m("ORTModelForTokenClassification"),hs=h(),P=r("div"),v(Xt.$$.fragment),Da=h(),ln=r("p"),Ha=m(`Onnx Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g.
for Named-Entity-Recognition (NER) tasks.`),Xa=h(),Qt=r("p"),Qa=m("This model inherits from [~"),mn=r("code"),Wa=m("onnxruntime.modeling_ort.ORTModel"),Ba=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),Ga=h(),pn=r("p"),Va=m("Token Classification model for ONNX."),Ja=h(),W=r("div"),v(Wt.$$.fragment),Ua=h(),Me=r("p"),Ka=m("The "),dn=r("code"),Ya=m("ORTModelForTokenClassification"),Za=m(" forward method, overrides the "),cn=r("code"),ei=m("__call__"),ti=m(" special method."),oi=h(),v(Ze.$$.fragment),ni=h(),v(et.$$.fragment),si=h(),v(tt.$$.fragment),fs=h(),qe=r("h2"),ot=r("a"),un=r("span"),v(Bt.$$.fragment),ri=h(),hn=r("span"),ai=m("ORTModelForCausalLM"),gs=h(),N=r("div"),v(Gt.$$.fragment),ii=h(),fn=r("p"),li=m(`Onnx Model with a causal language modeling head on top (linear layer with weights tied to the input
embeddings).`),mi=h(),Vt=r("p"),pi=m("This model inherits from [~"),gn=r("code"),di=m("onnxruntime.modeling_ort.ORTModel"),ci=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),ui=h(),_n=r("p"),hi=m("Causal LM model for ONNX."),fi=h(),B=r("div"),v(Jt.$$.fragment),gi=h(),Oe=r("p"),_i=m("The "),$n=r("code"),$i=m("ORTModelForCausalLM"),ki=m(" forward method, overrides the "),kn=r("code"),wi=m("__call__"),xi=m(" special method."),vi=h(),v(nt.$$.fragment),Ti=h(),v(st.$$.fragment),bi=h(),v(rt.$$.fragment),_s=h(),ye=r("h2"),at=r("a"),wn=r("span"),v(Ut.$$.fragment),Mi=h(),xn=r("span"),qi=m("ORTModelForSeq2SeqLM"),$s=h(),ee=r("div"),v(Kt.$$.fragment),Oi=h(),vn=r("p"),yi=m("Sequence-to-sequence model with a language modeling head for ONNX Runtime inference."),ji=h(),G=r("div"),v(Yt.$$.fragment),Ei=h(),je=r("p"),Ri=m("The "),Tn=r("code"),Fi=m("ORTModelForSeq2SeqLM"),zi=m(" forward method, overrides the "),bn=r("code"),Ci=m("__call__"),Ai=m(" special method."),Si=h(),v(it.$$.fragment),Pi=h(),v(lt.$$.fragment),Ni=h(),v(mt.$$.fragment),ks=h(),Ee=r("h2"),pt=r("a"),Mn=r("span"),v(Zt.$$.fragment),Ii=h(),qn=r("span"),Li=m("ORTModelForImageClassification"),ws=h(),I=r("div"),v(eo.$$.fragment),Di=h(),On=r("p"),Hi=m("Onnx Model for image-classification tasks."),Xi=h(),to=r("p"),Qi=m("This model inherits from [~"),yn=r("code"),Wi=m("onnxruntime.modeling_ort.ORTModel"),Bi=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),Gi=h(),jn=r("p"),Vi=m("Image Classification model for ONNX."),Ji=h(),V=r("div"),v(oo.$$.fragment),Ui=h(),Re=r("p"),Ki=m("The "),En=r("code"),Yi=m("ORTModelForImageClassification"),Zi=m(" forward method, overrides the "),Rn=r("code"),el=m("__call__"),tl=m(" special method."),ol=h(),v(dt.$$.fragment),nl=h(),v(ct.$$.fragment),sl=h(),v(ut.$$.fragment),this.h()},l(t){const g=xm('[data-svelte="svelte-1phssyn"]',document.head);s=a(g,"META",{name:!0,content:!0}),g.forEach(o),$=f(t),d=a(t,"H1",{class:!0});var no=i(d);u=a(no,"A",{id:!0,class:!0,href:!0});var Fn=i(u);_=a(Fn,"SPAN",{});var zn=i(_);T(n.$$.fragment,zn),zn.forEach(o),Fn.forEach(o),l=f(no),y=a(no,"SPAN",{});var Cn=i(y);c=p(Cn,"Optimum Inference with ONNX Runtime"),Cn.forEach(o),no.forEach(o),w=f(t),E=a(t,"P",{});var so=i(E);Ds=p(so,`Optimum is a utility package for building and running inference with accelerated runtime like ONNX Runtime.
Optimum can be used to load optimized models from the `),lo=a(so,"A",{href:!0});var An=i(lo);Hs=p(An,"Hugging Face Hub"),An.forEach(o),Xs=p(so,` and create pipelines
to run accelerated inference without rewriting your APIs.`),so.forEach(o),Vn=f(t),he=a(t,"H2",{class:!0});var ro=i(he);ze=a(ro,"A",{id:!0,class:!0,href:!0});var Sn=i(ze);wo=a(Sn,"SPAN",{});var Pn=i(wo);T(gt.$$.fragment,Pn),Pn.forEach(o),Sn.forEach(o),Qs=f(ro),xo=a(ro,"SPAN",{});var Nn=i(xo);Ws=p(Nn,"Switching from Transformers to Optimum Inference"),Nn.forEach(o),ro.forEach(o),Jn=f(t),H=a(t,"P",{});var U=i(H);Bs=p(U,"The Optimum Inference models are API compatible with Hugging Face Transformers models. This means you can just replace your "),vo=a(U,"CODE",{});var In=i(vo);Gs=p(In,"AutoModelForXxx"),In.forEach(o),Vs=p(U," class with the corresponding "),To=a(U,"CODE",{});var Ln=i(To);Js=p(Ln,"ORTModelForXxx"),Ln.forEach(o),Us=p(U," class in "),bo=a(U,"CODE",{});var Dn=i(bo);Ks=p(Dn,"optimum"),Dn.forEach(o),Ys=p(U,". For example, this is how you can use a question answering model in "),Mo=a(U,"CODE",{});var Hn=i(Mo);Zs=p(Hn,"optimum"),Hn.forEach(o),er=p(U,":"),U.forEach(o),Un=f(t),T(_t.$$.fragment,t),Kn=f(t),te=a(t,"P",{});var Fe=i(te);tr=p(Fe,"Optimum Inference also includes methods to convert vanilla Transformers models to optimized ones. Simply pass "),qo=a(Fe,"CODE",{});var Xn=i(qo);or=p(Xn,"from_transformers=True"),Xn.forEach(o),nr=p(Fe," to the "),Oo=a(Fe,"CODE",{});var Qn=i(Oo);sr=p(Qn,"from_pretrained()"),Qn.forEach(o),rr=p(Fe," method, and your model will be loaded and converted to ONNX on-the-fly:"),Fe.forEach(o),Yn=f(t),T($t.$$.fragment,t),Zn=f(t),fe=a(t,"H3",{class:!0});var ao=i(fe);Ce=a(ao,"A",{id:!0,class:!0,href:!0});var Wn=i(Ce);yo=a(Wn,"SPAN",{});var Bn=i(yo);T(kt.$$.fragment,Bn),Bn.forEach(o),Wn.forEach(o),ar=f(ao),jo=a(ao,"SPAN",{});var Gn=i(jo);ir=p(Gn,"Working with the Hugging Face Model Hub"),Gn.forEach(o),ao.forEach(o),es=f(t),K=a(t,"P",{});var ht=i(K);lr=p(ht,"The Optimum model classes like "),mo=a(ht,"A",{href:!0});var rl=i(mo);mr=p(rl,"ORTModelForSequenceClassification"),rl.forEach(o),pr=p(ht," are integrated with the "),wt=a(ht,"A",{href:!0,rel:!0});var al=i(wt);dr=p(al,"Hugging Face Model Hub"),al.forEach(o),cr=p(ht,`, which means you can not only
load model from the Hub, but also push your models to the Hub with `),Eo=a(ht,"CODE",{});var il=i(Eo);ur=p(il,"push_to_hub()"),il.forEach(o),hr=p(ht,` method. Below is an example which downloads a vanilla Transformers model
from the Hub and converts it to an optimum onnxruntime model and pushes it back into a new repository.`),ht.forEach(o),ts=f(t),T(xt.$$.fragment,t),os=f(t),ge=a(t,"H2",{class:!0});var vs=i(ge);Ae=a(vs,"A",{id:!0,class:!0,href:!0});var ll=i(Ae);Ro=a(ll,"SPAN",{});var ml=i(Ro);T(vt.$$.fragment,ml),ml.forEach(o),ll.forEach(o),fr=f(vs),Fo=a(vs,"SPAN",{});var pl=i(Fo);gr=p(pl,"Export and inference of sequence-to-sequence models"),pl.forEach(o),vs.forEach(o),ns=f(t),po=a(t,"P",{});var dl=i(po);_r=p(dl,`Sequence-to-sequence (Seq2Seq) models, that generate a new sequence from an input, can also be used when running inference with ONNX Runtime. When Seq2Seq models are exported to the ONNX format, they are decomposed into three parts that are later combined during inference.
Those three parts consist of the encoder, the \u201Cdecoder\u201D (which actually consists of the decoder with the language modeling head), and the \u201Cdecoder\u201D with pre-computed key/values as additional inputs.
This specific export comes from the fact that during the first pass, the decoder has no pre-computed key/values hidden-states, while during the rest of the generation past key/values will be used to speed up sequential decoding.
Here is an example on how you can export a T5 model to the ONNX format and run inference for a translation task:`),dl.forEach(o),ss=f(t),T(Tt.$$.fragment,t),rs=f(t),_e=a(t,"H2",{class:!0});var Ts=i(_e);Se=a(Ts,"A",{id:!0,class:!0,href:!0});var cl=i(Se);zo=a(cl,"SPAN",{});var ul=i(zo);T(bt.$$.fragment,ul),ul.forEach(o),cl.forEach(o),$r=f(Ts),Co=a(Ts,"SPAN",{});var hl=i(Co);kr=p(hl,"ORTModel"),hl.forEach(o),Ts.forEach(o),as=f(t),J=a(t,"DIV",{class:!0});var ft=i(J);T(Mt.$$.fragment,ft),wr=f(ft),qt=a(ft,"P",{});var bs=i(qt);xr=p(bs,`Base ORTModel class for implementing models using ONNX Runtime. The ORTModel implements generic methods for interacting
with the Hugging Face Hub as well as exporting vanilla transformers models to ONNX using `),Ao=a(bs,"CODE",{});var fl=i(Ao);vr=p(fl,"transformers.onnx"),fl.forEach(o),Tr=p(bs,` toolchain.
The ORTModel implements additionally generic methods for optimizing and quantizing Onnx models.`),bs.forEach(o),br=f(ft),Pe=a(ft,"DIV",{class:!0});var Ms=i(Pe);T(Ot.$$.fragment,Ms),Mr=f(Ms),yt=a(Ms,"P",{});var qs=i(yt);qr=p(qs,"Loads an ONNX Inference session with a given provider. Default provider is "),So=a(qs,"CODE",{});var gl=i(So);Or=p(gl,"CPUExecutionProvider"),gl.forEach(o),yr=p(qs," to match the default behaviour in PyTorch/TensorFlow/JAX."),qs.forEach(o),Ms.forEach(o),jr=f(ft),Ne=a(ft,"DIV",{class:!0});var Os=i(Ne);T(jt.$$.fragment,Os),Er=f(Os),Po=a(Os,"P",{});var _l=i(Po);Rr=p(_l,"Changes the ONNX Runtime provider according to the device."),_l.forEach(o),Os.forEach(o),ft.forEach(o),is=f(t),$e=a(t,"H2",{class:!0});var ys=i($e);Ie=a(ys,"A",{id:!0,class:!0,href:!0});var $l=i(Ie);No=a($l,"SPAN",{});var kl=i(No);T(Et.$$.fragment,kl),kl.forEach(o),$l.forEach(o),Fr=f(ys),Io=a(ys,"SPAN",{});var wl=i(Io);zr=p(wl,"ORTModelForFeatureExtraction"),wl.forEach(o),ys.forEach(o),ls=f(t),C=a(t,"DIV",{class:!0});var oe=i(C);T(Rt.$$.fragment,oe),Cr=f(oe),Lo=a(oe,"P",{});var xl=i(Lo);Ar=p(xl,"Onnx Model with a MaskedLMOutput for feature-extraction tasks."),xl.forEach(o),Sr=f(oe),Ft=a(oe,"P",{});var js=i(Ft);Pr=p(js,"This model inherits from [~"),Do=a(js,"CODE",{});var vl=i(Do);Nr=p(vl,"onnxruntime.modeling_ort.ORTModel"),vl.forEach(o),Ir=p(js,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),js.forEach(o),Lr=f(oe),Ho=a(oe,"P",{});var Tl=i(Ho);Dr=p(Tl,"Feature Extraction model for ONNX."),Tl.forEach(o),Hr=f(oe),X=a(oe,"DIV",{class:!0});var ne=i(X);T(zt.$$.fragment,ne),Xr=f(ne),ke=a(ne,"P",{});var co=i(ke);Qr=p(co,"The "),Xo=a(co,"CODE",{});var bl=i(Xo);Wr=p(bl,"ORTModelForFeatureExtraction"),bl.forEach(o),Br=p(co," forward method, overrides the "),Qo=a(co,"CODE",{});var Ml=i(Qo);Gr=p(Ml,"__call__"),Ml.forEach(o),Vr=p(co," special method."),co.forEach(o),Jr=f(ne),T(Le.$$.fragment,ne),Ur=f(ne),T(De.$$.fragment,ne),Kr=f(ne),T(He.$$.fragment,ne),ne.forEach(o),oe.forEach(o),ms=f(t),we=a(t,"H2",{class:!0});var Es=i(we);Xe=a(Es,"A",{id:!0,class:!0,href:!0});var ql=i(Xe);Wo=a(ql,"SPAN",{});var Ol=i(Wo);T(Ct.$$.fragment,Ol),Ol.forEach(o),ql.forEach(o),Yr=f(Es),Bo=a(Es,"SPAN",{});var yl=i(Bo);Zr=p(yl,"ORTModelForQuestionAnswering"),yl.forEach(o),Es.forEach(o),ps=f(t),A=a(t,"DIV",{class:!0});var se=i(A);T(At.$$.fragment,se),ea=f(se),Go=a(se,"P",{});var jl=i(Go);ta=p(jl,"Onnx Model with a QuestionAnsweringModelOutput for extractive question-answering tasks like SQuAD."),jl.forEach(o),oa=f(se),St=a(se,"P",{});var Rs=i(St);na=p(Rs,"This model inherits from [~"),Vo=a(Rs,"CODE",{});var El=i(Vo);sa=p(El,"onnxruntime.modeling_ort.ORTModel"),El.forEach(o),ra=p(Rs,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),Rs.forEach(o),aa=f(se),Jo=a(se,"P",{});var Rl=i(Jo);ia=p(Rl,"Question Answering model for ONNX."),Rl.forEach(o),la=f(se),Q=a(se,"DIV",{class:!0});var re=i(Q);T(Pt.$$.fragment,re),ma=f(re),xe=a(re,"P",{});var uo=i(xe);pa=p(uo,"The "),Uo=a(uo,"CODE",{});var Fl=i(Uo);da=p(Fl,"ORTModelForQuestionAnswering"),Fl.forEach(o),ca=p(uo," forward method, overrides the "),Ko=a(uo,"CODE",{});var zl=i(Ko);ua=p(zl,"__call__"),zl.forEach(o),ha=p(uo," special method."),uo.forEach(o),fa=f(re),T(Qe.$$.fragment,re),ga=f(re),T(We.$$.fragment,re),_a=f(re),T(Be.$$.fragment,re),re.forEach(o),se.forEach(o),ds=f(t),ve=a(t,"H2",{class:!0});var Fs=i(ve);Ge=a(Fs,"A",{id:!0,class:!0,href:!0});var Cl=i(Ge);Yo=a(Cl,"SPAN",{});var Al=i(Yo);T(Nt.$$.fragment,Al),Al.forEach(o),Cl.forEach(o),$a=f(Fs),Zo=a(Fs,"SPAN",{});var Sl=i(Zo);ka=p(Sl,"ORTModelForSequenceClassification"),Sl.forEach(o),Fs.forEach(o),cs=f(t),S=a(t,"DIV",{class:!0});var ae=i(S);T(It.$$.fragment,ae),wa=f(ae),en=a(ae,"P",{});var Pl=i(en);xa=p(Pl,`Onnx Model with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.`),Pl.forEach(o),va=f(ae),Lt=a(ae,"P",{});var zs=i(Lt);Ta=p(zs,"This model inherits from [~"),tn=a(zs,"CODE",{});var Nl=i(tn);ba=p(Nl,"onnxruntime.modeling_ort.ORTModel"),Nl.forEach(o),Ma=p(zs,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),zs.forEach(o),qa=f(ae),on=a(ae,"P",{});var Il=i(on);Oa=p(Il,"Sequence Classification model for ONNX."),Il.forEach(o),ya=f(ae),z=a(ae,"DIV",{class:!0});var Y=i(z);T(Dt.$$.fragment,Y),ja=f(Y),Te=a(Y,"P",{});var ho=i(Te);Ea=p(ho,"The "),nn=a(ho,"CODE",{});var Ll=i(nn);Ra=p(Ll,"ORTModelForSequenceClassification"),Ll.forEach(o),Fa=p(ho," forward method, overrides the "),sn=a(ho,"CODE",{});var Dl=i(sn);za=p(Dl,"__call__"),Dl.forEach(o),Ca=p(ho," special method."),ho.forEach(o),Aa=f(Y),T(Ve.$$.fragment,Y),Sa=f(Y),T(Je.$$.fragment,Y),Pa=f(Y),T(Ue.$$.fragment,Y),Na=f(Y),T(Ke.$$.fragment,Y),Y.forEach(o),ae.forEach(o),us=f(t),be=a(t,"H2",{class:!0});var Cs=i(be);Ye=a(Cs,"A",{id:!0,class:!0,href:!0});var Hl=i(Ye);rn=a(Hl,"SPAN",{});var Xl=i(rn);T(Ht.$$.fragment,Xl),Xl.forEach(o),Hl.forEach(o),Ia=f(Cs),an=a(Cs,"SPAN",{});var Ql=i(an);La=p(Ql,"ORTModelForTokenClassification"),Ql.forEach(o),Cs.forEach(o),hs=f(t),P=a(t,"DIV",{class:!0});var ie=i(P);T(Xt.$$.fragment,ie),Da=f(ie),ln=a(ie,"P",{});var Wl=i(ln);Ha=p(Wl,`Onnx Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g.
for Named-Entity-Recognition (NER) tasks.`),Wl.forEach(o),Xa=f(ie),Qt=a(ie,"P",{});var As=i(Qt);Qa=p(As,"This model inherits from [~"),mn=a(As,"CODE",{});var Bl=i(mn);Wa=p(Bl,"onnxruntime.modeling_ort.ORTModel"),Bl.forEach(o),Ba=p(As,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),As.forEach(o),Ga=f(ie),pn=a(ie,"P",{});var Gl=i(pn);Va=p(Gl,"Token Classification model for ONNX."),Gl.forEach(o),Ja=f(ie),W=a(ie,"DIV",{class:!0});var le=i(W);T(Wt.$$.fragment,le),Ua=f(le),Me=a(le,"P",{});var fo=i(Me);Ka=p(fo,"The "),dn=a(fo,"CODE",{});var Vl=i(dn);Ya=p(Vl,"ORTModelForTokenClassification"),Vl.forEach(o),Za=p(fo," forward method, overrides the "),cn=a(fo,"CODE",{});var Jl=i(cn);ei=p(Jl,"__call__"),Jl.forEach(o),ti=p(fo," special method."),fo.forEach(o),oi=f(le),T(Ze.$$.fragment,le),ni=f(le),T(et.$$.fragment,le),si=f(le),T(tt.$$.fragment,le),le.forEach(o),ie.forEach(o),fs=f(t),qe=a(t,"H2",{class:!0});var Ss=i(qe);ot=a(Ss,"A",{id:!0,class:!0,href:!0});var Ul=i(ot);un=a(Ul,"SPAN",{});var Kl=i(un);T(Bt.$$.fragment,Kl),Kl.forEach(o),Ul.forEach(o),ri=f(Ss),hn=a(Ss,"SPAN",{});var Yl=i(hn);ai=p(Yl,"ORTModelForCausalLM"),Yl.forEach(o),Ss.forEach(o),gs=f(t),N=a(t,"DIV",{class:!0});var me=i(N);T(Gt.$$.fragment,me),ii=f(me),fn=a(me,"P",{});var Zl=i(fn);li=p(Zl,`Onnx Model with a causal language modeling head on top (linear layer with weights tied to the input
embeddings).`),Zl.forEach(o),mi=f(me),Vt=a(me,"P",{});var Ps=i(Vt);pi=p(Ps,"This model inherits from [~"),gn=a(Ps,"CODE",{});var em=i(gn);di=p(em,"onnxruntime.modeling_ort.ORTModel"),em.forEach(o),ci=p(Ps,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),Ps.forEach(o),ui=f(me),_n=a(me,"P",{});var tm=i(_n);hi=p(tm,"Causal LM model for ONNX."),tm.forEach(o),fi=f(me),B=a(me,"DIV",{class:!0});var pe=i(B);T(Jt.$$.fragment,pe),gi=f(pe),Oe=a(pe,"P",{});var go=i(Oe);_i=p(go,"The "),$n=a(go,"CODE",{});var om=i($n);$i=p(om,"ORTModelForCausalLM"),om.forEach(o),ki=p(go," forward method, overrides the "),kn=a(go,"CODE",{});var nm=i(kn);wi=p(nm,"__call__"),nm.forEach(o),xi=p(go," special method."),go.forEach(o),vi=f(pe),T(nt.$$.fragment,pe),Ti=f(pe),T(st.$$.fragment,pe),bi=f(pe),T(rt.$$.fragment,pe),pe.forEach(o),me.forEach(o),_s=f(t),ye=a(t,"H2",{class:!0});var Ns=i(ye);at=a(Ns,"A",{id:!0,class:!0,href:!0});var sm=i(at);wn=a(sm,"SPAN",{});var rm=i(wn);T(Ut.$$.fragment,rm),rm.forEach(o),sm.forEach(o),Mi=f(Ns),xn=a(Ns,"SPAN",{});var am=i(xn);qi=p(am,"ORTModelForSeq2SeqLM"),am.forEach(o),Ns.forEach(o),$s=f(t),ee=a(t,"DIV",{class:!0});var _o=i(ee);T(Kt.$$.fragment,_o),Oi=f(_o),vn=a(_o,"P",{});var im=i(vn);yi=p(im,"Sequence-to-sequence model with a language modeling head for ONNX Runtime inference."),im.forEach(o),ji=f(_o),G=a(_o,"DIV",{class:!0});var de=i(G);T(Yt.$$.fragment,de),Ei=f(de),je=a(de,"P",{});var $o=i(je);Ri=p($o,"The "),Tn=a($o,"CODE",{});var lm=i(Tn);Fi=p(lm,"ORTModelForSeq2SeqLM"),lm.forEach(o),zi=p($o," forward method, overrides the "),bn=a($o,"CODE",{});var mm=i(bn);Ci=p(mm,"__call__"),mm.forEach(o),Ai=p($o," special method."),$o.forEach(o),Si=f(de),T(it.$$.fragment,de),Pi=f(de),T(lt.$$.fragment,de),Ni=f(de),T(mt.$$.fragment,de),de.forEach(o),_o.forEach(o),ks=f(t),Ee=a(t,"H2",{class:!0});var Is=i(Ee);pt=a(Is,"A",{id:!0,class:!0,href:!0});var pm=i(pt);Mn=a(pm,"SPAN",{});var dm=i(Mn);T(Zt.$$.fragment,dm),dm.forEach(o),pm.forEach(o),Ii=f(Is),qn=a(Is,"SPAN",{});var cm=i(qn);Li=p(cm,"ORTModelForImageClassification"),cm.forEach(o),Is.forEach(o),ws=f(t),I=a(t,"DIV",{class:!0});var ce=i(I);T(eo.$$.fragment,ce),Di=f(ce),On=a(ce,"P",{});var um=i(On);Hi=p(um,"Onnx Model for image-classification tasks."),um.forEach(o),Xi=f(ce),to=a(ce,"P",{});var Ls=i(to);Qi=p(Ls,"This model inherits from [~"),yn=a(Ls,"CODE",{});var hm=i(yn);Wi=p(hm,"onnxruntime.modeling_ort.ORTModel"),hm.forEach(o),Bi=p(Ls,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),Ls.forEach(o),Gi=f(ce),jn=a(ce,"P",{});var fm=i(jn);Vi=p(fm,"Image Classification model for ONNX."),fm.forEach(o),Ji=f(ce),V=a(ce,"DIV",{class:!0});var ue=i(V);T(oo.$$.fragment,ue),Ui=f(ue),Re=a(ue,"P",{});var ko=i(Re);Ki=p(ko,"The "),En=a(ko,"CODE",{});var gm=i(En);Yi=p(gm,"ORTModelForImageClassification"),gm.forEach(o),Zi=p(ko," forward method, overrides the "),Rn=a(ko,"CODE",{});var _m=i(Rn);el=p(_m,"__call__"),_m.forEach(o),tl=p(ko," special method."),ko.forEach(o),ol=f(ue),T(dt.$$.fragment,ue),nl=f(ue),T(ct.$$.fragment,ue),sl=f(ue),T(ut.$$.fragment,ue),ue.forEach(o),ce.forEach(o),this.h()},h(){x(s,"name","hf:doc:metadata"),x(s,"content",JSON.stringify(Bm)),x(u,"id","optimum-inference-with-onnx-runtime"),x(u,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),x(u,"href","#optimum-inference-with-onnx-runtime"),x(d,"class","relative group"),x(lo,"href","hf.co/models"),x(ze,"id","switching-from-transformers-to-optimum-inference"),x(ze,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),x(ze,"href","#switching-from-transformers-to-optimum-inference"),x(he,"class","relative group"),x(Ce,"id","working-with-the-hugging-face-model-hub"),x(Ce,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),x(Ce,"href","#working-with-the-hugging-face-model-hub"),x(fe,"class","relative group"),x(mo,"href","/docs/optimum/pr_279/en/onnxruntime/modeling_ort#optimum.onnxruntime.ORTModelForSequenceClassification"),x(wt,"href","https://hf.co/models"),x(wt,"rel","nofollow"),x(Ae,"id","export-and-inference-of-sequencetosequence-models"),x(Ae,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),x(Ae,"href","#export-and-inference-of-sequencetosequence-models"),x(ge,"class","relative group"),x(Se,"id","optimum.onnxruntime.ORTModel"),x(Se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),x(Se,"href","#optimum.onnxruntime.ORTModel"),x(_e,"class","relative group"),x(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ie,"id","optimum.onnxruntime.ORTModelForFeatureExtraction"),x(Ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),x(Ie,"href","#optimum.onnxruntime.ORTModelForFeatureExtraction"),x($e,"class","relative group"),x(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Xe,"id","optimum.onnxruntime.ORTModelForQuestionAnswering"),x(Xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),x(Xe,"href","#optimum.onnxruntime.ORTModelForQuestionAnswering"),x(we,"class","relative group"),x(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ge,"id","optimum.onnxruntime.ORTModelForSequenceClassification"),x(Ge,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),x(Ge,"href","#optimum.onnxruntime.ORTModelForSequenceClassification"),x(ve,"class","relative group"),x(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ye,"id","optimum.onnxruntime.ORTModelForTokenClassification"),x(Ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),x(Ye,"href","#optimum.onnxruntime.ORTModelForTokenClassification"),x(be,"class","relative group"),x(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(ot,"id","optimum.onnxruntime.ORTModelForCausalLM"),x(ot,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),x(ot,"href","#optimum.onnxruntime.ORTModelForCausalLM"),x(qe,"class","relative group"),x(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(at,"id","optimum.onnxruntime.ORTModelForSeq2SeqLM"),x(at,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),x(at,"href","#optimum.onnxruntime.ORTModelForSeq2SeqLM"),x(ye,"class","relative group"),x(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(pt,"id","optimum.onnxruntime.ORTModelForImageClassification"),x(pt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),x(pt,"href","#optimum.onnxruntime.ORTModelForImageClassification"),x(Ee,"class","relative group"),x(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,g){e(document.head,s),k(t,$,g),k(t,d,g),e(d,u),e(u,_),b(n,_,null),e(d,l),e(d,y),e(y,c),k(t,w,g),k(t,E,g),e(E,Ds),e(E,lo),e(lo,Hs),e(E,Xs),k(t,Vn,g),k(t,he,g),e(he,ze),e(ze,wo),b(gt,wo,null),e(he,Qs),e(he,xo),e(xo,Ws),k(t,Jn,g),k(t,H,g),e(H,Bs),e(H,vo),e(vo,Gs),e(H,Vs),e(H,To),e(To,Js),e(H,Us),e(H,bo),e(bo,Ks),e(H,Ys),e(H,Mo),e(Mo,Zs),e(H,er),k(t,Un,g),b(_t,t,g),k(t,Kn,g),k(t,te,g),e(te,tr),e(te,qo),e(qo,or),e(te,nr),e(te,Oo),e(Oo,sr),e(te,rr),k(t,Yn,g),b($t,t,g),k(t,Zn,g),k(t,fe,g),e(fe,Ce),e(Ce,yo),b(kt,yo,null),e(fe,ar),e(fe,jo),e(jo,ir),k(t,es,g),k(t,K,g),e(K,lr),e(K,mo),e(mo,mr),e(K,pr),e(K,wt),e(wt,dr),e(K,cr),e(K,Eo),e(Eo,ur),e(K,hr),k(t,ts,g),b(xt,t,g),k(t,os,g),k(t,ge,g),e(ge,Ae),e(Ae,Ro),b(vt,Ro,null),e(ge,fr),e(ge,Fo),e(Fo,gr),k(t,ns,g),k(t,po,g),e(po,_r),k(t,ss,g),b(Tt,t,g),k(t,rs,g),k(t,_e,g),e(_e,Se),e(Se,zo),b(bt,zo,null),e(_e,$r),e(_e,Co),e(Co,kr),k(t,as,g),k(t,J,g),b(Mt,J,null),e(J,wr),e(J,qt),e(qt,xr),e(qt,Ao),e(Ao,vr),e(qt,Tr),e(J,br),e(J,Pe),b(Ot,Pe,null),e(Pe,Mr),e(Pe,yt),e(yt,qr),e(yt,So),e(So,Or),e(yt,yr),e(J,jr),e(J,Ne),b(jt,Ne,null),e(Ne,Er),e(Ne,Po),e(Po,Rr),k(t,is,g),k(t,$e,g),e($e,Ie),e(Ie,No),b(Et,No,null),e($e,Fr),e($e,Io),e(Io,zr),k(t,ls,g),k(t,C,g),b(Rt,C,null),e(C,Cr),e(C,Lo),e(Lo,Ar),e(C,Sr),e(C,Ft),e(Ft,Pr),e(Ft,Do),e(Do,Nr),e(Ft,Ir),e(C,Lr),e(C,Ho),e(Ho,Dr),e(C,Hr),e(C,X),b(zt,X,null),e(X,Xr),e(X,ke),e(ke,Qr),e(ke,Xo),e(Xo,Wr),e(ke,Br),e(ke,Qo),e(Qo,Gr),e(ke,Vr),e(X,Jr),b(Le,X,null),e(X,Ur),b(De,X,null),e(X,Kr),b(He,X,null),k(t,ms,g),k(t,we,g),e(we,Xe),e(Xe,Wo),b(Ct,Wo,null),e(we,Yr),e(we,Bo),e(Bo,Zr),k(t,ps,g),k(t,A,g),b(At,A,null),e(A,ea),e(A,Go),e(Go,ta),e(A,oa),e(A,St),e(St,na),e(St,Vo),e(Vo,sa),e(St,ra),e(A,aa),e(A,Jo),e(Jo,ia),e(A,la),e(A,Q),b(Pt,Q,null),e(Q,ma),e(Q,xe),e(xe,pa),e(xe,Uo),e(Uo,da),e(xe,ca),e(xe,Ko),e(Ko,ua),e(xe,ha),e(Q,fa),b(Qe,Q,null),e(Q,ga),b(We,Q,null),e(Q,_a),b(Be,Q,null),k(t,ds,g),k(t,ve,g),e(ve,Ge),e(Ge,Yo),b(Nt,Yo,null),e(ve,$a),e(ve,Zo),e(Zo,ka),k(t,cs,g),k(t,S,g),b(It,S,null),e(S,wa),e(S,en),e(en,xa),e(S,va),e(S,Lt),e(Lt,Ta),e(Lt,tn),e(tn,ba),e(Lt,Ma),e(S,qa),e(S,on),e(on,Oa),e(S,ya),e(S,z),b(Dt,z,null),e(z,ja),e(z,Te),e(Te,Ea),e(Te,nn),e(nn,Ra),e(Te,Fa),e(Te,sn),e(sn,za),e(Te,Ca),e(z,Aa),b(Ve,z,null),e(z,Sa),b(Je,z,null),e(z,Pa),b(Ue,z,null),e(z,Na),b(Ke,z,null),k(t,us,g),k(t,be,g),e(be,Ye),e(Ye,rn),b(Ht,rn,null),e(be,Ia),e(be,an),e(an,La),k(t,hs,g),k(t,P,g),b(Xt,P,null),e(P,Da),e(P,ln),e(ln,Ha),e(P,Xa),e(P,Qt),e(Qt,Qa),e(Qt,mn),e(mn,Wa),e(Qt,Ba),e(P,Ga),e(P,pn),e(pn,Va),e(P,Ja),e(P,W),b(Wt,W,null),e(W,Ua),e(W,Me),e(Me,Ka),e(Me,dn),e(dn,Ya),e(Me,Za),e(Me,cn),e(cn,ei),e(Me,ti),e(W,oi),b(Ze,W,null),e(W,ni),b(et,W,null),e(W,si),b(tt,W,null),k(t,fs,g),k(t,qe,g),e(qe,ot),e(ot,un),b(Bt,un,null),e(qe,ri),e(qe,hn),e(hn,ai),k(t,gs,g),k(t,N,g),b(Gt,N,null),e(N,ii),e(N,fn),e(fn,li),e(N,mi),e(N,Vt),e(Vt,pi),e(Vt,gn),e(gn,di),e(Vt,ci),e(N,ui),e(N,_n),e(_n,hi),e(N,fi),e(N,B),b(Jt,B,null),e(B,gi),e(B,Oe),e(Oe,_i),e(Oe,$n),e($n,$i),e(Oe,ki),e(Oe,kn),e(kn,wi),e(Oe,xi),e(B,vi),b(nt,B,null),e(B,Ti),b(st,B,null),e(B,bi),b(rt,B,null),k(t,_s,g),k(t,ye,g),e(ye,at),e(at,wn),b(Ut,wn,null),e(ye,Mi),e(ye,xn),e(xn,qi),k(t,$s,g),k(t,ee,g),b(Kt,ee,null),e(ee,Oi),e(ee,vn),e(vn,yi),e(ee,ji),e(ee,G),b(Yt,G,null),e(G,Ei),e(G,je),e(je,Ri),e(je,Tn),e(Tn,Fi),e(je,zi),e(je,bn),e(bn,Ci),e(je,Ai),e(G,Si),b(it,G,null),e(G,Pi),b(lt,G,null),e(G,Ni),b(mt,G,null),k(t,ks,g),k(t,Ee,g),e(Ee,pt),e(pt,Mn),b(Zt,Mn,null),e(Ee,Ii),e(Ee,qn),e(qn,Li),k(t,ws,g),k(t,I,g),b(eo,I,null),e(I,Di),e(I,On),e(On,Hi),e(I,Xi),e(I,to),e(to,Qi),e(to,yn),e(yn,Wi),e(to,Bi),e(I,Gi),e(I,jn),e(jn,Vi),e(I,Ji),e(I,V),b(oo,V,null),e(V,Ui),e(V,Re),e(Re,Ki),e(Re,En),e(En,Yi),e(Re,Zi),e(Re,Rn),e(Rn,el),e(Re,tl),e(V,ol),b(dt,V,null),e(V,nl),b(ct,V,null),e(V,sl),b(ut,V,null),xs=!0},p(t,[g]){const no={};g&2&&(no.$$scope={dirty:g,ctx:t}),Le.$set(no);const Fn={};g&2&&(Fn.$$scope={dirty:g,ctx:t}),De.$set(Fn);const zn={};g&2&&(zn.$$scope={dirty:g,ctx:t}),He.$set(zn);const Cn={};g&2&&(Cn.$$scope={dirty:g,ctx:t}),Qe.$set(Cn);const so={};g&2&&(so.$$scope={dirty:g,ctx:t}),We.$set(so);const An={};g&2&&(An.$$scope={dirty:g,ctx:t}),Be.$set(An);const ro={};g&2&&(ro.$$scope={dirty:g,ctx:t}),Ve.$set(ro);const Sn={};g&2&&(Sn.$$scope={dirty:g,ctx:t}),Je.$set(Sn);const Pn={};g&2&&(Pn.$$scope={dirty:g,ctx:t}),Ue.$set(Pn);const Nn={};g&2&&(Nn.$$scope={dirty:g,ctx:t}),Ke.$set(Nn);const U={};g&2&&(U.$$scope={dirty:g,ctx:t}),Ze.$set(U);const In={};g&2&&(In.$$scope={dirty:g,ctx:t}),et.$set(In);const Ln={};g&2&&(Ln.$$scope={dirty:g,ctx:t}),tt.$set(Ln);const Dn={};g&2&&(Dn.$$scope={dirty:g,ctx:t}),nt.$set(Dn);const Hn={};g&2&&(Hn.$$scope={dirty:g,ctx:t}),st.$set(Hn);const Fe={};g&2&&(Fe.$$scope={dirty:g,ctx:t}),rt.$set(Fe);const Xn={};g&2&&(Xn.$$scope={dirty:g,ctx:t}),it.$set(Xn);const Qn={};g&2&&(Qn.$$scope={dirty:g,ctx:t}),lt.$set(Qn);const ao={};g&2&&(ao.$$scope={dirty:g,ctx:t}),mt.$set(ao);const Wn={};g&2&&(Wn.$$scope={dirty:g,ctx:t}),dt.$set(Wn);const Bn={};g&2&&(Bn.$$scope={dirty:g,ctx:t}),ct.$set(Bn);const Gn={};g&2&&(Gn.$$scope={dirty:g,ctx:t}),ut.$set(Gn)},i(t){xs||(M(n.$$.fragment,t),M(gt.$$.fragment,t),M(_t.$$.fragment,t),M($t.$$.fragment,t),M(kt.$$.fragment,t),M(xt.$$.fragment,t),M(vt.$$.fragment,t),M(Tt.$$.fragment,t),M(bt.$$.fragment,t),M(Mt.$$.fragment,t),M(Ot.$$.fragment,t),M(jt.$$.fragment,t),M(Et.$$.fragment,t),M(Rt.$$.fragment,t),M(zt.$$.fragment,t),M(Le.$$.fragment,t),M(De.$$.fragment,t),M(He.$$.fragment,t),M(Ct.$$.fragment,t),M(At.$$.fragment,t),M(Pt.$$.fragment,t),M(Qe.$$.fragment,t),M(We.$$.fragment,t),M(Be.$$.fragment,t),M(Nt.$$.fragment,t),M(It.$$.fragment,t),M(Dt.$$.fragment,t),M(Ve.$$.fragment,t),M(Je.$$.fragment,t),M(Ue.$$.fragment,t),M(Ke.$$.fragment,t),M(Ht.$$.fragment,t),M(Xt.$$.fragment,t),M(Wt.$$.fragment,t),M(Ze.$$.fragment,t),M(et.$$.fragment,t),M(tt.$$.fragment,t),M(Bt.$$.fragment,t),M(Gt.$$.fragment,t),M(Jt.$$.fragment,t),M(nt.$$.fragment,t),M(st.$$.fragment,t),M(rt.$$.fragment,t),M(Ut.$$.fragment,t),M(Kt.$$.fragment,t),M(Yt.$$.fragment,t),M(it.$$.fragment,t),M(lt.$$.fragment,t),M(mt.$$.fragment,t),M(Zt.$$.fragment,t),M(eo.$$.fragment,t),M(oo.$$.fragment,t),M(dt.$$.fragment,t),M(ct.$$.fragment,t),M(ut.$$.fragment,t),xs=!0)},o(t){q(n.$$.fragment,t),q(gt.$$.fragment,t),q(_t.$$.fragment,t),q($t.$$.fragment,t),q(kt.$$.fragment,t),q(xt.$$.fragment,t),q(vt.$$.fragment,t),q(Tt.$$.fragment,t),q(bt.$$.fragment,t),q(Mt.$$.fragment,t),q(Ot.$$.fragment,t),q(jt.$$.fragment,t),q(Et.$$.fragment,t),q(Rt.$$.fragment,t),q(zt.$$.fragment,t),q(Le.$$.fragment,t),q(De.$$.fragment,t),q(He.$$.fragment,t),q(Ct.$$.fragment,t),q(At.$$.fragment,t),q(Pt.$$.fragment,t),q(Qe.$$.fragment,t),q(We.$$.fragment,t),q(Be.$$.fragment,t),q(Nt.$$.fragment,t),q(It.$$.fragment,t),q(Dt.$$.fragment,t),q(Ve.$$.fragment,t),q(Je.$$.fragment,t),q(Ue.$$.fragment,t),q(Ke.$$.fragment,t),q(Ht.$$.fragment,t),q(Xt.$$.fragment,t),q(Wt.$$.fragment,t),q(Ze.$$.fragment,t),q(et.$$.fragment,t),q(tt.$$.fragment,t),q(Bt.$$.fragment,t),q(Gt.$$.fragment,t),q(Jt.$$.fragment,t),q(nt.$$.fragment,t),q(st.$$.fragment,t),q(rt.$$.fragment,t),q(Ut.$$.fragment,t),q(Kt.$$.fragment,t),q(Yt.$$.fragment,t),q(it.$$.fragment,t),q(lt.$$.fragment,t),q(mt.$$.fragment,t),q(Zt.$$.fragment,t),q(eo.$$.fragment,t),q(oo.$$.fragment,t),q(dt.$$.fragment,t),q(ct.$$.fragment,t),q(ut.$$.fragment,t),xs=!1},d(t){o(s),t&&o($),t&&o(d),O(n),t&&o(w),t&&o(E),t&&o(Vn),t&&o(he),O(gt),t&&o(Jn),t&&o(H),t&&o(Un),O(_t,t),t&&o(Kn),t&&o(te),t&&o(Yn),O($t,t),t&&o(Zn),t&&o(fe),O(kt),t&&o(es),t&&o(K),t&&o(ts),O(xt,t),t&&o(os),t&&o(ge),O(vt),t&&o(ns),t&&o(po),t&&o(ss),O(Tt,t),t&&o(rs),t&&o(_e),O(bt),t&&o(as),t&&o(J),O(Mt),O(Ot),O(jt),t&&o(is),t&&o($e),O(Et),t&&o(ls),t&&o(C),O(Rt),O(zt),O(Le),O(De),O(He),t&&o(ms),t&&o(we),O(Ct),t&&o(ps),t&&o(A),O(At),O(Pt),O(Qe),O(We),O(Be),t&&o(ds),t&&o(ve),O(Nt),t&&o(cs),t&&o(S),O(It),O(Dt),O(Ve),O(Je),O(Ue),O(Ke),t&&o(us),t&&o(be),O(Ht),t&&o(hs),t&&o(P),O(Xt),O(Wt),O(Ze),O(et),O(tt),t&&o(fs),t&&o(qe),O(Bt),t&&o(gs),t&&o(N),O(Gt),O(Jt),O(nt),O(st),O(rt),t&&o(_s),t&&o(ye),O(Ut),t&&o($s),t&&o(ee),O(Kt),O(Yt),O(it),O(lt),O(mt),t&&o(ks),t&&o(Ee),O(Zt),t&&o(ws),t&&o(I),O(eo),O(oo),O(dt),O(ct),O(ut)}}}const Bm={local:"optimum-inference-with-onnx-runtime",sections:[{local:"switching-from-transformers-to-optimum-inference",sections:[{local:"working-with-the-hugging-face-model-hub",title:"Working with the Hugging Face Model Hub"}],title:"Switching from Transformers to Optimum Inference"},{local:"export-and-inference-of-sequencetosequence-models",title:"Export and inference of sequence-to-sequence models"},{local:"optimum.onnxruntime.ORTModel",title:"ORTModel"},{local:"optimum.onnxruntime.ORTModelForFeatureExtraction",title:"ORTModelForFeatureExtraction"},{local:"optimum.onnxruntime.ORTModelForQuestionAnswering",title:"ORTModelForQuestionAnswering"},{local:"optimum.onnxruntime.ORTModelForSequenceClassification",title:"ORTModelForSequenceClassification"},{local:"optimum.onnxruntime.ORTModelForTokenClassification",title:"ORTModelForTokenClassification"},{local:"optimum.onnxruntime.ORTModelForCausalLM",title:"ORTModelForCausalLM"},{local:"optimum.onnxruntime.ORTModelForSeq2SeqLM",title:"ORTModelForSeq2SeqLM"},{local:"optimum.onnxruntime.ORTModelForImageClassification",title:"ORTModelForImageClassification"}],title:"Optimum Inference with ONNX Runtime"};function Gm(j){return vm(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ep extends $m{constructor(s){super();km(this,s,Gm,Wm,wm,{})}}export{ep as default,Bm as metadata};
