import{S as mp,i as bp,s as _p,e as o,k as p,w as m,t as n,M as gp,c as r,d as t,m as d,a as l,x as b,h as a,b as c,G as s,g as h,y as _,L as vp,q as g,o as v,B as k,v as kp}from"../chunks/vendor-hf-doc-builder.js";import{Y as ii}from"../chunks/Youtube-hf-doc-builder.js";import{I as C}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as E}from"../chunks/CodeBlock-hf-doc-builder.js";function wp(hi){let D,Qt,M,Y,Ss,ve,Da,Fs,Ma,Jt,L,Q,Ns,ke,La,Rs,Ba,Kt,u,Os,Sa,Fa,Hs,Na,Ra,Gs,Oa,Ha,Ws,Ga,Wa,Us,Ua,Va,Vs,Xa,Ya,Xs,Qa,Ja,Ys,Ka,Za,Qs,eo,so,Js,to,no,Ks,ao,oo,Zs,ro,lo,B,io,Je,ho,po,Ke,co,uo,fo,et,mo,bo,st,_o,Zt,S,J,tt,we,go,nt,vo,en,Ze,ko,sn,F,K,at,ye,wo,ot,yo,tn,Z,$o,rt,Eo,jo,nn,$e,an,ee,qo,Ee,To,zo,on,je,rn,es,xo,ln,qe,hn,ss,Po,pn,Te,dn,se,Ao,ze,Io,Co,cn,xe,un,ts,Do,fn,Pe,mn,ns,Mo,bn,as,Lo,_n,Ae,gn,os,Bo,vn,Ie,kn,te,So,rs,Fo,No,wn,N,ne,lt,Ce,Ro,it,Oo,yn,ls,Ho,$n,De,En,is,Go,jn,hs,Wo,qn,Me,Tn,ps,Uo,zn,Le,xn,ds,Vo,Pn,cs,Xo,An,Be,In,us,Yo,Cn,Se,Dn,q,Qo,fs,Jo,Ko,ht,Zo,er,pt,sr,tr,Mn,Fe,Ln,R,ae,dt,Ne,nr,ct,ar,Bn,ms,or,Sn,Re,Fn,P,rr,ut,lr,ir,ft,hr,pr,Nn,Oe,Rn,oe,dr,mt,cr,ur,On,He,Hn,bs,fr,Gn,Ge,Wn,_s,mr,Un,gs,br,Vn,We,Xn,A,_r,bt,gr,vr,_t,kr,wr,Yn,I,yr,vs,$r,Er,gt,jr,qr,Qn,O,re,vt,Ue,Tr,kt,zr,Jn,le,xr,wt,Pr,Ar,Kn,ie,Ir,yt,Cr,Dr,Zn,he,Mr,$t,Lr,Br,ea,H,pe,Et,Ve,Sr,jt,Fr,sa,ks,Nr,ta,ws,Rr,na,T,G,Or,ys,Hr,Gr,qt,Wr,Ur,Vr,W,Xr,$s,Yr,Qr,Tt,Jr,Kr,Zr,U,el,Es,sl,tl,zt,nl,al,ol,$,rl,js,ll,il,qs,hl,pl,xt,dl,cl,Pt,ul,fl,At,ml,bl,It,_l,gl,aa,de,vl,Ts,kl,wl,oa,V,ce,Ct,Xe,yl,Dt,$l,ra,zs,El,la,z,jl,Mt,ql,Tl,Lt,zl,xl,Bt,Pl,Al,ia,xs,Il,ha,X,ue,St,Ye,Cl,Ft,Dl,pa,fe,Ml,Nt,Ll,Bl,da,w,Sl,Rt,Fl,Nl,Ot,Rl,Ol,Qe,Hl,Gl,Ht,Wl,Ul,Gt,Vl,Xl,Wt,Yl,Ql,Ut,Jl,Kl,Vt,Zl,ei,ca,x,si,Ps,ti,ni,Xt,ai,oi,Yt,ri,li,ua;return ve=new C({}),ke=new C({}),we=new C({}),ye=new C({}),$e=new ii({props:{id:"VFp38yj8h3A"}}),je=new E({props:{code:`from transformers import BertTokenizer

tokenizer = BertTokenizer.from_pretrained("bert-base-cased")

sequence = "A Titan RTX has 24GB of VRAM"`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = BertTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>sequence = <span class="hljs-string">&quot;A Titan RTX has 24GB of VRAM&quot;</span>`}}),qe=new E({props:{code:"tokenized_sequence = tokenizer.tokenize(sequence)",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_sequence = tokenizer.tokenize(sequence)'}}),Te=new E({props:{code:"print(tokenized_sequence)",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenized_sequence)
[<span class="hljs-string">&#x27;A&#x27;</span>, <span class="hljs-string">&#x27;Titan&#x27;</span>, <span class="hljs-string">&#x27;R&#x27;</span>, <span class="hljs-string">&#x27;##T&#x27;</span>, <span class="hljs-string">&#x27;##X&#x27;</span>, <span class="hljs-string">&#x27;has&#x27;</span>, <span class="hljs-string">&#x27;24&#x27;</span>, <span class="hljs-string">&#x27;##GB&#x27;</span>, <span class="hljs-string">&#x27;of&#x27;</span>, <span class="hljs-string">&#x27;V&#x27;</span>, <span class="hljs-string">&#x27;##RA&#x27;</span>, <span class="hljs-string">&#x27;##M&#x27;</span>]`}}),xe=new E({props:{code:"inputs = tokenizer(sequence)",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(sequence)'}}),Pe=new E({props:{code:`encoded_sequence = inputs["input_ids"]
print(encoded_sequence)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_sequence = inputs[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(encoded_sequence)
[<span class="hljs-number">101</span>, <span class="hljs-number">138</span>, <span class="hljs-number">18696</span>, <span class="hljs-number">155</span>, <span class="hljs-number">1942</span>, <span class="hljs-number">3190</span>, <span class="hljs-number">1144</span>, <span class="hljs-number">1572</span>, <span class="hljs-number">13745</span>, <span class="hljs-number">1104</span>, <span class="hljs-number">159</span>, <span class="hljs-number">9664</span>, <span class="hljs-number">2107</span>, <span class="hljs-number">102</span>]`}}),Ae=new E({props:{code:"decoded_sequence = tokenizer.decode(encoded_sequence)",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>decoded_sequence = tokenizer.decode(encoded_sequence)'}}),Ie=new E({props:{code:"print(decoded_sequence)",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(decoded_sequence)
[CLS] A Titan RTX has 24GB of VRAM [SEP]`}}),Ce=new C({}),De=new ii({props:{id:"M6adb1j2jPI"}}),Me=new E({props:{code:`from transformers import BertTokenizer

tokenizer = BertTokenizer.from_pretrained("bert-base-cased")

sequence_a = "This is a short sequence."
sequence_b = "This is a rather long sequence. It is at least longer than the sequence A."

encoded_sequence_a = tokenizer(sequence_a)["input_ids"]
encoded_sequence_b = tokenizer(sequence_b)["input_ids"]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = BertTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_a = <span class="hljs-string">&quot;This is a short sequence.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_b = <span class="hljs-string">&quot;This is a rather long sequence. It is at least longer than the sequence A.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_sequence_a = tokenizer(sequence_a)[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_sequence_b = tokenizer(sequence_b)[<span class="hljs-string">&quot;input_ids&quot;</span>]`}}),Le=new E({props:{code:"len(encoded_sequence_a), len(encoded_sequence_b)",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">len</span>(encoded_sequence_a), <span class="hljs-built_in">len</span>(encoded_sequence_b)
(<span class="hljs-number">8</span>, <span class="hljs-number">19</span>)`}}),Be=new E({props:{code:"padded_sequences = tokenizer([sequence_a, sequence_b], padding=True)",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>padded_sequences = tokenizer([sequence_a, sequence_b], padding=<span class="hljs-literal">True</span>)'}}),Se=new E({props:{code:'padded_sequences["input_ids"]',highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>padded_sequences[<span class="hljs-string">&quot;input_ids&quot;</span>]
[[<span class="hljs-number">101</span>, <span class="hljs-number">1188</span>, <span class="hljs-number">1110</span>, <span class="hljs-number">170</span>, <span class="hljs-number">1603</span>, <span class="hljs-number">4954</span>, <span class="hljs-number">119</span>, <span class="hljs-number">102</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>], [<span class="hljs-number">101</span>, <span class="hljs-number">1188</span>, <span class="hljs-number">1110</span>, <span class="hljs-number">170</span>, <span class="hljs-number">1897</span>, <span class="hljs-number">1263</span>, <span class="hljs-number">4954</span>, <span class="hljs-number">119</span>, <span class="hljs-number">1135</span>, <span class="hljs-number">1110</span>, <span class="hljs-number">1120</span>, <span class="hljs-number">1655</span>, <span class="hljs-number">2039</span>, <span class="hljs-number">1190</span>, <span class="hljs-number">1103</span>, <span class="hljs-number">4954</span>, <span class="hljs-number">138</span>, <span class="hljs-number">119</span>, <span class="hljs-number">102</span>]]`}}),Fe=new E({props:{code:'padded_sequences["attention_mask"]',highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>padded_sequences[<span class="hljs-string">&quot;attention_mask&quot;</span>]
[[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>], [<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>]]`}}),Ne=new C({}),Re=new ii({props:{id:"0u3ioSwev3s"}}),Oe=new E({props:{code:"# [CLS] SEQUENCE_A [SEP] SEQUENCE_B [SEP]",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># [CLS] SEQUENCE_A [SEP] SEQUENCE_B [SEP]</span>'}}),He=new E({props:{code:`from transformers import BertTokenizer

tokenizer = BertTokenizer.from_pretrained("bert-base-cased")
sequence_a = "HuggingFace is based in NYC"
sequence_b = "Where is HuggingFace based?"

encoded_dict = tokenizer(sequence_a, sequence_b)
decoded = tokenizer.decode(encoded_dict["input_ids"])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = BertTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_a = <span class="hljs-string">&quot;HuggingFace is based in NYC&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_b = <span class="hljs-string">&quot;Where is HuggingFace based?&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_dict = tokenizer(sequence_a, sequence_b)
<span class="hljs-meta">&gt;&gt;&gt; </span>decoded = tokenizer.decode(encoded_dict[<span class="hljs-string">&quot;input_ids&quot;</span>])`}}),Ge=new E({props:{code:"print(decoded)",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(decoded)
[CLS] HuggingFace <span class="hljs-keyword">is</span> based <span class="hljs-keyword">in</span> NYC [SEP] Where <span class="hljs-keyword">is</span> HuggingFace based? [SEP]`}}),We=new E({props:{code:'encoded_dict["token_type_ids"]',highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_dict[<span class="hljs-string">&quot;token_type_ids&quot;</span>]
[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>]`}}),Ue=new C({}),Ve=new C({}),Xe=new C({}),Ye=new C({}),{c(){D=o("meta"),Qt=p(),M=o("h1"),Y=o("a"),Ss=o("span"),m(ve.$$.fragment),Da=p(),Fs=o("span"),Ma=n("Glossary"),Jt=p(),L=o("h2"),Q=o("a"),Ns=o("span"),m(ke.$$.fragment),La=p(),Rs=o("span"),Ba=n("General terms"),Kt=p(),u=o("ul"),Os=o("li"),Sa=n("autoencoding models: see MLM"),Fa=p(),Hs=o("li"),Na=n("autoregressive models: see CLM"),Ra=p(),Gs=o("li"),Oa=n(`CLM: causal language modeling, a pretraining task where the model reads the texts in order and has to predict the
next word. It\u2019s usually done by reading the whole sentence but using a mask inside the model to hide the future
tokens at a certain timestep.`),Ha=p(),Ws=o("li"),Ga=n("deep learning: machine learning algorithms which uses neural networks with several layers."),Wa=p(),Us=o("li"),Ua=n(`MLM: masked language modeling, a pretraining task where the model sees a corrupted version of the texts, usually done
by masking some tokens randomly, and has to predict the original text.`),Va=p(),Vs=o("li"),Xa=n("multimodal: a task that combines texts with another kind of inputs (for instance images)."),Ya=p(),Xs=o("li"),Qa=n(`NLG: natural language generation, all tasks related to generating text (for instance talk with transformers,
translation).`),Ja=p(),Ys=o("li"),Ka=n("NLP: natural language processing, a generic way to say \u201Cdeal with texts\u201D."),Za=p(),Qs=o("li"),eo=n(`NLU: natural language understanding, all tasks related to understanding what is in a text (for instance classifying
the whole text, individual words).`),so=p(),Js=o("li"),to=n(`pretrained model: a model that has been pretrained on some data (for instance all of Wikipedia). Pretraining methods
involve a self-supervised objective, which can be reading the text and trying to predict the next word (see CLM) or
masking some words and trying to predict them (see MLM).`),no=p(),Ks=o("li"),ao=n("RNN: recurrent neural network, a type of model that uses a loop over a layer to process texts."),oo=p(),Zs=o("li"),ro=n("self-attention: each element of the input finds out which other elements of the input they should attend to."),lo=p(),B=o("li"),io=n(`seq2seq or sequence-to-sequence: models that generate a new sequence from an input, like translation models, or
summarization models (such as `),Je=o("a"),ho=n("Bart"),po=n(" or "),Ke=o("a"),co=n("T5"),uo=n(")."),fo=p(),et=o("li"),mo=n(`token: a part of a sentence, usually a word, but can also be a subword (non-common words are often split in subwords)
or a punctuation symbol.`),bo=p(),st=o("li"),_o=n("transformer: self-attention based deep learning model architecture."),Zt=p(),S=o("h2"),J=o("a"),tt=o("span"),m(we.$$.fragment),go=p(),nt=o("span"),vo=n("Model inputs"),en=p(),Ze=o("p"),ko=n(`Every model is different yet bears similarities with the others. Therefore most models use the same inputs, which are
detailed here alongside usage examples.`),sn=p(),F=o("h3"),K=o("a"),at=o("span"),m(ye.$$.fragment),wo=p(),ot=o("span"),yo=n("Input IDs"),tn=p(),Z=o("p"),$o=n("The input ids are often the only required parameters to be passed to the model as input. "),rt=o("em"),Eo=n(`They are token indices,
numerical representations of tokens building the sequences that will be used as input by the model`),jo=n("."),nn=p(),m($e.$$.fragment),an=p(),ee=o("p"),qo=n(`Each tokenizer works differently but the underlying mechanism remains the same. Here\u2019s an example using the BERT
tokenizer, which is a `),Ee=o("a"),To=n("WordPiece"),zo=n(" tokenizer:"),on=p(),m(je.$$.fragment),rn=p(),es=o("p"),xo=n("The tokenizer takes care of splitting the sequence into tokens available in the tokenizer vocabulary."),ln=p(),m(qe.$$.fragment),hn=p(),ss=o("p"),Po=n(`The tokens are either words or subwords. Here for instance, \u201CVRAM\u201D wasn\u2019t in the model vocabulary, so it\u2019s been split
in \u201CV\u201D, \u201CRA\u201D and \u201CM\u201D. To indicate those tokens are not separate words but parts of the same word, a double-hash prefix
is added for \u201CRA\u201D and \u201CM\u201D:`),pn=p(),m(Te.$$.fragment),dn=p(),se=o("p"),Ao=n(`These tokens can then be converted into IDs which are understandable by the model. This can be done by directly feeding
the sentence to the tokenizer, which leverages the Rust implementation of `),ze=o("a"),Io=n("\u{1F917} Tokenizers"),Co=n(" for peak performance."),cn=p(),m(xe.$$.fragment),un=p(),ts=o("p"),Do=n(`The tokenizer returns a dictionary with all the arguments necessary for its corresponding model to work properly. The
token indices are under the key \u201Cinput_ids\u201D:`),fn=p(),m(Pe.$$.fragment),mn=p(),ns=o("p"),Mo=n(`Note that the tokenizer automatically adds \u201Cspecial tokens\u201D (if the associated model relies on them) which are special
IDs the model sometimes uses.`),bn=p(),as=o("p"),Lo=n("If we decode the previous sequence of ids,"),_n=p(),m(Ae.$$.fragment),gn=p(),os=o("p"),Bo=n("we will see"),vn=p(),m(Ie.$$.fragment),kn=p(),te=o("p"),So=n("because this is the way a "),rs=o("a"),Fo=n("BertModel"),No=n(" is going to expect its inputs."),wn=p(),N=o("h3"),ne=o("a"),lt=o("span"),m(Ce.$$.fragment),Ro=p(),it=o("span"),Oo=n("Attention mask"),yn=p(),ls=o("p"),Ho=n("The attention mask is an optional argument used when batching sequences together."),$n=p(),m(De.$$.fragment),En=p(),is=o("p"),Go=n("This argument indicates to the model which tokens should be attended to, and which should not."),jn=p(),hs=o("p"),Wo=n("For example, consider these two sequences:"),qn=p(),m(Me.$$.fragment),Tn=p(),ps=o("p"),Uo=n("The encoded versions have different lengths:"),zn=p(),m(Le.$$.fragment),xn=p(),ds=o("p"),Vo=n(`Therefore, we can\u2019t put them together in the same tensor as-is. The first sequence needs to be padded up to the length
of the second one, or the second one needs to be truncated down to the length of the first one.`),Pn=p(),cs=o("p"),Xo=n(`In the first case, the list of IDs will be extended by the padding indices. We can pass a list to the tokenizer and ask
it to pad like this:`),An=p(),m(Be.$$.fragment),In=p(),us=o("p"),Yo=n("We can see that 0s have been added on the right of the first sentence to make it the same length as the second one:"),Cn=p(),m(Se.$$.fragment),Dn=p(),q=o("p"),Qo=n(`This can then be converted into a tensor in PyTorch or TensorFlow. The attention mask is a binary tensor indicating the
position of the padded indices so that the model does not attend to them. For the `),fs=o("a"),Jo=n("BertTokenizer"),Ko=n(`,
`),ht=o("code"),Zo=n("1"),er=n(" indicates a value that should be attended to, while "),pt=o("code"),sr=n("0"),tr=n(` indicates a padded value. This attention mask is
in the dictionary returned by the tokenizer under the key \u201Cattention_mask\u201D:`),Mn=p(),m(Fe.$$.fragment),Ln=p(),R=o("h3"),ae=o("a"),dt=o("span"),m(Ne.$$.fragment),nr=p(),ct=o("span"),ar=n("Token Type IDs"),Bn=p(),ms=o("p"),or=n("Some models\u2019 purpose is to do classification on pairs of sentences or question answering."),Sn=p(),m(Re.$$.fragment),Fn=p(),P=o("p"),rr=n(`These require two different sequences to be joined in a single \u201Cinput_ids\u201D entry, which usually is performed with the
help of special tokens, such as the classifier (`),ut=o("code"),lr=n("[CLS]"),ir=n(") and separator ("),ft=o("code"),hr=n("[SEP]"),pr=n(`) tokens. For example, the BERT
model builds its two sequence input as such:`),Nn=p(),m(Oe.$$.fragment),Rn=p(),oe=o("p"),dr=n("We can use our tokenizer to automatically generate such a sentence by passing the two sequences to "),mt=o("code"),cr=n("tokenizer"),ur=n(` as two
arguments (and not a list, like before) like this:`),On=p(),m(He.$$.fragment),Hn=p(),bs=o("p"),fr=n("which will return:"),Gn=p(),m(Ge.$$.fragment),Wn=p(),_s=o("p"),mr=n(`This is enough for some models to understand where one sequence ends and where another begins. However, other models,
such as BERT, also deploy token type IDs (also called segment IDs). They are represented as a binary mask identifying
the two types of sequence in the model.`),Un=p(),gs=o("p"),br=n("The tokenizer returns this mask as the \u201Ctoken_type_ids\u201D entry:"),Vn=p(),m(We.$$.fragment),Xn=p(),A=o("p"),_r=n("The first sequence, the \u201Ccontext\u201D used for the question, has all its tokens represented by a "),bt=o("code"),gr=n("0"),vr=n(`, whereas the
second sequence, corresponding to the \u201Cquestion\u201D, has all its tokens represented by a `),_t=o("code"),kr=n("1"),wr=n("."),Yn=p(),I=o("p"),yr=n("Some models, like "),vs=o("a"),$r=n("XLNetModel"),Er=n(" use an additional token represented by a "),gt=o("code"),jr=n("2"),qr=n("."),Qn=p(),O=o("h3"),re=o("a"),vt=o("span"),m(Ue.$$.fragment),Tr=p(),kt=o("span"),zr=n("Position IDs"),Jn=p(),le=o("p"),xr=n(`Contrary to RNNs that have the position of each token embedded within them, transformers are unaware of the position of
each token. Therefore, the position IDs (`),wt=o("code"),Pr=n("position_ids"),Ar=n(`) are used by the model to identify each token\u2019s position in
the list of tokens.`),Kn=p(),ie=o("p"),Ir=n("They are an optional parameter. If no "),yt=o("code"),Cr=n("position_ids"),Dr=n(` are passed to the model, the IDs are automatically created as
absolute positional embeddings.`),Zn=p(),he=o("p"),Mr=n("Absolute positional embeddings are selected in the range "),$t=o("code"),Lr=n("[0, config.max_position_embeddings - 1]"),Br=n(`. Some models use
other types of positional embeddings, such as sinusoidal position embeddings or relative position embeddings.`),ea=p(),H=o("h3"),pe=o("a"),Et=o("span"),m(Ve.$$.fragment),Sr=p(),jt=o("span"),Fr=n("Labels"),sa=p(),ks=o("p"),Nr=n(`The labels are an optional argument which can be passed in order for the model to compute the loss itself. These labels
should be the expected prediction of the model: it will use the standard loss in order to compute the loss between its
predictions and the expected value (the label).`),ta=p(),ws=o("p"),Rr=n("These labels are different according to the model head, for example:"),na=p(),T=o("ul"),G=o("li"),Or=n("For sequence classification models (e.g., "),ys=o("a"),Hr=n("BertForSequenceClassification"),Gr=n(`), the model expects a
tensor of dimension `),qt=o("code"),Wr=n("(batch_size)"),Ur=n(` with each value of the batch corresponding to the expected label of the
entire sequence.`),Vr=p(),W=o("li"),Xr=n("For token classification models (e.g., "),$s=o("a"),Yr=n("BertForTokenClassification"),Qr=n(`), the model expects a tensor
of dimension `),Tt=o("code"),Jr=n("(batch_size, seq_length)"),Kr=n(` with each value corresponding to the expected label of each individual
token.`),Zr=p(),U=o("li"),el=n("For masked language modeling (e.g., "),Es=o("a"),sl=n("BertForMaskedLM"),tl=n(`), the model expects a tensor of dimension
`),zt=o("code"),nl=n("(batch_size, seq_length)"),al=n(` with each value corresponding to the expected label of each individual token: the
labels being the token ID for the masked token, and values to be ignored for the rest (usually -100).`),ol=p(),$=o("li"),rl=n("For sequence to sequence tasks,(e.g., "),js=o("a"),ll=n("BartForConditionalGeneration"),il=n(`,
`),qs=o("a"),hl=n("MBartForConditionalGeneration"),pl=n("), the model expects a tensor of dimension "),xt=o("code"),dl=n("(batch_size, tgt_seq_length)"),cl=n(` with each value corresponding to the target sequences associated with each input sequence. During
training, both `),Pt=o("em"),ul=n("BART"),fl=n(" and "),At=o("em"),ml=n("T5"),bl=n(" will make the appropriate "),It=o("em"),_l=n("decoder_input_ids"),gl=n(` and decoder attention masks internally.
They usually do not need to be supplied. This does not apply to models leveraging the Encoder-Decoder framework. See
the documentation of each model for more information on each specific model\u2019s labels.`),aa=p(),de=o("p"),vl=n("The base models (e.g., "),Ts=o("a"),kl=n("BertModel"),wl=n(`) do not accept labels, as these are the base transformer
models, simply outputting features.`),oa=p(),V=o("h3"),ce=o("a"),Ct=o("span"),m(Xe.$$.fragment),yl=p(),Dt=o("span"),$l=n("Decoder input IDs"),ra=p(),zs=o("p"),El=n(`This input is specific to encoder-decoder models, and contains the input IDs that will be fed to the decoder. These
inputs should be used for sequence to sequence tasks, such as translation or summarization, and are usually built in a
way specific to each model.`),la=p(),z=o("p"),jl=n("Most encoder-decoder models (BART, T5) create their "),Mt=o("code"),ql=n("decoder_input_ids"),Tl=n(" on their own from the "),Lt=o("code"),zl=n("labels"),xl=n(`. In
such models, passing the `),Bt=o("code"),Pl=n("labels"),Al=n(" is the preferred way to handle training."),ia=p(),xs=o("p"),Il=n("Please check each model\u2019s docs to see how they handle these input IDs for sequence to sequence training."),ha=p(),X=o("h3"),ue=o("a"),St=o("span"),m(Ye.$$.fragment),Cl=p(),Ft=o("span"),Dl=n("Feed Forward Chunking"),pa=p(),fe=o("p"),Ml=n(`In each residual attention block in transformers the self-attention layer is usually followed by 2 feed forward layers.
The intermediate embedding size of the feed forward layers is often bigger than the hidden size of the model (e.g., for
`),Nt=o("code"),Ll=n("bert-base-uncased"),Bl=n(")."),da=p(),w=o("p"),Sl=n("For an input of size "),Rt=o("code"),Fl=n("[batch_size, sequence_length]"),Nl=n(`, the memory required to store the intermediate feed forward
embeddings `),Ot=o("code"),Rl=n("[batch_size, sequence_length, config.intermediate_size]"),Ol=n(` can account for a large fraction of the memory
use. The authors of `),Qe=o("a"),Hl=n("Reformer: The Efficient Transformer"),Gl=n(` noticed that since the
computation is independent of the `),Ht=o("code"),Wl=n("sequence_length"),Ul=n(` dimension, it is mathematically equivalent to compute the output
embeddings of both feed forward layers `),Gt=o("code"),Vl=n("[batch_size, config.hidden_size]_0, ..., [batch_size, config.hidden_size]_n"),Xl=n(`
individually and concat them afterward to `),Wt=o("code"),Yl=n("[batch_size, sequence_length, config.hidden_size]"),Ql=n(" with "),Ut=o("code"),Jl=n("n = sequence_length"),Kl=n(`, which trades increased computation time against reduced memory use, but yields a mathematically
`),Vt=o("strong"),Zl=n("equivalent"),ei=n(" result."),ca=p(),x=o("p"),si=n("For models employing the function "),Ps=o("a"),ti=n("apply_chunking_to_forward()"),ni=n(", the "),Xt=o("code"),ai=n("chunk_size"),oi=n(` defines the
number of output embeddings that are computed in parallel and thus defines the trade-off between memory and time
complexity. If `),Yt=o("code"),ri=n("chunk_size"),li=n(" is set to 0, no feed forward chunking is done."),this.h()},l(e){const i=gp('[data-svelte="svelte-1phssyn"]',document.head);D=r(i,"META",{name:!0,content:!0}),i.forEach(t),Qt=d(e),M=r(e,"H1",{class:!0});var fa=l(M);Y=r(fa,"A",{id:!0,class:!0,href:!0});var pi=l(Y);Ss=r(pi,"SPAN",{});var di=l(Ss);b(ve.$$.fragment,di),di.forEach(t),pi.forEach(t),Da=d(fa),Fs=r(fa,"SPAN",{});var ci=l(Fs);Ma=a(ci,"Glossary"),ci.forEach(t),fa.forEach(t),Jt=d(e),L=r(e,"H2",{class:!0});var ma=l(L);Q=r(ma,"A",{id:!0,class:!0,href:!0});var ui=l(Q);Ns=r(ui,"SPAN",{});var fi=l(Ns);b(ke.$$.fragment,fi),fi.forEach(t),ui.forEach(t),La=d(ma),Rs=r(ma,"SPAN",{});var mi=l(Rs);Ba=a(mi,"General terms"),mi.forEach(t),ma.forEach(t),Kt=d(e),u=r(e,"UL",{});var f=l(u);Os=r(f,"LI",{});var bi=l(Os);Sa=a(bi,"autoencoding models: see MLM"),bi.forEach(t),Fa=d(f),Hs=r(f,"LI",{});var _i=l(Hs);Na=a(_i,"autoregressive models: see CLM"),_i.forEach(t),Ra=d(f),Gs=r(f,"LI",{});var gi=l(Gs);Oa=a(gi,`CLM: causal language modeling, a pretraining task where the model reads the texts in order and has to predict the
next word. It\u2019s usually done by reading the whole sentence but using a mask inside the model to hide the future
tokens at a certain timestep.`),gi.forEach(t),Ha=d(f),Ws=r(f,"LI",{});var vi=l(Ws);Ga=a(vi,"deep learning: machine learning algorithms which uses neural networks with several layers."),vi.forEach(t),Wa=d(f),Us=r(f,"LI",{});var ki=l(Us);Ua=a(ki,`MLM: masked language modeling, a pretraining task where the model sees a corrupted version of the texts, usually done
by masking some tokens randomly, and has to predict the original text.`),ki.forEach(t),Va=d(f),Vs=r(f,"LI",{});var wi=l(Vs);Xa=a(wi,"multimodal: a task that combines texts with another kind of inputs (for instance images)."),wi.forEach(t),Ya=d(f),Xs=r(f,"LI",{});var yi=l(Xs);Qa=a(yi,`NLG: natural language generation, all tasks related to generating text (for instance talk with transformers,
translation).`),yi.forEach(t),Ja=d(f),Ys=r(f,"LI",{});var $i=l(Ys);Ka=a($i,"NLP: natural language processing, a generic way to say \u201Cdeal with texts\u201D."),$i.forEach(t),Za=d(f),Qs=r(f,"LI",{});var Ei=l(Qs);eo=a(Ei,`NLU: natural language understanding, all tasks related to understanding what is in a text (for instance classifying
the whole text, individual words).`),Ei.forEach(t),so=d(f),Js=r(f,"LI",{});var ji=l(Js);to=a(ji,`pretrained model: a model that has been pretrained on some data (for instance all of Wikipedia). Pretraining methods
involve a self-supervised objective, which can be reading the text and trying to predict the next word (see CLM) or
masking some words and trying to predict them (see MLM).`),ji.forEach(t),no=d(f),Ks=r(f,"LI",{});var qi=l(Ks);ao=a(qi,"RNN: recurrent neural network, a type of model that uses a loop over a layer to process texts."),qi.forEach(t),oo=d(f),Zs=r(f,"LI",{});var Ti=l(Zs);ro=a(Ti,"self-attention: each element of the input finds out which other elements of the input they should attend to."),Ti.forEach(t),lo=d(f),B=r(f,"LI",{});var As=l(B);io=a(As,`seq2seq or sequence-to-sequence: models that generate a new sequence from an input, like translation models, or
summarization models (such as `),Je=r(As,"A",{href:!0});var zi=l(Je);ho=a(zi,"Bart"),zi.forEach(t),po=a(As," or "),Ke=r(As,"A",{href:!0});var xi=l(Ke);co=a(xi,"T5"),xi.forEach(t),uo=a(As,")."),As.forEach(t),fo=d(f),et=r(f,"LI",{});var Pi=l(et);mo=a(Pi,`token: a part of a sentence, usually a word, but can also be a subword (non-common words are often split in subwords)
or a punctuation symbol.`),Pi.forEach(t),bo=d(f),st=r(f,"LI",{});var Ai=l(st);_o=a(Ai,"transformer: self-attention based deep learning model architecture."),Ai.forEach(t),f.forEach(t),Zt=d(e),S=r(e,"H2",{class:!0});var ba=l(S);J=r(ba,"A",{id:!0,class:!0,href:!0});var Ii=l(J);tt=r(Ii,"SPAN",{});var Ci=l(tt);b(we.$$.fragment,Ci),Ci.forEach(t),Ii.forEach(t),go=d(ba),nt=r(ba,"SPAN",{});var Di=l(nt);vo=a(Di,"Model inputs"),Di.forEach(t),ba.forEach(t),en=d(e),Ze=r(e,"P",{});var Mi=l(Ze);ko=a(Mi,`Every model is different yet bears similarities with the others. Therefore most models use the same inputs, which are
detailed here alongside usage examples.`),Mi.forEach(t),sn=d(e),F=r(e,"H3",{class:!0});var _a=l(F);K=r(_a,"A",{id:!0,class:!0,href:!0});var Li=l(K);at=r(Li,"SPAN",{});var Bi=l(at);b(ye.$$.fragment,Bi),Bi.forEach(t),Li.forEach(t),wo=d(_a),ot=r(_a,"SPAN",{});var Si=l(ot);yo=a(Si,"Input IDs"),Si.forEach(t),_a.forEach(t),tn=d(e),Z=r(e,"P",{});var ga=l(Z);$o=a(ga,"The input ids are often the only required parameters to be passed to the model as input. "),rt=r(ga,"EM",{});var Fi=l(rt);Eo=a(Fi,`They are token indices,
numerical representations of tokens building the sequences that will be used as input by the model`),Fi.forEach(t),jo=a(ga,"."),ga.forEach(t),nn=d(e),b($e.$$.fragment,e),an=d(e),ee=r(e,"P",{});var va=l(ee);qo=a(va,`Each tokenizer works differently but the underlying mechanism remains the same. Here\u2019s an example using the BERT
tokenizer, which is a `),Ee=r(va,"A",{href:!0,rel:!0});var Ni=l(Ee);To=a(Ni,"WordPiece"),Ni.forEach(t),zo=a(va," tokenizer:"),va.forEach(t),on=d(e),b(je.$$.fragment,e),rn=d(e),es=r(e,"P",{});var Ri=l(es);xo=a(Ri,"The tokenizer takes care of splitting the sequence into tokens available in the tokenizer vocabulary."),Ri.forEach(t),ln=d(e),b(qe.$$.fragment,e),hn=d(e),ss=r(e,"P",{});var Oi=l(ss);Po=a(Oi,`The tokens are either words or subwords. Here for instance, \u201CVRAM\u201D wasn\u2019t in the model vocabulary, so it\u2019s been split
in \u201CV\u201D, \u201CRA\u201D and \u201CM\u201D. To indicate those tokens are not separate words but parts of the same word, a double-hash prefix
is added for \u201CRA\u201D and \u201CM\u201D:`),Oi.forEach(t),pn=d(e),b(Te.$$.fragment,e),dn=d(e),se=r(e,"P",{});var ka=l(se);Ao=a(ka,`These tokens can then be converted into IDs which are understandable by the model. This can be done by directly feeding
the sentence to the tokenizer, which leverages the Rust implementation of `),ze=r(ka,"A",{href:!0,rel:!0});var Hi=l(ze);Io=a(Hi,"\u{1F917} Tokenizers"),Hi.forEach(t),Co=a(ka," for peak performance."),ka.forEach(t),cn=d(e),b(xe.$$.fragment,e),un=d(e),ts=r(e,"P",{});var Gi=l(ts);Do=a(Gi,`The tokenizer returns a dictionary with all the arguments necessary for its corresponding model to work properly. The
token indices are under the key \u201Cinput_ids\u201D:`),Gi.forEach(t),fn=d(e),b(Pe.$$.fragment,e),mn=d(e),ns=r(e,"P",{});var Wi=l(ns);Mo=a(Wi,`Note that the tokenizer automatically adds \u201Cspecial tokens\u201D (if the associated model relies on them) which are special
IDs the model sometimes uses.`),Wi.forEach(t),bn=d(e),as=r(e,"P",{});var Ui=l(as);Lo=a(Ui,"If we decode the previous sequence of ids,"),Ui.forEach(t),_n=d(e),b(Ae.$$.fragment,e),gn=d(e),os=r(e,"P",{});var Vi=l(os);Bo=a(Vi,"we will see"),Vi.forEach(t),vn=d(e),b(Ie.$$.fragment,e),kn=d(e),te=r(e,"P",{});var wa=l(te);So=a(wa,"because this is the way a "),rs=r(wa,"A",{href:!0});var Xi=l(rs);Fo=a(Xi,"BertModel"),Xi.forEach(t),No=a(wa," is going to expect its inputs."),wa.forEach(t),wn=d(e),N=r(e,"H3",{class:!0});var ya=l(N);ne=r(ya,"A",{id:!0,class:!0,href:!0});var Yi=l(ne);lt=r(Yi,"SPAN",{});var Qi=l(lt);b(Ce.$$.fragment,Qi),Qi.forEach(t),Yi.forEach(t),Ro=d(ya),it=r(ya,"SPAN",{});var Ji=l(it);Oo=a(Ji,"Attention mask"),Ji.forEach(t),ya.forEach(t),yn=d(e),ls=r(e,"P",{});var Ki=l(ls);Ho=a(Ki,"The attention mask is an optional argument used when batching sequences together."),Ki.forEach(t),$n=d(e),b(De.$$.fragment,e),En=d(e),is=r(e,"P",{});var Zi=l(is);Go=a(Zi,"This argument indicates to the model which tokens should be attended to, and which should not."),Zi.forEach(t),jn=d(e),hs=r(e,"P",{});var eh=l(hs);Wo=a(eh,"For example, consider these two sequences:"),eh.forEach(t),qn=d(e),b(Me.$$.fragment,e),Tn=d(e),ps=r(e,"P",{});var sh=l(ps);Uo=a(sh,"The encoded versions have different lengths:"),sh.forEach(t),zn=d(e),b(Le.$$.fragment,e),xn=d(e),ds=r(e,"P",{});var th=l(ds);Vo=a(th,`Therefore, we can\u2019t put them together in the same tensor as-is. The first sequence needs to be padded up to the length
of the second one, or the second one needs to be truncated down to the length of the first one.`),th.forEach(t),Pn=d(e),cs=r(e,"P",{});var nh=l(cs);Xo=a(nh,`In the first case, the list of IDs will be extended by the padding indices. We can pass a list to the tokenizer and ask
it to pad like this:`),nh.forEach(t),An=d(e),b(Be.$$.fragment,e),In=d(e),us=r(e,"P",{});var ah=l(us);Yo=a(ah,"We can see that 0s have been added on the right of the first sentence to make it the same length as the second one:"),ah.forEach(t),Cn=d(e),b(Se.$$.fragment,e),Dn=d(e),q=r(e,"P",{});var me=l(q);Qo=a(me,`This can then be converted into a tensor in PyTorch or TensorFlow. The attention mask is a binary tensor indicating the
position of the padded indices so that the model does not attend to them. For the `),fs=r(me,"A",{href:!0});var oh=l(fs);Jo=a(oh,"BertTokenizer"),oh.forEach(t),Ko=a(me,`,
`),ht=r(me,"CODE",{});var rh=l(ht);Zo=a(rh,"1"),rh.forEach(t),er=a(me," indicates a value that should be attended to, while "),pt=r(me,"CODE",{});var lh=l(pt);sr=a(lh,"0"),lh.forEach(t),tr=a(me,` indicates a padded value. This attention mask is
in the dictionary returned by the tokenizer under the key \u201Cattention_mask\u201D:`),me.forEach(t),Mn=d(e),b(Fe.$$.fragment,e),Ln=d(e),R=r(e,"H3",{class:!0});var $a=l(R);ae=r($a,"A",{id:!0,class:!0,href:!0});var ih=l(ae);dt=r(ih,"SPAN",{});var hh=l(dt);b(Ne.$$.fragment,hh),hh.forEach(t),ih.forEach(t),nr=d($a),ct=r($a,"SPAN",{});var ph=l(ct);ar=a(ph,"Token Type IDs"),ph.forEach(t),$a.forEach(t),Bn=d(e),ms=r(e,"P",{});var dh=l(ms);or=a(dh,"Some models\u2019 purpose is to do classification on pairs of sentences or question answering."),dh.forEach(t),Sn=d(e),b(Re.$$.fragment,e),Fn=d(e),P=r(e,"P",{});var Is=l(P);rr=a(Is,`These require two different sequences to be joined in a single \u201Cinput_ids\u201D entry, which usually is performed with the
help of special tokens, such as the classifier (`),ut=r(Is,"CODE",{});var ch=l(ut);lr=a(ch,"[CLS]"),ch.forEach(t),ir=a(Is,") and separator ("),ft=r(Is,"CODE",{});var uh=l(ft);hr=a(uh,"[SEP]"),uh.forEach(t),pr=a(Is,`) tokens. For example, the BERT
model builds its two sequence input as such:`),Is.forEach(t),Nn=d(e),b(Oe.$$.fragment,e),Rn=d(e),oe=r(e,"P",{});var Ea=l(oe);dr=a(Ea,"We can use our tokenizer to automatically generate such a sentence by passing the two sequences to "),mt=r(Ea,"CODE",{});var fh=l(mt);cr=a(fh,"tokenizer"),fh.forEach(t),ur=a(Ea,` as two
arguments (and not a list, like before) like this:`),Ea.forEach(t),On=d(e),b(He.$$.fragment,e),Hn=d(e),bs=r(e,"P",{});var mh=l(bs);fr=a(mh,"which will return:"),mh.forEach(t),Gn=d(e),b(Ge.$$.fragment,e),Wn=d(e),_s=r(e,"P",{});var bh=l(_s);mr=a(bh,`This is enough for some models to understand where one sequence ends and where another begins. However, other models,
such as BERT, also deploy token type IDs (also called segment IDs). They are represented as a binary mask identifying
the two types of sequence in the model.`),bh.forEach(t),Un=d(e),gs=r(e,"P",{});var _h=l(gs);br=a(_h,"The tokenizer returns this mask as the \u201Ctoken_type_ids\u201D entry:"),_h.forEach(t),Vn=d(e),b(We.$$.fragment,e),Xn=d(e),A=r(e,"P",{});var Cs=l(A);_r=a(Cs,"The first sequence, the \u201Ccontext\u201D used for the question, has all its tokens represented by a "),bt=r(Cs,"CODE",{});var gh=l(bt);gr=a(gh,"0"),gh.forEach(t),vr=a(Cs,`, whereas the
second sequence, corresponding to the \u201Cquestion\u201D, has all its tokens represented by a `),_t=r(Cs,"CODE",{});var vh=l(_t);kr=a(vh,"1"),vh.forEach(t),wr=a(Cs,"."),Cs.forEach(t),Yn=d(e),I=r(e,"P",{});var Ds=l(I);yr=a(Ds,"Some models, like "),vs=r(Ds,"A",{href:!0});var kh=l(vs);$r=a(kh,"XLNetModel"),kh.forEach(t),Er=a(Ds," use an additional token represented by a "),gt=r(Ds,"CODE",{});var wh=l(gt);jr=a(wh,"2"),wh.forEach(t),qr=a(Ds,"."),Ds.forEach(t),Qn=d(e),O=r(e,"H3",{class:!0});var ja=l(O);re=r(ja,"A",{id:!0,class:!0,href:!0});var yh=l(re);vt=r(yh,"SPAN",{});var $h=l(vt);b(Ue.$$.fragment,$h),$h.forEach(t),yh.forEach(t),Tr=d(ja),kt=r(ja,"SPAN",{});var Eh=l(kt);zr=a(Eh,"Position IDs"),Eh.forEach(t),ja.forEach(t),Jn=d(e),le=r(e,"P",{});var qa=l(le);xr=a(qa,`Contrary to RNNs that have the position of each token embedded within them, transformers are unaware of the position of
each token. Therefore, the position IDs (`),wt=r(qa,"CODE",{});var jh=l(wt);Pr=a(jh,"position_ids"),jh.forEach(t),Ar=a(qa,`) are used by the model to identify each token\u2019s position in
the list of tokens.`),qa.forEach(t),Kn=d(e),ie=r(e,"P",{});var Ta=l(ie);Ir=a(Ta,"They are an optional parameter. If no "),yt=r(Ta,"CODE",{});var qh=l(yt);Cr=a(qh,"position_ids"),qh.forEach(t),Dr=a(Ta,` are passed to the model, the IDs are automatically created as
absolute positional embeddings.`),Ta.forEach(t),Zn=d(e),he=r(e,"P",{});var za=l(he);Mr=a(za,"Absolute positional embeddings are selected in the range "),$t=r(za,"CODE",{});var Th=l($t);Lr=a(Th,"[0, config.max_position_embeddings - 1]"),Th.forEach(t),Br=a(za,`. Some models use
other types of positional embeddings, such as sinusoidal position embeddings or relative position embeddings.`),za.forEach(t),ea=d(e),H=r(e,"H3",{class:!0});var xa=l(H);pe=r(xa,"A",{id:!0,class:!0,href:!0});var zh=l(pe);Et=r(zh,"SPAN",{});var xh=l(Et);b(Ve.$$.fragment,xh),xh.forEach(t),zh.forEach(t),Sr=d(xa),jt=r(xa,"SPAN",{});var Ph=l(jt);Fr=a(Ph,"Labels"),Ph.forEach(t),xa.forEach(t),sa=d(e),ks=r(e,"P",{});var Ah=l(ks);Nr=a(Ah,`The labels are an optional argument which can be passed in order for the model to compute the loss itself. These labels
should be the expected prediction of the model: it will use the standard loss in order to compute the loss between its
predictions and the expected value (the label).`),Ah.forEach(t),ta=d(e),ws=r(e,"P",{});var Ih=l(ws);Rr=a(Ih,"These labels are different according to the model head, for example:"),Ih.forEach(t),na=d(e),T=r(e,"UL",{});var be=l(T);G=r(be,"LI",{});var Ms=l(G);Or=a(Ms,"For sequence classification models (e.g., "),ys=r(Ms,"A",{href:!0});var Ch=l(ys);Hr=a(Ch,"BertForSequenceClassification"),Ch.forEach(t),Gr=a(Ms,`), the model expects a
tensor of dimension `),qt=r(Ms,"CODE",{});var Dh=l(qt);Wr=a(Dh,"(batch_size)"),Dh.forEach(t),Ur=a(Ms,` with each value of the batch corresponding to the expected label of the
entire sequence.`),Ms.forEach(t),Vr=d(be),W=r(be,"LI",{});var Ls=l(W);Xr=a(Ls,"For token classification models (e.g., "),$s=r(Ls,"A",{href:!0});var Mh=l($s);Yr=a(Mh,"BertForTokenClassification"),Mh.forEach(t),Qr=a(Ls,`), the model expects a tensor
of dimension `),Tt=r(Ls,"CODE",{});var Lh=l(Tt);Jr=a(Lh,"(batch_size, seq_length)"),Lh.forEach(t),Kr=a(Ls,` with each value corresponding to the expected label of each individual
token.`),Ls.forEach(t),Zr=d(be),U=r(be,"LI",{});var Bs=l(U);el=a(Bs,"For masked language modeling (e.g., "),Es=r(Bs,"A",{href:!0});var Bh=l(Es);sl=a(Bh,"BertForMaskedLM"),Bh.forEach(t),tl=a(Bs,`), the model expects a tensor of dimension
`),zt=r(Bs,"CODE",{});var Sh=l(zt);nl=a(Sh,"(batch_size, seq_length)"),Sh.forEach(t),al=a(Bs,` with each value corresponding to the expected label of each individual token: the
labels being the token ID for the masked token, and values to be ignored for the rest (usually -100).`),Bs.forEach(t),ol=d(be),$=r(be,"LI",{});var j=l($);rl=a(j,"For sequence to sequence tasks,(e.g., "),js=r(j,"A",{href:!0});var Fh=l(js);ll=a(Fh,"BartForConditionalGeneration"),Fh.forEach(t),il=a(j,`,
`),qs=r(j,"A",{href:!0});var Nh=l(qs);hl=a(Nh,"MBartForConditionalGeneration"),Nh.forEach(t),pl=a(j,"), the model expects a tensor of dimension "),xt=r(j,"CODE",{});var Rh=l(xt);dl=a(Rh,"(batch_size, tgt_seq_length)"),Rh.forEach(t),cl=a(j,` with each value corresponding to the target sequences associated with each input sequence. During
training, both `),Pt=r(j,"EM",{});var Oh=l(Pt);ul=a(Oh,"BART"),Oh.forEach(t),fl=a(j," and "),At=r(j,"EM",{});var Hh=l(At);ml=a(Hh,"T5"),Hh.forEach(t),bl=a(j," will make the appropriate "),It=r(j,"EM",{});var Gh=l(It);_l=a(Gh,"decoder_input_ids"),Gh.forEach(t),gl=a(j,` and decoder attention masks internally.
They usually do not need to be supplied. This does not apply to models leveraging the Encoder-Decoder framework. See
the documentation of each model for more information on each specific model\u2019s labels.`),j.forEach(t),be.forEach(t),aa=d(e),de=r(e,"P",{});var Pa=l(de);vl=a(Pa,"The base models (e.g., "),Ts=r(Pa,"A",{href:!0});var Wh=l(Ts);kl=a(Wh,"BertModel"),Wh.forEach(t),wl=a(Pa,`) do not accept labels, as these are the base transformer
models, simply outputting features.`),Pa.forEach(t),oa=d(e),V=r(e,"H3",{class:!0});var Aa=l(V);ce=r(Aa,"A",{id:!0,class:!0,href:!0});var Uh=l(ce);Ct=r(Uh,"SPAN",{});var Vh=l(Ct);b(Xe.$$.fragment,Vh),Vh.forEach(t),Uh.forEach(t),yl=d(Aa),Dt=r(Aa,"SPAN",{});var Xh=l(Dt);$l=a(Xh,"Decoder input IDs"),Xh.forEach(t),Aa.forEach(t),ra=d(e),zs=r(e,"P",{});var Yh=l(zs);El=a(Yh,`This input is specific to encoder-decoder models, and contains the input IDs that will be fed to the decoder. These
inputs should be used for sequence to sequence tasks, such as translation or summarization, and are usually built in a
way specific to each model.`),Yh.forEach(t),la=d(e),z=r(e,"P",{});var _e=l(z);jl=a(_e,"Most encoder-decoder models (BART, T5) create their "),Mt=r(_e,"CODE",{});var Qh=l(Mt);ql=a(Qh,"decoder_input_ids"),Qh.forEach(t),Tl=a(_e," on their own from the "),Lt=r(_e,"CODE",{});var Jh=l(Lt);zl=a(Jh,"labels"),Jh.forEach(t),xl=a(_e,`. In
such models, passing the `),Bt=r(_e,"CODE",{});var Kh=l(Bt);Pl=a(Kh,"labels"),Kh.forEach(t),Al=a(_e," is the preferred way to handle training."),_e.forEach(t),ia=d(e),xs=r(e,"P",{});var Zh=l(xs);Il=a(Zh,"Please check each model\u2019s docs to see how they handle these input IDs for sequence to sequence training."),Zh.forEach(t),ha=d(e),X=r(e,"H3",{class:!0});var Ia=l(X);ue=r(Ia,"A",{id:!0,class:!0,href:!0});var ep=l(ue);St=r(ep,"SPAN",{});var sp=l(St);b(Ye.$$.fragment,sp),sp.forEach(t),ep.forEach(t),Cl=d(Ia),Ft=r(Ia,"SPAN",{});var tp=l(Ft);Dl=a(tp,"Feed Forward Chunking"),tp.forEach(t),Ia.forEach(t),pa=d(e),fe=r(e,"P",{});var Ca=l(fe);Ml=a(Ca,`In each residual attention block in transformers the self-attention layer is usually followed by 2 feed forward layers.
The intermediate embedding size of the feed forward layers is often bigger than the hidden size of the model (e.g., for
`),Nt=r(Ca,"CODE",{});var np=l(Nt);Ll=a(np,"bert-base-uncased"),np.forEach(t),Bl=a(Ca,")."),Ca.forEach(t),da=d(e),w=r(e,"P",{});var y=l(w);Sl=a(y,"For an input of size "),Rt=r(y,"CODE",{});var ap=l(Rt);Fl=a(ap,"[batch_size, sequence_length]"),ap.forEach(t),Nl=a(y,`, the memory required to store the intermediate feed forward
embeddings `),Ot=r(y,"CODE",{});var op=l(Ot);Rl=a(op,"[batch_size, sequence_length, config.intermediate_size]"),op.forEach(t),Ol=a(y,` can account for a large fraction of the memory
use. The authors of `),Qe=r(y,"A",{href:!0,rel:!0});var rp=l(Qe);Hl=a(rp,"Reformer: The Efficient Transformer"),rp.forEach(t),Gl=a(y,` noticed that since the
computation is independent of the `),Ht=r(y,"CODE",{});var lp=l(Ht);Wl=a(lp,"sequence_length"),lp.forEach(t),Ul=a(y,` dimension, it is mathematically equivalent to compute the output
embeddings of both feed forward layers `),Gt=r(y,"CODE",{});var ip=l(Gt);Vl=a(ip,"[batch_size, config.hidden_size]_0, ..., [batch_size, config.hidden_size]_n"),ip.forEach(t),Xl=a(y,`
individually and concat them afterward to `),Wt=r(y,"CODE",{});var hp=l(Wt);Yl=a(hp,"[batch_size, sequence_length, config.hidden_size]"),hp.forEach(t),Ql=a(y," with "),Ut=r(y,"CODE",{});var pp=l(Ut);Jl=a(pp,"n = sequence_length"),pp.forEach(t),Kl=a(y,`, which trades increased computation time against reduced memory use, but yields a mathematically
`),Vt=r(y,"STRONG",{});var dp=l(Vt);Zl=a(dp,"equivalent"),dp.forEach(t),ei=a(y," result."),y.forEach(t),ca=d(e),x=r(e,"P",{});var ge=l(x);si=a(ge,"For models employing the function "),Ps=r(ge,"A",{href:!0});var cp=l(Ps);ti=a(cp,"apply_chunking_to_forward()"),cp.forEach(t),ni=a(ge,", the "),Xt=r(ge,"CODE",{});var up=l(Xt);ai=a(up,"chunk_size"),up.forEach(t),oi=a(ge,` defines the
number of output embeddings that are computed in parallel and thus defines the trade-off between memory and time
complexity. If `),Yt=r(ge,"CODE",{});var fp=l(Yt);ri=a(fp,"chunk_size"),fp.forEach(t),li=a(ge," is set to 0, no feed forward chunking is done."),ge.forEach(t),this.h()},h(){c(D,"name","hf:doc:metadata"),c(D,"content",JSON.stringify(yp)),c(Y,"id","glossary"),c(Y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Y,"href","#glossary"),c(M,"class","relative group"),c(Q,"id","general-terms"),c(Q,"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"),c(Q,"href","#general-terms"),c(L,"class","relative group"),c(Je,"href","model_doc/bart"),c(Ke,"href","model_doc/t5"),c(J,"id","model-inputs"),c(J,"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"),c(J,"href","#model-inputs"),c(S,"class","relative group"),c(K,"id","input-ids"),c(K,"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"),c(K,"href","#input-ids"),c(F,"class","relative group"),c(Ee,"href","https://arxiv.org/pdf/1609.08144.pdf"),c(Ee,"rel","nofollow"),c(ze,"href","https://github.com/huggingface/tokenizers"),c(ze,"rel","nofollow"),c(rs,"href","/docs/transformers/pr_19907/en/model_doc/bert#transformers.BertModel"),c(ne,"id","attention-mask"),c(ne,"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"),c(ne,"href","#attention-mask"),c(N,"class","relative group"),c(fs,"href","/docs/transformers/pr_19907/en/model_doc/bert#transformers.BertTokenizer"),c(ae,"id","token-type-ids"),c(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"),c(ae,"href","#token-type-ids"),c(R,"class","relative group"),c(vs,"href","/docs/transformers/pr_19907/en/model_doc/xlnet#transformers.XLNetModel"),c(re,"id","position-ids"),c(re,"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"),c(re,"href","#position-ids"),c(O,"class","relative group"),c(pe,"id","labels"),c(pe,"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"),c(pe,"href","#labels"),c(H,"class","relative group"),c(ys,"href","/docs/transformers/pr_19907/en/model_doc/bert#transformers.BertForSequenceClassification"),c($s,"href","/docs/transformers/pr_19907/en/model_doc/bert#transformers.BertForTokenClassification"),c(Es,"href","/docs/transformers/pr_19907/en/model_doc/bert#transformers.BertForMaskedLM"),c(js,"href","/docs/transformers/pr_19907/en/model_doc/bart#transformers.BartForConditionalGeneration"),c(qs,"href","/docs/transformers/pr_19907/en/model_doc/mbart#transformers.MBartForConditionalGeneration"),c(Ts,"href","/docs/transformers/pr_19907/en/model_doc/bert#transformers.BertModel"),c(ce,"id","decoder-input-ids"),c(ce,"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"),c(ce,"href","#decoder-input-ids"),c(V,"class","relative group"),c(ue,"id","feed-forward-chunking"),c(ue,"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"),c(ue,"href","#feed-forward-chunking"),c(X,"class","relative group"),c(Qe,"href","https://arxiv.org/abs/2001.04451"),c(Qe,"rel","nofollow"),c(Ps,"href","/docs/transformers/pr_19907/en/internal/modeling_utils#transformers.apply_chunking_to_forward")},m(e,i){s(document.head,D),h(e,Qt,i),h(e,M,i),s(M,Y),s(Y,Ss),_(ve,Ss,null),s(M,Da),s(M,Fs),s(Fs,Ma),h(e,Jt,i),h(e,L,i),s(L,Q),s(Q,Ns),_(ke,Ns,null),s(L,La),s(L,Rs),s(Rs,Ba),h(e,Kt,i),h(e,u,i),s(u,Os),s(Os,Sa),s(u,Fa),s(u,Hs),s(Hs,Na),s(u,Ra),s(u,Gs),s(Gs,Oa),s(u,Ha),s(u,Ws),s(Ws,Ga),s(u,Wa),s(u,Us),s(Us,Ua),s(u,Va),s(u,Vs),s(Vs,Xa),s(u,Ya),s(u,Xs),s(Xs,Qa),s(u,Ja),s(u,Ys),s(Ys,Ka),s(u,Za),s(u,Qs),s(Qs,eo),s(u,so),s(u,Js),s(Js,to),s(u,no),s(u,Ks),s(Ks,ao),s(u,oo),s(u,Zs),s(Zs,ro),s(u,lo),s(u,B),s(B,io),s(B,Je),s(Je,ho),s(B,po),s(B,Ke),s(Ke,co),s(B,uo),s(u,fo),s(u,et),s(et,mo),s(u,bo),s(u,st),s(st,_o),h(e,Zt,i),h(e,S,i),s(S,J),s(J,tt),_(we,tt,null),s(S,go),s(S,nt),s(nt,vo),h(e,en,i),h(e,Ze,i),s(Ze,ko),h(e,sn,i),h(e,F,i),s(F,K),s(K,at),_(ye,at,null),s(F,wo),s(F,ot),s(ot,yo),h(e,tn,i),h(e,Z,i),s(Z,$o),s(Z,rt),s(rt,Eo),s(Z,jo),h(e,nn,i),_($e,e,i),h(e,an,i),h(e,ee,i),s(ee,qo),s(ee,Ee),s(Ee,To),s(ee,zo),h(e,on,i),_(je,e,i),h(e,rn,i),h(e,es,i),s(es,xo),h(e,ln,i),_(qe,e,i),h(e,hn,i),h(e,ss,i),s(ss,Po),h(e,pn,i),_(Te,e,i),h(e,dn,i),h(e,se,i),s(se,Ao),s(se,ze),s(ze,Io),s(se,Co),h(e,cn,i),_(xe,e,i),h(e,un,i),h(e,ts,i),s(ts,Do),h(e,fn,i),_(Pe,e,i),h(e,mn,i),h(e,ns,i),s(ns,Mo),h(e,bn,i),h(e,as,i),s(as,Lo),h(e,_n,i),_(Ae,e,i),h(e,gn,i),h(e,os,i),s(os,Bo),h(e,vn,i),_(Ie,e,i),h(e,kn,i),h(e,te,i),s(te,So),s(te,rs),s(rs,Fo),s(te,No),h(e,wn,i),h(e,N,i),s(N,ne),s(ne,lt),_(Ce,lt,null),s(N,Ro),s(N,it),s(it,Oo),h(e,yn,i),h(e,ls,i),s(ls,Ho),h(e,$n,i),_(De,e,i),h(e,En,i),h(e,is,i),s(is,Go),h(e,jn,i),h(e,hs,i),s(hs,Wo),h(e,qn,i),_(Me,e,i),h(e,Tn,i),h(e,ps,i),s(ps,Uo),h(e,zn,i),_(Le,e,i),h(e,xn,i),h(e,ds,i),s(ds,Vo),h(e,Pn,i),h(e,cs,i),s(cs,Xo),h(e,An,i),_(Be,e,i),h(e,In,i),h(e,us,i),s(us,Yo),h(e,Cn,i),_(Se,e,i),h(e,Dn,i),h(e,q,i),s(q,Qo),s(q,fs),s(fs,Jo),s(q,Ko),s(q,ht),s(ht,Zo),s(q,er),s(q,pt),s(pt,sr),s(q,tr),h(e,Mn,i),_(Fe,e,i),h(e,Ln,i),h(e,R,i),s(R,ae),s(ae,dt),_(Ne,dt,null),s(R,nr),s(R,ct),s(ct,ar),h(e,Bn,i),h(e,ms,i),s(ms,or),h(e,Sn,i),_(Re,e,i),h(e,Fn,i),h(e,P,i),s(P,rr),s(P,ut),s(ut,lr),s(P,ir),s(P,ft),s(ft,hr),s(P,pr),h(e,Nn,i),_(Oe,e,i),h(e,Rn,i),h(e,oe,i),s(oe,dr),s(oe,mt),s(mt,cr),s(oe,ur),h(e,On,i),_(He,e,i),h(e,Hn,i),h(e,bs,i),s(bs,fr),h(e,Gn,i),_(Ge,e,i),h(e,Wn,i),h(e,_s,i),s(_s,mr),h(e,Un,i),h(e,gs,i),s(gs,br),h(e,Vn,i),_(We,e,i),h(e,Xn,i),h(e,A,i),s(A,_r),s(A,bt),s(bt,gr),s(A,vr),s(A,_t),s(_t,kr),s(A,wr),h(e,Yn,i),h(e,I,i),s(I,yr),s(I,vs),s(vs,$r),s(I,Er),s(I,gt),s(gt,jr),s(I,qr),h(e,Qn,i),h(e,O,i),s(O,re),s(re,vt),_(Ue,vt,null),s(O,Tr),s(O,kt),s(kt,zr),h(e,Jn,i),h(e,le,i),s(le,xr),s(le,wt),s(wt,Pr),s(le,Ar),h(e,Kn,i),h(e,ie,i),s(ie,Ir),s(ie,yt),s(yt,Cr),s(ie,Dr),h(e,Zn,i),h(e,he,i),s(he,Mr),s(he,$t),s($t,Lr),s(he,Br),h(e,ea,i),h(e,H,i),s(H,pe),s(pe,Et),_(Ve,Et,null),s(H,Sr),s(H,jt),s(jt,Fr),h(e,sa,i),h(e,ks,i),s(ks,Nr),h(e,ta,i),h(e,ws,i),s(ws,Rr),h(e,na,i),h(e,T,i),s(T,G),s(G,Or),s(G,ys),s(ys,Hr),s(G,Gr),s(G,qt),s(qt,Wr),s(G,Ur),s(T,Vr),s(T,W),s(W,Xr),s(W,$s),s($s,Yr),s(W,Qr),s(W,Tt),s(Tt,Jr),s(W,Kr),s(T,Zr),s(T,U),s(U,el),s(U,Es),s(Es,sl),s(U,tl),s(U,zt),s(zt,nl),s(U,al),s(T,ol),s(T,$),s($,rl),s($,js),s(js,ll),s($,il),s($,qs),s(qs,hl),s($,pl),s($,xt),s(xt,dl),s($,cl),s($,Pt),s(Pt,ul),s($,fl),s($,At),s(At,ml),s($,bl),s($,It),s(It,_l),s($,gl),h(e,aa,i),h(e,de,i),s(de,vl),s(de,Ts),s(Ts,kl),s(de,wl),h(e,oa,i),h(e,V,i),s(V,ce),s(ce,Ct),_(Xe,Ct,null),s(V,yl),s(V,Dt),s(Dt,$l),h(e,ra,i),h(e,zs,i),s(zs,El),h(e,la,i),h(e,z,i),s(z,jl),s(z,Mt),s(Mt,ql),s(z,Tl),s(z,Lt),s(Lt,zl),s(z,xl),s(z,Bt),s(Bt,Pl),s(z,Al),h(e,ia,i),h(e,xs,i),s(xs,Il),h(e,ha,i),h(e,X,i),s(X,ue),s(ue,St),_(Ye,St,null),s(X,Cl),s(X,Ft),s(Ft,Dl),h(e,pa,i),h(e,fe,i),s(fe,Ml),s(fe,Nt),s(Nt,Ll),s(fe,Bl),h(e,da,i),h(e,w,i),s(w,Sl),s(w,Rt),s(Rt,Fl),s(w,Nl),s(w,Ot),s(Ot,Rl),s(w,Ol),s(w,Qe),s(Qe,Hl),s(w,Gl),s(w,Ht),s(Ht,Wl),s(w,Ul),s(w,Gt),s(Gt,Vl),s(w,Xl),s(w,Wt),s(Wt,Yl),s(w,Ql),s(w,Ut),s(Ut,Jl),s(w,Kl),s(w,Vt),s(Vt,Zl),s(w,ei),h(e,ca,i),h(e,x,i),s(x,si),s(x,Ps),s(Ps,ti),s(x,ni),s(x,Xt),s(Xt,ai),s(x,oi),s(x,Yt),s(Yt,ri),s(x,li),ua=!0},p:vp,i(e){ua||(g(ve.$$.fragment,e),g(ke.$$.fragment,e),g(we.$$.fragment,e),g(ye.$$.fragment,e),g($e.$$.fragment,e),g(je.$$.fragment,e),g(qe.$$.fragment,e),g(Te.$$.fragment,e),g(xe.$$.fragment,e),g(Pe.$$.fragment,e),g(Ae.$$.fragment,e),g(Ie.$$.fragment,e),g(Ce.$$.fragment,e),g(De.$$.fragment,e),g(Me.$$.fragment,e),g(Le.$$.fragment,e),g(Be.$$.fragment,e),g(Se.$$.fragment,e),g(Fe.$$.fragment,e),g(Ne.$$.fragment,e),g(Re.$$.fragment,e),g(Oe.$$.fragment,e),g(He.$$.fragment,e),g(Ge.$$.fragment,e),g(We.$$.fragment,e),g(Ue.$$.fragment,e),g(Ve.$$.fragment,e),g(Xe.$$.fragment,e),g(Ye.$$.fragment,e),ua=!0)},o(e){v(ve.$$.fragment,e),v(ke.$$.fragment,e),v(we.$$.fragment,e),v(ye.$$.fragment,e),v($e.$$.fragment,e),v(je.$$.fragment,e),v(qe.$$.fragment,e),v(Te.$$.fragment,e),v(xe.$$.fragment,e),v(Pe.$$.fragment,e),v(Ae.$$.fragment,e),v(Ie.$$.fragment,e),v(Ce.$$.fragment,e),v(De.$$.fragment,e),v(Me.$$.fragment,e),v(Le.$$.fragment,e),v(Be.$$.fragment,e),v(Se.$$.fragment,e),v(Fe.$$.fragment,e),v(Ne.$$.fragment,e),v(Re.$$.fragment,e),v(Oe.$$.fragment,e),v(He.$$.fragment,e),v(Ge.$$.fragment,e),v(We.$$.fragment,e),v(Ue.$$.fragment,e),v(Ve.$$.fragment,e),v(Xe.$$.fragment,e),v(Ye.$$.fragment,e),ua=!1},d(e){t(D),e&&t(Qt),e&&t(M),k(ve),e&&t(Jt),e&&t(L),k(ke),e&&t(Kt),e&&t(u),e&&t(Zt),e&&t(S),k(we),e&&t(en),e&&t(Ze),e&&t(sn),e&&t(F),k(ye),e&&t(tn),e&&t(Z),e&&t(nn),k($e,e),e&&t(an),e&&t(ee),e&&t(on),k(je,e),e&&t(rn),e&&t(es),e&&t(ln),k(qe,e),e&&t(hn),e&&t(ss),e&&t(pn),k(Te,e),e&&t(dn),e&&t(se),e&&t(cn),k(xe,e),e&&t(un),e&&t(ts),e&&t(fn),k(Pe,e),e&&t(mn),e&&t(ns),e&&t(bn),e&&t(as),e&&t(_n),k(Ae,e),e&&t(gn),e&&t(os),e&&t(vn),k(Ie,e),e&&t(kn),e&&t(te),e&&t(wn),e&&t(N),k(Ce),e&&t(yn),e&&t(ls),e&&t($n),k(De,e),e&&t(En),e&&t(is),e&&t(jn),e&&t(hs),e&&t(qn),k(Me,e),e&&t(Tn),e&&t(ps),e&&t(zn),k(Le,e),e&&t(xn),e&&t(ds),e&&t(Pn),e&&t(cs),e&&t(An),k(Be,e),e&&t(In),e&&t(us),e&&t(Cn),k(Se,e),e&&t(Dn),e&&t(q),e&&t(Mn),k(Fe,e),e&&t(Ln),e&&t(R),k(Ne),e&&t(Bn),e&&t(ms),e&&t(Sn),k(Re,e),e&&t(Fn),e&&t(P),e&&t(Nn),k(Oe,e),e&&t(Rn),e&&t(oe),e&&t(On),k(He,e),e&&t(Hn),e&&t(bs),e&&t(Gn),k(Ge,e),e&&t(Wn),e&&t(_s),e&&t(Un),e&&t(gs),e&&t(Vn),k(We,e),e&&t(Xn),e&&t(A),e&&t(Yn),e&&t(I),e&&t(Qn),e&&t(O),k(Ue),e&&t(Jn),e&&t(le),e&&t(Kn),e&&t(ie),e&&t(Zn),e&&t(he),e&&t(ea),e&&t(H),k(Ve),e&&t(sa),e&&t(ks),e&&t(ta),e&&t(ws),e&&t(na),e&&t(T),e&&t(aa),e&&t(de),e&&t(oa),e&&t(V),k(Xe),e&&t(ra),e&&t(zs),e&&t(la),e&&t(z),e&&t(ia),e&&t(xs),e&&t(ha),e&&t(X),k(Ye),e&&t(pa),e&&t(fe),e&&t(da),e&&t(w),e&&t(ca),e&&t(x)}}}const yp={local:"glossary",sections:[{local:"general-terms",title:"General terms"},{local:"model-inputs",sections:[{local:"input-ids",title:"Input IDs"},{local:"attention-mask",title:"Attention mask"},{local:"token-type-ids",title:"Token Type IDs"},{local:"position-ids",title:"Position IDs"},{local:"labels",title:"Labels"},{local:"decoder-input-ids",title:"Decoder input IDs"},{local:"feed-forward-chunking",title:"Feed Forward Chunking"}],title:"Model inputs"}],title:"Glossary"};function $p(hi){return kp(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class zp extends mp{constructor(D){super();bp(this,D,$p,wp,_p,{})}}export{zp as default,yp as metadata};
