import{S as sg,i as rg,s as og,e as n,k as f,w as v,t as o,M as lg,c as i,d as a,m,a as p,x as _,h as l,b as u,G as e,g as d,y as w,q as T,o as M,B as k,v as ng,L as we}from"../chunks/vendor-hf-doc-builder.js";import{T as jr}from"../chunks/Tip-hf-doc-builder.js";import{Y as ag}from"../chunks/Youtube-hf-doc-builder.js";import{I as ze}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as V}from"../chunks/CodeBlock-hf-doc-builder.js";import{D as ig}from"../chunks/DocNotebookDropdown-hf-doc-builder.js";import{F as us,M as de}from"../chunks/Markdown-hf-doc-builder.js";function pg(C){let s,h;return s=new V({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRvcmNo",highlighted:"pip install torch"}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p:we,i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function cg(C){let s,h;return s=new de({props:{$$slots:{default:[pg]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function fg(C){let s,h;return s=new V({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRlbnNvcmZsb3c=",highlighted:"pip install tensorflow"}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p:we,i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function mg(C){let s,h;return s=new de({props:{$$slots:{default:[fg]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function dg(C){let s,h,r,y,$;return{c(){s=n("p"),h=o("For a complete list of available tasks, check out the "),r=n("a"),y=o("pipeline API reference"),$=o("."),this.h()},l(b){s=i(b,"P",{});var E=p(s);h=l(E,"For a complete list of available tasks, check out the "),r=i(E,"A",{href:!0});var R=p(r);y=l(R,"pipeline API reference"),R.forEach(a),$=l(E,"."),E.forEach(a),this.h()},h(){u(r,"href","./main_classes/pipelines")},m(b,E){d(b,s,E),e(s,h),e(s,r),e(r,y),e(s,$)},d(b){b&&a(s)}}}function hg(C){let s,h,r,y,$,b,E,R,g,J,G,I,z,x;return z=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZChtb2RlbF9uYW1lKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX25hbWUp",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(){s=n("p"),h=o("Use "),r=n("a"),y=o("AutoModelForSequenceClassification"),$=o(" and "),b=n("a"),E=o("AutoTokenizer"),R=o(" to load the pretrained model and it\u2019s associated tokenizer (more on an "),g=n("code"),J=o("AutoClass"),G=o(" in the next section):"),I=f(),v(z.$$.fragment),this.h()},l(U){s=i(U,"P",{});var A=p(s);h=l(A,"Use "),r=i(A,"A",{href:!0});var j=p(r);y=l(j,"AutoModelForSequenceClassification"),j.forEach(a),$=l(A," and "),b=i(A,"A",{href:!0});var W=p(b);E=l(W,"AutoTokenizer"),W.forEach(a),R=l(A," to load the pretrained model and it\u2019s associated tokenizer (more on an "),g=i(A,"CODE",{});var S=p(g);J=l(S,"AutoClass"),S.forEach(a),G=l(A," in the next section):"),A.forEach(a),I=m(U),_(z.$$.fragment,U),this.h()},h(){u(r,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoModelForSequenceClassification"),u(b,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer")},m(U,A){d(U,s,A),e(s,h),e(s,r),e(r,y),e(s,$),e(s,b),e(b,E),e(s,R),e(s,g),e(g,J),e(s,G),d(U,I,A),w(z,U,A),x=!0},p:we,i(U){x||(T(z.$$.fragment,U),x=!0)},o(U){M(z.$$.fragment,U),x=!1},d(U){U&&a(s),U&&a(I),k(z,U)}}}function ug(C){let s,h;return s=new de({props:{$$slots:{default:[hg]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function yg(C){let s,h,r,y,$,b,E,R,g,J,G,I,z,x;return z=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQobW9kZWxfbmFtZSklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9uYW1lKQ==",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(){s=n("p"),h=o("Use "),r=n("a"),y=o("TFAutoModelForSequenceClassification"),$=o(" and "),b=n("a"),E=o("AutoTokenizer"),R=o(" to load the pretrained model and it\u2019s associated tokenizer (more on an "),g=n("code"),J=o("TFAutoClass"),G=o(" in the next section):"),I=f(),v(z.$$.fragment),this.h()},l(U){s=i(U,"P",{});var A=p(s);h=l(A,"Use "),r=i(A,"A",{href:!0});var j=p(r);y=l(j,"TFAutoModelForSequenceClassification"),j.forEach(a),$=l(A," and "),b=i(A,"A",{href:!0});var W=p(b);E=l(W,"AutoTokenizer"),W.forEach(a),R=l(A," to load the pretrained model and it\u2019s associated tokenizer (more on an "),g=i(A,"CODE",{});var S=p(g);J=l(S,"TFAutoClass"),S.forEach(a),G=l(A," in the next section):"),A.forEach(a),I=m(U),_(z.$$.fragment,U),this.h()},h(){u(r,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.TFAutoModelForSequenceClassification"),u(b,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer")},m(U,A){d(U,s,A),e(s,h),e(s,r),e(r,y),e(s,$),e(s,b),e(b,E),e(s,R),e(s,g),e(g,J),e(s,G),d(U,I,A),w(z,U,A),x=!0},p:we,i(U){x||(T(z.$$.fragment,U),x=!0)},o(U){M(z.$$.fragment,U),x=!1},d(U){U&&a(s),U&&a(I),k(z,U)}}}function gg(C){let s,h;return s=new de({props:{$$slots:{default:[yg]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function $g(C){let s,h;return s=new V({props:{code:"cHRfYmF0Y2glMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwJTVCJTIyV2UlMjBhcmUlMjB2ZXJ5JTIwaGFwcHklMjB0byUyMHNob3clMjB5b3UlMjB0aGUlMjAlRjAlOUYlQTQlOTclMjBUcmFuc2Zvcm1lcnMlMjBsaWJyYXJ5LiUyMiUyQyUyMCUyMldlJTIwaG9wZSUyMHlvdSUyMGRvbid0JTIwaGF0ZSUyMGl0LiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHBhZGRpbmclM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwdHJ1bmNhdGlvbiUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBtYXhfbGVuZ3RoJTNENTEyJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUyQyUwQSk=",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(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p:we,i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function bg(C){let s,h;return s=new de({props:{$$slots:{default:[$g]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function vg(C){let s,h;return s=new V({props:{code:"dGZfYmF0Y2glMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwJTVCJTIyV2UlMjBhcmUlMjB2ZXJ5JTIwaGFwcHklMjB0byUyMHNob3clMjB5b3UlMjB0aGUlMjAlRjAlOUYlQTQlOTclMjBUcmFuc2Zvcm1lcnMlMjBsaWJyYXJ5LiUyMiUyQyUyMCUyMldlJTIwaG9wZSUyMHlvdSUyMGRvbid0JTIwaGF0ZSUyMGl0LiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHBhZGRpbmclM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwdHJ1bmNhdGlvbiUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBtYXhfbGVuZ3RoJTNENTEyJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiUyQyUwQSk=",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(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p:we,i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function _g(C){let s,h;return s=new de({props:{$$slots:{default:[vg]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function wg(C){let s,h,r,y,$,b,E,R,g,J,G,I,z,x;return{c(){s=n("p"),h=o("Check out the "),r=n("a"),y=o("preprocess"),$=o(" tutorial for more details about tokenization, and how to use an "),b=n("a"),E=o("AutoImageProcessor"),R=o(", "),g=n("a"),J=o("AutoFeatureExtractor"),G=o(" and "),I=n("a"),z=o("AutoProcessor"),x=o(" to preprocess image, audio, and multimodal inputs."),this.h()},l(U){s=i(U,"P",{});var A=p(s);h=l(A,"Check out the "),r=i(A,"A",{href:!0});var j=p(r);y=l(j,"preprocess"),j.forEach(a),$=l(A," tutorial for more details about tokenization, and how to use an "),b=i(A,"A",{href:!0});var W=p(b);E=l(W,"AutoImageProcessor"),W.forEach(a),R=l(A,", "),g=i(A,"A",{href:!0});var S=p(g);J=l(S,"AutoFeatureExtractor"),S.forEach(a),G=l(A," and "),I=i(A,"A",{href:!0});var Y=p(I);z=l(Y,"AutoProcessor"),Y.forEach(a),x=l(A," to preprocess image, audio, and multimodal inputs."),A.forEach(a),this.h()},h(){u(r,"href","./preprocessing"),u(b,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor"),u(g,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoFeatureExtractor"),u(I,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoProcessor")},m(U,A){d(U,s,A),e(s,h),e(s,r),e(r,y),e(s,$),e(s,b),e(b,E),e(s,R),e(s,g),e(g,J),e(s,G),e(s,I),e(I,z),e(s,x)},d(U){U&&a(s)}}}function Tg(C){let s,h,r,y,$,b,E,R;return{c(){s=n("p"),h=o("See the "),r=n("a"),y=o("task summary"),$=o(" for tasks supported by an "),b=n("a"),E=o("AutoModel"),R=o(" class."),this.h()},l(g){s=i(g,"P",{});var J=p(s);h=l(J,"See the "),r=i(J,"A",{href:!0});var G=p(r);y=l(G,"task summary"),G.forEach(a),$=l(J," for tasks supported by an "),b=i(J,"A",{href:!0});var I=p(b);E=l(I,"AutoModel"),I.forEach(a),R=l(J," class."),J.forEach(a),this.h()},h(){u(r,"href","./task_summary"),u(b,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoModel")},m(g,J){d(g,s,J),e(s,h),e(s,r),e(r,y),e(s,$),e(s,b),e(b,E),e(s,R)},d(g){g&&a(s)}}}function Mg(C){let s,h,r,y,$,b,E,R,g,J,G,I,z,x,U,A,j,W,S,Y,Q,pe,le,he,q,ne,ie,P,ye,O,Te,ge,D,se,L,Z,N,K;return A=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEFtb2RlbF9uYW1lJTIwJTNEJTIwJTIybmxwdG93biUyRmJlcnQtYmFzZS1tdWx0aWxpbmd1YWwtdW5jYXNlZC1zZW50aW1lbnQlMjIlMEFwdF9tb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX25hbWUp",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)`}}),W=new jr({props:{$$slots:{default:[Tg]},$$scope:{ctx:C}}}),ne=new V({props:{code:"cHRfb3V0cHV0cyUyMCUzRCUyMHB0X21vZGVsKCoqcHRfYmF0Y2gp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>pt_outputs = pt_model(**pt_batch)'}}),N=new V({props:{code:"ZnJvbSUyMHRvcmNoJTIwaW1wb3J0JTIwbm4lMEElMEFwdF9wcmVkaWN0aW9ucyUyMCUzRCUyMG5uLmZ1bmN0aW9uYWwuc29mdG1heChwdF9vdXRwdXRzLmxvZ2l0cyUyQyUyMGRpbSUzRC0xKSUwQXByaW50KHB0X3ByZWRpY3Rpb25zKQ==",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(){s=n("p"),h=o("\u{1F917} Transformers provides a simple and unified way to load pretrained instances. This means you can load an "),r=n("a"),y=o("AutoModel"),$=o(" like you would load an "),b=n("a"),E=o("AutoTokenizer"),R=o(". The only difference is selecting the correct "),g=n("a"),J=o("AutoModel"),G=o(" for the task. For text (or sequence) classification, you should load "),I=n("a"),z=o("AutoModelForSequenceClassification"),x=o(":"),U=f(),v(A.$$.fragment),j=f(),v(W.$$.fragment),S=f(),Y=n("p"),Q=o("Now pass your preprocessed batch of inputs directly to the model. You just have to unpack the dictionary by adding "),pe=n("code"),le=o("**"),he=o(":"),q=f(),v(ne.$$.fragment),ie=f(),P=n("p"),ye=o("The model outputs the final activations in the "),O=n("code"),Te=o("logits"),ge=o(" attribute. Apply the softmax function to the "),D=n("code"),se=o("logits"),L=o(" to retrieve the probabilities:"),Z=f(),v(N.$$.fragment),this.h()},l(F){s=i(F,"P",{});var X=p(s);h=l(X,"\u{1F917} Transformers provides a simple and unified way to load pretrained instances. This means you can load an "),r=i(X,"A",{href:!0});var $e=p(r);y=l($e,"AutoModel"),$e.forEach(a),$=l(X," like you would load an "),b=i(X,"A",{href:!0});var Ve=p(b);E=l(Ve,"AutoTokenizer"),Ve.forEach(a),R=l(X,". The only difference is selecting the correct "),g=i(X,"A",{href:!0});var ae=p(g);J=l(ae,"AutoModel"),ae.forEach(a),G=l(X," for the task. For text (or sequence) classification, you should load "),I=i(X,"A",{href:!0});var Ne=p(I);z=l(Ne,"AutoModelForSequenceClassification"),Ne.forEach(a),x=l(X,":"),X.forEach(a),U=m(F),_(A.$$.fragment,F),j=m(F),_(W.$$.fragment,F),S=m(F),Y=i(F,"P",{});var ee=p(Y);Q=l(ee,"Now pass your preprocessed batch of inputs directly to the model. You just have to unpack the dictionary by adding "),pe=i(ee,"CODE",{});var ys=p(pe);le=l(ys,"**"),ys.forEach(a),he=l(ee,":"),ee.forEach(a),q=m(F),_(ne.$$.fragment,F),ie=m(F),P=i(F,"P",{});var ue=p(P);ye=l(ue,"The model outputs the final activations in the "),O=i(ue,"CODE",{});var gs=p(O);Te=l(gs,"logits"),gs.forEach(a),ge=l(ue," attribute. Apply the softmax function to the "),D=i(ue,"CODE",{});var $s=p(D);se=l($s,"logits"),$s.forEach(a),L=l(ue," to retrieve the probabilities:"),ue.forEach(a),Z=m(F),_(N.$$.fragment,F),this.h()},h(){u(r,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoModel"),u(b,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer"),u(g,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoModel"),u(I,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoModelForSequenceClassification")},m(F,X){d(F,s,X),e(s,h),e(s,r),e(r,y),e(s,$),e(s,b),e(b,E),e(s,R),e(s,g),e(g,J),e(s,G),e(s,I),e(I,z),e(s,x),d(F,U,X),w(A,F,X),d(F,j,X),w(W,F,X),d(F,S,X),d(F,Y,X),e(Y,Q),e(Y,pe),e(pe,le),e(Y,he),d(F,q,X),w(ne,F,X),d(F,ie,X),d(F,P,X),e(P,ye),e(P,O),e(O,Te),e(P,ge),e(P,D),e(D,se),e(P,L),d(F,Z,X),w(N,F,X),K=!0},p(F,X){const $e={};X&2&&($e.$$scope={dirty:X,ctx:F}),W.$set($e)},i(F){K||(T(A.$$.fragment,F),T(W.$$.fragment,F),T(ne.$$.fragment,F),T(N.$$.fragment,F),K=!0)},o(F){M(A.$$.fragment,F),M(W.$$.fragment,F),M(ne.$$.fragment,F),M(N.$$.fragment,F),K=!1},d(F){F&&a(s),F&&a(U),k(A,F),F&&a(j),k(W,F),F&&a(S),F&&a(Y),F&&a(q),k(ne,F),F&&a(ie),F&&a(P),F&&a(Z),k(N,F)}}}function kg(C){let s,h;return s=new de({props:{$$slots:{default:[Mg]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function jg(C){let s,h,r,y,$,b,E,R;return{c(){s=n("p"),h=o("See the "),r=n("a"),y=o("task summary"),$=o(" for tasks supported by an "),b=n("a"),E=o("AutoModel"),R=o(" class."),this.h()},l(g){s=i(g,"P",{});var J=p(s);h=l(J,"See the "),r=i(J,"A",{href:!0});var G=p(r);y=l(G,"task summary"),G.forEach(a),$=l(J," for tasks supported by an "),b=i(J,"A",{href:!0});var I=p(b);E=l(I,"AutoModel"),I.forEach(a),R=l(J," class."),J.forEach(a),this.h()},h(){u(r,"href","./task_summary"),u(b,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoModel")},m(g,J){d(g,s,J),e(s,h),e(s,r),e(r,y),e(s,$),e(s,b),e(b,E),e(s,R)},d(g){g&&a(s)}}}function Eg(C){let s,h,r,y,$,b,E,R,g,J,G,I,z,x,U,A,j,W,S,Y,Q,pe,le,he,q,ne,ie,P,ye,O,Te,ge,D,se,L;return A=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQW1vZGVsX25hbWUlMjAlM0QlMjAlMjJubHB0b3duJTJGYmVydC1iYXNlLW11bHRpbGluZ3VhbC11bmNhc2VkLXNlbnRpbWVudCUyMiUwQXRmX21vZGVsJTIwJTNEJTIwVEZBdXRvTW9kZWxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZChtb2RlbF9uYW1lKQ==",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)`}}),W=new jr({props:{$$slots:{default:[jg]},$$scope:{ctx:C}}}),le=new V({props:{code:"dGZfb3V0cHV0cyUyMCUzRCUyMHRmX21vZGVsKHRmX2JhdGNoKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_outputs = tf_model(tf_batch)'}}),se=new V({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEF0Zl9wcmVkaWN0aW9ucyUyMCUzRCUyMHRmLm5uLnNvZnRtYXgodGZfb3V0cHV0cy5sb2dpdHMlMkMlMjBheGlzJTNELTEpJTBBdGZfcHJlZGljdGlvbnM=",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(){s=n("p"),h=o("\u{1F917} Transformers provides a simple and unified way to load pretrained instances. This means you can load an "),r=n("a"),y=o("TFAutoModel"),$=o(" like you would load an "),b=n("a"),E=o("AutoTokenizer"),R=o(". The only difference is selecting the correct "),g=n("a"),J=o("TFAutoModel"),G=o(" for the task. For text (or sequence) classification, you should load "),I=n("a"),z=o("TFAutoModelForSequenceClassification"),x=o(":"),U=f(),v(A.$$.fragment),j=f(),v(W.$$.fragment),S=f(),Y=n("p"),Q=o("Now pass your preprocessed batch of inputs directly to the model by passing the dictionary keys directly to the tensors:"),pe=f(),v(le.$$.fragment),he=f(),q=n("p"),ne=o("The model outputs the final activations in the "),ie=n("code"),P=o("logits"),ye=o(" attribute. Apply the softmax function to the "),O=n("code"),Te=o("logits"),ge=o(" to retrieve the probabilities:"),D=f(),v(se.$$.fragment),this.h()},l(Z){s=i(Z,"P",{});var N=p(s);h=l(N,"\u{1F917} Transformers provides a simple and unified way to load pretrained instances. This means you can load an "),r=i(N,"A",{href:!0});var K=p(r);y=l(K,"TFAutoModel"),K.forEach(a),$=l(N," like you would load an "),b=i(N,"A",{href:!0});var F=p(b);E=l(F,"AutoTokenizer"),F.forEach(a),R=l(N,". The only difference is selecting the correct "),g=i(N,"A",{href:!0});var X=p(g);J=l(X,"TFAutoModel"),X.forEach(a),G=l(N," for the task. For text (or sequence) classification, you should load "),I=i(N,"A",{href:!0});var $e=p(I);z=l($e,"TFAutoModelForSequenceClassification"),$e.forEach(a),x=l(N,":"),N.forEach(a),U=m(Z),_(A.$$.fragment,Z),j=m(Z),_(W.$$.fragment,Z),S=m(Z),Y=i(Z,"P",{});var Ve=p(Y);Q=l(Ve,"Now pass your preprocessed batch of inputs directly to the model by passing the dictionary keys directly to the tensors:"),Ve.forEach(a),pe=m(Z),_(le.$$.fragment,Z),he=m(Z),q=i(Z,"P",{});var ae=p(q);ne=l(ae,"The model outputs the final activations in the "),ie=i(ae,"CODE",{});var Ne=p(ie);P=l(Ne,"logits"),Ne.forEach(a),ye=l(ae," attribute. Apply the softmax function to the "),O=i(ae,"CODE",{});var ee=p(O);Te=l(ee,"logits"),ee.forEach(a),ge=l(ae," to retrieve the probabilities:"),ae.forEach(a),D=m(Z),_(se.$$.fragment,Z),this.h()},h(){u(r,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.TFAutoModel"),u(b,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer"),u(g,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.TFAutoModel"),u(I,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.TFAutoModelForSequenceClassification")},m(Z,N){d(Z,s,N),e(s,h),e(s,r),e(r,y),e(s,$),e(s,b),e(b,E),e(s,R),e(s,g),e(g,J),e(s,G),e(s,I),e(I,z),e(s,x),d(Z,U,N),w(A,Z,N),d(Z,j,N),w(W,Z,N),d(Z,S,N),d(Z,Y,N),e(Y,Q),d(Z,pe,N),w(le,Z,N),d(Z,he,N),d(Z,q,N),e(q,ne),e(q,ie),e(ie,P),e(q,ye),e(q,O),e(O,Te),e(q,ge),d(Z,D,N),w(se,Z,N),L=!0},p(Z,N){const K={};N&2&&(K.$$scope={dirty:N,ctx:Z}),W.$set(K)},i(Z){L||(T(A.$$.fragment,Z),T(W.$$.fragment,Z),T(le.$$.fragment,Z),T(se.$$.fragment,Z),L=!0)},o(Z){M(A.$$.fragment,Z),M(W.$$.fragment,Z),M(le.$$.fragment,Z),M(se.$$.fragment,Z),L=!1},d(Z){Z&&a(s),Z&&a(U),k(A,Z),Z&&a(j),k(W,Z),Z&&a(S),Z&&a(Y),Z&&a(pe),k(le,Z),Z&&a(he),Z&&a(q),Z&&a(D),k(se,Z)}}}function Jg(C){let s,h;return s=new de({props:{$$slots:{default:[Eg]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function Ug(C){let s,h,r,y,$;return{c(){s=n("p"),h=o("All \u{1F917} Transformers models (PyTorch or TensorFlow) output the tensors "),r=n("em"),y=o("before"),$=o(` 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(b){s=i(b,"P",{});var E=p(s);h=l(E,"All \u{1F917} Transformers models (PyTorch or TensorFlow) output the tensors "),r=i(E,"EM",{});var R=p(r);y=l(R,"before"),R.forEach(a),$=l(E,` 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.`),E.forEach(a)},m(b,E){d(b,s,E),e(s,h),e(s,r),e(r,y),e(s,$)},d(b){b&&a(s)}}}function Ag(C){let s,h,r,y,$,b,E,R,g,J,G,I,z,x,U,A;return E=new V({props:{code:"cHRfc2F2ZV9kaXJlY3RvcnklMjAlM0QlMjAlMjIuJTJGcHRfc2F2ZV9wcmV0cmFpbmVkJTIyJTBBdG9rZW5pemVyLnNhdmVfcHJldHJhaW5lZChwdF9zYXZlX2RpcmVjdG9yeSklMEFwdF9tb2RlbC5zYXZlX3ByZXRyYWluZWQocHRfc2F2ZV9kaXJlY3Rvcnkp",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)`}}),U=new V({props:{code:"cHRfbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjIuJTJGcHRfc2F2ZV9wcmV0cmFpbmVkJTIyKQ==",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(){s=n("p"),h=o("Once your model is fine-tuned, you can save it with its tokenizer using "),r=n("a"),y=o("PreTrainedModel.save_pretrained()"),$=o(":"),b=f(),v(E.$$.fragment),R=f(),g=n("p"),J=o("When you are ready to use the model again, reload it with "),G=n("a"),I=o("PreTrainedModel.from_pretrained()"),z=o(":"),x=f(),v(U.$$.fragment),this.h()},l(j){s=i(j,"P",{});var W=p(s);h=l(W,"Once your model is fine-tuned, you can save it with its tokenizer using "),r=i(W,"A",{href:!0});var S=p(r);y=l(S,"PreTrainedModel.save_pretrained()"),S.forEach(a),$=l(W,":"),W.forEach(a),b=m(j),_(E.$$.fragment,j),R=m(j),g=i(j,"P",{});var Y=p(g);J=l(Y,"When you are ready to use the model again, reload it with "),G=i(Y,"A",{href:!0});var Q=p(G);I=l(Q,"PreTrainedModel.from_pretrained()"),Q.forEach(a),z=l(Y,":"),Y.forEach(a),x=m(j),_(U.$$.fragment,j),this.h()},h(){u(r,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.save_pretrained"),u(G,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained")},m(j,W){d(j,s,W),e(s,h),e(s,r),e(r,y),e(s,$),d(j,b,W),w(E,j,W),d(j,R,W),d(j,g,W),e(g,J),e(g,G),e(G,I),e(g,z),d(j,x,W),w(U,j,W),A=!0},p:we,i(j){A||(T(E.$$.fragment,j),T(U.$$.fragment,j),A=!0)},o(j){M(E.$$.fragment,j),M(U.$$.fragment,j),A=!1},d(j){j&&a(s),j&&a(b),k(E,j),j&&a(R),j&&a(g),j&&a(x),k(U,j)}}}function Zg(C){let s,h;return s=new de({props:{$$slots:{default:[Ag]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function Cg(C){let s,h,r,y,$,b,E,R,g,J,G,I,z,x,U,A;return E=new V({props:{code:"dGZfc2F2ZV9kaXJlY3RvcnklMjAlM0QlMjAlMjIuJTJGdGZfc2F2ZV9wcmV0cmFpbmVkJTIyJTBBdG9rZW5pemVyLnNhdmVfcHJldHJhaW5lZCh0Zl9zYXZlX2RpcmVjdG9yeSklMEF0Zl9tb2RlbC5zYXZlX3ByZXRyYWluZWQodGZfc2F2ZV9kaXJlY3Rvcnkp",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)`}}),U=new V({props:{code:"dGZfbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMi4lMkZ0Zl9zYXZlX3ByZXRyYWluZWQlMjIp",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(){s=n("p"),h=o("Once your model is fine-tuned, you can save it with its tokenizer using "),r=n("a"),y=o("TFPreTrainedModel.save_pretrained()"),$=o(":"),b=f(),v(E.$$.fragment),R=f(),g=n("p"),J=o("When you are ready to use the model again, reload it with "),G=n("a"),I=o("TFPreTrainedModel.from_pretrained()"),z=o(":"),x=f(),v(U.$$.fragment),this.h()},l(j){s=i(j,"P",{});var W=p(s);h=l(W,"Once your model is fine-tuned, you can save it with its tokenizer using "),r=i(W,"A",{href:!0});var S=p(r);y=l(S,"TFPreTrainedModel.save_pretrained()"),S.forEach(a),$=l(W,":"),W.forEach(a),b=m(j),_(E.$$.fragment,j),R=m(j),g=i(j,"P",{});var Y=p(g);J=l(Y,"When you are ready to use the model again, reload it with "),G=i(Y,"A",{href:!0});var Q=p(G);I=l(Q,"TFPreTrainedModel.from_pretrained()"),Q.forEach(a),z=l(Y,":"),Y.forEach(a),x=m(j),_(U.$$.fragment,j),this.h()},h(){u(r,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel.save_pretrained"),u(G,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained")},m(j,W){d(j,s,W),e(s,h),e(s,r),e(r,y),e(s,$),d(j,b,W),w(E,j,W),d(j,R,W),d(j,g,W),e(g,J),e(g,G),e(G,I),e(g,z),d(j,x,W),w(U,j,W),A=!0},p:we,i(j){A||(T(E.$$.fragment,j),T(U.$$.fragment,j),A=!0)},o(j){M(E.$$.fragment,j),M(U.$$.fragment,j),A=!1},d(j){j&&a(s),j&&a(b),k(E,j),j&&a(R),j&&a(g),j&&a(x),k(U,j)}}}function Rg(C){let s,h;return s=new de({props:{$$slots:{default:[Cg]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function Fg(C){let s,h;return s=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKHRmX3NhdmVfZGlyZWN0b3J5KSUwQXB0X21vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQodGZfc2F2ZV9kaXJlY3RvcnklMkMlMjBmcm9tX3RmJTNEVHJ1ZSk=",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(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p:we,i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function Wg(C){let s,h;return s=new de({props:{$$slots:{default:[Fg]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function Gg(C){let s,h;return s=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQocHRfc2F2ZV9kaXJlY3RvcnkpJTBBdGZfbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKHB0X3NhdmVfZGlyZWN0b3J5JTJDJTIwZnJvbV9wdCUzRFRydWUp",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(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p:we,i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function Ig(C){let s,h;return s=new de({props:{$$slots:{default:[Gg]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function zg(C){let s,h,r,y,$,b,E,R;return E=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbCUwQSUwQW15X21vZGVsJTIwJTNEJTIwQXV0b01vZGVsLmZyb21fY29uZmlnKG15X2NvbmZpZyk=",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(){s=n("p"),h=o("Create a model from your custom configuration with "),r=n("a"),y=o("AutoModel.from_config()"),$=o(":"),b=f(),v(E.$$.fragment),this.h()},l(g){s=i(g,"P",{});var J=p(s);h=l(J,"Create a model from your custom configuration with "),r=i(J,"A",{href:!0});var G=p(r);y=l(G,"AutoModel.from_config()"),G.forEach(a),$=l(J,":"),J.forEach(a),b=m(g),_(E.$$.fragment,g),this.h()},h(){u(r,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_config")},m(g,J){d(g,s,J),e(s,h),e(s,r),e(r,y),e(s,$),d(g,b,J),w(E,g,J),R=!0},p:we,i(g){R||(T(E.$$.fragment,g),R=!0)},o(g){M(E.$$.fragment,g),R=!1},d(g){g&&a(s),g&&a(b),k(E,g)}}}function Vg(C){let s,h;return s=new de({props:{$$slots:{default:[zg]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function Ng(C){let s,h,r,y,$,b,E,R;return E=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsJTBBJTBBbXlfbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbC5mcm9tX2NvbmZpZyhteV9jb25maWcp",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(){s=n("p"),h=o("Create a model from your custom configuration with "),r=n("a"),y=o("TFAutoModel.from_config()"),$=o(":"),b=f(),v(E.$$.fragment),this.h()},l(g){s=i(g,"P",{});var J=p(s);h=l(J,"Create a model from your custom configuration with "),r=i(J,"A",{href:!0});var G=p(r);y=l(G,"TFAutoModel.from_config()"),G.forEach(a),$=l(J,":"),J.forEach(a),b=m(g),_(E.$$.fragment,g),this.h()},h(){u(r,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_config")},m(g,J){d(g,s,J),e(s,h),e(s,r),e(r,y),e(s,$),d(g,b,J),w(E,g,J),R=!0},p:we,i(g){R||(T(E.$$.fragment,g),R=!0)},o(g){M(E.$$.fragment,g),R=!1},d(g){g&&a(s),g&&a(b),k(E,g)}}}function Xg(C){let s,h;return s=new de({props:{$$slots:{default:[Ng]},$$scope:{ctx:C}}}),{c(){v(s.$$.fragment)},l(r){_(s.$$.fragment,r)},m(r,y){w(s,r,y),h=!0},p(r,y){const $={};y&2&&($.$$scope={dirty:y,ctx:r}),s.$set($)},i(r){h||(T(s.$$.fragment,r),h=!0)},o(r){M(s.$$.fragment,r),h=!1},d(r){k(s,r)}}}function xg(C){let s,h,r,y,$,b,E,R;return{c(){s=n("p"),h=o("For tasks - like translation or summarization - that use a sequence-to-sequence model, use the "),r=n("a"),y=o("Seq2SeqTrainer"),$=o(" and "),b=n("a"),E=o("Seq2SeqTrainingArguments"),R=o(" classes instead."),this.h()},l(g){s=i(g,"P",{});var J=p(s);h=l(J,"For tasks - like translation or summarization - that use a sequence-to-sequence model, use the "),r=i(J,"A",{href:!0});var G=p(r);y=l(G,"Seq2SeqTrainer"),G.forEach(a),$=l(J," and "),b=i(J,"A",{href:!0});var I=p(b);E=l(I,"Seq2SeqTrainingArguments"),I.forEach(a),R=l(J," classes instead."),J.forEach(a),this.h()},h(){u(r,"href","/docs/transformers/v4.30.0/en/main_classes/trainer#transformers.Seq2SeqTrainer"),u(b,"href","/docs/transformers/v4.30.0/en/main_classes/trainer#transformers.Seq2SeqTrainingArguments")},m(g,J){d(g,s,J),e(s,h),e(s,r),e(r,y),e(s,$),e(s,b),e(b,E),e(s,R)},d(g){g&&a(s)}}}function Yg(C){let s,h,r,y,$,b,E,R,g,J,G,I,z,x,U,A,j,W,S,Y,Q,pe,le,he,q,ne,ie,P,ye,O,Te,ge,D,se,L,Z,N,K,F,X,$e,Ve,ae,Ne,ee,ys,ue,gs,$s,bs,gi,$i,_l,mt,wl,dt,Er,Me,Jr,Ur,bi,vi,Ar,Zr,_i,wi,Cr,Rr,Ti,Mi,Fr,Wr,ki,ji,B,ke,Gr,Ei,Ji,Ir,Ui,Ai,zr,Zi,Ci,Vr,Ri,Fi,je,Nr,Wi,Gi,Xr,Ii,zi,xr,Vi,Ni,Yr,Xi,xi,Ee,Sr,Yi,Si,Br,Bi,qi,qr,Pi,Hi,Pr,Qi,Di,Je,Hr,Oi,Li,Qr,Ki,ep,Dr,tp,ap,Or,sp,rp,Ue,Lr,op,lp,Kr,np,ip,eo,pp,cp,to,fp,mp,Ae,ao,dp,hp,so,up,yp,ro,gp,$p,oo,bp,vp,Ze,lo,_p,wp,no,Tp,Mp,io,kp,jp,po,Ep,Jp,Ce,co,Up,Ap,fo,Zp,Cp,mo,Rp,Fp,ho,Wp,Gp,Re,uo,Ip,zp,yo,Vp,Np,go,Xp,xp,$o,Yp,Sp,Fe,bo,Bp,qp,vo,Pp,Hp,_o,Qp,Dp,wo,Op,Lp,We,To,Kp,ec,Mo,tc,ac,ko,sc,rc,jo,oc,Tl,Xe,lc,vs,nc,ic,_s,pc,cc,Ml,ra,kl,be,fc,ws,mc,dc,oa,hc,uc,Eo,yc,gc,jl,la,El,ht,$c,Ts,bc,vc,Jl,na,Ul,ut,_c,Ms,wc,Tc,Al,ia,Zl,xe,Mc,pa,kc,jc,ca,Ec,Jc,Cl,fa,Rl,yt,Uc,ma,Jo,Ac,Zc,Fl,da,Wl,gt,Cc,Uo,Rc,Fc,Gl,ha,Il,$t,Wc,ks,Gc,Ic,zl,Ke,bt,Ao,ua,zc,Zo,Vc,Vl,ce,Nc,js,Xc,xc,ya,Yc,Sc,Es,Bc,qc,ga,Pc,Hc,Nl,$a,Xl,vt,xl,Ye,Qc,Js,Dc,Oc,Co,Lc,Kc,Yl,ba,Sl,Se,ef,Us,tf,af,As,sf,rf,Bl,et,_t,Ro,va,of,Fo,lf,ql,_a,Pl,re,nf,Zs,pf,cf,Cs,ff,mf,Rs,df,hf,Fs,uf,yf,Wo,gf,$f,Hl,Be,bf,Go,vf,_f,Ws,wf,Tf,Ql,tt,wt,Io,wa,Mf,zo,kf,Dl,Tt,jf,Gs,Ef,Jf,Ol,Mt,Uf,Is,Af,Zf,Ll,Ta,Kl,zs,Cf,en,Ma,tn,Vs,Rf,an,kt,Ns,Xs,Ff,Wf,Gf,xs,Ys,If,zf,sn,Ss,Vf,rn,jt,on,Et,ln,at,Jt,Vo,ka,Nf,No,Xf,nn,Ut,pn,At,cn,st,Zt,Xo,ja,xf,xo,Yf,fn,Ct,mn,qe,Sf,Yo,Bf,qf,So,Pf,Hf,dn,Rt,hn,rt,Ft,Bo,Ea,Qf,qo,Df,un,Bs,Of,yn,Pe,Lf,qs,Kf,em,Ps,tm,am,gn,Ja,$n,Wt,bn,Gt,sm,Hs,rm,om,vn,ot,It,Po,Ua,lm,Ho,nm,_n,He,im,Aa,Qo,pm,cm,Qs,fm,mm,wn,zt,dm,Ds,hm,um,Tn,oe,Za,lt,ym,Os,gm,$m,Ca,Do,bm,vm,_m,Ra,wm,Fa,Ls,Ks,Tm,Mm,km,Wa,jm,Ga,Oo,Em,Jm,Ia,Um,za,Lo,Am,Zm,Va,Cm,Ge,Ko,Rm,Fm,Na,Wm,Xa,Gm,xa,Im,zm,Vm,Ya,Nm,Sa,Ba,Xm,er,xm,Ym,Sm,qa,Mn,Vt,Bm,tr,qm,Pm,kn,Pa,jn,Nt,Hm,ar,Qm,Dm,En,Ha,Jn,Xt,Un,Qe,Om,sr,Lm,Km,rr,ed,td,An,De,ad,or,sd,rd,lr,od,ld,Zn,nt,xt,el,Qa,nd,tl,id,Cn,te,pd,Da,al,cd,fd,Oa,md,dd,nr,hd,ud,sl,yd,gd,La,rl,$d,bd,Ka,ol,vd,_d,Rn,fe,es,it,wd,ir,Td,Md,ts,ll,kd,jd,Ed,as,Jd,ss,nl,Ud,Ad,rs,Zd,os,il,Cd,Rd,ls,Fd,ns,pt,Wd,is,Gd,Id,pr,zd,Vd,Nd,ps,Xd,cs,ct,xd,pl,Yd,Sd,cl,Bd,qd,Pd,fs,Fn,ft,Yt,fl,ms,Hd,ml,Qd,Wn,cr,Dd,Gn;return b=new ze({}),G=new ig({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"}]}}),P=new V({props:{code:"IXBpcCUyMGluc3RhbGwlMjB0cmFuc2Zvcm1lcnMlMjBkYXRhc2V0cw==",highlighted:"!pip install transformers datasets"}}),D=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[mg],pytorch:[cg]},$$scope:{ctx:C}}}),K=new ze({}),ae=new ag({props:{id:"tiZFewofSLM"}}),mt=new jr({props:{$$slots:{default:[dg]},$$scope:{ctx:C}}}),ra=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUyMnNlbnRpbWVudC1hbmFseXNpcyUyMik=",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>)`}}),la=new V({props:{code:"Y2xhc3NpZmllciglMjJXZSUyMGFyZSUyMHZlcnklMjBoYXBweSUyMHRvJTIwc2hvdyUyMHlvdSUyMHRoZSUyMCVGMCU5RiVBNCU5NyUyMFRyYW5zZm9ybWVycyUyMGxpYnJhcnkuJTIyKQ==",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>}]`}}),na=new V({props:{code:"cmVzdWx0cyUyMCUzRCUyMGNsYXNzaWZpZXIoJTVCJTIyV2UlMjBhcmUlMjB2ZXJ5JTIwaGFwcHklMjB0byUyMHNob3clMjB5b3UlMjB0aGUlMjAlRjAlOUYlQTQlOTclMjBUcmFuc2Zvcm1lcnMlMjBsaWJyYXJ5LiUyMiUyQyUyMCUyMldlJTIwaG9wZSUyMHlvdSUyMGRvbid0JTIwaGF0ZSUyMGl0LiUyMiU1RCklMEFmb3IlMjByZXN1bHQlMjBpbiUyMHJlc3VsdHMlM0ElMEElMjAlMjAlMjAlMjBwcmludChmJTIybGFiZWwlM0ElMjAlN0JyZXN1bHQlNUInbGFiZWwnJTVEJTdEJTJDJTIwd2l0aCUyMHNjb3JlJTNBJTIwJTdCcm91bmQocmVzdWx0JTVCJ3Njb3JlJyU1RCUyQyUyMDQpJTdEJTIyKQ==",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>`}}),ia=new V({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwcGlwZWxpbmUlMEElMEFzcGVlY2hfcmVjb2duaXplciUyMCUzRCUyMHBpcGVsaW5lKCUyMmF1dG9tYXRpYy1zcGVlY2gtcmVjb2duaXRpb24lMjIlMkMlMjBtb2RlbCUzRCUyMmZhY2Vib29rJTJGd2F2MnZlYzItYmFzZS05NjBoJTIyKQ==",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>)`}}),fa=new V({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTJDJTIwQXVkaW8lMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMlBvbHlBSSUyRm1pbmRzMTQlMjIlMkMlMjBuYW1lJTNEJTIyZW4tVVMlMjIlMkMlMjBzcGxpdCUzRCUyMnRyYWluJTIyKQ==",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>)`}}),da=new V({props:{code:"ZGF0YXNldCUyMCUzRCUyMGRhdGFzZXQuY2FzdF9jb2x1bW4oJTIyYXVkaW8lMjIlMkMlMjBBdWRpbyhzYW1wbGluZ19yYXRlJTNEc3BlZWNoX3JlY29nbml6ZXIuZmVhdHVyZV9leHRyYWN0b3Iuc2FtcGxpbmdfcmF0ZSkp",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))'}}),ha=new V({props:{code:"cmVzdWx0JTIwJTNEJTIwc3BlZWNoX3JlY29nbml6ZXIoZGF0YXNldCU1QiUzQTQlNUQlNUIlMjJhdWRpbyUyMiU1RCklMEFwcmludCglNUJkJTVCJTIydGV4dCUyMiU1RCUyMGZvciUyMGQlMjBpbiUyMHJlc3VsdCU1RCk=",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;FONDERING HOW I&#x27;D SET UP A JOIN TO HELL T 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 APSO 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 AN 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 FURN A JOINA COUT&#x27;</span>]`}}),ua=new ze({}),$a=new V({props:{code:"bW9kZWxfbmFtZSUyMCUzRCUyMCUyMm5scHRvd24lMkZiZXJ0LWJhc2UtbXVsdGlsaW5ndWFsLXVuY2FzZWQtc2VudGltZW50JTIy",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model_name = <span class="hljs-string">&quot;nlptown/bert-base-multilingual-uncased-sentiment&quot;</span>'}}),vt=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[gg],pytorch:[ug]},$$scope:{ctx:C}}}),ba=new V({props:{code:"Y2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUyMnNlbnRpbWVudC1hbmFseXNpcyUyMiUyQyUyMG1vZGVsJTNEbW9kZWwlMkMlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIpJTBBY2xhc3NpZmllciglMjJOb3VzJTIwc29tbWVzJTIwdHIlQzMlQThzJTIwaGV1cmV1eCUyMGRlJTIwdm91cyUyMHByJUMzJUE5c2VudGVyJTIwbGElMjBiaWJsaW90aCVDMyVBOHF1ZSUyMCVGMCU5RiVBNCU5NyUyMFRyYW5zZm9ybWVycy4lMjIp",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>}]`}}),va=new ze({}),_a=new ag({props:{id:"AhChOFRegn4"}}),wa=new ze({}),Ta=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEFtb2RlbF9uYW1lJTIwJTNEJTIwJTIybmxwdG93biUyRmJlcnQtYmFzZS1tdWx0aWxpbmd1YWwtdW5jYXNlZC1zZW50aW1lbnQlMjIlMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9uYW1lKQ==",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)`}}),Ma=new V({props:{code:"ZW5jb2RpbmclMjAlM0QlMjB0b2tlbml6ZXIoJTIyV2UlMjBhcmUlMjB2ZXJ5JTIwaGFwcHklMjB0byUyMHNob3clMjB5b3UlMjB0aGUlMjAlRjAlOUYlQTQlOTclMjBUcmFuc2Zvcm1lcnMlMjBsaWJyYXJ5LiUyMiklMEFwcmludChlbmNvZGluZyk=",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:[_g],pytorch:[bg]},$$scope:{ctx:C}}}),Et=new jr({props:{$$slots:{default:[wg]},$$scope:{ctx:C}}}),ka=new ze({}),Ut=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Jg],pytorch:[kg]},$$scope:{ctx:C}}}),At=new jr({props:{$$slots:{default:[Ug]},$$scope:{ctx:C}}}),ja=new ze({}),Ct=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Rg],pytorch:[Zg]},$$scope:{ctx:C}}}),Rt=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Ig],pytorch:[Wg]},$$scope:{ctx:C}}}),Ea=new ze({}),Ja=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Db25maWclMEElMEFteV9jb25maWclMjAlM0QlMjBBdXRvQ29uZmlnLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiUyQyUyMG5faGVhZHMlM0QxMik=",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>)`}}),Wt=new us({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Xg],pytorch:[Vg]},$$scope:{ctx:C}}}),Ua=new ze({}),Ra=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKQ==",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>)`}}),Wa=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTBBJTBBdHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJwYXRoJTJGdG8lMkZzYXZlJTJGZm9sZGVyJTJGJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0Q4JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV9ldmFsX2JhdGNoX3NpemUlM0Q4JTJDJTBBJTIwJTIwJTIwJTIwbnVtX3RyYWluX2Vwb2NocyUzRDIlMkMlMEEp",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>)`}}),Ia=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMik=",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>)`}}),Va=new V({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJyb3R0ZW5fdG9tYXRvZXMlMjIpJTIwJTIwJTIzJTIwZG9jdGVzdCUzQSUyMCUyQklHTk9SRV9SRVNVTFQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;rotten_tomatoes&quot;</span>)  <span class="hljs-comment"># doctest: +IGNORE_RESULT</span>`}}),Na=new V({props:{code:"ZGVmJTIwdG9rZW5pemVfZGF0YXNldChkYXRhc2V0KSUzQSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMHRva2VuaXplcihkYXRhc2V0JTVCJTIydGV4dCUyMiU1RCk=",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>])`}}),Ya=new V({props:{code:"ZGF0YXNldCUyMCUzRCUyMGRhdGFzZXQubWFwKHRva2VuaXplX2RhdGFzZXQlMkMlMjBiYXRjaGVkJTNEVHJ1ZSk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = dataset.<span class="hljs-built_in">map</span>(tokenize_dataset, batched=<span class="hljs-literal">True</span>)'}}),qa=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvcldpdGhQYWRkaW5nJTBBJTBBZGF0YV9jb2xsYXRvciUyMCUzRCUyMERhdGFDb2xsYXRvcldpdGhQYWRkaW5nKHRva2VuaXplciUzRHRva2VuaXplcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorWithPadding

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