import{S as tw,i as ow,s as nw,e as o,k as l,w as c,t as s,M as rw,c as n,d as t,m as d,a as r,x as p,h as i,b as m,F as e,g as y,y as h,q as f,o as u,B as g}from"../../chunks/vendor-4833417e.js";import{T as fl}from"../../chunks/Tip-fffd6df1.js";import{D as v}from"../../chunks/Docstring-4f315ed9.js";import{C as Q}from"../../chunks/CodeBlock-6a3d1b46.js";import{I as ao}from"../../chunks/IconCopyLink-4b81c553.js";import"../../chunks/CopyButton-dacfbfaf.js";function aw(S){let w,k;return{c(){w=o("p"),k=s("Passing `use_auth_token=True\u201C is required when you want to use a private model.")},l(x){w=n(x,"P",{});var E=r(w);k=i(E,"Passing `use_auth_token=True\u201C is required when you want to use a private model."),E.forEach(t)},m(x,E){y(x,w,E),e(w,k)},d(x){x&&t(w)}}}function sw(S){let w,k,x,E,W;return{c(){w=o("p"),k=s("Activate the special "),x=o("a"),E=s("\u201Coffline-mode\u201D"),W=s(` to
use this method in a firewalled environment.`),this.h()},l(A){w=n(A,"P",{});var L=r(w);k=i(L,"Activate the special "),x=n(L,"A",{href:!0,rel:!0});var de=r(x);E=i(de,"\u201Coffline-mode\u201D"),de.forEach(t),W=i(L,` to
use this method in a firewalled environment.`),L.forEach(t),this.h()},h(){m(x,"href","https://huggingface.co/transformers/installation.html#offline-mode"),m(x,"rel","nofollow")},m(A,L){y(A,w,L),e(w,k),e(w,x),e(x,E),e(w,W)},d(A){A&&t(w)}}}function iw(S){let w,k;return{c(){w=o("p"),k=s("This API is experimental and may have some slight breaking changes in the next releases.")},l(x){w=n(x,"P",{});var E=r(w);k=i(E,"This API is experimental and may have some slight breaking changes in the next releases."),E.forEach(t)},m(x,E){y(x,w,E),e(w,k)},d(x){x&&t(w)}}}function lw(S){let w,k,x,E,W;return{c(){w=o("p"),k=s("Passing "),x=o("code"),E=s("use_auth_token=True"),W=s(" is required when you want to use a private model.")},l(A){w=n(A,"P",{});var L=r(w);k=i(L,"Passing "),x=n(L,"CODE",{});var de=r(x);E=i(de,"use_auth_token=True"),de.forEach(t),W=i(L," is required when you want to use a private model."),L.forEach(t)},m(A,L){y(A,w,L),e(w,k),e(w,x),e(x,E),e(w,W)},d(A){A&&t(w)}}}function dw(S){let w,k;return{c(){w=o("p"),k=s("This API is experimental and may have some slight breaking changes in the next releases.")},l(x){w=n(x,"P",{});var E=r(w);k=i(E,"This API is experimental and may have some slight breaking changes in the next releases."),E.forEach(t)},m(x,E){y(x,w,E),e(w,k)},d(x){x&&t(w)}}}function mw(S){let w,k,x,E,W,A,L,de,Jd,ul,Z,Qd,sr,Zd,em,ir,tm,om,lr,nm,rm,gl,Le,dr,am,sm,mr,im,lm,_l,Ze,Qr,dm,mm,Zr,cm,bl,z,pm,cr,hm,fm,ea,um,gm,pr,_m,bm,hr,vm,ym,fr,$m,wm,vl,ze,et,ta,so,Tm,oa,xm,yl,T,io,Pm,na,Em,Mm,ur,gr,km,jm,Dm,lo,ra,Fm,qm,aa,Am,Cm,sa,Im,Lm,G,ia,ge,la,zm,Om,_r,Um,Nm,br,Hm,Xm,Bm,mo,_e,da,Vm,Sm,ma,Wm,Gm,ca,Rm,Ym,Km,Oe,tt,pa,Jm,Qm,vr,Zm,ec,tc,ot,ha,oc,nc,fa,rc,ac,sc,nt,ua,ic,lc,ga,dc,mc,cc,_a,rt,ba,pc,hc,va,fc,uc,gc,ya,at,$a,_c,bc,wa,vc,yc,$c,Ta,U,xa,wc,Tc,Pa,xc,Pc,Ea,Ec,Mc,Ma,kc,jc,ka,Dc,Fc,qc,ee,co,Ac,po,Cc,ja,Ic,Lc,zc,Da,Oc,Uc,ho,Nc,F,fo,Hc,Fa,Xc,Bc,Ue,Vc,qa,Sc,Wc,Aa,Gc,Rc,Yc,uo,Kc,Ca,Jc,Qc,Zc,go,ep,Ia,tp,op,np,st,rp,it,ap,La,sp,ip,_o,lp,lt,bo,dp,za,mp,cp,dt,vo,pp,Oa,hp,fp,be,yo,up,Ua,gp,_p,Na,bp,vp,ve,$o,yp,Ha,$p,wp,Xa,Tp,xp,mt,wo,Pp,Ba,Ep,Mp,ct,To,kp,Va,jp,Dp,pt,xo,Fp,Sa,qp,Ap,ye,Po,Cp,Wa,Ip,Lp,ht,zp,$e,Eo,Op,Mo,Up,Ga,Np,Hp,Xp,ko,Bp,Ra,Vp,Sp,Wp,ft,jo,Gp,Do,Rp,Ya,Yp,Kp,Jp,ut,Fo,Qp,Ka,Zp,eh,we,qo,th,Ja,oh,nh,Ao,rh,Qa,ah,sh,$l,yr,wl,Ne,gt,Za,Co,ih,es,lh,Tl,te,dh,ts,mh,ch,os,ph,hh,ns,fh,uh,xl,Io,Pl,Te,gh,rs,_h,bh,as,vh,yh,El,Lo,Ml,_t,$h,ss,wh,Th,kl,zo,jl,$r,xh,Dl,He,bt,is,Oo,Ph,ls,Eh,Fl,j,Uo,Mh,No,kh,ds,jh,Dh,Fh,xe,Ho,qh,ms,Ah,Ch,Xe,Ih,cs,Lh,zh,ps,Oh,Uh,Nh,vt,Xo,Hh,hs,Xh,Bh,yt,Bo,Vh,Be,Sh,fs,Wh,Gh,Vo,Rh,Yh,Kh,$t,So,Jh,us,Qh,Zh,wt,Wo,ef,gs,tf,of,Tt,Go,nf,_s,rf,af,xt,Ro,sf,bs,lf,df,Pt,Yo,mf,Ve,cf,vs,pf,hf,wr,ff,uf,ql,Se,Et,ys,Ko,gf,$s,_f,Al,b,Jo,bf,ws,vf,yf,Tr,xr,$f,wf,Tf,Qo,Ts,xf,Pf,xs,Ef,Mf,Ps,kf,jf,We,Pe,Es,Df,Ff,Pr,qf,Af,Er,Cf,If,Lf,Mt,Ms,zf,Of,ks,Uf,Nf,Hf,N,js,Xf,Bf,Ds,Vf,Sf,Fs,Wf,Gf,qs,Rf,Yf,As,Kf,Jf,Qf,oe,Zo,Zf,en,eu,Cs,tu,ou,nu,Is,ru,au,tn,su,kt,on,iu,Ls,lu,du,C,nn,mu,zs,cu,pu,rn,hu,Os,fu,uu,gu,an,_u,Us,bu,vu,yu,jt,$u,Ns,wu,Tu,sn,xu,Dt,ln,Pu,Hs,Eu,Mu,Ft,dn,ku,Xs,ju,Du,qt,mn,Fu,Bs,qu,Au,At,cn,Cu,Vs,Iu,Lu,Ct,pn,zu,Ss,Ou,Uu,It,hn,Nu,Ws,Hu,Xu,Lt,fn,Bu,Gs,Vu,Su,zt,un,Wu,Rs,Gu,Ru,Ee,gn,Yu,_n,Ku,Ys,Ju,Qu,Zu,bn,eg,Ks,tg,og,ng,Ot,vn,rg,yn,ag,Mr,sg,ig,lg,Ut,$n,dg,Js,mg,cg,Nt,wn,pg,Qs,hg,fg,Ht,Tn,ug,Zs,gg,_g,Xt,xn,bg,ei,vg,yg,Bt,Pn,$g,ti,wg,Tg,Vt,En,xg,oi,Pg,Eg,ne,Mn,Mg,R,kg,ni,jg,Dg,ri,Fg,qg,ai,Ag,Cg,si,Ig,Lg,zg,Ge,Og,ii,Ug,Ng,li,Hg,Xg,Bg,Re,Vg,di,Sg,Wg,mi,Gg,Rg,Cl,Ye,St,ci,kn,Yg,pi,Kg,Il,me,jn,Jg,Dn,Qg,hi,Zg,e_,t_,Wt,Fn,o_,fi,n_,Ll,Ke,Gt,ui,qn,r_,gi,a_,zl,M,An,s_,_i,i_,l_,kr,jr,d_,m_,c_,bi,p_,h_,Je,Me,vi,f_,u_,Dr,g_,__,Fr,b_,v_,y_,Rt,yi,$_,w_,$i,T_,x_,P_,H,wi,E_,M_,Ti,k_,j_,xi,D_,F_,Pi,q_,A_,Ei,C_,I_,L_,re,Cn,z_,In,O_,Mi,U_,N_,H_,ki,X_,B_,Ln,V_,O,zn,S_,ji,W_,G_,On,R_,Di,Y_,K_,J_,Un,Q_,Fi,Z_,eb,tb,qi,ob,nb,Nn,rb,ke,Hn,ab,Ai,sb,ib,Yt,lb,Kt,Xn,db,Bn,mb,Ci,cb,pb,hb,X,Vn,fb,Y,ub,Ii,gb,_b,Li,bb,vb,zi,yb,$b,Oi,wb,Tb,xb,Ui,Pb,Eb,Ni,Mb,kb,Sn,jb,B,Wn,Db,K,Fb,Hi,qb,Ab,Xi,Cb,Ib,Bi,Lb,zb,Vi,Ob,Ub,Nb,Si,Hb,Xb,Wi,Bb,Vb,Gn,Sb,ae,Rn,Wb,J,Gb,Gi,Rb,Yb,Ri,Kb,Jb,Yi,Qb,Zb,Ki,ev,tv,ov,Ji,nv,rv,Yn,Ol,Qe,Jt,Qi,Kn,av,Zi,sv,Ul,ce,Jn,iv,el,lv,dv,se,Qn,mv,Zn,cv,tl,pv,hv,fv,ol,uv,gv,er,Nl;return A=new ao({}),so=new ao({}),io=new v({props:{name:"class transformers.PreTrainedModel",anchor:"transformers.PreTrainedModel",parameters:[{name:"config",val:": PretrainedConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L423"}}),co=new v({props:{name:"push_to_hub",anchor:"transformers.file_utils.PushToHubMixin.push_to_hub",parameters:[{name:"repo_path_or_name",val:": typing.Optional[str] = None"},{name:"repo_url",val:": typing.Optional[str] = None"},{name:"use_temp_dir",val:": bool = False"},{name:"commit_message",val:": typing.Optional[str] = None"},{name:"organization",val:": typing.Optional[str] = None"},{name:"private",val:": typing.Optional[bool] = None"},{name:"use_auth_token",val:": typing.Union[bool, str, NoneType] = None"},{name:"**model_card_kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/file_utils.py#L2842",parametersDescription:[{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.repo_path_or_name",description:`<strong>repo_path_or_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Can either be a repository name for your model in the Hub or a path to a local folder (in which case
the repository will have the name of that local folder). If not specified, will default to the name
given by <code>repo_url</code> and a local directory with that name will be created.`,name:"repo_path_or_name"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.repo_url",description:`<strong>repo_url</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Specify this in case you want to push to an existing repository in the hub. If unspecified, a new
repository will be created in your namespace (unless you specify an <code>organization</code>) with <code>repo_name</code>.`,name:"repo_url"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.use_temp_dir",description:`<strong>use_temp_dir</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to clone the distant repo in a temporary directory or in <code>repo_path_or_name</code> inside the
current working directory. This will slow things down if you are making changes in an existing repo
since you will need to clone the repo before every push.`,name:"use_temp_dir"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Message to commit while pushing. Will default to <code>&quot;add model&quot;</code>.`,name:"commit_message"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.organization",description:`<strong>organization</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Organization in which you want to push your model (you must be a member of this organization).`,name:"organization"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the repository created should be private (requires a paying subscription).`,name:"private"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.use_auth_token",description:`<strong>use_auth_token</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>transformers-cli login</code> (stored in <code>~/.huggingface</code>). Will default to <code>True</code> if
<code>repo_url</code> is not specified.`,name:"use_auth_token"}],returnDescription:`
<p>The url of the commit of your model in the given repository.</p>
`,returnType:`
<p><code>str</code></p>
`}}),ho=new Q({props:{code:`from transformers import AutoModel

model = AutoModel.from_pretrained("bert-base-cased")

# Push the model to your namespace with the name "my-finetuned-bert" and have a local clone in the
# *my-finetuned-bert* folder.
model.push_to_hub("my-finetuned-bert")

# Push the model to your namespace with the name "my-finetuned-bert" with no local clone.
model.push_to_hub("my-finetuned-bert", use_temp_dir=True)

# Push the model to an organization with the name "my-finetuned-bert" and have a local clone in the
# *my-finetuned-bert* folder.
model.push_to_hub("my-finetuned-bert", organization="huggingface")

# Make a change to an existing repo that has been cloned locally in *my-finetuned-bert*.
model.push_to_hub("my-finetuned-bert", repo_url="https://huggingface.co/sgugger/my-finetuned-bert")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModel

model = AutoModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)

<span class="hljs-comment"># Push the model to your namespace with the name &quot;my-finetuned-bert&quot; and have a local clone in the</span>
<span class="hljs-comment"># *my-finetuned-bert* folder.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>)

<span class="hljs-comment"># Push the model to your namespace with the name &quot;my-finetuned-bert&quot; with no local clone.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>, use_temp_dir=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># Push the model to an organization with the name &quot;my-finetuned-bert&quot; and have a local clone in the</span>
<span class="hljs-comment"># *my-finetuned-bert* folder.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>, organization=<span class="hljs-string">&quot;huggingface&quot;</span>)

<span class="hljs-comment"># Make a change to an existing repo that has been cloned locally in *my-finetuned-bert*.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>, repo_url=<span class="hljs-string">&quot;https://huggingface.co/sgugger/my-finetuned-bert&quot;</span>)`}}),fo=new v({props:{name:"from_pretrained",anchor:"transformers.PreTrainedModel.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike, NoneType]"},{name:"*model_args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L1091",parametersDescription:[{anchor:"transformers.PreTrainedModel.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/pr_15839/en/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
<li>A path or url to a <em>tensorflow index checkpoint file</em> (e.g, <code>./tf_model/model.ckpt.index</code>). In
this case, <code>from_tf</code> should be set to <code>True</code> and a configuration object should be provided as
<code>config</code> argument. This loading path is slower than converting the TensorFlow checkpoint in a
PyTorch model using the provided conversion scripts and loading the PyTorch model afterwards.</li>
<li>A path or url to a model folder containing a <em>flax checkpoint file</em> in <em>.msgpack</em> format (e.g,
<code>./flax_model/</code> containing <code>flax_model.msgpack</code>). In this case, <code>from_flax</code> should be set to
<code>True</code>.</li>
<li><code>None</code> if you are both providing the configuration and state dictionary (resp. with keyword
arguments <code>config</code> and <code>state_dict</code>).</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"transformers.PreTrainedModel.from_pretrained.model_args",description:`<strong>model_args</strong> (sequence of positional arguments, <em>optional</em>) &#x2014;
All remaining positional arguments will be passed to the underlying model&#x2019;s <code>__init__</code> method.`,name:"model_args"},{anchor:"transformers.PreTrainedModel.from_pretrained.config",description:`<strong>config</strong> (<code>Union[PretrainedConfig, str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>an instance of a class derived from <a href="/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>,</li>
<li>a string or path valid as input to <a href="/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained">from_pretrained()</a>.</li>
</ul>`,name:"config"}]}}),st=new fl({props:{$$slots:{default:[aw]},$$scope:{ctx:S}}}),it=new fl({props:{$$slots:{default:[sw]},$$scope:{ctx:S}}}),_o=new Q({props:{code:`from transformers import BertConfig, BertModel

# Download model and configuration from huggingface.co and cache.
model = BertModel.from_pretrained("bert-base-uncased")
# Model was saved using *save_pretrained('./test/saved_model/')* (for example purposes, not runnable).
model = BertModel.from_pretrained("./test/saved_model/")
# Update configuration during loading.
model = BertModel.from_pretrained("bert-base-uncased", output_attentions=True)
assert model.config.output_attentions == True
# Loading from a TF checkpoint file instead of a PyTorch model (slower, for example purposes, not runnable).
config = BertConfig.from_json_file("./tf_model/my_tf_model_config.json")
model = BertModel.from_pretrained("./tf_model/my_tf_checkpoint.ckpt.index", from_tf=True, config=config)
# Loading from a Flax checkpoint file instead of a PyTorch model (slower)
model = BertModel.from_pretrained("bert-base-uncased", from_flax=True)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, BertModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download model and configuration from huggingface.co and cache.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Model was saved using *save_pretrained(&#x27;./test/saved_model/&#x27;)* (for example purposes, not runnable).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BertModel.from_pretrained(<span class="hljs-string">&quot;./test/saved_model/&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Update configuration during loading.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>, output_attentions=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">assert</span> model.config.output_attentions == <span class="hljs-literal">True</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Loading from a TF checkpoint file instead of a PyTorch model (slower, for example purposes, not runnable).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = BertConfig.from_json_file(<span class="hljs-string">&quot;./tf_model/my_tf_model_config.json&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BertModel.from_pretrained(<span class="hljs-string">&quot;./tf_model/my_tf_checkpoint.ckpt.index&quot;</span>, from_tf=<span class="hljs-literal">True</span>, config=config)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Loading from a Flax checkpoint file instead of a PyTorch model (slower)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = BertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>, from_flax=<span class="hljs-literal">True</span>)`}}),bo=new v({props:{name:"get_input_embeddings",anchor:"transformers.PreTrainedModel.get_input_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L575",returnDescription:`
<p>A torch module mapping vocabulary to hidden states.</p>
`,returnType:`
<p><code>nn.Module</code></p>
`}}),vo=new v({props:{name:"get_output_embeddings",anchor:"transformers.PreTrainedModel.get_output_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L601",returnDescription:`
<p>A torch module mapping hidden states to vocabulary.</p>
`,returnType:`
<p><code>nn.Module</code></p>
`}}),yo=new v({props:{name:"gradient_checkpointing_disable",anchor:"transformers.PreTrainedModel.gradient_checkpointing_disable",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L980"}}),$o=new v({props:{name:"gradient_checkpointing_enable",anchor:"transformers.PreTrainedModel.gradient_checkpointing_enable",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L969"}}),wo=new v({props:{name:"init_weights",anchor:"transformers.PreTrainedModel.init_weights",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L936"}}),To=new v({props:{name:"post_init",anchor:"transformers.PreTrainedModel.post_init",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L494"}}),xo=new v({props:{name:"prune_heads",anchor:"transformers.PreTrainedModel.prune_heads",parameters:[{name:"heads_to_prune",val:": typing.Dict[int, typing.List[int]]"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L952",parametersDescription:[{anchor:"transformers.PreTrainedModel.prune_heads.heads_to_prune",description:`<strong>heads_to_prune</strong> (<code>Dict[int, List[int]]</code>) &#x2014;
Dictionary with keys being selected layer indices (<code>int</code>) and associated values being the list of heads
to prune in said layer (list of <code>int</code>). For instance {1: [0, 2], 2: [2, 3]} will prune heads 0 and 2 on
layer 1 and heads 2 and 3 on layer 2.`,name:"heads_to_prune"}]}}),Po=new v({props:{name:"register_for_auto_class",anchor:"transformers.PreTrainedModel.register_for_auto_class",parameters:[{name:"auto_class",val:" = 'AutoModel'"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L1817",parametersDescription:[{anchor:"transformers.PreTrainedModel.register_for_auto_class.auto_class",description:`<strong>auto_class</strong> (<code>str</code> or <code>type</code>, <em>optional</em>, defaults to <code>&quot;AutoModel&quot;</code>) &#x2014;
The auto class to register this new model with.`,name:"auto_class"}]}}),ht=new fl({props:{warning:"&lcub;true}",$$slots:{default:[iw]},$$scope:{ctx:S}}}),Eo=new v({props:{name:"resize_token_embeddings",anchor:"transformers.PreTrainedModel.resize_token_embeddings",parameters:[{name:"new_num_tokens",val:": typing.Optional[int] = None"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L729",parametersDescription:[{anchor:"transformers.PreTrainedModel.resize_token_embeddings.new_num_tokens",description:`<strong>new_num_tokens</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of new tokens in the embedding matrix. Increasing the size will add newly initialized
vectors at the end. Reducing the size will remove vectors from the end. If not provided or <code>None</code>, just
returns a pointer to the input tokens <code>torch.nn.Embedding</code> module of the model without doing anything.`,name:"new_num_tokens"}],returnDescription:`
<p>Pointer to the input tokens Embeddings Module of the model.</p>
`,returnType:`
<p><code>torch.nn.Embedding</code></p>
`}}),jo=new v({props:{name:"save_pretrained",anchor:"transformers.PreTrainedModel.save_pretrained",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"save_config",val:": bool = True"},{name:"state_dict",val:": typing.Optional[dict] = None"},{name:"save_function",val:": typing.Callable = <function save at 0x7f8f2ba36e50>"},{name:"push_to_hub",val:": bool = False"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L1000",parametersDescription:[{anchor:"transformers.PreTrainedModel.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to which to save. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"transformers.PreTrainedModel.save_pretrained.save_config",description:`<strong>save_config</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to save the config of the model. Useful when in distributed training like TPUs and need
to call this function on all processes. In this case, set <code>save_config=True</code> only on the main process
to avoid race conditions.`,name:"save_config"},{anchor:"transformers.PreTrainedModel.save_pretrained.state_dict",description:`<strong>state_dict</strong> (nested dictionary of <code>torch.Tensor</code>) &#x2014;
The state dictionary of the model to save. Will default to <code>self.state_dict()</code>, but can be used to only
save parts of the model or if special precautions need to be taken when recovering the state dictionary
of a model (like when using model parallelism).`,name:"state_dict"},{anchor:"transformers.PreTrainedModel.save_pretrained.save_function",description:`<strong>save_function</strong> (<code>Callable</code>) &#x2014;
The function to use to save the state dictionary. Useful on distributed training like TPUs when one
need to replace <code>torch.save</code> by another method.`,name:"save_function"},{anchor:"transformers.PreTrainedModel.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push your model to the Hugging Face model hub after saving it.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>Using <code>push_to_hub=True</code> will synchronize the repository you are pushing to with <code>save_directory</code>,
which requires <code>save_directory</code> to be a local clone of the repo you are pushing to if it&#x2019;s an existing
folder. Pass along <code>temp_dir=True</code> to use a temporary directory instead.</p>

					</div>
<p>kwargs &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/pr_15839/en/main_classes/model#transformers.file_utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method.`,name:"push_to_hub"}]}}),Fo=new v({props:{name:"set_input_embeddings",anchor:"transformers.PreTrainedModel.set_input_embeddings",parameters:[{name:"value",val:": Module"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L588",parametersDescription:[{anchor:"transformers.PreTrainedModel.set_input_embeddings.value",description:"<strong>value</strong> (<code>nn.Module</code>) &#x2014; A module mapping vocabulary to hidden states.",name:"value"}]}}),qo=new v({props:{name:"tie_weights",anchor:"transformers.PreTrainedModel.tie_weights",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L616"}}),Co=new ao({}),Io=new Q({props:{code:'model = T5ForConditionalGeneration.from_pretrained("t5", torch_dtype=torch.float16)',highlighted:'model = T5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;t5&quot;</span>, torch_dtype=torch.float16)'}}),Lo=new Q({props:{code:'model = T5ForConditionalGeneration.from_pretrained("t5", torch_dtype="auto")',highlighted:'model = T5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;t5&quot;</span>, torch_dtype=<span class="hljs-string">&quot;auto&quot;</span>)'}}),zo=new Q({props:{code:`config = T5Config.from_pretrained("t5")
model = AutoModel.from_config(config)`,highlighted:`config = T5Config.from_pretrained(<span class="hljs-string">&quot;t5&quot;</span>)
model = AutoModel.from_config(config)`}}),Oo=new ao({}),Uo=new v({props:{name:"class transformers.modeling_utils.ModuleUtilsMixin",anchor:"transformers.modeling_utils.ModuleUtilsMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L151"}}),Ho=new v({props:{name:"add_memory_hooks",anchor:"transformers.modeling_utils.ModuleUtilsMixin.add_memory_hooks",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L182"}}),Xo=new v({props:{name:"estimate_tokens",anchor:"transformers.modeling_utils.ModuleUtilsMixin.estimate_tokens",parameters:[{name:"input_dict",val:": typing.Dict[str, typing.Union[torch.Tensor, typing.Any]]"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L378",parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.estimate_tokens.inputs",description:"<strong>inputs</strong> (<code>dict</code>) &#x2014; The model inputs.",name:"inputs"}],returnDescription:`
<p>The total number of tokens.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Bo=new v({props:{name:"floating_point_ops",anchor:"transformers.modeling_utils.ModuleUtilsMixin.floating_point_ops",parameters:[{name:"input_dict",val:": typing.Dict[str, typing.Union[torch.Tensor, typing.Any]]"},{name:"exclude_embeddings",val:": bool = True"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L396",parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.floating_point_ops.batch_size",description:`<strong>batch_size</strong> (<code>int</code>) &#x2014;
The batch size for the forward pass.`,name:"batch_size"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.floating_point_ops.sequence_length",description:`<strong>sequence_length</strong> (<code>int</code>) &#x2014;
The number of tokens in each line of the batch.`,name:"sequence_length"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.floating_point_ops.exclude_embeddings",description:`<strong>exclude_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to count embedding and softmax operations.`,name:"exclude_embeddings"}],returnDescription:`
<p>The number of floating-point operations.</p>
`,returnType:`
<p><code>int</code></p>
`}}),So=new v({props:{name:"get_extended_attention_mask",anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_extended_attention_mask",parameters:[{name:"attention_mask",val:": Tensor"},{name:"input_shape",val:": typing.Tuple[int]"},{name:"device",val:": <property object at 0x7f8ec23e2040>"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L271",parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_extended_attention_mask.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code>) &#x2014;
Mask with ones indicating tokens to attend to, zeros for tokens to ignore.`,name:"attention_mask"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_extended_attention_mask.input_shape",description:`<strong>input_shape</strong> (<code>Tuple[int]</code>) &#x2014;
The shape of the input to the model.
device &#x2014; (<code>torch.device</code>):
The device of the input to the model.`,name:"input_shape"}],returnDescription:`
<p><code>torch.Tensor</code> The extended attention mask, with a the same dtype as <code>attention_mask.dtype</code>.</p>
`}}),Wo=new v({props:{name:"get_head_mask",anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_head_mask",parameters:[{name:"head_mask",val:": typing.Optional[torch.Tensor]"},{name:"num_hidden_layers",val:": int"},{name:"is_attention_chunked",val:": bool = False"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L314",parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_head_mask.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> with shape <code>[num_heads]</code> or <code>[num_hidden_layers x num_heads]</code>, <em>optional</em>) &#x2014;
The mask indicating if we should keep the heads or not (1.0 for keep, 0.0 for discard).`,name:"head_mask"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.get_head_mask.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>) &#x2014;
The number of hidden layers in the model.
is_attention_chunked &#x2014; (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Whether or not the attentions scores are computed by chunks or not.`,name:"num_hidden_layers"}],returnDescription:`
<p><code>torch.Tensor</code> with shape <code>[num_hidden_layers x batch x num_heads x seq_length x seq_length]</code> or list with
<code>[None]</code> for each layer.</p>
`}}),Go=new v({props:{name:"invert_attention_mask",anchor:"transformers.modeling_utils.ModuleUtilsMixin.invert_attention_mask",parameters:[{name:"encoder_attention_mask",val:": Tensor"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L218",parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.invert_attention_mask.encoder_attention_mask",description:"<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code>) &#x2014; An attention mask.",name:"encoder_attention_mask"}],returnDescription:`
<p>The inverted attention mask.</p>
`,returnType:`
<p><code>torch.Tensor</code></p>
`}}),Ro=new v({props:{name:"num_parameters",anchor:"transformers.modeling_utils.ModuleUtilsMixin.num_parameters",parameters:[{name:"only_trainable",val:": bool = False"},{name:"exclude_embeddings",val:": bool = False"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L352",parametersDescription:[{anchor:"transformers.modeling_utils.ModuleUtilsMixin.num_parameters.only_trainable",description:`<strong>only_trainable</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return only the number of trainable parameters`,name:"only_trainable"},{anchor:"transformers.modeling_utils.ModuleUtilsMixin.num_parameters.exclude_embeddings",description:`<strong>exclude_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return only the number of non-embeddings parameters`,name:"exclude_embeddings"}],returnDescription:`
<p>The number of parameters.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Yo=new v({props:{name:"reset_memory_hooks_state",anchor:"transformers.modeling_utils.ModuleUtilsMixin.reset_memory_hooks_state",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_utils.py#L194"}}),Ko=new ao({}),Jo=new v({props:{name:"class transformers.TFPreTrainedModel",anchor:"transformers.TFPreTrainedModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L686"}}),Zo=new v({props:{name:"push_to_hub",anchor:"transformers.file_utils.PushToHubMixin.push_to_hub",parameters:[{name:"repo_path_or_name",val:": typing.Optional[str] = None"},{name:"repo_url",val:": typing.Optional[str] = None"},{name:"use_temp_dir",val:": bool = False"},{name:"commit_message",val:": typing.Optional[str] = None"},{name:"organization",val:": typing.Optional[str] = None"},{name:"private",val:": typing.Optional[bool] = None"},{name:"use_auth_token",val:": typing.Union[bool, str, NoneType] = None"},{name:"**model_card_kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/file_utils.py#L2842",parametersDescription:[{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.repo_path_or_name",description:`<strong>repo_path_or_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Can either be a repository name for your model in the Hub or a path to a local folder (in which case
the repository will have the name of that local folder). If not specified, will default to the name
given by <code>repo_url</code> and a local directory with that name will be created.`,name:"repo_path_or_name"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.repo_url",description:`<strong>repo_url</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Specify this in case you want to push to an existing repository in the hub. If unspecified, a new
repository will be created in your namespace (unless you specify an <code>organization</code>) with <code>repo_name</code>.`,name:"repo_url"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.use_temp_dir",description:`<strong>use_temp_dir</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to clone the distant repo in a temporary directory or in <code>repo_path_or_name</code> inside the
current working directory. This will slow things down if you are making changes in an existing repo
since you will need to clone the repo before every push.`,name:"use_temp_dir"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Message to commit while pushing. Will default to <code>&quot;add model&quot;</code>.`,name:"commit_message"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.organization",description:`<strong>organization</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Organization in which you want to push your model (you must be a member of this organization).`,name:"organization"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the repository created should be private (requires a paying subscription).`,name:"private"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.use_auth_token",description:`<strong>use_auth_token</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>transformers-cli login</code> (stored in <code>~/.huggingface</code>). Will default to <code>True</code> if
<code>repo_url</code> is not specified.`,name:"use_auth_token"}],returnDescription:`
<p>The url of the commit of your model in the given repository.</p>
`,returnType:`
<p><code>str</code></p>
`}}),tn=new Q({props:{code:`from transformers import TFAutoModel

model = TFAutoModel.from_pretrained("bert-base-cased")

# Push the model to your namespace with the name "my-finetuned-bert" and have a local clone in the
# *my-finetuned-bert* folder.
model.push_to_hub("my-finetuned-bert")

# Push the model to your namespace with the name "my-finetuned-bert" with no local clone.
model.push_to_hub("my-finetuned-bert", use_temp_dir=True)

# Push the model to an organization with the name "my-finetuned-bert" and have a local clone in the
# *my-finetuned-bert* folder.
model.push_to_hub("my-finetuned-bert", organization="huggingface")

# Make a change to an existing repo that has been cloned locally in *my-finetuned-bert*.
model.push_to_hub("my-finetuned-bert", repo_url="https://huggingface.co/sgugger/my-finetuned-bert")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModel

model = TFAutoModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)

<span class="hljs-comment"># Push the model to your namespace with the name &quot;my-finetuned-bert&quot; and have a local clone in the</span>
<span class="hljs-comment"># *my-finetuned-bert* folder.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>)

<span class="hljs-comment"># Push the model to your namespace with the name &quot;my-finetuned-bert&quot; with no local clone.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>, use_temp_dir=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># Push the model to an organization with the name &quot;my-finetuned-bert&quot; and have a local clone in the</span>
<span class="hljs-comment"># *my-finetuned-bert* folder.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>, organization=<span class="hljs-string">&quot;huggingface&quot;</span>)

<span class="hljs-comment"># Make a change to an existing repo that has been cloned locally in *my-finetuned-bert*.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>, repo_url=<span class="hljs-string">&quot;https://huggingface.co/sgugger/my-finetuned-bert&quot;</span>)`}}),on=new v({props:{name:"compile",anchor:"transformers.TFPreTrainedModel.compile",parameters:[{name:"optimizer",val:" = 'rmsprop'"},{name:"loss",val:" = 'passthrough'"},{name:"metrics",val:" = None"},{name:"loss_weights",val:" = None"},{name:"weighted_metrics",val:" = None"},{name:"run_eagerly",val:" = None"},{name:"steps_per_execution",val:" = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L877"}}),nn=new v({props:{name:"from_pretrained",anchor:"transformers.TFPreTrainedModel.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:""},{name:"*model_args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L1439",parametersDescription:[{anchor:"transformers.TFPreTrainedModel.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/pr_15839/en/main_classes/model#transformers.TFPreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
<li>A path or url to a <em>PyTorch state_dict save file</em> (e.g, <code>./pt_model/pytorch_model.bin</code>). In this
case, <code>from_pt</code> should be set to <code>True</code> and a configuration object should be provided as <code>config</code>
argument. This loading path is slower than converting the PyTorch model in a TensorFlow model
using the provided conversion scripts and loading the TensorFlow model afterwards.</li>
<li><code>None</code> if you are both providing the configuration and state dictionary (resp. with keyword
arguments <code>config</code> and <code>state_dict</code>).</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.model_args",description:`<strong>model_args</strong> (sequence of positional arguments, <em>optional</em>) &#x2014;
All remaining positional arguments will be passed to the underlying model&#x2019;s <code>__init__</code> method.`,name:"model_args"},{anchor:"transformers.TFPreTrainedModel.from_pretrained.config",description:`<strong>config</strong> (<code>Union[PretrainedConfig, str]</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>an instance of a class derived from <a href="/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>,</li>
<li>a string valid as input to <a href="/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained">from_pretrained()</a>.</li>
</ul>`,name:"config"}]}}),jt=new fl({props:{$$slots:{default:[lw]},$$scope:{ctx:S}}}),sn=new Q({props:{code:`from transformers import BertConfig, TFBertModel

# Download model and configuration from huggingface.co and cache.
model = TFBertModel.from_pretrained("bert-base-uncased")
# Model was saved using *save_pretrained('./test/saved_model/')* (for example purposes, not runnable).
model = TFBertModel.from_pretrained("./test/saved_model/")
# Update configuration during loading.
model = TFBertModel.from_pretrained("bert-base-uncased", output_attentions=True)
assert model.config.output_attentions == True
# Loading from a Pytorch model file instead of a TensorFlow checkpoint (slower, for example purposes, not runnable).
config = BertConfig.from_json_file("./pt_model/my_pt_model_config.json")
model = TFBertModel.from_pretrained("./pt_model/my_pytorch_model.bin", from_pt=True, config=config)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, TFBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download model and configuration from huggingface.co and cache.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Model was saved using *save_pretrained(&#x27;./test/saved_model/&#x27;)* (for example purposes, not runnable).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBertModel.from_pretrained(<span class="hljs-string">&quot;./test/saved_model/&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Update configuration during loading.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>, output_attentions=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">assert</span> model.config.output_attentions == <span class="hljs-literal">True</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Loading from a Pytorch model file instead of a TensorFlow checkpoint (slower, for example purposes, not runnable).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = BertConfig.from_json_file(<span class="hljs-string">&quot;./pt_model/my_pt_model_config.json&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFBertModel.from_pretrained(<span class="hljs-string">&quot;./pt_model/my_pytorch_model.bin&quot;</span>, from_pt=<span class="hljs-literal">True</span>, config=config)`}}),ln=new v({props:{name:"get_bias",anchor:"transformers.TFPreTrainedModel.get_bias",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L1123",returnDescription:`
<p>The weights representing the bias, None if not an LM model.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),dn=new v({props:{name:"get_input_embeddings",anchor:"transformers.TFPreTrainedModel.get_input_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L796",returnDescription:`
<p>The embeddings layer mapping vocabulary to hidden states.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),mn=new v({props:{name:"get_lm_head",anchor:"transformers.TFPreTrainedModel.get_lm_head",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L1156",returnDescription:`
<p>The LM head layer if the model has one, None if not.</p>
`,returnType:`
<p><code>tf.keras.layers.Layer</code></p>
`}}),cn=new v({props:{name:"get_output_embeddings",anchor:"transformers.TFPreTrainedModel.get_output_embeddings",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L1063",returnDescription:`
<p>The new weights mapping vocabulary to hidden states.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),pn=new v({props:{name:"get_output_layer_with_bias",anchor:"transformers.TFPreTrainedModel.get_output_layer_with_bias",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L1100",returnDescription:`
<p>The layer that handles the bias, None if not an LM model.</p>
`,returnType:`
<p><code>tf.keras.layers.Layer</code></p>
`}}),hn=new v({props:{name:"get_prefix_bias_name",anchor:"transformers.TFPreTrainedModel.get_prefix_bias_name",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L1113",returnDescription:`
<p>The _prefix name of the bias.</p>
`,returnType:`
<p><code>str</code></p>
`}}),fn=new v({props:{name:"load_repo_checkpoint",anchor:"transformers.TFPreTrainedModel.load_repo_checkpoint",parameters:[{name:"repo_path_or_name",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L823",parametersDescription:[{anchor:"transformers.TFPreTrainedModel.load_repo_checkpoint.repo_path_or_name",description:`<strong>repo_path_or_name</strong> (<code>str</code>) &#x2014;
Can either be a repository name for your {object} in the Hub or a path to a local folder (in which case
the repository will have the name of that local folder).`,name:"repo_path_or_name"}],returnDescription:`
<p>A dictionary of extra metadata from the checkpoint, most commonly an \u201Cepoch\u201D count.</p>
`,returnType:`
<p><code>dict</code></p>
`}}),un=new v({props:{name:"prune_heads",anchor:"transformers.TFPreTrainedModel.prune_heads",parameters:[{name:"heads_to_prune",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L1365",parametersDescription:[{anchor:"transformers.TFPreTrainedModel.prune_heads.heads_to_prune",description:`<strong>heads_to_prune</strong> (<code>Dict[int, List[int]]</code>) &#x2014;
Dictionary with keys being selected layer indices (<code>int</code>) and associated values being the list of heads
to prune in said layer (list of <code>int</code>). For instance {1: [0, 2], 2: [2, 3]} will prune heads 0 and 2 on
layer 1 and heads 2 and 3 on layer 2.`,name:"heads_to_prune"}]}}),gn=new v({props:{name:"resize_token_embeddings",anchor:"transformers.TFPreTrainedModel.resize_token_embeddings",parameters:[{name:"new_num_tokens",val:" = None"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L1165",parametersDescription:[{anchor:"transformers.TFPreTrainedModel.resize_token_embeddings.new_num_tokens",description:`<strong>new_num_tokens</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of new tokens in the embedding matrix. Increasing the size will add newly initialized
vectors at the end. Reducing the size will remove vectors from the end. If not provided or <code>None</code>, just
returns a pointer to the input tokens <code>tf.Variable</code> module of the model without doing anything.`,name:"new_num_tokens"}],returnDescription:`
<p>Pointer to the input tokens Embeddings Module of the model.</p>
`,returnType:`
<p><code>tf.Variable</code></p>
`}}),vn=new v({props:{name:"save_pretrained",anchor:"transformers.TFPreTrainedModel.save_pretrained",parameters:[{name:"save_directory",val:""},{name:"saved_model",val:" = False"},{name:"version",val:" = 1"},{name:"push_to_hub",val:" = False"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L1377",parametersDescription:[{anchor:"transformers.TFPreTrainedModel.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code>) &#x2014;
Directory to which to save. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.saved_model",description:`<strong>saved_model</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If the model has to be saved in saved model format as well or not.`,name:"saved_model"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.version",description:`<strong>version</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The version of the saved model. A saved model needs to be versioned in order to be properly loaded by
TensorFlow Serving as detailed in the official documentation
<a href="https://www.tensorflow.org/tfx/serving/serving_basic" rel="nofollow">https://www.tensorflow.org/tfx/serving/serving_basic</a>`,name:"version"},{anchor:"transformers.TFPreTrainedModel.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push your model to the Hugging Face model hub after saving it.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>Using <code>push_to_hub=True</code> will synchronize the repository you are pushing to with <code>save_directory</code>,
which requires <code>save_directory</code> to be a local clone of the repo you are pushing to if it&#x2019;s an existing
folder. Pass along <code>temp_dir=True</code> to use a temporary directory instead.</p>

					</div>
<p>kwargs &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/pr_15839/en/main_classes/model#transformers.file_utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method.`,name:"push_to_hub"}]}}),$n=new v({props:{name:"serving",anchor:"transformers.TFPreTrainedModel.serving",parameters:[{name:"inputs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L765",parametersDescription:[{anchor:"transformers.TFPreTrainedModel.serving.inputs",description:`<strong>inputs</strong> (<code>Dict[str, tf.Tensor]</code>) &#x2014;
The input of the saved model as a dictionary of tensors.`,name:"inputs"}]}}),wn=new v({props:{name:"serving_output",anchor:"transformers.TFPreTrainedModel.serving_output",parameters:[{name:"output",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L786",parametersDescription:[{anchor:"transformers.TFPreTrainedModel.serving_output.output",description:`<strong>output</strong> (<code>TFBaseModelOutput</code>) &#x2014;
The output returned by the model.`,name:"output"}]}}),Tn=new v({props:{name:"set_bias",anchor:"transformers.TFPreTrainedModel.set_bias",parameters:[{name:"value",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L1140",parametersDescription:[{anchor:"transformers.TFPreTrainedModel.set_bias.value",description:`<strong>value</strong> (<code>Dict[tf.Variable]</code>) &#x2014;
All the new bias attached to an LM head.`,name:"value"}]}}),xn=new v({props:{name:"set_input_embeddings",anchor:"transformers.TFPreTrainedModel.set_input_embeddings",parameters:[{name:"value",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L1043",parametersDescription:[{anchor:"transformers.TFPreTrainedModel.set_input_embeddings.value",description:`<strong>value</strong> (<code>tf.Variable</code>) &#x2014;
The new weights mapping hidden states to vocabulary.`,name:"value"}]}}),Pn=new v({props:{name:"set_output_embeddings",anchor:"transformers.TFPreTrainedModel.set_output_embeddings",parameters:[{name:"value",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L1083",parametersDescription:[{anchor:"transformers.TFPreTrainedModel.set_output_embeddings.value",description:`<strong>value</strong> (<code>tf.Variable</code>) &#x2014;
The new weights mapping hidden states to vocabulary.`,name:"value"}]}}),En=new v({props:{name:"test_step",anchor:"transformers.TFPreTrainedModel.test_step",parameters:[{name:"data",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L977"}}),Mn=new v({props:{name:"train_step",anchor:"transformers.TFPreTrainedModel.train_step",parameters:[{name:"data",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L926"}}),kn=new ao({}),jn=new v({props:{name:"class transformers.modeling_tf_utils.TFModelUtilsMixin",anchor:"transformers.modeling_tf_utils.TFModelUtilsMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L83"}}),Fn=new v({props:{name:"num_parameters",anchor:"transformers.modeling_tf_utils.TFModelUtilsMixin.num_parameters",parameters:[{name:"only_trainable",val:": bool = False"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_tf_utils.py#L88",parametersDescription:[{anchor:"transformers.modeling_tf_utils.TFModelUtilsMixin.num_parameters.only_trainable",description:`<strong>only_trainable</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return only the number of trainable parameters`,name:"only_trainable"}],returnDescription:`
<p>The number of parameters.</p>
`,returnType:`
<p><code>int</code></p>
`}}),qn=new ao({}),An=new v({props:{name:"class transformers.FlaxPreTrainedModel",anchor:"transformers.FlaxPreTrainedModel",parameters:[{name:"config",val:": PretrainedConfig"},{name:"module",val:": Module"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax._src.numpy.lax_numpy.float32'>"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_flax_utils.py#L72"}}),Cn=new v({props:{name:"push_to_hub",anchor:"transformers.file_utils.PushToHubMixin.push_to_hub",parameters:[{name:"repo_path_or_name",val:": typing.Optional[str] = None"},{name:"repo_url",val:": typing.Optional[str] = None"},{name:"use_temp_dir",val:": bool = False"},{name:"commit_message",val:": typing.Optional[str] = None"},{name:"organization",val:": typing.Optional[str] = None"},{name:"private",val:": typing.Optional[bool] = None"},{name:"use_auth_token",val:": typing.Union[bool, str, NoneType] = None"},{name:"**model_card_kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/file_utils.py#L2842",parametersDescription:[{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.repo_path_or_name",description:`<strong>repo_path_or_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Can either be a repository name for your model in the Hub or a path to a local folder (in which case
the repository will have the name of that local folder). If not specified, will default to the name
given by <code>repo_url</code> and a local directory with that name will be created.`,name:"repo_path_or_name"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.repo_url",description:`<strong>repo_url</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Specify this in case you want to push to an existing repository in the hub. If unspecified, a new
repository will be created in your namespace (unless you specify an <code>organization</code>) with <code>repo_name</code>.`,name:"repo_url"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.use_temp_dir",description:`<strong>use_temp_dir</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to clone the distant repo in a temporary directory or in <code>repo_path_or_name</code> inside the
current working directory. This will slow things down if you are making changes in an existing repo
since you will need to clone the repo before every push.`,name:"use_temp_dir"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Message to commit while pushing. Will default to <code>&quot;add model&quot;</code>.`,name:"commit_message"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.organization",description:`<strong>organization</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Organization in which you want to push your model (you must be a member of this organization).`,name:"organization"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the repository created should be private (requires a paying subscription).`,name:"private"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.use_auth_token",description:`<strong>use_auth_token</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>transformers-cli login</code> (stored in <code>~/.huggingface</code>). Will default to <code>True</code> if
<code>repo_url</code> is not specified.`,name:"use_auth_token"}],returnDescription:`
<p>The url of the commit of your model in the given repository.</p>
`,returnType:`
<p><code>str</code></p>
`}}),Ln=new Q({props:{code:`from transformers import FlaxAutoModel

model = FlaxAutoModel.from_pretrained("bert-base-cased")

# Push the model to your namespace with the name "my-finetuned-bert" and have a local clone in the
# *my-finetuned-bert* folder.
model.push_to_hub("my-finetuned-bert")

# Push the model to your namespace with the name "my-finetuned-bert" with no local clone.
model.push_to_hub("my-finetuned-bert", use_temp_dir=True)

# Push the model to an organization with the name "my-finetuned-bert" and have a local clone in the
# *my-finetuned-bert* folder.
model.push_to_hub("my-finetuned-bert", organization="huggingface")

# Make a change to an existing repo that has been cloned locally in *my-finetuned-bert*.
model.push_to_hub("my-finetuned-bert", repo_url="https://huggingface.co/sgugger/my-finetuned-bert")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FlaxAutoModel

model = FlaxAutoModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)

<span class="hljs-comment"># Push the model to your namespace with the name &quot;my-finetuned-bert&quot; and have a local clone in the</span>
<span class="hljs-comment"># *my-finetuned-bert* folder.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>)

<span class="hljs-comment"># Push the model to your namespace with the name &quot;my-finetuned-bert&quot; with no local clone.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>, use_temp_dir=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># Push the model to an organization with the name &quot;my-finetuned-bert&quot; and have a local clone in the</span>
<span class="hljs-comment"># *my-finetuned-bert* folder.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>, organization=<span class="hljs-string">&quot;huggingface&quot;</span>)

<span class="hljs-comment"># Make a change to an existing repo that has been cloned locally in *my-finetuned-bert*.</span>
model.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>, repo_url=<span class="hljs-string">&quot;https://huggingface.co/sgugger/my-finetuned-bert&quot;</span>)`}}),zn=new v({props:{name:"from_pretrained",anchor:"transformers.FlaxPreTrainedModel.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike]"},{name:"dtype",val:": dtype = <class 'jax._src.numpy.lax_numpy.float32'>"},{name:"*model_args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_flax_utils.py#L296",parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
<li>A path or url to a <em>pt index checkpoint file</em> (e.g, <code>./tf_model/model.ckpt.index</code>). In this case,
<code>from_pt</code> should be set to <code>True</code>.</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.model_args",description:`<strong>model_args</strong> (sequence of positional arguments, <em>optional</em>) &#x2014;
All remaining positional arguments will be passed to the underlying model&#x2019;s <code>__init__</code> method.`,name:"model_args"},{anchor:"transformers.FlaxPreTrainedModel.from_pretrained.config",description:`<strong>config</strong> (<code>Union[PretrainedConfig, str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>an instance of a class derived from <a href="/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>,</li>
<li>a string or path valid as input to <a href="/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained">from_pretrained()</a>.</li>
</ul>`,name:"config"}]}}),Nn=new Q({props:{code:`from transformers import BertConfig, FlaxBertModel

# Download model and configuration from huggingface.co and cache.
model = FlaxBertModel.from_pretrained("bert-base-cased")
# Model was saved using *save_pretrained('./test/saved_model/')* (for example purposes, not runnable).
model = FlaxBertModel.from_pretrained("./test/saved_model/")
# Loading from a PyTorch checkpoint file instead of a PyTorch model (slower, for example purposes, not runnable).
config = BertConfig.from_json_file("./pt_model/config.json")
model = FlaxBertModel.from_pretrained("./pt_model/pytorch_model.bin", from_pt=True, config=config)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, FlaxBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download model and configuration from huggingface.co and cache.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Model was saved using *save_pretrained(&#x27;./test/saved_model/&#x27;)* (for example purposes, not runnable).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;./test/saved_model/&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Loading from a PyTorch checkpoint file instead of a PyTorch model (slower, for example purposes, not runnable).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = BertConfig.from_json_file(<span class="hljs-string">&quot;./pt_model/config.json&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;./pt_model/pytorch_model.bin&quot;</span>, from_pt=<span class="hljs-literal">True</span>, config=config)`}}),Hn=new v({props:{name:"register_for_auto_class",anchor:"transformers.FlaxPreTrainedModel.register_for_auto_class",parameters:[{name:"auto_class",val:" = 'FlaxAutoModel'"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_flax_utils.py#L716",parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.register_for_auto_class.auto_class",description:`<strong>auto_class</strong> (<code>str</code> or <code>type</code>, <em>optional</em>, defaults to <code>&quot;FlaxAutoModel&quot;</code>) &#x2014;
The auto class to register this new model with.`,name:"auto_class"}]}}),Yt=new fl({props:{warning:"&lcub;true}",$$slots:{default:[dw]},$$scope:{ctx:S}}}),Xn=new v({props:{name:"save_pretrained",anchor:"transformers.FlaxPreTrainedModel.save_pretrained",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"params",val:" = None"},{name:"push_to_hub",val:" = False"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_flax_utils.py#L659",parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to which to save. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"transformers.FlaxPreTrainedModel.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push your model to the Hugging Face model hub after saving it.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>Using <code>push_to_hub=True</code> will synchronize the repository you are pushing to with <code>save_directory</code>,
which requires <code>save_directory</code> to be a local clone of the repo you are pushing to if it&#x2019;s an existing
folder. Pass along <code>temp_dir=True</code> to use a temporary directory instead.</p>

					</div>
<p>kwargs &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/pr_15839/en/main_classes/model#transformers.file_utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method.`,name:"push_to_hub"}]}}),Vn=new v({props:{name:"to_bf16",anchor:"transformers.FlaxPreTrainedModel.to_bf16",parameters:[{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"mask",val:": typing.Any = None"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_flax_utils.py#L191",parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.to_bf16.params",description:`<strong>params</strong> (<code>Union[Dict, FrozenDict]</code>) &#x2014;
A <code>PyTree</code> of model parameters.`,name:"params"},{anchor:"transformers.FlaxPreTrainedModel.to_bf16.mask",description:`<strong>mask</strong> (<code>Union[Dict, FrozenDict]</code>) &#x2014;
A <code>PyTree</code> with same structure as the <code>params</code> tree. The leaves should be booleans, <code>True</code> for params
you want to cast, and should be <code>False</code> for those you want to skip.`,name:"mask"}]}}),Sn=new Q({props:{code:`from transformers import FlaxBertModel

# load model
model = FlaxBertModel.from_pretrained("bert-base-cased")
# By default, the model parameters will be in fp32 precision, to cast these to bfloat16 precision
model.params = model.to_bf16(model.params)
# If you want don't want to cast certain parameters (for example layer norm bias and scale)
# then pass the mask as follows
from flax import traverse_util

model = FlaxBertModel.from_pretrained("bert-base-cased")
flat_params = traverse_util.flatten_dict(model.params)
mask = {
    path: (path[-2] != ("LayerNorm", "bias") and path[-2:] != ("LayerNorm", "scale"))
    for path in flat_params
}
mask = traverse_util.unflatten_dict(mask)
model.params = model.to_bf16(model.params, mask)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FlaxBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># By default, the model parameters will be in fp32 precision, to cast these to bfloat16 precision</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.params = model.to_bf16(model.params)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># If you want don&#x27;t want to cast certain parameters (for example layer norm bias and scale)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># then pass the mask as follows</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> flax <span class="hljs-keyword">import</span> traverse_util

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>flat_params = traverse_util.flatten_dict(model.params)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask = {
<span class="hljs-meta">... </span>    path: (path[-<span class="hljs-number">2</span>] != (<span class="hljs-string">&quot;LayerNorm&quot;</span>, <span class="hljs-string">&quot;bias&quot;</span>) <span class="hljs-keyword">and</span> path[-<span class="hljs-number">2</span>:] != (<span class="hljs-string">&quot;LayerNorm&quot;</span>, <span class="hljs-string">&quot;scale&quot;</span>))
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> path <span class="hljs-keyword">in</span> flat_params
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>mask = traverse_util.unflatten_dict(mask)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.params = model.to_bf16(model.params, mask)`}}),Wn=new v({props:{name:"to_fp16",anchor:"transformers.FlaxPreTrainedModel.to_fp16",parameters:[{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"mask",val:": typing.Any = None"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_flax_utils.py#L257",parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.to_fp16.params",description:`<strong>params</strong> (<code>Union[Dict, FrozenDict]</code>) &#x2014;
A <code>PyTree</code> of model parameters.`,name:"params"},{anchor:"transformers.FlaxPreTrainedModel.to_fp16.mask",description:`<strong>mask</strong> (<code>Union[Dict, FrozenDict]</code>) &#x2014;
A <code>PyTree</code> with same structure as the <code>params</code> tree. The leaves should be booleans, <code>True</code> for params
you want to cast, and should be <code>False</code> for those you want to skip`,name:"mask"}]}}),Gn=new Q({props:{code:`from transformers import FlaxBertModel

# load model
model = FlaxBertModel.from_pretrained("bert-base-cased")
# By default, the model params will be in fp32, to cast these to float16
model.params = model.to_fp16(model.params)
# If you want don't want to cast certain parameters (for example layer norm bias and scale)
# then pass the mask as follows
from flax import traverse_util

model = FlaxBertModel.from_pretrained("bert-base-cased")
flat_params = traverse_util.flatten_dict(model.params)
mask = {
    path: (path[-2] != ("LayerNorm", "bias") and path[-2:] != ("LayerNorm", "scale"))
    for path in flat_params
}
mask = traverse_util.unflatten_dict(mask)
model.params = model.to_fp16(model.params, mask)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FlaxBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># By default, the model params will be in fp32, to cast these to float16</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.params = model.to_fp16(model.params)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># If you want don&#x27;t want to cast certain parameters (for example layer norm bias and scale)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># then pass the mask as follows</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> flax <span class="hljs-keyword">import</span> traverse_util

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>flat_params = traverse_util.flatten_dict(model.params)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask = {
<span class="hljs-meta">... </span>    path: (path[-<span class="hljs-number">2</span>] != (<span class="hljs-string">&quot;LayerNorm&quot;</span>, <span class="hljs-string">&quot;bias&quot;</span>) <span class="hljs-keyword">and</span> path[-<span class="hljs-number">2</span>:] != (<span class="hljs-string">&quot;LayerNorm&quot;</span>, <span class="hljs-string">&quot;scale&quot;</span>))
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> path <span class="hljs-keyword">in</span> flat_params
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>mask = traverse_util.unflatten_dict(mask)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.params = model.to_fp16(model.params, mask)`}}),Rn=new v({props:{name:"to_fp32",anchor:"transformers.FlaxPreTrainedModel.to_fp32",parameters:[{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"mask",val:": typing.Any = None"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/modeling_flax_utils.py#L230",parametersDescription:[{anchor:"transformers.FlaxPreTrainedModel.to_fp32.params",description:`<strong>params</strong> (<code>Union[Dict, FrozenDict]</code>) &#x2014;
A <code>PyTree</code> of model parameters.`,name:"params"},{anchor:"transformers.FlaxPreTrainedModel.to_fp32.mask",description:`<strong>mask</strong> (<code>Union[Dict, FrozenDict]</code>) &#x2014;
A <code>PyTree</code> with same structure as the <code>params</code> tree. The leaves should be booleans, <code>True</code> for params
you want to cast, and should be <code>False</code> for those you want to skip`,name:"mask"}]}}),Yn=new Q({props:{code:`from transformers import FlaxBertModel

# Download model and configuration from huggingface.co
model = FlaxBertModel.from_pretrained("bert-base-cased")
# By default, the model params will be in fp32, to illustrate the use of this method,
# we'll first cast to fp16 and back to fp32
model.params = model.to_f16(model.params)
# now cast back to fp32
model.params = model.to_fp32(model.params)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FlaxBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download model and configuration from huggingface.co</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># By default, the model params will be in fp32, to illustrate the use of this method,</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># we&#x27;ll first cast to fp16 and back to fp32</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.params = model.to_f16(model.params)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># now cast back to fp32</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.params = model.to_fp32(model.params)`}}),Kn=new ao({}),Jn=new v({props:{name:"class transformers.file_utils.PushToHubMixin",anchor:"transformers.file_utils.PushToHubMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/file_utils.py#L2837"}}),Qn=new v({props:{name:"push_to_hub",anchor:"transformers.file_utils.PushToHubMixin.push_to_hub",parameters:[{name:"repo_path_or_name",val:": typing.Optional[str] = None"},{name:"repo_url",val:": typing.Optional[str] = None"},{name:"use_temp_dir",val:": bool = False"},{name:"commit_message",val:": typing.Optional[str] = None"},{name:"organization",val:": typing.Optional[str] = None"},{name:"private",val:": typing.Optional[bool] = None"},{name:"use_auth_token",val:": typing.Union[bool, str, NoneType] = None"},{name:"**model_card_kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/file_utils.py#L2842",parametersDescription:[{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.repo_path_or_name",description:`<strong>repo_path_or_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Can either be a repository name for your {object} in the Hub or a path to a local folder (in which case
the repository will have the name of that local folder). If not specified, will default to the name
given by <code>repo_url</code> and a local directory with that name will be created.`,name:"repo_path_or_name"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.repo_url",description:`<strong>repo_url</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Specify this in case you want to push to an existing repository in the hub. If unspecified, a new
repository will be created in your namespace (unless you specify an <code>organization</code>) with <code>repo_name</code>.`,name:"repo_url"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.use_temp_dir",description:`<strong>use_temp_dir</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to clone the distant repo in a temporary directory or in <code>repo_path_or_name</code> inside the
current working directory. This will slow things down if you are making changes in an existing repo
since you will need to clone the repo before every push.`,name:"use_temp_dir"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Message to commit while pushing. Will default to <code>&quot;add {object}&quot;</code>.`,name:"commit_message"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.organization",description:`<strong>organization</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Organization in which you want to push your {object} (you must be a member of this organization).`,name:"organization"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the repository created should be private (requires a paying subscription).`,name:"private"},{anchor:"transformers.file_utils.PushToHubMixin.push_to_hub.use_auth_token",description:`<strong>use_auth_token</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>transformers-cli login</code> (stored in <code>~/.huggingface</code>). Will default to <code>True</code> if
<code>repo_url</code> is not specified.`,name:"use_auth_token"}],returnDescription:`
<p>The url of the commit of your {object} in the given repository.</p>
`,returnType:`
<p><code>str</code></p>
`}}),er=new Q({props:{code:`from transformers import {object_class}

{object} = {object_class}.from_pretrained("bert-base-cased")

# Push the {object} to your namespace with the name "my-finetuned-bert" and have a local clone in the
# *my-finetuned-bert* folder.
{object}.push_to_hub("my-finetuned-bert")

# Push the {object} to your namespace with the name "my-finetuned-bert" with no local clone.
{object}.push_to_hub("my-finetuned-bert", use_temp_dir=True)

# Push the {object} to an organization with the name "my-finetuned-bert" and have a local clone in the
# *my-finetuned-bert* folder.
{object}.push_to_hub("my-finetuned-bert", organization="huggingface")

# Make a change to an existing repo that has been cloned locally in *my-finetuned-bert*.
{object}.push_to_hub("my-finetuned-bert", repo_url="https://huggingface.co/sgugger/my-finetuned-bert")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> {object_class}

{<span class="hljs-built_in">object</span>} = {object_class}.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)

<span class="hljs-comment"># Push the {object} to your namespace with the name &quot;my-finetuned-bert&quot; and have a local clone in the</span>
<span class="hljs-comment"># *my-finetuned-bert* folder.</span>
{<span class="hljs-built_in">object</span>}.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>)

<span class="hljs-comment"># Push the {object} to your namespace with the name &quot;my-finetuned-bert&quot; with no local clone.</span>
{<span class="hljs-built_in">object</span>}.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>, use_temp_dir=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># Push the {object} to an organization with the name &quot;my-finetuned-bert&quot; and have a local clone in the</span>
<span class="hljs-comment"># *my-finetuned-bert* folder.</span>
{<span class="hljs-built_in">object</span>}.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>, organization=<span class="hljs-string">&quot;huggingface&quot;</span>)

<span class="hljs-comment"># Make a change to an existing repo that has been cloned locally in *my-finetuned-bert*.</span>
{<span class="hljs-built_in">object</span>}.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>, repo_url=<span class="hljs-string">&quot;https://huggingface.co/sgugger/my-finetuned-bert&quot;</span>)`}}),{c(){w=o("meta"),k=l(),x=o("h1"),E=o("a"),W=o("span"),c(A.$$.fragment),L=l(),de=o("span"),Jd=s("Models"),ul=l(),Z=o("p"),Qd=s("The base classes "),sr=o("a"),Zd=s("PreTrainedModel"),em=s(", "),ir=o("a"),tm=s("TFPreTrainedModel"),om=s(`, and
`),lr=o("a"),nm=s("FlaxPreTrainedModel"),rm=s(` implement the common methods for loading/saving a model either from a local
file or directory, or from a pretrained model configuration provided by the library (downloaded from HuggingFace\u2019s AWS
S3 repository).`),gl=l(),Le=o("p"),dr=o("a"),am=s("PreTrainedModel"),sm=s(" and "),mr=o("a"),im=s("TFPreTrainedModel"),lm=s(` also implement a few methods which
are common among all the models to:`),_l=l(),Ze=o("ul"),Qr=o("li"),dm=s("resize the input token embeddings when new tokens are added to the vocabulary"),mm=l(),Zr=o("li"),cm=s("prune the attention heads of the model."),bl=l(),z=o("p"),pm=s("The other methods that are common to each model are defined in "),cr=o("a"),hm=s("ModuleUtilsMixin"),fm=s(`
(for the PyTorch models) and `),ea=o("code"),um=s("TFModuleUtilsMixin"),gm=s(` (for the TensorFlow models) or
for text generation, `),pr=o("a"),_m=s("GenerationMixin"),bm=s(` (for the PyTorch models),
`),hr=o("a"),vm=s("TFGenerationMixin"),ym=s(` (for the TensorFlow models) and
`),fr=o("a"),$m=s("FlaxGenerationMixin"),wm=s(" (for the Flax/JAX models)."),vl=l(),ze=o("h2"),et=o("a"),ta=o("span"),c(so.$$.fragment),Tm=l(),oa=o("span"),xm=s("PreTrainedModel"),yl=l(),T=o("div"),c(io.$$.fragment),Pm=l(),na=o("p"),Em=s("Base class for all models."),Mm=l(),ur=o("p"),gr=o("a"),km=s("PreTrainedModel"),jm=s(` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models as well as a few methods common to all models to:`),Dm=l(),lo=o("ul"),ra=o("li"),Fm=s("resize the input embeddings,"),qm=l(),aa=o("li"),Am=s("prune heads in the self-attention heads."),Cm=l(),sa=o("p"),Im=s("Class attributes (overridden by derived classes):"),Lm=l(),G=o("ul"),ia=o("li"),ge=o("p"),la=o("strong"),zm=s("config_class"),Om=s(" ("),_r=o("a"),Um=s("PretrainedConfig"),Nm=s(") \u2014 A subclass of "),br=o("a"),Hm=s("PretrainedConfig"),Xm=s(` to use as configuration class
for this model architecture.`),Bm=l(),mo=o("li"),_e=o("p"),da=o("strong"),Vm=s("load_tf_weights"),Sm=s(" ("),ma=o("code"),Wm=s("Callable"),Gm=s(") \u2014 A python "),ca=o("em"),Rm=s("method"),Ym=s(` for loading a TensorFlow checkpoint in a PyTorch model,
taking as arguments:`),Km=l(),Oe=o("ul"),tt=o("li"),pa=o("strong"),Jm=s("model"),Qm=s(" ("),vr=o("a"),Zm=s("PreTrainedModel"),ec=s(") \u2014 An instance of the model on which to load the TensorFlow checkpoint."),tc=l(),ot=o("li"),ha=o("strong"),oc=s("config"),nc=s(" ("),fa=o("code"),rc=s("PreTrainedConfig"),ac=s(") \u2014 An instance of the configuration associated to the model."),sc=l(),nt=o("li"),ua=o("strong"),ic=s("path"),lc=s(" ("),ga=o("code"),dc=s("str"),mc=s(") \u2014 A path to the TensorFlow checkpoint."),cc=l(),_a=o("li"),rt=o("p"),ba=o("strong"),pc=s("base_model_prefix"),hc=s(" ("),va=o("code"),fc=s("str"),uc=s(`) \u2014 A string indicating the attribute associated to the base model in derived
classes of the same architecture adding modules on top of the base model.`),gc=l(),ya=o("li"),at=o("p"),$a=o("strong"),_c=s("is_parallelizable"),bc=s(" ("),wa=o("code"),vc=s("bool"),yc=s(") \u2014 A flag indicating whether this model supports model parallelization."),$c=l(),Ta=o("li"),U=o("p"),xa=o("strong"),wc=s("main_input_name"),Tc=s(" ("),Pa=o("code"),xc=s("str"),Pc=s(") \u2014 The name of the principal input to the model (often "),Ea=o("code"),Ec=s("input_ids"),Mc=s(` for NLP
models, `),Ma=o("code"),kc=s("pixel_values"),jc=s(" for vision models and "),ka=o("code"),Dc=s("input_values"),Fc=s(" for speech models)."),qc=l(),ee=o("div"),c(co.$$.fragment),Ac=l(),po=o("p"),Cc=s(`Upload the model checkpoint to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),ja=o("code"),Ic=s("repo_path_or_name"),Lc=s("."),zc=l(),Da=o("p"),Oc=s("Examples:"),Uc=l(),c(ho.$$.fragment),Nc=l(),F=o("div"),c(fo.$$.fragment),Hc=l(),Fa=o("p"),Xc=s("Instantiate a pretrained pytorch model from a pre-trained model configuration."),Bc=l(),Ue=o("p"),Vc=s("The model is set in evaluation mode by default using "),qa=o("code"),Sc=s("model.eval()"),Wc=s(` (Dropout modules are deactivated). To train
the model, you should first set it back in training mode with `),Aa=o("code"),Gc=s("model.train()"),Rc=s("."),Yc=l(),uo=o("p"),Kc=s("The warning "),Ca=o("em"),Jc=s("Weights from XXX not initialized from pretrained model"),Qc=s(` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),Zc=l(),go=o("p"),ep=s("The warning "),Ia=o("em"),tp=s("Weights from XXX not used in YYY"),op=s(` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),np=l(),c(st.$$.fragment),rp=l(),c(it.$$.fragment),ap=l(),La=o("p"),sp=s("Examples:"),ip=l(),c(_o.$$.fragment),lp=l(),lt=o("div"),c(bo.$$.fragment),dp=l(),za=o("p"),mp=s("Returns the model\u2019s input embeddings."),cp=l(),dt=o("div"),c(vo.$$.fragment),pp=l(),Oa=o("p"),hp=s("Returns the model\u2019s output embeddings."),fp=l(),be=o("div"),c(yo.$$.fragment),up=l(),Ua=o("p"),gp=s("Deactivates gradient checkpointing for the current model."),_p=l(),Na=o("p"),bp=s(`Note that in other frameworks this feature can be referred to as \u201Cactivation checkpointing\u201D or \u201Ccheckpoint
activations\u201D.`),vp=l(),ve=o("div"),c($o.$$.fragment),yp=l(),Ha=o("p"),$p=s("Activates gradient checkpointing for the current model."),wp=l(),Xa=o("p"),Tp=s(`Note that in other frameworks this feature can be referred to as \u201Cactivation checkpointing\u201D or \u201Ccheckpoint
activations\u201D.`),xp=l(),mt=o("div"),c(wo.$$.fragment),Pp=l(),Ba=o("p"),Ep=s("If needed prunes and maybe initializes weights."),Mp=l(),ct=o("div"),c(To.$$.fragment),kp=l(),Va=o("p"),jp=s(`A method executed at the end of each Transformer model initialization, to execute code that needs the model\u2019s
modules properly initialized (such as weight initialization).`),Dp=l(),pt=o("div"),c(xo.$$.fragment),Fp=l(),Sa=o("p"),qp=s("Prunes heads of the base model."),Ap=l(),ye=o("div"),c(Po.$$.fragment),Cp=l(),Wa=o("p"),Ip=s(`Register this class with a given auto class. This should only be used for custom models as the ones in the
library are already mapped with an auto class.`),Lp=l(),c(ht.$$.fragment),zp=l(),$e=o("div"),c(Eo.$$.fragment),Op=l(),Mo=o("p"),Up=s("Resizes input token embeddings matrix of the model if "),Ga=o("code"),Np=s("new_num_tokens != config.vocab_size"),Hp=s("."),Xp=l(),ko=o("p"),Bp=s("Takes care of tying weights embeddings afterwards if the model class has a "),Ra=o("code"),Vp=s("tie_weights()"),Sp=s(" method."),Wp=l(),ft=o("div"),c(jo.$$.fragment),Gp=l(),Do=o("p"),Rp=s(`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),Ya=o("code"),Yp=s("[from_pretrained()](/docs/transformers/pr_15839/en/main_classes/model#transformers.PreTrainedModel.from_pretrained)"),Kp=s(" class method."),Jp=l(),ut=o("div"),c(Fo.$$.fragment),Qp=l(),Ka=o("p"),Zp=s("Set model\u2019s input embeddings."),eh=l(),we=o("div"),c(qo.$$.fragment),th=l(),Ja=o("p"),oh=s("Tie the weights between the input embeddings and the output embeddings."),nh=l(),Ao=o("p"),rh=s("If the "),Qa=o("code"),ah=s("torchscript"),sh=s(` flag is set in the configuration, can\u2019t handle parameter sharing so we are cloning the
weights instead.`),$l=l(),yr=o("a"),wl=l(),Ne=o("h3"),gt=o("a"),Za=o("span"),c(Co.$$.fragment),ih=l(),es=o("span"),lh=s("Model Instantiation dtype"),Tl=l(),te=o("p"),dh=s("Under Pytorch a model normally gets instantiated with "),ts=o("code"),mh=s("torch.float32"),ch=s(` format. This can be an issue if one tries to
load a model whose weights are in fp16, since it\u2019d require twice as much memory. To overcome this limitation, you can
either explicitly pass the desired `),os=o("code"),ph=s("dtype"),hh=s(" using "),ns=o("code"),fh=s("torch_dtype"),uh=s(" argument:"),xl=l(),c(Io.$$.fragment),Pl=l(),Te=o("p"),gh=s("or, if you want the model to always load in the most optimal memory pattern, you can use the special value "),rs=o("code"),_h=s('"auto"'),bh=s(`,
and then `),as=o("code"),vh=s("dtype"),yh=s(" will be automatically derived from the model\u2019s weights:"),El=l(),c(Lo.$$.fragment),Ml=l(),_t=o("p"),$h=s("Models instantiated from scratch can also be told which "),ss=o("code"),wh=s("dtype"),Th=s(" to use with:"),kl=l(),c(zo.$$.fragment),jl=l(),$r=o("p"),xh=s("Due to Pytorch design, this functionality is only available for floating dtypes."),Dl=l(),He=o("h2"),bt=o("a"),is=o("span"),c(Oo.$$.fragment),Ph=l(),ls=o("span"),Eh=s("ModuleUtilsMixin"),Fl=l(),j=o("div"),c(Uo.$$.fragment),Mh=l(),No=o("p"),kh=s("A few utilities for "),ds=o("code"),jh=s("torch.nn.Modules"),Dh=s(", to be used as a mixin."),Fh=l(),xe=o("div"),c(Ho.$$.fragment),qh=l(),ms=o("p"),Ah=s("Add a memory hook before and after each sub-module forward pass to record increase in memory consumption."),Ch=l(),Xe=o("p"),Ih=s("Increase in memory consumption is stored in a "),cs=o("code"),Lh=s("mem_rss_diff"),zh=s(` attribute for each module and can be reset to zero
with `),ps=o("code"),Oh=s("model.reset_memory_hooks_state()"),Uh=s("."),Nh=l(),vt=o("div"),c(Xo.$$.fragment),Hh=l(),hs=o("p"),Xh=s("Helper function to estimate the total number of tokens from the model inputs."),Bh=l(),yt=o("div"),c(Bo.$$.fragment),Vh=l(),Be=o("p"),Sh=s(`Get number of (optionally, non-embeddings) floating-point operations for the forward and backward passes of a
batch with this transformer model. Default approximation neglects the quadratic dependency on the number of
tokens (valid if `),fs=o("code"),Wh=s("12 * d_model << sequence_length"),Gh=s(") as laid out in "),Vo=o("a"),Rh=s(`this
paper`),Yh=s(` section 2.1. Should be overridden for transformers with parameter
re-use e.g. Albert or Universal Transformers, or if doing long-range modeling with very high sequence lengths.`),Kh=l(),$t=o("div"),c(So.$$.fragment),Jh=l(),us=o("p"),Qh=s("Makes broadcastable attention and causal masks so that future and masked tokens are ignored."),Zh=l(),wt=o("div"),c(Wo.$$.fragment),ef=l(),gs=o("p"),tf=s("Prepare the head mask if needed."),of=l(),Tt=o("div"),c(Go.$$.fragment),nf=l(),_s=o("p"),rf=s("Invert an attention mask (e.g., switches 0. and 1.)."),af=l(),xt=o("div"),c(Ro.$$.fragment),sf=l(),bs=o("p"),lf=s("Get number of (optionally, trainable or non-embeddings) parameters in the module."),df=l(),Pt=o("div"),c(Yo.$$.fragment),mf=l(),Ve=o("p"),cf=s("Reset the "),vs=o("code"),pf=s("mem_rss_diff"),hf=s(" attribute of each module (see "),wr=o("a"),ff=s("add_memory_hooks()"),uf=s(")."),ql=l(),Se=o("h2"),Et=o("a"),ys=o("span"),c(Ko.$$.fragment),gf=l(),$s=o("span"),_f=s("TFPreTrainedModel"),Al=l(),b=o("div"),c(Jo.$$.fragment),bf=l(),ws=o("p"),vf=s("Base class for all TF models."),yf=l(),Tr=o("p"),xr=o("a"),$f=s("TFPreTrainedModel"),wf=s(` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models as well as a few methods common to all models to:`),Tf=l(),Qo=o("ul"),Ts=o("li"),xf=s("resize the input embeddings,"),Pf=l(),xs=o("li"),Ef=s("prune heads in the self-attention heads."),Mf=l(),Ps=o("p"),kf=s("Class attributes (overridden by derived classes):"),jf=l(),We=o("ul"),Pe=o("li"),Es=o("strong"),Df=s("config_class"),Ff=s(" ("),Pr=o("a"),qf=s("PretrainedConfig"),Af=s(") \u2014 A subclass of "),Er=o("a"),Cf=s("PretrainedConfig"),If=s(` to use as configuration class
for this model architecture.`),Lf=l(),Mt=o("li"),Ms=o("strong"),zf=s("base_model_prefix"),Of=s(" ("),ks=o("code"),Uf=s("str"),Nf=s(`) \u2014 A string indicating the attribute associated to the base model in derived
classes of the same architecture adding modules on top of the base model.`),Hf=l(),N=o("li"),js=o("strong"),Xf=s("main_input_name"),Bf=s(" ("),Ds=o("code"),Vf=s("str"),Sf=s(") \u2014 The name of the principal input to the model (often "),Fs=o("code"),Wf=s("input_ids"),Gf=s(` for NLP
models, `),qs=o("code"),Rf=s("pixel_values"),Yf=s(" for vision models and "),As=o("code"),Kf=s("input_values"),Jf=s(" for speech models)."),Qf=l(),oe=o("div"),c(Zo.$$.fragment),Zf=l(),en=o("p"),eu=s(`Upload the model checkpoint to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),Cs=o("code"),tu=s("repo_path_or_name"),ou=s("."),nu=l(),Is=o("p"),ru=s("Examples:"),au=l(),c(tn.$$.fragment),su=l(),kt=o("div"),c(on.$$.fragment),iu=l(),Ls=o("p"),lu=s(`This is a thin wrapper that sets the model\u2019s loss output head as the loss if the user does not specify a loss
function themselves.`),du=l(),C=o("div"),c(nn.$$.fragment),mu=l(),zs=o("p"),cu=s("Instantiate a pretrained TF 2.0 model from a pre-trained model configuration."),pu=l(),rn=o("p"),hu=s("The warning "),Os=o("em"),fu=s("Weights from XXX not initialized from pretrained model"),uu=s(` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),gu=l(),an=o("p"),_u=s("The warning "),Us=o("em"),bu=s("Weights from XXX not used in YYY"),vu=s(` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),yu=l(),c(jt.$$.fragment),$u=l(),Ns=o("p"),wu=s("Examples:"),Tu=l(),c(sn.$$.fragment),xu=l(),Dt=o("div"),c(ln.$$.fragment),Pu=l(),Hs=o("p"),Eu=s("Dict of bias attached to an LM head. The key represents the name of the bias attribute."),Mu=l(),Ft=o("div"),c(dn.$$.fragment),ku=l(),Xs=o("p"),ju=s("Returns the model\u2019s input embeddings layer."),Du=l(),qt=o("div"),c(mn.$$.fragment),Fu=l(),Bs=o("p"),qu=s("The LM Head layer. This method must be overwritten by all the models that have a lm head."),Au=l(),At=o("div"),c(cn.$$.fragment),Cu=l(),Vs=o("p"),Iu=s("Returns the model\u2019s output embeddings"),Lu=l(),Ct=o("div"),c(pn.$$.fragment),zu=l(),Ss=o("p"),Ou=s(`Get the layer that handles a bias attribute in case the model has an LM head with weights tied to the
embeddings`),Uu=l(),It=o("div"),c(hn.$$.fragment),Nu=l(),Ws=o("p"),Hu=s("Get the concatenated _prefix name of the bias from the model name to the parent layer"),Xu=l(),Lt=o("div"),c(fn.$$.fragment),Bu=l(),Gs=o("p"),Vu=s(`Loads a saved checkpoint (model weights and optimizer state) from a repo. Returns the current epoch count when
the checkpoint was made.`),Su=l(),zt=o("div"),c(un.$$.fragment),Wu=l(),Rs=o("p"),Gu=s("Prunes heads of the base model."),Ru=l(),Ee=o("div"),c(gn.$$.fragment),Yu=l(),_n=o("p"),Ku=s("Resizes input token embeddings matrix of the model if "),Ys=o("code"),Ju=s("new_num_tokens != config.vocab_size"),Qu=s("."),Zu=l(),bn=o("p"),eg=s("Takes care of tying weights embeddings afterwards if the model class has a "),Ks=o("code"),tg=s("tie_weights()"),og=s(" method."),ng=l(),Ot=o("div"),c(vn.$$.fragment),rg=l(),yn=o("p"),ag=s(`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),Mr=o("a"),sg=s("from_pretrained()"),ig=s(" class method."),lg=l(),Ut=o("div"),c($n.$$.fragment),dg=l(),Js=o("p"),mg=s("Method used for serving the model."),cg=l(),Nt=o("div"),c(wn.$$.fragment),pg=l(),Qs=o("p"),hg=s("Prepare the output of the saved model. Each model must implement this function."),fg=l(),Ht=o("div"),c(Tn.$$.fragment),ug=l(),Zs=o("p"),gg=s("Set all the bias in the LM head."),_g=l(),Xt=o("div"),c(xn.$$.fragment),bg=l(),ei=o("p"),vg=s("Set model\u2019s input embeddings"),yg=l(),Bt=o("div"),c(Pn.$$.fragment),$g=l(),ti=o("p"),wg=s("Set model\u2019s output embeddings"),Tg=l(),Vt=o("div"),c(En.$$.fragment),xg=l(),oi=o("p"),Pg=s("A modification of Keras\u2019s default test_step that cleans up the printed metrics when we use a dummy loss."),Eg=l(),ne=o("div"),c(Mn.$$.fragment),Mg=l(),R=o("p"),kg=s("A modification of Keras\u2019s default "),ni=o("code"),jg=s("train_step"),Dg=s(` that cleans up the printed metrics when we use a dummy loss. If
a user specifies a loss at model compile time, this function behaves as the original Keras `),ri=o("code"),Fg=s("train_step"),qg=s(`. In
this case, it expects the same `),ai=o("code"),Ag=s("data"),Cg=s(" as the original function (i.e. "),si=o("code"),Ig=s("(inputs, labels)"),Lg=s(")."),zg=l(),Ge=o("p"),Og=s(`However, when the model is compiled without specifying the loss AND the expected label columns are passed as
part of the input dictionary, the loss is computed internally (inside the model class) and is used in the
backwards pass. In this case, `),ii=o("code"),Ug=s("data"),Ng=s(" is a singleton tuple containing "),li=o("code"),Hg=s("(inputs,)"),Xg=s("."),Bg=l(),Re=o("p"),Vg=s(`This is possible under the aforementioned circumstances because our overriden compile function can set an
additional loss function that reduces a `),di=o("code"),Sg=s("loss"),Wg=s(" output, and the model will output a "),mi=o("code"),Gg=s("loss"),Rg=s(` component (notice the
name matching) containing the loss that was used to train the pre-trained model.`),Cl=l(),Ye=o("h2"),St=o("a"),ci=o("span"),c(kn.$$.fragment),Yg=l(),pi=o("span"),Kg=s("TFModelUtilsMixin"),Il=l(),me=o("div"),c(jn.$$.fragment),Jg=l(),Dn=o("p"),Qg=s("A few utilities for "),hi=o("code"),Zg=s("tf.keras.Model"),e_=s(", to be used as a mixin."),t_=l(),Wt=o("div"),c(Fn.$$.fragment),o_=l(),fi=o("p"),n_=s("Get the number of (optionally, trainable) parameters in the model."),Ll=l(),Ke=o("h2"),Gt=o("a"),ui=o("span"),c(qn.$$.fragment),r_=l(),gi=o("span"),a_=s("FlaxPreTrainedModel"),zl=l(),M=o("div"),c(An.$$.fragment),s_=l(),_i=o("p"),i_=s("Base class for all models."),l_=l(),kr=o("p"),jr=o("a"),d_=s("FlaxPreTrainedModel"),m_=s(` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models.`),c_=l(),bi=o("p"),p_=s("Class attributes (overridden by derived classes):"),h_=l(),Je=o("ul"),Me=o("li"),vi=o("strong"),f_=s("config_class"),u_=s(" ("),Dr=o("a"),g_=s("PretrainedConfig"),__=s(") \u2014 A subclass of "),Fr=o("a"),b_=s("PretrainedConfig"),v_=s(` to use as configuration class
for this model architecture.`),y_=l(),Rt=o("li"),yi=o("strong"),$_=s("base_model_prefix"),w_=s(" ("),$i=o("code"),T_=s("str"),x_=s(`) \u2014 A string indicating the attribute associated to the base model in derived
classes of the same architecture adding modules on top of the base model.`),P_=l(),H=o("li"),wi=o("strong"),E_=s("main_input_name"),M_=s(" ("),Ti=o("code"),k_=s("str"),j_=s(") \u2014 The name of the principal input to the model (often "),xi=o("code"),D_=s("input_ids"),F_=s(` for NLP
models, `),Pi=o("code"),q_=s("pixel_values"),A_=s(" for vision models and "),Ei=o("code"),C_=s("input_values"),I_=s(" for speech models)."),L_=l(),re=o("div"),c(Cn.$$.fragment),z_=l(),In=o("p"),O_=s(`Upload the model checkpoint to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),Mi=o("code"),U_=s("repo_path_or_name"),N_=s("."),H_=l(),ki=o("p"),X_=s("Examples:"),B_=l(),c(Ln.$$.fragment),V_=l(),O=o("div"),c(zn.$$.fragment),S_=l(),ji=o("p"),W_=s("Instantiate a pretrained flax model from a pre-trained model configuration."),G_=l(),On=o("p"),R_=s("The warning "),Di=o("em"),Y_=s("Weights from XXX not initialized from pretrained model"),K_=s(` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),J_=l(),Un=o("p"),Q_=s("The warning "),Fi=o("em"),Z_=s("Weights from XXX not used in YYY"),eb=s(` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),tb=l(),qi=o("p"),ob=s("Examples:"),nb=l(),c(Nn.$$.fragment),rb=l(),ke=o("div"),c(Hn.$$.fragment),ab=l(),Ai=o("p"),sb=s(`Register this class with a given auto class. This should only be used for custom models as the ones in the
library are already mapped with an auto class.`),ib=l(),c(Yt.$$.fragment),lb=l(),Kt=o("div"),c(Xn.$$.fragment),db=l(),Bn=o("p"),mb=s(`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),Ci=o("code"),cb=s("[from_pretrained()](/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained)"),pb=s(" class method"),hb=l(),X=o("div"),c(Vn.$$.fragment),fb=l(),Y=o("p"),ub=s("Cast the floating-point "),Ii=o("code"),gb=s("params"),_b=s(" to "),Li=o("code"),bb=s("jax.numpy.bfloat16"),vb=s(". This returns a new "),zi=o("code"),yb=s("params"),$b=s(` tree and does not cast
the `),Oi=o("code"),wb=s("params"),Tb=s(" in place."),xb=l(),Ui=o("p"),Pb=s(`This method can be used on TPU to explicitly convert the model parameters to bfloat16 precision to do full
half-precision training or to save weights in bfloat16 for inference in order to save memory and improve speed.`),Eb=l(),Ni=o("p"),Mb=s("Examples:"),kb=l(),c(Sn.$$.fragment),jb=l(),B=o("div"),c(Wn.$$.fragment),Db=l(),K=o("p"),Fb=s("Cast the floating-point "),Hi=o("code"),qb=s("parmas"),Ab=s(" to "),Xi=o("code"),Cb=s("jax.numpy.float16"),Ib=s(". This returns a new "),Bi=o("code"),Lb=s("params"),zb=s(` tree and does not cast the
`),Vi=o("code"),Ob=s("params"),Ub=s(" in place."),Nb=l(),Si=o("p"),Hb=s(`This method can be used on GPU to explicitly convert the model parameters to float16 precision to do full
half-precision training or to save weights in float16 for inference in order to save memory and improve speed.`),Xb=l(),Wi=o("p"),Bb=s("Examples:"),Vb=l(),c(Gn.$$.fragment),Sb=l(),ae=o("div"),c(Rn.$$.fragment),Wb=l(),J=o("p"),Gb=s("Cast the floating-point "),Gi=o("code"),Rb=s("parmas"),Yb=s(" to "),Ri=o("code"),Kb=s("jax.numpy.float32"),Jb=s(`. This method can be used to explicitly convert the
model parameters to fp32 precision. This returns a new `),Yi=o("code"),Qb=s("params"),Zb=s(" tree and does not cast the "),Ki=o("code"),ev=s("params"),tv=s(" in place."),ov=l(),Ji=o("p"),nv=s("Examples:"),rv=l(),c(Yn.$$.fragment),Ol=l(),Qe=o("h2"),Jt=o("a"),Qi=o("span"),c(Kn.$$.fragment),av=l(),Zi=o("span"),sv=s("Pushing to the Hub"),Ul=l(),ce=o("div"),c(Jn.$$.fragment),iv=l(),el=o("p"),lv=s("A Mixin containing the functionality to push a model or tokenizer to the hub."),dv=l(),se=o("div"),c(Qn.$$.fragment),mv=l(),Zn=o("p"),cv=s(`Upload the {object_files} to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),tl=o("code"),pv=s("repo_path_or_name"),hv=s("."),fv=l(),ol=o("p"),uv=s("Examples:"),gv=l(),c(er.$$.fragment),this.h()},l(a){const _=rw('[data-svelte="svelte-1phssyn"]',document.head);w=n(_,"META",{name:!0,content:!0}),_.forEach(t),k=d(a),x=n(a,"H1",{class:!0});var tr=r(x);E=n(tr,"A",{id:!0,class:!0,href:!0});var nl=r(E);W=n(nl,"SPAN",{});var rl=r(W);p(A.$$.fragment,rl),rl.forEach(t),nl.forEach(t),L=d(tr),de=n(tr,"SPAN",{});var al=r(de);Jd=i(al,"Models"),al.forEach(t),tr.forEach(t),ul=d(a),Z=n(a,"P",{});var pe=r(Z);Qd=i(pe,"The base classes "),sr=n(pe,"A",{href:!0});var yv=r(sr);Zd=i(yv,"PreTrainedModel"),yv.forEach(t),em=i(pe,", "),ir=n(pe,"A",{href:!0});var $v=r(ir);tm=i($v,"TFPreTrainedModel"),$v.forEach(t),om=i(pe,`, and
`),lr=n(pe,"A",{href:!0});var wv=r(lr);nm=i(wv,"FlaxPreTrainedModel"),wv.forEach(t),rm=i(pe,` implement the common methods for loading/saving a model either from a local
file or directory, or from a pretrained model configuration provided by the library (downloaded from HuggingFace\u2019s AWS
S3 repository).`),pe.forEach(t),gl=d(a),Le=n(a,"P",{});var sl=r(Le);dr=n(sl,"A",{href:!0});var Tv=r(dr);am=i(Tv,"PreTrainedModel"),Tv.forEach(t),sm=i(sl," and "),mr=n(sl,"A",{href:!0});var xv=r(mr);im=i(xv,"TFPreTrainedModel"),xv.forEach(t),lm=i(sl,` also implement a few methods which
are common among all the models to:`),sl.forEach(t),_l=d(a),Ze=n(a,"UL",{});var Hl=r(Ze);Qr=n(Hl,"LI",{});var Pv=r(Qr);dm=i(Pv,"resize the input token embeddings when new tokens are added to the vocabulary"),Pv.forEach(t),mm=d(Hl),Zr=n(Hl,"LI",{});var Ev=r(Zr);cm=i(Ev,"prune the attention heads of the model."),Ev.forEach(t),Hl.forEach(t),bl=d(a),z=n(a,"P",{});var ie=r(z);pm=i(ie,"The other methods that are common to each model are defined in "),cr=n(ie,"A",{href:!0});var Mv=r(cr);hm=i(Mv,"ModuleUtilsMixin"),Mv.forEach(t),fm=i(ie,`
(for the PyTorch models) and `),ea=n(ie,"CODE",{});var kv=r(ea);um=i(kv,"TFModuleUtilsMixin"),kv.forEach(t),gm=i(ie,` (for the TensorFlow models) or
for text generation, `),pr=n(ie,"A",{href:!0});var jv=r(pr);_m=i(jv,"GenerationMixin"),jv.forEach(t),bm=i(ie,` (for the PyTorch models),
`),hr=n(ie,"A",{href:!0});var Dv=r(hr);vm=i(Dv,"TFGenerationMixin"),Dv.forEach(t),ym=i(ie,` (for the TensorFlow models) and
`),fr=n(ie,"A",{href:!0});var Fv=r(fr);$m=i(Fv,"FlaxGenerationMixin"),Fv.forEach(t),wm=i(ie," (for the Flax/JAX models)."),ie.forEach(t),vl=d(a),ze=n(a,"H2",{class:!0});var Xl=r(ze);et=n(Xl,"A",{id:!0,class:!0,href:!0});var qv=r(et);ta=n(qv,"SPAN",{});var Av=r(ta);p(so.$$.fragment,Av),Av.forEach(t),qv.forEach(t),Tm=d(Xl),oa=n(Xl,"SPAN",{});var Cv=r(oa);xm=i(Cv,"PreTrainedModel"),Cv.forEach(t),Xl.forEach(t),yl=d(a),T=n(a,"DIV",{class:!0});var P=r(T);p(io.$$.fragment,P),Pm=d(P),na=n(P,"P",{});var Iv=r(na);Em=i(Iv,"Base class for all models."),Iv.forEach(t),Mm=d(P),ur=n(P,"P",{});var _v=r(ur);gr=n(_v,"A",{href:!0});var Lv=r(gr);km=i(Lv,"PreTrainedModel"),Lv.forEach(t),jm=i(_v,` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models as well as a few methods common to all models to:`),_v.forEach(t),Dm=d(P),lo=n(P,"UL",{});var Bl=r(lo);ra=n(Bl,"LI",{});var zv=r(ra);Fm=i(zv,"resize the input embeddings,"),zv.forEach(t),qm=d(Bl),aa=n(Bl,"LI",{});var Ov=r(aa);Am=i(Ov,"prune heads in the self-attention heads."),Ov.forEach(t),Bl.forEach(t),Cm=d(P),sa=n(P,"P",{});var Uv=r(sa);Im=i(Uv,"Class attributes (overridden by derived classes):"),Uv.forEach(t),Lm=d(P),G=n(P,"UL",{});var je=r(G);ia=n(je,"LI",{});var Nv=r(ia);ge=n(Nv,"P",{});var or=r(ge);la=n(or,"STRONG",{});var Hv=r(la);zm=i(Hv,"config_class"),Hv.forEach(t),Om=i(or," ("),_r=n(or,"A",{href:!0});var Xv=r(_r);Um=i(Xv,"PretrainedConfig"),Xv.forEach(t),Nm=i(or,") \u2014 A subclass of "),br=n(or,"A",{href:!0});var Bv=r(br);Hm=i(Bv,"PretrainedConfig"),Bv.forEach(t),Xm=i(or,` to use as configuration class
for this model architecture.`),or.forEach(t),Nv.forEach(t),Bm=d(je),mo=n(je,"LI",{});var Vl=r(mo);_e=n(Vl,"P",{});var nr=r(_e);da=n(nr,"STRONG",{});var Vv=r(da);Vm=i(Vv,"load_tf_weights"),Vv.forEach(t),Sm=i(nr," ("),ma=n(nr,"CODE",{});var Sv=r(ma);Wm=i(Sv,"Callable"),Sv.forEach(t),Gm=i(nr,") \u2014 A python "),ca=n(nr,"EM",{});var Wv=r(ca);Rm=i(Wv,"method"),Wv.forEach(t),Ym=i(nr,` for loading a TensorFlow checkpoint in a PyTorch model,
taking as arguments:`),nr.forEach(t),Km=d(Vl),Oe=n(Vl,"UL",{});var qr=r(Oe);tt=n(qr,"LI",{});var il=r(tt);pa=n(il,"STRONG",{});var Gv=r(pa);Jm=i(Gv,"model"),Gv.forEach(t),Qm=i(il," ("),vr=n(il,"A",{href:!0});var Rv=r(vr);Zm=i(Rv,"PreTrainedModel"),Rv.forEach(t),ec=i(il,") \u2014 An instance of the model on which to load the TensorFlow checkpoint."),il.forEach(t),tc=d(qr),ot=n(qr,"LI",{});var ll=r(ot);ha=n(ll,"STRONG",{});var Yv=r(ha);oc=i(Yv,"config"),Yv.forEach(t),nc=i(ll," ("),fa=n(ll,"CODE",{});var Kv=r(fa);rc=i(Kv,"PreTrainedConfig"),Kv.forEach(t),ac=i(ll,") \u2014 An instance of the configuration associated to the model."),ll.forEach(t),sc=d(qr),nt=n(qr,"LI",{});var dl=r(nt);ua=n(dl,"STRONG",{});var Jv=r(ua);ic=i(Jv,"path"),Jv.forEach(t),lc=i(dl," ("),ga=n(dl,"CODE",{});var Qv=r(ga);dc=i(Qv,"str"),Qv.forEach(t),mc=i(dl,") \u2014 A path to the TensorFlow checkpoint."),dl.forEach(t),qr.forEach(t),Vl.forEach(t),cc=d(je),_a=n(je,"LI",{});var Zv=r(_a);rt=n(Zv,"P",{});var ml=r(rt);ba=n(ml,"STRONG",{});var ey=r(ba);pc=i(ey,"base_model_prefix"),ey.forEach(t),hc=i(ml," ("),va=n(ml,"CODE",{});var ty=r(va);fc=i(ty,"str"),ty.forEach(t),uc=i(ml,`) \u2014 A string indicating the attribute associated to the base model in derived
classes of the same architecture adding modules on top of the base model.`),ml.forEach(t),Zv.forEach(t),gc=d(je),ya=n(je,"LI",{});var oy=r(ya);at=n(oy,"P",{});var cl=r(at);$a=n(cl,"STRONG",{});var ny=r($a);_c=i(ny,"is_parallelizable"),ny.forEach(t),bc=i(cl," ("),wa=n(cl,"CODE",{});var ry=r(wa);vc=i(ry,"bool"),ry.forEach(t),yc=i(cl,") \u2014 A flag indicating whether this model supports model parallelization."),cl.forEach(t),oy.forEach(t),$c=d(je),Ta=n(je,"LI",{});var ay=r(Ta);U=n(ay,"P",{});var he=r(U);xa=n(he,"STRONG",{});var sy=r(xa);wc=i(sy,"main_input_name"),sy.forEach(t),Tc=i(he," ("),Pa=n(he,"CODE",{});var iy=r(Pa);xc=i(iy,"str"),iy.forEach(t),Pc=i(he,") \u2014 The name of the principal input to the model (often "),Ea=n(he,"CODE",{});var ly=r(Ea);Ec=i(ly,"input_ids"),ly.forEach(t),Mc=i(he,` for NLP
models, `),Ma=n(he,"CODE",{});var dy=r(Ma);kc=i(dy,"pixel_values"),dy.forEach(t),jc=i(he," for vision models and "),ka=n(he,"CODE",{});var my=r(ka);Dc=i(my,"input_values"),my.forEach(t),Fc=i(he," for speech models)."),he.forEach(t),ay.forEach(t),je.forEach(t),qc=d(P),ee=n(P,"DIV",{class:!0});var Qt=r(ee);p(co.$$.fragment,Qt),Ac=d(Qt),po=n(Qt,"P",{});var Sl=r(po);Cc=i(Sl,`Upload the model checkpoint to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),ja=n(Sl,"CODE",{});var cy=r(ja);Ic=i(cy,"repo_path_or_name"),cy.forEach(t),Lc=i(Sl,"."),Sl.forEach(t),zc=d(Qt),Da=n(Qt,"P",{});var py=r(Da);Oc=i(py,"Examples:"),py.forEach(t),Uc=d(Qt),p(ho.$$.fragment,Qt),Qt.forEach(t),Nc=d(P),F=n(P,"DIV",{class:!0});var I=r(F);p(fo.$$.fragment,I),Hc=d(I),Fa=n(I,"P",{});var hy=r(Fa);Xc=i(hy,"Instantiate a pretrained pytorch model from a pre-trained model configuration."),hy.forEach(t),Bc=d(I),Ue=n(I,"P",{});var Ar=r(Ue);Vc=i(Ar,"The model is set in evaluation mode by default using "),qa=n(Ar,"CODE",{});var fy=r(qa);Sc=i(fy,"model.eval()"),fy.forEach(t),Wc=i(Ar,` (Dropout modules are deactivated). To train
the model, you should first set it back in training mode with `),Aa=n(Ar,"CODE",{});var uy=r(Aa);Gc=i(uy,"model.train()"),uy.forEach(t),Rc=i(Ar,"."),Ar.forEach(t),Yc=d(I),uo=n(I,"P",{});var Wl=r(uo);Kc=i(Wl,"The warning "),Ca=n(Wl,"EM",{});var gy=r(Ca);Jc=i(gy,"Weights from XXX not initialized from pretrained model"),gy.forEach(t),Qc=i(Wl,` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),Wl.forEach(t),Zc=d(I),go=n(I,"P",{});var Gl=r(go);ep=i(Gl,"The warning "),Ia=n(Gl,"EM",{});var _y=r(Ia);tp=i(_y,"Weights from XXX not used in YYY"),_y.forEach(t),op=i(Gl,` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),Gl.forEach(t),np=d(I),p(st.$$.fragment,I),rp=d(I),p(it.$$.fragment,I),ap=d(I),La=n(I,"P",{});var by=r(La);sp=i(by,"Examples:"),by.forEach(t),ip=d(I),p(_o.$$.fragment,I),I.forEach(t),lp=d(P),lt=n(P,"DIV",{class:!0});var Rl=r(lt);p(bo.$$.fragment,Rl),dp=d(Rl),za=n(Rl,"P",{});var vy=r(za);mp=i(vy,"Returns the model\u2019s input embeddings."),vy.forEach(t),Rl.forEach(t),cp=d(P),dt=n(P,"DIV",{class:!0});var Yl=r(dt);p(vo.$$.fragment,Yl),pp=d(Yl),Oa=n(Yl,"P",{});var yy=r(Oa);hp=i(yy,"Returns the model\u2019s output embeddings."),yy.forEach(t),Yl.forEach(t),fp=d(P),be=n(P,"DIV",{class:!0});var Cr=r(be);p(yo.$$.fragment,Cr),up=d(Cr),Ua=n(Cr,"P",{});var $y=r(Ua);gp=i($y,"Deactivates gradient checkpointing for the current model."),$y.forEach(t),_p=d(Cr),Na=n(Cr,"P",{});var wy=r(Na);bp=i(wy,`Note that in other frameworks this feature can be referred to as \u201Cactivation checkpointing\u201D or \u201Ccheckpoint
activations\u201D.`),wy.forEach(t),Cr.forEach(t),vp=d(P),ve=n(P,"DIV",{class:!0});var Ir=r(ve);p($o.$$.fragment,Ir),yp=d(Ir),Ha=n(Ir,"P",{});var Ty=r(Ha);$p=i(Ty,"Activates gradient checkpointing for the current model."),Ty.forEach(t),wp=d(Ir),Xa=n(Ir,"P",{});var xy=r(Xa);Tp=i(xy,`Note that in other frameworks this feature can be referred to as \u201Cactivation checkpointing\u201D or \u201Ccheckpoint
activations\u201D.`),xy.forEach(t),Ir.forEach(t),xp=d(P),mt=n(P,"DIV",{class:!0});var Kl=r(mt);p(wo.$$.fragment,Kl),Pp=d(Kl),Ba=n(Kl,"P",{});var Py=r(Ba);Ep=i(Py,"If needed prunes and maybe initializes weights."),Py.forEach(t),Kl.forEach(t),Mp=d(P),ct=n(P,"DIV",{class:!0});var Jl=r(ct);p(To.$$.fragment,Jl),kp=d(Jl),Va=n(Jl,"P",{});var Ey=r(Va);jp=i(Ey,`A method executed at the end of each Transformer model initialization, to execute code that needs the model\u2019s
modules properly initialized (such as weight initialization).`),Ey.forEach(t),Jl.forEach(t),Dp=d(P),pt=n(P,"DIV",{class:!0});var Ql=r(pt);p(xo.$$.fragment,Ql),Fp=d(Ql),Sa=n(Ql,"P",{});var My=r(Sa);qp=i(My,"Prunes heads of the base model."),My.forEach(t),Ql.forEach(t),Ap=d(P),ye=n(P,"DIV",{class:!0});var Lr=r(ye);p(Po.$$.fragment,Lr),Cp=d(Lr),Wa=n(Lr,"P",{});var ky=r(Wa);Ip=i(ky,`Register this class with a given auto class. This should only be used for custom models as the ones in the
library are already mapped with an auto class.`),ky.forEach(t),Lp=d(Lr),p(ht.$$.fragment,Lr),Lr.forEach(t),zp=d(P),$e=n(P,"DIV",{class:!0});var zr=r($e);p(Eo.$$.fragment,zr),Op=d(zr),Mo=n(zr,"P",{});var Zl=r(Mo);Up=i(Zl,"Resizes input token embeddings matrix of the model if "),Ga=n(Zl,"CODE",{});var jy=r(Ga);Np=i(jy,"new_num_tokens != config.vocab_size"),jy.forEach(t),Hp=i(Zl,"."),Zl.forEach(t),Xp=d(zr),ko=n(zr,"P",{});var ed=r(ko);Bp=i(ed,"Takes care of tying weights embeddings afterwards if the model class has a "),Ra=n(ed,"CODE",{});var Dy=r(Ra);Vp=i(Dy,"tie_weights()"),Dy.forEach(t),Sp=i(ed," method."),ed.forEach(t),zr.forEach(t),Wp=d(P),ft=n(P,"DIV",{class:!0});var td=r(ft);p(jo.$$.fragment,td),Gp=d(td),Do=n(td,"P",{});var od=r(Do);Rp=i(od,`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),Ya=n(od,"CODE",{});var Fy=r(Ya);Yp=i(Fy,"[from_pretrained()](/docs/transformers/pr_15839/en/main_classes/model#transformers.PreTrainedModel.from_pretrained)"),Fy.forEach(t),Kp=i(od," class method."),od.forEach(t),td.forEach(t),Jp=d(P),ut=n(P,"DIV",{class:!0});var nd=r(ut);p(Fo.$$.fragment,nd),Qp=d(nd),Ka=n(nd,"P",{});var qy=r(Ka);Zp=i(qy,"Set model\u2019s input embeddings."),qy.forEach(t),nd.forEach(t),eh=d(P),we=n(P,"DIV",{class:!0});var Or=r(we);p(qo.$$.fragment,Or),th=d(Or),Ja=n(Or,"P",{});var Ay=r(Ja);oh=i(Ay,"Tie the weights between the input embeddings and the output embeddings."),Ay.forEach(t),nh=d(Or),Ao=n(Or,"P",{});var rd=r(Ao);rh=i(rd,"If the "),Qa=n(rd,"CODE",{});var Cy=r(Qa);ah=i(Cy,"torchscript"),Cy.forEach(t),sh=i(rd,` flag is set in the configuration, can\u2019t handle parameter sharing so we are cloning the
weights instead.`),rd.forEach(t),Or.forEach(t),P.forEach(t),$l=d(a),yr=n(a,"A",{id:!0}),r(yr).forEach(t),wl=d(a),Ne=n(a,"H3",{class:!0});var ad=r(Ne);gt=n(ad,"A",{id:!0,class:!0,href:!0});var Iy=r(gt);Za=n(Iy,"SPAN",{});var Ly=r(Za);p(Co.$$.fragment,Ly),Ly.forEach(t),Iy.forEach(t),ih=d(ad),es=n(ad,"SPAN",{});var zy=r(es);lh=i(zy,"Model Instantiation dtype"),zy.forEach(t),ad.forEach(t),Tl=d(a),te=n(a,"P",{});var Zt=r(te);dh=i(Zt,"Under Pytorch a model normally gets instantiated with "),ts=n(Zt,"CODE",{});var Oy=r(ts);mh=i(Oy,"torch.float32"),Oy.forEach(t),ch=i(Zt,` format. This can be an issue if one tries to
load a model whose weights are in fp16, since it\u2019d require twice as much memory. To overcome this limitation, you can
either explicitly pass the desired `),os=n(Zt,"CODE",{});var Uy=r(os);ph=i(Uy,"dtype"),Uy.forEach(t),hh=i(Zt," using "),ns=n(Zt,"CODE",{});var Ny=r(ns);fh=i(Ny,"torch_dtype"),Ny.forEach(t),uh=i(Zt," argument:"),Zt.forEach(t),xl=d(a),p(Io.$$.fragment,a),Pl=d(a),Te=n(a,"P",{});var Ur=r(Te);gh=i(Ur,"or, if you want the model to always load in the most optimal memory pattern, you can use the special value "),rs=n(Ur,"CODE",{});var Hy=r(rs);_h=i(Hy,'"auto"'),Hy.forEach(t),bh=i(Ur,`,
and then `),as=n(Ur,"CODE",{});var Xy=r(as);vh=i(Xy,"dtype"),Xy.forEach(t),yh=i(Ur," will be automatically derived from the model\u2019s weights:"),Ur.forEach(t),El=d(a),p(Lo.$$.fragment,a),Ml=d(a),_t=n(a,"P",{});var sd=r(_t);$h=i(sd,"Models instantiated from scratch can also be told which "),ss=n(sd,"CODE",{});var By=r(ss);wh=i(By,"dtype"),By.forEach(t),Th=i(sd," to use with:"),sd.forEach(t),kl=d(a),p(zo.$$.fragment,a),jl=d(a),$r=n(a,"P",{});var Vy=r($r);xh=i(Vy,"Due to Pytorch design, this functionality is only available for floating dtypes."),Vy.forEach(t),Dl=d(a),He=n(a,"H2",{class:!0});var id=r(He);bt=n(id,"A",{id:!0,class:!0,href:!0});var Sy=r(bt);is=n(Sy,"SPAN",{});var Wy=r(is);p(Oo.$$.fragment,Wy),Wy.forEach(t),Sy.forEach(t),Ph=d(id),ls=n(id,"SPAN",{});var Gy=r(ls);Eh=i(Gy,"ModuleUtilsMixin"),Gy.forEach(t),id.forEach(t),Fl=d(a),j=n(a,"DIV",{class:!0});var q=r(j);p(Uo.$$.fragment,q),Mh=d(q),No=n(q,"P",{});var ld=r(No);kh=i(ld,"A few utilities for "),ds=n(ld,"CODE",{});var Ry=r(ds);jh=i(Ry,"torch.nn.Modules"),Ry.forEach(t),Dh=i(ld,", to be used as a mixin."),ld.forEach(t),Fh=d(q),xe=n(q,"DIV",{class:!0});var Nr=r(xe);p(Ho.$$.fragment,Nr),qh=d(Nr),ms=n(Nr,"P",{});var Yy=r(ms);Ah=i(Yy,"Add a memory hook before and after each sub-module forward pass to record increase in memory consumption."),Yy.forEach(t),Ch=d(Nr),Xe=n(Nr,"P",{});var Hr=r(Xe);Ih=i(Hr,"Increase in memory consumption is stored in a "),cs=n(Hr,"CODE",{});var Ky=r(cs);Lh=i(Ky,"mem_rss_diff"),Ky.forEach(t),zh=i(Hr,` attribute for each module and can be reset to zero
with `),ps=n(Hr,"CODE",{});var Jy=r(ps);Oh=i(Jy,"model.reset_memory_hooks_state()"),Jy.forEach(t),Uh=i(Hr,"."),Hr.forEach(t),Nr.forEach(t),Nh=d(q),vt=n(q,"DIV",{class:!0});var dd=r(vt);p(Xo.$$.fragment,dd),Hh=d(dd),hs=n(dd,"P",{});var Qy=r(hs);Xh=i(Qy,"Helper function to estimate the total number of tokens from the model inputs."),Qy.forEach(t),dd.forEach(t),Bh=d(q),yt=n(q,"DIV",{class:!0});var md=r(yt);p(Bo.$$.fragment,md),Vh=d(md),Be=n(md,"P",{});var Xr=r(Be);Sh=i(Xr,`Get number of (optionally, non-embeddings) floating-point operations for the forward and backward passes of a
batch with this transformer model. Default approximation neglects the quadratic dependency on the number of
tokens (valid if `),fs=n(Xr,"CODE",{});var Zy=r(fs);Wh=i(Zy,"12 * d_model << sequence_length"),Zy.forEach(t),Gh=i(Xr,") as laid out in "),Vo=n(Xr,"A",{href:!0,rel:!0});var e1=r(Vo);Rh=i(e1,`this
paper`),e1.forEach(t),Yh=i(Xr,` section 2.1. Should be overridden for transformers with parameter
re-use e.g. Albert or Universal Transformers, or if doing long-range modeling with very high sequence lengths.`),Xr.forEach(t),md.forEach(t),Kh=d(q),$t=n(q,"DIV",{class:!0});var cd=r($t);p(So.$$.fragment,cd),Jh=d(cd),us=n(cd,"P",{});var t1=r(us);Qh=i(t1,"Makes broadcastable attention and causal masks so that future and masked tokens are ignored."),t1.forEach(t),cd.forEach(t),Zh=d(q),wt=n(q,"DIV",{class:!0});var pd=r(wt);p(Wo.$$.fragment,pd),ef=d(pd),gs=n(pd,"P",{});var o1=r(gs);tf=i(o1,"Prepare the head mask if needed."),o1.forEach(t),pd.forEach(t),of=d(q),Tt=n(q,"DIV",{class:!0});var hd=r(Tt);p(Go.$$.fragment,hd),nf=d(hd),_s=n(hd,"P",{});var n1=r(_s);rf=i(n1,"Invert an attention mask (e.g., switches 0. and 1.)."),n1.forEach(t),hd.forEach(t),af=d(q),xt=n(q,"DIV",{class:!0});var fd=r(xt);p(Ro.$$.fragment,fd),sf=d(fd),bs=n(fd,"P",{});var r1=r(bs);lf=i(r1,"Get number of (optionally, trainable or non-embeddings) parameters in the module."),r1.forEach(t),fd.forEach(t),df=d(q),Pt=n(q,"DIV",{class:!0});var ud=r(Pt);p(Yo.$$.fragment,ud),mf=d(ud),Ve=n(ud,"P",{});var Br=r(Ve);cf=i(Br,"Reset the "),vs=n(Br,"CODE",{});var a1=r(vs);pf=i(a1,"mem_rss_diff"),a1.forEach(t),hf=i(Br," attribute of each module (see "),wr=n(Br,"A",{href:!0});var s1=r(wr);ff=i(s1,"add_memory_hooks()"),s1.forEach(t),uf=i(Br,")."),Br.forEach(t),ud.forEach(t),q.forEach(t),ql=d(a),Se=n(a,"H2",{class:!0});var gd=r(Se);Et=n(gd,"A",{id:!0,class:!0,href:!0});var i1=r(Et);ys=n(i1,"SPAN",{});var l1=r(ys);p(Ko.$$.fragment,l1),l1.forEach(t),i1.forEach(t),gf=d(gd),$s=n(gd,"SPAN",{});var d1=r($s);_f=i(d1,"TFPreTrainedModel"),d1.forEach(t),gd.forEach(t),Al=d(a),b=n(a,"DIV",{class:!0});var $=r(b);p(Jo.$$.fragment,$),bf=d($),ws=n($,"P",{});var m1=r(ws);vf=i(m1,"Base class for all TF models."),m1.forEach(t),yf=d($),Tr=n($,"P",{});var bv=r(Tr);xr=n(bv,"A",{href:!0});var c1=r(xr);$f=i(c1,"TFPreTrainedModel"),c1.forEach(t),wf=i(bv,` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models as well as a few methods common to all models to:`),bv.forEach(t),Tf=d($),Qo=n($,"UL",{});var _d=r(Qo);Ts=n(_d,"LI",{});var p1=r(Ts);xf=i(p1,"resize the input embeddings,"),p1.forEach(t),Pf=d(_d),xs=n(_d,"LI",{});var h1=r(xs);Ef=i(h1,"prune heads in the self-attention heads."),h1.forEach(t),_d.forEach(t),Mf=d($),Ps=n($,"P",{});var f1=r(Ps);kf=i(f1,"Class attributes (overridden by derived classes):"),f1.forEach(t),jf=d($),We=n($,"UL",{});var Vr=r(We);Pe=n(Vr,"LI",{});var rr=r(Pe);Es=n(rr,"STRONG",{});var u1=r(Es);Df=i(u1,"config_class"),u1.forEach(t),Ff=i(rr," ("),Pr=n(rr,"A",{href:!0});var g1=r(Pr);qf=i(g1,"PretrainedConfig"),g1.forEach(t),Af=i(rr,") \u2014 A subclass of "),Er=n(rr,"A",{href:!0});var _1=r(Er);Cf=i(_1,"PretrainedConfig"),_1.forEach(t),If=i(rr,` to use as configuration class
for this model architecture.`),rr.forEach(t),Lf=d(Vr),Mt=n(Vr,"LI",{});var pl=r(Mt);Ms=n(pl,"STRONG",{});var b1=r(Ms);zf=i(b1,"base_model_prefix"),b1.forEach(t),Of=i(pl," ("),ks=n(pl,"CODE",{});var v1=r(ks);Uf=i(v1,"str"),v1.forEach(t),Nf=i(pl,`) \u2014 A string indicating the attribute associated to the base model in derived
classes of the same architecture adding modules on top of the base model.`),pl.forEach(t),Hf=d(Vr),N=n(Vr,"LI",{});var fe=r(N);js=n(fe,"STRONG",{});var y1=r(js);Xf=i(y1,"main_input_name"),y1.forEach(t),Bf=i(fe," ("),Ds=n(fe,"CODE",{});var $1=r(Ds);Vf=i($1,"str"),$1.forEach(t),Sf=i(fe,") \u2014 The name of the principal input to the model (often "),Fs=n(fe,"CODE",{});var w1=r(Fs);Wf=i(w1,"input_ids"),w1.forEach(t),Gf=i(fe,` for NLP
models, `),qs=n(fe,"CODE",{});var T1=r(qs);Rf=i(T1,"pixel_values"),T1.forEach(t),Yf=i(fe," for vision models and "),As=n(fe,"CODE",{});var x1=r(As);Kf=i(x1,"input_values"),x1.forEach(t),Jf=i(fe," for speech models)."),fe.forEach(t),Vr.forEach(t),Qf=d($),oe=n($,"DIV",{class:!0});var eo=r(oe);p(Zo.$$.fragment,eo),Zf=d(eo),en=n(eo,"P",{});var bd=r(en);eu=i(bd,`Upload the model checkpoint to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),Cs=n(bd,"CODE",{});var P1=r(Cs);tu=i(P1,"repo_path_or_name"),P1.forEach(t),ou=i(bd,"."),bd.forEach(t),nu=d(eo),Is=n(eo,"P",{});var E1=r(Is);ru=i(E1,"Examples:"),E1.forEach(t),au=d(eo),p(tn.$$.fragment,eo),eo.forEach(t),su=d($),kt=n($,"DIV",{class:!0});var vd=r(kt);p(on.$$.fragment,vd),iu=d(vd),Ls=n(vd,"P",{});var M1=r(Ls);lu=i(M1,`This is a thin wrapper that sets the model\u2019s loss output head as the loss if the user does not specify a loss
function themselves.`),M1.forEach(t),vd.forEach(t),du=d($),C=n($,"DIV",{class:!0});var V=r(C);p(nn.$$.fragment,V),mu=d(V),zs=n(V,"P",{});var k1=r(zs);cu=i(k1,"Instantiate a pretrained TF 2.0 model from a pre-trained model configuration."),k1.forEach(t),pu=d(V),rn=n(V,"P",{});var yd=r(rn);hu=i(yd,"The warning "),Os=n(yd,"EM",{});var j1=r(Os);fu=i(j1,"Weights from XXX not initialized from pretrained model"),j1.forEach(t),uu=i(yd,` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),yd.forEach(t),gu=d(V),an=n(V,"P",{});var $d=r(an);_u=i($d,"The warning "),Us=n($d,"EM",{});var D1=r(Us);bu=i(D1,"Weights from XXX not used in YYY"),D1.forEach(t),vu=i($d,` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),$d.forEach(t),yu=d(V),p(jt.$$.fragment,V),$u=d(V),Ns=n(V,"P",{});var F1=r(Ns);wu=i(F1,"Examples:"),F1.forEach(t),Tu=d(V),p(sn.$$.fragment,V),V.forEach(t),xu=d($),Dt=n($,"DIV",{class:!0});var wd=r(Dt);p(ln.$$.fragment,wd),Pu=d(wd),Hs=n(wd,"P",{});var q1=r(Hs);Eu=i(q1,"Dict of bias attached to an LM head. The key represents the name of the bias attribute."),q1.forEach(t),wd.forEach(t),Mu=d($),Ft=n($,"DIV",{class:!0});var Td=r(Ft);p(dn.$$.fragment,Td),ku=d(Td),Xs=n(Td,"P",{});var A1=r(Xs);ju=i(A1,"Returns the model\u2019s input embeddings layer."),A1.forEach(t),Td.forEach(t),Du=d($),qt=n($,"DIV",{class:!0});var xd=r(qt);p(mn.$$.fragment,xd),Fu=d(xd),Bs=n(xd,"P",{});var C1=r(Bs);qu=i(C1,"The LM Head layer. This method must be overwritten by all the models that have a lm head."),C1.forEach(t),xd.forEach(t),Au=d($),At=n($,"DIV",{class:!0});var Pd=r(At);p(cn.$$.fragment,Pd),Cu=d(Pd),Vs=n(Pd,"P",{});var I1=r(Vs);Iu=i(I1,"Returns the model\u2019s output embeddings"),I1.forEach(t),Pd.forEach(t),Lu=d($),Ct=n($,"DIV",{class:!0});var Ed=r(Ct);p(pn.$$.fragment,Ed),zu=d(Ed),Ss=n(Ed,"P",{});var L1=r(Ss);Ou=i(L1,`Get the layer that handles a bias attribute in case the model has an LM head with weights tied to the
embeddings`),L1.forEach(t),Ed.forEach(t),Uu=d($),It=n($,"DIV",{class:!0});var Md=r(It);p(hn.$$.fragment,Md),Nu=d(Md),Ws=n(Md,"P",{});var z1=r(Ws);Hu=i(z1,"Get the concatenated _prefix name of the bias from the model name to the parent layer"),z1.forEach(t),Md.forEach(t),Xu=d($),Lt=n($,"DIV",{class:!0});var kd=r(Lt);p(fn.$$.fragment,kd),Bu=d(kd),Gs=n(kd,"P",{});var O1=r(Gs);Vu=i(O1,`Loads a saved checkpoint (model weights and optimizer state) from a repo. Returns the current epoch count when
the checkpoint was made.`),O1.forEach(t),kd.forEach(t),Su=d($),zt=n($,"DIV",{class:!0});var jd=r(zt);p(un.$$.fragment,jd),Wu=d(jd),Rs=n(jd,"P",{});var U1=r(Rs);Gu=i(U1,"Prunes heads of the base model."),U1.forEach(t),jd.forEach(t),Ru=d($),Ee=n($,"DIV",{class:!0});var Sr=r(Ee);p(gn.$$.fragment,Sr),Yu=d(Sr),_n=n(Sr,"P",{});var Dd=r(_n);Ku=i(Dd,"Resizes input token embeddings matrix of the model if "),Ys=n(Dd,"CODE",{});var N1=r(Ys);Ju=i(N1,"new_num_tokens != config.vocab_size"),N1.forEach(t),Qu=i(Dd,"."),Dd.forEach(t),Zu=d(Sr),bn=n(Sr,"P",{});var Fd=r(bn);eg=i(Fd,"Takes care of tying weights embeddings afterwards if the model class has a "),Ks=n(Fd,"CODE",{});var H1=r(Ks);tg=i(H1,"tie_weights()"),H1.forEach(t),og=i(Fd," method."),Fd.forEach(t),Sr.forEach(t),ng=d($),Ot=n($,"DIV",{class:!0});var qd=r(Ot);p(vn.$$.fragment,qd),rg=d(qd),yn=n(qd,"P",{});var Ad=r(yn);ag=i(Ad,`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),Mr=n(Ad,"A",{href:!0});var X1=r(Mr);sg=i(X1,"from_pretrained()"),X1.forEach(t),ig=i(Ad," class method."),Ad.forEach(t),qd.forEach(t),lg=d($),Ut=n($,"DIV",{class:!0});var Cd=r(Ut);p($n.$$.fragment,Cd),dg=d(Cd),Js=n(Cd,"P",{});var B1=r(Js);mg=i(B1,"Method used for serving the model."),B1.forEach(t),Cd.forEach(t),cg=d($),Nt=n($,"DIV",{class:!0});var Id=r(Nt);p(wn.$$.fragment,Id),pg=d(Id),Qs=n(Id,"P",{});var V1=r(Qs);hg=i(V1,"Prepare the output of the saved model. Each model must implement this function."),V1.forEach(t),Id.forEach(t),fg=d($),Ht=n($,"DIV",{class:!0});var Ld=r(Ht);p(Tn.$$.fragment,Ld),ug=d(Ld),Zs=n(Ld,"P",{});var S1=r(Zs);gg=i(S1,"Set all the bias in the LM head."),S1.forEach(t),Ld.forEach(t),_g=d($),Xt=n($,"DIV",{class:!0});var zd=r(Xt);p(xn.$$.fragment,zd),bg=d(zd),ei=n(zd,"P",{});var W1=r(ei);vg=i(W1,"Set model\u2019s input embeddings"),W1.forEach(t),zd.forEach(t),yg=d($),Bt=n($,"DIV",{class:!0});var Od=r(Bt);p(Pn.$$.fragment,Od),$g=d(Od),ti=n(Od,"P",{});var G1=r(ti);wg=i(G1,"Set model\u2019s output embeddings"),G1.forEach(t),Od.forEach(t),Tg=d($),Vt=n($,"DIV",{class:!0});var Ud=r(Vt);p(En.$$.fragment,Ud),xg=d(Ud),oi=n(Ud,"P",{});var R1=r(oi);Pg=i(R1,"A modification of Keras\u2019s default test_step that cleans up the printed metrics when we use a dummy loss."),R1.forEach(t),Ud.forEach(t),Eg=d($),ne=n($,"DIV",{class:!0});var to=r(ne);p(Mn.$$.fragment,to),Mg=d(to),R=n(to,"P",{});var De=r(R);kg=i(De,"A modification of Keras\u2019s default "),ni=n(De,"CODE",{});var Y1=r(ni);jg=i(Y1,"train_step"),Y1.forEach(t),Dg=i(De,` that cleans up the printed metrics when we use a dummy loss. If
a user specifies a loss at model compile time, this function behaves as the original Keras `),ri=n(De,"CODE",{});var K1=r(ri);Fg=i(K1,"train_step"),K1.forEach(t),qg=i(De,`. In
this case, it expects the same `),ai=n(De,"CODE",{});var J1=r(ai);Ag=i(J1,"data"),J1.forEach(t),Cg=i(De," as the original function (i.e. "),si=n(De,"CODE",{});var Q1=r(si);Ig=i(Q1,"(inputs, labels)"),Q1.forEach(t),Lg=i(De,")."),De.forEach(t),zg=d(to),Ge=n(to,"P",{});var Wr=r(Ge);Og=i(Wr,`However, when the model is compiled without specifying the loss AND the expected label columns are passed as
part of the input dictionary, the loss is computed internally (inside the model class) and is used in the
backwards pass. In this case, `),ii=n(Wr,"CODE",{});var Z1=r(ii);Ug=i(Z1,"data"),Z1.forEach(t),Ng=i(Wr," is a singleton tuple containing "),li=n(Wr,"CODE",{});var e$=r(li);Hg=i(e$,"(inputs,)"),e$.forEach(t),Xg=i(Wr,"."),Wr.forEach(t),Bg=d(to),Re=n(to,"P",{});var Gr=r(Re);Vg=i(Gr,`This is possible under the aforementioned circumstances because our overriden compile function can set an
additional loss function that reduces a `),di=n(Gr,"CODE",{});var t$=r(di);Sg=i(t$,"loss"),t$.forEach(t),Wg=i(Gr," output, and the model will output a "),mi=n(Gr,"CODE",{});var o$=r(mi);Gg=i(o$,"loss"),o$.forEach(t),Rg=i(Gr,` component (notice the
name matching) containing the loss that was used to train the pre-trained model.`),Gr.forEach(t),to.forEach(t),$.forEach(t),Cl=d(a),Ye=n(a,"H2",{class:!0});var Nd=r(Ye);St=n(Nd,"A",{id:!0,class:!0,href:!0});var n$=r(St);ci=n(n$,"SPAN",{});var r$=r(ci);p(kn.$$.fragment,r$),r$.forEach(t),n$.forEach(t),Yg=d(Nd),pi=n(Nd,"SPAN",{});var a$=r(pi);Kg=i(a$,"TFModelUtilsMixin"),a$.forEach(t),Nd.forEach(t),Il=d(a),me=n(a,"DIV",{class:!0});var Rr=r(me);p(jn.$$.fragment,Rr),Jg=d(Rr),Dn=n(Rr,"P",{});var Hd=r(Dn);Qg=i(Hd,"A few utilities for "),hi=n(Hd,"CODE",{});var s$=r(hi);Zg=i(s$,"tf.keras.Model"),s$.forEach(t),e_=i(Hd,", to be used as a mixin."),Hd.forEach(t),t_=d(Rr),Wt=n(Rr,"DIV",{class:!0});var Xd=r(Wt);p(Fn.$$.fragment,Xd),o_=d(Xd),fi=n(Xd,"P",{});var i$=r(fi);n_=i(i$,"Get the number of (optionally, trainable) parameters in the model."),i$.forEach(t),Xd.forEach(t),Rr.forEach(t),Ll=d(a),Ke=n(a,"H2",{class:!0});var Bd=r(Ke);Gt=n(Bd,"A",{id:!0,class:!0,href:!0});var l$=r(Gt);ui=n(l$,"SPAN",{});var d$=r(ui);p(qn.$$.fragment,d$),d$.forEach(t),l$.forEach(t),r_=d(Bd),gi=n(Bd,"SPAN",{});var m$=r(gi);a_=i(m$,"FlaxPreTrainedModel"),m$.forEach(t),Bd.forEach(t),zl=d(a),M=n(a,"DIV",{class:!0});var D=r(M);p(An.$$.fragment,D),s_=d(D),_i=n(D,"P",{});var c$=r(_i);i_=i(c$,"Base class for all models."),c$.forEach(t),l_=d(D),kr=n(D,"P",{});var vv=r(kr);jr=n(vv,"A",{href:!0});var p$=r(jr);d_=i(p$,"FlaxPreTrainedModel"),p$.forEach(t),m_=i(vv,` takes care of storing the configuration of the models and handles methods for loading,
downloading and saving models.`),vv.forEach(t),c_=d(D),bi=n(D,"P",{});var h$=r(bi);p_=i(h$,"Class attributes (overridden by derived classes):"),h$.forEach(t),h_=d(D),Je=n(D,"UL",{});var Yr=r(Je);Me=n(Yr,"LI",{});var ar=r(Me);vi=n(ar,"STRONG",{});var f$=r(vi);f_=i(f$,"config_class"),f$.forEach(t),u_=i(ar," ("),Dr=n(ar,"A",{href:!0});var u$=r(Dr);g_=i(u$,"PretrainedConfig"),u$.forEach(t),__=i(ar,") \u2014 A subclass of "),Fr=n(ar,"A",{href:!0});var g$=r(Fr);b_=i(g$,"PretrainedConfig"),g$.forEach(t),v_=i(ar,` to use as configuration class
for this model architecture.`),ar.forEach(t),y_=d(Yr),Rt=n(Yr,"LI",{});var hl=r(Rt);yi=n(hl,"STRONG",{});var _$=r(yi);$_=i(_$,"base_model_prefix"),_$.forEach(t),w_=i(hl," ("),$i=n(hl,"CODE",{});var b$=r($i);T_=i(b$,"str"),b$.forEach(t),x_=i(hl,`) \u2014 A string indicating the attribute associated to the base model in derived
classes of the same architecture adding modules on top of the base model.`),hl.forEach(t),P_=d(Yr),H=n(Yr,"LI",{});var ue=r(H);wi=n(ue,"STRONG",{});var v$=r(wi);E_=i(v$,"main_input_name"),v$.forEach(t),M_=i(ue," ("),Ti=n(ue,"CODE",{});var y$=r(Ti);k_=i(y$,"str"),y$.forEach(t),j_=i(ue,") \u2014 The name of the principal input to the model (often "),xi=n(ue,"CODE",{});var $$=r(xi);D_=i($$,"input_ids"),$$.forEach(t),F_=i(ue,` for NLP
models, `),Pi=n(ue,"CODE",{});var w$=r(Pi);q_=i(w$,"pixel_values"),w$.forEach(t),A_=i(ue," for vision models and "),Ei=n(ue,"CODE",{});var T$=r(Ei);C_=i(T$,"input_values"),T$.forEach(t),I_=i(ue," for speech models)."),ue.forEach(t),Yr.forEach(t),L_=d(D),re=n(D,"DIV",{class:!0});var oo=r(re);p(Cn.$$.fragment,oo),z_=d(oo),In=n(oo,"P",{});var Vd=r(In);O_=i(Vd,`Upload the model checkpoint to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),Mi=n(Vd,"CODE",{});var x$=r(Mi);U_=i(x$,"repo_path_or_name"),x$.forEach(t),N_=i(Vd,"."),Vd.forEach(t),H_=d(oo),ki=n(oo,"P",{});var P$=r(ki);X_=i(P$,"Examples:"),P$.forEach(t),B_=d(oo),p(Ln.$$.fragment,oo),oo.forEach(t),V_=d(D),O=n(D,"DIV",{class:!0});var le=r(O);p(zn.$$.fragment,le),S_=d(le),ji=n(le,"P",{});var E$=r(ji);W_=i(E$,"Instantiate a pretrained flax model from a pre-trained model configuration."),E$.forEach(t),G_=d(le),On=n(le,"P",{});var Sd=r(On);R_=i(Sd,"The warning "),Di=n(Sd,"EM",{});var M$=r(Di);Y_=i(M$,"Weights from XXX not initialized from pretrained model"),M$.forEach(t),K_=i(Sd,` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),Sd.forEach(t),J_=d(le),Un=n(le,"P",{});var Wd=r(Un);Q_=i(Wd,"The warning "),Fi=n(Wd,"EM",{});var k$=r(Fi);Z_=i(k$,"Weights from XXX not used in YYY"),k$.forEach(t),eb=i(Wd,` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),Wd.forEach(t),tb=d(le),qi=n(le,"P",{});var j$=r(qi);ob=i(j$,"Examples:"),j$.forEach(t),nb=d(le),p(Nn.$$.fragment,le),le.forEach(t),rb=d(D),ke=n(D,"DIV",{class:!0});var Kr=r(ke);p(Hn.$$.fragment,Kr),ab=d(Kr),Ai=n(Kr,"P",{});var D$=r(Ai);sb=i(D$,`Register this class with a given auto class. This should only be used for custom models as the ones in the
library are already mapped with an auto class.`),D$.forEach(t),ib=d(Kr),p(Yt.$$.fragment,Kr),Kr.forEach(t),lb=d(D),Kt=n(D,"DIV",{class:!0});var Gd=r(Kt);p(Xn.$$.fragment,Gd),db=d(Gd),Bn=n(Gd,"P",{});var Rd=r(Bn);mb=i(Rd,`Save a model and its configuration file to a directory, so that it can be re-loaded using the
`),Ci=n(Rd,"CODE",{});var F$=r(Ci);cb=i(F$,"[from_pretrained()](/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained)"),F$.forEach(t),pb=i(Rd," class method"),Rd.forEach(t),Gd.forEach(t),hb=d(D),X=n(D,"DIV",{class:!0});var Fe=r(X);p(Vn.$$.fragment,Fe),fb=d(Fe),Y=n(Fe,"P",{});var qe=r(Y);ub=i(qe,"Cast the floating-point "),Ii=n(qe,"CODE",{});var q$=r(Ii);gb=i(q$,"params"),q$.forEach(t),_b=i(qe," to "),Li=n(qe,"CODE",{});var A$=r(Li);bb=i(A$,"jax.numpy.bfloat16"),A$.forEach(t),vb=i(qe,". This returns a new "),zi=n(qe,"CODE",{});var C$=r(zi);yb=i(C$,"params"),C$.forEach(t),$b=i(qe,` tree and does not cast
the `),Oi=n(qe,"CODE",{});var I$=r(Oi);wb=i(I$,"params"),I$.forEach(t),Tb=i(qe," in place."),qe.forEach(t),xb=d(Fe),Ui=n(Fe,"P",{});var L$=r(Ui);Pb=i(L$,`This method can be used on TPU to explicitly convert the model parameters to bfloat16 precision to do full
half-precision training or to save weights in bfloat16 for inference in order to save memory and improve speed.`),L$.forEach(t),Eb=d(Fe),Ni=n(Fe,"P",{});var z$=r(Ni);Mb=i(z$,"Examples:"),z$.forEach(t),kb=d(Fe),p(Sn.$$.fragment,Fe),Fe.forEach(t),jb=d(D),B=n(D,"DIV",{class:!0});var Ae=r(B);p(Wn.$$.fragment,Ae),Db=d(Ae),K=n(Ae,"P",{});var Ce=r(K);Fb=i(Ce,"Cast the floating-point "),Hi=n(Ce,"CODE",{});var O$=r(Hi);qb=i(O$,"parmas"),O$.forEach(t),Ab=i(Ce," to "),Xi=n(Ce,"CODE",{});var U$=r(Xi);Cb=i(U$,"jax.numpy.float16"),U$.forEach(t),Ib=i(Ce,". This returns a new "),Bi=n(Ce,"CODE",{});var N$=r(Bi);Lb=i(N$,"params"),N$.forEach(t),zb=i(Ce,` tree and does not cast the
`),Vi=n(Ce,"CODE",{});var H$=r(Vi);Ob=i(H$,"params"),H$.forEach(t),Ub=i(Ce," in place."),Ce.forEach(t),Nb=d(Ae),Si=n(Ae,"P",{});var X$=r(Si);Hb=i(X$,`This method can be used on GPU to explicitly convert the model parameters to float16 precision to do full
half-precision training or to save weights in float16 for inference in order to save memory and improve speed.`),X$.forEach(t),Xb=d(Ae),Wi=n(Ae,"P",{});var B$=r(Wi);Bb=i(B$,"Examples:"),B$.forEach(t),Vb=d(Ae),p(Gn.$$.fragment,Ae),Ae.forEach(t),Sb=d(D),ae=n(D,"DIV",{class:!0});var no=r(ae);p(Rn.$$.fragment,no),Wb=d(no),J=n(no,"P",{});var Ie=r(J);Gb=i(Ie,"Cast the floating-point "),Gi=n(Ie,"CODE",{});var V$=r(Gi);Rb=i(V$,"parmas"),V$.forEach(t),Yb=i(Ie," to "),Ri=n(Ie,"CODE",{});var S$=r(Ri);Kb=i(S$,"jax.numpy.float32"),S$.forEach(t),Jb=i(Ie,`. This method can be used to explicitly convert the
model parameters to fp32 precision. This returns a new `),Yi=n(Ie,"CODE",{});var W$=r(Yi);Qb=i(W$,"params"),W$.forEach(t),Zb=i(Ie," tree and does not cast the "),Ki=n(Ie,"CODE",{});var G$=r(Ki);ev=i(G$,"params"),G$.forEach(t),tv=i(Ie," in place."),Ie.forEach(t),ov=d(no),Ji=n(no,"P",{});var R$=r(Ji);nv=i(R$,"Examples:"),R$.forEach(t),rv=d(no),p(Yn.$$.fragment,no),no.forEach(t),D.forEach(t),Ol=d(a),Qe=n(a,"H2",{class:!0});var Yd=r(Qe);Jt=n(Yd,"A",{id:!0,class:!0,href:!0});var Y$=r(Jt);Qi=n(Y$,"SPAN",{});var K$=r(Qi);p(Kn.$$.fragment,K$),K$.forEach(t),Y$.forEach(t),av=d(Yd),Zi=n(Yd,"SPAN",{});var J$=r(Zi);sv=i(J$,"Pushing to the Hub"),J$.forEach(t),Yd.forEach(t),Ul=d(a),ce=n(a,"DIV",{class:!0});var Jr=r(ce);p(Jn.$$.fragment,Jr),iv=d(Jr),el=n(Jr,"P",{});var Q$=r(el);lv=i(Q$,"A Mixin containing the functionality to push a model or tokenizer to the hub."),Q$.forEach(t),dv=d(Jr),se=n(Jr,"DIV",{class:!0});var ro=r(se);p(Qn.$$.fragment,ro),mv=d(ro),Zn=n(ro,"P",{});var Kd=r(Zn);cv=i(Kd,`Upload the {object_files} to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),tl=n(Kd,"CODE",{});var Z$=r(tl);pv=i(Z$,"repo_path_or_name"),Z$.forEach(t),hv=i(Kd,"."),Kd.forEach(t),fv=d(ro),ol=n(ro,"P",{});var ew=r(ol);uv=i(ew,"Examples:"),ew.forEach(t),gv=d(ro),p(er.$$.fragment,ro),ro.forEach(t),Jr.forEach(t),this.h()},h(){m(w,"name","hf:doc:metadata"),m(w,"content",JSON.stringify(cw)),m(E,"id","models"),m(E,"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"),m(E,"href","#models"),m(x,"class","relative group"),m(sr,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.PreTrainedModel"),m(ir,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.TFPreTrainedModel"),m(lr,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel"),m(dr,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.PreTrainedModel"),m(mr,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.TFPreTrainedModel"),m(cr,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.modeling_utils.ModuleUtilsMixin"),m(pr,"href","/docs/transformers/pr_15839/en/main_classes/text_generation#transformers.generation_utils.GenerationMixin"),m(hr,"href","/docs/transformers/pr_15839/en/main_classes/text_generation#transformers.generation_tf_utils.TFGenerationMixin"),m(fr,"href","/docs/transformers/pr_15839/en/main_classes/text_generation#transformers.generation_flax_utils.FlaxGenerationMixin"),m(et,"id","transformers.PreTrainedModel"),m(et,"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"),m(et,"href","#transformers.PreTrainedModel"),m(ze,"class","relative group"),m(gr,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.PreTrainedModel"),m(_r,"href","/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig"),m(br,"href","/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig"),m(vr,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.PreTrainedModel"),m(ee,"class","docstring"),m(F,"class","docstring"),m(lt,"class","docstring"),m(dt,"class","docstring"),m(be,"class","docstring"),m(ve,"class","docstring"),m(mt,"class","docstring"),m(ct,"class","docstring"),m(pt,"class","docstring"),m(ye,"class","docstring"),m($e,"class","docstring"),m(ft,"class","docstring"),m(ut,"class","docstring"),m(we,"class","docstring"),m(T,"class","docstring"),m(yr,"id","from_pretrained-torch-dtype"),m(gt,"id","model-instantiation-dtype"),m(gt,"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"),m(gt,"href","#model-instantiation-dtype"),m(Ne,"class","relative group"),m(bt,"id","transformers.modeling_utils.ModuleUtilsMixin"),m(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"),m(bt,"href","#transformers.modeling_utils.ModuleUtilsMixin"),m(He,"class","relative group"),m(xe,"class","docstring"),m(vt,"class","docstring"),m(Vo,"href","https://arxiv.org/pdf/2001.08361.pdf"),m(Vo,"rel","nofollow"),m(yt,"class","docstring"),m($t,"class","docstring"),m(wt,"class","docstring"),m(Tt,"class","docstring"),m(xt,"class","docstring"),m(wr,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.modeling_utils.ModuleUtilsMixin.add_memory_hooks"),m(Pt,"class","docstring"),m(j,"class","docstring"),m(Et,"id","transformers.TFPreTrainedModel"),m(Et,"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"),m(Et,"href","#transformers.TFPreTrainedModel"),m(Se,"class","relative group"),m(xr,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.TFPreTrainedModel"),m(Pr,"href","/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig"),m(Er,"href","/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig"),m(oe,"class","docstring"),m(kt,"class","docstring"),m(C,"class","docstring"),m(Dt,"class","docstring"),m(Ft,"class","docstring"),m(qt,"class","docstring"),m(At,"class","docstring"),m(Ct,"class","docstring"),m(It,"class","docstring"),m(Lt,"class","docstring"),m(zt,"class","docstring"),m(Ee,"class","docstring"),m(Mr,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained"),m(Ot,"class","docstring"),m(Ut,"class","docstring"),m(Nt,"class","docstring"),m(Ht,"class","docstring"),m(Xt,"class","docstring"),m(Bt,"class","docstring"),m(Vt,"class","docstring"),m(ne,"class","docstring"),m(b,"class","docstring"),m(St,"id","transformers.modeling_tf_utils.TFModelUtilsMixin"),m(St,"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"),m(St,"href","#transformers.modeling_tf_utils.TFModelUtilsMixin"),m(Ye,"class","relative group"),m(Wt,"class","docstring"),m(me,"class","docstring"),m(Gt,"id","transformers.FlaxPreTrainedModel"),m(Gt,"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"),m(Gt,"href","#transformers.FlaxPreTrainedModel"),m(Ke,"class","relative group"),m(jr,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel"),m(Dr,"href","/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig"),m(Fr,"href","/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig"),m(re,"class","docstring"),m(O,"class","docstring"),m(ke,"class","docstring"),m(Kt,"class","docstring"),m(X,"class","docstring"),m(B,"class","docstring"),m(ae,"class","docstring"),m(M,"class","docstring"),m(Jt,"id","transformers.file_utils.PushToHubMixin"),m(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"),m(Jt,"href","#transformers.file_utils.PushToHubMixin"),m(Qe,"class","relative group"),m(se,"class","docstring"),m(ce,"class","docstring")},m(a,_){e(document.head,w),y(a,k,_),y(a,x,_),e(x,E),e(E,W),h(A,W,null),e(x,L),e(x,de),e(de,Jd),y(a,ul,_),y(a,Z,_),e(Z,Qd),e(Z,sr),e(sr,Zd),e(Z,em),e(Z,ir),e(ir,tm),e(Z,om),e(Z,lr),e(lr,nm),e(Z,rm),y(a,gl,_),y(a,Le,_),e(Le,dr),e(dr,am),e(Le,sm),e(Le,mr),e(mr,im),e(Le,lm),y(a,_l,_),y(a,Ze,_),e(Ze,Qr),e(Qr,dm),e(Ze,mm),e(Ze,Zr),e(Zr,cm),y(a,bl,_),y(a,z,_),e(z,pm),e(z,cr),e(cr,hm),e(z,fm),e(z,ea),e(ea,um),e(z,gm),e(z,pr),e(pr,_m),e(z,bm),e(z,hr),e(hr,vm),e(z,ym),e(z,fr),e(fr,$m),e(z,wm),y(a,vl,_),y(a,ze,_),e(ze,et),e(et,ta),h(so,ta,null),e(ze,Tm),e(ze,oa),e(oa,xm),y(a,yl,_),y(a,T,_),h(io,T,null),e(T,Pm),e(T,na),e(na,Em),e(T,Mm),e(T,ur),e(ur,gr),e(gr,km),e(ur,jm),e(T,Dm),e(T,lo),e(lo,ra),e(ra,Fm),e(lo,qm),e(lo,aa),e(aa,Am),e(T,Cm),e(T,sa),e(sa,Im),e(T,Lm),e(T,G),e(G,ia),e(ia,ge),e(ge,la),e(la,zm),e(ge,Om),e(ge,_r),e(_r,Um),e(ge,Nm),e(ge,br),e(br,Hm),e(ge,Xm),e(G,Bm),e(G,mo),e(mo,_e),e(_e,da),e(da,Vm),e(_e,Sm),e(_e,ma),e(ma,Wm),e(_e,Gm),e(_e,ca),e(ca,Rm),e(_e,Ym),e(mo,Km),e(mo,Oe),e(Oe,tt),e(tt,pa),e(pa,Jm),e(tt,Qm),e(tt,vr),e(vr,Zm),e(tt,ec),e(Oe,tc),e(Oe,ot),e(ot,ha),e(ha,oc),e(ot,nc),e(ot,fa),e(fa,rc),e(ot,ac),e(Oe,sc),e(Oe,nt),e(nt,ua),e(ua,ic),e(nt,lc),e(nt,ga),e(ga,dc),e(nt,mc),e(G,cc),e(G,_a),e(_a,rt),e(rt,ba),e(ba,pc),e(rt,hc),e(rt,va),e(va,fc),e(rt,uc),e(G,gc),e(G,ya),e(ya,at),e(at,$a),e($a,_c),e(at,bc),e(at,wa),e(wa,vc),e(at,yc),e(G,$c),e(G,Ta),e(Ta,U),e(U,xa),e(xa,wc),e(U,Tc),e(U,Pa),e(Pa,xc),e(U,Pc),e(U,Ea),e(Ea,Ec),e(U,Mc),e(U,Ma),e(Ma,kc),e(U,jc),e(U,ka),e(ka,Dc),e(U,Fc),e(T,qc),e(T,ee),h(co,ee,null),e(ee,Ac),e(ee,po),e(po,Cc),e(po,ja),e(ja,Ic),e(po,Lc),e(ee,zc),e(ee,Da),e(Da,Oc),e(ee,Uc),h(ho,ee,null),e(T,Nc),e(T,F),h(fo,F,null),e(F,Hc),e(F,Fa),e(Fa,Xc),e(F,Bc),e(F,Ue),e(Ue,Vc),e(Ue,qa),e(qa,Sc),e(Ue,Wc),e(Ue,Aa),e(Aa,Gc),e(Ue,Rc),e(F,Yc),e(F,uo),e(uo,Kc),e(uo,Ca),e(Ca,Jc),e(uo,Qc),e(F,Zc),e(F,go),e(go,ep),e(go,Ia),e(Ia,tp),e(go,op),e(F,np),h(st,F,null),e(F,rp),h(it,F,null),e(F,ap),e(F,La),e(La,sp),e(F,ip),h(_o,F,null),e(T,lp),e(T,lt),h(bo,lt,null),e(lt,dp),e(lt,za),e(za,mp),e(T,cp),e(T,dt),h(vo,dt,null),e(dt,pp),e(dt,Oa),e(Oa,hp),e(T,fp),e(T,be),h(yo,be,null),e(be,up),e(be,Ua),e(Ua,gp),e(be,_p),e(be,Na),e(Na,bp),e(T,vp),e(T,ve),h($o,ve,null),e(ve,yp),e(ve,Ha),e(Ha,$p),e(ve,wp),e(ve,Xa),e(Xa,Tp),e(T,xp),e(T,mt),h(wo,mt,null),e(mt,Pp),e(mt,Ba),e(Ba,Ep),e(T,Mp),e(T,ct),h(To,ct,null),e(ct,kp),e(ct,Va),e(Va,jp),e(T,Dp),e(T,pt),h(xo,pt,null),e(pt,Fp),e(pt,Sa),e(Sa,qp),e(T,Ap),e(T,ye),h(Po,ye,null),e(ye,Cp),e(ye,Wa),e(Wa,Ip),e(ye,Lp),h(ht,ye,null),e(T,zp),e(T,$e),h(Eo,$e,null),e($e,Op),e($e,Mo),e(Mo,Up),e(Mo,Ga),e(Ga,Np),e(Mo,Hp),e($e,Xp),e($e,ko),e(ko,Bp),e(ko,Ra),e(Ra,Vp),e(ko,Sp),e(T,Wp),e(T,ft),h(jo,ft,null),e(ft,Gp),e(ft,Do),e(Do,Rp),e(Do,Ya),e(Ya,Yp),e(Do,Kp),e(T,Jp),e(T,ut),h(Fo,ut,null),e(ut,Qp),e(ut,Ka),e(Ka,Zp),e(T,eh),e(T,we),h(qo,we,null),e(we,th),e(we,Ja),e(Ja,oh),e(we,nh),e(we,Ao),e(Ao,rh),e(Ao,Qa),e(Qa,ah),e(Ao,sh),y(a,$l,_),y(a,yr,_),y(a,wl,_),y(a,Ne,_),e(Ne,gt),e(gt,Za),h(Co,Za,null),e(Ne,ih),e(Ne,es),e(es,lh),y(a,Tl,_),y(a,te,_),e(te,dh),e(te,ts),e(ts,mh),e(te,ch),e(te,os),e(os,ph),e(te,hh),e(te,ns),e(ns,fh),e(te,uh),y(a,xl,_),h(Io,a,_),y(a,Pl,_),y(a,Te,_),e(Te,gh),e(Te,rs),e(rs,_h),e(Te,bh),e(Te,as),e(as,vh),e(Te,yh),y(a,El,_),h(Lo,a,_),y(a,Ml,_),y(a,_t,_),e(_t,$h),e(_t,ss),e(ss,wh),e(_t,Th),y(a,kl,_),h(zo,a,_),y(a,jl,_),y(a,$r,_),e($r,xh),y(a,Dl,_),y(a,He,_),e(He,bt),e(bt,is),h(Oo,is,null),e(He,Ph),e(He,ls),e(ls,Eh),y(a,Fl,_),y(a,j,_),h(Uo,j,null),e(j,Mh),e(j,No),e(No,kh),e(No,ds),e(ds,jh),e(No,Dh),e(j,Fh),e(j,xe),h(Ho,xe,null),e(xe,qh),e(xe,ms),e(ms,Ah),e(xe,Ch),e(xe,Xe),e(Xe,Ih),e(Xe,cs),e(cs,Lh),e(Xe,zh),e(Xe,ps),e(ps,Oh),e(Xe,Uh),e(j,Nh),e(j,vt),h(Xo,vt,null),e(vt,Hh),e(vt,hs),e(hs,Xh),e(j,Bh),e(j,yt),h(Bo,yt,null),e(yt,Vh),e(yt,Be),e(Be,Sh),e(Be,fs),e(fs,Wh),e(Be,Gh),e(Be,Vo),e(Vo,Rh),e(Be,Yh),e(j,Kh),e(j,$t),h(So,$t,null),e($t,Jh),e($t,us),e(us,Qh),e(j,Zh),e(j,wt),h(Wo,wt,null),e(wt,ef),e(wt,gs),e(gs,tf),e(j,of),e(j,Tt),h(Go,Tt,null),e(Tt,nf),e(Tt,_s),e(_s,rf),e(j,af),e(j,xt),h(Ro,xt,null),e(xt,sf),e(xt,bs),e(bs,lf),e(j,df),e(j,Pt),h(Yo,Pt,null),e(Pt,mf),e(Pt,Ve),e(Ve,cf),e(Ve,vs),e(vs,pf),e(Ve,hf),e(Ve,wr),e(wr,ff),e(Ve,uf),y(a,ql,_),y(a,Se,_),e(Se,Et),e(Et,ys),h(Ko,ys,null),e(Se,gf),e(Se,$s),e($s,_f),y(a,Al,_),y(a,b,_),h(Jo,b,null),e(b,bf),e(b,ws),e(ws,vf),e(b,yf),e(b,Tr),e(Tr,xr),e(xr,$f),e(Tr,wf),e(b,Tf),e(b,Qo),e(Qo,Ts),e(Ts,xf),e(Qo,Pf),e(Qo,xs),e(xs,Ef),e(b,Mf),e(b,Ps),e(Ps,kf),e(b,jf),e(b,We),e(We,Pe),e(Pe,Es),e(Es,Df),e(Pe,Ff),e(Pe,Pr),e(Pr,qf),e(Pe,Af),e(Pe,Er),e(Er,Cf),e(Pe,If),e(We,Lf),e(We,Mt),e(Mt,Ms),e(Ms,zf),e(Mt,Of),e(Mt,ks),e(ks,Uf),e(Mt,Nf),e(We,Hf),e(We,N),e(N,js),e(js,Xf),e(N,Bf),e(N,Ds),e(Ds,Vf),e(N,Sf),e(N,Fs),e(Fs,Wf),e(N,Gf),e(N,qs),e(qs,Rf),e(N,Yf),e(N,As),e(As,Kf),e(N,Jf),e(b,Qf),e(b,oe),h(Zo,oe,null),e(oe,Zf),e(oe,en),e(en,eu),e(en,Cs),e(Cs,tu),e(en,ou),e(oe,nu),e(oe,Is),e(Is,ru),e(oe,au),h(tn,oe,null),e(b,su),e(b,kt),h(on,kt,null),e(kt,iu),e(kt,Ls),e(Ls,lu),e(b,du),e(b,C),h(nn,C,null),e(C,mu),e(C,zs),e(zs,cu),e(C,pu),e(C,rn),e(rn,hu),e(rn,Os),e(Os,fu),e(rn,uu),e(C,gu),e(C,an),e(an,_u),e(an,Us),e(Us,bu),e(an,vu),e(C,yu),h(jt,C,null),e(C,$u),e(C,Ns),e(Ns,wu),e(C,Tu),h(sn,C,null),e(b,xu),e(b,Dt),h(ln,Dt,null),e(Dt,Pu),e(Dt,Hs),e(Hs,Eu),e(b,Mu),e(b,Ft),h(dn,Ft,null),e(Ft,ku),e(Ft,Xs),e(Xs,ju),e(b,Du),e(b,qt),h(mn,qt,null),e(qt,Fu),e(qt,Bs),e(Bs,qu),e(b,Au),e(b,At),h(cn,At,null),e(At,Cu),e(At,Vs),e(Vs,Iu),e(b,Lu),e(b,Ct),h(pn,Ct,null),e(Ct,zu),e(Ct,Ss),e(Ss,Ou),e(b,Uu),e(b,It),h(hn,It,null),e(It,Nu),e(It,Ws),e(Ws,Hu),e(b,Xu),e(b,Lt),h(fn,Lt,null),e(Lt,Bu),e(Lt,Gs),e(Gs,Vu),e(b,Su),e(b,zt),h(un,zt,null),e(zt,Wu),e(zt,Rs),e(Rs,Gu),e(b,Ru),e(b,Ee),h(gn,Ee,null),e(Ee,Yu),e(Ee,_n),e(_n,Ku),e(_n,Ys),e(Ys,Ju),e(_n,Qu),e(Ee,Zu),e(Ee,bn),e(bn,eg),e(bn,Ks),e(Ks,tg),e(bn,og),e(b,ng),e(b,Ot),h(vn,Ot,null),e(Ot,rg),e(Ot,yn),e(yn,ag),e(yn,Mr),e(Mr,sg),e(yn,ig),e(b,lg),e(b,Ut),h($n,Ut,null),e(Ut,dg),e(Ut,Js),e(Js,mg),e(b,cg),e(b,Nt),h(wn,Nt,null),e(Nt,pg),e(Nt,Qs),e(Qs,hg),e(b,fg),e(b,Ht),h(Tn,Ht,null),e(Ht,ug),e(Ht,Zs),e(Zs,gg),e(b,_g),e(b,Xt),h(xn,Xt,null),e(Xt,bg),e(Xt,ei),e(ei,vg),e(b,yg),e(b,Bt),h(Pn,Bt,null),e(Bt,$g),e(Bt,ti),e(ti,wg),e(b,Tg),e(b,Vt),h(En,Vt,null),e(Vt,xg),e(Vt,oi),e(oi,Pg),e(b,Eg),e(b,ne),h(Mn,ne,null),e(ne,Mg),e(ne,R),e(R,kg),e(R,ni),e(ni,jg),e(R,Dg),e(R,ri),e(ri,Fg),e(R,qg),e(R,ai),e(ai,Ag),e(R,Cg),e(R,si),e(si,Ig),e(R,Lg),e(ne,zg),e(ne,Ge),e(Ge,Og),e(Ge,ii),e(ii,Ug),e(Ge,Ng),e(Ge,li),e(li,Hg),e(Ge,Xg),e(ne,Bg),e(ne,Re),e(Re,Vg),e(Re,di),e(di,Sg),e(Re,Wg),e(Re,mi),e(mi,Gg),e(Re,Rg),y(a,Cl,_),y(a,Ye,_),e(Ye,St),e(St,ci),h(kn,ci,null),e(Ye,Yg),e(Ye,pi),e(pi,Kg),y(a,Il,_),y(a,me,_),h(jn,me,null),e(me,Jg),e(me,Dn),e(Dn,Qg),e(Dn,hi),e(hi,Zg),e(Dn,e_),e(me,t_),e(me,Wt),h(Fn,Wt,null),e(Wt,o_),e(Wt,fi),e(fi,n_),y(a,Ll,_),y(a,Ke,_),e(Ke,Gt),e(Gt,ui),h(qn,ui,null),e(Ke,r_),e(Ke,gi),e(gi,a_),y(a,zl,_),y(a,M,_),h(An,M,null),e(M,s_),e(M,_i),e(_i,i_),e(M,l_),e(M,kr),e(kr,jr),e(jr,d_),e(kr,m_),e(M,c_),e(M,bi),e(bi,p_),e(M,h_),e(M,Je),e(Je,Me),e(Me,vi),e(vi,f_),e(Me,u_),e(Me,Dr),e(Dr,g_),e(Me,__),e(Me,Fr),e(Fr,b_),e(Me,v_),e(Je,y_),e(Je,Rt),e(Rt,yi),e(yi,$_),e(Rt,w_),e(Rt,$i),e($i,T_),e(Rt,x_),e(Je,P_),e(Je,H),e(H,wi),e(wi,E_),e(H,M_),e(H,Ti),e(Ti,k_),e(H,j_),e(H,xi),e(xi,D_),e(H,F_),e(H,Pi),e(Pi,q_),e(H,A_),e(H,Ei),e(Ei,C_),e(H,I_),e(M,L_),e(M,re),h(Cn,re,null),e(re,z_),e(re,In),e(In,O_),e(In,Mi),e(Mi,U_),e(In,N_),e(re,H_),e(re,ki),e(ki,X_),e(re,B_),h(Ln,re,null),e(M,V_),e(M,O),h(zn,O,null),e(O,S_),e(O,ji),e(ji,W_),e(O,G_),e(O,On),e(On,R_),e(On,Di),e(Di,Y_),e(On,K_),e(O,J_),e(O,Un),e(Un,Q_),e(Un,Fi),e(Fi,Z_),e(Un,eb),e(O,tb),e(O,qi),e(qi,ob),e(O,nb),h(Nn,O,null),e(M,rb),e(M,ke),h(Hn,ke,null),e(ke,ab),e(ke,Ai),e(Ai,sb),e(ke,ib),h(Yt,ke,null),e(M,lb),e(M,Kt),h(Xn,Kt,null),e(Kt,db),e(Kt,Bn),e(Bn,mb),e(Bn,Ci),e(Ci,cb),e(Bn,pb),e(M,hb),e(M,X),h(Vn,X,null),e(X,fb),e(X,Y),e(Y,ub),e(Y,Ii),e(Ii,gb),e(Y,_b),e(Y,Li),e(Li,bb),e(Y,vb),e(Y,zi),e(zi,yb),e(Y,$b),e(Y,Oi),e(Oi,wb),e(Y,Tb),e(X,xb),e(X,Ui),e(Ui,Pb),e(X,Eb),e(X,Ni),e(Ni,Mb),e(X,kb),h(Sn,X,null),e(M,jb),e(M,B),h(Wn,B,null),e(B,Db),e(B,K),e(K,Fb),e(K,Hi),e(Hi,qb),e(K,Ab),e(K,Xi),e(Xi,Cb),e(K,Ib),e(K,Bi),e(Bi,Lb),e(K,zb),e(K,Vi),e(Vi,Ob),e(K,Ub),e(B,Nb),e(B,Si),e(Si,Hb),e(B,Xb),e(B,Wi),e(Wi,Bb),e(B,Vb),h(Gn,B,null),e(M,Sb),e(M,ae),h(Rn,ae,null),e(ae,Wb),e(ae,J),e(J,Gb),e(J,Gi),e(Gi,Rb),e(J,Yb),e(J,Ri),e(Ri,Kb),e(J,Jb),e(J,Yi),e(Yi,Qb),e(J,Zb),e(J,Ki),e(Ki,ev),e(J,tv),e(ae,ov),e(ae,Ji),e(Ji,nv),e(ae,rv),h(Yn,ae,null),y(a,Ol,_),y(a,Qe,_),e(Qe,Jt),e(Jt,Qi),h(Kn,Qi,null),e(Qe,av),e(Qe,Zi),e(Zi,sv),y(a,Ul,_),y(a,ce,_),h(Jn,ce,null),e(ce,iv),e(ce,el),e(el,lv),e(ce,dv),e(ce,se),h(Qn,se,null),e(se,mv),e(se,Zn),e(Zn,cv),e(Zn,tl),e(tl,pv),e(Zn,hv),e(se,fv),e(se,ol),e(ol,uv),e(se,gv),h(er,se,null),Nl=!0},p(a,[_]){const tr={};_&2&&(tr.$$scope={dirty:_,ctx:a}),st.$set(tr);const nl={};_&2&&(nl.$$scope={dirty:_,ctx:a}),it.$set(nl);const rl={};_&2&&(rl.$$scope={dirty:_,ctx:a}),ht.$set(rl);const al={};_&2&&(al.$$scope={dirty:_,ctx:a}),jt.$set(al);const pe={};_&2&&(pe.$$scope={dirty:_,ctx:a}),Yt.$set(pe)},i(a){Nl||(f(A.$$.fragment,a),f(so.$$.fragment,a),f(io.$$.fragment,a),f(co.$$.fragment,a),f(ho.$$.fragment,a),f(fo.$$.fragment,a),f(st.$$.fragment,a),f(it.$$.fragment,a),f(_o.$$.fragment,a),f(bo.$$.fragment,a),f(vo.$$.fragment,a),f(yo.$$.fragment,a),f($o.$$.fragment,a),f(wo.$$.fragment,a),f(To.$$.fragment,a),f(xo.$$.fragment,a),f(Po.$$.fragment,a),f(ht.$$.fragment,a),f(Eo.$$.fragment,a),f(jo.$$.fragment,a),f(Fo.$$.fragment,a),f(qo.$$.fragment,a),f(Co.$$.fragment,a),f(Io.$$.fragment,a),f(Lo.$$.fragment,a),f(zo.$$.fragment,a),f(Oo.$$.fragment,a),f(Uo.$$.fragment,a),f(Ho.$$.fragment,a),f(Xo.$$.fragment,a),f(Bo.$$.fragment,a),f(So.$$.fragment,a),f(Wo.$$.fragment,a),f(Go.$$.fragment,a),f(Ro.$$.fragment,a),f(Yo.$$.fragment,a),f(Ko.$$.fragment,a),f(Jo.$$.fragment,a),f(Zo.$$.fragment,a),f(tn.$$.fragment,a),f(on.$$.fragment,a),f(nn.$$.fragment,a),f(jt.$$.fragment,a),f(sn.$$.fragment,a),f(ln.$$.fragment,a),f(dn.$$.fragment,a),f(mn.$$.fragment,a),f(cn.$$.fragment,a),f(pn.$$.fragment,a),f(hn.$$.fragment,a),f(fn.$$.fragment,a),f(un.$$.fragment,a),f(gn.$$.fragment,a),f(vn.$$.fragment,a),f($n.$$.fragment,a),f(wn.$$.fragment,a),f(Tn.$$.fragment,a),f(xn.$$.fragment,a),f(Pn.$$.fragment,a),f(En.$$.fragment,a),f(Mn.$$.fragment,a),f(kn.$$.fragment,a),f(jn.$$.fragment,a),f(Fn.$$.fragment,a),f(qn.$$.fragment,a),f(An.$$.fragment,a),f(Cn.$$.fragment,a),f(Ln.$$.fragment,a),f(zn.$$.fragment,a),f(Nn.$$.fragment,a),f(Hn.$$.fragment,a),f(Yt.$$.fragment,a),f(Xn.$$.fragment,a),f(Vn.$$.fragment,a),f(Sn.$$.fragment,a),f(Wn.$$.fragment,a),f(Gn.$$.fragment,a),f(Rn.$$.fragment,a),f(Yn.$$.fragment,a),f(Kn.$$.fragment,a),f(Jn.$$.fragment,a),f(Qn.$$.fragment,a),f(er.$$.fragment,a),Nl=!0)},o(a){u(A.$$.fragment,a),u(so.$$.fragment,a),u(io.$$.fragment,a),u(co.$$.fragment,a),u(ho.$$.fragment,a),u(fo.$$.fragment,a),u(st.$$.fragment,a),u(it.$$.fragment,a),u(_o.$$.fragment,a),u(bo.$$.fragment,a),u(vo.$$.fragment,a),u(yo.$$.fragment,a),u($o.$$.fragment,a),u(wo.$$.fragment,a),u(To.$$.fragment,a),u(xo.$$.fragment,a),u(Po.$$.fragment,a),u(ht.$$.fragment,a),u(Eo.$$.fragment,a),u(jo.$$.fragment,a),u(Fo.$$.fragment,a),u(qo.$$.fragment,a),u(Co.$$.fragment,a),u(Io.$$.fragment,a),u(Lo.$$.fragment,a),u(zo.$$.fragment,a),u(Oo.$$.fragment,a),u(Uo.$$.fragment,a),u(Ho.$$.fragment,a),u(Xo.$$.fragment,a),u(Bo.$$.fragment,a),u(So.$$.fragment,a),u(Wo.$$.fragment,a),u(Go.$$.fragment,a),u(Ro.$$.fragment,a),u(Yo.$$.fragment,a),u(Ko.$$.fragment,a),u(Jo.$$.fragment,a),u(Zo.$$.fragment,a),u(tn.$$.fragment,a),u(on.$$.fragment,a),u(nn.$$.fragment,a),u(jt.$$.fragment,a),u(sn.$$.fragment,a),u(ln.$$.fragment,a),u(dn.$$.fragment,a),u(mn.$$.fragment,a),u(cn.$$.fragment,a),u(pn.$$.fragment,a),u(hn.$$.fragment,a),u(fn.$$.fragment,a),u(un.$$.fragment,a),u(gn.$$.fragment,a),u(vn.$$.fragment,a),u($n.$$.fragment,a),u(wn.$$.fragment,a),u(Tn.$$.fragment,a),u(xn.$$.fragment,a),u(Pn.$$.fragment,a),u(En.$$.fragment,a),u(Mn.$$.fragment,a),u(kn.$$.fragment,a),u(jn.$$.fragment,a),u(Fn.$$.fragment,a),u(qn.$$.fragment,a),u(An.$$.fragment,a),u(Cn.$$.fragment,a),u(Ln.$$.fragment,a),u(zn.$$.fragment,a),u(Nn.$$.fragment,a),u(Hn.$$.fragment,a),u(Yt.$$.fragment,a),u(Xn.$$.fragment,a),u(Vn.$$.fragment,a),u(Sn.$$.fragment,a),u(Wn.$$.fragment,a),u(Gn.$$.fragment,a),u(Rn.$$.fragment,a),u(Yn.$$.fragment,a),u(Kn.$$.fragment,a),u(Jn.$$.fragment,a),u(Qn.$$.fragment,a),u(er.$$.fragment,a),Nl=!1},d(a){t(w),a&&t(k),a&&t(x),g(A),a&&t(ul),a&&t(Z),a&&t(gl),a&&t(Le),a&&t(_l),a&&t(Ze),a&&t(bl),a&&t(z),a&&t(vl),a&&t(ze),g(so),a&&t(yl),a&&t(T),g(io),g(co),g(ho),g(fo),g(st),g(it),g(_o),g(bo),g(vo),g(yo),g($o),g(wo),g(To),g(xo),g(Po),g(ht),g(Eo),g(jo),g(Fo),g(qo),a&&t($l),a&&t(yr),a&&t(wl),a&&t(Ne),g(Co),a&&t(Tl),a&&t(te),a&&t(xl),g(Io,a),a&&t(Pl),a&&t(Te),a&&t(El),g(Lo,a),a&&t(Ml),a&&t(_t),a&&t(kl),g(zo,a),a&&t(jl),a&&t($r),a&&t(Dl),a&&t(He),g(Oo),a&&t(Fl),a&&t(j),g(Uo),g(Ho),g(Xo),g(Bo),g(So),g(Wo),g(Go),g(Ro),g(Yo),a&&t(ql),a&&t(Se),g(Ko),a&&t(Al),a&&t(b),g(Jo),g(Zo),g(tn),g(on),g(nn),g(jt),g(sn),g(ln),g(dn),g(mn),g(cn),g(pn),g(hn),g(fn),g(un),g(gn),g(vn),g($n),g(wn),g(Tn),g(xn),g(Pn),g(En),g(Mn),a&&t(Cl),a&&t(Ye),g(kn),a&&t(Il),a&&t(me),g(jn),g(Fn),a&&t(Ll),a&&t(Ke),g(qn),a&&t(zl),a&&t(M),g(An),g(Cn),g(Ln),g(zn),g(Nn),g(Hn),g(Yt),g(Xn),g(Vn),g(Sn),g(Wn),g(Gn),g(Rn),g(Yn),a&&t(Ol),a&&t(Qe),g(Kn),a&&t(Ul),a&&t(ce),g(Jn),g(Qn),g(er)}}}const cw={local:"models",sections:[{local:"transformers.PreTrainedModel",sections:[{local:"model-instantiation-dtype",title:"Model Instantiation dtype"}],title:"PreTrainedModel"},{local:"transformers.modeling_utils.ModuleUtilsMixin",title:"ModuleUtilsMixin"},{local:"transformers.TFPreTrainedModel",title:"TFPreTrainedModel"},{local:"transformers.modeling_tf_utils.TFModelUtilsMixin",title:"TFModelUtilsMixin"},{local:"transformers.FlaxPreTrainedModel",title:"FlaxPreTrainedModel"},{local:"transformers.file_utils.PushToHubMixin",title:"Pushing to the Hub"}],title:"Models"};function pw(S,w,k){let{fw:x}=w;return S.$$set=E=>{"fw"in E&&k(0,x=E.fw)},[x]}class vw extends tw{constructor(w){super();ow(this,w,pw,mw,nw,{fw:0})}}export{vw as default,cw as metadata};
