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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-model = AutoModelForQuestionAnswering.from_pretrained("deepset/roberta-base-squad2") # pytorch checkpoint
+model = ORTModelForQuestionAnswering.from_pretrained("optimum/roberta-base-squad2") # onnx checkpoint
tokenizer = AutoTokenizer.from_pretrained("deepset/roberta-base-squad2")

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

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

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

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

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