import{S as Si,i as Fi,s as Ai,e as r,k as l,w as h,t as a,M as Oi,c as s,d as o,m as d,a as n,x as g,h as i,b as f,G as t,g as m,y as _,q as v,o as b,B as y,v as Ii,L as Ni}from"../../chunks/vendor-hf-doc-builder.js";import{T as rr}from"../../chunks/Tip-hf-doc-builder.js";import{D as k}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Hi}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Jt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Mi}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Vi(S){let p,x,u,$,q,w,D,O,P,Q,F,C,B,A,z,G,L;return{c(){p=r("p"),x=a("One of "),u=r("code"),$=a("start_states"),q=a(" or "),w=r("code"),D=a("start_positions"),O=a(" should be not "),P=r("code"),Q=a("None"),F=a(". If both are set, "),C=r("code"),B=a("start_positions"),A=a(` overrides
`),z=r("code"),G=a("start_states"),L=a(".")},l(E){p=s(E,"P",{});var T=n(p);x=i(T,"One of "),u=s(T,"CODE",{});var I=n(u);$=i(I,"start_states"),I.forEach(o),q=i(T," or "),w=s(T,"CODE",{});var ce=n(w);D=i(ce,"start_positions"),ce.forEach(o),O=i(T," should be not "),P=s(T,"CODE",{});var U=n(P);Q=i(U,"None"),U.forEach(o),F=i(T,". If both are set, "),C=s(T,"CODE",{});var pe=n(C);B=i(pe,"start_positions"),pe.forEach(o),A=i(T,` overrides
`),z=s(T,"CODE",{});var ae=n(z);G=i(ae,"start_states"),ae.forEach(o),L=i(T,"."),T.forEach(o)},m(E,T){m(E,p,T),t(p,x),t(p,u),t(u,$),t(p,q),t(p,w),t(w,D),t(p,O),t(p,P),t(P,Q),t(p,F),t(p,C),t(C,B),t(p,A),t(p,z),t(z,G),t(p,L)},d(E){E&&o(p)}}}function ji(S){let p,x,u,$,q,w,D,O,P,Q,F,C,B,A,z,G,L;return{c(){p=r("p"),x=a("One of "),u=r("code"),$=a("start_states"),q=a(" or "),w=r("code"),D=a("start_positions"),O=a(" should be not "),P=r("code"),Q=a("None"),F=a(". If both are set, "),C=r("code"),B=a("start_positions"),A=a(` overrides
`),z=r("code"),G=a("start_states"),L=a(".")},l(E){p=s(E,"P",{});var T=n(p);x=i(T,"One of "),u=s(T,"CODE",{});var I=n(u);$=i(I,"start_states"),I.forEach(o),q=i(T," or "),w=s(T,"CODE",{});var ce=n(w);D=i(ce,"start_positions"),ce.forEach(o),O=i(T," should be not "),P=s(T,"CODE",{});var U=n(P);Q=i(U,"None"),U.forEach(o),F=i(T,". If both are set, "),C=s(T,"CODE",{});var pe=n(C);B=i(pe,"start_positions"),pe.forEach(o),A=i(T,` overrides
`),z=s(T,"CODE",{});var ae=n(z);G=i(ae,"start_states"),ae.forEach(o),L=i(T,"."),T.forEach(o)},m(E,T){m(E,p,T),t(p,x),t(p,u),t(u,$),t(p,q),t(p,w),t(w,D),t(p,O),t(p,P),t(P,Q),t(p,F),t(p,C),t(C,B),t(p,A),t(p,z),t(z,G),t(p,L)},d(E){E&&o(p)}}}function Qi(S){let p,x,u,$,q;return $=new Hi({props:{code:`# rename the usual forward() fn to forward_chunk()
def forward_chunk(self, hidden_states):
    hidden_states = self.decoder(hidden_states)
    return hidden_states


# implement a chunked forward function
def forward(self, hidden_states):
    return apply_chunking_to_forward(self.forward_chunk, self.chunk_size_lm_head, self.seq_len_dim, hidden_states)`,highlighted:`<span class="hljs-comment"># rename the usual forward() fn to forward_chunk()</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">forward_chunk</span>(<span class="hljs-params">self, hidden_states</span>):
    hidden_states = self.decoder(hidden_states)
    <span class="hljs-keyword">return</span> hidden_states


<span class="hljs-comment"># implement a chunked forward function</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, hidden_states</span>):
    <span class="hljs-keyword">return</span> apply_chunking_to_forward(self.forward_chunk, self.chunk_size_lm_head, self.seq_len_dim, hidden_states)`}}),{c(){p=r("p"),x=a("Examples:"),u=l(),h($.$$.fragment)},l(w){p=s(w,"P",{});var D=n(p);x=i(D,"Examples:"),D.forEach(o),u=d(w),g($.$$.fragment,w)},m(w,D){m(w,p,D),t(p,x),m(w,u,D),_($,w,D),q=!0},p:Ni,i(w){q||(v($.$$.fragment,w),q=!0)},o(w){b($.$$.fragment,w),q=!1},d(w){w&&o(p),w&&o(u),y($,w)}}}function Bi(S){let p,x;return{c(){p=r("p"),x=a("Any label of -100 will be ignored (along with the corresponding logits) in the loss computation.")},l(u){p=s(u,"P",{});var $=n(p);x=i($,"Any label of -100 will be ignored (along with the corresponding logits) in the loss computation."),$.forEach(o)},m(u,$){m(u,p,$),t(p,x)},d(u){u&&o(p)}}}function Gi(S){let p,x;return{c(){p=r("p"),x=a("Any label of -100 will be ignored (along with the corresponding logits) in the loss computation.")},l(u){p=s(u,"P",{});var $=n(p);x=i($,"Any label of -100 will be ignored (along with the corresponding logits) in the loss computation."),$.forEach(o)},m(u,$){m(u,p,$),t(p,x)},d(u){u&&o(p)}}}function Ui(S){let p,x;return{c(){p=r("p"),x=a("Any label of -100 will be ignored (along with the corresponding logits) in the loss computation.")},l(u){p=s(u,"P",{});var $=n(p);x=i($,"Any label of -100 will be ignored (along with the corresponding logits) in the loss computation."),$.forEach(o)},m(u,$){m(u,p,$),t(p,x)},d(u){u&&o(p)}}}function Ki(S){let p,x,u,$,q,w,D,O,P,Q,F,C,B,A,z,G,L,E,T,I,ce,U,pe,ae,K,Be,Yr,Yt,Zr,es,Zt,ts,sr,R,Ge,os,eo,rs,ss,Pt,Ue,nr,W,Ke,ns,to,as,is,De,Re,ls,Le,ar,X,We,ds,oo,cs,ps,Pe,Xe,ms,Ce,ir,me,Je,fs,Ye,us,Ct,hs,gs,lr,J,Ze,_s,ro,vs,bs,zt,et,dr,Y,tt,ys,so,$s,ws,ze,ot,Ts,no,ks,cr,fe,Se,ao,rt,xs,io,Es,pr,N,st,qs,H,Ds,lo,Ls,Ps,co,Cs,zs,po,Ss,Fs,mo,As,Os,Is,M,Ns,fo,Hs,Ms,uo,Vs,js,ho,Qs,Bs,go,Gs,Us,Ks,Fe,mr,ue,nt,Rs,at,Ws,_o,Xs,Js,fr,Z,it,Ys,vo,Zs,en,bo,tn,ur,ee,lt,on,yo,rn,sn,$o,nn,hr,te,dt,an,wo,ln,dn,To,cn,gr,he,Ae,ko,ct,pn,xo,mn,_r,oe,pt,fn,Eo,un,hn,qo,gn,vr,V,mt,_n,Do,vn,bn,Lo,yn,$n,ie,ft,wn,Po,Tn,kn,ut,xn,ht,En,qn,br,ge,gt,Dn,Co,Ln,yr,_e,Oe,zo,_t,Pn,So,Cn,$r,re,vt,zn,Fo,Sn,Fn,Ie,wr,se,bt,An,Ao,On,In,Ne,Tr,ve,yt,Nn,Oo,Hn,kr,be,$t,Mn,Io,Vn,xr,ye,wt,jn,No,Qn,Er,ne,Tt,Bn,Ho,Gn,Un,He,qr,$e,Me,Mo,kt,Kn,Vo,Rn,Dr,we,xt,Wn,Et,Xn,jo,Jn,Yn,Lr,j,qt,Zn,Qo,ea,ta,Bo,oa,ra,Te,ke,sa,Go,na,aa,Uo,ia,la,da,xe,ca,Ko,pa,ma,Ro,fa,ua,ha,Ee,ga,Wo,_a,va,Xo,ba,ya,Pr,qe,Dt,$a,Jo,wa,Cr;return w=new Jt({}),I=new Jt({}),Be=new k({props:{name:"class transformers.Conv1D",anchor:"transformers.Conv1D",parameters:[{name:"nf",val:""},{name:"nx",val:""}],parametersDescription:[{anchor:"transformers.Conv1D.nf",description:"<strong>nf</strong> (<code>int</code>) &#x2014; The number of output features.",name:"nf"},{anchor:"transformers.Conv1D.nx",description:"<strong>nx</strong> (<code>int</code>) &#x2014; The number of input features.",name:"nx"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/pytorch_utils.py#L91"}}),Ge=new k({props:{name:"class transformers.modeling_utils.PoolerStartLogits",anchor:"transformers.modeling_utils.PoolerStartLogits",parameters:[{name:"config",val:": PretrainedConfig"}],parametersDescription:[{anchor:"transformers.modeling_utils.PoolerStartLogits.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_19907/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The config used by the model, will be used to grab the <code>hidden_size</code> of the model.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_utils.py#L2715"}}),Ue=new k({props:{name:"forward",anchor:"transformers.modeling_utils.PoolerStartLogits.forward",parameters:[{name:"hidden_states",val:": FloatTensor"},{name:"p_mask",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"transformers.modeling_utils.PoolerStartLogits.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_len, hidden_size)</code>) &#x2014;
The final hidden states of the model.`,name:"hidden_states"},{anchor:"transformers.modeling_utils.PoolerStartLogits.forward.p_mask",description:`<strong>p_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_len)</code>, <em>optional</em>) &#x2014;
Mask for tokens at invalid position, such as query and special symbols (PAD, SEP, CLS). 1.0 means token
should be masked.`,name:"p_mask"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_utils.py#L2728",returnDescription:`
<p>The start logits for SQuAD.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),Ke=new k({props:{name:"class transformers.modeling_utils.PoolerEndLogits",anchor:"transformers.modeling_utils.PoolerEndLogits",parameters:[{name:"config",val:": PretrainedConfig"}],parametersDescription:[{anchor:"transformers.modeling_utils.PoolerEndLogits.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_19907/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The config used by the model, will be used to grab the <code>hidden_size</code> of the model and the <code>layer_norm_eps</code>
to use.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_utils.py#L2753"}}),Re=new k({props:{name:"forward",anchor:"transformers.modeling_utils.PoolerEndLogits.forward",parameters:[{name:"hidden_states",val:": FloatTensor"},{name:"start_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"p_mask",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"transformers.modeling_utils.PoolerEndLogits.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_len, hidden_size)</code>) &#x2014;
The final hidden states of the model.`,name:"hidden_states"},{anchor:"transformers.modeling_utils.PoolerEndLogits.forward.start_states",description:`<strong>start_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_len, hidden_size)</code>, <em>optional</em>) &#x2014;
The hidden states of the first tokens for the labeled span.`,name:"start_states"},{anchor:"transformers.modeling_utils.PoolerEndLogits.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
The position of the first token for the labeled span.`,name:"start_positions"},{anchor:"transformers.modeling_utils.PoolerEndLogits.forward.p_mask",description:`<strong>p_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_len)</code>, <em>optional</em>) &#x2014;
Mask for tokens at invalid position, such as query and special symbols (PAD, SEP, CLS). 1.0 means token
should be masked.`,name:"p_mask"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_utils.py#L2770",returnDescription:`
<p>The end logits for SQuAD.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),Le=new rr({props:{$$slots:{default:[Vi]},$$scope:{ctx:S}}}),We=new k({props:{name:"class transformers.modeling_utils.PoolerAnswerClass",anchor:"transformers.modeling_utils.PoolerAnswerClass",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.modeling_utils.PoolerAnswerClass.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_19907/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The config used by the model, will be used to grab the <code>hidden_size</code> of the model.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_utils.py#L2822"}}),Xe=new k({props:{name:"forward",anchor:"transformers.modeling_utils.PoolerAnswerClass.forward",parameters:[{name:"hidden_states",val:": FloatTensor"},{name:"start_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"cls_index",val:": typing.Optional[torch.LongTensor] = None"}],parametersDescription:[{anchor:"transformers.modeling_utils.PoolerAnswerClass.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_len, hidden_size)</code>) &#x2014;
The final hidden states of the model.`,name:"hidden_states"},{anchor:"transformers.modeling_utils.PoolerAnswerClass.forward.start_states",description:`<strong>start_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_len, hidden_size)</code>, <em>optional</em>) &#x2014;
The hidden states of the first tokens for the labeled span.`,name:"start_states"},{anchor:"transformers.modeling_utils.PoolerAnswerClass.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
The position of the first token for the labeled span.`,name:"start_positions"},{anchor:"transformers.modeling_utils.PoolerAnswerClass.forward.cls_index",description:`<strong>cls_index</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Position of the CLS token for each sentence in the batch. If <code>None</code>, takes the last token.`,name:"cls_index"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_utils.py#L2837",returnDescription:`
<p>The SQuAD 2.0 answer class.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),Ce=new rr({props:{$$slots:{default:[ji]},$$scope:{ctx:S}}}),Je=new k({props:{name:"class transformers.modeling_utils.SquadHeadOutput",anchor:"transformers.modeling_utils.SquadHeadOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_top_log_probs",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_top_index",val:": typing.Optional[torch.LongTensor] = None"},{name:"end_top_log_probs",val:": typing.Optional[torch.FloatTensor] = None"},{name:"end_top_index",val:": typing.Optional[torch.LongTensor] = None"},{name:"cls_logits",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"transformers.modeling_utils.SquadHeadOutput.loss",description:`<strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned if both <code>start_positions</code> and <code>end_positions</code> are provided) &#x2014;
Classification loss as the sum of start token, end token (and is_impossible if provided) classification
losses.`,name:"loss"},{anchor:"transformers.modeling_utils.SquadHeadOutput.start_top_log_probs",description:`<strong>start_top_log_probs</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.start_n_top)</code>, <em>optional</em>, returned if <code>start_positions</code> or <code>end_positions</code> is not provided) &#x2014;
Log probabilities for the top config.start_n_top start token possibilities (beam-search).`,name:"start_top_log_probs"},{anchor:"transformers.modeling_utils.SquadHeadOutput.start_top_index",description:`<strong>start_top_index</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, config.start_n_top)</code>, <em>optional</em>, returned if <code>start_positions</code> or <code>end_positions</code> is not provided) &#x2014;
Indices for the top config.start_n_top start token possibilities (beam-search).`,name:"start_top_index"},{anchor:"transformers.modeling_utils.SquadHeadOutput.end_top_log_probs",description:`<strong>end_top_log_probs</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.start_n_top * config.end_n_top)</code>, <em>optional</em>, returned if <code>start_positions</code> or <code>end_positions</code> is not provided) &#x2014;
Log probabilities for the top <code>config.start_n_top * config.end_n_top</code> end token possibilities
(beam-search).`,name:"end_top_log_probs"},{anchor:"transformers.modeling_utils.SquadHeadOutput.end_top_index",description:`<strong>end_top_index</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, config.start_n_top * config.end_n_top)</code>, <em>optional</em>, returned if <code>start_positions</code> or <code>end_positions</code> is not provided) &#x2014;
Indices for the top <code>config.start_n_top * config.end_n_top</code> end token possibilities (beam-search).`,name:"end_top_index"},{anchor:"transformers.modeling_utils.SquadHeadOutput.cls_logits",description:`<strong>cls_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>, returned if <code>start_positions</code> or <code>end_positions</code> is not provided) &#x2014;
Log probabilities for the <code>is_impossible</code> label of the answers.`,name:"cls_logits"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_utils.py#L2888"}}),Ze=new k({props:{name:"class transformers.modeling_utils.SQuADHead",anchor:"transformers.modeling_utils.SQuADHead",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.modeling_utils.SQuADHead.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_19907/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The config used by the model, will be used to grab the <code>hidden_size</code> of the model and the <code>layer_norm_eps</code>
to use.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_utils.py#L2918"}}),et=new k({props:{name:"forward",anchor:"transformers.modeling_utils.SQuADHead.forward",parameters:[{name:"hidden_states",val:": FloatTensor"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"end_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"cls_index",val:": typing.Optional[torch.LongTensor] = None"},{name:"is_impossible",val:": typing.Optional[torch.LongTensor] = None"},{name:"p_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"return_dict",val:": bool = False"}],parametersDescription:[{anchor:"transformers.modeling_utils.SQuADHead.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_len, hidden_size)</code>) &#x2014;
Final hidden states of the model on the sequence tokens.`,name:"hidden_states"},{anchor:"transformers.modeling_utils.SQuADHead.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Positions of the first token for the labeled span.`,name:"start_positions"},{anchor:"transformers.modeling_utils.SQuADHead.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Positions of the last token for the labeled span.`,name:"end_positions"},{anchor:"transformers.modeling_utils.SQuADHead.forward.cls_index",description:`<strong>cls_index</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Position of the CLS token for each sentence in the batch. If <code>None</code>, takes the last token.`,name:"cls_index"},{anchor:"transformers.modeling_utils.SQuADHead.forward.is_impossible",description:`<strong>is_impossible</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Whether the question has a possible answer in the paragraph or not.`,name:"is_impossible"},{anchor:"transformers.modeling_utils.SQuADHead.forward.p_mask",description:`<strong>p_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_len)</code>, <em>optional</em>) &#x2014;
Mask for tokens at invalid position, such as query and special symbols (PAD, SEP, CLS). 1.0 means token
should be masked.`,name:"p_mask"},{anchor:"transformers.modeling_utils.SQuADHead.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_19907/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_utils.py#L2937",returnDescription:`
<p>A <a
  href="/docs/transformers/pr_19907/en/internal/modeling_utils#transformers.modeling_utils.SquadHeadOutput"
