import{S as il,i as ll,s as fl,e as o,k as m,w as j,t as a,M as pl,c as n,d as s,m as d,a as i,x as q,h as r,b as g,G as t,g as f,y as E,q as T,o as x,B as z,v as ul,L as ur}from"../chunks/vendor-hf-doc-builder.js";import{T as Ms}from"../chunks/Tip-hf-doc-builder.js";import{I as Oe}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as W}from"../chunks/CodeBlock-hf-doc-builder.js";import{F as nl,M as cr}from"../chunks/Markdown-hf-doc-builder.js";function cl(V){let p,v,u,_,y;return{c(){p=o("p"),v=a("You can also save your configuration file as a dictionary or even just the difference between your custom configuration attributes and the default configuration attributes! See the "),u=o("a"),_=a("configuration"),y=a(" documentation for more details."),this.h()},l($){p=n($,"P",{});var w=i(p);v=r(w,"You can also save your configuration file as a dictionary or even just the difference between your custom configuration attributes and the default configuration attributes! See the "),u=n(w,"A",{href:!0});var P=i(u);_=r(P,"configuration"),P.forEach(s),y=r(w," documentation for more details."),w.forEach(s),this.h()},h(){g(u,"href","main_classes/configuration")},m($,w){f($,p,w),t(p,v),t(p,u),t(u,_),t(p,y)},d($){$&&s(p)}}}function ml(V){let p,v,u,_,y,$,w,P,b,L,k,S,A,I,F,M,h,B,N,C,R;return _=new W({props:{code:`from transformers import DistilBertModel

my_config = DistilBertConfig.from_pretrained("./your_model_save_path/config.json")
model = DistilBertModel(my_config)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig.from_pretrained(<span class="hljs-string">&quot;./your_model_save_path/config.json&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertModel(my_config)`}}),F=new W({props:{code:'model = DistilBertModel.from_pretrained("distilbert-base-uncased")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertModel.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)'}}),C=new W({props:{code:'model = DistilBertModel.from_pretrained("distilbert-base-uncased", config=my_config)',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertModel.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>, config=my_config)'}}),{c(){p=o("p"),v=a("Load your custom configuration attributes into the model:"),u=m(),j(_.$$.fragment),y=m(),$=o("p"),w=a("This creates a model with random values instead of pretrained weights. You won\u2019t be able to use this model for anything useful yet until you train it. Training is a costly and time-consuming process. It is generally better to use a pretrained model to obtain better results faster, while using only a fraction of the resources required for training."),P=m(),b=o("p"),L=a("Create a pretrained model with "),k=o("a"),S=a("from_pretrained()"),A=a(":"),I=m(),j(F.$$.fragment),M=m(),h=o("p"),B=a("When you load pretrained weights, the default model configuration is automatically loaded if the model is provided by \u{1F917} Transformers. However, you can still replace - some or all of - the default model configuration attributes with your own if you\u2019d like:"),N=m(),j(C.$$.fragment),this.h()},l(c){p=n(c,"P",{});var D=i(p);v=r(D,"Load your custom configuration attributes into the model:"),D.forEach(s),u=d(c),q(_.$$.fragment,c),y=d(c),$=n(c,"P",{});var O=i($);w=r(O,"This creates a model with random values instead of pretrained weights. You won\u2019t be able to use this model for anything useful yet until you train it. Training is a costly and time-consuming process. It is generally better to use a pretrained model to obtain better results faster, while using only a fraction of the resources required for training."),O.forEach(s),P=d(c),b=n(c,"P",{});var H=i(b);L=r(H,"Create a pretrained model with "),k=n(H,"A",{href:!0});var ae=i(k);S=r(ae,"from_pretrained()"),ae.forEach(s),A=r(H,":"),H.forEach(s),I=d(c),q(F.$$.fragment,c),M=d(c),h=n(c,"P",{});var re=i(h);B=r(re,"When you load pretrained weights, the default model configuration is automatically loaded if the model is provided by \u{1F917} Transformers. However, you can still replace - some or all of - the default model configuration attributes with your own if you\u2019d like:"),re.forEach(s),N=d(c),q(C.$$.fragment,c),this.h()},h(){g(k,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained")},m(c,D){f(c,p,D),t(p,v),f(c,u,D),E(_,c,D),f(c,y,D),f(c,$,D),t($,w),f(c,P,D),f(c,b,D),t(b,L),t(b,k),t(k,S),t(b,A),f(c,I,D),E(F,c,D),f(c,M,D),f(c,h,D),t(h,B),f(c,N,D),E(C,c,D),R=!0},p:ur,i(c){R||(T(_.$$.fragment,c),T(F.$$.fragment,c),T(C.$$.fragment,c),R=!0)},o(c){x(_.$$.fragment,c),x(F.$$.fragment,c),x(C.$$.fragment,c),R=!1},d(c){c&&s(p),c&&s(u),z(_,c),c&&s(y),c&&s($),c&&s(P),c&&s(b),c&&s(I),z(F,c),c&&s(M),c&&s(h),c&&s(N),z(C,c)}}}function dl(V){let p,v;return p=new cr({props:{$$slots:{default:[ml]},$$scope:{ctx:V}}}),{c(){j(p.$$.fragment)},l(u){q(p.$$.fragment,u)},m(u,_){E(p,u,_),v=!0},p(u,_){const y={};_&2&&(y.$$scope={dirty:_,ctx:u}),p.$set(y)},i(u){v||(T(p.$$.fragment,u),v=!0)},o(u){x(p.$$.fragment,u),v=!1},d(u){z(p,u)}}}function hl(V){let p,v,u,_,y,$,w,P,b,L,k,S,A,I,F,M,h,B,N,C,R;return _=new W({props:{code:`from transformers import TFDistilBertModel

my_config = DistilBertConfig.from_pretrained("./your_model_save_path/my_config.json")
tf_model = TFDistilBertModel(my_config)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFDistilBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig.from_pretrained(<span class="hljs-string">&quot;./your_model_save_path/my_config.json&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertModel(my_config)`}}),F=new W({props:{code:'tf_model = TFDistilBertModel.from_pretrained("distilbert-base-uncased")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertModel.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)'}}),C=new W({props:{code:'tf_model = TFDistilBertModel.from_pretrained("distilbert-base-uncased", config=my_config)',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertModel.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>, config=my_config)'}}),{c(){p=o("p"),v=a("Load your custom configuration attributes into the model:"),u=m(),j(_.$$.fragment),y=m(),$=o("p"),w=a("This creates a model with random values instead of pretrained weights. You won\u2019t be able to use this model for anything useful yet until you train it. Training is a costly and time-consuming process. It is generally better to use a pretrained model to obtain better results faster, while using only a fraction of the resources required for training."),P=m(),b=o("p"),L=a("Create a pretrained model with "),k=o("a"),S=a("from_pretrained()"),A=a(":"),I=m(),j(F.$$.fragment),M=m(),h=o("p"),B=a("When you load pretrained weights, the default model configuration is automatically loaded if the model is provided by \u{1F917} Transformers. However, you can still replace - some or all of - the default model configuration attributes with your own if you\u2019d like:"),N=m(),j(C.$$.fragment),this.h()},l(c){p=n(c,"P",{});var D=i(p);v=r(D,"Load your custom configuration attributes into the model:"),D.forEach(s),u=d(c),q(_.$$.fragment,c),y=d(c),$=n(c,"P",{});var O=i($);w=r(O,"This creates a model with random values instead of pretrained weights. You won\u2019t be able to use this model for anything useful yet until you train it. Training is a costly and time-consuming process. It is generally better to use a pretrained model to obtain better results faster, while using only a fraction of the resources required for training."),O.forEach(s),P=d(c),b=n(c,"P",{});var H=i(b);L=r(H,"Create a pretrained model with "),k=n(H,"A",{href:!0});var ae=i(k);S=r(ae,"from_pretrained()"),ae.forEach(s),A=r(H,":"),H.forEach(s),I=d(c),q(F.$$.fragment,c),M=d(c),h=n(c,"P",{});var re=i(h);B=r(re,"When you load pretrained weights, the default model configuration is automatically loaded if the model is provided by \u{1F917} Transformers. However, you can still replace - some or all of - the default model configuration attributes with your own if you\u2019d like:"),re.forEach(s),N=d(c),q(C.$$.fragment,c),this.h()},h(){g(k,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained")},m(c,D){f(c,p,D),t(p,v),f(c,u,D),E(_,c,D),f(c,y,D),f(c,$,D),t($,w),f(c,P,D),f(c,b,D),t(b,L),t(b,k),t(k,S),t(b,A),f(c,I,D),E(F,c,D),f(c,M,D),f(c,h,D),t(h,B),f(c,N,D),E(C,c,D),R=!0},p:ur,i(c){R||(T(_.$$.fragment,c),T(F.$$.fragment,c),T(C.$$.fragment,c),R=!0)},o(c){x(_.$$.fragment,c),x(F.$$.fragment,c),x(C.$$.fragment,c),R=!1},d(c){c&&s(p),c&&s(u),z(_,c),c&&s(y),c&&s($),c&&s(P),c&&s(b),c&&s(I),z(F,c),c&&s(M),c&&s(h),c&&s(N),z(C,c)}}}function gl(V){let p,v;return p=new cr({props:{$$slots:{default:[hl]},$$scope:{ctx:V}}}),{c(){j(p.$$.fragment)},l(u){q(p.$$.fragment,u)},m(u,_){E(p,u,_),v=!0},p(u,_){const y={};_&2&&(y.$$scope={dirty:_,ctx:u}),p.$set(y)},i(u){v||(T(p.$$.fragment,u),v=!0)},o(u){x(p.$$.fragment,u),v=!1},d(u){z(p,u)}}}function _l(V){let p,v,u,_,y,$,w,P,b,L,k,S,A,I,F,M;return w=new W({props:{code:`from transformers import DistilBertForSequenceClassification

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`}}),{c(){p=o("p"),v=a("For example, "),u=o("a"),_=a("DistilBertForSequenceClassification"),y=a(" is a base DistilBERT model with a sequence classification head. The sequence classification head is a linear layer on top of the pooled outputs."),$=m(),j(w.$$.fragment),P=m(),b=o("p"),L=a("Easily reuse this checkpoint for another task by switching to a different model head. For a question answering task, you would use the "),k=o("a"),S=a("DistilBertForQuestionAnswering"),A=a(" model head. The question answering head is similar to the sequence classification head except it is a linear layer on top of the hidden states output."),I=m(),j(F.$$.fragment),this.h()},l(h){p=n(h,"P",{});var B=i(p);v=r(B,"For example, "),u=n(B,"A",{href:!0});var N=i(u);_=r(N,"DistilBertForSequenceClassification"),N.forEach(s),y=r(B," is a base DistilBERT model with a sequence classification head. The sequence classification head is a linear layer on top of the pooled outputs."),B.forEach(s),$=d(h),q(w.$$.fragment,h),P=d(h),b=n(h,"P",{});var C=i(b);L=r(C,"Easily reuse this checkpoint for another task by switching to a different model head. For a question answering task, you would use the "),k=n(C,"A",{href:!0});var R=i(k);S=r(R,"DistilBertForQuestionAnswering"),R.forEach(s),A=r(C," model head. The question answering head is similar to the sequence classification head except it is a linear layer on top of the hidden states output."),C.forEach(s),I=d(h),q(F.$$.fragment,h),this.h()},h(){g(u,"href","/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertForSequenceClassification"),g(k,"href","/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertForQuestionAnswering")},m(h,B){f(h,p,B),t(p,v),t(p,u),t(u,_),t(p,y),f(h,$,B),E(w,h,B),f(h,P,B),f(h,b,B),t(b,L),t(b,k),t(k,S),t(b,A),f(h,I,B),E(F,h,B),M=!0},p:ur,i(h){M||(T(w.$$.fragment,h),T(F.$$.fragment,h),M=!0)},o(h){x(w.$$.fragment,h),x(F.$$.fragment,h),M=!1},d(h){h&&s(p),h&&s($),z(w,h),h&&s(P),h&&s(b),h&&s(I),z(F,h)}}}function $l(V){let p,v;return p=new cr({props:{$$slots:{default:[_l]},$$scope:{ctx:V}}}),{c(){j(p.$$.fragment)},l(u){q(p.$$.fragment,u)},m(u,_){E(p,u,_),v=!0},p(u,_){const y={};_&2&&(y.$$scope={dirty:_,ctx:u}),p.$set(y)},i(u){v||(T(p.$$.fragment,u),v=!0)},o(u){x(p.$$.fragment,u),v=!1},d(u){z(p,u)}}}function vl(V){let p,v,u,_,y,$,w,P,b,L,k,S,A,I,F,M;return w=new W({props:{code:`from transformers import TFDistilBertForSequenceClassification

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

<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`}}),F=new W({props:{code:`from transformers import TFDistilBertForQuestionAnswering

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

<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`}}),{c(){p=o("p"),v=a("For example, "),u=o("a"),_=a("TFDistilBertForSequenceClassification"),y=a(" is a base DistilBERT model with a sequence classification head. The sequence classification head is a linear layer on top of the pooled outputs."),$=m(),j(w.$$.fragment),P=m(),b=o("p"),L=a("Easily reuse this checkpoint for another task by switching to a different model head. For a question answering task, you would use the "),k=o("a"),S=a("TFDistilBertForQuestionAnswering"),A=a(" model head. The question answering head is similar to the sequence classification head except it is a linear layer on top of the hidden states output."),I=m(),j(F.$$.fragment),this.h()},l(h){p=n(h,"P",{});var B=i(p);v=r(B,"For example, "),u=n(B,"A",{href:!0});var N=i(u);_=r(N,"TFDistilBertForSequenceClassification"),N.forEach(s),y=r(B," is a base DistilBERT model with a sequence classification head. The sequence classification head is a linear layer on top of the pooled outputs."),B.forEach(s),$=d(h),q(w.$$.fragment,h),P=d(h),b=n(h,"P",{});var C=i(b);L=r(C,"Easily reuse this checkpoint for another task by switching to a different model head. For a question answering task, you would use the "),k=n(C,"A",{href:!0});var R=i(k);S=r(R,"TFDistilBertForQuestionAnswering"),R.forEach(s),A=r(C," model head. The question answering head is similar to the sequence classification head except it is a linear layer on top of the hidden states output."),C.forEach(s),I=d(h),q(F.$$.fragment,h),this.h()},h(){g(u,"href","/docs/transformers/main/en/model_doc/distilbert#transformers.TFDistilBertForSequenceClassification"),g(k,"href","/docs/transformers/main/en/model_doc/distilbert#transformers.TFDistilBertForQuestionAnswering")},m(h,B){f(h,p,B),t(p,v),t(p,u),t(u,_),t(p,y),f(h,$,B),E(w,h,B),f(h,P,B),f(h,b,B),t(b,L),t(b,k),t(k,S),t(b,A),f(h,I,B),E(F,h,B),M=!0},p:ur,i(h){M||(T(w.$$.fragment,h),T(F.$$.fragment,h),M=!0)},o(h){x(w.$$.fragment,h),x(F.$$.fragment,h),M=!1},d(h){h&&s(p),h&&s($),z(w,h),h&&s(P),h&&s(b),h&&s(I),z(F,h)}}}function wl(V){let p,v;return p=new cr({props:{$$slots:{default:[vl]},$$scope:{ctx:V}}}),{c(){j(p.$$.fragment)},l(u){q(p.$$.fragment,u)},m(u,_){E(p,u,_),v=!0},p(u,_){const y={};_&2&&(y.$$scope={dirty:_,ctx:u}),p.$set(y)},i(u){v||(T(p.$$.fragment,u),v=!0)},o(u){x(p.$$.fragment,u),v=!1},d(u){z(p,u)}}}function yl(V){let p,v,u,_,y;return{c(){p=o("p"),v=a("Not every model supports a fast tokenizer. Take a look at this "),u=o("a"),_=a("table"),y=a(" to check if a model has fast tokenizer support."),this.h()},l($){p=n($,"P",{});var w=i(p);v=r(w,"Not every model supports a fast tokenizer. Take a look at this "),u=n(w,"A",{href:!0});var P=i(u);_=r(P,"table"),P.forEach(s),y=r(w," to check if a model has fast tokenizer support."),w.forEach(s),this.h()},h(){g(u,"href","index#supported-frameworks")},m($,w){f($,p,w),t(p,v),t(p,u),t(u,_),t(p,y)},d($){$&&s(p)}}}function bl(V){let p,v,u,_,y,$,w,P,b,L,k;return{c(){p=o("p"),v=a("By default, "),u=o("a"),_=a("AutoTokenizer"),y=a(" will try to load a fast tokenizer. You can disable this behavior by setting "),$=o("code"),w=a("use_fast=False"),P=a(" in "),b=o("code"),L=a("from_pretrained"),k=a("."),this.h()},l(S){p=n(S,"P",{});var A=i(p);v=r(A,"By default, "),u=n(A,"A",{href:!0});var I=i(u);_=r(I,"AutoTokenizer"),I.forEach(s),y=r(A," will try to load a fast tokenizer. You can disable this behavior by setting "),$=n(A,"CODE",{});var F=i($);w=r(F,"use_fast=False"),F.forEach(s),P=r(A," in "),b=n(A,"CODE",{});var M=i(b);L=r(M,"from_pretrained"),M.forEach(s),k=r(A,"."),A.forEach(s),this.h()},h(){g(u,"href","/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer")},m(S,A){f(S,p,A),t(p,v),t(p,u),t(u,_),t(p,y),t(p,$),t($,w),t(p,P),t(p,b),t(b,L),t(p,k)},d(S){S&&s(p)}}}function kl(V){let p,v,u,_,y;return{c(){p=o("p"),v=a("If you aren\u2019t looking for any customization, just use the "),u=o("code"),_=a("from_pretrained"),y=a(" method to load a model\u2019s default image processor parameters.")},l($){p=n($,"P",{});var w=i(p);v=r(w,"If you aren\u2019t looking for any customization, just use the "),u=n(w,"CODE",{});var P=i(u);_=r(P,"from_pretrained"),P.forEach(s),y=r(w," method to load a model\u2019s default image processor parameters."),w.forEach(s)},m($,w){f($,p,w),t(p,v),t(p,u),t(u,_),t(p,y)},d($){$&&s(p)}}}function jl(V){let p,v,u,_,y;return{c(){p=o("p"),v=a("If you aren\u2019t looking for any customization, just use the "),u=o("code"),_=a("from_pretrained"),y=a(" method to load a model\u2019s default feature extractor parameters.")},l($){p=n($,"P",{});var w=i(p);v=r(w,"If you aren\u2019t looking for any customization, just use the "),u=n(w,"CODE",{});var P=i(u);_=r(P,"from_pretrained"),P.forEach(s),y=r(w," method to load a model\u2019s default feature extractor parameters."),w.forEach(s)},m($,w){f($,p,w),t(p,v),t(p,u),t(u,_),t(p,y)},d($){$&&s(p)}}}function ql(V){let p,v,u,_,y,$,w,P,b,L,k,S,A,I,F,M,h,B,N,C,R,c,D,O,H,ae,re,es,mr,dr,ts,hr,gr,ss,_r,$r,as,vr,wr,rs,yr,Ss,oe,me,os,Ne,br,ns,kr,Ws,Y,jr,vt,qr,Er,is,Tr,xr,ls,zr,Pr,fs,Fr,Dr,ps,Br,Ar,Ls,K,Cr,wt,Ir,Vr,yt,Mr,Sr,Os,Re,Ns,ne,bt,Wr,Lr,kt,Or,Nr,Rs,de,Qe,Rr,us,Qr,Yr,Hr,Ye,Ur,cs,Gr,Jr,Qs,He,Ys,he,Xr,jt,Kr,Zr,Hs,Ue,Us,ge,eo,qt,to,so,Gs,Ge,Js,_e,ao,Et,ro,oo,Xs,Je,Ks,$e,Zs,ie,ve,ms,Xe,no,ds,io,ea,Q,lo,Tt,fo,po,hs,uo,co,xt,mo,ho,Ke,gs,go,_o,Ze,_s,$o,vo,et,$s,wo,yo,ta,we,sa,le,ye,vs,tt,bo,ws,ko,aa,be,jo,ys,qo,Eo,ra,ke,oa,fe,je,bs,st,To,ks,xo,na,qe,zo,zt,Po,Fo,ia,Ee,Pt,Ft,Do,Bo,Ao,Z,Dt,Co,Io,at,Vo,Mo,js,So,Wo,la,Bt,Lo,fa,Te,pa,xe,Oo,qs,No,Ro,ua,rt,ca,ze,Qo,At,Yo,Ho,ma,ot,da,Pe,Uo,Ct,Go,Jo,ha,nt,ga,Fe,_a,pe,De,Es,it,Xo,Ts,Ko,$a,Be,Zo,It,en,tn,va,ee,sn,Vt,an,rn,Mt,on,nn,wa,lt,ya,Ae,ba,Ce,ln,St,fn,pn,ka,ft,ja,ue,Ie,xs,pt,un,zs,cn,qa,te,mn,Wt,dn,hn,Lt,gn,_n,Ea,se,$n,Ot,vn,wn,Nt,yn,bn,Ta,ut,xa,Ve,za,Me,kn,Rt,jn,qn,Pa,ct,Fa,ce,Se,Ps,mt,En,Fs,Tn,Da,We,xn,Qt,zn,Pn,Ba,Yt,Fn,Aa,dt,Ca,Ht,Dn,Ia,ht,Va,Le,Bn,Ut,An,Cn,Ma,gt,Sa,Gt,In,Wa;return $=new Oe({}),Ne=new Oe({}),Re=new W({props:{code:`from transformers import DistilBertConfig

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

<span class="hljs-meta">&gt;&gt;&gt; </span>config = DistilBertConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(config)
DistilBertConfig {
  <span class="hljs-string">&quot;activation&quot;</span>: <span class="hljs-string">&quot;gelu&quot;</span>,
  <span class="hljs-string">&quot;attention_dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;dim&quot;</span>: <span class="hljs-number">768</span>,
  <span class="hljs-string">&quot;dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;hidden_dim&quot;</span>: <span class="hljs-number">3072</span>,
  <span class="hljs-string">&quot;initializer_range&quot;</span>: <span class="hljs-number">0.02</span>,
  <span class="hljs-string">&quot;max_position_embeddings&quot;</span>: <span class="hljs-number">512</span>,
  <span class="hljs-string">&quot;model_type&quot;</span>: <span class="hljs-string">&quot;distilbert&quot;</span>,
  <span class="hljs-string">&quot;n_heads&quot;</span>: <span class="hljs-number">12</span>,
  <span class="hljs-string">&quot;n_layers&quot;</span>: <span class="hljs-number">6</span>,
  <span class="hljs-string">&quot;pad_token_id&quot;</span>: <span class="hljs-number">0</span>,
  <span class="hljs-string">&quot;qa_dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;seq_classif_dropout&quot;</span>: <span class="hljs-number">0.2</span>,
  <span class="hljs-string">&quot;sinusoidal_pos_embds&quot;</span>: false,
  <span class="hljs-string">&quot;transformers_version&quot;</span>: <span class="hljs-string">&quot;4.16.2&quot;</span>,
  <span class="hljs-string">&quot;vocab_size&quot;</span>: <span class="hljs-number">30522</span>
}`}}),He=new W({props:{code:`my_config = DistilBertConfig(activation="relu", attention_dropout=0.4)
print(my_config)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig(activation=<span class="hljs-string">&quot;relu&quot;</span>, attention_dropout=<span class="hljs-number">0.4</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(my_config)
DistilBertConfig {
  <span class="hljs-string">&quot;activation&quot;</span>: <span class="hljs-string">&quot;relu&quot;</span>,
  <span class="hljs-string">&quot;attention_dropout&quot;</span>: <span class="hljs-number">0.4</span>,
  <span class="hljs-string">&quot;dim&quot;</span>: <span class="hljs-number">768</span>,
  <span class="hljs-string">&quot;dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;hidden_dim&quot;</span>: <span class="hljs-number">3072</span>,
  <span class="hljs-string">&quot;initializer_range&quot;</span>: <span class="hljs-number">0.02</span>,
  <span class="hljs-string">&quot;max_position_embeddings&quot;</span>: <span class="hljs-number">512</span>,
  <span class="hljs-string">&quot;model_type&quot;</span>: <span class="hljs-string">&quot;distilbert&quot;</span>,
  <span class="hljs-string">&quot;n_heads&quot;</span>: <span class="hljs-number">12</span>,
  <span class="hljs-string">&quot;n_layers&quot;</span>: <span class="hljs-number">6</span>,
  <span class="hljs-string">&quot;pad_token_id&quot;</span>: <span class="hljs-number">0</span>,
  <span class="hljs-string">&quot;qa_dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;seq_classif_dropout&quot;</span>: <span class="hljs-number">0.2</span>,
  <span class="hljs-string">&quot;sinusoidal_pos_embds&quot;</span>: false,
  <span class="hljs-string">&quot;transformers_version&quot;</span>: <span class="hljs-string">&quot;4.16.2&quot;</span>,
  <span class="hljs-string">&quot;vocab_size&quot;</span>: <span class="hljs-number">30522</span>
}`}}),Ue=new W({props:{code:'my_config = DistilBertConfig.from_pretrained("distilbert-base-uncased", activation="relu", attention_dropout=0.4)',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>, activation=<span class="hljs-string">&quot;relu&quot;</span>, attention_dropout=<span class="hljs-number">0.4</span>)'}}),Ge=new W({props:{code:'my_config.save_pretrained(save_directory="./your_model_save_path")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>my_config.save_pretrained(save_directory=<span class="hljs-string">&quot;./your_model_save_path&quot;</span>)'}}),Je=new W({props:{code:'my_config = DistilBertConfig.from_pretrained("./your_model_save_path/config.json")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig.from_pretrained(<span class="hljs-string">&quot;./your_model_save_path/config.json&quot;</span>)'}}),$e=new Ms({props:{$$slots:{default:[cl]},$$scope:{ctx:V}}}),Xe=new Oe({}),we=new nl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[gl],pytorch:[dl]},$$scope:{ctx:V}}}),tt=new Oe({}),ke=new nl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[wl],pytorch:[$l]},$$scope:{ctx:V}}}),st=new Oe({}),Te=new Ms({props:{warning:!0,$$slots:{default:[yl]},$$scope:{ctx:V}}}),rt=new W({props:{code:`from transformers import DistilBertTokenizer

my_tokenizer = DistilBertTokenizer(vocab_file="my_vocab_file.txt", do_lower_case=False, padding_side="left")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>my_tokenizer = DistilBertTokenizer(vocab_file=<span class="hljs-string">&quot;my_vocab_file.txt&quot;</span>, do_lower_case=<span class="hljs-literal">False</span>, padding_side=<span class="hljs-string">&quot;left&quot;</span>)`}}),ot=new W({props:{code:`from transformers import DistilBertTokenizer

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

<span class="hljs-meta">&gt;&gt;&gt; </span>slow_tokenizer = DistilBertTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`}}),nt=new W({props:{code:`from transformers import DistilBertTokenizerFast

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

<span class="hljs-meta">&gt;&gt;&gt; </span>fast_tokenizer = DistilBertTokenizerFast.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`}}),Fe=new Ms({props:{$$slots:{default:[bl]},$$scope:{ctx:V}}}),it=new Oe({}),lt=new W({props:{code:`from transformers import ViTImageProcessor

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

<span class="hljs-meta">&gt;&gt;&gt; </span>vit_extractor = ViTImageProcessor()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(vit_extractor)
ViTImageProcessor {
  <span class="hljs-string">&quot;do_normalize&quot;</span>: true,
  <span class="hljs-string">&quot;do_resize&quot;</span>: true,
  <span class="hljs-string">&quot;feature_extractor_type&quot;</span>: <span class="hljs-string">&quot;ViTImageProcessor&quot;</span>,
  <span class="hljs-string">&quot;image_mean&quot;</span>: [
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>
  ],
  <span class="hljs-string">&quot;image_std&quot;</span>: [
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>
  ],
  <span class="hljs-string">&quot;resample&quot;</span>: <span class="hljs-number">2</span>,
  <span class="hljs-string">&quot;size&quot;</span>: <span class="hljs-number">224</span>
}`}}),Ae=new Ms({props:{$$slots:{default:[kl]},$$scope:{ctx:V}}}),ft=new W({props:{code:`from transformers import ViTImageProcessor

my_vit_extractor = ViTImageProcessor(resample="PIL.Image.BOX", do_normalize=False, image_mean=[0.3, 0.3, 0.3])
print(my_vit_extractor)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViTImageProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span>my_vit_extractor = ViTImageProcessor(resample=<span class="hljs-string">&quot;PIL.Image.BOX&quot;</span>, do_normalize=<span class="hljs-literal">False</span>, image_mean=[<span class="hljs-number">0.3</span>, <span class="hljs-number">0.3</span>, <span class="hljs-number">0.3</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(my_vit_extractor)
ViTImageProcessor {
  <span class="hljs-string">&quot;do_normalize&quot;</span>: false,
  <span class="hljs-string">&quot;do_resize&quot;</span>: true,
  <span class="hljs-string">&quot;feature_extractor_type&quot;</span>: <span class="hljs-string">&quot;ViTImageProcessor&quot;</span>,
  <span class="hljs-string">&quot;image_mean&quot;</span>: [
    <span class="hljs-number">0.3</span>,
    <span class="hljs-number">0.3</span>,
    <span class="hljs-number">0.3</span>
  ],
  <span class="hljs-string">&quot;image_std&quot;</span>: [
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>
  ],
  <span class="hljs-string">&quot;resample&quot;</span>: <span class="hljs-string">&quot;PIL.Image.BOX&quot;</span>,
  <span class="hljs-string">&quot;size&quot;</span>: <span class="hljs-number">224</span>
}`}}),pt=new Oe({}),ut=new W({props:{code:`from transformers import Wav2Vec2FeatureExtractor

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

<span class="hljs-meta">&gt;&gt;&gt; </span>w2v2_extractor = Wav2Vec2FeatureExtractor()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(w2v2_extractor)
Wav2Vec2FeatureExtractor {
  <span class="hljs-string">&quot;do_normalize&quot;</span>: true,
  <span class="hljs-string">&quot;feature_extractor_type&quot;</span>: <span class="hljs-string">&quot;Wav2Vec2FeatureExtractor&quot;</span>,
  <span class="hljs-string">&quot;feature_size&quot;</span>: <span class="hljs-number">1</span>,
  <span class="hljs-string">&quot;padding_side&quot;</span>: <span class="hljs-string">&quot;right&quot;</span>,
  <span class="hljs-string">&quot;padding_value&quot;</span>: <span class="hljs-number">0.0</span>,
  <span class="hljs-string">&quot;return_attention_mask&quot;</span>: false,
  <span class="hljs-string">&quot;sampling_rate&quot;</span>: <span class="hljs-number">16000</span>
}`}}),Ve=new Ms({props:{$$slots:{default:[jl]},$$scope:{ctx:V}}}),ct=new W({props:{code:`from transformers import Wav2Vec2FeatureExtractor

w2v2_extractor = Wav2Vec2FeatureExtractor(sampling_rate=8000, do_normalize=False)
print(w2v2_extractor)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2FeatureExtractor

<span class="hljs-meta">&gt;&gt;&gt; </span>w2v2_extractor = Wav2Vec2FeatureExtractor(sampling_rate=<span class="hljs-number">8000</span>, do_normalize=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(w2v2_extractor)
Wav2Vec2FeatureExtractor {
  <span class="hljs-string">&quot;do_normalize&quot;</span>: false,
  <span class="hljs-string">&quot;feature_extractor_type&quot;</span>: <span class="hljs-string">&quot;Wav2Vec2FeatureExtractor&quot;</span>,
  <span class="hljs-string">&quot;feature_size&quot;</span>: <span class="hljs-number">1</span>,
  <span class="hljs-string">&quot;padding_side&quot;</span>: <span class="hljs-string">&quot;right&quot;</span>,
  <span class="hljs-string">&quot;padding_value&quot;</span>: <span class="hljs-number">0.0</span>,
  <span class="hljs-string">&quot;return_attention_mask&quot;</span>: false,
  <span class="hljs-string">&quot;sampling_rate&quot;</span>: <span class="hljs-number">8000</span>
}`}}),mt=new Oe({}),dt=new W({props:{code:`from transformers import Wav2Vec2FeatureExtractor

feature_extractor = Wav2Vec2FeatureExtractor(padding_value=1.0, do_normalize=True)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2FeatureExtractor

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = Wav2Vec2FeatureExtractor(padding_value=<span class="hljs-number">1.0</span>, do_normalize=<span class="hljs-literal">True</span>)`}}),ht=new W({props:{code:`from transformers import Wav2Vec2CTCTokenizer

tokenizer = Wav2Vec2CTCTokenizer(vocab_file="my_vocab_file.txt")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2CTCTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = Wav2Vec2CTCTokenizer(vocab_file=<span class="hljs-string">&quot;my_vocab_file.txt&quot;</span>)`}}),gt=new W({props:{code:`from transformers import Wav2Vec2Processor

processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2Processor

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer)`}}),{c(){p=o("meta"),v=m(),u=o("h1"),_=o("a"),y=o("span"),j($.$$.fragment),w=m(),P=o("span"),b=a("Create a custom architecture"),L=m(),k=o("p"),S=a("An "),A=o("a"),I=o("code"),F=a("AutoClass"),M=a(" automatically infers the model architecture and downloads pretrained configuration and weights. Generally, we recommend using an "),h=o("code"),B=a("AutoClass"),N=a(" to produce checkpoint-agnostic code. But users who want more control over specific model parameters can create a custom \u{1F917} Transformers model from just a few base classes. This could be particularly useful for anyone who is interested in studying, training or experimenting with a \u{1F917} Transformers model. In this guide, dive deeper into creating a custom model without an "),C=o("code"),R=a("AutoClass"),c=a(". Learn how to:"),D=m(),O=o("ul"),H=o("li"),ae=a("Load and customize a model configuration."),re=m(),es=o("li"),mr=a("Create a model architecture."),dr=m(),ts=o("li"),hr=a("Create a slow and fast tokenizer for text."),gr=m(),ss=o("li"),_r=a("Create an image processor for vision tasks."),$r=m(),as=o("li"),vr=a("Create a feature extractor for audio tasks."),wr=m(),rs=o("li"),yr=a("Create a processor for multimodal tasks."),Ss=m(),oe=o("h2"),me=o("a"),os=o("span"),j(Ne.$$.fragment),br=m(),ns=o("span"),kr=a("Configuration"),Ws=m(),Y=o("p"),jr=a("A "),vt=o("a"),qr=a("configuration"),Er=a(" refers to a model\u2019s specific attributes. Each model configuration has different attributes; for instance, all NLP models have the "),is=o("code"),Tr=a("hidden_size"),xr=a(", "),ls=o("code"),zr=a("num_attention_heads"),Pr=a(", "),fs=o("code"),Fr=a("num_hidden_layers"),Dr=a(" and "),ps=o("code"),Br=a("vocab_size"),Ar=a(" attributes in common. These attributes specify the number of attention heads or hidden layers to construct a model with."),Ls=m(),K=o("p"),Cr=a("Get a closer look at "),wt=o("a"),Ir=a("DistilBERT"),Vr=a(" by accessing "),yt=o("a"),Mr=a("DistilBertConfig"),Sr=a(" to inspect it\u2019s attributes:"),Os=m(),j(Re.$$.fragment),Ns=m(),ne=o("p"),bt=o("a"),Wr=a("DistilBertConfig"),Lr=a(" displays all the default attributes used to build a base "),kt=o("a"),Or=a("DistilBertModel"),Nr=a(". All attributes are customizable, creating space for experimentation. For example, you can customize a default model to:"),Rs=m(),de=o("ul"),Qe=o("li"),Rr=a("Try a different activation function with the "),us=o("code"),Qr=a("activation"),Yr=a(" parameter."),Hr=m(),Ye=o("li"),Ur=a("Use a higher dropout ratio for the attention probabilities with the "),cs=o("code"),Gr=a("attention_dropout"),Jr=a(" parameter."),Qs=m(),j(He.$$.fragment),Ys=m(),he=o("p"),Xr=a("Pretrained model attributes can be modified in the "),jt=o("a"),Kr=a("from_pretrained()"),Zr=a(" function:"),Hs=m(),j(Ue.$$.fragment),Us=m(),ge=o("p"),eo=a("Once you are satisfied with your model configuration, you can save it with "),qt=o("a"),to=a("save_pretrained()"),so=a(". Your configuration file is stored as a JSON file in the specified save directory:"),Gs=m(),j(Ge.$$.fragment),Js=m(),_e=o("p"),ao=a("To reuse the configuration file, load it with "),Et=o("a"),ro=a("from_pretrained()"),oo=a(":"),Xs=m(),j(Je.$$.fragment),Ks=m(),j($e.$$.fragment),Zs=m(),ie=o("h2"),ve=o("a"),ms=o("span"),j(Xe.$$.fragment),no=m(),ds=o("span"),io=a("Model"),ea=m(),Q=o("p"),lo=a("The next step is to create a "),Tt=o("a"),fo=a("model"),po=a(". The model - also loosely referred to as the architecture - defines what each layer is doing and what operations are happening. Attributes like "),hs=o("code"),uo=a("num_hidden_layers"),co=a(" from the configuration are used to define the architecture. Every model shares the base class "),xt=o("a"),mo=a("PreTrainedModel"),ho=a(" and a few common methods like resizing input embeddings and pruning self-attention heads. In addition, all models are also either a "),Ke=o("a"),gs=o("code"),go=a("torch.nn.Module"),_o=a(", "),Ze=o("a"),_s=o("code"),$o=a("tf.keras.Model"),vo=a(" or "),et=o("a"),$s=o("code"),wo=a("flax.linen.Module"),yo=a(" subclass. This means models are compatible with each of their respective framework\u2019s usage."),ta=m(),j(we.$$.fragment),sa=m(),le=o("h3"),ye=o("a"),vs=o("span"),j(tt.$$.fragment),bo=m(),ws=o("span"),ko=a("Model heads"),aa=m(),be=o("p"),jo=a("At this point, you have a base DistilBERT model which outputs the "),ys=o("em"),qo=a("hidden states"),Eo=a(". The hidden states are passed as inputs to a model head to produce the final output. \u{1F917} Transformers provides a different model head for each task as long as a model supports the task (i.e., you can\u2019t use DistilBERT for a sequence-to-sequence task like translation)."),ra=m(),j(ke.$$.fragment),oa=m(),fe=o("h2"),je=o("a"),bs=o("span"),j(st.$$.fragment),To=m(),ks=o("span"),xo=a("Tokenizer"),na=m(),qe=o("p"),zo=a("The last base class you need before using a model for textual data is a "),zt=o("a"),Po=a("tokenizer"),Fo=a(" to convert raw text to tensors. There are two types of tokenizers you can use with \u{1F917} Transformers:"),ia=m(),Ee=o("ul"),Pt=o("li"),Ft=o("a"),Do=a("PreTrainedTokenizer"),Bo=a(": a Python implementation of a tokenizer."),Ao=m(),Z=o("li"),Dt=o("a"),Co=a("PreTrainedTokenizerFast"),Io=a(": a tokenizer from our Rust-based "),at=o("a"),Vo=a("\u{1F917} Tokenizer"),Mo=a(" library. This tokenizer type is significantly faster - especially during batch tokenization - due to it\u2019s Rust implementation. The fast tokenizer also offers additional methods like "),js=o("em"),So=a("offset mapping"),Wo=a(" which maps tokens to their original words or characters."),la=m(),Bt=o("p"),Lo=a("Both tokenizers support common methods such as encoding and decoding, adding new tokens, and managing special tokens."),fa=m(),j(Te.$$.fragment),pa=m(),xe=o("p"),Oo=a("If you trained your own tokenizer, you can create one from your "),qs=o("em"),No=a("vocabulary"),Ro=a(" file:"),ua=m(),j(rt.$$.fragment),ca=m(),ze=o("p"),Qo=a("It is important to remember the vocabulary from a custom tokenizer will be different from the vocabulary generated by a pretrained model\u2019s tokenizer. You need to use a pretrained model\u2019s vocabulary if you are using a pretrained model, otherwise the inputs won\u2019t make sense. Create a tokenizer with a pretrained model\u2019s vocabulary with the "),At=o("a"),Yo=a("DistilBertTokenizer"),Ho=a(" class:"),ma=m(),j(ot.$$.fragment),da=m(),Pe=o("p"),Uo=a("Create a fast tokenizer with the "),Ct=o("a"),Go=a("DistilBertTokenizerFast"),Jo=a(" class:"),ha=m(),j(nt.$$.fragment),ga=m(),j(Fe.$$.fragment),_a=m(),pe=o("h2"),De=o("a"),Es=o("span"),j(it.$$.fragment),Xo=m(),Ts=o("span"),Ko=a("Image Processor"),$a=m(),Be=o("p"),Zo=a("An image processor processes vision inputs. It inherits from the base "),It=o("a"),en=a("ImageProcessingMixin"),tn=a(" class."),va=m(),ee=o("p"),sn=a("To use, create an image processor associated with the model you\u2019re using. For example, create a default "),Vt=o("a"),an=a("ViTImageProcessor"),rn=a(" if you are using "),Mt=o("a"),on=a("ViT"),nn=a(" for image classification:"),wa=m(),j(lt.$$.fragment),ya=m(),j(Ae.$$.fragment),ba=m(),Ce=o("p"),ln=a("Modify any of the "),St=o("a"),fn=a("ViTImageProcessor"),pn=a(" parameters to create your custom image processor:"),ka=m(),j(ft.$$.fragment),ja=m(),ue=o("h2"),Ie=o("a"),xs=o("span"),j(pt.$$.fragment),un=m(),zs=o("span"),cn=a("Feature Extractor"),qa=m(),te=o("p"),mn=a("A feature extractor processes audio inputs. It inherits from the base "),Wt=o("a"),dn=a("FeatureExtractionMixin"),hn=a(" class, and may also inherit from the "),Lt=o("a"),gn=a("SequenceFeatureExtractor"),_n=a(" class for processing audio inputs."),Ea=m(),se=o("p"),$n=a("To use, create a feature extractor associated with the model you\u2019re using. For example, create a default "),Ot=o("a"),vn=a("Wav2Vec2FeatureExtractor"),wn=a(" if you are using "),Nt=o("a"),yn=a("Wav2Vec2"),bn=a(" for audio classification:"),Ta=m(),j(ut.$$.fragment),xa=m(),j(Ve.$$.fragment),za=m(),Me=o("p"),kn=a("Modify any of the "),Rt=o("a"),jn=a("Wav2Vec2FeatureExtractor"),qn=a(" parameters to create your custom feature extractor:"),Pa=m(),j(ct.$$.fragment),Fa=m(),ce=o("h2"),Se=o("a"),Ps=o("span"),j(mt.$$.fragment),En=m(),Fs=o("span"),Tn=a("Processor"),Da=m(),We=o("p"),xn=a("For models that support multimodal tasks, \u{1F917} Transformers offers a processor class that conveniently wraps processing classes such as a feature extractor and a tokenizer into a single object. For example, let\u2019s use the "),Qt=o("a"),zn=a("Wav2Vec2Processor"),Pn=a(" for an automatic speech recognition task (ASR). ASR transcribes audio to text, so you will need a feature extractor and a tokenizer."),Ba=m(),Yt=o("p"),Fn=a("Create a feature extractor to handle the audio inputs:"),Aa=m(),j(dt.$$.fragment),Ca=m(),Ht=o("p"),Dn=a("Create a tokenizer to handle the text inputs:"),Ia=m(),j(ht.$$.fragment),Va=m(),Le=o("p"),Bn=a("Combine the feature extractor and tokenizer in "),Ut=o("a"),An=a("Wav2Vec2Processor"),Cn=a(":"),Ma=m(),j(gt.$$.fragment),Sa=m(),Gt=o("p"),In=a("With two basic classes - configuration and model - and an additional preprocessing class (tokenizer, image processor, feature extractor, or processor), you can create any of the models supported by \u{1F917} Transformers. Each of these base classes are configurable, allowing you to use the specific attributes you want. You can easily setup a model for training or modify an existing pretrained model to fine-tune."),this.h()},l(e){const l=pl('[data-svelte="svelte-1phssyn"]',document.head);p=n(l,"META",{name:!0,content:!0}),l.forEach(s),v=d(e),u=n(e,"H1",{class:!0});var _t=i(u);_=n(_t,"A",{id:!0,class:!0,href:!0});var Ds=i(_);y=n(Ds,"SPAN",{});var Bs=i(y);q($.$$.fragment,Bs),Bs.forEach(s),Ds.forEach(s),w=d(_t),P=n(_t,"SPAN",{});var As=i(P);b=r(As,"Create a custom architecture"),As.forEach(s),_t.forEach(s),L=d(e),k=n(e,"P",{});var X=i(k);S=r(X,"An "),A=n(X,"A",{href:!0});var Cs=i(A);I=n(Cs,"CODE",{});var Is=i(I);F=r(Is,"AutoClass"),Is.forEach(s),Cs.forEach(s),M=r(X," automatically infers the model architecture and downloads pretrained configuration and weights. Generally, we recommend using an "),h=n(X,"CODE",{});var Mn=i(h);B=r(Mn,"AutoClass"),Mn.forEach(s),N=r(X," to produce checkpoint-agnostic code. But users who want more control over specific model parameters can create a custom \u{1F917} Transformers model from just a few base classes. This could be particularly useful for anyone who is interested in studying, training or experimenting with a \u{1F917} Transformers model. In this guide, dive deeper into creating a custom model without an "),C=n(X,"CODE",{});var Sn=i(C);R=r(Sn,"AutoClass"),Sn.forEach(s),c=r(X,". Learn how to:"),X.forEach(s),D=d(e),O=n(e,"UL",{});var G=i(O);H=n(G,"LI",{});var Wn=i(H);ae=r(Wn,"Load and customize a model configuration."),Wn.forEach(s),re=d(G),es=n(G,"LI",{});var Ln=i(es);mr=r(Ln,"Create a model architecture."),Ln.forEach(s),dr=d(G),ts=n(G,"LI",{});var On=i(ts);hr=r(On,"Create a slow and fast tokenizer for text."),On.forEach(s),gr=d(G),ss=n(G,"LI",{});var Nn=i(ss);_r=r(Nn,"Create an image processor for vision tasks."),Nn.forEach(s),$r=d(G),as=n(G,"LI",{});var Rn=i(as);vr=r(Rn,"Create a feature extractor for audio tasks."),Rn.forEach(s),wr=d(G),rs=n(G,"LI",{});var Qn=i(rs);yr=r(Qn,"Create a processor for multimodal tasks."),Qn.forEach(s),G.forEach(s),Ss=d(e),oe=n(e,"H2",{class:!0});var La=i(oe);me=n(La,"A",{id:!0,class:!0,href:!0});var Yn=i(me);os=n(Yn,"SPAN",{});var Hn=i(os);q(Ne.$$.fragment,Hn),Hn.forEach(s),Yn.forEach(s),br=d(La),ns=n(La,"SPAN",{});var Un=i(ns);kr=r(Un,"Configuration"),Un.forEach(s),La.forEach(s),Ws=d(e),Y=n(e,"P",{});var J=i(Y);jr=r(J,"A "),vt=n(J,"A",{href:!0});var Gn=i(vt);qr=r(Gn,"configuration"),Gn.forEach(s),Er=r(J," refers to a model\u2019s specific attributes. Each model configuration has different attributes; for instance, all NLP models have the "),is=n(J,"CODE",{});var Jn=i(is);Tr=r(Jn,"hidden_size"),Jn.forEach(s),xr=r(J,", "),ls=n(J,"CODE",{});var Xn=i(ls);zr=r(Xn,"num_attention_heads"),Xn.forEach(s),Pr=r(J,", "),fs=n(J,"CODE",{});var Kn=i(fs);Fr=r(Kn,"num_hidden_layers"),Kn.forEach(s),Dr=r(J," and "),ps=n(J,"CODE",{});var Zn=i(ps);Br=r(Zn,"vocab_size"),Zn.forEach(s),Ar=r(J," attributes in common. These attributes specify the number of attention heads or hidden layers to construct a model with."),J.forEach(s),Ls=d(e),K=n(e,"P",{});var Jt=i(K);Cr=r(Jt,"Get a closer look at "),wt=n(Jt,"A",{href:!0});var ei=i(wt);Ir=r(ei,"DistilBERT"),ei.forEach(s),Vr=r(Jt," by accessing "),yt=n(Jt,"A",{href:!0});var ti=i(yt);Mr=r(ti,"DistilBertConfig"),ti.forEach(s),Sr=r(Jt," to inspect it\u2019s attributes:"),Jt.forEach(s),Os=d(e),q(Re.$$.fragment,e),Ns=d(e),ne=n(e,"P",{});var Vs=i(ne);bt=n(Vs,"A",{href:!0});var si=i(bt);Wr=r(si,"DistilBertConfig"),si.forEach(s),Lr=r(Vs," displays all the default attributes used to build a base "),kt=n(Vs,"A",{href:!0});var ai=i(kt);Or=r(ai,"DistilBertModel"),ai.forEach(s),Nr=r(Vs,". All attributes are customizable, creating space for experimentation. For example, you can customize a default model to:"),Vs.forEach(s),Rs=d(e),de=n(e,"UL",{});var Oa=i(de);Qe=n(Oa,"LI",{});var Na=i(Qe);Rr=r(Na,"Try a different activation function with the "),us=n(Na,"CODE",{});var ri=i(us);Qr=r(ri,"activation"),ri.forEach(s),Yr=r(Na," parameter."),Na.forEach(s),Hr=d(Oa),Ye=n(Oa,"LI",{});var Ra=i(Ye);Ur=r(Ra,"Use a higher dropout ratio for the attention probabilities with the "),cs=n(Ra,"CODE",{});var oi=i(cs);Gr=r(oi,"attention_dropout"),oi.forEach(s),Jr=r(Ra," parameter."),Ra.forEach(s),Oa.forEach(s),Qs=d(e),q(He.$$.fragment,e),Ys=d(e),he=n(e,"P",{});var Qa=i(he);Xr=r(Qa,"Pretrained model attributes can be modified in the "),jt=n(Qa,"A",{href:!0});var ni=i(jt);Kr=r(ni,"from_pretrained()"),ni.forEach(s),Zr=r(Qa," function:"),Qa.forEach(s),Hs=d(e),q(Ue.$$.fragment,e),Us=d(e),ge=n(e,"P",{});var Ya=i(ge);eo=r(Ya,"Once you are satisfied with your model configuration, you can save it with "),qt=n(Ya,"A",{href:!0});var ii=i(qt);to=r(ii,"save_pretrained()"),ii.forEach(s),so=r(Ya,". Your configuration file is stored as a JSON file in the specified save directory:"),Ya.forEach(s),Gs=d(e),q(Ge.$$.fragment,e),Js=d(e),_e=n(e,"P",{});var Ha=i(_e);ao=r(Ha,"To reuse the configuration file, load it with "),Et=n(Ha,"A",{href:!0});var li=i(Et);ro=r(li,"from_pretrained()"),li.forEach(s),oo=r(Ha,":"),Ha.forEach(s),Xs=d(e),q(Je.$$.fragment,e),Ks=d(e),q($e.$$.fragment,e),Zs=d(e),ie=n(e,"H2",{class:!0});var Ua=i(ie);ve=n(Ua,"A",{id:!0,class:!0,href:!0});var fi=i(ve);ms=n(fi,"SPAN",{});var pi=i(ms);q(Xe.$$.fragment,pi),pi.forEach(s),fi.forEach(s),no=d(Ua),ds=n(Ua,"SPAN",{});var ui=i(ds);io=r(ui,"Model"),ui.forEach(s),Ua.forEach(s),ea=d(e),Q=n(e,"P",{});var U=i(Q);lo=r(U,"The next step is to create a "),Tt=n(U,"A",{href:!0});var ci=i(Tt);fo=r(ci,"model"),ci.forEach(s),po=r(U,". The model - also loosely referred to as the architecture - defines what each layer is doing and what operations are happening. Attributes like "),hs=n(U,"CODE",{});var mi=i(hs);uo=r(mi,"num_hidden_layers"),mi.forEach(s),co=r(U," from the configuration are used to define the architecture. Every model shares the base class "),xt=n(U,"A",{href:!0});var di=i(xt);mo=r(di,"PreTrainedModel"),di.forEach(s),ho=r(U," and a few common methods like resizing input embeddings and pruning self-attention heads. In addition, all models are also either a "),Ke=n(U,"A",{href:!0,rel:!0});var hi=i(Ke);gs=n(hi,"CODE",{});var gi=i(gs);go=r(gi,"torch.nn.Module"),gi.forEach(s),hi.forEach(s),_o=r(U,", "),Ze=n(U,"A",{href:!0,rel:!0});var _i=i(Ze);_s=n(_i,"CODE",{});var $i=i(_s);$o=r($i,"tf.keras.Model"),$i.forEach(s),_i.forEach(s),vo=r(U," or "),et=n(U,"A",{href:!0,rel:!0});var vi=i(et);$s=n(vi,"CODE",{});var wi=i($s);wo=r(wi,"flax.linen.Module"),wi.forEach(s),vi.forEach(s),yo=r(U," subclass. This means models are compatible with each of their respective framework\u2019s usage."),U.forEach(s),ta=d(e),q(we.$$.fragment,e),sa=d(e),le=n(e,"H3",{class:!0});var Ga=i(le);ye=n(Ga,"A",{id:!0,class:!0,href:!0});var yi=i(ye);vs=n(yi,"SPAN",{});var bi=i(vs);q(tt.$$.fragment,bi),bi.forEach(s),yi.forEach(s),bo=d(Ga),ws=n(Ga,"SPAN",{});var ki=i(ws);ko=r(ki,"Model heads"),ki.forEach(s),Ga.forEach(s),aa=d(e),be=n(e,"P",{});var Ja=i(be);jo=r(Ja,"At this point, you have a base DistilBERT model which outputs the "),ys=n(Ja,"EM",{});var ji=i(ys);qo=r(ji,"hidden states"),ji.forEach(s),Eo=r(Ja,". The hidden states are passed as inputs to a model head to produce the final output. \u{1F917} Transformers provides a different model head for each task as long as a model supports the task (i.e., you can\u2019t use DistilBERT for a sequence-to-sequence task like translation)."),Ja.forEach(s),ra=d(e),q(ke.$$.fragment,e),oa=d(e),fe=n(e,"H2",{class:!0});var Xa=i(fe);je=n(Xa,"A",{id:!0,class:!0,href:!0});var qi=i(je);bs=n(qi,"SPAN",{});var Ei=i(bs);q(st.$$.fragment,Ei),Ei.forEach(s),qi.forEach(s),To=d(Xa),ks=n(Xa,"SPAN",{});var Ti=i(ks);xo=r(Ti,"Tokenizer"),Ti.forEach(s),Xa.forEach(s),na=d(e),qe=n(e,"P",{});var Ka=i(qe);zo=r(Ka,"The last base class you need before using a model for textual data is a "),zt=n(Ka,"A",{href:!0});var xi=i(zt);Po=r(xi,"tokenizer"),xi.forEach(s),Fo=r(Ka," to convert raw text to tensors. There are two types of tokenizers you can use with \u{1F917} Transformers:"),Ka.forEach(s),ia=d(e),Ee=n(e,"UL",{});var Za=i(Ee);Pt=n(Za,"LI",{});var Vn=i(Pt);Ft=n(Vn,"A",{href:!0});var zi=i(Ft);Do=r(zi,"PreTrainedTokenizer"),zi.forEach(s),Bo=r(Vn,": a Python implementation of a tokenizer."),Vn.forEach(s),Ao=d(Za),Z=n(Za,"LI",{});var $t=i(Z);Dt=n($t,"A",{href:!0});var Pi=i(Dt);Co=r(Pi,"PreTrainedTokenizerFast"),Pi.forEach(s),Io=r($t,": a tokenizer from our Rust-based "),at=n($t,"A",{href:!0,rel:!0});var Fi=i(at);Vo=r(Fi,"\u{1F917} Tokenizer"),Fi.forEach(s),Mo=r($t," library. This tokenizer type is significantly faster - especially during batch tokenization - due to it\u2019s Rust implementation. The fast tokenizer also offers additional methods like "),js=n($t,"EM",{});var Di=i(js);So=r(Di,"offset mapping"),Di.forEach(s),Wo=r($t," which maps tokens to their original words or characters."),$t.forEach(s),Za.forEach(s),la=d(e),Bt=n(e,"P",{});var Bi=i(Bt);Lo=r(Bi,"Both tokenizers support common methods such as encoding and decoding, adding new tokens, and managing special tokens."),Bi.forEach(s),fa=d(e),q(Te.$$.fragment,e),pa=d(e),xe=n(e,"P",{});var er=i(xe);Oo=r(er,"If you trained your own tokenizer, you can create one from your "),qs=n(er,"EM",{});var Ai=i(qs);No=r(Ai,"vocabulary"),Ai.forEach(s),Ro=r(er," file:"),er.forEach(s),ua=d(e),q(rt.$$.fragment,e),ca=d(e),ze=n(e,"P",{});var tr=i(ze);Qo=r(tr,"It is important to remember the vocabulary from a custom tokenizer will be different from the vocabulary generated by a pretrained model\u2019s tokenizer. You need to use a pretrained model\u2019s vocabulary if you are using a pretrained model, otherwise the inputs won\u2019t make sense. Create a tokenizer with a pretrained model\u2019s vocabulary with the "),At=n(tr,"A",{href:!0});var Ci=i(At);Yo=r(Ci,"DistilBertTokenizer"),Ci.forEach(s),Ho=r(tr," class:"),tr.forEach(s),ma=d(e),q(ot.$$.fragment,e),da=d(e),Pe=n(e,"P",{});var sr=i(Pe);Uo=r(sr,"Create a fast tokenizer with the "),Ct=n(sr,"A",{href:!0});var Ii=i(Ct);Go=r(Ii,"DistilBertTokenizerFast"),Ii.forEach(s),Jo=r(sr," class:"),sr.forEach(s),ha=d(e),q(nt.$$.fragment,e),ga=d(e),q(Fe.$$.fragment,e),_a=d(e),pe=n(e,"H2",{class:!0});var ar=i(pe);De=n(ar,"A",{id:!0,class:!0,href:!0});var Vi=i(De);Es=n(Vi,"SPAN",{});var Mi=i(Es);q(it.$$.fragment,Mi),Mi.forEach(s),Vi.forEach(s),Xo=d(ar),Ts=n(ar,"SPAN",{});var Si=i(Ts);Ko=r(Si,"Image Processor"),Si.forEach(s),ar.forEach(s),$a=d(e),Be=n(e,"P",{});var rr=i(Be);Zo=r(rr,"An image processor processes vision inputs. It inherits from the base "),It=n(rr,"A",{href:!0});var Wi=i(It);en=r(Wi,"ImageProcessingMixin"),Wi.forEach(s),tn=r(rr," class."),rr.forEach(s),va=d(e),ee=n(e,"P",{});var Xt=i(ee);sn=r(Xt,"To use, create an image processor associated with the model you\u2019re using. For example, create a default "),Vt=n(Xt,"A",{href:!0});var Li=i(Vt);an=r(Li,"ViTImageProcessor"),Li.forEach(s),rn=r(Xt," if you are using "),Mt=n(Xt,"A",{href:!0});var Oi=i(Mt);on=r(Oi,"ViT"),Oi.forEach(s),nn=r(Xt," for image classification:"),Xt.forEach(s),wa=d(e),q(lt.$$.fragment,e),ya=d(e),q(Ae.$$.fragment,e),ba=d(e),Ce=n(e,"P",{});var or=i(Ce);ln=r(or,"Modify any of the "),St=n(or,"A",{href:!0});var Ni=i(St);fn=r(Ni,"ViTImageProcessor"),Ni.forEach(s),pn=r(or," parameters to create your custom image processor:"),or.forEach(s),ka=d(e),q(ft.$$.fragment,e),ja=d(e),ue=n(e,"H2",{class:!0});var nr=i(ue);Ie=n(nr,"A",{id:!0,class:!0,href:!0});var Ri=i(Ie);xs=n(Ri,"SPAN",{});var Qi=i(xs);q(pt.$$.fragment,Qi),Qi.forEach(s),Ri.forEach(s),un=d(nr),zs=n(nr,"SPAN",{});var Yi=i(zs);cn=r(Yi,"Feature Extractor"),Yi.forEach(s),nr.forEach(s),qa=d(e),te=n(e,"P",{});var Kt=i(te);mn=r(Kt,"A feature extractor processes audio inputs. It inherits from the base "),Wt=n(Kt,"A",{href:!0});var Hi=i(Wt);dn=r(Hi,"FeatureExtractionMixin"),Hi.forEach(s),hn=r(Kt," class, and may also inherit from the "),Lt=n(Kt,"A",{href:!0});var Ui=i(Lt);gn=r(Ui,"SequenceFeatureExtractor"),Ui.forEach(s),_n=r(Kt," class for processing audio inputs."),Kt.forEach(s),Ea=d(e),se=n(e,"P",{});var Zt=i(se);$n=r(Zt,"To use, create a feature extractor associated with the model you\u2019re using. For example, create a default "),Ot=n(Zt,"A",{href:!0});var Gi=i(Ot);vn=r(Gi,"Wav2Vec2FeatureExtractor"),Gi.forEach(s),wn=r(Zt," if you are using "),Nt=n(Zt,"A",{href:!0});var Ji=i(Nt);yn=r(Ji,"Wav2Vec2"),Ji.forEach(s),bn=r(Zt," for audio classification:"),Zt.forEach(s),Ta=d(e),q(ut.$$.fragment,e),xa=d(e),q(Ve.$$.fragment,e),za=d(e),Me=n(e,"P",{});var ir=i(Me);kn=r(ir,"Modify any of the "),Rt=n(ir,"A",{href:!0});var Xi=i(Rt);jn=r(Xi,"Wav2Vec2FeatureExtractor"),Xi.forEach(s),qn=r(ir," parameters to create your custom feature extractor:"),ir.forEach(s),Pa=d(e),q(ct.$$.fragment,e),Fa=d(e),ce=n(e,"H2",{class:!0});var lr=i(ce);Se=n(lr,"A",{id:!0,class:!0,href:!0});var Ki=i(Se);Ps=n(Ki,"SPAN",{});var Zi=i(Ps);q(mt.$$.fragment,Zi),Zi.forEach(s),Ki.forEach(s),En=d(lr),Fs=n(lr,"SPAN",{});var el=i(Fs);Tn=r(el,"Processor"),el.forEach(s),lr.forEach(s),Da=d(e),We=n(e,"P",{});var fr=i(We);xn=r(fr,"For models that support multimodal tasks, \u{1F917} Transformers offers a processor class that conveniently wraps processing classes such as a feature extractor and a tokenizer into a single object. For example, let\u2019s use the "),Qt=n(fr,"A",{href:!0});var tl=i(Qt);zn=r(tl,"Wav2Vec2Processor"),tl.forEach(s),Pn=r(fr," for an automatic speech recognition task (ASR). ASR transcribes audio to text, so you will need a feature extractor and a tokenizer."),fr.forEach(s),Ba=d(e),Yt=n(e,"P",{});var sl=i(Yt);Fn=r(sl,"Create a feature extractor to handle the audio inputs:"),sl.forEach(s),Aa=d(e),q(dt.$$.fragment,e),Ca=d(e),Ht=n(e,"P",{});var al=i(Ht);Dn=r(al,"Create a tokenizer to handle the text inputs:"),al.forEach(s),Ia=d(e),q(ht.$$.fragment,e),Va=d(e),Le=n(e,"P",{});var pr=i(Le);Bn=r(pr,"Combine the feature extractor and tokenizer in "),Ut=n(pr,"A",{href:!0});var rl=i(Ut);An=r(rl,"Wav2Vec2Processor"),rl.forEach(s),Cn=r(pr,":"),pr.forEach(s),Ma=d(e),q(gt.$$.fragment,e),Sa=d(e),Gt=n(e,"P",{});var ol=i(Gt);In=r(ol,"With two basic classes - configuration and model - and an additional preprocessing class (tokenizer, image processor, feature extractor, or processor), you can create any of the models supported by \u{1F917} Transformers. Each of these base classes are configurable, allowing you to use the specific attributes you want. You can easily setup a model for training or modify an existing pretrained model to fine-tune."),ol.forEach(s),this.h()},h(){g(p,"name","hf:doc:metadata"),g(p,"content",JSON.stringify(El)),g(_,"id","create-a-custom-architecture"),g(_,"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"),g(_,"href","#create-a-custom-architecture"),g(u,"class","relative group"),g(A,"href","model_doc/auto"),g(me,"id","configuration"),g(me,"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"),g(me,"href","#configuration"),g(oe,"class","relative group"),g(vt,"href","main_classes/configuration"),g(wt,"href","model_doc/distilbert"),g(yt,"href","/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertConfig"),g(bt,"href","/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertConfig"),g(kt,"href","/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertModel"),g(jt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained"),g(qt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig.save_pretrained"),g(Et,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained"),g(ve,"id","model"),g(ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(ve,"href","#model"),g(ie,"class","relative group"),g(Tt,"href","main_classes/models"),g(xt,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),g(Ke,"href","https://pytorch.org/docs/stable/generated/torch.nn.Module.html"),g(Ke,"rel","nofollow"),g(Ze,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),g(Ze,"rel","nofollow"),g(et,"href","https://flax.readthedocs.io/en/latest/flax.linen.html#module"),g(et,"rel","nofollow"),g(ye,"id","model-heads"),g(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(ye,"href","#model-heads"),g(le,"class","relative group"),g(je,"id","tokenizer"),g(je,"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"),g(je,"href","#tokenizer"),g(fe,"class","relative group"),g(zt,"href","main_classes/tokenizer"),g(Ft,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),g(Dt,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),g(at,"href","https://huggingface.co/docs/tokenizers/python/latest/"),g(at,"rel","nofollow"),g(At,"href","/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertTokenizer"),g(Ct,"href","/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertTokenizerFast"),g(De,"id","image-processor"),g(De,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(De,"href","#image-processor"),g(pe,"class","relative group"),g(It,"href","/docs/transformers/main/en/internal/image_processing_utils#transformers.ImageProcessingMixin"),g(Vt,"href","/docs/transformers/main/en/model_doc/vit#transformers.ViTImageProcessor"),g(Mt,"href","model_doc/vit"),g(St,"href","/docs/transformers/main/en/model_doc/vit#transformers.ViTImageProcessor"),g(Ie,"id","feature-extractor"),g(Ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(Ie,"href","#feature-extractor"),g(ue,"class","relative group"),g(Wt,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin"),g(Lt,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor"),g(Ot,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor"),g(Nt,"href","model_doc/wav2vec2"),g(Rt,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor"),g(Se,"id","processor"),g(Se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(Se,"href","#processor"),g(ce,"class","relative group"),g(Qt,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor"),g(Ut,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor")},m(e,l){t(document.head,p),f(e,v,l),f(e,u,l),t(u,_),t(_,y),E($,y,null),t(u,w),t(u,P),t(P,b),f(e,L,l),f(e,k,l),t(k,S),t(k,A),t(A,I),t(I,F),t(k,M),t(k,h),t(h,B),t(k,N),t(k,C),t(C,R),t(k,c),f(e,D,l),f(e,O,l),t(O,H),t(H,ae),t(O,re),t(O,es),t(es,mr),t(O,dr),t(O,ts),t(ts,hr),t(O,gr),t(O,ss),t(ss,_r),t(O,$r),t(O,as),t(as,vr),t(O,wr),t(O,rs),t(rs,yr),f(e,Ss,l),f(e,oe,l),t(oe,me),t(me,os),E(Ne,os,null),t(oe,br),t(oe,ns),t(ns,kr),f(e,Ws,l),f(e,Y,l),t(Y,jr),t(Y,vt),t(vt,qr),t(Y,Er),t(Y,is),t(is,Tr),t(Y,xr),t(Y,ls),t(ls,zr),t(Y,Pr),t(Y,fs),t(fs,Fr),t(Y,Dr),t(Y,ps),t(ps,Br),t(Y,Ar),f(e,Ls,l),f(e,K,l),t(K,Cr),t(K,wt),t(wt,Ir),t(K,Vr),t(K,yt),t(yt,Mr),t(K,Sr),f(e,Os,l),E(Re,e,l),f(e,Ns,l),f(e,ne,l),t(ne,bt),t(bt,Wr),t(ne,Lr),t(ne,kt),t(kt,Or),t(ne,Nr),f(e,Rs,l),f(e,de,l),t(de,Qe),t(Qe,Rr),t(Qe,us),t(us,Qr),t(Qe,Yr),t(de,Hr),t(de,Ye),t(Ye,Ur),t(Ye,cs),t(cs,Gr),t(Ye,Jr),f(e,Qs,l),E(He,e,l),f(e,Ys,l),f(e,he,l),t(he,Xr),t(he,jt),t(jt,Kr),t(he,Zr),f(e,Hs,l),E(Ue,e,l),f(e,Us,l),f(e,ge,l),t(ge,eo),t(ge,qt),t(qt,to),t(ge,so),f(e,Gs,l),E(Ge,e,l),f(e,Js,l),f(e,_e,l),t(_e,ao),t(_e,Et),t(Et,ro),t(_e,oo),f(e,Xs,l),E(Je,e,l),f(e,Ks,l),E($e,e,l),f(e,Zs,l),f(e,ie,l),t(ie,ve),t(ve,ms),E(Xe,ms,null),t(ie,no),t(ie,ds),t(ds,io),f(e,ea,l),f(e,Q,l),t(Q,lo),t(Q,Tt),t(Tt,fo),t(Q,po),t(Q,hs),t(hs,uo),t(Q,co),t(Q,xt),t(xt,mo),t(Q,ho),t(Q,Ke),t(Ke,gs),t(gs,go),t(Q,_o),t(Q,Ze),t(Ze,_s),t(_s,$o),t(Q,vo),t(Q,et),t(et,$s),t($s,wo),t(Q,yo),f(e,ta,l),E(we,e,l),f(e,sa,l),f(e,le,l),t(le,ye),t(ye,vs),E(tt,vs,null),t(le,bo),t(le,ws),t(ws,ko),f(e,aa,l),f(e,be,l),t(be,jo),t(be,ys),t(ys,qo),t(be,Eo),f(e,ra,l),E(ke,e,l),f(e,oa,l),f(e,fe,l),t(fe,je),t(je,bs),E(st,bs,null),t(fe,To),t(fe,ks),t(ks,xo),f(e,na,l),f(e,qe,l),t(qe,zo),t(qe,zt),t(zt,Po),t(qe,Fo),f(e,ia,l),f(e,Ee,l),t(Ee,Pt),t(Pt,Ft),t(Ft,Do),t(Pt,Bo),t(Ee,Ao),t(Ee,Z),t(Z,Dt),t(Dt,Co),t(Z,Io),t(Z,at),t(at,Vo),t(Z,Mo),t(Z,js),t(js,So),t(Z,Wo),f(e,la,l),f(e,Bt,l),t(Bt,Lo),f(e,fa,l),E(Te,e,l),f(e,pa,l),f(e,xe,l),t(xe,Oo),t(xe,qs),t(qs,No),t(xe,Ro),f(e,ua,l),E(rt,e,l),f(e,ca,l),f(e,ze,l),t(ze,Qo),t(ze,At),t(At,Yo),t(ze,Ho),f(e,ma,l),E(ot,e,l),f(e,da,l),f(e,Pe,l),t(Pe,Uo),t(Pe,Ct),t(Ct,Go),t(Pe,Jo),f(e,ha,l),E(nt,e,l),f(e,ga,l),E(Fe,e,l),f(e,_a,l),f(e,pe,l),t(pe,De),t(De,Es),E(it,Es,null),t(pe,Xo),t(pe,Ts),t(Ts,Ko),f(e,$a,l),f(e,Be,l),t(Be,Zo),t(Be,It),t(It,en),t(Be,tn),f(e,va,l),f(e,ee,l),t(ee,sn),t(ee,Vt),t(Vt,an),t(ee,rn),t(ee,Mt),t(Mt,on),t(ee,nn),f(e,wa,l),E(lt,e,l),f(e,ya,l),E(Ae,e,l),f(e,ba,l),f(e,Ce,l),t(Ce,ln),t(Ce,St),t(St,fn),t(Ce,pn),f(e,ka,l),E(ft,e,l),f(e,ja,l),f(e,ue,l),t(ue,Ie),t(Ie,xs),E(pt,xs,null),t(ue,un),t(ue,zs),t(zs,cn),f(e,qa,l),f(e,te,l),t(te,mn),t(te,Wt),t(Wt,dn),t(te,hn),t(te,Lt),t(Lt,gn),t(te,_n),f(e,Ea,l),f(e,se,l),t(se,$n),t(se,Ot),t(Ot,vn),t(se,wn),t(se,Nt),t(Nt,yn),t(se,bn),f(e,Ta,l),E(ut,e,l),f(e,xa,l),E(Ve,e,l),f(e,za,l),f(e,Me,l),t(Me,kn),t(Me,Rt),t(Rt,jn),t(Me,qn),f(e,Pa,l),E(ct,e,l),f(e,Fa,l),f(e,ce,l),t(ce,Se),t(Se,Ps),E(mt,Ps,null),t(ce,En),t(ce,Fs),t(Fs,Tn),f(e,Da,l),f(e,We,l),t(We,xn),t(We,Qt),t(Qt,zn),t(We,Pn),f(e,Ba,l),f(e,Yt,l),t(Yt,Fn),f(e,Aa,l),E(dt,e,l),f(e,Ca,l),f(e,Ht,l),t(Ht,Dn),f(e,Ia,l),E(ht,e,l),f(e,Va,l),f(e,Le,l),t(Le,Bn),t(Le,Ut),t(Ut,An),t(Le,Cn),f(e,Ma,l),E(gt,e,l),f(e,Sa,l),f(e,Gt,l),t(Gt,In),Wa=!0},p(e,[l]){const _t={};l&2&&(_t.$$scope={dirty:l,ctx:e}),$e.$set(_t);const Ds={};l&2&&(Ds.$$scope={dirty:l,ctx:e}),we.$set(Ds);const Bs={};l&2&&(Bs.$$scope={dirty:l,ctx:e}),ke.$set(Bs);const As={};l&2&&(As.$$scope={dirty:l,ctx:e}),Te.$set(As);const X={};l&2&&(X.$$scope={dirty:l,ctx:e}),Fe.$set(X);const Cs={};l&2&&(Cs.$$scope={dirty:l,ctx:e}),Ae.$set(Cs);const Is={};l&2&&(Is.$$scope={dirty:l,ctx:e}),Ve.$set(Is)},i(e){Wa||(T($.$$.fragment,e),T(Ne.$$.fragment,e),T(Re.$$.fragment,e),T(He.$$.fragment,e),T(Ue.$$.fragment,e),T(Ge.$$.fragment,e),T(Je.$$.fragment,e),T($e.$$.fragment,e),T(Xe.$$.fragment,e),T(we.$$.fragment,e),T(tt.$$.fragment,e),T(ke.$$.fragment,e),T(st.$$.fragment,e),T(Te.$$.fragment,e),T(rt.$$.fragment,e),T(ot.$$.fragment,e),T(nt.$$.fragment,e),T(Fe.$$.fragment,e),T(it.$$.fragment,e),T(lt.$$.fragment,e),T(Ae.$$.fragment,e),T(ft.$$.fragment,e),T(pt.$$.fragment,e),T(ut.$$.fragment,e),T(Ve.$$.fragment,e),T(ct.$$.fragment,e),T(mt.$$.fragment,e),T(dt.$$.fragment,e),T(ht.$$.fragment,e),T(gt.$$.fragment,e),Wa=!0)},o(e){x($.$$.fragment,e),x(Ne.$$.fragment,e),x(Re.$$.fragment,e),x(He.$$.fragment,e),x(Ue.$$.fragment,e),x(Ge.$$.fragment,e),x(Je.$$.fragment,e),x($e.$$.fragment,e),x(Xe.$$.fragment,e),x(we.$$.fragment,e),x(tt.$$.fragment,e),x(ke.$$.fragment,e),x(st.$$.fragment,e),x(Te.$$.fragment,e),x(rt.$$.fragment,e),x(ot.$$.fragment,e),x(nt.$$.fragment,e),x(Fe.$$.fragment,e),x(it.$$.fragment,e),x(lt.$$.fragment,e),x(Ae.$$.fragment,e),x(ft.$$.fragment,e),x(pt.$$.fragment,e),x(ut.$$.fragment,e),x(Ve.$$.fragment,e),x(ct.$$.fragment,e),x(mt.$$.fragment,e),x(dt.$$.fragment,e),x(ht.$$.fragment,e),x(gt.$$.fragment,e),Wa=!1},d(e){s(p),e&&s(v),e&&s(u),z($),e&&s(L),e&&s(k),e&&s(D),e&&s(O),e&&s(Ss),e&&s(oe),z(Ne),e&&s(Ws),e&&s(Y),e&&s(Ls),e&&s(K),e&&s(Os),z(Re,e),e&&s(Ns),e&&s(ne),e&&s(Rs),e&&s(de),e&&s(Qs),z(He,e),e&&s(Ys),e&&s(he),e&&s(Hs),z(Ue,e),e&&s(Us),e&&s(ge),e&&s(Gs),z(Ge,e),e&&s(Js),e&&s(_e),e&&s(Xs),z(Je,e),e&&s(Ks),z($e,e),e&&s(Zs),e&&s(ie),z(Xe),e&&s(ea),e&&s(Q),e&&s(ta),z(we,e),e&&s(sa),e&&s(le),z(tt),e&&s(aa),e&&s(be),e&&s(ra),z(ke,e),e&&s(oa),e&&s(fe),z(st),e&&s(na),e&&s(qe),e&&s(ia),e&&s(Ee),e&&s(la),e&&s(Bt),e&&s(fa),z(Te,e),e&&s(pa),e&&s(xe),e&&s(ua),z(rt,e),e&&s(ca),e&&s(ze),e&&s(ma),z(ot,e),e&&s(da),e&&s(Pe),e&&s(ha),z(nt,e),e&&s(ga),z(Fe,e),e&&s(_a),e&&s(pe),z(it),e&&s($a),e&&s(Be),e&&s(va),e&&s(ee),e&&s(wa),z(lt,e),e&&s(ya),z(Ae,e),e&&s(ba),e&&s(Ce),e&&s(ka),z(ft,e),e&&s(ja),e&&s(ue),z(pt),e&&s(qa),e&&s(te),e&&s(Ea),e&&s(se),e&&s(Ta),z(ut,e),e&&s(xa),z(Ve,e),e&&s(za),e&&s(Me),e&&s(Pa),z(ct,e),e&&s(Fa),e&&s(ce),z(mt),e&&s(Da),e&&s(We),e&&s(Ba),e&&s(Yt),e&&s(Aa),z(dt,e),e&&s(Ca),e&&s(Ht),e&&s(Ia),z(ht,e),e&&s(Va),e&&s(Le),e&&s(Ma),z(gt,e),e&&s(Sa),e&&s(Gt)}}}const El={local:"create-a-custom-architecture",sections:[{local:"configuration",title:"Configuration"},{local:"model",sections:[{local:"model-heads",title:"Model heads"}],title:"Model"},{local:"tokenizer",title:"Tokenizer"},{local:"image-processor",title:"Image Processor"},{local:"feature-extractor",title:"Feature Extractor"},{local:"processor",title:"Processor"}],title:"Create a custom architecture"};function Tl(V){return ul(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Bl extends il{constructor(p){super();ll(this,p,Tl,ql,fl,{})}}export{Bl as default,El as metadata};
