import{S as jg,i as qg,s as zg,e as l,k as f,w as k,t as s,M as Pg,c as i,d as a,m as c,a as p,x as w,h as r,b as h,G as e,g as d,y,q as b,o as T,B as E,v as xg,L as ye}from"../chunks/vendor-hf-doc-builder.js";import{T as An}from"../chunks/Tip-hf-doc-builder.js";import{Y as Ag}from"../chunks/Youtube-hf-doc-builder.js";import{I as Oe}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as O}from"../chunks/CodeBlock-hf-doc-builder.js";import{D as Fg}from"../chunks/DocNotebookDropdown-hf-doc-builder.js";import{F as us,M as me}from"../chunks/Markdown-hf-doc-builder.js";function Mg(x){let o,m;return o=new O({props:{code:"pip install torch",highlighted:"pip install torch"}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p:ye,i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function Sg(x){let o,m;return o=new me({props:{$$slots:{default:[Mg]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function Cg(x){let o,m;return o=new O({props:{code:"pip install tensorflow",highlighted:"pip install tensorflow"}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p:ye,i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function Dg(x){let o,m;return o=new me({props:{$$slots:{default:[Cg]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function Ig(x){let o,m,n,_,$,v,q,F,g,j,C,N,I,W;return I=new O({props:{code:`from transformers import AutoTokenizer, AutoModelForSequenceClassification

model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSequenceClassification.from_pretrained(model_name)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(model_name)`}}),{c(){o=l("p"),m=s("Use "),n=l("a"),_=s("AutoModelForSequenceClassification"),$=s(" and "),v=l("a"),q=s("AutoTokenizer"),F=s(" to load the pretrained model and it\u2019s associated tokenizer (more on an "),g=l("code"),j=s("AutoClass"),C=s(" in the next section):"),N=f(),k(I.$$.fragment),this.h()},l(z){o=i(z,"P",{});var S=p(o);m=r(S,"Use "),n=i(S,"A",{href:!0});var A=p(n);_=r(A,"AutoModelForSequenceClassification"),A.forEach(a),$=r(S," and "),v=i(S,"A",{href:!0});var D=p(v);q=r(D,"AutoTokenizer"),D.forEach(a),F=r(S," to load the pretrained model and it\u2019s associated tokenizer (more on an "),g=i(S,"CODE",{});var K=p(g);j=r(K,"AutoClass"),K.forEach(a),C=r(S," in the next section):"),S.forEach(a),N=c(z),w(I.$$.fragment,z),this.h()},h(){h(n,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoModelForSequenceClassification"),h(v,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoTokenizer")},m(z,S){d(z,o,S),e(o,m),e(o,n),e(n,_),e(o,$),e(o,v),e(v,q),e(o,F),e(o,g),e(g,j),e(o,C),d(z,N,S),y(I,z,S),W=!0},p:ye,i(z){W||(b(I.$$.fragment,z),W=!0)},o(z){T(I.$$.fragment,z),W=!1},d(z){z&&a(o),z&&a(N),E(I,z)}}}function Ng(x){let o,m;return o=new me({props:{$$slots:{default:[Ig]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function Og(x){let o,m,n,_,$,v,q,F,g,j,C,N,I,W;return I=new O({props:{code:`from transformers import AutoTokenizer, TFAutoModelForSequenceClassification

model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFAutoModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(model_name)`}}),{c(){o=l("p"),m=s("Use "),n=l("a"),_=s("TFAutoModelForSequenceClassification"),$=s(" and "),v=l("a"),q=s("AutoTokenizer"),F=s(" to load the pretrained model and it\u2019s associated tokenizer (more on an "),g=l("code"),j=s("TFAutoClass"),C=s(" in the next section):"),N=f(),k(I.$$.fragment),this.h()},l(z){o=i(z,"P",{});var S=p(o);m=r(S,"Use "),n=i(S,"A",{href:!0});var A=p(n);_=r(A,"TFAutoModelForSequenceClassification"),A.forEach(a),$=r(S," and "),v=i(S,"A",{href:!0});var D=p(v);q=r(D,"AutoTokenizer"),D.forEach(a),F=r(S," to load the pretrained model and it\u2019s associated tokenizer (more on an "),g=i(S,"CODE",{});var K=p(g);j=r(K,"TFAutoClass"),K.forEach(a),C=r(S," in the next section):"),S.forEach(a),N=c(z),w(I.$$.fragment,z),this.h()},h(){h(n,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.TFAutoModelForSequenceClassification"),h(v,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoTokenizer")},m(z,S){d(z,o,S),e(o,m),e(o,n),e(n,_),e(o,$),e(o,v),e(v,q),e(o,F),e(o,g),e(g,j),e(o,C),d(z,N,S),y(I,z,S),W=!0},p:ye,i(z){W||(b(I.$$.fragment,z),W=!0)},o(z){T(I.$$.fragment,z),W=!1},d(z){z&&a(o),z&&a(N),E(I,z)}}}function Hg(x){let o,m;return o=new me({props:{$$slots:{default:[Og]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function Lg(x){let o,m;return o=new O({props:{code:`pt_batch = tokenizer(
    ["We are very happy to show you the \u{1F917} Transformers library.", "We hope you don't hate it."],
    padding=True,
    truncation=True,
    max_length=512,
    return_tensors="pt",
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>pt_batch = tokenizer(
<span class="hljs-meta">... </span>    [<span class="hljs-string">&quot;We are very happy to show you the \u{1F917} Transformers library.&quot;</span>, <span class="hljs-string">&quot;We hope you don&#x27;t hate it.&quot;</span>],
<span class="hljs-meta">... </span>    padding=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    truncation=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    max_length=<span class="hljs-number">512</span>,
<span class="hljs-meta">... </span>    return_tensors=<span class="hljs-string">&quot;pt&quot;</span>,
<span class="hljs-meta">... </span>)`}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p:ye,i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function Wg(x){let o,m;return o=new me({props:{$$slots:{default:[Lg]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function Rg(x){let o,m;return o=new O({props:{code:`tf_batch = tokenizer(
    ["We are very happy to show you the \u{1F917} Transformers library.", "We hope you don't hate it."],
    padding=True,
    truncation=True,
    max_length=512,
    return_tensors="tf",
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_batch = tokenizer(
<span class="hljs-meta">... </span>    [<span class="hljs-string">&quot;We are very happy to show you the \u{1F917} Transformers library.&quot;</span>, <span class="hljs-string">&quot;We hope you don&#x27;t hate it.&quot;</span>],
<span class="hljs-meta">... </span>    padding=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    truncation=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    max_length=<span class="hljs-number">512</span>,
<span class="hljs-meta">... </span>    return_tensors=<span class="hljs-string">&quot;tf&quot;</span>,
<span class="hljs-meta">... </span>)`}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p:ye,i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function Yg(x){let o,m;return o=new me({props:{$$slots:{default:[Rg]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function Ug(x){let o,m,n,_,$,v,q,F,g,j,C;return{c(){o=l("p"),m=s("Check out the "),n=l("a"),_=s("preprocess"),$=s(" tutorial for more details about tokenization, and how to use an "),v=l("a"),q=s("AutoFeatureExtractor"),F=s(" and "),g=l("a"),j=s("AutoProcessor"),C=s(" to preprocess image, audio, and multimodal inputs."),this.h()},l(N){o=i(N,"P",{});var I=p(o);m=r(I,"Check out the "),n=i(I,"A",{href:!0});var W=p(n);_=r(W,"preprocess"),W.forEach(a),$=r(I," tutorial for more details about tokenization, and how to use an "),v=i(I,"A",{href:!0});var z=p(v);q=r(z,"AutoFeatureExtractor"),z.forEach(a),F=r(I," and "),g=i(I,"A",{href:!0});var S=p(g);j=r(S,"AutoProcessor"),S.forEach(a),C=r(I," to preprocess image, audio, and multimodal inputs."),I.forEach(a),this.h()},h(){h(n,"href","./preprocessing"),h(v,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoFeatureExtractor"),h(g,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoProcessor")},m(N,I){d(N,o,I),e(o,m),e(o,n),e(n,_),e(o,$),e(o,v),e(v,q),e(o,F),e(o,g),e(g,j),e(o,C)},d(N){N&&a(o)}}}function Kg(x){let o,m,n,_,$,v,q,F;return{c(){o=l("p"),m=s("See the "),n=l("a"),_=s("task summary"),$=s(" for tasks supported by an "),v=l("a"),q=s("AutoModel"),F=s(" class."),this.h()},l(g){o=i(g,"P",{});var j=p(o);m=r(j,"See the "),n=i(j,"A",{href:!0});var C=p(n);_=r(C,"task summary"),C.forEach(a),$=r(j," for tasks supported by an "),v=i(j,"A",{href:!0});var N=p(v);q=r(N,"AutoModel"),N.forEach(a),F=r(j," class."),j.forEach(a),this.h()},h(){h(n,"href","./task_summary"),h(v,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoModel")},m(g,j){d(g,o,j),e(o,m),e(o,n),e(n,_),e(o,$),e(o,v),e(v,q),e(o,F)},d(g){g&&a(o)}}}function Gg(x){let o,m,n,_,$,v,q,F,g,j,C,N,I,W,z,S,A,D,K,R,V,ie,oe,he,G,ne,le,B,ge,J,be,$e,Q,se,Z,P,H,X;return S=new O({props:{code:`from transformers import AutoModelForSequenceClassification

model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
pt_model = AutoModelForSequenceClassification.from_pretrained(model_name)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model_name = <span class="hljs-string">&quot;nlptown/bert-base-multilingual-uncased-sentiment&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model = AutoModelForSequenceClassification.from_pretrained(model_name)`}}),D=new An({props:{$$slots:{default:[Kg]},$$scope:{ctx:x}}}),ne=new O({props:{code:"pt_outputs = pt_model(**pt_batch)",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>pt_outputs = pt_model(**pt_batch)'}}),H=new O({props:{code:`from torch import nn

pt_predictions = nn.functional.softmax(pt_outputs.logits, dim=-1)
print(pt_predictions)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> torch <span class="hljs-keyword">import</span> nn

<span class="hljs-meta">&gt;&gt;&gt; </span>pt_predictions = nn.functional.softmax(pt_outputs.logits, dim=-<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(pt_predictions)
tensor([[<span class="hljs-number">0.0021</span>, <span class="hljs-number">0.0018</span>, <span class="hljs-number">0.0115</span>, <span class="hljs-number">0.2121</span>, <span class="hljs-number">0.7725</span>],
        [<span class="hljs-number">0.2084</span>, <span class="hljs-number">0.1826</span>, <span class="hljs-number">0.1969</span>, <span class="hljs-number">0.1755</span>, <span class="hljs-number">0.2365</span>]], grad_fn=&lt;SoftmaxBackward0&gt;)`}}),{c(){o=l("p"),m=s("\u{1F917} Transformers provides a simple and unified way to load pretrained instances. This means you can load an "),n=l("a"),_=s("AutoModel"),$=s(" like you would load an "),v=l("a"),q=s("AutoTokenizer"),F=s(". The only difference is selecting the correct "),g=l("a"),j=s("AutoModel"),C=s(" for the task. For text (or sequence) classification, you should load "),N=l("a"),I=s("AutoModelForSequenceClassification"),W=s(":"),z=f(),k(S.$$.fragment),A=f(),k(D.$$.fragment),K=f(),R=l("p"),V=s("Now pass your preprocessed batch of inputs directly to the model. You just have to unpack the dictionary by adding "),ie=l("code"),oe=s("**"),he=s(":"),G=f(),k(ne.$$.fragment),le=f(),B=l("p"),ge=s("The model outputs the final activations in the "),J=l("code"),be=s("logits"),$e=s(" attribute. Apply the softmax function to the "),Q=l("code"),se=s("logits"),Z=s(" to retrieve the probabilities:"),P=f(),k(H.$$.fragment),this.h()},l(M){o=i(M,"P",{});var L=p(o);m=r(L,"\u{1F917} Transformers provides a simple and unified way to load pretrained instances. This means you can load an "),n=i(L,"A",{href:!0});var ve=p(n);_=r(ve,"AutoModel"),ve.forEach(a),$=r(L," like you would load an "),v=i(L,"A",{href:!0});var He=p(v);q=r(He,"AutoTokenizer"),He.forEach(a),F=r(L,". The only difference is selecting the correct "),g=i(L,"A",{href:!0});var ae=p(g);j=r(ae,"AutoModel"),ae.forEach(a),C=r(L," for the task. For text (or sequence) classification, you should load "),N=i(L,"A",{href:!0});var Le=p(N);I=r(Le,"AutoModelForSequenceClassification"),Le.forEach(a),W=r(L,":"),L.forEach(a),z=c(M),w(S.$$.fragment,M),A=c(M),w(D.$$.fragment,M),K=c(M),R=i(M,"P",{});var ee=p(R);V=r(ee,"Now pass your preprocessed batch of inputs directly to the model. You just have to unpack the dictionary by adding "),ie=i(ee,"CODE",{});var ds=p(ie);oe=r(ds,"**"),ds.forEach(a),he=r(ee,":"),ee.forEach(a),G=c(M),w(ne.$$.fragment,M),le=c(M),B=i(M,"P",{});var _e=p(B);ge=r(_e,"The model outputs the final activations in the "),J=i(_e,"CODE",{});var ms=p(J);be=r(ms,"logits"),ms.forEach(a),$e=r(_e," attribute. Apply the softmax function to the "),Q=i(_e,"CODE",{});var hs=p(Q);se=r(hs,"logits"),hs.forEach(a),Z=r(_e," to retrieve the probabilities:"),_e.forEach(a),P=c(M),w(H.$$.fragment,M),this.h()},h(){h(n,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoModel"),h(v,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoTokenizer"),h(g,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoModel"),h(N,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoModelForSequenceClassification")},m(M,L){d(M,o,L),e(o,m),e(o,n),e(n,_),e(o,$),e(o,v),e(v,q),e(o,F),e(o,g),e(g,j),e(o,C),e(o,N),e(N,I),e(o,W),d(M,z,L),y(S,M,L),d(M,A,L),y(D,M,L),d(M,K,L),d(M,R,L),e(R,V),e(R,ie),e(ie,oe),e(R,he),d(M,G,L),y(ne,M,L),d(M,le,L),d(M,B,L),e(B,ge),e(B,J),e(J,be),e(B,$e),e(B,Q),e(Q,se),e(B,Z),d(M,P,L),y(H,M,L),X=!0},p(M,L){const ve={};L&2&&(ve.$$scope={dirty:L,ctx:M}),D.$set(ve)},i(M){X||(b(S.$$.fragment,M),b(D.$$.fragment,M),b(ne.$$.fragment,M),b(H.$$.fragment,M),X=!0)},o(M){T(S.$$.fragment,M),T(D.$$.fragment,M),T(ne.$$.fragment,M),T(H.$$.fragment,M),X=!1},d(M){M&&a(o),M&&a(z),E(S,M),M&&a(A),E(D,M),M&&a(K),M&&a(R),M&&a(G),E(ne,M),M&&a(le),M&&a(B),M&&a(P),E(H,M)}}}function Bg(x){let o,m;return o=new me({props:{$$slots:{default:[Gg]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function Vg(x){let o,m,n,_,$,v,q,F;return{c(){o=l("p"),m=s("See the "),n=l("a"),_=s("task summary"),$=s(" for tasks supported by an "),v=l("a"),q=s("AutoModel"),F=s(" class."),this.h()},l(g){o=i(g,"P",{});var j=p(o);m=r(j,"See the "),n=i(j,"A",{href:!0});var C=p(n);_=r(C,"task summary"),C.forEach(a),$=r(j," for tasks supported by an "),v=i(j,"A",{href:!0});var N=p(v);q=r(N,"AutoModel"),N.forEach(a),F=r(j," class."),j.forEach(a),this.h()},h(){h(n,"href","./task_summary"),h(v,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoModel")},m(g,j){d(g,o,j),e(o,m),e(o,n),e(n,_),e(o,$),e(o,v),e(v,q),e(o,F)},d(g){g&&a(o)}}}function Qg(x){let o,m,n,_,$,v,q,F,g,j,C,N,I,W,z,S,A,D,K,R,V,ie,oe,he,G,ne,le,B,ge,J,be,$e,Q,se,Z;return S=new O({props:{code:`from transformers import TFAutoModelForSequenceClassification

model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
tf_model = TFAutoModelForSequenceClassification.from_pretrained(model_name)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model_name = <span class="hljs-string">&quot;nlptown/bert-base-multilingual-uncased-sentiment&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFAutoModelForSequenceClassification.from_pretrained(model_name)`}}),D=new An({props:{$$slots:{default:[Vg]},$$scope:{ctx:x}}}),oe=new O({props:{code:"tf_outputs = tf_model(tf_batch)",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_outputs = tf_model(tf_batch)'}}),se=new O({props:{code:`import tensorflow as tf

tf_predictions = tf.nn.softmax(tf_outputs.logits, axis=-1)
tf_predictions`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-meta">&gt;&gt;&gt; </span>tf_predictions = tf.nn.softmax(tf_outputs.logits, axis=-<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_predictions`}}),{c(){o=l("p"),m=s("\u{1F917} Transformers provides a simple and unified way to load pretrained instances. This means you can load an "),n=l("a"),_=s("TFAutoModel"),$=s(" like you would load an "),v=l("a"),q=s("AutoTokenizer"),F=s(". The only difference is selecting the correct "),g=l("a"),j=s("TFAutoModel"),C=s(" for the task. For text (or sequence) classification, you should load "),N=l("a"),I=s("TFAutoModelForSequenceClassification"),W=s(":"),z=f(),k(S.$$.fragment),A=f(),k(D.$$.fragment),K=f(),R=l("p"),V=s("Now pass your preprocessed batch of inputs directly to the model by passing the dictionary keys directly to the tensors:"),ie=f(),k(oe.$$.fragment),he=f(),G=l("p"),ne=s("The model outputs the final activations in the "),le=l("code"),B=s("logits"),ge=s(" attribute. Apply the softmax function to the "),J=l("code"),be=s("logits"),$e=s(" to retrieve the probabilities:"),Q=f(),k(se.$$.fragment),this.h()},l(P){o=i(P,"P",{});var H=p(o);m=r(H,"\u{1F917} Transformers provides a simple and unified way to load pretrained instances. This means you can load an "),n=i(H,"A",{href:!0});var X=p(n);_=r(X,"TFAutoModel"),X.forEach(a),$=r(H," like you would load an "),v=i(H,"A",{href:!0});var M=p(v);q=r(M,"AutoTokenizer"),M.forEach(a),F=r(H,". The only difference is selecting the correct "),g=i(H,"A",{href:!0});var L=p(g);j=r(L,"TFAutoModel"),L.forEach(a),C=r(H," for the task. For text (or sequence) classification, you should load "),N=i(H,"A",{href:!0});var ve=p(N);I=r(ve,"TFAutoModelForSequenceClassification"),ve.forEach(a),W=r(H,":"),H.forEach(a),z=c(P),w(S.$$.fragment,P),A=c(P),w(D.$$.fragment,P),K=c(P),R=i(P,"P",{});var He=p(R);V=r(He,"Now pass your preprocessed batch of inputs directly to the model by passing the dictionary keys directly to the tensors:"),He.forEach(a),ie=c(P),w(oe.$$.fragment,P),he=c(P),G=i(P,"P",{});var ae=p(G);ne=r(ae,"The model outputs the final activations in the "),le=i(ae,"CODE",{});var Le=p(le);B=r(Le,"logits"),Le.forEach(a),ge=r(ae," attribute. Apply the softmax function to the "),J=i(ae,"CODE",{});var ee=p(J);be=r(ee,"logits"),ee.forEach(a),$e=r(ae," to retrieve the probabilities:"),ae.forEach(a),Q=c(P),w(se.$$.fragment,P),this.h()},h(){h(n,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.TFAutoModel"),h(v,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoTokenizer"),h(g,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.TFAutoModel"),h(N,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.TFAutoModelForSequenceClassification")},m(P,H){d(P,o,H),e(o,m),e(o,n),e(n,_),e(o,$),e(o,v),e(v,q),e(o,F),e(o,g),e(g,j),e(o,C),e(o,N),e(N,I),e(o,W),d(P,z,H),y(S,P,H),d(P,A,H),y(D,P,H),d(P,K,H),d(P,R,H),e(R,V),d(P,ie,H),y(oe,P,H),d(P,he,H),d(P,G,H),e(G,ne),e(G,le),e(le,B),e(G,ge),e(G,J),e(J,be),e(G,$e),d(P,Q,H),y(se,P,H),Z=!0},p(P,H){const X={};H&2&&(X.$$scope={dirty:H,ctx:P}),D.$set(X)},i(P){Z||(b(S.$$.fragment,P),b(D.$$.fragment,P),b(oe.$$.fragment,P),b(se.$$.fragment,P),Z=!0)},o(P){T(S.$$.fragment,P),T(D.$$.fragment,P),T(oe.$$.fragment,P),T(se.$$.fragment,P),Z=!1},d(P){P&&a(o),P&&a(z),E(S,P),P&&a(A),E(D,P),P&&a(K),P&&a(R),P&&a(ie),E(oe,P),P&&a(he),P&&a(G),P&&a(Q),E(se,P)}}}function Jg(x){let o,m;return o=new me({props:{$$slots:{default:[Qg]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function Zg(x){let o,m,n,_,$;return{c(){o=l("p"),m=s("All \u{1F917} Transformers models (PyTorch or TensorFlow) output the tensors "),n=l("em"),_=s("before"),$=s(` the final activation
function (like softmax) because the final activation function is often fused with the loss. Model outputs are special dataclasses so their attributes are autocompleted in an IDE. The model outputs behave like a tuple or a dictionary (you can index with an integer, a slice or a string) in which case, attributes that are None are ignored.`)},l(v){o=i(v,"P",{});var q=p(o);m=r(q,"All \u{1F917} Transformers models (PyTorch or TensorFlow) output the tensors "),n=i(q,"EM",{});var F=p(n);_=r(F,"before"),F.forEach(a),$=r(q,` the final activation
function (like softmax) because the final activation function is often fused with the loss. Model outputs are special dataclasses so their attributes are autocompleted in an IDE. The model outputs behave like a tuple or a dictionary (you can index with an integer, a slice or a string) in which case, attributes that are None are ignored.`),q.forEach(a)},m(v,q){d(v,o,q),e(o,m),e(o,n),e(n,_),e(o,$)},d(v){v&&a(o)}}}function Xg(x){let o,m,n,_,$,v,q,F,g,j,C,N,I,W,z,S;return q=new O({props:{code:`pt_save_directory = "./pt_save_pretrained"
tokenizer.save_pretrained(pt_save_directory)
pt_model.save_pretrained(pt_save_directory)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>pt_save_directory = <span class="hljs-string">&quot;./pt_save_pretrained&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.save_pretrained(pt_save_directory)
<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model.save_pretrained(pt_save_directory)`}}),z=new O({props:{code:'pt_model = AutoModelForSequenceClassification.from_pretrained("./pt_save_pretrained")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model = AutoModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;./pt_save_pretrained&quot;</span>)'}}),{c(){o=l("p"),m=s("Once your model is fine-tuned, you can save it with its tokenizer using "),n=l("a"),_=s("PreTrainedModel.save_pretrained()"),$=s(":"),v=f(),k(q.$$.fragment),F=f(),g=l("p"),j=s("When you are ready to use the model again, reload it with "),C=l("a"),N=s("PreTrainedModel.from_pretrained()"),I=s(":"),W=f(),k(z.$$.fragment),this.h()},l(A){o=i(A,"P",{});var D=p(o);m=r(D,"Once your model is fine-tuned, you can save it with its tokenizer using "),n=i(D,"A",{href:!0});var K=p(n);_=r(K,"PreTrainedModel.save_pretrained()"),K.forEach(a),$=r(D,":"),D.forEach(a),v=c(A),w(q.$$.fragment,A),F=c(A),g=i(A,"P",{});var R=p(g);j=r(R,"When you are ready to use the model again, reload it with "),C=i(R,"A",{href:!0});var V=p(C);N=r(V,"PreTrainedModel.from_pretrained()"),V.forEach(a),I=r(R,":"),R.forEach(a),W=c(A),w(z.$$.fragment,A),this.h()},h(){h(n,"href","/docs/transformers/pr_19907/en/main_classes/model#transformers.PreTrainedModel.save_pretrained"),h(C,"href","/docs/transformers/pr_19907/en/main_classes/model#transformers.PreTrainedModel.from_pretrained")},m(A,D){d(A,o,D),e(o,m),e(o,n),e(n,_),e(o,$),d(A,v,D),y(q,A,D),d(A,F,D),d(A,g,D),e(g,j),e(g,C),e(C,N),e(g,I),d(A,W,D),y(z,A,D),S=!0},p:ye,i(A){S||(b(q.$$.fragment,A),b(z.$$.fragment,A),S=!0)},o(A){T(q.$$.fragment,A),T(z.$$.fragment,A),S=!1},d(A){A&&a(o),A&&a(v),E(q,A),A&&a(F),A&&a(g),A&&a(W),E(z,A)}}}function e$(x){let o,m;return o=new me({props:{$$slots:{default:[Xg]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function t$(x){let o,m,n,_,$,v,q,F,g,j,C,N,I,W,z,S;return q=new O({props:{code:`tf_save_directory = "./tf_save_pretrained"
tokenizer.save_pretrained(tf_save_directory)
tf_model.save_pretrained(tf_save_directory)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_save_directory = <span class="hljs-string">&quot;./tf_save_pretrained&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.save_pretrained(tf_save_directory)
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model.save_pretrained(tf_save_directory)`}}),z=new O({props:{code:'tf_model = TFAutoModelForSequenceClassification.from_pretrained("./tf_save_pretrained")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFAutoModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;./tf_save_pretrained&quot;</span>)'}}),{c(){o=l("p"),m=s("Once your model is fine-tuned, you can save it with its tokenizer using "),n=l("a"),_=s("TFPreTrainedModel.save_pretrained()"),$=s(":"),v=f(),k(q.$$.fragment),F=f(),g=l("p"),j=s("When you are ready to use the model again, reload it with "),C=l("a"),N=s("TFPreTrainedModel.from_pretrained()"),I=s(":"),W=f(),k(z.$$.fragment),this.h()},l(A){o=i(A,"P",{});var D=p(o);m=r(D,"Once your model is fine-tuned, you can save it with its tokenizer using "),n=i(D,"A",{href:!0});var K=p(n);_=r(K,"TFPreTrainedModel.save_pretrained()"),K.forEach(a),$=r(D,":"),D.forEach(a),v=c(A),w(q.$$.fragment,A),F=c(A),g=i(A,"P",{});var R=p(g);j=r(R,"When you are ready to use the model again, reload it with "),C=i(R,"A",{href:!0});var V=p(C);N=r(V,"TFPreTrainedModel.from_pretrained()"),V.forEach(a),I=r(R,":"),R.forEach(a),W=c(A),w(z.$$.fragment,A),this.h()},h(){h(n,"href","/docs/transformers/pr_19907/en/main_classes/model#transformers.TFPreTrainedModel.save_pretrained"),h(C,"href","/docs/transformers/pr_19907/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained")},m(A,D){d(A,o,D),e(o,m),e(o,n),e(n,_),e(o,$),d(A,v,D),y(q,A,D),d(A,F,D),d(A,g,D),e(g,j),e(g,C),e(C,N),e(g,I),d(A,W,D),y(z,A,D),S=!0},p:ye,i(A){S||(b(q.$$.fragment,A),b(z.$$.fragment,A),S=!0)},o(A){T(q.$$.fragment,A),T(z.$$.fragment,A),S=!1},d(A){A&&a(o),A&&a(v),E(q,A),A&&a(F),A&&a(g),A&&a(W),E(z,A)}}}function a$(x){let o,m;return o=new me({props:{$$slots:{default:[t$]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function s$(x){let o,m;return o=new O({props:{code:`from transformers import AutoModel

tokenizer = AutoTokenizer.from_pretrained(tf_save_directory)
pt_model = AutoModelForSequenceClassification.from_pretrained(tf_save_directory, from_tf=True)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(tf_save_directory)
<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model = AutoModelForSequenceClassification.from_pretrained(tf_save_directory, from_tf=<span class="hljs-literal">True</span>)`}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p:ye,i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function r$(x){let o,m;return o=new me({props:{$$slots:{default:[s$]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function o$(x){let o,m;return o=new O({props:{code:`from transformers import TFAutoModel

tokenizer = AutoTokenizer.from_pretrained(pt_save_directory)
tf_model = TFAutoModelForSequenceClassification.from_pretrained(pt_save_directory, from_pt=True)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(pt_save_directory)
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFAutoModelForSequenceClassification.from_pretrained(pt_save_directory, from_pt=<span class="hljs-literal">True</span>)`}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p:ye,i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function n$(x){let o,m;return o=new me({props:{$$slots:{default:[o$]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function l$(x){let o,m,n,_,$,v,q,F;return q=new O({props:{code:`from transformers import AutoModel

my_model = AutoModel.from_config(my_config)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModel

<span class="hljs-meta">&gt;&gt;&gt; </span>my_model = AutoModel.from_config(my_config)`}}),{c(){o=l("p"),m=s("Create a model from your custom configuration with "),n=l("a"),_=s("AutoModel.from_config()"),$=s(":"),v=f(),k(q.$$.fragment),this.h()},l(g){o=i(g,"P",{});var j=p(o);m=r(j,"Create a model from your custom configuration with "),n=i(j,"A",{href:!0});var C=p(n);_=r(C,"AutoModel.from_config()"),C.forEach(a),$=r(j,":"),j.forEach(a),v=c(g),w(q.$$.fragment,g),this.h()},h(){h(n,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_config")},m(g,j){d(g,o,j),e(o,m),e(o,n),e(n,_),e(o,$),d(g,v,j),y(q,g,j),F=!0},p:ye,i(g){F||(b(q.$$.fragment,g),F=!0)},o(g){T(q.$$.fragment,g),F=!1},d(g){g&&a(o),g&&a(v),E(q,g)}}}function i$(x){let o,m;return o=new me({props:{$$slots:{default:[l$]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function p$(x){let o,m,n,_,$,v,q,F;return q=new O({props:{code:`from transformers import TFAutoModel

my_model = TFAutoModel.from_config(my_config)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModel

<span class="hljs-meta">&gt;&gt;&gt; </span>my_model = TFAutoModel.from_config(my_config)`}}),{c(){o=l("p"),m=s("Create a model from your custom configuration with "),n=l("a"),_=s("TFAutoModel.from_config()"),$=s(":"),v=f(),k(q.$$.fragment),this.h()},l(g){o=i(g,"P",{});var j=p(o);m=r(j,"Create a model from your custom configuration with "),n=i(j,"A",{href:!0});var C=p(n);_=r(C,"TFAutoModel.from_config()"),C.forEach(a),$=r(j,":"),j.forEach(a),v=c(g),w(q.$$.fragment,g),this.h()},h(){h(n,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_config")},m(g,j){d(g,o,j),e(o,m),e(o,n),e(n,_),e(o,$),d(g,v,j),y(q,g,j),F=!0},p:ye,i(g){F||(b(q.$$.fragment,g),F=!0)},o(g){T(q.$$.fragment,g),F=!1},d(g){g&&a(o),g&&a(v),E(q,g)}}}function f$(x){let o,m;return o=new me({props:{$$slots:{default:[p$]},$$scope:{ctx:x}}}),{c(){k(o.$$.fragment)},l(n){w(o.$$.fragment,n)},m(n,_){y(o,n,_),m=!0},p(n,_){const $={};_&2&&($.$$scope={dirty:_,ctx:n}),o.$set($)},i(n){m||(b(o.$$.fragment,n),m=!0)},o(n){T(o.$$.fragment,n),m=!1},d(n){E(o,n)}}}function c$(x){let o,m,n,_,$,v,q,F;return{c(){o=l("p"),m=s("For tasks - like translation or summarization - that use a sequence-to-sequence model, use the "),n=l("a"),_=s("Seq2SeqTrainer"),$=s(" and "),v=l("a"),q=s("Seq2SeqTrainingArguments"),F=s(" classes instead."),this.h()},l(g){o=i(g,"P",{});var j=p(o);m=r(j,"For tasks - like translation or summarization - that use a sequence-to-sequence model, use the "),n=i(j,"A",{href:!0});var C=p(n);_=r(C,"Seq2SeqTrainer"),C.forEach(a),$=r(j," and "),v=i(j,"A",{href:!0});var N=p(v);q=r(N,"Seq2SeqTrainingArguments"),N.forEach(a),F=r(j," classes instead."),j.forEach(a),this.h()},h(){h(n,"href","/docs/transformers/pr_19907/en/main_classes/trainer#transformers.Seq2SeqTrainer"),h(v,"href","/docs/transformers/pr_19907/en/main_classes/trainer#transformers.Seq2SeqTrainingArguments")},m(g,j){d(g,o,j),e(o,m),e(o,n),e(n,_),e(o,$),e(o,v),e(v,q),e(o,F)},d(g){g&&a(o)}}}function u$(x){let o,m,n,_,$,v,q,F,g,j,C,N,I,W,z,S,A,D,K,R,V,ie,oe,he,G,ne,le,B,ge,J,be,$e,Q,se,Z,P,H,X,M,L,ve,He,ae,Le,ee,ds,_e,ms,hs,_s,wi,yi,jn,mt,br,Te,Tr,Er,bi,Ti,Ar,jr,Ei,Ai,qr,zr,ji,qi,Pr,xr,zi,Pi,Y,Ee,Fr,xi,Fi,Mr,Mi,Si,Sr,Ci,Di,Cr,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nl,dt,Yt,_n,fs,fm,gn,cm,Ol,ir,um,Hl;return v=new Oe({}),C=new Fg({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/quicktour.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/quicktour.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/quicktour.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/quicktour.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/quicktour.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/quicktour.ipynb"}]}}),B=new O({props:{code:"!pip install transformers datasets",highlighted:"!pip install transformers datasets"}}),Q=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Dg],pytorch:[Sg]},$$scope:{ctx:x}}}),X=new Oe({}),ae=new Ag({props:{id:"tiZFewofSLM"}}),na=new O({props:{code:`from transformers import pipeline

classifier = pipeline("sentiment-analysis")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>classifier = pipeline(<span class="hljs-string">&quot;sentiment-analysis&quot;</span>)`}}),ia=new O({props:{code:'classifier("We are very happy to show you the \u{1F917} Transformers library.")',highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>classifier(<span class="hljs-string">&quot;We are very happy to show you the \u{1F917} Transformers library.&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.9998</span>}]`}}),pa=new O({props:{code:`results = classifier(["We are very happy to show you the \u{1F917} Transformers library.", "We hope you don't hate it."])
for result in results:
    print(f"label: {result['label']}, with score: {round(result['score'], 4)}")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>results = classifier([<span class="hljs-string">&quot;We are very happy to show you the \u{1F917} Transformers library.&quot;</span>, <span class="hljs-string">&quot;We hope you don&#x27;t hate it.&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> result <span class="hljs-keyword">in</span> results:
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;label: <span class="hljs-subst">{result[<span class="hljs-string">&#x27;label&#x27;</span>]}</span>, with score: <span class="hljs-subst">{<span class="hljs-built_in">round</span>(result[<span class="hljs-string">&#x27;score&#x27;</span>], <span class="hljs-number">4</span>)}</span>&quot;</span>)
label: POSITIVE, <span class="hljs-keyword">with</span> score: <span class="hljs-number">0.9998</span>
label: NEGATIVE, <span class="hljs-keyword">with</span> score: <span class="hljs-number">0.5309</span>`}}),fa=new O({props:{code:`import torch
from transformers import pipeline

speech_recognizer = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-960h")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>speech_recognizer = pipeline(<span class="hljs-string">&quot;automatic-speech-recognition&quot;</span>, model=<span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>)`}}),da=new O({props:{code:`from datasets import load_dataset, Audio

dataset = load_dataset("PolyAI/minds14", name="en-US", split="train")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset, Audio

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;PolyAI/minds14&quot;</span>, name=<span class="hljs-string">&quot;en-US&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)`}}),ha=new O({props:{code:'dataset = dataset.cast_column("audio", Audio(sampling_rate=speech_recognizer.feature_extractor.sampling_rate))',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = dataset.cast_column(<span class="hljs-string">&quot;audio&quot;</span>, Audio(sampling_rate=speech_recognizer.feature_extractor.sampling_rate))'}}),_a=new O({props:{code:`result = speech_recognizer(dataset[:4]["audio"])
print([d["text"] for d in result])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>result = speech_recognizer(dataset[:<span class="hljs-number">4</span>][<span class="hljs-string">&quot;audio&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>([d[<span class="hljs-string">&quot;text&quot;</span>] <span class="hljs-keyword">for</span> d <span class="hljs-keyword">in</span> result])
[<span class="hljs-string">&#x27;I WOULD LIKE TO SET UP A JOINT ACCOUNT WITH MY PARTNER HOW DO I PROCEED WITH DOING THAT&#x27;</span>, <span class="hljs-string">&quot;FODING HOW I&#x27;D SET UP A JOIN TO HET WITH MY WIFE AND WHERE THE AP MIGHT BE&quot;</span>, <span class="hljs-string">&quot;I I&#x27;D LIKE TOY SET UP A JOINT ACCOUNT WITH MY PARTNER I&#x27;M NOT SEEING THE OPTION TO DO IT ON THE AP SO I CALLED IN TO GET SOME HELP CAN I JUST DO IT OVER THE PHONE WITH YOU AND GIVE YOU THE INFORMATION OR SHOULD I DO IT IN THE AP AND I&#x27;M MISSING SOMETHING UQUETTE HAD PREFERRED TO JUST DO IT OVER THE PHONE OF POSSIBLE THINGS&quot;</span>, <span class="hljs-string">&#x27;HOW DO I THURN A JOIN A COUNT&#x27;</span>]`}}),ga=new Oe({}),ka=new O({props:{code:'model_name = "nlptown/bert-base-multilingual-uncased-sentiment"',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model_name = <span class="hljs-string">&quot;nlptown/bert-base-multilingual-uncased-sentiment&quot;</span>'}}),wt=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Hg],pytorch:[Ng]},$$scope:{ctx:x}}}),wa=new O({props:{code:`classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
classifier("Nous sommes tr\xE8s heureux de vous pr\xE9senter la biblioth\xE8que \u{1F917} Transformers.")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>classifier = pipeline(<span class="hljs-string">&quot;sentiment-analysis&quot;</span>, model=model, tokenizer=tokenizer)
<span class="hljs-meta">&gt;&gt;&gt; </span>classifier(<span class="hljs-string">&quot;Nous sommes tr\xE8s heureux de vous pr\xE9senter la biblioth\xE8que \u{1F917} Transformers.&quot;</span>)
[{<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;5 stars&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.7273</span>}]`}}),ya=new Oe({}),ba=new Ag({props:{id:"AhChOFRegn4"}}),Ta=new Oe({}),Ea=new O({props:{code:`from transformers import AutoTokenizer

model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
tokenizer = AutoTokenizer.from_pretrained(model_name)`,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>model_name = <span class="hljs-string">&quot;nlptown/bert-base-multilingual-uncased-sentiment&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(model_name)`}}),Aa=new O({props:{code:`encoding = tokenizer("We are very happy to show you the \u{1F917} Transformers library.")
print(encoding)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(<span class="hljs-string">&quot;We are very happy to show you the \u{1F917} Transformers library.&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(encoding)
{<span class="hljs-string">&#x27;input_ids&#x27;</span>: [<span class="hljs-number">101</span>, <span class="hljs-number">11312</span>, <span class="hljs-number">10320</span>, <span class="hljs-number">12495</span>, <span class="hljs-number">19308</span>, <span class="hljs-number">10114</span>, <span class="hljs-number">11391</span>, <span class="hljs-number">10855</span>, <span class="hljs-number">10103</span>, <span class="hljs-number">100</span>, <span class="hljs-number">58263</span>, <span class="hljs-number">13299</span>, <span class="hljs-number">119</span>, <span class="hljs-number">102</span>],
 <span class="hljs-string">&#x27;token_type_ids&#x27;</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>],
 <span class="hljs-string">&#x27;attention_mask&#x27;</span>: [<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>]}`}}),jt=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Yg],pytorch:[Wg]},$$scope:{ctx:x}}}),qt=new An({props:{$$slots:{default:[Ug]},$$scope:{ctx:x}}}),ja=new Oe({}),Pt=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Jg],pytorch:[Bg]},$$scope:{ctx:x}}}),xt=new An({props:{$$slots:{default:[Zg]},$$scope:{ctx:x}}}),qa=new Oe({}),Mt=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[a$],pytorch:[e$]},$$scope:{ctx:x}}}),St=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[n$],pytorch:[r$]},$$scope:{ctx:x}}}),za=new Oe({}),Pa=new O({props:{code:`from transformers import AutoConfig

my_config = AutoConfig.from_pretrained("distilbert-base-uncased", n_heads=12)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoConfig

<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = AutoConfig.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>, n_heads=<span class="hljs-number">12</span>)`}}),Dt=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[f$],pytorch:[i$]},$$scope:{ctx:x}}}),xa=new Oe({}),Ca=new O({props:{code:`from transformers import AutoModelForSequenceClassification

model = AutoModelForSequenceClassification.from_pretrained("distilbert-base-uncased")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`}}),Ia=new O({props:{code:`from transformers import TrainingArguments

training_args = TrainingArguments(
    output_dir="path/to/save/folder/",
    learning_rate=2e-5,
    per_device_train_batch_size=8,
    per_device_eval_batch_size=8,
    num_train_epochs=2,
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = TrainingArguments(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;path/to/save/folder/&quot;</span>,
<span class="hljs-meta">... </span>    learning_rate=<span class="hljs-number">2e-5</span>,
<span class="hljs-meta">... </span>    per_device_train_batch_size=<span class="hljs-number">8</span>,
<span class="hljs-meta">... </span>    per_device_eval_batch_size=<span class="hljs-number">8</span>,
<span class="hljs-meta">... </span>    num_train_epochs=<span class="hljs-number">2</span>,
<span class="hljs-meta">... </span>)`}}),Oa=new O({props:{code:`from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased")`,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>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`}}),La=new O({props:{code:`train_dataset = dataset["train"]  # doctest: +SKIP
eval_dataset = dataset["eval"]  # doctest: +SKIP`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>train_dataset = dataset[<span class="hljs-string">&quot;train&quot;</span>]  <span class="hljs-comment"># doctest: +SKIP</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>eval_dataset = dataset[<span class="hljs-string">&quot;eval&quot;</span>]  <span class="hljs-comment"># doctest: +SKIP</span>`}}),Ya=new O({props:{code:`from transformers import DefaultDataCollator

data_collator = DefaultDataCollator()`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DefaultDataCollator

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DefaultDataCollator()`}}),Ua=new O({props:{code:`from transformers import Trainer

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=dataset["train"],
    eval_dataset=dataset["test"],
    tokenizer=tokenizer,
    data_collator=data_collator,
)  # doctest: +SKIP`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer = Trainer(
<span class="hljs-meta">... </span>    model=model,
<span class="hljs-meta">... </span>    args=training_args,
<span class="hljs-meta">... </span>    train_dataset=dataset[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=dataset[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>    data_collator=data_collator,
<span class="hljs-meta">... </span>)  <span class="hljs-comment"># doctest: +SKIP</span>`}}),Ka=new O({props:{code:"trainer.train()",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()'}}),Wt=new An({props:{$$slots:{default:[c$]},$$scope:{ctx:x}}}),Ga=new Oe({}),es=new O({props:{code:`from transformers import TFAutoModelForSequenceClassification

model = TFAutoModelForSequenceClassification.from_pretrained("distilbert-base-uncased")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`}}),as=new O({props:{code:`from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased")`,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>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`}}),rs=new O({props:{code:`def tokenize_dataset(dataset):
    return tokenizer(dataset["text"])  # doctest: +SKIP`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">tokenize_dataset</span>(<span class="hljs-params">dataset</span>):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> tokenizer(dataset[<span class="hljs-string">&quot;text&quot;</span>])  <span class="hljs-comment"># doctest: +SKIP</span>`}}),ls=new O({props:{code:`dataset = dataset.map(tokenize_dataset)  # doctest: +SKIP
tf_dataset = model.prepare_tf_dataset(
    dataset, batch_size=16, shuffle=True, tokenizer=tokenizer
)  # doctest: +SKIP`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = dataset.<span class="hljs-built_in">map</span>(tokenize_dataset)  <span class="hljs-comment"># doctest: +SKIP</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_dataset = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    dataset, batch_size=<span class="hljs-number">16</span>, shuffle=<span class="hljs-literal">True</span>, tokenizer=tokenizer
<span class="hljs-meta">... </span>)  <span class="hljs-comment"># doctest: +SKIP</span>`}}),ps=new O({props:{code:`from tensorflow.keras.optimizers import Adam

model.compile(optimizer=Adam(3e-5))
model.fit(dataset)  # doctest: +SKIP`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> tensorflow.keras.optimizers <span class="hljs-keyword">import</span> Adam

<span class="hljs-meta">&gt;&gt;&gt; </span>model.<span class="hljs-built_in">compile</span>(optimizer=Adam(<span class="hljs-number">3e-5</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(dataset)  <span class="hljs-comment"># doctest: +SKIP</span>`}}),fs=new Oe({}),{c(){o=l("meta"),m=f(),n=l("h1"),_=l("a"),$=l("span"),k(v.$$.fragment),q=f(),F=l("span"),g=s("Quick tour"),j=f(),k(C.$$.fragment),N=f(),I=l("p"),W=s("Get up and running with \u{1F917} Transformers! Whether you\u2019re a developer or an everyday user, this quick tour will help you get started and show you how to use the "),z=l("a"),S=s("pipeline()"),A=s(" for inference, load a pretrained model and preprocessor with an "),D=l("a"),K=s("AutoClass"),R=s(", and quickly train a model with PyTorch or TensorFlow. If you\u2019re a beginner, we recommend checking out our tutorials or "),V=l("a"),ie=s("course"),oe=s(" next for more in-depth explanations of the concepts introduced here."),he=f(),G=l("p"),ne=s("Before you begin, make sure you have all the necessary libraries installed:"),le=f(),k(B.$$.fragment),ge=f(),J=l("p"),be=s("You\u2019ll also need to install your preferred machine learning framework:"),$e=f(),k(Q.$$.fragment),se=f(),Z=l("h2"),P=l("a"),H=l("span"),k(X.$$.fragment),M=f(),L=l("span"),ve=s("Pipeline"),He=f(),k(ae.$$.fragment),Le=f(),ee=l("p"),ds=s("The "),_e=l("a"),ms=s("pipeline()"),hs=s(" is the easiest way to use a pretrained model for inference. You can use the "),_s=l("a"),wi=s("pipeline()"),yi=s(" out-of-the-box for many tasks across different modalities. Take a look at the table below for some supported tasks:"),jn=f(),mt=l("table"),br=l("thead"),Te=l("tr"),Tr=l("th"),Er=l("strong"),bi=s("Task"),Ti=f(),Ar=l("th"),jr=l("strong"),Ei=s("Description"),Ai=f(),qr=l("th"),zr=l("strong"),ji=s("Modality"),qi=f(),Pr=l("th"),xr=l("strong"),zi=s("Pipeline identifier"),Pi=f(),Y=l("tbody"),Ee=l("tr"),Fr=l("td"),xi=s("Text classification"),Fi=f(),Mr=l("td"),Mi=s("assign a label to a given sequence of text"),Si=f(),Sr=l("td"),Ci=s("NLP"),Di=f(),Cr=l("td"),Ii=s("pipeline(task=\u201Csentiment-analysis\u201D)"),Ni=f(),Ae=l("tr"),Dr=l("td"),Oi=s("Text generation"),Hi=f(),Ir=l("td"),Li=s("generate text that follows a given prompt"),Wi=f(),Nr=l("td"),Ri=s("NLP"),Yi=f(),Or=l("td"),Ui=s("pipeline(task=\u201Ctext-generation\u201D)"),Ki=f(),je=l("tr"),Hr=l("td"),Gi=s("Name entity recognition"),Bi=f(),Lr=l("td"),Vi=s("assign a label to each token in a sequence (people, organization, location, etc.)"),Qi=f(),Wr=l("td"),Ji=s("NLP"),Zi=f(),Rr=l("td"),Xi=s("pipeline(task=\u201Cner\u201D)"),ep=f(),qe=l("tr"),Yr=l("td"),tp=s("Question answering"),ap=f(),Ur=l("td"),sp=s("extract an answer from the text given some context and a question"),rp=f(),Kr=l("td"),op=s("NLP"),np=f(),Gr=l("td"),lp=s("pipeline(task=\u201Cquestion-answering\u201D)"),ip=f(),ze=l("tr"),Br=l("td"),pp=s("Fill-mask"),fp=f(),Vr=l("td"),cp=s("predict the correct masked token in a sequence"),up=f(),Qr=l("td"),dp=s("NLP"),mp=f(),Jr=l("td"),hp=s("pipeline(task=\u201Cfill-mask\u201D)"),_p=f(),Pe=l("tr"),Zr=l("td"),gp=s("Summarization"),$p=f(),Xr=l("td"),vp=s("generate a summary of a sequence of text or document"),kp=f(),eo=l("td"),wp=s("NLP"),yp=f(),to=l("td"),bp=s("pipeline(task=\u201Csummarization\u201D)"),Tp=f(),xe=l("tr"),ao=l("td"),Ep=s("Translation"),Ap=f(),so=l("td"),jp=s("translate text from one language into another"),qp=f(),ro=l("td"),zp=s("NLP"),Pp=f(),oo=l("td"),xp=s("pipeline(task=\u201Ctranslation\u201D)"),Fp=f(),Fe=l("tr"),no=l("td"),Mp=s("Image classification"),Sp=f(),lo=l("td"),Cp=s("assign a label to an image"),Dp=f(),io=l("td"),Ip=s("Computer vision"),Np=f(),po=l("td"),Op=s("pipeline(task=\u201Cimage-classification\u201D)"),Hp=f(),Me=l("tr"),fo=l("td"),Lp=s("Image segmentation"),Wp=f(),co=l("td"),Rp=s("assign a label to each individual pixel of an image (supports semantic, panoptic, and instance segmentation)"),Yp=f(),uo=l("td"),Up=s("Computer vision"),Kp=f(),mo=l("td"),Gp=s("pipeline(task=\u201Cimage-segmentation\u201D)"),Bp=f(),Se=l("tr"),ho=l("td"),Vp=s("Object detection"),Qp=f(),_o=l("td"),Jp=s("predict the bounding boxes and classes of objects in an image"),Zp=f(),go=l("td"),Xp=s("Computer vision"),ef=f(),$o=l("td"),tf=s("pipeline(task=\u201Cobject-detection\u201D)"),af=f(),Ce=l("tr"),vo=l("td"),sf=s("Audio classification"),rf=f(),ko=l("td"),of=s("assign a label to an audio file"),nf=f(),wo=l("td"),lf=s("Audio"),pf=f(),yo=l("td"),ff=s("pipeline(task=\u201Caudio-classification\u201D)"),cf=f(),De=l("tr"),bo=l("td"),uf=s("Automatic speech recognition"),df=f(),To=l("td"),mf=s("extract speech from an audio file into text"),hf=f(),Eo=l("td"),_f=s("Audio"),gf=f(),Ao=l("td"),$f=s("pipeline(task=\u201Cautomatic-speech-recognition\u201D)"),vf=f(),Ie=l("tr"),jo=l("td"),kf=s("Visual question answering"),wf=f(),qo=l("td"),yf=s("given an image and a question, correctly answer a question about the image"),bf=f(),zo=l("td"),Tf=s("Multimodal"),Ef=f(),Po=l("td"),Af=s("pipeline(task=\u201Cvqa\u201D)"),qn=f(),pe=l("p"),jf=s("Start by creating an instance of "),gs=l("a"),qf=s("pipeline()"),zf=s(" and specifying a task you want to use it for. You can use the "),$s=l("a"),Pf=s("pipeline()"),xf=s(" for any of the previously mentioned tasks, and for a complete list of supported tasks, take a look at the "),vs=l("a"),Ff=s("pipeline API reference"),Mf=s(". In this guide though, you\u2019ll use the "),ks=l("a"),Sf=s("pipeline()"),Cf=s(" for sentiment analysis as an example:"),zn=f(),k(na.$$.fragment),Pn=f(),ke=l("p"),Df=s("The "),ws=l("a"),If=s("pipeline()"),Nf=s(" downloads and caches a default "),la=l("a"),Of=s("pretrained model"),Hf=s(" and tokenizer for sentiment analysis. Now you can use the "),xo=l("code"),Lf=s("classifier"),Wf=s(" on your target text:"),xn=f(),k(ia.$$.fragment),Fn=f(),ht=l("p"),Rf=s("If you have more than one input, pass your inputs as a list to the "),ys=l("a"),Yf=s("pipeline()"),Uf=s(" to return a list of dictionaries:"),Mn=f(),k(pa.$$.fragment),Sn=f(),_t=l("p"),Kf=s("The "),bs=l("a"),Gf=s("pipeline()"),Bf=s(" can also iterate over an entire dataset for any task you like. For this example, let\u2019s choose automatic speech recognition as our task:"),Cn=f(),k(fa.$$.fragment),Dn=f(),We=l("p"),Vf=s("Load an audio dataset (see the \u{1F917} Datasets "),ca=l("a"),Qf=s("Quick Start"),Jf=s(" for more details) you\u2019d like to iterate over. For example, load the "),ua=l("a"),Zf=s("MInDS-14"),Xf=s(" dataset:"),In=f(),k(da.$$.fragment),Nn=f(),gt=l("p"),ec=s(`You need to make sure the sampling rate of the dataset matches the sampling
rate `),ma=l("a"),Fo=l("code"),tc=s("facebook/wav2vec2-base-960h"),ac=s(" was trained on:"),On=f(),k(ha.$$.fragment),Hn=f(),$t=l("p"),sc=s("The audio files are automatically loaded and resampled when calling the "),Mo=l("code"),rc=s('"audio"'),oc=s(` column.
Extract the raw waveform arrays from the first 4 samples and pass it as a list to the pipeline:`),Ln=f(),k(_a.$$.fragment),Wn=f(),vt=l("p"),nc=s("For larger datasets where the inputs are big (like in speech or vision), you\u2019ll want to pass a generator instead of a list to load all the inputs in memory. Take a look at the "),Ts=l("a"),lc=s("pipeline API reference"),ic=s(" for more information."),Rn=f(),tt=l("h3"),kt=l("a"),So=l("span"),k(ga.$$.fragment),pc=f(),Co=l("span"),fc=s("Use another model and tokenizer in the pipeline"),Yn=f(),fe=l("p"),cc=s("The "),Es=l("a"),uc=s("pipeline()"),dc=s(" can accommodate any model from the "),$a=l("a"),mc=s("Hub"),hc=s(", making it easy to adapt the "),As=l("a"),_c=s("pipeline()"),gc=s(" for other use-cases. For example, if you\u2019d like a model capable of handling French text, use the tags on the Hub to filter for an appropriate model. The top filtered result returns a multilingual "),va=l("a"),$c=s("BERT model"),vc=s(" finetuned for sentiment analysis you can use for French text:"),Un=f(),k(ka.$$.fragment),Kn=f(),k(wt.$$.fragment),Gn=f(),Re=l("p"),kc=s("Specify the model and tokenizer in the "),js=l("a"),wc=s("pipeline()"),yc=s(", and now you can apply the "),Do=l("code"),bc=s("classifier"),Tc=s(" on French text:"),Bn=f(),k(wa.$$.fragment),Vn=f(),Ye=l("p"),Ec=s("If you can\u2019t find a model for your use-case, you\u2019ll need to finetune a pretrained model on your data. Take a look at our "),qs=l("a"),Ac=s("finetuning tutorial"),jc=s(" to learn how. Finally, after you\u2019ve finetuned your pretrained model, please consider "),zs=l("a"),qc=s("sharing"),zc=s(" the model with the community on the Hub to democratize machine learning for everyone! \u{1F917}"),Qn=f(),at=l("h2"),yt=l("a"),Io=l("span"),k(ya.$$.fragment),Pc=f(),No=l("span"),xc=s("AutoClass"),Jn=f(),k(ba.$$.fragment),Zn=f(),re=l("p"),Fc=s("Under the hood, the "),Ps=l("a"),Mc=s("AutoModelForSequenceClassification"),Sc=s(" and "),xs=l("a"),Cc=s("AutoTokenizer"),Dc=s(" classes work together to power the "),Fs=l("a"),Ic=s("pipeline()"),Nc=s(" you used above. An "),Ms=l("a"),Oc=s("AutoClass"),Hc=s(" is a shortcut that automatically retrieves the architecture of a pretrained model from it\u2019s name or path. You only need to select the appropriate "),Oo=l("code"),Lc=s("AutoClass"),Wc=s(" for your task and it\u2019s associated preprocessing class."),Xn=f(),Ue=l("p"),Rc=s("Let\u2019s return to the example from the previous section and see how you can use the "),Ho=l("code"),Yc=s("AutoClass"),Uc=s(" to replicate the results of the "),Ss=l("a"),Kc=s("pipeline()"),Gc=s("."),el=f(),st=l("h3"),bt=l("a"),Lo=l("span"),k(Ta.$$.fragment),Bc=f(),Wo=l("span"),Vc=s("AutoTokenizer"),tl=f(),Tt=l("p"),Qc=s("A tokenizer is responsible for preprocessing text into an array of numbers as inputs to a model. There are multiple rules that govern the tokenization process, including how to split a word and at what level words should be split (learn more about tokenization in the "),Cs=l("a"),Jc=s("tokenizer summary"),Zc=s("). The most important thing to remember is you need to instantiate a tokenizer with the same model name to ensure you\u2019re using the same tokenization rules a model was pretrained with."),al=f(),Et=l("p"),Xc=s("Load a tokenizer with "),Ds=l("a"),eu=s("AutoTokenizer"),tu=s(":"),sl=f(),k(Ea.$$.fragment),rl=f(),Is=l("p"),au=s("Pass your text to the tokenizer:"),ol=f(),k(Aa.$$.fragment),nl=f(),Ns=l("p"),su=s("The tokenizer returns a dictionary containing:"),ll=f(),At=l("ul"),Os=l("li"),Hs=l("a"),ru=s("input_ids"),ou=s(": numerical representations of your tokens."),nu=f(),Ls=l("li"),Ws=l("a"),lu=s("attention_mask"),iu=s(": indicates which tokens should be attended to."),il=f(),Rs=l("p"),pu=s("A tokenizer can also accept a list of inputs, and pad and truncate the text to return a batch with uniform length:"),pl=f(),k(jt.$$.fragment),fl=f(),k(qt.$$.fragment),cl=f(),rt=l("h3"),zt=l("a"),Ro=l("span"),k(ja.$$.fragment),fu=f(),Yo=l("span"),cu=s("AutoModel"),ul=f(),k(Pt.$$.fragment),dl=f(),k(xt.$$.fragment),ml=f(),ot=l("h3"),Ft=l("a"),Uo=l("span"),k(qa.$$.fragment),uu=f(),Ko=l("span"),du=s("Save a model"),hl=f(),k(Mt.$$.fragment),_l=f(),Ke=l("p"),mu=s("One particularly cool \u{1F917} Transformers feature is the ability to save a model and reload it as either a PyTorch or TensorFlow model. The "),Go=l("code"),hu=s("from_pt"),_u=s(" or "),Bo=l("code"),gu=s("from_tf"),$u=s(" parameter can convert the model from one framework to the other:"),gl=f(),k(St.$$.fragment),$l=f(),nt=l("h2"),Ct=l("a"),Vo=l("span"),k(za.$$.fragment),vu=f(),Qo=l("span"),ku=s("Custom model builds"),vl=f(),Ys=l("p"),wu=s("You can modify the model\u2019s configuration class to change how a model is built. The configuration specifies a model\u2019s attributes, such as the number of hidden layers or attention heads. You start from scratch when you initialize a model from a custom configuration class. The model attributes are randomly initialized, and you\u2019ll need to train the model before you can use it to get meaningful results."),kl=f(),Ge=l("p"),yu=s("Start by importing "),Us=l("a"),bu=s("AutoConfig"),Tu=s(", and then load the pretrained model you want to modify. Within "),Ks=l("a"),Eu=s("AutoConfig.from_pretrained()"),Au=s(", you can specify the attribute you want to change, such as the number of attention heads:"),wl=f(),k(Pa.$$.fragment),yl=f(),k(Dt.$$.fragment),bl=f(),It=l("p"),ju=s("Take a look at the "),Gs=l("a"),qu=s("Create a custom architecture"),zu=s(" guide for more information about building custom configurations."),Tl=f(),lt=l("h2"),Nt=l("a"),Jo=l("span"),k(xa.$$.fragment),Pu=f(),Zo=l("span"),xu=s("Trainer - a PyTorch optimized training loop"),El=f(),Be=l("p"),Fu=s("All models are a standard "),Fa=l("a"),Xo=l("code"),Mu=s("torch.nn.Module"),Su=s(" so you can use them in any typical training loop. While you can write your own training loop, \u{1F917} Transformers provides a "),Bs=l("a"),Cu=s("Trainer"),Du=s(" class for PyTorch, which contains the basic training loop and adds additional functionality for features like distributed training, mixed precision, and more."),Al=f(),Ot=l("p"),Iu=s("Depending on your task, you\u2019ll typically pass the following parameters to "),Vs=l("a"),Nu=s("Trainer"),Ou=s(":"),jl=f(),ce=l("ol"),Ma=l("li"),it=l("p"),Hu=s("A "),Qs=l("a"),Lu=s("PreTrainedModel"),Wu=s(" or a "),Sa=l("a"),en=l("code"),Ru=s("torch.nn.Module"),Yu=s(":"),Uu=f(),k(Ca.$$.fragment),Ku=f(),Da=l("li"),Js=l("p"),Zs=l("a"),Gu=s("TrainingArguments"),Bu=s(" contains the model hyperparameters you can change like learning rate, batch size, and the number of epochs to train for. The default values are used if you don\u2019t specify any training arguments:"),Vu=f(),k(Ia.$$.fragment),Qu=f(),Na=l("li"),tn=l("p"),Ju=s("A preprocessing class like a tokenizer, feature extractor, or processor:"),Zu=f(),k(Oa.$$.fragment),Xu=f(),Ha=l("li"),an=l("p"),ed=s("Your preprocessed train and test datasets:"),td=f(),k(La.$$.fragment),ad=f(),Wa=l("li"),Ra=l("p"),sd=s("A "),sn=l("code"),rd=s("DataCollator()"),od=s(" to create a batch of examples from your dataset:"),nd=f(),k(Ya.$$.fragment),ql=f(),Ht=l("p"),ld=s("Now gather all these classes in "),Xs=l("a"),id=s("Trainer"),pd=s(":"),zl=f(),k(Ua.$$.fragment),Pl=f(),Lt=l("p"),fd=s("When you\u2019re ready, call "),er=l("a"),cd=s("train()"),ud=s(" to start training:"),xl=f(),k(Ka.$$.fragment),Fl=f(),k(Wt.$$.fragment),Ml=f(),Ve=l("p"),dd=s("You can customize the training loop behavior by subclassing the methods inside "),tr=l("a"),md=s("Trainer"),hd=s(". This allows you to customize features such as the loss function, optimizer, and scheduler. Take a look at the "),ar=l("a"),_d=s("Trainer"),gd=s(" reference for which methods can be subclassed."),Sl=f(),Qe=l("p"),$d=s("The other way to customize the training loop is by using "),sr=l("a"),vd=s("Callbacks"),kd=s(". You can use callbacks to integrate with other libraries and inspect the training loop to report on progress or stop the training early. Callbacks do not modify anything in the training loop itself. To customize something like the loss function, you need to subclass the "),rr=l("a"),wd=s("Trainer"),yd=s(" instead."),Cl=f(),pt=l("h2"),Rt=l("a"),rn=l("span"),k(Ga.$$.fragment),bd=f(),on=l("span"),Td=s("Train with TensorFlow"),Dl=f(),te=l("p"),Ed=s("All models are a standard "),Ba=l("a"),nn=l("code"),Ad=s("tf.keras.Model"),jd=s(" so they can be trained in TensorFlow with the "),Va=l("a"),qd=s("Keras"),zd=s(" API. \u{1F917} Transformers provides the "),or=l("a"),Pd=s("prepare_tf_dataset()"),xd=s(" method to easily load your dataset as a "),ln=l("code"),Fd=s("tf.data.Dataset"),Md=s(" so you can start training right away with Keras\u2019 "),Qa=l("a"),pn=l("code"),Sd=s("compile"),Cd=s(" and "),Ja=l("a"),fn=l("code"),Dd=s("fit"),Id=s(" methods."),Il=f(),ue=l("ol"),Za=l("li"),ft=l("p"),Nd=s("You\u2019ll start with a "),nr=l("a"),Od=s("TFPreTrainedModel"),Hd=s(" or a "),Xa=l("a"),cn=l("code"),Ld=s("tf.keras.Model"),Wd=s(":"),Rd=f(),k(es.$$.fragment),Yd=f(),ts=l("li"),un=l("p"),Ud=s("A preprocessing class like a tokenizer, feature extractor, or processor:"),Kd=f(),k(as.$$.fragment),Gd=f(),ss=l("li"),dn=l("p"),Bd=s("Create a function to tokenize the dataset:"),Vd=f(),k(rs.$$.fragment),Qd=f(),os=l("li"),ct=l("p"),Jd=s("Apply the tokenizer over the entire dataset with "),ns=l("a"),Zd=s("map"),Xd=s(" and then pass the dataset and tokenizer to "),lr=l("a"),em=s("prepare_tf_dataset()"),tm=s(". You can also change the batch size and shuffle the dataset here if you\u2019d like:"),am=f(),k(ls.$$.fragment),sm=f(),is=l("li"),ut=l("p"),rm=s("When you\u2019re ready, you can call "),mn=l("code"),om=s("compile"),nm=s(" and "),hn=l("code"),lm=s("fit"),im=s(" to start training:"),pm=f(),k(ps.$$.fragment),Nl=f(),dt=l("h2"),Yt=l("a"),_n=l("span"),k(fs.$$.fragment),fm=f(),gn=l("span"),cm=s("What's next?"),Ol=f(),ir=l("p"),um=s("Now that you\u2019ve completed the \u{1F917} Transformers quick tour, check out our guides and learn how to do more specific things like writing a custom model, fine-tuning a model for a task, and how to train a model with a script. If you\u2019re interested in learning more about \u{1F917} Transformers core concepts, grab a cup of coffee and take a look at our Conceptual Guides!"),this.h()},l(t){const u=Pg('[data-svelte="svelte-1phssyn"]',document.head);o=i(u,"META",{name:!0,content:!0}),u.forEach(a),m=c(t),n=i(t,"H1",{class:!0});var cs=p(n);_=i(cs,"A",{id:!0,class:!0,href:!0});var $n=p(_);$=i($n,"SPAN",{});var vn=p($);w(v.$$.fragment,vn),vn.forEach(a),$n.forEach(a),q=c(cs),F=i(cs,"SPAN",{});var kn=p(F);g=r(kn,"Quick tour"),kn.forEach(a),cs.forEach(a),j=c(t),w(C.$$.fragment,t),N=c(t),I=i(t,"P",{});var Ne=p(I);W=r(Ne,"Get up and running with \u{1F917} Transformers! Whether you\u2019re a developer or an everyday user, this quick tour will help you get started and show you how to use the "),z=i(Ne,"A",{href:!0});var wn=p(z);S=r(wn,"pipeline()"),wn.forEach(a),A=r(Ne," for inference, load a pretrained model and preprocessor with an "),D=i(Ne,"A",{href:!0});var yn=p(D);K=r(yn,"AutoClass"),yn.forEach(a),R=r(Ne,", and quickly train a model with PyTorch or TensorFlow. If you\u2019re a beginner, we recommend checking out our tutorials or "),V=i(Ne,"A",{href:!0,rel:!0});var bn=p(V);ie=r(bn,"course"),bn.forEach(a),oe=r(Ne," next for more in-depth explanations of the concepts introduced here."),Ne.forEach(a),he=c(t),G=i(t,"P",{});var Tn=p(G);ne=r(Tn,"Before you begin, make sure you have all the necessary libraries installed:"),Tn.forEach(a),le=c(t),w(B.$$.fragment,t),ge=c(t),J=i(t,"P",{});var En=p(J);be=r(En,"You\u2019ll also need to install your preferred machine learning framework:"),En.forEach(a),$e=c(t),w(Q.$$.fragment,t),se=c(t),Z=i(t,"H2",{class:!0});var Ll=p(Z);P=i(Ll,"A",{id:!0,class:!0,href:!0});var _m=p(P);H=i(_m,"SPAN",{});var gm=p(H);w(X.$$.fragment,gm),gm.forEach(a),_m.forEach(a),M=c(Ll),L=i(Ll,"SPAN",{});var $m=p(L);ve=r($m,"Pipeline"),$m.forEach(a),Ll.forEach(a),He=c(t),w(ae.$$.fragment,t),Le=c(t),ee=i(t,"P",{});var pr=p(ee);ds=r(pr,"The "),_e=i(pr,"A",{href:!0});var vm=p(_e);ms=r(vm,"pipeline()"),vm.forEach(a),hs=r(pr," is the easiest way to use a pretrained model for inference. You can use the "),_s=i(pr,"A",{href:!0});var km=p(_s);wi=r(km,"pipeline()"),km.forEach(a),yi=r(pr," out-of-the-box for many tasks across different modalities. Take a look at the table below for some supported tasks:"),pr.forEach(a),jn=c(t),mt=i(t,"TABLE",{});var Wl=p(mt);br=i(Wl,"THEAD",{});var wm=p(br);Te=i(wm,"TR",{});var Ut=p(Te);Tr=i(Ut,"TH",{});var ym=p(Tr);Er=i(ym,"STRONG",{});var bm=p(Er);bi=r(bm,"Task"),bm.forEach(a),ym.forEach(a),Ti=c(Ut),Ar=i(Ut,"TH",{});var Tm=p(Ar);jr=i(Tm,"STRONG",{});var Em=p(jr);Ei=r(Em,"Description"),Em.forEach(a),Tm.forEach(a),Ai=c(Ut),qr=i(Ut,"TH",{});var Am=p(qr);zr=i(Am,"STRONG",{});var jm=p(zr);ji=r(jm,"Modality"),jm.forEach(a),Am.forEach(a),qi=c(Ut),Pr=i(Ut,"TH",{});var qm=p(Pr);xr=i(qm,"STRONG",{});var zm=p(xr);zi=r(zm,"Pipeline identifier"),zm.forEach(a),qm.forEach(a),Ut.forEach(a),wm.forEach(a),Pi=c(Wl),Y=i(Wl,"TBODY",{});var U=p(Y);Ee=i(U,"TR",{});var Kt=p(Ee);Fr=i(Kt,"TD",{});var Pm=p(Fr);xi=r(Pm,"Text classification"),Pm.forEach(a),Fi=c(Kt),Mr=i(Kt,"TD",{});var xm=p(Mr);Mi=r(xm,"assign a label to a given sequence of text"),xm.forEach(a),Si=c(Kt),Sr=i(Kt,"TD",{});var Fm=p(Sr);Ci=r(Fm,"NLP"),Fm.forEach(a),Di=c(Kt),Cr=i(Kt,"TD",{});var Mm=p(Cr);Ii=r(Mm,"pipeline(task=\u201Csentiment-analysis\u201D)"),Mm.forEach(a),Kt.forEach(a),Ni=c(U),Ae=i(U,"TR",{});var Gt=p(Ae);Dr=i(Gt,"TD",{});var Sm=p(Dr);Oi=r(Sm,"Text generation"),Sm.forEach(a),Hi=c(Gt),Ir=i(Gt,"TD",{});var Cm=p(Ir);Li=r(Cm,"generate text that follows a given prompt"),Cm.forEach(a),Wi=c(Gt),Nr=i(Gt,"TD",{});var Dm=p(Nr);Ri=r(Dm,"NLP"),Dm.forEach(a),Yi=c(Gt),Or=i(Gt,"TD",{});var Im=p(Or);Ui=r(Im,"pipeline(task=\u201Ctext-generation\u201D)"),Im.forEach(a),Gt.forEach(a),Ki=c(U),je=i(U,"TR",{});var Bt=p(je);Hr=i(Bt,"TD",{});var Nm=p(Hr);Gi=r(Nm,"Name entity recognition"),Nm.forEach(a),Bi=c(Bt),Lr=i(Bt,"TD",{});var Om=p(Lr);Vi=r(Om,"assign a label to each token in a sequence (people, organization, location, etc.)"),Om.forEach(a),Qi=c(Bt),Wr=i(Bt,"TD",{});var Hm=p(Wr);Ji=r(Hm,"NLP"),Hm.forEach(a),Zi=c(Bt),Rr=i(Bt,"TD",{});var Lm=p(Rr);Xi=r(Lm,"pipeline(task=\u201Cner\u201D)"),Lm.forEach(a),Bt.forEach(a),ep=c(U),qe=i(U,"TR",{});var Vt=p(qe);Yr=i(Vt,"TD",{});var Wm=p(Yr);tp=r(Wm,"Question answering"),Wm.forEach(a),ap=c(Vt),Ur=i(Vt,"TD",{});var Rm=p(Ur);sp=r(Rm,"extract an answer from the text given some context and a question"),Rm.forEach(a),rp=c(Vt),Kr=i(Vt,"TD",{});var Ym=p(Kr);op=r(Ym,"NLP"),Ym.forEach(a),np=c(Vt),Gr=i(Vt,"TD",{});var Um=p(Gr);lp=r(Um,"pipeline(task=\u201Cquestion-answering\u201D)"),Um.forEach(a),Vt.forEach(a),ip=c(U),ze=i(U,"TR",{});var Qt=p(ze);Br=i(Qt,"TD",{});var Km=p(Br);pp=r(Km,"Fill-mask"),Km.forEach(a),fp=c(Qt),Vr=i(Qt,"TD",{});var Gm=p(Vr);cp=r(Gm,"predict the correct masked token in a sequence"),Gm.forEach(a),up=c(Qt),Qr=i(Qt,"TD",{});var Bm=p(Qr);dp=r(Bm,"NLP"),Bm.forEach(a),mp=c(Qt),Jr=i(Qt,"TD",{});var Vm=p(Jr);hp=r(Vm,"pipeline(task=\u201Cfill-mask\u201D)"),Vm.forEach(a),Qt.forEach(a),_p=c(U),Pe=i(U,"TR",{});var Jt=p(Pe);Zr=i(Jt,"TD",{});var Qm=p(Zr);gp=r(Qm,"Summarization"),Qm.forEach(a),$p=c(Jt),Xr=i(Jt,"TD",{});var Jm=p(Xr);vp=r(Jm,"generate a summary of a sequence of text or document"),Jm.forEach(a),kp=c(Jt),eo=i(Jt,"TD",{});var Zm=p(eo);wp=r(Zm,"NLP"),Zm.forEach(a),yp=c(Jt),to=i(Jt,"TD",{});var Xm=p(to);bp=r(Xm,"pipeline(task=\u201Csummarization\u201D)"),Xm.forEach(a),Jt.forEach(a),Tp=c(U),xe=i(U,"TR",{});var Zt=p(xe);ao=i(Zt,"TD",{});var eh=p(ao);Ep=r(eh,"Translation"),eh.forEach(a),Ap=c(Zt),so=i(Zt,"TD",{});var th=p(so);jp=r(th,"translate text from one language into another"),th.forEach(a),qp=c(Zt),ro=i(Zt,"TD",{});var ah=p(ro);zp=r(ah,"NLP"),ah.forEach(a),Pp=c(Zt),oo=i(Zt,"TD",{});var sh=p(oo);xp=r(sh,"pipeline(task=\u201Ctranslation\u201D)"),sh.forEach(a),Zt.forEach(a),Fp=c(U),Fe=i(U,"TR",{});var Xt=p(Fe);no=i(Xt,"TD",{});var rh=p(no);Mp=r(rh,"Image classification"),rh.forEach(a),Sp=c(Xt),lo=i(Xt,"TD",{});var oh=p(lo);Cp=r(oh,"assign a label to an image"),oh.forEach(a),Dp=c(Xt),io=i(Xt,"TD",{});var nh=p(io);Ip=r(nh,"Computer vision"),nh.forEach(a),Np=c(Xt),po=i(Xt,"TD",{});var lh=p(po);Op=r(lh,"pipeline(task=\u201Cimage-classification\u201D)"),lh.forEach(a),Xt.forEach(a),Hp=c(U),Me=i(U,"TR",{});var ea=p(Me);fo=i(ea,"TD",{});var ih=p(fo);Lp=r(ih,"Image segmentation"),ih.forEach(a),Wp=c(ea),co=i(ea,"TD",{});var ph=p(co);Rp=r(ph,"assign a label to each individual pixel of an image (supports semantic, panoptic, and instance segmentation)"),ph.forEach(a),Yp=c(ea),uo=i(ea,"TD",{});var fh=p(uo);Up=r(fh,"Computer vision"),fh.forEach(a),Kp=c(ea),mo=i(ea,"TD",{});var ch=p(mo);Gp=r(ch,"pipeline(task=\u201Cimage-segmentation\u201D)"),ch.forEach(a),ea.forEach(a),Bp=c(U),Se=i(U,"TR",{});var ta=p(Se);ho=i(ta,"TD",{});var uh=p(ho);Vp=r(uh,"Object detection"),uh.forEach(a),Qp=c(ta),_o=i(ta,"TD",{});var dh=p(_o);Jp=r(dh,"predict the bounding boxes and classes of objects in an image"),dh.forEach(a),Zp=c(ta),go=i(ta,"TD",{});var mh=p(go);Xp=r(mh,"Computer vision"),mh.forEach(a),ef=c(ta),$o=i(ta,"TD",{});var hh=p($o);tf=r(hh,"pipeline(task=\u201Cobject-detection\u201D)"),hh.forEach(a),ta.forEach(a),af=c(U),Ce=i(U,"TR",{});var aa=p(Ce);vo=i(aa,"TD",{});var _h=p(vo);sf=r(_h,"Audio classification"),_h.forEach(a),rf=c(aa),ko=i(aa,"TD",{});var gh=p(ko);of=r(gh,"assign a label to an audio file"),gh.forEach(a),nf=c(aa),wo=i(aa,"TD",{});var $h=p(wo);lf=r($h,"Audio"),$h.forEach(a),pf=c(aa),yo=i(aa,"TD",{});var vh=p(yo);ff=r(vh,"pipeline(task=\u201Caudio-classification\u201D)"),vh.forEach(a),aa.forEach(a),cf=c(U),De=i(U,"TR",{});var sa=p(De);bo=i(sa,"TD",{});var kh=p(bo);uf=r(kh,"Automatic speech recognition"),kh.forEach(a),df=c(sa),To=i(sa,"TD",{});var wh=p(To);mf=r(wh,"extract speech from an audio file into text"),wh.forEach(a),hf=c(sa),Eo=i(sa,"TD",{});var yh=p(Eo);_f=r(yh,"Audio"),yh.forEach(a),gf=c(sa),Ao=i(sa,"TD",{});var bh=p(Ao);$f=r(bh,"pipeline(task=\u201Cautomatic-speech-recognition\u201D)"),bh.forEach(a),sa.forEach(a),vf=c(U),Ie=i(U,"TR",{});var ra=p(Ie);jo=i(ra,"TD",{});var Th=p(jo);kf=r(Th,"Visual question answering"),Th.forEach(a),wf=c(ra),qo=i(ra,"TD",{});var Eh=p(qo);yf=r(Eh,"given an image and a question, correctly answer a question about the image"),Eh.forEach(a),bf=c(ra),zo=i(ra,"TD",{});var Ah=p(zo);Tf=r(Ah,"Multimodal"),Ah.forEach(a),Ef=c(ra),Po=i(ra,"TD",{});var jh=p(Po);Af=r(jh,"pipeline(task=\u201Cvqa\u201D)"),jh.forEach(a),ra.forEach(a),U.forEach(a),Wl.forEach(a),qn=c(t),pe=i(t,"P",{});var Je=p(pe);jf=r(Je,"Start by creating an instance of "),gs=i(Je,"A",{href:!0});var qh=p(gs);qf=r(qh,"pipeline()"),qh.forEach(a),zf=r(Je," and specifying a task you want to use it for. You can use the "),$s=i(Je,"A",{href:!0});var zh=p($s);Pf=r(zh,"pipeline()"),zh.forEach(a),xf=r(Je," for any of the previously mentioned tasks, and for a complete list of supported tasks, take a look at the "),vs=i(Je,"A",{href:!0});var Ph=p(vs);Ff=r(Ph,"pipeline API reference"),Ph.forEach(a),Mf=r(Je,". In this guide though, you\u2019ll use the "),ks=i(Je,"A",{href:!0});var xh=p(ks);Sf=r(xh,"pipeline()"),xh.forEach(a),Cf=r(Je," for sentiment analysis as an example:"),Je.forEach(a),zn=c(t),w(na.$$.fragment,t),Pn=c(t),ke=i(t,"P",{});var oa=p(ke);Df=r(oa,"The "),ws=i(oa,"A",{href:!0});var Fh=p(ws);If=r(Fh,"pipeline()"),Fh.forEach(a),Nf=r(oa," downloads and caches a default "),la=i(oa,"A",{href:!0,rel:!0});var Mh=p(la);Of=r(Mh,"pretrained model"),Mh.forEach(a),Hf=r(oa," and tokenizer for sentiment analysis. Now you can use the "),xo=i(oa,"CODE",{});var Sh=p(xo);Lf=r(Sh,"classifier"),Sh.forEach(a),Wf=r(oa," on your target text:"),oa.forEach(a),xn=c(t),w(ia.$$.fragment,t),Fn=c(t),ht=i(t,"P",{});var Rl=p(ht);Rf=r(Rl,"If you have more than one input, pass your inputs as a list to the "),ys=i(Rl,"A",{href:!0});var Ch=p(ys);Yf=r(Ch,"pipeline()"),Ch.forEach(a),Uf=r(Rl," to return a list of dictionaries:"),Rl.forEach(a),Mn=c(t),w(pa.$$.fragment,t),Sn=c(t),_t=i(t,"P",{});var Yl=p(_t);Kf=r(Yl,"The "),bs=i(Yl,"A",{href:!0});var Dh=p(bs);Gf=r(Dh,"pipeline()"),Dh.forEach(a),Bf=r(Yl," can also iterate over an entire dataset for any task you like. For this example, let\u2019s choose automatic speech recognition as our task:"),Yl.forEach(a),Cn=c(t),w(fa.$$.fragment,t),Dn=c(t),We=i(t,"P",{});var fr=p(We);Vf=r(fr,"Load an audio dataset (see the \u{1F917} Datasets "),ca=i(fr,"A",{href:!0,rel:!0});var Ih=p(ca);Qf=r(Ih,"Quick Start"),Ih.forEach(a),Jf=r(fr," for more details) you\u2019d like to iterate over. For example, load the "),ua=i(fr,"A",{href:!0,rel:!0});var Nh=p(ua);Zf=r(Nh,"MInDS-14"),Nh.forEach(a),Xf=r(fr," dataset:"),fr.forEach(a),In=c(t),w(da.$$.fragment,t),Nn=c(t),gt=i(t,"P",{});var Ul=p(gt);ec=r(Ul,`You need to make sure the sampling rate of the dataset matches the sampling
rate `),ma=i(Ul,"A",{href:!0,rel:!0});var Oh=p(ma);Fo=i(Oh,"CODE",{});var Hh=p(Fo);tc=r(Hh,"facebook/wav2vec2-base-960h"),Hh.forEach(a),Oh.forEach(a),ac=r(Ul," was trained on:"),Ul.forEach(a),On=c(t),w(ha.$$.fragment,t),Hn=c(t),$t=i(t,"P",{});var Kl=p($t);sc=r(Kl,"The audio files are automatically loaded and resampled when calling the "),Mo=i(Kl,"CODE",{});var Lh=p(Mo);rc=r(Lh,'"audio"'),Lh.forEach(a),oc=r(Kl,` column.
Extract the raw waveform arrays from the first 4 samples and pass it as a list to the pipeline:`),Kl.forEach(a),Ln=c(t),w(_a.$$.fragment,t),Wn=c(t),vt=i(t,"P",{});var Gl=p(vt);nc=r(Gl,"For larger datasets where the inputs are big (like in speech or vision), you\u2019ll want to pass a generator instead of a list to load all the inputs in memory. Take a look at the "),Ts=i(Gl,"A",{href:!0});var Wh=p(Ts);lc=r(Wh,"pipeline API reference"),Wh.forEach(a),ic=r(Gl," for more information."),Gl.forEach(a),Rn=c(t),tt=i(t,"H3",{class:!0});var Bl=p(tt);kt=i(Bl,"A",{id:!0,class:!0,href:!0});var Rh=p(kt);So=i(Rh,"SPAN",{});var Yh=p(So);w(ga.$$.fragment,Yh),Yh.forEach(a),Rh.forEach(a),pc=c(Bl),Co=i(Bl,"SPAN",{});var Uh=p(Co);fc=r(Uh,"Use another model and tokenizer in the pipeline"),Uh.forEach(a),Bl.forEach(a),Yn=c(t),fe=i(t,"P",{});var Ze=p(fe);cc=r(Ze,"The "),Es=i(Ze,"A",{href:!0});var Kh=p(Es);uc=r(Kh,"pipeline()"),Kh.forEach(a),dc=r(Ze," can accommodate any model from the "),$a=i(Ze,"A",{href:!0,rel:!0});var Gh=p($a);mc=r(Gh,"Hub"),Gh.forEach(a),hc=r(Ze,", making it easy to adapt the "),As=i(Ze,"A",{href:!0});var Bh=p(As);_c=r(Bh,"pipeline()"),Bh.forEach(a),gc=r(Ze," for other use-cases. For example, if you\u2019d like a model capable of handling French text, use the tags on the Hub to filter for an appropriate model. The top filtered result returns a multilingual "),va=i(Ze,"A",{href:!0,rel:!0});var Vh=p(va);$c=r(Vh,"BERT model"),Vh.forEach(a),vc=r(Ze," finetuned for sentiment analysis you can use for French text:"),Ze.forEach(a),Un=c(t),w(ka.$$.fragment,t),Kn=c(t),w(wt.$$.fragment,t),Gn=c(t),Re=i(t,"P",{});var cr=p(Re);kc=r(cr,"Specify the model and tokenizer in the "),js=i(cr,"A",{href:!0});var Qh=p(js);wc=r(Qh,"pipeline()"),Qh.forEach(a),yc=r(cr,", and now you can apply the "),Do=i(cr,"CODE",{});var Jh=p(Do);bc=r(Jh,"classifier"),Jh.forEach(a),Tc=r(cr," on French text:"),cr.forEach(a),Bn=c(t),w(wa.$$.fragment,t),Vn=c(t),Ye=i(t,"P",{});var ur=p(Ye);Ec=r(ur,"If you can\u2019t find a model for your use-case, you\u2019ll need to finetune a pretrained model on your data. Take a look at our "),qs=i(ur,"A",{href:!0});var Zh=p(qs);Ac=r(Zh,"finetuning tutorial"),Zh.forEach(a),jc=r(ur," to learn how. Finally, after you\u2019ve finetuned your pretrained model, please consider "),zs=i(ur,"A",{href:!0});var Xh=p(zs);qc=r(Xh,"sharing"),Xh.forEach(a),zc=r(ur," the model with the community on the Hub to democratize machine learning for everyone! \u{1F917}"),ur.forEach(a),Qn=c(t),at=i(t,"H2",{class:!0});var Vl=p(at);yt=i(Vl,"A",{id:!0,class:!0,href:!0});var e_=p(yt);Io=i(e_,"SPAN",{});var t_=p(Io);w(ya.$$.fragment,t_),t_.forEach(a),e_.forEach(a),Pc=c(Vl),No=i(Vl,"SPAN",{});var a_=p(No);xc=r(a_,"AutoClass"),a_.forEach(a),Vl.forEach(a),Jn=c(t),w(ba.$$.fragment,t),Zn=c(t),re=i(t,"P",{});var we=p(re);Fc=r(we,"Under the hood, the "),Ps=i(we,"A",{href:!0});var s_=p(Ps);Mc=r(s_,"AutoModelForSequenceClassification"),s_.forEach(a),Sc=r(we," and "),xs=i(we,"A",{href:!0});var r_=p(xs);Cc=r(r_,"AutoTokenizer"),r_.forEach(a),Dc=r(we," classes work together to power the "),Fs=i(we,"A",{href:!0});var o_=p(Fs);Ic=r(o_,"pipeline()"),o_.forEach(a),Nc=r(we," you used above. An "),Ms=i(we,"A",{href:!0});var n_=p(Ms);Oc=r(n_,"AutoClass"),n_.forEach(a),Hc=r(we," is a shortcut that automatically retrieves the architecture of a pretrained model from it\u2019s name or path. You only need to select the appropriate "),Oo=i(we,"CODE",{});var l_=p(Oo);Lc=r(l_,"AutoClass"),l_.forEach(a),Wc=r(we," for your task and it\u2019s associated preprocessing class."),we.forEach(a),Xn=c(t),Ue=i(t,"P",{});var dr=p(Ue);Rc=r(dr,"Let\u2019s return to the example from the previous section and see how you can use the "),Ho=i(dr,"CODE",{});var i_=p(Ho);Yc=r(i_,"AutoClass"),i_.forEach(a),Uc=r(dr," to replicate the results of the "),Ss=i(dr,"A",{href:!0});var p_=p(Ss);Kc=r(p_,"pipeline()"),p_.forEach(a),Gc=r(dr,"."),dr.forEach(a),el=c(t),st=i(t,"H3",{class:!0});var Ql=p(st);bt=i(Ql,"A",{id:!0,class:!0,href:!0});var f_=p(bt);Lo=i(f_,"SPAN",{});var c_=p(Lo);w(Ta.$$.fragment,c_),c_.forEach(a),f_.forEach(a),Bc=c(Ql),Wo=i(Ql,"SPAN",{});var u_=p(Wo);Vc=r(u_,"AutoTokenizer"),u_.forEach(a),Ql.forEach(a),tl=c(t),Tt=i(t,"P",{});var Jl=p(Tt);Qc=r(Jl,"A tokenizer is responsible for preprocessing text into an array of numbers as inputs to a model. There are multiple rules that govern the tokenization process, including how to split a word and at what level words should be split (learn more about tokenization in the "),Cs=i(Jl,"A",{href:!0});var d_=p(Cs);Jc=r(d_,"tokenizer summary"),d_.forEach(a),Zc=r(Jl,"). The most important thing to remember is you need to instantiate a tokenizer with the same model name to ensure you\u2019re using the same tokenization rules a model was pretrained with."),Jl.forEach(a),al=c(t),Et=i(t,"P",{});var Zl=p(Et);Xc=r(Zl,"Load a tokenizer with "),Ds=i(Zl,"A",{href:!0});var m_=p(Ds);eu=r(m_,"AutoTokenizer"),m_.forEach(a),tu=r(Zl,":"),Zl.forEach(a),sl=c(t),w(Ea.$$.fragment,t),rl=c(t),Is=i(t,"P",{});var h_=p(Is);au=r(h_,"Pass your text to the tokenizer:"),h_.forEach(a),ol=c(t),w(Aa.$$.fragment,t),nl=c(t),Ns=i(t,"P",{});var __=p(Ns);su=r(__,"The tokenizer returns a dictionary containing:"),__.forEach(a),ll=c(t),At=i(t,"UL",{});var Xl=p(At);Os=i(Xl,"LI",{});var dm=p(Os);Hs=i(dm,"A",{href:!0});var g_=p(Hs);ru=r(g_,"input_ids"),g_.forEach(a),ou=r(dm,": numerical representations of your tokens."),dm.forEach(a),nu=c(Xl),Ls=i(Xl,"LI",{});var mm=p(Ls);Ws=i(mm,"A",{href:!0});var $_=p(Ws);lu=r($_,"attention_mask"),$_.forEach(a),iu=r(mm,": indicates which tokens should be attended to."),mm.forEach(a),Xl.forEach(a),il=c(t),Rs=i(t,"P",{});var v_=p(Rs);pu=r(v_,"A tokenizer can also accept a list of inputs, and pad and truncate the text to return a batch with uniform length:"),v_.forEach(a),pl=c(t),w(jt.$$.fragment,t),fl=c(t),w(qt.$$.fragment,t),cl=c(t),rt=i(t,"H3",{class:!0});var ei=p(rt);zt=i(ei,"A",{id:!0,class:!0,href:!0});var k_=p(zt);Ro=i(k_,"SPAN",{});var w_=p(Ro);w(ja.$$.fragment,w_),w_.forEach(a),k_.forEach(a),fu=c(ei),Yo=i(ei,"SPAN",{});var y_=p(Yo);cu=r(y_,"AutoModel"),y_.forEach(a),ei.forEach(a),ul=c(t),w(Pt.$$.fragment,t),dl=c(t),w(xt.$$.fragment,t),ml=c(t),ot=i(t,"H3",{class:!0});var ti=p(ot);Ft=i(ti,"A",{id:!0,class:!0,href:!0});var b_=p(Ft);Uo=i(b_,"SPAN",{});var T_=p(Uo);w(qa.$$.fragment,T_),T_.forEach(a),b_.forEach(a),uu=c(ti),Ko=i(ti,"SPAN",{});var E_=p(Ko);du=r(E_,"Save a model"),E_.forEach(a),ti.forEach(a),hl=c(t),w(Mt.$$.fragment,t),_l=c(t),Ke=i(t,"P",{});var mr=p(Ke);mu=r(mr,"One particularly cool \u{1F917} Transformers feature is the ability to save a model and reload it as either a PyTorch or TensorFlow model. The "),Go=i(mr,"CODE",{});var A_=p(Go);hu=r(A_,"from_pt"),A_.forEach(a),_u=r(mr," or "),Bo=i(mr,"CODE",{});var j_=p(Bo);gu=r(j_,"from_tf"),j_.forEach(a),$u=r(mr," parameter can convert the model from one framework to the other:"),mr.forEach(a),gl=c(t),w(St.$$.fragment,t),$l=c(t),nt=i(t,"H2",{class:!0});var ai=p(nt);Ct=i(ai,"A",{id:!0,class:!0,href:!0});var q_=p(Ct);Vo=i(q_,"SPAN",{});var z_=p(Vo);w(za.$$.fragment,z_),z_.forEach(a),q_.forEach(a),vu=c(ai),Qo=i(ai,"SPAN",{});var P_=p(Qo);ku=r(P_,"Custom model builds"),P_.forEach(a),ai.forEach(a),vl=c(t),Ys=i(t,"P",{});var x_=p(Ys);wu=r(x_,"You can modify the model\u2019s configuration class to change how a model is built. The configuration specifies a model\u2019s attributes, such as the number of hidden layers or attention heads. You start from scratch when you initialize a model from a custom configuration class. The model attributes are randomly initialized, and you\u2019ll need to train the model before you can use it to get meaningful results."),x_.forEach(a),kl=c(t),Ge=i(t,"P",{});var hr=p(Ge);yu=r(hr,"Start by importing "),Us=i(hr,"A",{href:!0});var F_=p(Us);bu=r(F_,"AutoConfig"),F_.forEach(a),Tu=r(hr,", and then load the pretrained model you want to modify. Within "),Ks=i(hr,"A",{href:!0});var M_=p(Ks);Eu=r(M_,"AutoConfig.from_pretrained()"),M_.forEach(a),Au=r(hr,", you can specify the attribute you want to change, such as the number of attention heads:"),hr.forEach(a),wl=c(t),w(Pa.$$.fragment,t),yl=c(t),w(Dt.$$.fragment,t),bl=c(t),It=i(t,"P",{});var si=p(It);ju=r(si,"Take a look at the "),Gs=i(si,"A",{href:!0});var S_=p(Gs);qu=r(S_,"Create a custom architecture"),S_.forEach(a),zu=r(si," guide for more information about building custom configurations."),si.forEach(a),Tl=c(t),lt=i(t,"H2",{class:!0});var ri=p(lt);Nt=i(ri,"A",{id:!0,class:!0,href:!0});var C_=p(Nt);Jo=i(C_,"SPAN",{});var D_=p(Jo);w(xa.$$.fragment,D_),D_.forEach(a),C_.forEach(a),Pu=c(ri),Zo=i(ri,"SPAN",{});var I_=p(Zo);xu=r(I_,"Trainer - a PyTorch optimized training loop"),I_.forEach(a),ri.forEach(a),El=c(t),Be=i(t,"P",{});var _r=p(Be);Fu=r(_r,"All models are a standard "),Fa=i(_r,"A",{href:!0,rel:!0});var N_=p(Fa);Xo=i(N_,"CODE",{});var O_=p(Xo);Mu=r(O_,"torch.nn.Module"),O_.forEach(a),N_.forEach(a),Su=r(_r," so you can use them in any typical training loop. While you can write your own training loop, \u{1F917} Transformers provides a "),Bs=i(_r,"A",{href:!0});var H_=p(Bs);Cu=r(H_,"Trainer"),H_.forEach(a),Du=r(_r," class for PyTorch, which contains the basic training loop and adds additional functionality for features like distributed training, mixed precision, and more."),_r.forEach(a),Al=c(t),Ot=i(t,"P",{});var oi=p(Ot);Iu=r(oi,"Depending on your task, you\u2019ll typically pass the following parameters to "),Vs=i(oi,"A",{href:!0});var L_=p(Vs);Nu=r(L_,"Trainer"),L_.forEach(a),Ou=r(oi,":"),oi.forEach(a),jl=c(t),ce=i(t,"OL",{});var Xe=p(ce);Ma=i(Xe,"LI",{});var ni=p(Ma);it=i(ni,"P",{});var gr=p(it);Hu=r(gr,"A "),Qs=i(gr,"A",{href:!0});var W_=p(Qs);Lu=r(W_,"PreTrainedModel"),W_.forEach(a),Wu=r(gr," or a "),Sa=i(gr,"A",{href:!0,rel:!0});var R_=p(Sa);en=i(R_,"CODE",{});var Y_=p(en);Ru=r(Y_,"torch.nn.Module"),Y_.forEach(a),R_.forEach(a),Yu=r(gr,":"),gr.forEach(a),Uu=c(ni),w(Ca.$$.fragment,ni),ni.forEach(a),Ku=c(Xe),Da=i(Xe,"LI",{});var li=p(Da);Js=i(li,"P",{});var hm=p(Js);Zs=i(hm,"A",{href:!0});var U_=p(Zs);Gu=r(U_,"TrainingArguments"),U_.forEach(a),Bu=r(hm," contains the model hyperparameters you can change like learning rate, batch size, and the number of epochs to train for. The default values are used if you don\u2019t specify any training arguments:"),hm.forEach(a),Vu=c(li),w(Ia.$$.fragment,li),li.forEach(a),Qu=c(Xe),Na=i(Xe,"LI",{});var ii=p(Na);tn=i(ii,"P",{});var K_=p(tn);Ju=r(K_,"A preprocessing class like a tokenizer, feature extractor, or processor:"),K_.forEach(a),Zu=c(ii),w(Oa.$$.fragment,ii),ii.forEach(a),Xu=c(Xe),Ha=i(Xe,"LI",{});var pi=p(Ha);an=i(pi,"P",{});var G_=p(an);ed=r(G_,"Your preprocessed train and test datasets:"),G_.forEach(a),td=c(pi),w(La.$$.fragment,pi),pi.forEach(a),ad=c(Xe),Wa=i(Xe,"LI",{});var fi=p(Wa);Ra=i(fi,"P",{});var ci=p(Ra);sd=r(ci,"A "),sn=i(ci,"CODE",{});var B_=p(sn);rd=r(B_,"DataCollator()"),B_.forEach(a),od=r(ci," to create a batch of examples from your dataset:"),ci.forEach(a),nd=c(fi),w(Ya.$$.fragment,fi),fi.forEach(a),Xe.forEach(a),ql=c(t),Ht=i(t,"P",{});var ui=p(Ht);ld=r(ui,"Now gather all these classes in "),Xs=i(ui,"A",{href:!0});var V_=p(Xs);id=r(V_,"Trainer"),V_.forEach(a),pd=r(ui,":"),ui.forEach(a),zl=c(t),w(Ua.$$.fragment,t),Pl=c(t),Lt=i(t,"P",{});var di=p(Lt);fd=r(di,"When you\u2019re ready, call "),er=i(di,"A",{href:!0});var Q_=p(er);cd=r(Q_,"train()"),Q_.forEach(a),ud=r(di," to start training:"),di.forEach(a),xl=c(t),w(Ka.$$.fragment,t),Fl=c(t),w(Wt.$$.fragment,t),Ml=c(t),Ve=i(t,"P",{});var $r=p(Ve);dd=r($r,"You can customize the training loop behavior by subclassing the methods inside "),tr=i($r,"A",{href:!0});var J_=p(tr);md=r(J_,"Trainer"),J_.forEach(a),hd=r($r,". This allows you to customize features such as the loss function, optimizer, and scheduler. Take a look at the "),ar=i($r,"A",{href:!0});var Z_=p(ar);_d=r(Z_,"Trainer"),Z_.forEach(a),gd=r($r," reference for which methods can be subclassed."),$r.forEach(a),Sl=c(t),Qe=i(t,"P",{});var vr=p(Qe);$d=r(vr,"The other way to customize the training loop is by using "),sr=i(vr,"A",{href:!0});var X_=p(sr);vd=r(X_,"Callbacks"),X_.forEach(a),kd=r(vr,". You can use callbacks to integrate with other libraries and inspect the training loop to report on progress or stop the training early. Callbacks do not modify anything in the training loop itself. To customize something like the loss function, you need to subclass the "),rr=i(vr,"A",{href:!0});var eg=p(rr);wd=r(eg,"Trainer"),eg.forEach(a),yd=r(vr," instead."),vr.forEach(a),Cl=c(t),pt=i(t,"H2",{class:!0});var mi=p(pt);Rt=i(mi,"A",{id:!0,class:!0,href:!0});var tg=p(Rt);rn=i(tg,"SPAN",{});var ag=p(rn);w(Ga.$$.fragment,ag),ag.forEach(a),tg.forEach(a),bd=c(mi),on=i(mi,"SPAN",{});var sg=p(on);Td=r(sg,"Train with TensorFlow"),sg.forEach(a),mi.forEach(a),Dl=c(t),te=i(t,"P",{});var de=p(te);Ed=r(de,"All models are a standard "),Ba=i(de,"A",{href:!0,rel:!0});var rg=p(Ba);nn=i(rg,"CODE",{});var og=p(nn);Ad=r(og,"tf.keras.Model"),og.forEach(a),rg.forEach(a),jd=r(de," so they can be trained in TensorFlow with the "),Va=i(de,"A",{href:!0,rel:!0});var ng=p(Va);qd=r(ng,"Keras"),ng.forEach(a),zd=r(de," API. \u{1F917} Transformers provides the "),or=i(de,"A",{href:!0});var lg=p(or);Pd=r(lg,"prepare_tf_dataset()"),lg.forEach(a),xd=r(de," method to easily load your dataset as a "),ln=i(de,"CODE",{});var ig=p(ln);Fd=r(ig,"tf.data.Dataset"),ig.forEach(a),Md=r(de," so you can start training right away with Keras\u2019 "),Qa=i(de,"A",{href:!0,rel:!0});var pg=p(Qa);pn=i(pg,"CODE",{});var fg=p(pn);Sd=r(fg,"compile"),fg.forEach(a),pg.forEach(a),Cd=r(de," and "),Ja=i(de,"A",{href:!0,rel:!0});var cg=p(Ja);fn=i(cg,"CODE",{});var ug=p(fn);Dd=r(ug,"fit"),ug.forEach(a),cg.forEach(a),Id=r(de," methods."),de.forEach(a),Il=c(t),ue=i(t,"OL",{});var et=p(ue);Za=i(et,"LI",{});var hi=p(Za);ft=i(hi,"P",{});var kr=p(ft);Nd=r(kr,"You\u2019ll start with a "),nr=i(kr,"A",{href:!0});var dg=p(nr);Od=r(dg,"TFPreTrainedModel"),dg.forEach(a),Hd=r(kr," or a "),Xa=i(kr,"A",{href:!0,rel:!0});var mg=p(Xa);cn=i(mg,"CODE",{});var hg=p(cn);Ld=r(hg,"tf.keras.Model"),hg.forEach(a),mg.forEach(a),Wd=r(kr,":"),kr.forEach(a),Rd=c(hi),w(es.$$.fragment,hi),hi.forEach(a),Yd=c(et),ts=i(et,"LI",{});var _i=p(ts);un=i(_i,"P",{});var _g=p(un);Ud=r(_g,"A preprocessing class like a tokenizer, feature extractor, or processor:"),_g.forEach(a),Kd=c(_i),w(as.$$.fragment,_i),_i.forEach(a),Gd=c(et),ss=i(et,"LI",{});var gi=p(ss);dn=i(gi,"P",{});var gg=p(dn);Bd=r(gg,"Create a function to tokenize the dataset:"),gg.forEach(a),Vd=c(gi),w(rs.$$.fragment,gi),gi.forEach(a),Qd=c(et),os=i(et,"LI",{});var $i=p(os);ct=i($i,"P",{});var wr=p(ct);Jd=r(wr,"Apply the tokenizer over the entire dataset with "),ns=i(wr,"A",{href:!0,rel:!0});var $g=p(ns);Zd=r($g,"map"),$g.forEach(a),Xd=r(wr," and then pass the dataset and tokenizer to "),lr=i(wr,"A",{href:!0});var vg=p(lr);em=r(vg,"prepare_tf_dataset()"),vg.forEach(a),tm=r(wr,". You can also change the batch size and shuffle the dataset here if you\u2019d like:"),wr.forEach(a),am=c($i),w(ls.$$.fragment,$i),$i.forEach(a),sm=c(et),is=i(et,"LI",{});var vi=p(is);ut=i(vi,"P",{});var yr=p(ut);rm=r(yr,"When you\u2019re ready, you can call "),mn=i(yr,"CODE",{});var kg=p(mn);om=r(kg,"compile"),kg.forEach(a),nm=r(yr," and "),hn=i(yr,"CODE",{});var wg=p(hn);lm=r(wg,"fit"),wg.forEach(a),im=r(yr," to start training:"),yr.forEach(a),pm=c(vi),w(ps.$$.fragment,vi),vi.forEach(a),et.forEach(a),Nl=c(t),dt=i(t,"H2",{class:!0});var ki=p(dt);Yt=i(ki,"A",{id:!0,class:!0,href:!0});var yg=p(Yt);_n=i(yg,"SPAN",{});var bg=p(_n);w(fs.$$.fragment,bg),bg.forEach(a),yg.forEach(a),fm=c(ki),gn=i(ki,"SPAN",{});var Tg=p(gn);cm=r(Tg,"What's next?"),Tg.forEach(a),ki.forEach(a),Ol=c(t),ir=i(t,"P",{});var Eg=p(ir);um=r(Eg,"Now that you\u2019ve completed the \u{1F917} Transformers quick tour, check out our guides and learn how to do more specific things like writing a custom model, fine-tuning a model for a task, and how to train a model with a script. If you\u2019re interested in learning more about \u{1F917} Transformers core concepts, grab a cup of coffee and take a look at our Conceptual Guides!"),Eg.forEach(a),this.h()},h(){h(o,"name","hf:doc:metadata"),h(o,"content",JSON.stringify(d$)),h(_,"id","quick-tour"),h(_,"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"),h(_,"href","#quick-tour"),h(n,"class","relative group"),h(z,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h(D,"href","./model_doc/auto"),h(V,"href","https://huggingface.co/course/chapter1/1"),h(V,"rel","nofollow"),h(P,"id","pipeline"),h(P,"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"),h(P,"href","#pipeline"),h(Z,"class","relative group"),h(_e,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h(_s,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h(gs,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h($s,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h(vs,"href","./main_classes/pipelines"),h(ks,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h(ws,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h(la,"href","https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english"),h(la,"rel","nofollow"),h(ys,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h(bs,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h(ca,"href","https://huggingface.co/docs/datasets/quickstart#audio"),h(ca,"rel","nofollow"),h(ua,"href","https://huggingface.co/datasets/PolyAI/minds14"),h(ua,"rel","nofollow"),h(ma,"href","https://huggingface.co/facebook/wav2vec2-base-960h"),h(ma,"rel","nofollow"),h(Ts,"href","./main_classes/pipelines"),h(kt,"id","use-another-model-and-tokenizer-in-the-pipeline"),h(kt,"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"),h(kt,"href","#use-another-model-and-tokenizer-in-the-pipeline"),h(tt,"class","relative group"),h(Es,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h($a,"href","https://huggingface.co/models"),h($a,"rel","nofollow"),h(As,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h(va,"href","https://huggingface.co/nlptown/bert-base-multilingual-uncased-sentiment"),h(va,"rel","nofollow"),h(js,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h(qs,"href","./training"),h(zs,"href","./model_sharing"),h(yt,"id","autoclass"),h(yt,"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"),h(yt,"href","#autoclass"),h(at,"class","relative group"),h(Ps,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoModelForSequenceClassification"),h(xs,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoTokenizer"),h(Fs,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h(Ms,"href","./model_doc/auto"),h(Ss,"href","/docs/transformers/pr_19907/en/main_classes/pipelines#transformers.pipeline"),h(bt,"id","autotokenizer"),h(bt,"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"),h(bt,"href","#autotokenizer"),h(st,"class","relative group"),h(Cs,"href","./tokenizer_summary"),h(Ds,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoTokenizer"),h(Hs,"href","./glossary#input-ids"),h(Ws,"href",".glossary#attention-mask"),h(zt,"id","automodel"),h(zt,"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"),h(zt,"href","#automodel"),h(rt,"class","relative group"),h(Ft,"id","save-a-model"),h(Ft,"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"),h(Ft,"href","#save-a-model"),h(ot,"class","relative group"),h(Ct,"id","custom-model-builds"),h(Ct,"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"),h(Ct,"href","#custom-model-builds"),h(nt,"class","relative group"),h(Us,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoConfig"),h(Ks,"href","/docs/transformers/pr_19907/en/model_doc/auto#transformers.AutoConfig.from_pretrained"),h(Gs,"href","./create_a_model"),h(Nt,"id","trainer-a-pytorch-optimized-training-loop"),h(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"),h(Nt,"href","#trainer-a-pytorch-optimized-training-loop"),h(lt,"class","relative group"),h(Fa,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Fa,"rel","nofollow"),h(Bs,"href","/docs/transformers/pr_19907/en/main_classes/trainer#transformers.Trainer"),h(Vs,"href","/docs/transformers/pr_19907/en/main_classes/trainer#transformers.Trainer"),h(Qs,"href","/docs/transformers/pr_19907/en/main_classes/model#transformers.PreTrainedModel"),h(Sa,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Sa,"rel","nofollow"),h(Zs,"href","/docs/transformers/pr_19907/en/main_classes/trainer#transformers.TrainingArguments"),h(Xs,"href","/docs/transformers/pr_19907/en/main_classes/trainer#transformers.Trainer"),h(er,"href","/docs/transformers/pr_19907/en/main_classes/trainer#transformers.Trainer.train"),h(tr,"href","/docs/transformers/pr_19907/en/main_classes/trainer#transformers.Trainer"),h(ar,"href","/docs/transformers/pr_19907/en/main_classes/trainer#transformers.Trainer"),h(sr,"href","./main_classes/callbacks"),h(rr,"href","/docs/transformers/pr_19907/en/main_classes/trainer#transformers.Trainer"),h(Rt,"id","train-with-tensorflow"),h(Rt,"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"),h(Rt,"href","#train-with-tensorflow"),h(pt,"class","relative group"),h(Ba,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(Ba,"rel","nofollow"),h(Va,"href","https://keras.io/"),h(Va,"rel","nofollow"),h(or,"href","/docs/transformers/pr_19907/en/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset"),h(Qa,"href","https://keras.io/api/models/model_training_apis/#compile-method"),h(Qa,"rel","nofollow"),h(Ja,"href","https://keras.io/api/models/model_training_apis/#fit-method"),h(Ja,"rel","nofollow"),h(nr,"href","/docs/transformers/pr_19907/en/main_classes/model#transformers.TFPreTrainedModel"),h(Xa,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(Xa,"rel","nofollow"),h(ns,"href","https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset.map"),h(ns,"rel","nofollow"),h(lr,"href","/docs/transformers/pr_19907/en/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset"),h(Yt,"id","whats-next"),h(Yt,"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"),h(Yt,"href","#whats-next"),h(dt,"class","relative group")},m(t,u){e(document.head,o),d(t,m,u),d(t,n,u),e(n,_),e(_,$),y(v,$,null),e(n,q),e(n,F),e(F,g),d(t,j,u),y(C,t,u),d(t,N,u),d(t,I,u),e(I,W),e(I,z),e(z,S),e(I,A),e(I,D),e(D,K),e(I,R),e(I,V),e(V,ie),e(I,oe),d(t,he,u),d(t,G,u),e(G,ne),d(t,le,u),y(B,t,u),d(t,ge,u),d(t,J,u),e(J,be),d(t,$e,u),y(Q,t,u),d(t,se,u),d(t,Z,u),e(Z,P),e(P,H),y(X,H,null),e(Z,M),e(Z,L),e(L,ve),d(t,He,u),y(ae,t,u),d(t,Le,u),d(t,ee,u),e(ee,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),e(te,Ba),e(Ba,nn),e(nn,Ad),e(te,jd),e(te,Va),e(Va,qd),e(te,zd),e(te,or),e(or,Pd),e(te,xd),e(te,ln),e(ln,Fd),e(te,Md),e(te,Qa),e(Qa,pn),e(pn,Sd),e(te,Cd),e(te,Ja),e(Ja,fn),e(fn,Dd),e(te,Id),d(t,Il,u),d(t,ue,u),e(ue,Za),e(Za,ft),e(ft,Nd),e(ft,nr),e(nr,Od),e(ft,Hd),e(ft,Xa),e(Xa,cn),e(cn,Ld),e(ft,Wd),e(Za,Rd),y(es,Za,null),e(ue,Yd),e(ue,ts),e(ts,un),e(un,Ud),e(ts,Kd),y(as,ts,null),e(ue,Gd),e(ue,ss),e(ss,dn),e(dn,Bd),e(ss,Vd),y(rs,ss,null),e(ue,Qd),e(ue,os),e(os,ct),e(ct,Jd),e(ct,ns),e(ns,Zd),e(ct,Xd),e(ct,lr),e(lr,em),e(ct,tm),e(os,am),y(ls,os,null),e(ue,sm),e(ue,is),e(is,ut),e(ut,rm),e(ut,mn),e(mn,om),e(ut,nm),e(ut,hn),e(hn,lm),e(ut,im),e(is,pm),y(ps,is,null),d(t,Nl,u),d(t,dt,u),e(dt,Yt),e(Yt,_n),y(fs,_n,null),e(dt,fm),e(dt,gn),e(gn,cm),d(t,Ol,u),d(t,ir,u),e(ir,um),Hl=!0},p(t,[u]){const cs={};u&2&&(cs.$$scope={dirty:u,ctx:t}),Q.$set(cs);const $n={};u&2&&($n.$$scope={dirty:u,ctx:t}),wt.$set($n);const vn={};u&2&&(vn.$$scope={dirty:u,ctx:t}),jt.$set(vn);const kn={};u&2&&(kn.$$scope={dirty:u,ctx:t}),qt.$set(kn);const Ne={};u&2&&(Ne.$$scope={dirty:u,ctx:t}),Pt.$set(Ne);const wn={};u&2&&(wn.$$scope={dirty:u,ctx:t}),xt.$set(wn);const yn={};u&2&&(yn.$$scope={dirty:u,ctx:t}),Mt.$set(yn);const bn={};u&2&&(bn.$$scope={dirty:u,ctx:t}),St.$set(bn);const Tn={};u&2&&(Tn.$$scope={dirty:u,ctx:t}),Dt.$set(Tn);const En={};u&2&&(En.$$scope={dirty:u,ctx:t}),Wt.$set(En)},i(t){Hl||(b(v.$$.fragment,t),b(C.$$.fragment,t),b(B.$$.fragment,t),b(Q.$$.fragment,t),b(X.$$.fragment,t),b(ae.$$.fragment,t),b(na.$$.fragment,t),b(ia.$$.fragment,t),b(pa.$$.fragment,t),b(fa.$$.fragment,t),b(da.$$.fragment,t),b(ha.$$.fragment,t),b(_a.$$.fragment,t),b(ga.$$.fragment,t),b(ka.$$.fragment,t),b(wt.$$.fragment,t),b(wa.$$.fragment,t),b(ya.$$.fragment,t),b(ba.$$.fragment,t),b(Ta.$$.fragment,t),b(Ea.$$.fragment,t),b(Aa.$$.fragment,t),b(jt.$$.fragment,t),b(qt.$$.fragment,t),b(ja.$$.fragment,t),b(Pt.$$.fragment,t),b(xt.$$.fragment,t),b(qa.$$.fragment,t),b(Mt.$$.fragment,t),b(St.$$.fragment,t),b(za.$$.fragment,t),b(Pa.$$.fragment,t),b(Dt.$$.fragment,t),b(xa.$$.fragment,t),b(Ca.$$.fragment,t),b(Ia.$$.fragment,t),b(Oa.$$.fragment,t),b(La.$$.fragment,t),b(Ya.$$.fragment,t),b(Ua.$$.fragment,t),b(Ka.$$.fragment,t),b(Wt.$$.fragment,t),b(Ga.$$.fragment,t),b(es.$$.fragment,t),b(as.$$.fragment,t),b(rs.$$.fragment,t),b(ls.$$.fragment,t),b(ps.$$.fragment,t),b(fs.$$.fragment,t),Hl=!0)},o(t){T(v.$$.fragment,t),T(C.$$.fragment,t),T(B.$$.fragment,t),T(Q.$$.fragment,t),T(X.$$.fragment,t),T(ae.$$.fragment,t),T(na.$$.fragment,t),T(ia.$$.fragment,t),T(pa.$$.fragment,t),T(fa.$$.fragment,t),T(da.$$.fragment,t),T(ha.$$.fragment,t),T(_a.$$.fragment,t),T(ga.$$.fragment,t),T(ka.$$.fragment,t),T(wt.$$.fragment,t),T(wa.$$.fragment,t),T(ya.$$.fragment,t),T(ba.$$.fragment,t),T(Ta.$$.fragment,t),T(Ea.$$.fragment,t),T(Aa.$$.fragment,t),T(jt.$$.fragment,t),T(qt.$$.fragment,t),T(ja.$$.fragment,t),T(Pt.$$.fragment,t),T(xt.$$.fragment,t),T(qa.$$.fragment,t),T(Mt.$$.fragment,t),T(St.$$.fragment,t),T(za.$$.fragment,t),T(Pa.$$.fragment,t),T(Dt.$$.fragment,t),T(xa.$$.fragment,t),T(Ca.$$.fragment,t),T(Ia.$$.fragment,t),T(Oa.$$.fragment,t),T(La.$$.fragment,t),T(Ya.$$.fragment,t),T(Ua.$$.fragment,t),T(Ka.$$.fragment,t),T(Wt.$$.fragment,t),T(Ga.$$.fragment,t),T(es.$$.fragment,t),T(as.$$.fragment,t),T(rs.$$.fragment,t),T(ls.$$.fragment,t),T(ps.$$.fragment,t),T(fs.$$.fragment,t),Hl=!1},d(t){a(o),t&&a(m),t&&a(n),E(v),t&&a(j),E(C,t),t&&a(N),t&&a(I),t&&a(he),t&&a(G),t&&a(le),E(B,t),t&&a(ge),t&&a(J),t&&a($e),E(Q,t),t&&a(se),t&&a(Z),E(X),t&&a(He),E(ae,t),t&&a(Le),t&&a(ee),t&&a(jn),t&&a(mt),t&&a(qn),t&&a(pe),t&&a(zn),E(na,t),t&&a(Pn),t&&a(ke),t&&a(xn),E(ia,t),t&&a(Fn),t&&a(ht),t&&a(Mn),E(pa,t),t&&a(Sn),t&&a(_t),t&&a(Cn),E(fa,t),t&&a(Dn),t&&a(We),t&&a(In),E(da,t),t&&a(Nn),t&&a(gt),t&&a(On),E(ha,t),t&&a(Hn),t&&a($t),t&&a(Ln),E(_a,t),t&&a(Wn),t&&a(vt),t&&a(Rn),t&&a(tt),E(ga),t&&a(Yn),t&&a(fe),t&&a(Un),E(ka,t),t&&a(Kn),E(wt,t),t&&a(Gn),t&&a(Re),t&&a(Bn),E(wa,t),t&&a(Vn),t&&a(Ye),t&&a(Qn),t&&a(at),E(ya),t&&a(Jn),E(ba,t),t&&a(Zn),t&&a(re),t&&a(Xn),t&&a(Ue),t&&a(el),t&&a(st),E(Ta),t&&a(tl),t&&a(Tt),t&&a(al),t&&a(Et),t&&a(sl),E(Ea,t),t&&a(rl),t&&a(Is),t&&a(ol),E(Aa,t),t&&a(nl),t&&a(Ns),t&&a(ll),t&&a(At),t&&a(il),t&&a(Rs),t&&a(pl),E(jt,t),t&&a(fl),E(qt,t),t&&a(cl),t&&a(rt),E(ja),t&&a(ul),E(Pt,t),t&&a(dl),E(xt,t),t&&a(ml),t&&a(ot),E(qa),t&&a(hl),E(Mt,t),t&&a(_l),t&&a(Ke),t&&a(gl),E(St,t),t&&a($l),t&&a(nt),E(za),t&&a(vl),t&&a(Ys),t&&a(kl),t&&a(Ge),t&&a(wl),E(Pa,t),t&&a(yl),E(Dt,t),t&&a(bl),t&&a(It),t&&a(Tl),t&&a(lt),E(xa),t&&a(El),t&&a(Be),t&&a(Al),t&&a(Ot),t&&a(jl),t&&a(ce),E(Ca),E(Ia),E(Oa),E(La),E(Ya),t&&a(ql),t&&a(Ht),t&&a(zl),E(Ua,t),t&&a(Pl),t&&a(Lt),t&&a(xl),E(Ka,t),t&&a(Fl),E(Wt,t),t&&a(Ml),t&&a(Ve),t&&a(Sl),t&&a(Qe),t&&a(Cl),t&&a(pt),E(Ga),t&&a(Dl),t&&a(te),t&&a(Il),t&&a(ue),E(es),E(as),E(rs),E(ls),E(ps),t&&a(Nl),t&&a(dt),E(fs),t&&a(Ol),t&&a(ir)}}}const d$={local:"quick-tour",sections:[{local:"pipeline",sections:[{local:"use-another-model-and-tokenizer-in-the-pipeline",title:"Use another model and tokenizer in the pipeline"}],title:"Pipeline"},{local:"autoclass",sections:[{local:"autotokenizer",title:"AutoTokenizer"},{local:"automodel",title:"AutoModel"},{local:"save-a-model",title:"Save a model"}],title:"AutoClass"},{local:"custom-model-builds",title:"Custom model builds"},{local:"trainer-a-pytorch-optimized-training-loop",title:"Trainer - a PyTorch optimized training loop"},{local:"train-with-tensorflow",title:"Train with TensorFlow"},{local:"whats-next",title:"What's next?"}],title:"Quick tour"};function m$(x){return xg(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class y$ extends jg{constructor(o){super();qg(this,o,m$,u$,zg,{})}}export{y$ as default,d$ as metadata};