>transformers.modeling_utils.SquadHeadOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.configuration_utils.PretrainedConfig'&gt;</code>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned if both <code>start_positions</code> and <code>end_positions</code> are provided) \u2014 Classification loss as the sum of start token, end token (and is_impossible if provided) classification
losses.</li>
<li><strong>start_top_log_probs</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.start_n_top)</code>, <em>optional</em>, returned if <code>start_positions</code> or <code>end_positions</code> is not provided) \u2014 Log probabilities for the top config.start_n_top start token possibilities (beam-search).</li>
<li><strong>start_top_index</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, config.start_n_top)</code>, <em>optional</em>, returned if <code>start_positions</code> or <code>end_positions</code> is not provided) \u2014 Indices for the top config.start_n_top start token possibilities (beam-search).</li>
<li><strong>end_top_log_probs</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.start_n_top * config.end_n_top)</code>, <em>optional</em>, returned if <code>start_positions</code> or <code>end_positions</code> is not provided) \u2014 Log probabilities for the top <code>config.start_n_top * config.end_n_top</code> end token possibilities
(beam-search).</li>
<li><strong>end_top_index</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, config.start_n_top * config.end_n_top)</code>, <em>optional</em>, returned if <code>start_positions</code> or <code>end_positions</code> is not provided) \u2014 Indices for the top <code>config.start_n_top * config.end_n_top</code> end token possibilities (beam-search).</li>
<li><strong>cls_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>, returned if <code>start_positions</code> or <code>end_positions</code> is not provided) \u2014 Log probabilities for the <code>is_impossible</code> label of the answers.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/pr_19907/en/internal/modeling_utils#transformers.modeling_utils.SquadHeadOutput"
>transformers.modeling_utils.SquadHeadOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),tt=new k({props:{name:"class transformers.modeling_utils.SequenceSummary",anchor:"transformers.modeling_utils.SequenceSummary",parameters:[{name:"config",val:": PretrainedConfig"}],parametersDescription:[{anchor:"transformers.modeling_utils.SequenceSummary.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_19907/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The config used by the model. Relevant arguments in the config class of the model are (refer to the actual
config class of your model for the default values it uses):</p>
<ul>
<li>
<p><strong>summary_type</strong> (<code>str</code>) &#x2014; The method to use to make this summary. Accepted values are:</p>
<ul>
<li><code>&quot;last&quot;</code> &#x2014; Take the last token hidden state (like XLNet)</li>
<li><code>&quot;first&quot;</code> &#x2014; Take the first token hidden state (like Bert)</li>
<li><code>&quot;mean&quot;</code> &#x2014; Take the mean of all tokens hidden states</li>
<li><code>&quot;cls_index&quot;</code> &#x2014; Supply a Tensor of classification token position (GPT/GPT-2)</li>
<li><code>&quot;attn&quot;</code> &#x2014; Not implemented now, use multi-head attention</li>
</ul>
</li>
<li>
<p><strong>summary_use_proj</strong> (<code>bool</code>) &#x2014; Add a projection after the vector extraction.</p>
</li>
<li>
<p><strong>summary_proj_to_labels</strong> (<code>bool</code>) &#x2014; If <code>True</code>, the projection outputs to <code>config.num_labels</code> classes
(otherwise to <code>config.hidden_size</code>).</p>
</li>
<li>
<p><strong>summary_activation</strong> (<code>Optional[str]</code>) &#x2014; Set to <code>&quot;tanh&quot;</code> to add a tanh activation to the output,
another string or <code>None</code> will add no activation.</p>
</li>
<li>
<p><strong>summary_first_dropout</strong> (<code>float</code>) &#x2014; Optional dropout probability before the projection and activation.</p>
</li>
<li>
<p><strong>summary_last_dropout</strong> (<code>float</code>)&#x2014; Optional dropout probability after the projection and activation.</p>
</li>
</ul>`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_utils.py#L3035"}}),ot=new k({props:{name:"forward",anchor:"transformers.modeling_utils.SequenceSummary.forward",parameters:[{name:"hidden_states",val:": FloatTensor"},{name:"cls_index",val:": typing.Optional[torch.LongTensor] = None"}],parametersDescription:[{anchor:"transformers.modeling_utils.SequenceSummary.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>[batch_size, seq_len, hidden_size]</code>) &#x2014;
The hidden states of the last layer.`,name:"hidden_states"},{anchor:"transformers.modeling_utils.SequenceSummary.forward.cls_index",description:`<strong>cls_index</strong> (<code>torch.LongTensor</code> of shape <code>[batch_size]</code> or <code>[batch_size, ...]</code> where &#x2026; are optional leading dimensions of <code>hidden_states</code>, <em>optional</em>) &#x2014;
Used if <code>summary_type == &quot;cls_index&quot;</code> and takes the last token of the sequence as classification token.`,name:"cls_index"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_utils.py#L3090",returnDescription:`
<p>The summary of the sequence hidden states.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),rt=new Jt({}),st=new k({props:{name:"transformers.apply_chunking_to_forward",anchor:"transformers.apply_chunking_to_forward",parameters:[{name:"forward_fn",val:": typing.Callable[..., torch.Tensor]"},{name:"chunk_size",val:": int"},{name:"chunk_dim",val:": int"},{name:"*input_tensors",val:""}],parametersDescription:[{anchor:"transformers.apply_chunking_to_forward.forward_fn",description:`<strong>forward_fn</strong> (<code>Callable[..., torch.Tensor]</code>) &#x2014;
The forward function of the model.`,name:"forward_fn"},{anchor:"transformers.apply_chunking_to_forward.chunk_size",description:`<strong>chunk_size</strong> (<code>int</code>) &#x2014;
The chunk size of a chunked tensor: <code>num_chunks = len(input_tensors[0]) / chunk_size</code>.`,name:"chunk_size"},{anchor:"transformers.apply_chunking_to_forward.chunk_dim",description:`<strong>chunk_dim</strong> (<code>int</code>) &#x2014;
The dimension over which the <code>input_tensors</code> should be chunked.`,name:"chunk_dim"},{anchor:"transformers.apply_chunking_to_forward.input_tensors",description:`<strong>input_tensors</strong> (<code>Tuple[torch.Tensor]</code>) &#x2014;
The input tensors of <code>forward_fn</code> which will be chunked`,name:"input_tensors"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/pytorch_utils.py#L174",returnDescription:`
<p>A tensor with the same shape as the <code>forward_fn</code> would have given if applied\`.</p>
`,returnType:`
<p><code>torch.Tensor</code></p>
`}}),Fe=new Mi({props:{anchor:"transformers.apply_chunking_to_forward.example",$$slots:{default:[Qi]},$$scope:{ctx:S}}}),nt=new k({props:{name:"transformers.pytorch_utils.find_pruneable_heads_and_indices",anchor:"transformers.pytorch_utils.find_pruneable_heads_and_indices",parameters:[{name:"heads",val:": typing.List[int]"},{name:"n_heads",val:": int"},{name:"head_size",val:": int"},{name:"already_pruned_heads",val:": typing.Set[int]"}],parametersDescription:[{anchor:"transformers.pytorch_utils.find_pruneable_heads_and_indices.heads",description:"<strong>heads</strong> (<code>List[int]</code>) &#x2014; List of the indices of heads to prune.",name:"heads"},{anchor:"transformers.pytorch_utils.find_pruneable_heads_and_indices.n_heads",description:"<strong>n_heads</strong> (<code>int</code>) &#x2014; The number of heads in the model.",name:"n_heads"},{anchor:"transformers.pytorch_utils.find_pruneable_heads_and_indices.head_size",description:"<strong>head_size</strong> (<code>int</code>) &#x2014; The size of each head.",name:"head_size"},{anchor:"transformers.pytorch_utils.find_pruneable_heads_and_indices.already_pruned_heads",description:"<strong>already_pruned_heads</strong> (<code>Set[int]</code>) &#x2014; A set of already pruned heads.",name:"already_pruned_heads"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/pytorch_utils.py#L249",returnDescription:`
<p>A tuple with the remaining heads and their corresponding indices.</p>
`,returnType:`
<p><code>Tuple[Set[int], torch.LongTensor]</code></p>
`}}),it=new k({props:{name:"transformers.prune_layer",anchor:"transformers.prune_layer",parameters:[{name:"layer",val:": typing.Union[torch.nn.modules.linear.Linear, transformers.pytorch_utils.Conv1D]"},{name:"index",val:": LongTensor"},{name:"dim",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.prune_layer.layer",description:"<strong>layer</strong> (<code>Union[torch.nn.Linear, Conv1D]</code>) &#x2014; The layer to prune.",name:"layer"},{anchor:"transformers.prune_layer.index",description:"<strong>index</strong> (<code>torch.LongTensor</code>) &#x2014; The indices to keep in the layer.",name:"index"},{anchor:"transformers.prune_layer.dim",description:"<strong>dim</strong> (<code>int</code>, <em>optional</em>) &#x2014; The dimension on which to keep the indices.",name:"dim"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/pytorch_utils.py#L150",returnDescription:`
<p>The pruned layer as a new layer with <code>requires_grad=True</code>.</p>
`,returnType:`
<p><code>torch.nn.Linear</code> or <a
  href="/docs/transformers/pr_19907/en/internal/modeling_utils#transformers.Conv1D"
>Conv1D</a></p>
`}}),lt=new k({props:{name:"transformers.pytorch_utils.prune_conv1d_layer",anchor:"transformers.pytorch_utils.prune_conv1d_layer",parameters:[{name:"layer",val:": Conv1D"},{name:"index",val:": LongTensor"},{name:"dim",val:": int = 1"}],parametersDescription:[{anchor:"transformers.pytorch_utils.prune_conv1d_layer.layer",description:'<strong>layer</strong> (<a href="/docs/transformers/pr_19907/en/internal/modeling_utils#transformers.Conv1D">Conv1D</a>) &#x2014; The layer to prune.',name:"layer"},{anchor:"transformers.pytorch_utils.prune_conv1d_layer.index",description:"<strong>index</strong> (<code>torch.LongTensor</code>) &#x2014; The indices to keep in the layer.",name:"index"},{anchor:"transformers.pytorch_utils.prune_conv1d_layer.dim",description:"<strong>dim</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014; The dimension on which to keep the indices.",name:"dim"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/pytorch_utils.py#L117",returnDescription:`
<p>The pruned layer as a new layer with <code>requires_grad=True</code>.</p>
`,returnType:`
<p><a
  href="/docs/transformers/pr_19907/en/internal/modeling_utils#transformers.Conv1D"
>Conv1D</a></p>
`}}),dt=new k({props:{name:"transformers.pytorch_utils.prune_linear_layer",anchor:"transformers.pytorch_utils.prune_linear_layer",parameters:[{name:"layer",val:": Linear"},{name:"index",val:": LongTensor"},{name:"dim",val:": int = 0"}],parametersDescription:[{anchor:"transformers.pytorch_utils.prune_linear_layer.layer",description:"<strong>layer</strong> (<code>torch.nn.Linear</code>) &#x2014; The layer to prune.",name:"layer"},{anchor:"transformers.pytorch_utils.prune_linear_layer.index",description:"<strong>index</strong> (<code>torch.LongTensor</code>) &#x2014; The indices to keep in the layer.",name:"index"},{anchor:"transformers.pytorch_utils.prune_linear_layer.dim",description:"<strong>dim</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014; The dimension on which to keep the indices.",name:"dim"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/pytorch_utils.py#L57",returnDescription:`
<p>The pruned layer as a new layer with <code>requires_grad=True</code>.</p>
`,returnType:`
<p><code>torch.nn.Linear</code></p>
`}}),ct=new Jt({}),pt=new k({props:{name:"class transformers.modeling_tf_utils.TFConv1D",anchor:"transformers.modeling_tf_utils.TFConv1D",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.modeling_tf_utils.TFConv1D.nf",description:`<strong>nf</strong> (<code>int</code>) &#x2014;
The number of output features.`,name:"nf"},{anchor:"transformers.modeling_tf_utils.TFConv1D.nx",description:`<strong>nx</strong> (<code>int</code>) &#x2014;
The number of input features.`,name:"nx"},{anchor:"transformers.modeling_tf_utils.TFConv1D.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation to use to initialize the weights.
kwargs &#x2014;
Additional keyword arguments passed along to the <code>__init__</code> of <code>tf.keras.layers.Layer</code>.`,name:"initializer_range"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_tf_utils.py#L2786"}}),mt=new k({props:{name:"class transformers.TFSharedEmbeddings",anchor:"transformers.TFSharedEmbeddings",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFSharedEmbeddings.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>) &#x2014;
The size of the vocabulary, e.g., the number of unique tokens.`,name:"vocab_size"},{anchor:"transformers.TFSharedEmbeddings.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>) &#x2014;
The size of the embedding vectors.`,name:"hidden_size"},{anchor:"transformers.TFSharedEmbeddings.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The standard deviation to use when initializing the weights. If no value is provided, it will default to
{@html &quot;<span class="\\&quot;katex\\&quot;"><span class="\\&quot;katex-mathml\\&quot;"><math xmlns="\\&quot;http://www.w3.org/1998/Math/MathML\\&quot;"><semantics><mrow><mn>1</mn><mi mathvariant="\\&quot;normal\\&quot;">/</mi><msqrt><mrow><mi>h</mi><mi>i</mi><mi>d</mi><mi>d</mi><mi>e</mi><mi>n</mi><mi mathvariant="\\&quot;normal\\&quot;">_</mi><mi>s</mi><mi>i</mi><mi>z</mi><mi>e</mi></mrow></msqrt></mrow><annotation encoding="\\&quot;application/x-tex\\&quot;">1/\\\\sqrt{hidden\\\\_size}</annotation></semantics></math></span><span class="\\&quot;katex-html\\&quot;" aria-hidden="\\&quot;true\\&quot;"><span class="\\&quot;base\\&quot;"><span class="\\&quot;strut\\&quot;" style="\\&quot;height:1.24em;vertical-align:-0.3628em;\\&quot;"></span><span class="\\&quot;mord\\&quot;">1/</span><span class="\\&quot;mord" sqrt\\"><span class="\\&quot;vlist-t" vlist-t2\\"><span class="\\&quot;vlist-r\\&quot;"><span class="\\&quot;vlist\\&quot;" style="\\&quot;height:0.8772em;\\&quot;"><span class="\\&quot;svg-align\\&quot;" style="\\&quot;top:-3.2em;\\&quot;"><span class="\\&quot;pstrut\\&quot;" style="\\&quot;height:3.2em;\\&quot;"></span><span class="\\&quot;mord\\&quot;" style="\\&quot;padding-left:1em;\\&quot;"><span class="\\&quot;mord" mathnormal\\">hi</span><span class="\\&quot;mord" mathnormal\\">dd</span><span class="\\&quot;mord" mathnormal\\">e</span><span class="\\&quot;mord" mathnormal\\">n</span><span class="\\&quot;mord\\&quot;" style="\\&quot;margin-right:0.02778em;\\&quot;">_</span><span class="\\&quot;mord" mathnormal\\">s</span><span class="\\&quot;mord" mathnormal\\">i</span><span class="\\&quot;mord" mathnormal\\">ze</span></span></span><span style="\\&quot;top:-2.8372em;\\&quot;"><span class="\\&quot;pstrut\\&quot;" style="\\&quot;height:3.2em;\\&quot;"></span><span class="\\&quot;hide-tail\\&quot;" style="\\&quot;min-width:1.02em;height:1.28em;\\&quot;"><svg xmlns="\\&quot;http://www.w3.org/2000/svg\\&quot;" width="400em" height="1.28em" viewBox="0 0 400000 1296" preserveAspectRatio="xMinYMin slice"><path d="M263,681c0.7,0,18,39.7,52,119\\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\\nc340,-704.7,510.7,-1060.3,512,-1067\\nl0 -0\\nc4.7,-7.3,11,-11,19,-11\\nH40000v40H1012.3\\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\\nM1001 80h400000v40h-400000z"/></svg></span></span></span><span class="\\&quot;vlist-s\\&quot;">&#x200B;</span></span><span class="\\&quot;vlist-r\\&quot;"><span class="\\&quot;vlist\\&quot;" style="\\&quot;height:0.3628em;\\&quot;"><span></span></span></span></span></span></span></span></span>&quot;}.
kwargs &#x2014;
Additional keyword arguments passed along to the <code>__init__</code> of <code>tf.keras.layers.Layer</code>.`,name:"initializer_range"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_tf_utils.py#L2826"}}),ft=new k({props:{name:"call",anchor:"transformers.TFSharedEmbeddings.call",parameters:[{name:"inputs",val:": Tensor"},{name:"mode",val:": str = 'embedding'"}],parametersDescription:[{anchor:"transformers.TFSharedEmbeddings.call.inputs",description:`<strong>inputs</strong> (<code>tf.Tensor</code>) &#x2014;
In embedding mode, should be an int64 tensor with shape <code>[batch_size, length]</code>.</p>
<p>In linear mode, should be a float tensor with shape <code>[batch_size, length, hidden_size]</code>.`,name:"inputs"},{anchor:"transformers.TFSharedEmbeddings.call.mode",description:`<strong>mode</strong> (<code>str</code>, defaults to <code>&quot;embedding&quot;</code>) &#x2014;
A valid value is either <code>&quot;embedding&quot;</code> or <code>&quot;linear&quot;</code>, the first one indicates that the layer should be
used as an embedding layer, the second one that the layer should be used as a linear decoder.`,name:"mode"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_tf_utils.py#L2872",returnDescription:`
<p>In embedding mode, the output is a float32 embedding tensor, with shape <code>[batch_size, length, embedding_size]</code>.</p>
<p>In linear mode, the output is a float32 with shape <code>[batch_size, length, vocab_size]</code>.</p>
`,returnType:`
<p><code>tf.Tensor</code></p>
`,raiseDescription:`
<ul>
<li><code>ValueError</code> \u2014 if <code>mode</code> is not valid.</li>
</ul>
`,raiseType:`
<p><code>ValueError</code></p>
`}}),gt=new k({props:{name:"class transformers.TFSequenceSummary",anchor:"transformers.TFSequenceSummary",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFSequenceSummary.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_19907/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The config used by the model. Relevant arguments in the config class of the model are (refer to the actual
config class of your model for the default values it uses):</p>
<ul>
<li>
<p><strong>summary_type</strong> (<code>str</code>) &#x2014; The method to use to make this summary. Accepted values are:</p>
<ul>
<li><code>&quot;last&quot;</code> &#x2014; Take the last token hidden state (like XLNet)</li>
<li><code>&quot;first&quot;</code> &#x2014; Take the first token hidden state (like Bert)</li>
<li><code>&quot;mean&quot;</code> &#x2014; Take the mean of all tokens hidden states</li>
<li><code>&quot;cls_index&quot;</code> &#x2014; Supply a Tensor of classification token position (GPT/GPT-2)</li>
<li><code>&quot;attn&quot;</code> &#x2014; Not implemented now, use multi-head attention</li>
</ul>
</li>
<li>
<p><strong>summary_use_proj</strong> (<code>bool</code>) &#x2014; Add a projection after the vector extraction.</p>
</li>
<li>
<p><strong>summary_proj_to_labels</strong> (<code>bool</code>) &#x2014; If <code>True</code>, the projection outputs to <code>config.num_labels</code> classes
(otherwise to <code>config.hidden_size</code>).</p>
</li>
<li>
<p><strong>summary_activation</strong> (<code>Optional[str]</code>) &#x2014; Set to <code>&quot;tanh&quot;</code> to add a tanh activation to the output,
another string or <code>None</code> will add no activation.</p>
</li>
<li>
<p><strong>summary_first_dropout</strong> (<code>float</code>) &#x2014; Optional dropout probability before the projection and activation.</p>
</li>
<li>
<p><strong>summary_last_dropout</strong> (<code>float</code>)&#x2014; Optional dropout probability after the projection and activation.</p>
</li>
</ul>`,name:"config"},{anchor:"transformers.TFSequenceSummary.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, defaults to 0.02) &#x2014; The standard deviation to use to initialize the weights.
kwargs &#x2014;
Additional keyword arguments passed along to the <code>__init__</code> of <code>tf.keras.layers.Layer</code>.`,name:"initializer_range"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_tf_utils.py#L2925"}}),_t=new Jt({}),vt=new k({props:{name:"class transformers.modeling_tf_utils.TFCausalLanguageModelingLoss",anchor:"transformers.modeling_tf_utils.TFCausalLanguageModelingLoss",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_tf_utils.py#L179"}}),Ie=new rr({props:{$$slots:{default:[Bi]},$$scope:{ctx:S}}}),bt=new k({props:{name:"class transformers.modeling_tf_utils.TFMaskedLanguageModelingLoss",anchor:"transformers.modeling_tf_utils.TFMaskedLanguageModelingLoss",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_tf_utils.py#L298"}}),Ne=new rr({props:{$$slots:{default:[Gi]},$$scope:{ctx:S}}}),yt=new k({props:{name:"class transformers.modeling_tf_utils.TFMultipleChoiceLoss",anchor:"transformers.modeling_tf_utils.TFMultipleChoiceLoss",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_tf_utils.py#L288"}}),$t=new k({props:{name:"class transformers.modeling_tf_utils.TFQuestionAnsweringLoss",anchor:"transformers.modeling_tf_utils.TFQuestionAnsweringLoss",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_tf_utils.py#L210"}}),wt=new k({props:{name:"class transformers.modeling_tf_utils.TFSequenceClassificationLoss",anchor:"transformers.modeling_tf_utils.TFSequenceClassificationLoss",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_tf_utils.py#L269"}}),Tt=new k({props:{name:"class transformers.modeling_tf_utils.TFTokenClassificationLoss",anchor:"transformers.modeling_tf_utils.TFTokenClassificationLoss",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_tf_utils.py#L225"}}),He=new rr({props:{$$slots:{default:[Ui]},$$scope:{ctx:S}}}),kt=new Jt({}),xt=new k({props:{name:"transformers.modeling_tf_utils.get_initializer",anchor:"transformers.modeling_tf_utils.get_initializer",parameters:[{name:"initializer_range",val:": float = 0.02"}],parametersDescription:[{anchor:"transformers.modeling_tf_utils.get_initializer.initializer_range",description:"<strong>initializer_range</strong> (<em>float</em>, defaults to 0.02) &#x2014; Standard deviation of the initializer range.",name:"initializer_range"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_tf_utils.py#L3041",returnDescription:`
<p>The truncated normal initializer.</p>
`,returnType:`
<p><code>tf.initializers.TruncatedNormal</code></p>
`}}),qt=new k({props:{name:"transformers.modeling_tf_utils.keras_serializable",anchor:"transformers.modeling_tf_utils.keras_serializable",parameters:[],parametersDescription:[{anchor:"transformers.modeling_tf_utils.keras_serializable.cls",description:`<strong>cls</strong> (a <code>tf.keras.layers.Layers subclass</code>) &#x2014;
Typically a <code>TF.MainLayer</code> class in this project, in general must accept a <code>config</code> argument to its
initializer.`,name:"cls"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/modeling_tf_utils.py#L114",returnDescription:`
<p>The same class object, with modifications for Keras deserialization.</p>
`}}),Dt=new k({props:{name:"transformers.shape_list",anchor:"transformers.shape_list",parameters:[{name:"tensor",val:": typing.Union[tensorflow.python.framework.ops.Tensor, numpy.ndarray]"}],parametersDescription:[{anchor:"transformers.shape_list.tensor",description:"<strong>tensor</strong> (<code>tf.Tensor</code> or <code>np.ndarray</code>) &#x2014; The tensor we want the shape of.",name:"tensor"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/tf_utils.py#L26",returnDescription:`
<p>The shape of the tensor as a list.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),{c(){p=r("meta"),x=l(),u=r("h1"),$=r("a"),q=r("span"),h(w.$$.fragment),D=l(),O=r("span"),P=a("Custom Layers and Utilities"),Q=l(),F=r("p"),C=a("This page lists all the custom layers used by the library, as well as the utility functions it provides for modeling."),B=l(),A=r("p"),z=a("Most of those are only useful if you are studying the code of the models in the library."),G=l(),L=r("h2"),E=r("a"),T=r("span"),h(I.$$.fragment),ce=l(),U=r("span"),pe=a("Pytorch custom modules"),ae=l(),K=r("div"),h(Be.$$.fragment),Yr=l(),Yt=r("p"),Zr=a("1D-convolutional layer as defined by Radford et al. for OpenAI GPT (and also used in GPT-2)."),es=l(),Zt=r("p"),ts=a("Basically works like a linear layer but the weights are transposed."),sr=l(),R=r("div"),h(Ge.$$.fragment),os=l(),eo=r("p"),rs=a("Compute SQuAD start logits from sequence hidden states."),ss=l(),Pt=r("div"),h(Ue.$$.fragment),nr=l(),W=r("div"),h(Ke.$$.fragment),ns=l(),to=r("p"),as=a("Compute SQuAD end logits from sequence hidden states."),is=l(),De=r("div"),h(Re.$$.fragment),ls=l(),h(Le.$$.fragment),ar=l(),X=r("div"),h(We.$$.fragment),ds=l(),oo=r("p"),cs=a("Compute SQuAD 2.0 answer class from classification and start tokens hidden states."),ps=l(),Pe=r("div"),h(Xe.$$.fragment),ms=l(),h(Ce.$$.fragment),ir=l(),me=r("div"),h(Je.$$.fragment),fs=l(),Ye=r("p"),us=a("Base class for outputs of question answering models using a "),Ct=r("a"),hs=a("SQuADHead"),gs=a("."),lr=l(),J=r("div"),h(Ze.$$.fragment),_s=l(),ro=r("p"),vs=a("A SQuAD head inspired by XLNet."),bs=l(),zt=r("div"),h(et.$$.fragment),dr=l(),Y=r("div"),h(tt.$$.fragment),ys=l(),so=r("p"),$s=a("Compute a single vector summary of a sequence hidden states."),ws=l(),ze=r("div"),h(ot.$$.fragment),Ts=l(),no=r("p"),ks=a("Compute a single vector summary of a sequence hidden states."),cr=l(),fe=r("h2"),Se=r("a"),ao=r("span"),h(rt.$$.fragment),xs=l(),io=r("span"),Es=a("PyTorch Helper Functions"),pr=l(),N=r("div"),h(st.$$.fragment),qs=l(),H=r("p"),Ds=a("This function chunks the "),lo=r("code"),Ls=a("input_tensors"),Ps=a(" into smaller input tensor parts of size "),co=r("code"),Cs=a("chunk_size"),zs=a(` over the dimension
`),po=r("code"),Ss=a("chunk_dim"),Fs=a(". It then applies a layer "),mo=r("code"),As=a("forward_fn"),Os=a(" to each chunk independently to save memory."),Is=l(),M=r("p"),Ns=a("If the "),fo=r("code"),Hs=a("forward_fn"),Ms=a(" is independent across the "),uo=r("code"),Vs=a("chunk_dim"),js=a(` this function will yield the same result as directly
applying `),ho=r("code"),Qs=a("forward_fn"),Bs=a(" to "),go=r("code"),Gs=a("input_tensors"),Us=a("."),Ks=l(),h(Fe.$$.fragment),mr=l(),ue=r("div"),h(nt.$$.fragment),Rs=l(),at=r("p"),Ws=a("Finds the heads and their indices taking "),_o=r("code"),Xs=a("already_pruned_heads"),Js=a(" into account."),fr=l(),Z=r("div"),h(it.$$.fragment),Ys=l(),vo=r("p"),Zs=a("Prune a Conv1D or linear layer to keep only entries in index."),en=l(),bo=r("p"),tn=a("Used to remove heads."),ur=l(),ee=r("div"),h(lt.$$.fragment),on=l(),yo=r("p"),rn=a(`Prune a Conv1D layer to keep only entries in index. A Conv1D work as a Linear layer (see e.g. BERT) but the weights
are transposed.`),sn=l(),$o=r("p"),nn=a("Used to remove heads."),hr=l(),te=r("div"),h(dt.$$.fragment),an=l(),wo=r("p"),ln=a("Prune a linear layer to keep only entries in index."),dn=l(),To=r("p"),cn=a("Used to remove heads."),gr=l(),he=r("h2"),Ae=r("a"),ko=r("span"),h(ct.$$.fragment),pn=l(),xo=r("span"),mn=a("TensorFlow custom layers"),_r=l(),oe=r("div"),h(pt.$$.fragment),fn=l(),Eo=r("p"),un=a("1D-convolutional layer as defined by Radford et al. for OpenAI GPT (and also used in GPT-2)."),hn=l(),qo=r("p"),gn=a("Basically works like a linear layer but the weights are transposed."),vr=l(),V=r("div"),h(mt.$$.fragment),_n=l(),Do=r("p"),vn=a("Construct shared token embeddings."),bn=l(),Lo=r("p"),yn=a(`The weights of the embedding layer is usually shared with the weights of the linear decoder when doing language
modeling.`),$n=l(),ie=r("div"),h(ft.$$.fragment),wn=l(),Po=r("p"),Tn=a("Get token embeddings of inputs or decode final hidden state."),kn=l(),ut=r("p"),xn=a(`Shared weights logic is adapted from
`),ht=r("a"),En=a("here"),qn=a("."),br=l(),ge=r("div"),h(gt.$$.fragment),Dn=l(),Co=r("p"),Ln=a("Compute a single vector summary of a sequence hidden states."),yr=l(),_e=r("h2"),Oe=r("a"),zo=r("span"),h(_t.$$.fragment),Pn=l(),So=r("span"),Cn=a("TensorFlow loss functions"),$r=l(),re=r("div"),h(vt.$$.fragment),zn=l(),Fo=r("p"),Sn=a("Loss function suitable for causal language modeling (CLM), that is, the task of guessing the next token."),Fn=l(),h(Ie.$$.fragment),wr=l(),se=r("div"),h(bt.$$.fragment),An=l(),Ao=r("p"),On=a("Loss function suitable for masked language modeling (MLM), that is, the task of guessing the masked tokens."),In=l(),h(Ne.$$.fragment),Tr=l(),ve=r("div"),h(yt.$$.fragment),Nn=l(),Oo=r("p"),Hn=a("Loss function suitable for multiple choice tasks."),kr=l(),be=r("div"),h($t.$$.fragment),Mn=l(),Io=r("p"),Vn=a("Loss function suitable for question answering."),xr=l(),ye=r("div"),h(wt.$$.fragment),jn=l(),No=r("p"),Qn=a("Loss function suitable for sequence classification."),Er=l(),ne=r("div"),h(Tt.$$.fragment),Bn=l(),Ho=r("p"),Gn=a("Loss function suitable for token classification."),Un=l(),h(He.$$.fragment),qr=l(),$e=r("h2"),Me=r("a"),Mo=r("span"),h(kt.$$.fragment),Kn=l(),Vo=r("span"),Rn=a("TensorFlow Helper Functions"),Dr=l(),we=r("div"),h(xt.$$.fragment),Wn=l(),Et=r("p"),Xn=a("Creates a "),jo=r("code"),Jn=a("tf.initializers.TruncatedNormal"),Yn=a(" with the given range."),Lr=l(),j=r("div"),h(qt.$$.fragment),Zn=l(),Qo=r("p"),ea=a("Decorate a Keras Layer class to support Keras serialization."),ta=l(),Bo=r("p"),oa=a("This is done by:"),ra=l(),Te=r("ol"),ke=r("li"),sa=a("Adding a "),Go=r("code"),na=a("transformers_config"),aa=a(" dict to the Keras config dictionary in "),Uo=r("code"),ia=a("get_config"),la=a(` (called by Keras at
serialization time.`),da=l(),xe=r("li"),ca=a("Wrapping "),Ko=r("code"),pa=a("__init__"),ma=a(" to accept that "),Ro=r("code"),fa=a("transformers_config"),ua=a(` dict (passed by Keras at deserialization time) and
convert it to a config object for the actual layer initializer.`),ha=l(),Ee=r("li"),ga=a(`Registering the class as a custom object in Keras (if the Tensorflow version supports this), so that it does not
need to be supplied in `),Wo=r("code"),_a=a("custom_objects"),va=a(" in the call to "),Xo=r("code"),ba=a("tf.keras.models.load_model"),ya=a("."),Pr=l(),qe=r("div"),h(Dt.$$.fragment),$a=l(),Jo=r("p"),wa=a("Deal with dynamic shape in tensorflow cleanly."),this.h()},l(e){const c=Oi('[data-svelte="svelte-1phssyn"]',document.head);p=s(c,"META",{name:!0,content:!0}),c.forEach(o),x=d(e),u=s(e,"H1",{class:!0});var Lt=n(u);$=s(Lt,"A",{id:!0,class:!0,href:!0});var Yo=n($);q=s(Yo,"SPAN",{});var Zo=n(q);g(w.$$.fragment,Zo),Zo.forEach(o),Yo.forEach(o),D=d(Lt),O=s(Lt,"SPAN",{});var er=n(O);P=i(er,"Custom Layers and Utilities"),er.forEach(o),Lt.forEach(o),Q=d(e),F=s(e,"P",{});var tr=n(F);C=i(tr,"This page lists all the custom layers used by the library, as well as the utility functions it provides for modeling."),tr.forEach(o),B=d(e),A=s(e,"P",{});var or=n(A);z=i(or,"Most of those are only useful if you are studying the code of the models in the library."),or.forEach(o),G=d(e),L=s(e,"H2",{class:!0});var zr=n(L);E=s(zr,"A",{id:!0,class:!0,href:!0});var Ta=n(E);T=s(Ta,"SPAN",{});var ka=n(T);g(I.$$.fragment,ka),ka.forEach(o),Ta.forEach(o),ce=d(zr),U=s(zr,"SPAN",{});var xa=n(U);pe=i(xa,"Pytorch custom modules"),xa.forEach(o),zr.forEach(o),ae=d(e),K=s(e,"DIV",{class:!0});var St=n(K);g(Be.$$.fragment,St),Yr=d(St),Yt=s(St,"P",{});var Ea=n(Yt);Zr=i(Ea,"1D-convolutional layer as defined by Radford et al. for OpenAI GPT (and also used in GPT-2)."),Ea.forEach(o),es=d(St),Zt=s(St,"P",{});var qa=n(Zt);ts=i(qa,"Basically works like a linear layer but the weights are transposed."),qa.forEach(o),St.forEach(o),sr=d(e),R=s(e,"DIV",{class:!0});var Ft=n(R);g(Ge.$$.fragment,Ft),os=d(Ft),eo=s(Ft,"P",{});var Da=n(eo);rs=i(Da,"Compute SQuAD start logits from sequence hidden states."),Da.forEach(o),ss=d(Ft),Pt=s(Ft,"DIV",{class:!0});var La=n(Pt);g(Ue.$$.fragment,La),La.forEach(o),Ft.forEach(o),nr=d(e),W=s(e,"DIV",{class:!0});var At=n(W);g(Ke.$$.fragment,At),ns=d(At),to=s(At,"P",{});var Pa=n(to);as=i(Pa,"Compute SQuAD end logits from sequence hidden states."),Pa.forEach(o),is=d(At),De=s(At,"DIV",{class:!0});var Sr=n(De);g(Re.$$.fragment,Sr),ls=d(Sr),g(Le.$$.fragment,Sr),Sr.forEach(o),At.forEach(o),ar=d(e),X=s(e,"DIV",{class:!0});var Ot=n(X);g(We.$$.fragment,Ot),ds=d(Ot),oo=s(Ot,"P",{});var Ca=n(oo);cs=i(Ca,"Compute SQuAD 2.0 answer class from classification and start tokens hidden states."),Ca.forEach(o),ps=d(Ot),Pe=s(Ot,"DIV",{class:!0});var Fr=n(Pe);g(Xe.$$.fragment,Fr),ms=d(Fr),g(Ce.$$.fragment,Fr),Fr.forEach(o),Ot.forEach(o),ir=d(e),me=s(e,"DIV",{class:!0});var Ar=n(me);g(Je.$$.fragment,Ar),fs=d(Ar),Ye=s(Ar,"P",{});var Or=n(Ye);us=i(Or,"Base class for outputs of question answering models using a "),Ct=s(Or,"A",{href:!0});var za=n(Ct);hs=i(za,"SQuADHead"),za.forEach(o),gs=i(Or,"."),Or.forEach(o),Ar.forEach(o),lr=d(e),J=s(e,"DIV",{class:!0});var It=n(J);g(Ze.$$.fragment,It),_s=d(It),ro=s(It,"P",{});var Sa=n(ro);vs=i(Sa,"A SQuAD head inspired by XLNet."),Sa.forEach(o),bs=d(It),zt=s(It,"DIV",{class:!0});var Fa=n(zt);g(et.$$.fragment,Fa),Fa.forEach(o),It.forEach(o),dr=d(e),Y=s(e,"DIV",{class:!0});var Nt=n(Y);g(tt.$$.fragment,Nt),ys=d(Nt),so=s(Nt,"P",{});var Aa=n(so);$s=i(Aa,"Compute a single vector summary of a sequence hidden states."),Aa.forEach(o),ws=d(Nt),ze=s(Nt,"DIV",{class:!0});var Ir=n(ze);g(ot.$$.fragment,Ir),Ts=d(Ir),no=s(Ir,"P",{});var Oa=n(no);ks=i(Oa,"Compute a single vector summary of a sequence hidden states."),Oa.forEach(o),Ir.forEach(o),Nt.forEach(o),cr=d(e),fe=s(e,"H2",{class:!0});var Nr=n(fe);Se=s(Nr,"A",{id:!0,class:!0,href:!0});var Ia=n(Se);ao=s(Ia,"SPAN",{});var Na=n(ao);g(rt.$$.fragment,Na),Na.forEach(o),Ia.forEach(o),xs=d(Nr),io=s(Nr,"SPAN",{});var Ha=n(io);Es=i(Ha,"PyTorch Helper Functions"),Ha.forEach(o),Nr.forEach(o),pr=d(e),N=s(e,"DIV",{class:!0});var Ve=n(N);g(st.$$.fragment,Ve),qs=d(Ve),H=s(Ve,"P",{});var le=n(H);Ds=i(le,"This function chunks the "),lo=s(le,"CODE",{});var Ma=n(lo);Ls=i(Ma,"input_tensors"),Ma.forEach(o),Ps=i(le," into smaller input tensor parts of size "),co=s(le,"CODE",{});var Va=n(co);Cs=i(Va,"chunk_size"),Va.forEach(o),zs=i(le,` over the dimension
`),po=s(le,"CODE",{});var ja=n(po);Ss=i(ja,"chunk_dim"),ja.forEach(o),Fs=i(le,". It then applies a layer "),mo=s(le,"CODE",{});var Qa=n(mo);As=i(Qa,"forward_fn"),Qa.forEach(o),Os=i(le," to each chunk independently to save memory."),le.forEach(o),Is=d(Ve),M=s(Ve,"P",{});var de=n(M);Ns=i(de,"If the "),fo=s(de,"CODE",{});var Ba=n(fo);Hs=i(Ba,"forward_fn"),Ba.forEach(o),Ms=i(de," is independent across the "),uo=s(de,"CODE",{});var Ga=n(uo);Vs=i(Ga,"chunk_dim"),Ga.forEach(o),js=i(de,` this function will yield the same result as directly
applying `),ho=s(de,"CODE",{});var Ua=n(ho);Qs=i(Ua,"forward_fn"),Ua.forEach(o),Bs=i(de," to "),go=s(de,"CODE",{});var Ka=n(go);Gs=i(Ka,"input_tensors"),Ka.forEach(o),Us=i(de,"."),de.forEach(o),Ks=d(Ve),g(Fe.$$.fragment,Ve),Ve.forEach(o),mr=d(e),ue=s(e,"DIV",{class:!0});var Hr=n(ue);g(nt.$$.fragment,Hr),Rs=d(Hr),at=s(Hr,"P",{});var Mr=n(at);Ws=i(Mr,"Finds the heads and their indices taking "),_o=s(Mr,"CODE",{});var Ra=n(_o);Xs=i(Ra,"already_pruned_heads"),Ra.forEach(o),Js=i(Mr," into account."),Mr.forEach(o),Hr.forEach(o),fr=d(e),Z=s(e,"DIV",{class:!0});var Ht=n(Z);g(it.$$.fragment,Ht),Ys=d(Ht),vo=s(Ht,"P",{});var Wa=n(vo);Zs=i(Wa,"Prune a Conv1D or linear layer to keep only entries in index."),Wa.forEach(o),en=d(Ht),bo=s(Ht,"P",{});var Xa=n(bo);tn=i(Xa,"Used to remove heads."),Xa.forEach(o),Ht.forEach(o),ur=d(e),ee=s(e,"DIV",{class:!0});var Mt=n(ee);g(lt.$$.fragment,Mt),on=d(Mt),yo=s(Mt,"P",{});var Ja=n(yo);rn=i(Ja,`Prune a Conv1D layer to keep only entries in index. A Conv1D work as a Linear layer (see e.g. BERT) but the weights
are transposed.`),Ja.forEach(o),sn=d(Mt),$o=s(Mt,"P",{});var Ya=n($o);nn=i(Ya,"Used to remove heads."),Ya.forEach(o),Mt.forEach(o),hr=d(e),te=s(e,"DIV",{class:!0});var Vt=n(te);g(dt.$$.fragment,Vt),an=d(Vt),wo=s(Vt,"P",{});var Za=n(wo);ln=i(Za,"Prune a linear layer to keep only entries in index."),Za.forEach(o),dn=d(Vt),To=s(Vt,"P",{});var ei=n(To);cn=i(ei,"Used to remove heads."),ei.forEach(o),Vt.forEach(o),gr=d(e),he=s(e,"H2",{class:!0});var Vr=n(he);Ae=s(Vr,"A",{id:!0,class:!0,href:!0});var ti=n(Ae);ko=s(ti,"SPAN",{});var oi=n(ko);g(ct.$$.fragment,oi),oi.forEach(o),ti.forEach(o),pn=d(Vr),xo=s(Vr,"SPAN",{});var ri=n(xo);mn=i(ri,"TensorFlow custom layers"),ri.forEach(o),Vr.forEach(o),_r=d(e),oe=s(e,"DIV",{class:!0});var jt=n(oe);g(pt.$$.fragment,jt),fn=d(jt),Eo=s(jt,"P",{});var si=n(Eo);un=i(si,"1D-convolutional layer as defined by Radford et al. for OpenAI GPT (and also used in GPT-2)."),si.forEach(o),hn=d(jt),qo=s(jt,"P",{});var ni=n(qo);gn=i(ni,"Basically works like a linear layer but the weights are transposed."),ni.forEach(o),jt.forEach(o),vr=d(e),V=s(e,"DIV",{class:!0});var je=n(V);g(mt.$$.fragment,je),_n=d(je),Do=s(je,"P",{});var ai=n(Do);vn=i(ai,"Construct shared token embeddings."),ai.forEach(o),bn=d(je),Lo=s(je,"P",{});var ii=n(Lo);yn=i(ii,`The weights of the embedding layer is usually shared with the weights of the linear decoder when doing language
modeling.`),ii.forEach(o),$n=d(je),ie=s(je,"DIV",{class:!0});var Qt=n(ie);g(ft.$$.fragment,Qt),wn=d(Qt),Po=s(Qt,"P",{});var li=n(Po);Tn=i(li,"Get token embeddings of inputs or decode final hidden state."),li.forEach(o),kn=d(Qt),ut=s(Qt,"P",{});var jr=n(ut);xn=i(jr,`Shared weights logic is adapted from
`),ht=s(jr,"A",{href:!0,rel:!0});var di=n(ht);En=i(di,"here"),di.forEach(o),qn=i(jr,"."),jr.forEach(o),Qt.forEach(o),je.forEach(o),br=d(e),ge=s(e,"DIV",{class:!0});var Qr=n(ge);g(gt.$$.fragment,Qr),Dn=d(Qr),Co=s(Qr,"P",{});var ci=n(Co);Ln=i(ci,"Compute a single vector summary of a sequence hidden states."),ci.forEach(o),Qr.forEach(o),yr=d(e),_e=s(e,"H2",{class:!0});var Br=n(_e);Oe=s(Br,"A",{id:!0,class:!0,href:!0});var pi=n(Oe);zo=s(pi,"SPAN",{});var mi=n(zo);g(_t.$$.fragment,mi),mi.forEach(o),pi.forEach(o),Pn=d(Br),So=s(Br,"SPAN",{});var fi=n(So);Cn=i(fi,"TensorFlow loss functions"),fi.forEach(o),Br.forEach(o),$r=d(e),re=s(e,"DIV",{class:!0});var Bt=n(re);g(vt.$$.fragment,Bt),zn=d(Bt),Fo=s(Bt,"P",{});var ui=n(Fo);Sn=i(ui,"Loss function suitable for causal language modeling (CLM), that is, the task of guessing the next token."),ui.forEach(o),Fn=d(Bt),g(Ie.$$.fragment,Bt),Bt.forEach(o),wr=d(e),se=s(e,"DIV",{class:!0});var Gt=n(se);g(bt.$$.fragment,Gt),An=d(Gt),Ao=s(Gt,"P",{});var hi=n(Ao);On=i(hi,"Loss function suitable for masked language modeling (MLM), that is, the task of guessing the masked tokens."),hi.forEach(o),In=d(Gt),g(Ne.$$.fragment,Gt),Gt.forEach(o),Tr=d(e),ve=s(e,"DIV",{class:!0});var Gr=n(ve);g(yt.$$.fragment,Gr),Nn=d(Gr),Oo=s(Gr,"P",{});var gi=n(Oo);Hn=i(gi,"Loss function suitable for multiple choice tasks."),gi.forEach(o),Gr.forEach(o),kr=d(e),be=s(e,"DIV",{class:!0});var Ur=n(be);g($t.$$.fragment,Ur),Mn=d(Ur),Io=s(Ur,"P",{});var _i=n(Io);Vn=i(_i,"Loss function suitable for question answering."),_i.forEach(o),Ur.forEach(o),xr=d(e),ye=s(e,"DIV",{class:!0});var Kr=n(ye);g(wt.$$.fragment,Kr),jn=d(Kr),No=s(Kr,"P",{});var vi=n(No);Qn=i(vi,"Loss function suitable for sequence classification."),vi.forEach(o),Kr.forEach(o),Er=d(e),ne=s(e,"DIV",{class:!0});var Ut=n(ne);g(Tt.$$.fragment,Ut),Bn=d(Ut),Ho=s(Ut,"P",{});var bi=n(Ho);Gn=i(bi,"Loss function suitable for token classification."),bi.forEach(o),Un=d(Ut),g(He.$$.fragment,Ut),Ut.forEach(o),qr=d(e),$e=s(e,"H2",{class:!0});var Rr=n($e);Me=s(Rr,"A",{id:!0,class:!0,href:!0});var yi=n(Me);Mo=s(yi,"SPAN",{});var $i=n(Mo);g(kt.$$.fragment,$i),$i.forEach(o),yi.forEach(o),Kn=d(Rr),Vo=s(Rr,"SPAN",{});var wi=n(Vo);Rn=i(wi,"TensorFlow Helper Functions"),wi.forEach(o),Rr.forEach(o),Dr=d(e),we=s(e,"DIV",{class:!0});var Wr=n(we);g(xt.$$.fragment,Wr),Wn=d(Wr),Et=s(Wr,"P",{});var Xr=n(Et);Xn=i(Xr,"Creates a "),jo=s(Xr,"CODE",{});var Ti=n(jo);Jn=i(Ti,"tf.initializers.TruncatedNormal"),Ti.forEach(o),Yn=i(Xr," with the given range."),Xr.forEach(o),Wr.forEach(o),Lr=d(e),j=s(e,"DIV",{class:!0});var Qe=n(j);g(qt.$$.fragment,Qe),Zn=d(Qe),Qo=s(Qe,"P",{});var ki=n(Qo);ea=i(ki,"Decorate a Keras Layer class to support Keras serialization."),ki.forEach(o),ta=d(Qe),Bo=s(Qe,"P",{});var xi=n(Bo);oa=i(xi,"This is done by:"),xi.forEach(o),ra=d(Qe),Te=s(Qe,"OL",{});var Kt=n(Te);ke=s(Kt,"LI",{});var Rt=n(ke);sa=i(Rt,"Adding a "),Go=s(Rt,"CODE",{});var Ei=n(Go);na=i(Ei,"transformers_config"),Ei.forEach(o),aa=i(Rt," dict to the Keras config dictionary in "),Uo=s(Rt,"CODE",{});var qi=n(Uo);ia=i(qi,"get_config"),qi.forEach(o),la=i(Rt,` (called by Keras at
serialization time.`),Rt.forEach(o),da=d(Kt),xe=s(Kt,"LI",{});var Wt=n(xe);ca=i(Wt,"Wrapping "),Ko=s(Wt,"CODE",{});var Di=n(Ko);pa=i(Di,"__init__"),Di.forEach(o),ma=i(Wt," to accept that "),Ro=s(Wt,"CODE",{});var Li=n(Ro);fa=i(Li,"transformers_config"),Li.forEach(o),ua=i(Wt,` dict (passed by Keras at deserialization time) and
convert it to a config object for the actual layer initializer.`),Wt.forEach(o),ha=d(Kt),Ee=s(Kt,"LI",{});var Xt=n(Ee);ga=i(Xt,`Registering the class as a custom object in Keras (if the Tensorflow version supports this), so that it does not
need to be supplied in `),Wo=s(Xt,"CODE",{});var Pi=n(Wo);_a=i(Pi,"custom_objects"),Pi.forEach(o),va=i(Xt," in the call to "),Xo=s(Xt,"CODE",{});var Ci=n(Xo);ba=i(Ci,"tf.keras.models.load_model"),Ci.forEach(o),ya=i(Xt,"."),Xt.forEach(o),Kt.forEach(o),Qe.forEach(o),Pr=d(e),qe=s(e,"DIV",{class:!0});var Jr=n(qe);g(Dt.$$.fragment,Jr),$a=d(Jr),Jo=s(Jr,"P",{});var zi=n(Jo);wa=i(zi,"Deal with dynamic shape in tensorflow cleanly."),zi.forEach(o),Jr.forEach(o),this.h()},h(){f(p,"name","hf:doc:metadata"),f(p,"content",JSON.stringify(Ri)),f($,"id","custom-layers-and-utilities"),f($,"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"),f($,"href","#custom-layers-and-utilities"),f(u,"class","relative group"),f(E,"id","transformers.Conv1D"),f(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"),f(E,"href","#transformers.Conv1D"),f(L,"class","relative group"),f(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(De,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Ct,"href","/docs/transformers/pr_19907/en/internal/modeling_utils#transformers.modeling_utils.SQuADHead"),f(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(zt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Se,"id","transformers.apply_chunking_to_forward"),f(Se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Se,"href","#transformers.apply_chunking_to_forward"),f(fe,"class","relative group"),f(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Ae,"id","transformers.modeling_tf_utils.TFConv1D"),f(Ae,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Ae,"href","#transformers.modeling_tf_utils.TFConv1D"),f(he,"class","relative group"),f(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(ht,"href","https://github.com/tensorflow/models/blob/a009f4fb9d2fc4949e32192a944688925ef78659/official/transformer/v2/embedding_layer.py#L24"),f(ht,"rel","nofollow"),f(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Oe,"id","transformers.modeling_tf_utils.TFCausalLanguageModelingLoss"),f(Oe,"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"),f(Oe,"href","#transformers.modeling_tf_utils.TFCausalLanguageModelingLoss"),f(_e,"class","relative group"),f(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Me,"id","transformers.modeling_tf_utils.get_initializer"),f(Me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Me,"href","#transformers.modeling_tf_utils.get_initializer"),f($e,"class","relative group"),f(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,c){t(document.head,p),m(e,x,c),m(e,u,c),t(u,$),t($,q),_(w,q,null),t(u,D),t(u,O),t(O,P),m(e,Q,c),m(e,F,c),t(F,C),m(e,B,c),m(e,A,c),t(A,z),m(e,G,c),m(e,L,c),t(L,E),t(E,T),_(I,T,null),t(L,ce),t(L,U),t(U,pe),m(e,ae,c),m(e,K,c),_(Be,K,null),t(K,Yr),t(K,Yt),t(Yt,Zr),t(K,es),t(K,Zt),t(Zt,ts),m(e,sr,c),m(e,R,c),_(Ge,R,null),t(R,os),t(R,eo),t(eo,rs),t(R,ss),t(R,Pt),_(Ue,Pt,null),m(e,nr,c),m(e,W,c),_(Ke,W,null),t(W,ns),t(W,to),t(to,as),t(W,is),t(W,De),_(Re,De,null),t(De,ls),_(Le,De,null),m(e,ar,c),m(e,X,c),_(We,X,null),t(X,ds),t(X,oo),t(oo,cs),t(X,ps),t(X,Pe),_(Xe,Pe,null),t(Pe,ms),_(Ce,Pe,null),m(e,ir,c),m(e,me,c),_(Je,me,null),t(me,fs),t(me,Ye),t(Ye,us),t(Ye,Ct),t(Ct,hs),t(Ye,gs),m(e,lr,c),m(e,J,c),_(Ze,J,null),t(J,_s),t(J,ro),t(ro,vs),t(J,bs),t(J,zt),_(et,zt,null),m(e,dr,c),m(e,Y,c),_(tt,Y,null),t(Y,ys),t(Y,so),t(so,$s),t(Y,ws),t(Y,ze),_(ot,ze,null),t(ze,Ts),t(ze,no),t(no,ks),m(e,cr,c),m(e,fe,c),t(fe,Se),t(Se,ao),_(rt,ao,null),t(fe,xs),t(fe,io),t(io,Es),m(e,pr,c),m(e,N,c),_(st,N,null),t(N,qs),t(N,H),t(H,Ds),t(H,lo),t(lo,Ls),t(H,Ps),t(H,co),t(co,Cs),t(H,zs),t(H,po),t(po,Ss),t(H,Fs),t(H,mo),t(mo,As),t(H,Os),t(N,Is),t(N,M),t(M,Ns),t(M,fo),t(fo,Hs),t(M,Ms),t(M,uo),t(uo,Vs),t(M,js),t(M,ho),t(ho,Qs),t(M,Bs),t(M,go),t(go,Gs),t(M,Us),t(N,Ks),_(Fe,N,null),m(e,mr,c),m(e,ue,c),_(nt,ue,null),t(ue,Rs),t(ue,at),t(at,Ws),t(at,_o),t(_o,Xs),t(at,Js),m(e,fr,c),m(e,Z,c),_(it,Z,null),t(Z,Ys),t(Z,vo),t(vo,Zs),t(Z,en),t(Z,bo),t(bo,tn),m(e,ur,c),m(e,ee,c),_(lt,ee,null),t(ee,on),t(ee,yo),t(yo,rn),t(ee,sn),t(ee,$o),t($o,nn),m(e,hr,c),m(e,te,c),_(dt,te,null),t(te,an),t(te,wo),t(wo,ln),t(te,dn),t(te,To),t(To,cn),m(e,gr,c),m(e,he,c),t(he,Ae),t(Ae,ko),_(ct,ko,null),t(he,pn),t(he,xo),t(xo,mn),m(e,_r,c),m(e,oe,c),_(pt,oe,null),t(oe,fn),t(oe,Eo),t(Eo,un),t(oe,hn),t(oe,qo),t(qo,gn),m(e,vr,c),m(e,V,c),_(mt,V,null),t(V,_n),t(V,Do),t(Do,vn),t(V,bn),t(V,Lo),t(Lo,yn),t(V,$n),t(V,ie),_(ft,ie,null),t(ie,wn),t(ie,Po),t(Po,Tn),t(ie,kn),t(ie,ut),t(ut,xn),t(ut,ht),t(ht,En),t(ut,qn),m(e,br,c),m(e,ge,c),_(gt,ge,null),t(ge,Dn),t(ge,Co),t(Co,Ln),m(e,yr,c),m(e,_e,c),t(_e,Oe),t(Oe,zo),_(_t,zo,null),t(_e,Pn),t(_e,So),t(So,Cn),m(e,$r,c),m(e,re,c),_(vt,re,null),t(re,zn),t(re,Fo),t(Fo,Sn),t(re,Fn),_(Ie,re,null),m(e,wr,c),m(e,se,c),_(bt,se,null),t(se,An),t(se,Ao),t(Ao,On),t(se,In),_(Ne,se,null),m(e,Tr,c),m(e,ve,c),_(yt,ve,null),t(ve,Nn),t(ve,Oo),t(Oo,Hn),m(e,kr,c),m(e,be,c),_($t,be,null),t(be,Mn),t(be,Io),t(Io,Vn),m(e,xr,c),m(e,ye,c),_(wt,ye,null),t(ye,jn),t(ye,No),t(No,Qn),m(e,Er,c),m(e,ne,c),_(Tt,ne,null),t(ne,Bn),t(ne,Ho),t(Ho,Gn),t(ne,Un),_(He,ne,null),m(e,qr,c),m(e,$e,c),t($e,Me),t(Me,Mo),_(kt,Mo,null),t($e,Kn),t($e,Vo),t(Vo,Rn),m(e,Dr,c),m(e,we,c),_(xt,we,null),t(we,Wn),t(we,Et),t(Et,Xn),t(Et,jo),t(jo,Jn),t(Et,Yn),m(e,Lr,c),m(e,j,c),_(qt,j,null),t(j,Zn),t(j,Qo),t(Qo,ea),t(j,ta),t(j,Bo),t(Bo,oa),t(j,ra),t(j,Te),t(Te,ke),t(ke,sa),t(ke,Go),t(Go,na),t(ke,aa),t(ke,Uo),t(Uo,ia),t(ke,la),t(Te,da),t(Te,xe),t(xe,ca),t(xe,Ko),t(Ko,pa),t(xe,ma),t(xe,Ro),t(Ro,fa),t(xe,ua),t(Te,ha),t(Te,Ee),t(Ee,ga),t(Ee,Wo),t(Wo,_a),t(Ee,va),t(Ee,Xo),t(Xo,ba),t(Ee,ya),m(e,Pr,c),m(e,qe,c),_(Dt,qe,null),t(qe,$a),t(qe,Jo),t(Jo,wa),Cr=!0},p(e,[c]){const Lt={};c&2&&(Lt.$$scope={dirty:c,ctx:e}),Le.$set(Lt);const Yo={};c&2&&(Yo.$$scope={dirty:c,ctx:e}),Ce.$set(Yo);const Zo={};c&2&&(Zo.$$scope={dirty:c,ctx:e}),Fe.$set(Zo);const er={};c&2&&(er.$$scope={dirty:c,ctx:e}),Ie.$set(er);const tr={};c&2&&(tr.$$scope={dirty:c,ctx:e}),Ne.$set(tr);const or={};c&2&&(or.$$scope={dirty:c,ctx:e}),He.$set(or)},i(e){Cr||(v(w.$$.fragment,e),v(I.$$.fragment,e),v(Be.$$.fragment,e),v(Ge.$$.fragment,e),v(Ue.$$.fragment,e),v(Ke.$$.fragment,e),v(Re.$$.fragment,e),v(Le.$$.fragment,e),v(We.$$.fragment,e),v(Xe.$$.fragment,e),v(Ce.$$.fragment,e),v(Je.$$.fragment,e),v(Ze.$$.fragment,e),v(et.$$.fragment,e),v(tt.$$.fragment,e),v(ot.$$.fragment,e),v(rt.$$.fragment,e),v(st.$$.fragment,e),v(Fe.$$.fragment,e),v(nt.$$.fragment,e),v(it.$$.fragment,e),v(lt.$$.fragment,e),v(dt.$$.fragment,e),v(ct.$$.fragment,e),v(pt.$$.fragment,e),v(mt.$$.fragment,e),v(ft.$$.fragment,e),v(gt.$$.fragment,e),v(_t.$$.fragment,e),v(vt.$$.fragment,e),v(Ie.$$.fragment,e),v(bt.$$.fragment,e),v(Ne.$$.fragment,e),v(yt.$$.fragment,e),v($t.$$.fragment,e),v(wt.$$.fragment,e),v(Tt.$$.fragment,e),v(He.$$.fragment,e),v(kt.$$.fragment,e),v(xt.$$.fragment,e),v(qt.$$.fragment,e),v(Dt.$$.fragment,e),Cr=!0)},o(e){b(w.$$.fragment,e),b(I.$$.fragment,e),b(Be.$$.fragment,e),b(Ge.$$.fragment,e),b(Ue.$$.fragment,e),b(Ke.$$.fragment,e),b(Re.$$.fragment,e),b(Le.$$.fragment,e),b(We.$$.fragment,e),b(Xe.$$.fragment,e),b(Ce.$$.fragment,e),b(Je.$$.fragment,e),b(Ze.$$.fragment,e),b(et.$$.fragment,e),b(tt.$$.fragment,e),b(ot.$$.fragment,e),b(rt.$$.fragment,e),b(st.$$.fragment,e),b(Fe.$$.fragment,e),b(nt.$$.fragment,e),b(it.$$.fragment,e),b(lt.$$.fragment,e),b(dt.$$.fragment,e),b(ct.$$.fragment,e),b(pt.$$.fragment,e),b(mt.$$.fragment,e),b(ft.$$.fragment,e),b(gt.$$.fragment,e),b(_t.$$.fragment,e),b(vt.$$.fragment,e),b(Ie.$$.fragment,e),b(bt.$$.fragment,e),b(Ne.$$.fragment,e),b(yt.$$.fragment,e),b($t.$$.fragment,e),b(wt.$$.fragment,e),b(Tt.$$.fragment,e),b(He.$$.fragment,e),b(kt.$$.fragment,e),b(xt.$$.fragment,e),b(qt.$$.fragment,e),b(Dt.$$.fragment,e),Cr=!1},d(e){o(p),e&&o(x),e&&o(u),y(w),e&&o(Q),e&&o(F),e&&o(B),e&&o(A),e&&o(G),e&&o(L),y(I),e&&o(ae),e&&o(K),y(Be),e&&o(sr),e&&o(R),y(Ge),y(Ue),e&&o(nr),e&&o(W),y(Ke),y(Re),y(Le),e&&o(ar),e&&o(X),y(We),y(Xe),y(Ce),e&&o(ir),e&&o(me),y(Je),e&&o(lr),e&&o(J),y(Ze),y(et),e&&o(dr),e&&o(Y),y(tt),y(ot),e&&o(cr),e&&o(fe),y(rt),e&&o(pr),e&&o(N),y(st),y(Fe),e&&o(mr),e&&o(ue),y(nt),e&&o(fr),e&&o(Z),y(it),e&&o(ur),e&&o(ee),y(lt),e&&o(hr),e&&o(te),y(dt),e&&o(gr),e&&o(he),y(ct),e&&o(_r),e&&o(oe),y(pt),e&&o(vr),e&&o(V),y(mt),y(ft),e&&o(br),e&&o(ge),y(gt),e&&o(yr),e&&o(_e),y(_t),e&&o($r),e&&o(re),y(vt),y(Ie),e&&o(wr),e&&o(se),y(bt),y(Ne),e&&o(Tr),e&&o(ve),y(yt),e&&o(kr),e&&o(be),y($t),e&&o(xr),e&&o(ye),y(wt),e&&o(Er),e&&o(ne),y(Tt),y(He),e&&o(qr),e&&o($e),y(kt),e&&o(Dr),e&&o(we),y(xt),e&&o(Lr),e&&o(j),y(qt),e&&o(Pr),e&&o(qe),y(Dt)}}}const Ri={local:"custom-layers-and-utilities",sections:[{local:"transformers.Conv1D",title:"Pytorch custom modules"},{local:"transformers.apply_chunking_to_forward",title:"PyTorch Helper Functions"},{local:"transformers.modeling_tf_utils.TFConv1D",title:"TensorFlow custom layers"},{local:"transformers.modeling_tf_utils.TFCausalLanguageModelingLoss",title:"TensorFlow loss functions"},{local:"transformers.modeling_tf_utils.get_initializer",title:"TensorFlow Helper Functions"}],title:"Custom Layers and Utilities"};function Wi(S){return Ii(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ol extends Si{constructor(p){super();Fi(this,p,Wi,Ki,Ai,{})}}export{ol as default,Ri as metadata};
