import{S as Op,i as qp,s as jp,e as r,k as h,w as v,t as m,M as yp,c as a,d as o,m as f,a as i,x as T,h as p,b as j,G as e,g as k,y as b,q as M,o as O,B as q,v as Ep,L as C}from"../../chunks/vendor-hf-doc-builder.js";import{T as qt}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 z}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Rp(y){let n,$,c,u,_;return{c(){n=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=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(s){n=a(s,"P",{});var l=i(n);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a(l,"CODE",{});var x=i(c);u=p(x,"Module"),x.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(s,l){k(s,n,l),e(n,$),e(n,c),e(c,u),e(n,_)},d(s){s&&o(n)}}}function Fp(y){let n,$,c,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(){n=r("p"),$=m("Example of feature extraction:"),c=h(),v(u.$$.fragment)},l(s){n=a(s,"P",{});var l=i(n);$=p(l,"Example of feature extraction:"),l.forEach(o),c=f(s),T(u.$$.fragment,s)},m(s,l){k(s,n,l),e(n,$),k(s,c,l),b(u,s,l),_=!0},p:C,i(s){_||(M(u.$$.fragment,s),_=!0)},o(s){O(u.$$.fragment,s),_=!1},d(s){s&&o(n),s&&o(c),q(u,s)}}}function zp(y){let n,$,c,u,_,s,l,x;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(){n=r("p"),$=m("Example using "),c=r("code"),u=m("transformers.pipeline"),_=m(":"),s=h(),v(l.$$.fragment)},l(d){n=a(d,"P",{});var w=i(n);$=p(w,"Example using "),c=a(w,"CODE",{});var E=i(c);u=p(E,"transformers.pipeline"),E.forEach(o),_=p(w,":"),w.forEach(o),s=f(d),T(l.$$.fragment,d)},m(d,w){k(d,n,w),e(n,$),e(n,c),e(c,u),e(n,_),k(d,s,w),b(l,d,w),x=!0},p:C,i(d){x||(M(l.$$.fragment,d),x=!0)},o(d){O(l.$$.fragment,d),x=!1},d(d){d&&o(n),d&&o(s),q(l,d)}}}function Cp(y){let n,$,c,u,_;return{c(){n=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=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(s){n=a(s,"P",{});var l=i(n);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a(l,"CODE",{});var x=i(c);u=p(x,"Module"),x.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(s,l){k(s,n,l),e(n,$),e(n,c),e(c,u),e(n,_)},d(s){s&&o(n)}}}function Ap(y){let n,$,c,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(){n=r("p"),$=m("Example of question answering:"),c=h(),v(u.$$.fragment)},l(s){n=a(s,"P",{});var l=i(n);$=p(l,"Example of question answering:"),l.forEach(o),c=f(s),T(u.$$.fragment,s)},m(s,l){k(s,n,l),e(n,$),k(s,c,l),b(u,s,l),_=!0},p:C,i(s){_||(M(u.$$.fragment,s),_=!0)},o(s){O(u.$$.fragment,s),_=!1},d(s){s&&o(n),s&&o(c),q(u,s)}}}function Sp(y){let n,$,c,u,_,s,l,x;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(){n=r("p"),$=m("Example using "),c=r("code"),u=m("transformers.pipeline"),_=m(":"),s=h(),v(l.$$.fragment)},l(d){n=a(d,"P",{});var w=i(n);$=p(w,"Example using "),c=a(w,"CODE",{});var E=i(c);u=p(E,"transformers.pipeline"),E.forEach(o),_=p(w,":"),w.forEach(o),s=f(d),T(l.$$.fragment,d)},m(d,w){k(d,n,w),e(n,$),e(n,c),e(c,u),e(n,_),k(d,s,w),b(l,d,w),x=!0},p:C,i(d){x||(M(l.$$.fragment,d),x=!0)},o(d){O(l.$$.fragment,d),x=!1},d(d){d&&o(n),d&&o(s),q(l,d)}}}function Pp(y){let n,$,c,u,_;return{c(){n=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=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(s){n=a(s,"P",{});var l=i(n);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a(l,"CODE",{});var x=i(c);u=p(x,"Module"),x.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(s,l){k(s,n,l),e(n,$),e(n,c),e(c,u),e(n,_)},d(s){s&&o(n)}}}function Np(y){let n,$,c,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(){n=r("p"),$=m("Example of single-label classification:"),c=h(),v(u.$$.fragment)},l(s){n=a(s,"P",{});var l=i(n);$=p(l,"Example of single-label classification:"),l.forEach(o),c=f(s),T(u.$$.fragment,s)},m(s,l){k(s,n,l),e(n,$),k(s,c,l),b(u,s,l),_=!0},p:C,i(s){_||(M(u.$$.fragment,s),_=!0)},o(s){O(u.$$.fragment,s),_=!1},d(s){s&&o(n),s&&o(c),q(u,s)}}}function Ip(y){let n,$,c,u,_,s,l,x;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(){n=r("p"),$=m("Example using "),c=r("code"),u=m("transformers.pipelines"),_=m(":"),s=h(),v(l.$$.fragment)},l(d){n=a(d,"P",{});var w=i(n);$=p(w,"Example using "),c=a(w,"CODE",{});var E=i(c);u=p(E,"transformers.pipelines"),E.forEach(o),_=p(w,":"),w.forEach(o),s=f(d),T(l.$$.fragment,d)},m(d,w){k(d,n,w),e(n,$),e(n,c),e(c,u),e(n,_),k(d,s,w),b(l,d,w),x=!0},p:C,i(d){x||(M(l.$$.fragment,d),x=!0)},o(d){O(l.$$.fragment,d),x=!1},d(d){d&&o(n),d&&o(s),q(l,d)}}}function Lp(y){let n,$,c,u,_,s,l,x;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(){n=r("p"),$=m("Example using zero-shot-classification "),c=r("code"),u=m("transformers.pipelines"),_=m(":"),s=h(),v(l.$$.fragment)},l(d){n=a(d,"P",{});var w=i(n);$=p(w,"Example using zero-shot-classification "),c=a(w,"CODE",{});var E=i(c);u=p(E,"transformers.pipelines"),E.forEach(o),_=p(w,":"),w.forEach(o),s=f(d),T(l.$$.fragment,d)},m(d,w){k(d,n,w),e(n,$),e(n,c),e(c,u),e(n,_),k(d,s,w),b(l,d,w),x=!0},p:C,i(d){x||(M(l.$$.fragment,d),x=!0)},o(d){O(l.$$.fragment,d),x=!1},d(d){d&&o(n),d&&o(s),q(l,d)}}}function Dp(y){let n,$,c,u,_;return{c(){n=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=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(s){n=a(s,"P",{});var l=i(n);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a(l,"CODE",{});var x=i(c);u=p(x,"Module"),x.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(s,l){k(s,n,l),e(n,$),e(n,c),e(c,u),e(n,_)},d(s){s&&o(n)}}}function Hp(y){let n,$,c,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(){n=r("p"),$=m("Example of token classification:"),c=h(),v(u.$$.fragment)},l(s){n=a(s,"P",{});var l=i(n);$=p(l,"Example of token classification:"),l.forEach(o),c=f(s),T(u.$$.fragment,s)},m(s,l){k(s,n,l),e(n,$),k(s,c,l),b(u,s,l),_=!0},p:C,i(s){_||(M(u.$$.fragment,s),_=!0)},o(s){O(u.$$.fragment,s),_=!1},d(s){s&&o(n),s&&o(c),q(u,s)}}}function Xp(y){let n,$,c,u,_,s,l,x;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(){n=r("p"),$=m("Example using "),c=r("code"),u=m("transformers.pipelines"),_=m(":"),s=h(),v(l.$$.fragment)},l(d){n=a(d,"P",{});var w=i(n);$=p(w,"Example using "),c=a(w,"CODE",{});var E=i(c);u=p(E,"transformers.pipelines"),E.forEach(o),_=p(w,":"),w.forEach(o),s=f(d),T(l.$$.fragment,d)},m(d,w){k(d,n,w),e(n,$),e(n,c),e(c,u),e(n,_),k(d,s,w),b(l,d,w),x=!0},p:C,i(d){x||(M(l.$$.fragment,d),x=!0)},o(d){O(l.$$.fragment,d),x=!1},d(d){d&&o(n),d&&o(s),q(l,d)}}}function Qp(y){let n,$,c,u,_;return{c(){n=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=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(s){n=a(s,"P",{});var l=i(n);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a(l,"CODE",{});var x=i(c);u=p(x,"Module"),x.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(s,l){k(s,n,l),e(n,$),e(n,c),e(c,u),e(n,_)},d(s){s&&o(n)}}}function Wp(y){let n,$,c,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(){n=r("p"),$=m("Example of text generation:"),c=h(),v(u.$$.fragment)},l(s){n=a(s,"P",{});var l=i(n);$=p(l,"Example of text generation:"),l.forEach(o),c=f(s),T(u.$$.fragment,s)},m(s,l){k(s,n,l),e(n,$),k(s,c,l),b(u,s,l),_=!0},p:C,i(s){_||(M(u.$$.fragment,s),_=!0)},o(s){O(u.$$.fragment,s),_=!1},d(s){s&&o(n),s&&o(c),q(u,s)}}}function Bp(y){let n,$,c,u,_,s,l,x;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(){n=r("p"),$=m("Example using "),c=r("code"),u=m("transformers.pipelines"),_=m(":"),s=h(),v(l.$$.fragment)},l(d){n=a(d,"P",{});var w=i(n);$=p(w,"Example using "),c=a(w,"CODE",{});var E=i(c);u=p(E,"transformers.pipelines"),E.forEach(o),_=p(w,":"),w.forEach(o),s=f(d),T(l.$$.fragment,d)},m(d,w){k(d,n,w),e(n,$),e(n,c),e(c,u),e(n,_),k(d,s,w),b(l,d,w),x=!0},p:C,i(d){x||(M(l.$$.fragment,d),x=!0)},o(d){O(l.$$.fragment,d),x=!1},d(d){d&&o(n),d&&o(s),q(l,d)}}}function Vp(y){let n,$,c,u,_;return{c(){n=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=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(s){n=a(s,"P",{});var l=i(n);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a(l,"CODE",{});var x=i(c);u=p(x,"Module"),x.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(s,l){k(s,n,l),e(n,$),e(n,c),e(c,u),e(n,_)},d(s){s&&o(n)}}}function Gp(y){let n,$,c,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(){n=r("p"),$=m("Example of text generation:"),c=h(),v(u.$$.fragment)},l(s){n=a(s,"P",{});var l=i(n);$=p(l,"Example of text generation:"),l.forEach(o),c=f(s),T(u.$$.fragment,s)},m(s,l){k(s,n,l),e(n,$),k(s,c,l),b(u,s,l),_=!0},p:C,i(s){_||(M(u.$$.fragment,s),_=!0)},o(s){O(u.$$.fragment,s),_=!1},d(s){s&&o(n),s&&o(c),q(u,s)}}}function Jp(y){let n,$,c,u,_,s,l,x;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(){n=r("p"),$=m("Example using "),c=r("code"),u=m("transformers.pipeline"),_=m(":"),s=h(),v(l.$$.fragment)},l(d){n=a(d,"P",{});var w=i(n);$=p(w,"Example using "),c=a(w,"CODE",{});var E=i(c);u=p(E,"transformers.pipeline"),E.forEach(o),_=p(w,":"),w.forEach(o),s=f(d),T(l.$$.fragment,d)},m(d,w){k(d,n,w),e(n,$),e(n,c),e(c,u),e(n,_),k(d,s,w),b(l,d,w),x=!0},p:C,i(d){x||(M(l.$$.fragment,d),x=!0)},o(d){O(l.$$.fragment,d),x=!1},d(d){d&&o(n),d&&o(s),q(l,d)}}}function Up(y){let n,$,c,u,_;return{c(){n=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=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(s){n=a(s,"P",{});var l=i(n);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a(l,"CODE",{});var x=i(c);u=p(x,"Module"),x.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(s,l){k(s,n,l),e(n,$),e(n,c),e(c,u),e(n,_)},d(s){s&&o(n)}}}function Kp(y){let n,$,c,u,_;return u=new R({props:{code:`import requests
from PIL import Image
from optimum.onnxruntime import ORTModelForImageClassification
from transformers import AutoFeatureExtractor

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

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

inputs = preprocessor(images=image, return_tensors="pt")

outputs = model(**inputs)
logits = outputs.logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<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">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>preprocessor = 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 = preprocessor(images=image, 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`}}),{c(){n=r("p"),$=m("Example of image classification:"),c=h(),v(u.$$.fragment)},l(s){n=a(s,"P",{});var l=i(n);$=p(l,"Example of image classification:"),l.forEach(o),c=f(s),T(u.$$.fragment,s)},m(s,l){k(s,n,l),e(n,$),k(s,c,l),b(u,s,l),_=!0},p:C,i(s){_||(M(u.$$.fragment,s),_=!0)},o(s){O(u.$$.fragment,s),_=!1},d(s){s&&o(n),s&&o(c),q(u,s)}}}function Yp(y){let n,$,c,u,_,s,l,x;return l=new R({props:{code:`import requests
from PIL import Image
from transformers import AutoFeatureExtractor, pipeline
from optimum.onnxruntime import ORTModelForImageClassification

preprocessor = AutoFeatureExtractor.from_pretrained("optimum/vit-base-patch16-224")
model = ORTModelForImageClassification.from_pretrained("optimum/vit-base-patch16-224")
onnx_image_classifier = pipeline("image-classification", model=model, feature_extractor=preprocessor)

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
pred = onnx_image_classifier(url)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<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>preprocessor = 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_image_classifier = pipeline(<span class="hljs-string">&quot;image-classification&quot;</span>, model=model, feature_extractor=preprocessor)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pred = onnx_image_classifier(url)`}}),{c(){n=r("p"),$=m("Example using "),c=r("code"),u=m("transformers.pipeline"),_=m(":"),s=h(),v(l.$$.fragment)},l(d){n=a(d,"P",{});var w=i(n);$=p(w,"Example using "),c=a(w,"CODE",{});var E=i(c);u=p(E,"transformers.pipeline"),E.forEach(o),_=p(w,":"),w.forEach(o),s=f(d),T(l.$$.fragment,d)},m(d,w){k(d,n,w),e(n,$),e(n,c),e(c,u),e(n,_),k(d,s,w),b(l,d,w),x=!0},p:C,i(d){x||(M(l.$$.fragment,d),x=!0)},o(d){O(l.$$.fragment,d),x=!1},d(d){d&&o(n),d&&o(s),q(l,d)}}}function Zp(y){let n,$,c,u,_;return{c(){n=r("p"),$=m("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=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(s){n=a(s,"P",{});var l=i(n);$=p(l,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a(l,"CODE",{});var x=i(c);u=p(x,"Module"),x.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(s,l){k(s,n,l),e(n,$),e(n,c),e(c,u),e(n,_)},d(s){s&&o(n)}}}function ed(y){let n,$,c,u,_,s,l,x;return l=new R({props:{code:`from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForCustomTasks

tokenizer = AutoTokenizer.from_pretrained("optimum/sbert-all-MiniLM-L6-with-pooler")
model = ORTModelForCustomTasks.from_pretrained("optimum/sbert-all-MiniLM-L6-with-pooler")

inputs = tokenizer("I love burritos!", return_tensors="pt")

outputs = model(**inputs)
last_hidden_state = outputs.last_hidden_state
pooler_output = outputs.pooler_output`,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> ORTModelForCustomTasks

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;I love burritos!&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>last_hidden_state = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span>pooler_output = outputs.pooler_output`}}),{c(){n=r("p"),$=m("Example of custom tasks(e.g. a sentence transformers taking "),c=r("code"),u=m("pooler_output"),_=m(" as output):"),s=h(),v(l.$$.fragment)},l(d){n=a(d,"P",{});var w=i(n);$=p(w,"Example of custom tasks(e.g. a sentence transformers taking "),c=a(w,"CODE",{});var E=i(c);u=p(E,"pooler_output"),E.forEach(o),_=p(w," as output):"),w.forEach(o),s=f(d),T(l.$$.fragment,d)},m(d,w){k(d,n,w),e(n,$),e(n,c),e(c,u),e(n,_),k(d,s,w),b(l,d,w),x=!0},p:C,i(d){x||(M(l.$$.fragment,d),x=!0)},o(d){O(l.$$.fragment,d),x=!1},d(d){d&&o(n),d&&o(s),q(l,d)}}}function td(y){let n,$,c,u,_,s,l,x;return l=new R({props:{code:`from transformers import AutoTokenizer, pipeline
from optimum.onnxruntime import ORTModelForCustomTasks

tokenizer = AutoTokenizer.from_pretrained("optimum/sbert-all-MiniLM-L6-with-pooler")
model = ORTModelForCustomTasks.from_pretrained("optimum/sbert-all-MiniLM-L6-with-pooler")
onnx_extractor = pipeline("feature-extraction", model=model, tokenizer=tokenizer)

text = "I love burritos!"
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> ORTModelForCustomTasks

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;optimum/sbert-all-MiniLM-L6-with-pooler&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForCustomTasks.from_pretrained(<span class="hljs-string">&quot;optimum/sbert-all-MiniLM-L6-with-pooler&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;I love burritos!&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pred = onnx_extractor(text)`}}),{c(){n=r("p"),$=m("Example using "),c=r("code"),u=m("transformers.pipelines"),_=m("(only if the task is supported):"),s=h(),v(l.$$.fragment)},l(d){n=a(d,"P",{});var w=i(n);$=p(w,"Example using "),c=a(w,"CODE",{});var E=i(c);u=p(E,"transformers.pipelines"),E.forEach(o),_=p(w,"(only if the task is supported):"),w.forEach(o),s=f(d),T(l.$$.fragment,d)},m(d,w){k(d,n,w),e(n,$),e(n,c),e(c,u),e(n,_),k(d,s,w),b(l,d,w),x=!0},p:C,i(d){x||(M(l.$$.fragment,d),x=!0)},o(d){O(l.$$.fragment,d),x=!1},d(d){d&&o(n),d&&o(s),q(l,d)}}}function od(y){let n,$,c,u,_,s,l,x,d,w,E,$r,bo,kr,wr,xs,we,De,So,jt,xr,Po,vr,vs,X,Tr,No,br,Mr,Io,Or,qr,Lo,jr,yr,Do,Er,Rr,Ts,yt,bs,se,Fr,Ho,zr,Cr,Xo,Ar,Sr,Ms,Et,Os,xe,He,Qo,Rt,Pr,Wo,Nr,qs,ee,Ir,Mo,Lr,Dr,Ft,Hr,Xr,Bo,Qr,Wr,js,zt,ys,ve,Xe,Vo,Ct,Br,Go,Vr,Es,re,Gr,Jo,Jr,Ur,Uo,Kr,Yr,Rs,At,Fs,Te,Qe,Ko,St,Zr,Yo,ea,zs,K,Pt,ta,Nt,oa,Zo,na,sa,ra,We,It,aa,Lt,ia,en,la,ma,pa,Be,Dt,da,tn,ca,Cs,be,Ve,on,Ht,ua,nn,ha,As,S,Xt,fa,sn,ga,_a,Qt,$a,rn,ka,wa,xa,an,va,Ta,Q,Wt,ba,Me,Ma,ln,Oa,qa,mn,ja,ya,Ea,Ge,Ra,Je,Fa,Ue,Ss,Oe,Ke,pn,Bt,za,dn,Ca,Ps,P,Vt,Aa,cn,Sa,Pa,Gt,Na,un,Ia,La,Da,hn,Ha,Xa,W,Jt,Qa,qe,Wa,fn,Ba,Va,gn,Ga,Ja,Ua,Ye,Ka,Ze,Ya,et,Ns,je,tt,_n,Ut,Za,$n,ei,Is,N,Kt,ti,kn,oi,ni,Yt,si,wn,ri,ai,ii,xn,li,mi,A,Zt,pi,ye,di,vn,ci,ui,Tn,hi,fi,gi,ot,_i,nt,$i,st,ki,rt,Ls,Ee,at,bn,eo,wi,Mn,xi,Ds,I,to,vi,On,Ti,bi,oo,Mi,qn,Oi,qi,ji,jn,yi,Ei,B,no,Ri,Re,Fi,yn,zi,Ci,En,Ai,Si,Pi,it,Ni,lt,Ii,mt,Hs,Fe,pt,Rn,so,Li,Fn,Di,Xs,L,ro,Hi,zn,Xi,Qi,ao,Wi,Cn,Bi,Vi,Gi,An,Ji,Ui,V,io,Ki,ze,Yi,Sn,Zi,el,Pn,tl,ol,nl,dt,sl,ct,rl,ut,Qs,Ce,ht,Nn,lo,al,In,il,Ws,oe,mo,ll,Ln,ml,pl,G,po,dl,Ae,cl,Dn,ul,hl,Hn,fl,gl,_l,ft,$l,gt,kl,_t,Bs,Se,$t,Xn,co,wl,Qn,xl,Vs,D,uo,vl,Wn,Tl,bl,ho,Ml,Bn,Ol,ql,jl,Vn,yl,El,J,fo,Rl,Pe,Fl,Gn,zl,Cl,Jn,Al,Sl,Pl,kt,Nl,wt,Il,xt,Gs,Ne,vt,Un,go,Ll,Kn,Dl,Js,H,_o,Hl,Yn,Xl,Ql,$o,Wl,Zn,Bl,Vl,Gl,es,Jl,Ul,U,ko,Kl,Ie,Yl,ts,Zl,em,os,tm,om,nm,Tt,sm,bt,rm,Mt,Us;return s=new Z({}),jt=new Z({}),yt=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)`}}),Et=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>}]`}}),Rt=new Z({}),zt=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>)`}}),Ct=new Z({}),At=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>}]`}}),St=new Z({}),Pt=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_360/src/optimum/onnxruntime/modeling_ort.py#L106"}}),It=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_360/src/optimum/onnxruntime/modeling_ort.py#L150"}}),Dt=new F({props:{name:"to",anchor:"optimum.onnxruntime.ORTModel.to",parameters:[{name:"device",val:""}],source:"https://github.com/huggingface/optimum/blob/vr_360/src/optimum/onnxruntime/modeling_ort.py#L134"}}),Ht=new Z({}),Xt=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 <a href="/docs/optimum/pr_360/en/modeling_base#optimum.modeling_base.OptimizedModel.from_pretrained">from_pretrained()</a> 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_360/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_360/src/optimum/onnxruntime/modeling_ort.py#L351"}}),Wt=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_360/src/optimum/onnxruntime/modeling_ort.py#L365"}}),Ge=new qt({props:{$$slots:{default:[Rp]},$$scope:{ctx:y}}}),Je=new z({props:{anchor:"optimum.onnxruntime.ORTModelForFeatureExtraction.forward.example",$$slots:{default:[Fp]},$$scope:{ctx:y}}}),Ue=new z({props:{anchor:"optimum.onnxruntime.ORTModelForFeatureExtraction.forward.example-2",$$slots:{default:[zp]},$$scope:{ctx:y}}}),Bt=new Z({}),Vt=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 <a href="/docs/optimum/pr_360/en/modeling_base#optimum.modeling_base.OptimizedModel.from_pretrained">from_pretrained()</a> 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_360/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_360/src/optimum/onnxruntime/modeling_ort.py#L436"}}),Jt=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_360/src/optimum/onnxruntime/modeling_ort.py#L450"}}),Ye=new qt({props:{$$slots:{default:[Cp]},$$scope:{ctx:y}}}),Ze=new z({props:{anchor:"optimum.onnxruntime.ORTModelForQuestionAnswering.forward.example",$$slots:{default:[Ap]},$$scope:{ctx:y}}}),et=new z({props:{anchor:"optimum.onnxruntime.ORTModelForQuestionAnswering.forward.example-2",$$slots:{default:[Sp]},$$scope:{ctx:y}}}),Ut=new Z({}),Kt=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 <a href="/docs/optimum/pr_360/en/modeling_base#optimum.modeling_base.OptimizedModel.from_pretrained">from_pretrained()</a> 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_360/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_360/src/optimum/onnxruntime/modeling_ort.py#L536"}}),Zt=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_360/src/optimum/onnxruntime/modeling_ort.py#L551"}}),ot=new qt({props:{$$slots:{default:[Pp]},$$scope:{ctx:y}}}),nt=new z({props:{anchor:"optimum.onnxruntime.ORTModelForSequenceClassification.forward.example",$$slots:{default:[Np]},$$scope:{ctx:y}}}),st=new z({props:{anchor:"optimum.onnxruntime.ORTModelForSequenceClassification.forward.example-2",$$slots:{default:[Ip]},$$scope:{ctx:y}}}),rt=new z({props:{anchor:"optimum.onnxruntime.ORTModelForSequenceClassification.forward.example-3",$$slots:{default:[Lp]},$$scope:{ctx:y}}}),eo=new Z({}),to=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 <a href="/docs/optimum/pr_360/en/modeling_base#optimum.modeling_base.OptimizedModel.from_pretrained">from_pretrained()</a> 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_360/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_360/src/optimum/onnxruntime/modeling_ort.py#L622"}}),no=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_360/src/optimum/onnxruntime/modeling_ort.py#L636"}}),it=new qt({props:{$$slots:{default:[Dp]},$$scope:{ctx:y}}}),lt=new z({props:{anchor:"optimum.onnxruntime.ORTModelForTokenClassification.forward.example",$$slots:{default:[Hp]},$$scope:{ctx:y}}}),mt=new z({props:{anchor:"optimum.onnxruntime.ORTModelForTokenClassification.forward.example-2",$$slots:{default:[Xp]},$$scope:{ctx:y}}}),so=new Z({}),ro=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 <a href="/docs/optimum/pr_360/en/modeling_base#optimum.modeling_base.OptimizedModel.from_pretrained">from_pretrained()</a> 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_360/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_360/src/optimum/onnxruntime/modeling_ort.py#L785"}}),io=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_360/src/optimum/onnxruntime/modeling_ort.py#L809"}}),dt=new qt({props:{$$slots:{default:[Qp]},$$scope:{ctx:y}}}),ct=new z({props:{anchor:"optimum.onnxruntime.ORTModelForCausalLM.forward.example",$$slots:{default:[Wp]},$$scope:{ctx:y}}}),ut=new z({props:{anchor:"optimum.onnxruntime.ORTModelForCausalLM.forward.example-2",$$slots:{default:[Bp]},$$scope:{ctx:y}}}),lo=new Z({}),mo=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_360/src/optimum/onnxruntime/modeling_seq2seq.py#L567"}}),po=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_360/src/optimum/onnxruntime/modeling_seq2seq.py#L576"}}),ft=new qt({props:{$$slots:{default:[Vp]},$$scope:{ctx:y}}}),gt=new z({props:{anchor:"optimum.onnxruntime.ORTModelForSeq2SeqLM.forward.example",$$slots:{default:[Gp]},$$scope:{ctx:y}}}),_t=new z({props:{anchor:"optimum.onnxruntime.ORTModelForSeq2SeqLM.forward.example-2",$$slots:{default:[Jp]},$$scope:{ctx:y}}}),co=new Z({}),uo=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 <a href="/docs/optimum/pr_360/en/modeling_base#optimum.modeling_base.OptimizedModel.from_pretrained">from_pretrained()</a> 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_360/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_360/src/optimum/onnxruntime/modeling_ort.py#L903"}}),fo=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.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values corresponding to the images in the current batch.
Pixel values can be obtained from encoded images using <a href="https://huggingface.co/docs/transformers/autoclass_tutorial#autofeatureextractor" rel="nofollow"><code>AutoFeatureExtractor</code></a>.`,name:"pixel_values"}],source:"https://github.com/huggingface/optimum/blob/vr_360/src/optimum/onnxruntime/modeling_ort.py#L917"}}),kt=new qt({props:{$$slots:{default:[Up]},$$scope:{ctx:y}}}),wt=new z({props:{anchor:"optimum.onnxruntime.ORTModelForImageClassification.forward.example",$$slots:{default:[Kp]},$$scope:{ctx:y}}}),xt=new z({props:{anchor:"optimum.onnxruntime.ORTModelForImageClassification.forward.example-2",$$slots:{default:[Yp]},$$scope:{ctx:y}}}),go=new Z({}),_o=new F({props:{name:"class optimum.onnxruntime.ORTModelForCustomTasks",anchor:"optimum.onnxruntime.ORTModelForCustomTasks",parameters:[{name:"model",val:" = None"},{name:"config",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"optimum.onnxruntime.ORTModelForCustomTasks.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 <a href="/docs/optimum/pr_360/en/modeling_base#optimum.modeling_base.OptimizedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"optimum.onnxruntime.ORTModelForCustomTasks.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_360/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_360/src/optimum/onnxruntime/modeling_ort.py#L981"}}),ko=new F({props:{name:"forward",anchor:"optimum.onnxruntime.ORTModelForCustomTasks.forward",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/optimum/blob/vr_360/src/optimum/onnxruntime/modeling_ort.py#L991"}}),Tt=new qt({props:{$$slots:{default:[Zp]},$$scope:{ctx:y}}}),bt=new z({props:{anchor:"optimum.onnxruntime.ORTModelForCustomTasks.forward.example",$$slots:{default:[ed]},$$scope:{ctx:y}}}),Mt=new z({props:{anchor:"optimum.onnxruntime.ORTModelForCustomTasks.forward.example-2",$$slots:{default:[td]},$$scope:{ctx:y}}}),{c(){n=r("meta"),$=h(),c=r("h1"),u=r("a"),_=r("span"),v(s.$$.fragment),l=h(),x=r("span"),d=m("Optimum Inference with ONNX Runtime"),w=h(),E=r("p"),$r=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 `),bo=r("a"),kr=m("Hugging Face Hub"),wr=m(` and create pipelines
to run accelerated inference without rewriting your APIs.`),xs=h(),we=r("h2"),De=r("a"),So=r("span"),v(jt.$$.fragment),xr=h(),Po=r("span"),vr=m("Switching from Transformers to Optimum Inference"),vs=h(),X=r("p"),Tr=m("The Optimum Inference models are API compatible with Hugging Face Transformers models. This means you can just replace your "),No=r("code"),br=m("AutoModelForXxx"),Mr=m(" class with the corresponding "),Io=r("code"),Or=m("ORTModelForXxx"),qr=m(" class in "),Lo=r("code"),jr=m("optimum"),yr=m(". For example, this is how you can use a question answering model in "),Do=r("code"),Er=m("optimum"),Rr=m(":"),Ts=h(),v(yt.$$.fragment),bs=h(),se=r("p"),Fr=m("Optimum Inference also includes methods to convert vanilla Transformers models to optimized ones. Simply pass "),Ho=r("code"),zr=m("from_transformers=True"),Cr=m(" to the "),Xo=r("code"),Ar=m("from_pretrained()"),Sr=m(" method, and your model will be loaded and converted to ONNX on-the-fly:"),Ms=h(),v(Et.$$.fragment),Os=h(),xe=r("h3"),He=r("a"),Qo=r("span"),v(Rt.$$.fragment),Pr=h(),Wo=r("span"),Nr=m("Working with the Hugging Face Model Hub"),qs=h(),ee=r("p"),Ir=m("The Optimum model classes like "),Mo=r("a"),Lr=m("ORTModelForSequenceClassification"),Dr=m(" are integrated with the "),Ft=r("a"),Hr=m("Hugging Face Model Hub"),Xr=m(`, which means you can not only
load model from the Hub, but also push your models to the Hub with `),Bo=r("code"),Qr=m("push_to_hub()"),Wr=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.`),js=h(),v(zt.$$.fragment),ys=h(),ve=r("h2"),Xe=r("a"),Vo=r("span"),v(Ct.$$.fragment),Br=h(),Go=r("span"),Vr=m("Export and inference of sequence-to-sequence models"),Es=h(),re=r("p"),Gr=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 two parts : the encoder and the \u201Cdecoder\u201D (which actually consists of the decoder with the language modeling head), that are later combined during inference.
To leverage the pre-computed key/values hidden-states to speed up sequential decoding, simply pass `),Jo=r("code"),Jr=m("use_cache=True"),Ur=m(" to the "),Uo=r("code"),Kr=m("from_pretrained()"),Yr=m(` method. An additional model component will be exported: the \u201Cdecoder\u201D with pre-computed key/values as one of its 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:`),Rs=h(),v(At.$$.fragment),Fs=h(),Te=r("h2"),Qe=r("a"),Ko=r("span"),v(St.$$.fragment),Zr=h(),Yo=r("span"),ea=m("ORTModel"),zs=h(),K=r("div"),v(Pt.$$.fragment),ta=h(),Nt=r("p"),oa=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 `),Zo=r("code"),na=m("transformers.onnx"),sa=m(` toolchain.
The ORTModel implements additionally generic methods for optimizing and quantizing Onnx models.`),ra=h(),We=r("div"),v(It.$$.fragment),aa=h(),Lt=r("p"),ia=m("Loads an ONNX Inference session with a given provider. Default provider is "),en=r("code"),la=m("CPUExecutionProvider"),ma=m(" to match the default behaviour in PyTorch/TensorFlow/JAX."),pa=h(),Be=r("div"),v(Dt.$$.fragment),da=h(),tn=r("p"),ca=m("Changes the ONNX Runtime provider according to the device."),Cs=h(),be=r("h2"),Ve=r("a"),on=r("span"),v(Ht.$$.fragment),ua=h(),nn=r("span"),ha=m("ORTModelForFeatureExtraction"),As=h(),S=r("div"),v(Xt.$$.fragment),fa=h(),sn=r("p"),ga=m("Onnx Model with a MaskedLMOutput for feature-extraction tasks."),_a=h(),Qt=r("p"),$a=m("This model inherits from [~"),rn=r("code"),ka=m("onnxruntime.modeling_ort.ORTModel"),wa=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),xa=h(),an=r("p"),va=m("Feature Extraction model for ONNX."),Ta=h(),Q=r("div"),v(Wt.$$.fragment),ba=h(),Me=r("p"),Ma=m("The "),ln=r("code"),Oa=m("ORTModelForFeatureExtraction"),qa=m(" forward method, overrides the "),mn=r("code"),ja=m("__call__"),ya=m(" special method."),Ea=h(),v(Ge.$$.fragment),Ra=h(),v(Je.$$.fragment),Fa=h(),v(Ue.$$.fragment),Ss=h(),Oe=r("h2"),Ke=r("a"),pn=r("span"),v(Bt.$$.fragment),za=h(),dn=r("span"),Ca=m("ORTModelForQuestionAnswering"),Ps=h(),P=r("div"),v(Vt.$$.fragment),Aa=h(),cn=r("p"),Sa=m("Onnx Model with a QuestionAnsweringModelOutput for extractive question-answering tasks like SQuAD."),Pa=h(),Gt=r("p"),Na=m("This model inherits from [~"),un=r("code"),Ia=m("onnxruntime.modeling_ort.ORTModel"),La=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),Da=h(),hn=r("p"),Ha=m("Question Answering model for ONNX."),Xa=h(),W=r("div"),v(Jt.$$.fragment),Qa=h(),qe=r("p"),Wa=m("The "),fn=r("code"),Ba=m("ORTModelForQuestionAnswering"),Va=m(" forward method, overrides the "),gn=r("code"),Ga=m("__call__"),Ja=m(" special method."),Ua=h(),v(Ye.$$.fragment),Ka=h(),v(Ze.$$.fragment),Ya=h(),v(et.$$.fragment),Ns=h(),je=r("h2"),tt=r("a"),_n=r("span"),v(Ut.$$.fragment),Za=h(),$n=r("span"),ei=m("ORTModelForSequenceClassification"),Is=h(),N=r("div"),v(Kt.$$.fragment),ti=h(),kn=r("p"),oi=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.`),ni=h(),Yt=r("p"),si=m("This model inherits from [~"),wn=r("code"),ri=m("onnxruntime.modeling_ort.ORTModel"),ai=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),ii=h(),xn=r("p"),li=m("Sequence Classification model for ONNX."),mi=h(),A=r("div"),v(Zt.$$.fragment),pi=h(),ye=r("p"),di=m("The "),vn=r("code"),ci=m("ORTModelForSequenceClassification"),ui=m(" forward method, overrides the "),Tn=r("code"),hi=m("__call__"),fi=m(" special method."),gi=h(),v(ot.$$.fragment),_i=h(),v(nt.$$.fragment),$i=h(),v(st.$$.fragment),ki=h(),v(rt.$$.fragment),Ls=h(),Ee=r("h2"),at=r("a"),bn=r("span"),v(eo.$$.fragment),wi=h(),Mn=r("span"),xi=m("ORTModelForTokenClassification"),Ds=h(),I=r("div"),v(to.$$.fragment),vi=h(),On=r("p"),Ti=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.`),bi=h(),oo=r("p"),Mi=m("This model inherits from [~"),qn=r("code"),Oi=m("onnxruntime.modeling_ort.ORTModel"),qi=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),ji=h(),jn=r("p"),yi=m("Token Classification model for ONNX."),Ei=h(),B=r("div"),v(no.$$.fragment),Ri=h(),Re=r("p"),Fi=m("The "),yn=r("code"),zi=m("ORTModelForTokenClassification"),Ci=m(" forward method, overrides the "),En=r("code"),Ai=m("__call__"),Si=m(" special method."),Pi=h(),v(it.$$.fragment),Ni=h(),v(lt.$$.fragment),Ii=h(),v(mt.$$.fragment),Hs=h(),Fe=r("h2"),pt=r("a"),Rn=r("span"),v(so.$$.fragment),Li=h(),Fn=r("span"),Di=m("ORTModelForCausalLM"),Xs=h(),L=r("div"),v(ro.$$.fragment),Hi=h(),zn=r("p"),Xi=m(`Onnx Model with a causal language modeling head on top (linear layer with weights tied to the input
embeddings).`),Qi=h(),ao=r("p"),Wi=m("This model inherits from [~"),Cn=r("code"),Bi=m("onnxruntime.modeling_ort.ORTModel"),Vi=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),Gi=h(),An=r("p"),Ji=m("Causal LM model for ONNX."),Ui=h(),V=r("div"),v(io.$$.fragment),Ki=h(),ze=r("p"),Yi=m("The "),Sn=r("code"),Zi=m("ORTModelForCausalLM"),el=m(" forward method, overrides the "),Pn=r("code"),tl=m("__call__"),ol=m(" special method."),nl=h(),v(dt.$$.fragment),sl=h(),v(ct.$$.fragment),rl=h(),v(ut.$$.fragment),Qs=h(),Ce=r("h2"),ht=r("a"),Nn=r("span"),v(lo.$$.fragment),al=h(),In=r("span"),il=m("ORTModelForSeq2SeqLM"),Ws=h(),oe=r("div"),v(mo.$$.fragment),ll=h(),Ln=r("p"),ml=m("Sequence-to-sequence model with a language modeling head for ONNX Runtime inference."),pl=h(),G=r("div"),v(po.$$.fragment),dl=h(),Ae=r("p"),cl=m("The "),Dn=r("code"),ul=m("ORTModelForSeq2SeqLM"),hl=m(" forward method, overrides the "),Hn=r("code"),fl=m("__call__"),gl=m(" special method."),_l=h(),v(ft.$$.fragment),$l=h(),v(gt.$$.fragment),kl=h(),v(_t.$$.fragment),Bs=h(),Se=r("h2"),$t=r("a"),Xn=r("span"),v(co.$$.fragment),wl=h(),Qn=r("span"),xl=m("ORTModelForImageClassification"),Vs=h(),D=r("div"),v(uo.$$.fragment),vl=h(),Wn=r("p"),Tl=m("Onnx Model for image-classification tasks."),bl=h(),ho=r("p"),Ml=m("This model inherits from [~"),Bn=r("code"),Ol=m("onnxruntime.modeling_ort.ORTModel"),ql=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),jl=h(),Vn=r("p"),yl=m("Image Classification model for ONNX."),El=h(),J=r("div"),v(fo.$$.fragment),Rl=h(),Pe=r("p"),Fl=m("The "),Gn=r("code"),zl=m("ORTModelForImageClassification"),Cl=m(" forward method, overrides the "),Jn=r("code"),Al=m("__call__"),Sl=m(" special method."),Pl=h(),v(kt.$$.fragment),Nl=h(),v(wt.$$.fragment),Il=h(),v(xt.$$.fragment),Gs=h(),Ne=r("h2"),vt=r("a"),Un=r("span"),v(go.$$.fragment),Ll=h(),Kn=r("span"),Dl=m("ORTModelForCustomTasks"),Js=h(),H=r("div"),v(_o.$$.fragment),Hl=h(),Yn=r("p"),Xl=m("Onnx Model for any custom tasks. It can be used to leverage the inference acceleration with any custom exported ONNX model."),Ql=h(),$o=r("p"),Wl=m("This model inherits from [~"),Zn=r("code"),Bl=m("onnxruntime.modeling_ort.ORTModel"),Vl=m(`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),Gl=h(),es=r("p"),Jl=m("Onnx Model for any custom tasks."),Ul=h(),U=r("div"),v(ko.$$.fragment),Kl=h(),Ie=r("p"),Yl=m("The "),ts=r("code"),Zl=m("ORTModelForCustomTasks"),em=m(" forward method, overrides the "),os=r("code"),tm=m("__call__"),om=m(" special method."),nm=h(),v(Tt.$$.fragment),sm=h(),v(bt.$$.fragment),rm=h(),v(Mt.$$.fragment),this.h()},l(t){const g=yp('[data-svelte="svelte-1phssyn"]',document.head);n=a(g,"META",{name:!0,content:!0}),g.forEach(o),$=f(t),c=a(t,"H1",{class:!0});var wo=i(c);u=a(wo,"A",{id:!0,class:!0,href:!0});var ns=i(u);_=a(ns,"SPAN",{});var ss=i(_);T(s.$$.fragment,ss),ss.forEach(o),ns.forEach(o),l=f(wo),x=a(wo,"SPAN",{});var rs=i(x);d=p(rs,"Optimum Inference with ONNX Runtime"),rs.forEach(o),wo.forEach(o),w=f(t),E=a(t,"P",{});var xo=i(E);$r=p(xo,`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 `),bo=a(xo,"A",{href:!0});var as=i(bo);kr=p(as,"Hugging Face Hub"),as.forEach(o),wr=p(xo,` and create pipelines
to run accelerated inference without rewriting your APIs.`),xo.forEach(o),xs=f(t),we=a(t,"H2",{class:!0});var vo=i(we);De=a(vo,"A",{id:!0,class:!0,href:!0});var is=i(De);So=a(is,"SPAN",{});var ls=i(So);T(jt.$$.fragment,ls),ls.forEach(o),is.forEach(o),xr=f(vo),Po=a(vo,"SPAN",{});var ms=i(Po);vr=p(ms,"Switching from Transformers to Optimum Inference"),ms.forEach(o),vo.forEach(o),vs=f(t),X=a(t,"P",{});var Y=i(X);Tr=p(Y,"The Optimum Inference models are API compatible with Hugging Face Transformers models. This means you can just replace your "),No=a(Y,"CODE",{});var ps=i(No);br=p(ps,"AutoModelForXxx"),ps.forEach(o),Mr=p(Y," class with the corresponding "),Io=a(Y,"CODE",{});var ds=i(Io);Or=p(ds,"ORTModelForXxx"),ds.forEach(o),qr=p(Y," class in "),Lo=a(Y,"CODE",{});var cs=i(Lo);jr=p(cs,"optimum"),cs.forEach(o),yr=p(Y,". For example, this is how you can use a question answering model in "),Do=a(Y,"CODE",{});var us=i(Do);Er=p(us,"optimum"),us.forEach(o),Rr=p(Y,":"),Y.forEach(o),Ts=f(t),T(yt.$$.fragment,t),bs=f(t),se=a(t,"P",{});var Le=i(se);Fr=p(Le,"Optimum Inference also includes methods to convert vanilla Transformers models to optimized ones. Simply pass "),Ho=a(Le,"CODE",{});var hs=i(Ho);zr=p(hs,"from_transformers=True"),hs.forEach(o),Cr=p(Le," to the "),Xo=a(Le,"CODE",{});var fs=i(Xo);Ar=p(fs,"from_pretrained()"),fs.forEach(o),Sr=p(Le," method, and your model will be loaded and converted to ONNX on-the-fly:"),Le.forEach(o),Ms=f(t),T(Et.$$.fragment,t),Os=f(t),xe=a(t,"H3",{class:!0});var To=i(xe);He=a(To,"A",{id:!0,class:!0,href:!0});var gs=i(He);Qo=a(gs,"SPAN",{});var _s=i(Qo);T(Rt.$$.fragment,_s),_s.forEach(o),gs.forEach(o),Pr=f(To),Wo=a(To,"SPAN",{});var $s=i(Wo);Nr=p($s,"Working with the Hugging Face Model Hub"),$s.forEach(o),To.forEach(o),qs=f(t),ee=a(t,"P",{});var ne=i(ee);Ir=p(ne,"The Optimum model classes like "),Mo=a(ne,"A",{href:!0});var ks=i(Mo);Lr=p(ks,"ORTModelForSequenceClassification"),ks.forEach(o),Dr=p(ne," are integrated with the "),Ft=a(ne,"A",{href:!0,rel:!0});var ws=i(Ft);Hr=p(ws,"Hugging Face Model Hub"),ws.forEach(o),Xr=p(ne,`, which means you can not only
load model from the Hub, but also push your models to the Hub with `),Bo=a(ne,"CODE",{});var am=i(Bo);Qr=p(am,"push_to_hub()"),am.forEach(o),Wr=p(ne,` 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.`),ne.forEach(o),js=f(t),T(zt.$$.fragment,t),ys=f(t),ve=a(t,"H2",{class:!0});var Ks=i(ve);Xe=a(Ks,"A",{id:!0,class:!0,href:!0});var im=i(Xe);Vo=a(im,"SPAN",{});var lm=i(Vo);T(Ct.$$.fragment,lm),lm.forEach(o),im.forEach(o),Br=f(Ks),Go=a(Ks,"SPAN",{});var mm=i(Go);Vr=p(mm,"Export and inference of sequence-to-sequence models"),mm.forEach(o),Ks.forEach(o),Es=f(t),re=a(t,"P",{});var Oo=i(re);Gr=p(Oo,`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 two parts : the encoder and the \u201Cdecoder\u201D (which actually consists of the decoder with the language modeling head), that are later combined during inference.
To leverage the pre-computed key/values hidden-states to speed up sequential decoding, simply pass `),Jo=a(Oo,"CODE",{});var pm=i(Jo);Jr=p(pm,"use_cache=True"),pm.forEach(o),Ur=p(Oo," to the "),Uo=a(Oo,"CODE",{});var dm=i(Uo);Kr=p(dm,"from_pretrained()"),dm.forEach(o),Yr=p(Oo,` method. An additional model component will be exported: the \u201Cdecoder\u201D with pre-computed key/values as one of its 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:`),Oo.forEach(o),Rs=f(t),T(At.$$.fragment,t),Fs=f(t),Te=a(t,"H2",{class:!0});var Ys=i(Te);Qe=a(Ys,"A",{id:!0,class:!0,href:!0});var cm=i(Qe);Ko=a(cm,"SPAN",{});var um=i(Ko);T(St.$$.fragment,um),um.forEach(o),cm.forEach(o),Zr=f(Ys),Yo=a(Ys,"SPAN",{});var hm=i(Yo);ea=p(hm,"ORTModel"),hm.forEach(o),Ys.forEach(o),zs=f(t),K=a(t,"DIV",{class:!0});var Ot=i(K);T(Pt.$$.fragment,Ot),ta=f(Ot),Nt=a(Ot,"P",{});var Zs=i(Nt);oa=p(Zs,`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 `),Zo=a(Zs,"CODE",{});var fm=i(Zo);na=p(fm,"transformers.onnx"),fm.forEach(o),sa=p(Zs,` toolchain.
The ORTModel implements additionally generic methods for optimizing and quantizing Onnx models.`),Zs.forEach(o),ra=f(Ot),We=a(Ot,"DIV",{class:!0});var er=i(We);T(It.$$.fragment,er),aa=f(er),Lt=a(er,"P",{});var tr=i(Lt);ia=p(tr,"Loads an ONNX Inference session with a given provider. Default provider is "),en=a(tr,"CODE",{});var gm=i(en);la=p(gm,"CPUExecutionProvider"),gm.forEach(o),ma=p(tr," to match the default behaviour in PyTorch/TensorFlow/JAX."),tr.forEach(o),er.forEach(o),pa=f(Ot),Be=a(Ot,"DIV",{class:!0});var or=i(Be);T(Dt.$$.fragment,or),da=f(or),tn=a(or,"P",{});var _m=i(tn);ca=p(_m,"Changes the ONNX Runtime provider according to the device."),_m.forEach(o),or.forEach(o),Ot.forEach(o),Cs=f(t),be=a(t,"H2",{class:!0});var nr=i(be);Ve=a(nr,"A",{id:!0,class:!0,href:!0});var $m=i(Ve);on=a($m,"SPAN",{});var km=i(on);T(Ht.$$.fragment,km),km.forEach(o),$m.forEach(o),ua=f(nr),nn=a(nr,"SPAN",{});var wm=i(nn);ha=p(wm,"ORTModelForFeatureExtraction"),wm.forEach(o),nr.forEach(o),As=f(t),S=a(t,"DIV",{class:!0});var ae=i(S);T(Xt.$$.fragment,ae),fa=f(ae),sn=a(ae,"P",{});var xm=i(sn);ga=p(xm,"Onnx Model with a MaskedLMOutput for feature-extraction tasks."),xm.forEach(o),_a=f(ae),Qt=a(ae,"P",{});var sr=i(Qt);$a=p(sr,"This model inherits from [~"),rn=a(sr,"CODE",{});var vm=i(rn);ka=p(vm,"onnxruntime.modeling_ort.ORTModel"),vm.forEach(o),wa=p(sr,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),sr.forEach(o),xa=f(ae),an=a(ae,"P",{});var Tm=i(an);va=p(Tm,"Feature Extraction model for ONNX."),Tm.forEach(o),Ta=f(ae),Q=a(ae,"DIV",{class:!0});var ie=i(Q);T(Wt.$$.fragment,ie),ba=f(ie),Me=a(ie,"P",{});var qo=i(Me);Ma=p(qo,"The "),ln=a(qo,"CODE",{});var bm=i(ln);Oa=p(bm,"ORTModelForFeatureExtraction"),bm.forEach(o),qa=p(qo," forward method, overrides the "),mn=a(qo,"CODE",{});var Mm=i(mn);ja=p(Mm,"__call__"),Mm.forEach(o),ya=p(qo," special method."),qo.forEach(o),Ea=f(ie),T(Ge.$$.fragment,ie),Ra=f(ie),T(Je.$$.fragment,ie),Fa=f(ie),T(Ue.$$.fragment,ie),ie.forEach(o),ae.forEach(o),Ss=f(t),Oe=a(t,"H2",{class:!0});var rr=i(Oe);Ke=a(rr,"A",{id:!0,class:!0,href:!0});var Om=i(Ke);pn=a(Om,"SPAN",{});var qm=i(pn);T(Bt.$$.fragment,qm),qm.forEach(o),Om.forEach(o),za=f(rr),dn=a(rr,"SPAN",{});var jm=i(dn);Ca=p(jm,"ORTModelForQuestionAnswering"),jm.forEach(o),rr.forEach(o),Ps=f(t),P=a(t,"DIV",{class:!0});var le=i(P);T(Vt.$$.fragment,le),Aa=f(le),cn=a(le,"P",{});var ym=i(cn);Sa=p(ym,"Onnx Model with a QuestionAnsweringModelOutput for extractive question-answering tasks like SQuAD."),ym.forEach(o),Pa=f(le),Gt=a(le,"P",{});var ar=i(Gt);Na=p(ar,"This model inherits from [~"),un=a(ar,"CODE",{});var Em=i(un);Ia=p(Em,"onnxruntime.modeling_ort.ORTModel"),Em.forEach(o),La=p(ar,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),ar.forEach(o),Da=f(le),hn=a(le,"P",{});var Rm=i(hn);Ha=p(Rm,"Question Answering model for ONNX."),Rm.forEach(o),Xa=f(le),W=a(le,"DIV",{class:!0});var me=i(W);T(Jt.$$.fragment,me),Qa=f(me),qe=a(me,"P",{});var jo=i(qe);Wa=p(jo,"The "),fn=a(jo,"CODE",{});var Fm=i(fn);Ba=p(Fm,"ORTModelForQuestionAnswering"),Fm.forEach(o),Va=p(jo," forward method, overrides the "),gn=a(jo,"CODE",{});var zm=i(gn);Ga=p(zm,"__call__"),zm.forEach(o),Ja=p(jo," special method."),jo.forEach(o),Ua=f(me),T(Ye.$$.fragment,me),Ka=f(me),T(Ze.$$.fragment,me),Ya=f(me),T(et.$$.fragment,me),me.forEach(o),le.forEach(o),Ns=f(t),je=a(t,"H2",{class:!0});var ir=i(je);tt=a(ir,"A",{id:!0,class:!0,href:!0});var Cm=i(tt);_n=a(Cm,"SPAN",{});var Am=i(_n);T(Ut.$$.fragment,Am),Am.forEach(o),Cm.forEach(o),Za=f(ir),$n=a(ir,"SPAN",{});var Sm=i($n);ei=p(Sm,"ORTModelForSequenceClassification"),Sm.forEach(o),ir.forEach(o),Is=f(t),N=a(t,"DIV",{class:!0});var pe=i(N);T(Kt.$$.fragment,pe),ti=f(pe),kn=a(pe,"P",{});var Pm=i(kn);oi=p(Pm,`Onnx Model with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.`),Pm.forEach(o),ni=f(pe),Yt=a(pe,"P",{});var lr=i(Yt);si=p(lr,"This model inherits from [~"),wn=a(lr,"CODE",{});var Nm=i(wn);ri=p(Nm,"onnxruntime.modeling_ort.ORTModel"),Nm.forEach(o),ai=p(lr,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),lr.forEach(o),ii=f(pe),xn=a(pe,"P",{});var Im=i(xn);li=p(Im,"Sequence Classification model for ONNX."),Im.forEach(o),mi=f(pe),A=a(pe,"DIV",{class:!0});var te=i(A);T(Zt.$$.fragment,te),pi=f(te),ye=a(te,"P",{});var yo=i(ye);di=p(yo,"The "),vn=a(yo,"CODE",{});var Lm=i(vn);ci=p(Lm,"ORTModelForSequenceClassification"),Lm.forEach(o),ui=p(yo," forward method, overrides the "),Tn=a(yo,"CODE",{});var Dm=i(Tn);hi=p(Dm,"__call__"),Dm.forEach(o),fi=p(yo," special method."),yo.forEach(o),gi=f(te),T(ot.$$.fragment,te),_i=f(te),T(nt.$$.fragment,te),$i=f(te),T(st.$$.fragment,te),ki=f(te),T(rt.$$.fragment,te),te.forEach(o),pe.forEach(o),Ls=f(t),Ee=a(t,"H2",{class:!0});var mr=i(Ee);at=a(mr,"A",{id:!0,class:!0,href:!0});var Hm=i(at);bn=a(Hm,"SPAN",{});var Xm=i(bn);T(eo.$$.fragment,Xm),Xm.forEach(o),Hm.forEach(o),wi=f(mr),Mn=a(mr,"SPAN",{});var Qm=i(Mn);xi=p(Qm,"ORTModelForTokenClassification"),Qm.forEach(o),mr.forEach(o),Ds=f(t),I=a(t,"DIV",{class:!0});var de=i(I);T(to.$$.fragment,de),vi=f(de),On=a(de,"P",{});var Wm=i(On);Ti=p(Wm,`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.`),Wm.forEach(o),bi=f(de),oo=a(de,"P",{});var pr=i(oo);Mi=p(pr,"This model inherits from [~"),qn=a(pr,"CODE",{});var Bm=i(qn);Oi=p(Bm,"onnxruntime.modeling_ort.ORTModel"),Bm.forEach(o),qi=p(pr,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),pr.forEach(o),ji=f(de),jn=a(de,"P",{});var Vm=i(jn);yi=p(Vm,"Token Classification model for ONNX."),Vm.forEach(o),Ei=f(de),B=a(de,"DIV",{class:!0});var ce=i(B);T(no.$$.fragment,ce),Ri=f(ce),Re=a(ce,"P",{});var Eo=i(Re);Fi=p(Eo,"The "),yn=a(Eo,"CODE",{});var Gm=i(yn);zi=p(Gm,"ORTModelForTokenClassification"),Gm.forEach(o),Ci=p(Eo," forward method, overrides the "),En=a(Eo,"CODE",{});var Jm=i(En);Ai=p(Jm,"__call__"),Jm.forEach(o),Si=p(Eo," special method."),Eo.forEach(o),Pi=f(ce),T(it.$$.fragment,ce),Ni=f(ce),T(lt.$$.fragment,ce),Ii=f(ce),T(mt.$$.fragment,ce),ce.forEach(o),de.forEach(o),Hs=f(t),Fe=a(t,"H2",{class:!0});var dr=i(Fe);pt=a(dr,"A",{id:!0,class:!0,href:!0});var Um=i(pt);Rn=a(Um,"SPAN",{});var Km=i(Rn);T(so.$$.fragment,Km),Km.forEach(o),Um.forEach(o),Li=f(dr),Fn=a(dr,"SPAN",{});var Ym=i(Fn);Di=p(Ym,"ORTModelForCausalLM"),Ym.forEach(o),dr.forEach(o),Xs=f(t),L=a(t,"DIV",{class:!0});var ue=i(L);T(ro.$$.fragment,ue),Hi=f(ue),zn=a(ue,"P",{});var Zm=i(zn);Xi=p(Zm,`Onnx Model with a causal language modeling head on top (linear layer with weights tied to the input
embeddings).`),Zm.forEach(o),Qi=f(ue),ao=a(ue,"P",{});var cr=i(ao);Wi=p(cr,"This model inherits from [~"),Cn=a(cr,"CODE",{});var ep=i(Cn);Bi=p(ep,"onnxruntime.modeling_ort.ORTModel"),ep.forEach(o),Vi=p(cr,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),cr.forEach(o),Gi=f(ue),An=a(ue,"P",{});var tp=i(An);Ji=p(tp,"Causal LM model for ONNX."),tp.forEach(o),Ui=f(ue),V=a(ue,"DIV",{class:!0});var he=i(V);T(io.$$.fragment,he),Ki=f(he),ze=a(he,"P",{});var Ro=i(ze);Yi=p(Ro,"The "),Sn=a(Ro,"CODE",{});var op=i(Sn);Zi=p(op,"ORTModelForCausalLM"),op.forEach(o),el=p(Ro," forward method, overrides the "),Pn=a(Ro,"CODE",{});var np=i(Pn);tl=p(np,"__call__"),np.forEach(o),ol=p(Ro," special method."),Ro.forEach(o),nl=f(he),T(dt.$$.fragment,he),sl=f(he),T(ct.$$.fragment,he),rl=f(he),T(ut.$$.fragment,he),he.forEach(o),ue.forEach(o),Qs=f(t),Ce=a(t,"H2",{class:!0});var ur=i(Ce);ht=a(ur,"A",{id:!0,class:!0,href:!0});var sp=i(ht);Nn=a(sp,"SPAN",{});var rp=i(Nn);T(lo.$$.fragment,rp),rp.forEach(o),sp.forEach(o),al=f(ur),In=a(ur,"SPAN",{});var ap=i(In);il=p(ap,"ORTModelForSeq2SeqLM"),ap.forEach(o),ur.forEach(o),Ws=f(t),oe=a(t,"DIV",{class:!0});var Fo=i(oe);T(mo.$$.fragment,Fo),ll=f(Fo),Ln=a(Fo,"P",{});var ip=i(Ln);ml=p(ip,"Sequence-to-sequence model with a language modeling head for ONNX Runtime inference."),ip.forEach(o),pl=f(Fo),G=a(Fo,"DIV",{class:!0});var fe=i(G);T(po.$$.fragment,fe),dl=f(fe),Ae=a(fe,"P",{});var zo=i(Ae);cl=p(zo,"The "),Dn=a(zo,"CODE",{});var lp=i(Dn);ul=p(lp,"ORTModelForSeq2SeqLM"),lp.forEach(o),hl=p(zo," forward method, overrides the "),Hn=a(zo,"CODE",{});var mp=i(Hn);fl=p(mp,"__call__"),mp.forEach(o),gl=p(zo," special method."),zo.forEach(o),_l=f(fe),T(ft.$$.fragment,fe),$l=f(fe),T(gt.$$.fragment,fe),kl=f(fe),T(_t.$$.fragment,fe),fe.forEach(o),Fo.forEach(o),Bs=f(t),Se=a(t,"H2",{class:!0});var hr=i(Se);$t=a(hr,"A",{id:!0,class:!0,href:!0});var pp=i($t);Xn=a(pp,"SPAN",{});var dp=i(Xn);T(co.$$.fragment,dp),dp.forEach(o),pp.forEach(o),wl=f(hr),Qn=a(hr,"SPAN",{});var cp=i(Qn);xl=p(cp,"ORTModelForImageClassification"),cp.forEach(o),hr.forEach(o),Vs=f(t),D=a(t,"DIV",{class:!0});var ge=i(D);T(uo.$$.fragment,ge),vl=f(ge),Wn=a(ge,"P",{});var up=i(Wn);Tl=p(up,"Onnx Model for image-classification tasks."),up.forEach(o),bl=f(ge),ho=a(ge,"P",{});var fr=i(ho);Ml=p(fr,"This model inherits from [~"),Bn=a(fr,"CODE",{});var hp=i(Bn);Ol=p(hp,"onnxruntime.modeling_ort.ORTModel"),hp.forEach(o),ql=p(fr,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),fr.forEach(o),jl=f(ge),Vn=a(ge,"P",{});var fp=i(Vn);yl=p(fp,"Image Classification model for ONNX."),fp.forEach(o),El=f(ge),J=a(ge,"DIV",{class:!0});var _e=i(J);T(fo.$$.fragment,_e),Rl=f(_e),Pe=a(_e,"P",{});var Co=i(Pe);Fl=p(Co,"The "),Gn=a(Co,"CODE",{});var gp=i(Gn);zl=p(gp,"ORTModelForImageClassification"),gp.forEach(o),Cl=p(Co," forward method, overrides the "),Jn=a(Co,"CODE",{});var _p=i(Jn);Al=p(_p,"__call__"),_p.forEach(o),Sl=p(Co," special method."),Co.forEach(o),Pl=f(_e),T(kt.$$.fragment,_e),Nl=f(_e),T(wt.$$.fragment,_e),Il=f(_e),T(xt.$$.fragment,_e),_e.forEach(o),ge.forEach(o),Gs=f(t),Ne=a(t,"H2",{class:!0});var gr=i(Ne);vt=a(gr,"A",{id:!0,class:!0,href:!0});var $p=i(vt);Un=a($p,"SPAN",{});var kp=i(Un);T(go.$$.fragment,kp),kp.forEach(o),$p.forEach(o),Ll=f(gr),Kn=a(gr,"SPAN",{});var wp=i(Kn);Dl=p(wp,"ORTModelForCustomTasks"),wp.forEach(o),gr.forEach(o),Js=f(t),H=a(t,"DIV",{class:!0});var $e=i(H);T(_o.$$.fragment,$e),Hl=f($e),Yn=a($e,"P",{});var xp=i(Yn);Xl=p(xp,"Onnx Model for any custom tasks. It can be used to leverage the inference acceleration with any custom exported ONNX model."),xp.forEach(o),Ql=f($e),$o=a($e,"P",{});var _r=i($o);Wl=p(_r,"This model inherits from [~"),Zn=a(_r,"CODE",{});var vp=i(Zn);Bl=p(vp,"onnxruntime.modeling_ort.ORTModel"),vp.forEach(o),Vl=p(_r,`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving)`),_r.forEach(o),Gl=f($e),es=a($e,"P",{});var Tp=i(es);Jl=p(Tp,"Onnx Model for any custom tasks."),Tp.forEach(o),Ul=f($e),U=a($e,"DIV",{class:!0});var ke=i(U);T(ko.$$.fragment,ke),Kl=f(ke),Ie=a(ke,"P",{});var Ao=i(Ie);Yl=p(Ao,"The "),ts=a(Ao,"CODE",{});var bp=i(ts);Zl=p(bp,"ORTModelForCustomTasks"),bp.forEach(o),em=p(Ao," forward method, overrides the "),os=a(Ao,"CODE",{});var Mp=i(os);tm=p(Mp,"__call__"),Mp.forEach(o),om=p(Ao," special method."),Ao.forEach(o),nm=f(ke),T(Tt.$$.fragment,ke),sm=f(ke),T(bt.$$.fragment,ke),rm=f(ke),T(Mt.$$.fragment,ke),ke.forEach(o),$e.forEach(o),this.h()},h(){j(n,"name","hf:doc:metadata"),j(n,"content",JSON.stringify(nd)),j(u,"id","optimum-inference-with-onnx-runtime"),j(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"),j(u,"href","#optimum-inference-with-onnx-runtime"),j(c,"class","relative group"),j(bo,"href","hf.co/models"),j(De,"id","switching-from-transformers-to-optimum-inference"),j(De,"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"),j(De,"href","#switching-from-transformers-to-optimum-inference"),j(we,"class","relative group"),j(He,"id","working-with-the-hugging-face-model-hub"),j(He,"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"),j(He,"href","#working-with-the-hugging-face-model-hub"),j(xe,"class","relative group"),j(Mo,"href","/docs/optimum/pr_360/en/onnxruntime/modeling_ort#optimum.onnxruntime.ORTModelForSequenceClassification"),j(Ft,"href","https://hf.co/models"),j(Ft,"rel","nofollow"),j(Xe,"id","export-and-inference-of-sequencetosequence-models"),j(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"),j(Xe,"href","#export-and-inference-of-sequencetosequence-models"),j(ve,"class","relative group"),j(Qe,"id","optimum.onnxruntime.ORTModel"),j(Qe,"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"),j(Qe,"href","#optimum.onnxruntime.ORTModel"),j(Te,"class","relative group"),j(We,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(Be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(Ve,"id","optimum.onnxruntime.ORTModelForFeatureExtraction"),j(Ve,"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"),j(Ve,"href","#optimum.onnxruntime.ORTModelForFeatureExtraction"),j(be,"class","relative group"),j(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(Ke,"id","optimum.onnxruntime.ORTModelForQuestionAnswering"),j(Ke,"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"),j(Ke,"href","#optimum.onnxruntime.ORTModelForQuestionAnswering"),j(Oe,"class","relative group"),j(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(tt,"id","optimum.onnxruntime.ORTModelForSequenceClassification"),j(tt,"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"),j(tt,"href","#optimum.onnxruntime.ORTModelForSequenceClassification"),j(je,"class","relative group"),j(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(at,"id","optimum.onnxruntime.ORTModelForTokenClassification"),j(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"),j(at,"href","#optimum.onnxruntime.ORTModelForTokenClassification"),j(Ee,"class","relative group"),j(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(pt,"id","optimum.onnxruntime.ORTModelForCausalLM"),j(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"),j(pt,"href","#optimum.onnxruntime.ORTModelForCausalLM"),j(Fe,"class","relative group"),j(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(ht,"id","optimum.onnxruntime.ORTModelForSeq2SeqLM"),j(ht,"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"),j(ht,"href","#optimum.onnxruntime.ORTModelForSeq2SeqLM"),j(Ce,"class","relative group"),j(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j($t,"id","optimum.onnxruntime.ORTModelForImageClassification"),j($t,"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"),j($t,"href","#optimum.onnxruntime.ORTModelForImageClassification"),j(Se,"class","relative group"),j(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(vt,"id","optimum.onnxruntime.ORTModelForCustomTasks"),j(vt,"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"),j(vt,"href","#optimum.onnxruntime.ORTModelForCustomTasks"),j(Ne,"class","relative group"),j(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(H,"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,n),k(t,$,g),k(t,c,g),e(c,u),e(u,_),b(s,_,null),e(c,l),e(c,x),e(x,d),k(t,w,g),k(t,E,g),e(E,$r),e(E,bo),e(bo,kr),e(E,wr),k(t,xs,g),k(t,we,g),e(we,De),e(De,So),b(jt,So,null),e(we,xr),e(we,Po),e(Po,vr),k(t,vs,g),k(t,X,g),e(X,Tr),e(X,No),e(No,br),e(X,Mr),e(X,Io),e(Io,Or),e(X,qr),e(X,Lo),e(Lo,jr),e(X,yr),e(X,Do),e(Do,Er),e(X,Rr),k(t,Ts,g),b(yt,t,g),k(t,bs,g),k(t,se,g),e(se,Fr),e(se,Ho),e(Ho,zr),e(se,Cr),e(se,Xo),e(Xo,Ar),e(se,Sr),k(t,Ms,g),b(Et,t,g),k(t,Os,g),k(t,xe,g),e(xe,He),e(He,Qo),b(Rt,Qo,null),e(xe,Pr),e(xe,Wo),e(Wo,Nr),k(t,qs,g),k(t,ee,g),e(ee,Ir),e(ee,Mo),e(Mo,Lr),e(ee,Dr),e(ee,Ft),e(Ft,Hr),e(ee,Xr),e(ee,Bo),e(Bo,Qr),e(ee,Wr),k(t,js,g),b(zt,t,g),k(t,ys,g),k(t,ve,g),e(ve,Xe),e(Xe,Vo),b(Ct,Vo,null),e(ve,Br),e(ve,Go),e(Go,Vr),k(t,Es,g),k(t,re,g),e(re,Gr),e(re,Jo),e(Jo,Jr),e(re,Ur),e(re,Uo),e(Uo,Kr),e(re,Yr),k(t,Rs,g),b(At,t,g),k(t,Fs,g),k(t,Te,g),e(Te,Qe),e(Qe,Ko),b(St,Ko,null),e(Te,Zr),e(Te,Yo),e(Yo,ea),k(t,zs,g),k(t,K,g),b(Pt,K,null),e(K,ta),e(K,Nt),e(Nt,oa),e(Nt,Zo),e(Zo,na),e(Nt,sa),e(K,ra),e(K,We),b(It,We,null),e(We,aa),e(We,Lt),e(Lt,ia),e(Lt,en),e(en,la),e(Lt,ma),e(K,pa),e(K,Be),b(Dt,Be,null),e(Be,da),e(Be,tn),e(tn,ca),k(t,Cs,g),k(t,be,g),e(be,Ve),e(Ve,on),b(Ht,on,null),e(be,ua),e(be,nn),e(nn,ha),k(t,As,g),k(t,S,g),b(Xt,S,null),e(S,fa),e(S,sn),e(sn,ga),e(S,_a),e(S,Qt),e(Qt,$a),e(Qt,rn),e(rn,ka),e(Qt,wa),e(S,xa),e(S,an),e(an,va),e(S,Ta),e(S,Q),b(Wt,Q,null),e(Q,ba),e(Q,Me),e(Me,Ma),e(Me,ln),e(ln,Oa),e(Me,qa),e(Me,mn),e(mn,ja),e(Me,ya),e(Q,Ea),b(Ge,Q,null),e(Q,Ra),b(Je,Q,null),e(Q,Fa),b(Ue,Q,null),k(t,Ss,g),k(t,Oe,g),e(Oe,Ke),e(Ke,pn),b(Bt,pn,null),e(Oe,za),e(Oe,dn),e(dn,Ca),k(t,Ps,g),k(t,P,g),b(Vt,P,null),e(P,Aa),e(P,cn),e(cn,Sa),e(P,Pa),e(P,Gt),e(Gt,Na),e(Gt,un),e(un,Ia),e(Gt,La),e(P,Da),e(P,hn),e(hn,Ha),e(P,Xa),e(P,W),b(Jt,W,null),e(W,Qa),e(W,qe),e(qe,Wa),e(qe,fn),e(fn,Ba),e(qe,Va),e(qe,gn),e(gn,Ga),e(qe,Ja),e(W,Ua),b(Ye,W,null),e(W,Ka),b(Ze,W,null),e(W,Ya),b(et,W,null),k(t,Ns,g),k(t,je,g),e(je,tt),e(tt,_n),b(Ut,_n,null),e(je,Za),e(je,$n),e($n,ei),k(t,Is,g),k(t,N,g),b(Kt,N,null),e(N,ti),e(N,kn),e(kn,oi),e(N,ni),e(N,Yt),e(Yt,si),e(Yt,wn),e(wn,ri),e(Yt,ai),e(N,ii),e(N,xn),e(xn,li),e(N,mi),e(N,A),b(Zt,A,null),e(A,pi),e(A,ye),e(ye,di),e(ye,vn),e(vn,ci),e(ye,ui),e(ye,Tn),e(Tn,hi),e(ye,fi),e(A,gi),b(ot,A,null),e(A,_i),b(nt,A,null),e(A,$i),b(st,A,null),e(A,ki),b(rt,A,null),k(t,Ls,g),k(t,Ee,g),e(Ee,at),e(at,bn),b(eo,bn,null),e(Ee,wi),e(Ee,Mn),e(Mn,xi),k(t,Ds,g),k(t,I,g),b(to,I,null),e(I,vi),e(I,On),e(On,Ti),e(I,bi),e(I,oo),e(oo,Mi),e(oo,qn),e(qn,Oi),e(oo,qi),e(I,ji),e(I,jn),e(jn,yi),e(I,Ei),e(I,B),b(no,B,null),e(B,Ri),e(B,Re),e(Re,Fi),e(Re,yn),e(yn,zi),e(Re,Ci),e(Re,En),e(En,Ai),e(Re,Si),e(B,Pi),b(it,B,null),e(B,Ni),b(lt,B,null),e(B,Ii),b(mt,B,null),k(t,Hs,g),k(t,Fe,g),e(Fe,pt),e(pt,Rn),b(so,Rn,null),e(Fe,Li),e(Fe,Fn),e(Fn,Di),k(t,Xs,g),k(t,L,g),b(ro,L,null),e(L,Hi),e(L,zn),e(zn,Xi),e(L,Qi),e(L,ao),e(ao,Wi),e(ao,Cn),e(Cn,Bi),e(ao,Vi),e(L,Gi),e(L,An),e(An,Ji),e(L,Ui),e(L,V),b(io,V,null),e(V,Ki),e(V,ze),e(ze,Yi),e(ze,Sn),e(Sn,Zi),e(ze,el),e(ze,Pn),e(Pn,tl),e(ze,ol),e(V,nl),b(dt,V,null),e(V,sl),b(ct,V,null),e(V,rl),b(ut,V,null),k(t,Qs,g),k(t,Ce,g),e(Ce,ht),e(ht,Nn),b(lo,Nn,null),e(Ce,al),e(Ce,In),e(In,il),k(t,Ws,g),k(t,oe,g),b(mo,oe,null),e(oe,ll),e(oe,Ln),e(Ln,ml),e(oe,pl),e(oe,G),b(po,G,null),e(G,dl),e(G,Ae),e(Ae,cl),e(Ae,Dn),e(Dn,ul),e(Ae,hl),e(Ae,Hn),e(Hn,fl),e(Ae,gl),e(G,_l),b(ft,G,null),e(G,$l),b(gt,G,null),e(G,kl),b(_t,G,null),k(t,Bs,g),k(t,Se,g),e(Se,$t),e($t,Xn),b(co,Xn,null),e(Se,wl),e(Se,Qn),e(Qn,xl),k(t,Vs,g),k(t,D,g),b(uo,D,null),e(D,vl),e(D,Wn),e(Wn,Tl),e(D,bl),e(D,ho),e(ho,Ml),e(ho,Bn),e(Bn,Ol),e(ho,ql),e(D,jl),e(D,Vn),e(Vn,yl),e(D,El),e(D,J),b(fo,J,null),e(J,Rl),e(J,Pe),e(Pe,Fl),e(Pe,Gn),e(Gn,zl),e(Pe,Cl),e(Pe,Jn),e(Jn,Al),e(Pe,Sl),e(J,Pl),b(kt,J,null),e(J,Nl),b(wt,J,null),e(J,Il),b(xt,J,null),k(t,Gs,g),k(t,Ne,g),e(Ne,vt),e(vt,Un),b(go,Un,null),e(Ne,Ll),e(Ne,Kn),e(Kn,Dl),k(t,Js,g),k(t,H,g),b(_o,H,null),e(H,Hl),e(H,Yn),e(Yn,Xl),e(H,Ql),e(H,$o),e($o,Wl),e($o,Zn),e(Zn,Bl),e($o,Vl),e(H,Gl),e(H,es),e(es,Jl),e(H,Ul),e(H,U),b(ko,U,null),e(U,Kl),e(U,Ie),e(Ie,Yl),e(Ie,ts),e(ts,Zl),e(Ie,em),e(Ie,os),e(os,tm),e(Ie,om),e(U,nm),b(Tt,U,null),e(U,sm),b(bt,U,null),e(U,rm),b(Mt,U,null),Us=!0},p(t,[g]){const wo={};g&2&&(wo.$$scope={dirty:g,ctx:t}),Ge.$set(wo);const ns={};g&2&&(ns.$$scope={dirty:g,ctx:t}),Je.$set(ns);const ss={};g&2&&(ss.$$scope={dirty:g,ctx:t}),Ue.$set(ss);const rs={};g&2&&(rs.$$scope={dirty:g,ctx:t}),Ye.$set(rs);const xo={};g&2&&(xo.$$scope={dirty:g,ctx:t}),Ze.$set(xo);const as={};g&2&&(as.$$scope={dirty:g,ctx:t}),et.$set(as);const vo={};g&2&&(vo.$$scope={dirty:g,ctx:t}),ot.$set(vo);const is={};g&2&&(is.$$scope={dirty:g,ctx:t}),nt.$set(is);const ls={};g&2&&(ls.$$scope={dirty:g,ctx:t}),st.$set(ls);const ms={};g&2&&(ms.$$scope={dirty:g,ctx:t}),rt.$set(ms);const Y={};g&2&&(Y.$$scope={dirty:g,ctx:t}),it.$set(Y);const ps={};g&2&&(ps.$$scope={dirty:g,ctx:t}),lt.$set(ps);const ds={};g&2&&(ds.$$scope={dirty:g,ctx:t}),mt.$set(ds);const cs={};g&2&&(cs.$$scope={dirty:g,ctx:t}),dt.$set(cs);const us={};g&2&&(us.$$scope={dirty:g,ctx:t}),ct.$set(us);const Le={};g&2&&(Le.$$scope={dirty:g,ctx:t}),ut.$set(Le);const hs={};g&2&&(hs.$$scope={dirty:g,ctx:t}),ft.$set(hs);const fs={};g&2&&(fs.$$scope={dirty:g,ctx:t}),gt.$set(fs);const To={};g&2&&(To.$$scope={dirty:g,ctx:t}),_t.$set(To);const gs={};g&2&&(gs.$$scope={dirty:g,ctx:t}),kt.$set(gs);const _s={};g&2&&(_s.$$scope={dirty:g,ctx:t}),wt.$set(_s);const $s={};g&2&&($s.$$scope={dirty:g,ctx:t}),xt.$set($s);const ne={};g&2&&(ne.$$scope={dirty:g,ctx:t}),Tt.$set(ne);const ks={};g&2&&(ks.$$scope={dirty:g,ctx:t}),bt.$set(ks);const ws={};g&2&&(ws.$$scope={dirty:g,ctx:t}),Mt.$set(ws)},i(t){Us||(M(s.$$.fragment,t),M(jt.$$.fragment,t),M(yt.$$.fragment,t),M(Et.$$.fragment,t),M(Rt.$$.fragment,t),M(zt.$$.fragment,t),M(Ct.$$.fragment,t),M(At.$$.fragment,t),M(St.$$.fragment,t),M(Pt.$$.fragment,t),M(It.$$.fragment,t),M(Dt.$$.fragment,t),M(Ht.$$.fragment,t),M(Xt.$$.fragment,t),M(Wt.$$.fragment,t),M(Ge.$$.fragment,t),M(Je.$$.fragment,t),M(Ue.$$.fragment,t),M(Bt.$$.fragment,t),M(Vt.$$.fragment,t),M(Jt.$$.fragment,t),M(Ye.$$.fragment,t),M(Ze.$$.fragment,t),M(et.$$.fragment,t),M(Ut.$$.fragment,t),M(Kt.$$.fragment,t),M(Zt.$$.fragment,t),M(ot.$$.fragment,t),M(nt.$$.fragment,t),M(st.$$.fragment,t),M(rt.$$.fragment,t),M(eo.$$.fragment,t),M(to.$$.fragment,t),M(no.$$.fragment,t),M(it.$$.fragment,t),M(lt.$$.fragment,t),M(mt.$$.fragment,t),M(so.$$.fragment,t),M(ro.$$.fragment,t),M(io.$$.fragment,t),M(dt.$$.fragment,t),M(ct.$$.fragment,t),M(ut.$$.fragment,t),M(lo.$$.fragment,t),M(mo.$$.fragment,t),M(po.$$.fragment,t),M(ft.$$.fragment,t),M(gt.$$.fragment,t),M(_t.$$.fragment,t),M(co.$$.fragment,t),M(uo.$$.fragment,t),M(fo.$$.fragment,t),M(kt.$$.fragment,t),M(wt.$$.fragment,t),M(xt.$$.fragment,t),M(go.$$.fragment,t),M(_o.$$.fragment,t),M(ko.$$.fragment,t),M(Tt.$$.fragment,t),M(bt.$$.fragment,t),M(Mt.$$.fragment,t),Us=!0)},o(t){O(s.$$.fragment,t),O(jt.$$.fragment,t),O(yt.$$.fragment,t),O(Et.$$.fragment,t),O(Rt.$$.fragment,t),O(zt.$$.fragment,t),O(Ct.$$.fragment,t),O(At.$$.fragment,t),O(St.$$.fragment,t),O(Pt.$$.fragment,t),O(It.$$.fragment,t),O(Dt.$$.fragment,t),O(Ht.$$.fragment,t),O(Xt.$$.fragment,t),O(Wt.$$.fragment,t),O(Ge.$$.fragment,t),O(Je.$$.fragment,t),O(Ue.$$.fragment,t),O(Bt.$$.fragment,t),O(Vt.$$.fragment,t),O(Jt.$$.fragment,t),O(Ye.$$.fragment,t),O(Ze.$$.fragment,t),O(et.$$.fragment,t),O(Ut.$$.fragment,t),O(Kt.$$.fragment,t),O(Zt.$$.fragment,t),O(ot.$$.fragment,t),O(nt.$$.fragment,t),O(st.$$.fragment,t),O(rt.$$.fragment,t),O(eo.$$.fragment,t),O(to.$$.fragment,t),O(no.$$.fragment,t),O(it.$$.fragment,t),O(lt.$$.fragment,t),O(mt.$$.fragment,t),O(so.$$.fragment,t),O(ro.$$.fragment,t),O(io.$$.fragment,t),O(dt.$$.fragment,t),O(ct.$$.fragment,t),O(ut.$$.fragment,t),O(lo.$$.fragment,t),O(mo.$$.fragment,t),O(po.$$.fragment,t),O(ft.$$.fragment,t),O(gt.$$.fragment,t),O(_t.$$.fragment,t),O(co.$$.fragment,t),O(uo.$$.fragment,t),O(fo.$$.fragment,t),O(kt.$$.fragment,t),O(wt.$$.fragment,t),O(xt.$$.fragment,t),O(go.$$.fragment,t),O(_o.$$.fragment,t),O(ko.$$.fragment,t),O(Tt.$$.fragment,t),O(bt.$$.fragment,t),O(Mt.$$.fragment,t),Us=!1},d(t){o(n),t&&o($),t&&o(c),q(s),t&&o(w),t&&o(E),t&&o(xs),t&&o(we),q(jt),t&&o(vs),t&&o(X),t&&o(Ts),q(yt,t),t&&o(bs),t&&o(se),t&&o(Ms),q(Et,t),t&&o(Os),t&&o(xe),q(Rt),t&&o(qs),t&&o(ee),t&&o(js),q(zt,t),t&&o(ys),t&&o(ve),q(Ct),t&&o(Es),t&&o(re),t&&o(Rs),q(At,t),t&&o(Fs),t&&o(Te),q(St),t&&o(zs),t&&o(K),q(Pt),q(It),q(Dt),t&&o(Cs),t&&o(be),q(Ht),t&&o(As),t&&o(S),q(Xt),q(Wt),q(Ge),q(Je),q(Ue),t&&o(Ss),t&&o(Oe),q(Bt),t&&o(Ps),t&&o(P),q(Vt),q(Jt),q(Ye),q(Ze),q(et),t&&o(Ns),t&&o(je),q(Ut),t&&o(Is),t&&o(N),q(Kt),q(Zt),q(ot),q(nt),q(st),q(rt),t&&o(Ls),t&&o(Ee),q(eo),t&&o(Ds),t&&o(I),q(to),q(no),q(it),q(lt),q(mt),t&&o(Hs),t&&o(Fe),q(so),t&&o(Xs),t&&o(L),q(ro),q(io),q(dt),q(ct),q(ut),t&&o(Qs),t&&o(Ce),q(lo),t&&o(Ws),t&&o(oe),q(mo),q(po),q(ft),q(gt),q(_t),t&&o(Bs),t&&o(Se),q(co),t&&o(Vs),t&&o(D),q(uo),q(fo),q(kt),q(wt),q(xt),t&&o(Gs),t&&o(Ne),q(go),t&&o(Js),t&&o(H),q(_o),q(ko),q(Tt),q(bt),q(Mt)}}}const nd={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"},{local:"optimum.onnxruntime.ORTModelForCustomTasks",title:"ORTModelForCustomTasks"}],title:"Optimum Inference with ONNX Runtime"};function sd(y){return Ep(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class dd extends Op{constructor(n){super();qp(this,n,sd,od,jp,{})}}export{dd as default,nd as metadata};
