import{S as Hi,i as Gi,s as Ji,e as n,k as h,w,t as a,M as Xi,c as s,d as o,m as f,a as r,x as T,h as i,b as d,N as Ki,G as e,g as u,y,q as k,o as L,B as $,v as Yi,L as Uo}from"../../chunks/vendor-hf-doc-builder.js";import{T as jn}from"../../chunks/Tip-hf-doc-builder.js";import{D as le}from"../../chunks/Docstring-hf-doc-builder.js";import{C as oo}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Fe}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Io}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Zi(x){let c,v,_,g,b;return g=new oo({props:{code:`from transformers import LiltConfig, LiltModel

# Initializing a LiLT SCUT-DLVCLab/lilt-roberta-en-base style configuration
configuration = LiltConfig()
# Randomly initializing a model from the SCUT-DLVCLab/lilt-roberta-en-base style configuration
model = LiltModel(configuration)
# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LiltConfig, LiltModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a LiLT SCUT-DLVCLab/lilt-roberta-en-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = LiltConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Randomly initializing a model from the SCUT-DLVCLab/lilt-roberta-en-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LiltModel(configuration)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){c=n("p"),v=a("Examples:"),_=h(),w(g.$$.fragment)},l(l){c=s(l,"P",{});var m=r(c);v=i(m,"Examples:"),m.forEach(o),_=f(l),T(g.$$.fragment,l)},m(l,m){u(l,c,m),e(c,v),u(l,_,m),y(g,l,m),b=!0},p:Uo,i(l){b||(k(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&o(c),l&&o(_),$(g,l)}}}function el(x){let c,v,_,g,b;return{c(){c=n("p"),v=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),g=a("Module"),b=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var m=r(c);v=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(m,"CODE",{});var C=r(_);g=i(C,"Module"),C.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){u(l,c,m),e(c,v),e(c,_),e(_,g),e(c,b)},d(l){l&&o(c)}}}function tl(x){let c,v,_,g,b;return g=new oo({props:{code:`from transformers import AutoTokenizer, AutoModel
from datasets import load_dataset

tokenizer = AutoTokenizer.from_pretrained("SCUT-DLVCLab/lilt-roberta-en-base")
model = AutoModel.from_pretrained("SCUT-DLVCLab/lilt-roberta-en-base")

dataset = load_dataset("nielsr/funsd-layoutlmv3", split="train")
example = dataset[0]
words = example["tokens"]
boxes = example["bboxes"]

encoding = tokenizer(words, boxes=boxes, return_tensors="pt")

outputs = model(**encoding)
last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;SCUT-DLVCLab/lilt-roberta-en-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModel.from_pretrained(<span class="hljs-string">&quot;SCUT-DLVCLab/lilt-roberta-en-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;nielsr/funsd-layoutlmv3&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>example = dataset[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>words = example[<span class="hljs-string">&quot;tokens&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes = example[<span class="hljs-string">&quot;bboxes&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(words, boxes=boxes, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){c=n("p"),v=a("Examples:"),_=h(),w(g.$$.fragment)},l(l){c=s(l,"P",{});var m=r(c);v=i(m,"Examples:"),m.forEach(o),_=f(l),T(g.$$.fragment,l)},m(l,m){u(l,c,m),e(c,v),u(l,_,m),y(g,l,m),b=!0},p:Uo,i(l){b||(k(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&o(c),l&&o(_),$(g,l)}}}function ol(x){let c,v,_,g,b;return{c(){c=n("p"),v=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),g=a("Module"),b=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var m=r(c);v=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(m,"CODE",{});var C=r(_);g=i(C,"Module"),C.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){u(l,c,m),e(c,v),e(c,_),e(_,g),e(c,b)},d(l){l&&o(c)}}}function nl(x){let c,v,_,g,b;return g=new oo({props:{code:`from transformers import AutoTokenizer, AutoModelForSequenceClassification
from datasets import load_dataset

tokenizer = AutoTokenizer.from_pretrained("SCUT-DLVCLab/lilt-roberta-en-base")
model = AutoModelForSequenceClassification.from_pretrained("SCUT-DLVCLab/lilt-roberta-en-base")

dataset = load_dataset("nielsr/funsd-layoutlmv3", split="train")
example = dataset[0]
words = example["tokens"]
boxes = example["bboxes"]

encoding = tokenizer(words, boxes=boxes, return_tensors="pt")

outputs = model(**encoding)
predicted_class_idx = outputs.logits.argmax(-1).item()
predicted_class = model.config.id2label[predicted_class_idx]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForSequenceClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;SCUT-DLVCLab/lilt-roberta-en-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;SCUT-DLVCLab/lilt-roberta-en-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;nielsr/funsd-layoutlmv3&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>example = dataset[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>words = example[<span class="hljs-string">&quot;tokens&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes = example[<span class="hljs-string">&quot;bboxes&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(words, boxes=boxes, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_idx = outputs.logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class = model.config.id2label[predicted_class_idx]`}}),{c(){c=n("p"),v=a("Examples:"),_=h(),w(g.$$.fragment)},l(l){c=s(l,"P",{});var m=r(c);v=i(m,"Examples:"),m.forEach(o),_=f(l),T(g.$$.fragment,l)},m(l,m){u(l,c,m),e(c,v),u(l,_,m),y(g,l,m),b=!0},p:Uo,i(l){b||(k(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&o(c),l&&o(_),$(g,l)}}}function sl(x){let c,v,_,g,b;return{c(){c=n("p"),v=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),g=a("Module"),b=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var m=r(c);v=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(m,"CODE",{});var C=r(_);g=i(C,"Module"),C.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){u(l,c,m),e(c,v),e(c,_),e(_,g),e(c,b)},d(l){l&&o(c)}}}function rl(x){let c,v,_,g,b;return g=new oo({props:{code:`from transformers import AutoTokenizer, AutoModelForTokenClassification
from datasets import load_dataset

tokenizer = AutoTokenizer.from_pretrained("SCUT-DLVCLab/lilt-roberta-en-base")
model = AutoModelForTokenClassification.from_pretrained("SCUT-DLVCLab/lilt-roberta-en-base")

dataset = load_dataset("nielsr/funsd-layoutlmv3", split="train")
example = dataset[0]
words = example["tokens"]
boxes = example["bboxes"]

encoding = tokenizer(words, boxes=boxes, return_tensors="pt")

outputs = model(**encoding)
predicted_class_indices = outputs.logits.argmax(-1)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForTokenClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;SCUT-DLVCLab/lilt-roberta-en-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForTokenClassification.from_pretrained(<span class="hljs-string">&quot;SCUT-DLVCLab/lilt-roberta-en-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;nielsr/funsd-layoutlmv3&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>example = dataset[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>words = example[<span class="hljs-string">&quot;tokens&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes = example[<span class="hljs-string">&quot;bboxes&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(words, boxes=boxes, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_indices = outputs.logits.argmax(-<span class="hljs-number">1</span>)`}}),{c(){c=n("p"),v=a("Examples:"),_=h(),w(g.$$.fragment)},l(l){c=s(l,"P",{});var m=r(c);v=i(m,"Examples:"),m.forEach(o),_=f(l),T(g.$$.fragment,l)},m(l,m){u(l,c,m),e(c,v),u(l,_,m),y(g,l,m),b=!0},p:Uo,i(l){b||(k(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&o(c),l&&o(_),$(g,l)}}}function al(x){let c,v,_,g,b;return{c(){c=n("p"),v=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),g=a("Module"),b=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var m=r(c);v=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(m,"CODE",{});var C=r(_);g=i(C,"Module"),C.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){u(l,c,m),e(c,v),e(c,_),e(_,g),e(c,b)},d(l){l&&o(c)}}}function il(x){let c,v,_,g,b;return g=new oo({props:{code:`from transformers import AutoTokenizer, AutoModelForQuestionAnswering
from datasets import load_dataset

tokenizer = AutoTokenizer.from_pretrained("SCUT-DLVCLab/lilt-roberta-en-base")
model = AutoModelForQuestionAnswering.from_pretrained("SCUT-DLVCLab/lilt-roberta-en-base")

dataset = load_dataset("nielsr/funsd-layoutlmv3", split="train")
example = dataset[0]
words = example["tokens"]
boxes = example["bboxes"]

encoding = tokenizer(words, boxes=boxes, return_tensors="pt")

outputs = model(**encoding)

answer_start_index = outputs.start_logits.argmax()
answer_end_index = outputs.end_logits.argmax()

predict_answer_tokens = encoding.input_ids[0, answer_start_index : answer_end_index + 1]
predicted_answer = tokenizer.decode(predict_answer_tokens)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;SCUT-DLVCLab/lilt-roberta-en-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;SCUT-DLVCLab/lilt-roberta-en-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;nielsr/funsd-layoutlmv3&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>example = dataset[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>words = example[<span class="hljs-string">&quot;tokens&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes = example[<span class="hljs-string">&quot;bboxes&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(words, boxes=boxes, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding)

<span class="hljs-meta">&gt;&gt;&gt; </span>answer_start_index = outputs.start_logits.argmax()
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_end_index = outputs.end_logits.argmax()

<span class="hljs-meta">&gt;&gt;&gt; </span>predict_answer_tokens = encoding.input_ids[<span class="hljs-number">0</span>, answer_start_index : answer_end_index + <span class="hljs-number">1</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_answer = tokenizer.decode(predict_answer_tokens)`}}),{c(){c=n("p"),v=a("Examples:"),_=h(),w(g.$$.fragment)},l(l){c=s(l,"P",{});var m=r(c);v=i(m,"Examples:"),m.forEach(o),_=f(l),T(g.$$.fragment,l)},m(l,m){u(l,c,m),e(c,v),u(l,_,m),y(g,l,m),b=!0},p:Uo,i(l){b||(k(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&o(c),l&&o(_),$(g,l)}}}function ll(x){let c,v,_,g,b,l,m,C,Sn,Qo,J,de,no,je,Pn,so,On,Wo,U,Dn,Se,Nn,In,Tt,Un,Qn,Vo,yt,Wn,Ro,kt,ro,Vn,Bo,Lt,Rn,Ho,$t,A,Bn,Pe,Hn,Gn,Oe,Jn,Xn,ao,Kn,Yn,io,Zn,es,Go,De,Jo,ce,lo,ts,os,q,ns,Ne,ss,rs,xt,as,is,Ct,ls,ds,Ie,cs,ps,qt,hs,fs,Xo,pe,xa,Ko,he,us,Et,ms,gs,Yo,Q,_s,Ue,bs,vs,Qe,ws,Ts,Zo,X,fe,co,We,ys,po,ks,en,zt,Ls,tn,Mt,Ve,$s,Re,xs,Cs,on,At,ho,qs,nn,W,fo,Ft,Es,zs,uo,jt,Ms,As,mo,St,Fs,sn,Pt,js,rn,K,ue,go,Be,Ss,_o,Ps,an,I,He,Os,F,Ds,Ot,Ns,Is,Ge,Us,Qs,Dt,Ws,Vs,Nt,Rs,Bs,Hs,me,ln,Y,ge,bo,Je,Gs,vo,Js,dn,j,Xe,Xs,Ke,Ks,It,Ys,Zs,er,Ye,tr,Ze,or,nr,sr,S,et,rr,Z,ar,Ut,ir,lr,wo,dr,cr,pr,_e,hr,be,cn,ee,ve,To,tt,fr,yo,ur,pn,E,ot,mr,ko,gr,_r,nt,br,Qt,vr,wr,Tr,st,yr,rt,kr,Lr,$r,P,at,xr,te,Cr,Wt,qr,Er,Lo,zr,Mr,Ar,we,Fr,Te,hn,oe,ye,$o,it,jr,xo,Sr,fn,z,lt,Pr,Co,Or,Dr,dt,Nr,Vt,Ir,Ur,Qr,ct,Wr,pt,Vr,Rr,Br,O,ht,Hr,ne,Gr,Rt,Jr,Xr,qo,Kr,Yr,Zr,ke,ea,Le,un,se,$e,Eo,ft,ta,zo,oa,mn,M,ut,na,re,sa,Mo,ra,aa,Ao,ia,la,da,mt,ca,Bt,pa,ha,fa,gt,ua,_t,ma,ga,_a,D,bt,ba,ae,va,Ht,wa,Ta,Fo,ya,ka,La,xe,$a,Ce,gn;return l=new Fe({}),je=new Fe({}),De=new oo({props:{code:`from transformers import LiltModel

model = LiltModel.from_pretrained("path_to_your_files")
model.push_to_hub("name_of_repo_on_the_hub")`,highlighted:`from transformers import LiltModel

model = <span class="hljs-module-access"><span class="hljs-module"><span class="hljs-identifier">LiltModel</span>.</span></span>from<span class="hljs-constructor">_pretrained(<span class="hljs-string">&quot;path_to_your_files&quot;</span>)</span>
model.push<span class="hljs-constructor">_to_hub(<span class="hljs-string">&quot;name_of_repo_on_the_hub&quot;</span>)</span>`}}),We=new Fe({}),Be=new Fe({}),He=new le({props:{name:"class transformers.LiltConfig",anchor:"transformers.LiltConfig",parameters:[{name:"vocab_size",val:" = 30522"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"max_position_embeddings",val:" = 512"},{name:"type_vocab_size",val:" = 2"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"pad_token_id",val:" = 0"},{name:"position_embedding_type",val:" = 'absolute'"},{name:"classifier_dropout",val:" = None"},{name:"channel_shrink_ratio",val:" = 4"},{name:"max_2d_position_embeddings",val:" = 1024"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LiltConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the LiLT model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltModel">LiltModel</a>.`,name:"vocab_size"},{anchor:"transformers.LiltConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer. Should be a multiple of 24.`,name:"hidden_size"},{anchor:"transformers.LiltConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.LiltConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.LiltConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.LiltConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.LiltConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.LiltConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.LiltConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.LiltConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltModel">LiltModel</a>.`,name:"type_vocab_size"},{anchor:"transformers.LiltConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.LiltConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.LiltConfig.position_embedding_type",description:`<strong>position_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;absolute&quot;</code>) &#x2014;
Type of position embedding. Choose one of <code>&quot;absolute&quot;</code>, <code>&quot;relative_key&quot;</code>, <code>&quot;relative_key_query&quot;</code>. For
positional embeddings use <code>&quot;absolute&quot;</code>. For more information on <code>&quot;relative_key&quot;</code>, please refer to
<a href="https://arxiv.org/abs/1803.02155" rel="nofollow">Self-Attention with Relative Position Representations (Shaw et al.)</a>.
For more information on <code>&quot;relative_key_query&quot;</code>, please refer to <em>Method 4</em> in <a href="https://arxiv.org/abs/2009.13658" rel="nofollow">Improve Transformer Models
with Better Relative Position Embeddings (Huang et al.)</a>.`,name:"position_embedding_type"},{anchor:"transformers.LiltConfig.classifier_dropout",description:`<strong>classifier_dropout</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The dropout ratio for the classification head.`,name:"classifier_dropout"},{anchor:"transformers.LiltConfig.channel_shrink_ratio",description:`<strong>channel_shrink_ratio</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The shrink ratio compared to the <code>hidden_size</code> for the channel dimension of the layout embeddings.`,name:"channel_shrink_ratio"},{anchor:"transformers.LiltConfig.max_2d_position_embeddings",description:`<strong>max_2d_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
The maximum value that the 2D position embedding might ever be used with. Typically set this to something
large just in case (e.g., 1024).`,name:"max_2d_position_embeddings"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/lilt/configuration_lilt.py#L30"}}),me=new Io({props:{anchor:"transformers.LiltConfig.example",$$slots:{default:[Zi]},$$scope:{ctx:x}}}),Je=new Fe({}),Xe=new le({props:{name:"class transformers.LiltModel",anchor:"transformers.LiltModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"}],parametersDescription:[{anchor:"transformers.LiltModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltConfig">LiltConfig</a>) &#x2014; Model configuration class with all the parameters of the
model. Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/lilt/modeling_lilt.py#L699"}}),et=new le({props:{name:"forward",anchor:"transformers.LiltModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"bbox",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LiltModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LiltModel.forward.bbox",description:`<strong>bbox</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings-1]</code>. Each bounding box should be a normalized version in (x0, y0, x1, y1)
format, where (x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1,
y1) represents the position of the lower right corner. See <a href="#Overview">Overview</a> for normalization.`,name:"bbox"},{anchor:"transformers.LiltModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LiltModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LiltModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LiltModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.LiltModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LiltModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LiltModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.LiltModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/lilt/modeling_lilt.py#L729",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</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 (<a
  href="/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltConfig"
>LiltConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),_e=new jn({props:{$$slots:{default:[el]},$$scope:{ctx:x}}}),be=new Io({props:{anchor:"transformers.LiltModel.forward.example",$$slots:{default:[tl]},$$scope:{ctx:x}}}),tt=new Fe({}),ot=new le({props:{name:"class transformers.LiltForSequenceClassification",anchor:"transformers.LiltForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LiltForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltConfig">LiltConfig</a>) &#x2014; Model configuration class with all the parameters of the
model. Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/lilt/modeling_lilt.py#L849"}}),at=new le({props:{name:"forward",anchor:"transformers.LiltForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LiltForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LiltForSequenceClassification.forward.bbox",description:`<strong>bbox</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings-1]</code>. Each bounding box should be a normalized version in (x0, y0, x1, y1)
format, where (x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1,
y1) represents the position of the lower right corner. See <a href="#Overview">Overview</a> for normalization.`,name:"bbox"},{anchor:"transformers.LiltForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LiltForSequenceClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LiltForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LiltForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.LiltForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LiltForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LiltForSequenceClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.LiltForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LiltForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/lilt/modeling_lilt.py#L864",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</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 (<a
  href="/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltConfig"
>LiltConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),we=new jn({props:{$$slots:{default:[ol]},$$scope:{ctx:x}}}),Te=new Io({props:{anchor:"transformers.LiltForSequenceClassification.forward.example",$$slots:{default:[nl]},$$scope:{ctx:x}}}),it=new Fe({}),lt=new le({props:{name:"class transformers.LiltForTokenClassification",anchor:"transformers.LiltForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LiltForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltConfig">LiltConfig</a>) &#x2014; Model configuration class with all the parameters of the
model. Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/lilt/modeling_lilt.py#L967"}}),ht=new le({props:{name:"forward",anchor:"transformers.LiltForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LiltForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LiltForTokenClassification.forward.bbox",description:`<strong>bbox</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings-1]</code>. Each bounding box should be a normalized version in (x0, y0, x1, y1)
format, where (x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1,
y1) represents the position of the lower right corner. See <a href="#Overview">Overview</a> for normalization.`,name:"bbox"},{anchor:"transformers.LiltForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LiltForTokenClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LiltForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LiltForTokenClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.LiltForTokenClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LiltForTokenClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LiltForTokenClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.LiltForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LiltForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/lilt/modeling_lilt.py#L986",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</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 (<a
  href="/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltConfig"
>LiltConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided)  \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ke=new jn({props:{$$slots:{default:[sl]},$$scope:{ctx:x}}}),Le=new Io({props:{anchor:"transformers.LiltForTokenClassification.forward.example",$$slots:{default:[rl]},$$scope:{ctx:x}}}),ft=new Fe({}),ut=new le({props:{name:"class transformers.LiltForQuestionAnswering",anchor:"transformers.LiltForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LiltForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltConfig">LiltConfig</a>) &#x2014; Model configuration class with all the parameters of the
model. Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/lilt/modeling_lilt.py#L1094"}}),bt=new le({props:{name:"forward",anchor:"transformers.LiltForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"end_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LiltForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LiltForQuestionAnswering.forward.bbox",description:`<strong>bbox</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings-1]</code>. Each bounding box should be a normalized version in (x0, y0, x1, y1)
format, where (x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1,
y1) represents the position of the lower right corner. See <a href="#Overview">Overview</a> for normalization.`,name:"bbox"},{anchor:"transformers.LiltForQuestionAnswering.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LiltForQuestionAnswering.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LiltForQuestionAnswering.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LiltForQuestionAnswering.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.LiltForQuestionAnswering.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LiltForQuestionAnswering.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LiltForQuestionAnswering.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.LiltForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LiltForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.LiltForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/lilt/modeling_lilt.py#L1109",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</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 (<a
  href="/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltConfig"
>LiltConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),xe=new jn({props:{$$slots:{default:[al]},$$scope:{ctx:x}}}),Ce=new Io({props:{anchor:"transformers.LiltForQuestionAnswering.forward.example",$$slots:{default:[il]},$$scope:{ctx:x}}}),{c(){c=n("meta"),v=h(),_=n("h1"),g=n("a"),b=n("span"),w(l.$$.fragment),m=h(),C=n("span"),Sn=a("LiLT"),Qo=h(),J=n("h2"),de=n("a"),no=n("span"),w(je.$$.fragment),Pn=h(),so=n("span"),On=a("Overview"),Wo=h(),U=n("p"),Dn=a("The LiLT model was proposed in "),Se=n("a"),Nn=a("LiLT: A Simple yet Effective Language-Independent Layout Transformer for Structured Document Understanding"),In=a(` by Jiapeng Wang, Lianwen Jin, Kai Ding.
LiLT allows to combine any pre-trained RoBERTa text encoder with a lightweight Layout Transformer, to enable `),Tt=n("a"),Un=a("LayoutLM"),Qn=a(`-like document understanding for many
languages.`),Vo=h(),yt=n("p"),Wn=a("The abstract from the paper is the following:"),Ro=h(),kt=n("p"),ro=n("em"),Vn=a("Structured document understanding has attracted considerable attention and made significant progress recently, owing to its crucial role in intelligent document processing. However, most existing related models can only deal with the document data of specific language(s) (typically English) included in the pre-training collection, which is extremely limited. To address this issue, we propose a simple yet effective Language-independent Layout Transformer (LiLT) for structured document understanding. LiLT can be pre-trained on the structured documents of a single language and then directly fine-tuned on other languages with the corresponding off-the-shelf monolingual/multilingual pre-trained textual models. Experimental results on eight languages have shown that LiLT can achieve competitive or even superior performance on diverse widely-used downstream benchmarks, which enables language-independent benefit from the pre-training of document layout structure."),Bo=h(),Lt=n("p"),Rn=a("Tips:"),Ho=h(),$t=n("ul"),A=n("li"),Bn=a("To combine the Language-Independent Layout Transformer with a new RoBERTa checkpoint from the "),Pe=n("a"),Hn=a("hub"),Gn=a(", refer to "),Oe=n("a"),Jn=a("this guide"),Xn=a(`.
The script will result in `),ao=n("code"),Kn=a("config.json"),Yn=a(" and "),io=n("code"),Zn=a("pytorch_model.bin"),es=a(" files being stored locally. After doing this, one can do the following (assuming you\u2019re logged in with your HuggingFace account):"),Go=h(),w(De.$$.fragment),Jo=h(),ce=n("ul"),lo=n("li"),ts=a("When preparing data for the model, make sure to use the token vocabulary that corresponds to the RoBERTa checkpoint you combined with the Layout Transformer."),os=h(),q=n("li"),ns=a("As "),Ne=n("a"),ss=a("lilt-roberta-en-base"),rs=a(" uses the same vocabulary as "),xt=n("a"),as=a("LayoutLMv3"),is=a(", one can use "),Ct=n("a"),ls=a("LayoutLMv3TokenizerFast"),ds=a(` to prepare data for the model.
The same is true for `),Ie=n("a"),cs=a("lilt-roberta-en-base"),ps=a(": one can use "),qt=n("a"),hs=a("LayoutXLMTokenizerFast"),fs=a(" for that model."),Xo=h(),pe=n("img"),Ko=h(),he=n("small"),us=a("LiLT architecture. Taken from the "),Et=n("a"),ms=a("original paper"),gs=a("."),Yo=h(),Q=n("p"),_s=a("This model was contributed by "),Ue=n("a"),bs=a("nielsr"),vs=a(`.
The original code can be found `),Qe=n("a"),ws=a("here"),Ts=a("."),Zo=h(),X=n("h2"),fe=n("a"),co=n("span"),w(We.$$.fragment),ys=h(),po=n("span"),ks=a("Resources"),en=h(),zt=n("p"),Ls=a("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with LiLT."),tn=h(),Mt=n("ul"),Ve=n("li"),$s=a("Demo notebooks for LiLT can be found "),Re=n("a"),xs=a("here"),Cs=a("."),on=h(),At=n("p"),ho=n("strong"),qs=a("Documentation resources"),nn=h(),W=n("ul"),fo=n("li"),Ft=n("a"),Es=a("Text classification task guide"),zs=h(),uo=n("li"),jt=n("a"),Ms=a("Token classification task guide"),As=h(),mo=n("li"),St=n("a"),Fs=a("Question answering task guide"),sn=h(),Pt=n("p"),js=a("If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),rn=h(),K=n("h2"),ue=n("a"),go=n("span"),w(Be.$$.fragment),Ss=h(),_o=n("span"),Ps=a("LiltConfig"),an=h(),I=n("div"),w(He.$$.fragment),Os=h(),F=n("p"),Ds=a("This is the configuration class to store the configuration of a "),Ot=n("a"),Ns=a("LiltModel"),Is=a(`. It is used to instantiate a LiLT
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configuration to that of the LiLT
`),Ge=n("a"),Us=a("SCUT-DLVCLab/lilt-roberta-en-base"),Qs=a(` architecture.
Configuration objects inherit from `),Dt=n("a"),Ws=a("PretrainedConfig"),Vs=a(` and can be used to control the model outputs. Read the
documentation from `),Nt=n("a"),Rs=a("PretrainedConfig"),Bs=a(" for more information."),Hs=h(),w(me.$$.fragment),ln=h(),Y=n("h2"),ge=n("a"),bo=n("span"),w(Je.$$.fragment),Gs=h(),vo=n("span"),Js=a("LiltModel"),dn=h(),j=n("div"),w(Xe.$$.fragment),Xs=h(),Ke=n("p"),Ks=a(`The bare LiLT Model transformer outputting raw hidden-states without any specific head on top.
This model inherits from `),It=n("a"),Ys=a("PreTrainedModel"),Zs=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),er=h(),Ye=n("p"),tr=a("This model is also a PyTorch "),Ze=n("a"),or=a("torch.nn.Module"),nr=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),sr=h(),S=n("div"),w(et.$$.fragment),rr=h(),Z=n("p"),ar=a("The "),Ut=n("a"),ir=a("LiltModel"),lr=a(" forward method, overrides the "),wo=n("code"),dr=a("__call__"),cr=a(" special method."),pr=h(),w(_e.$$.fragment),hr=h(),w(be.$$.fragment),cn=h(),ee=n("h2"),ve=n("a"),To=n("span"),w(tt.$$.fragment),fr=h(),yo=n("span"),ur=a("LiltForSequenceClassification"),pn=h(),E=n("div"),w(ot.$$.fragment),mr=h(),ko=n("p"),gr=a(`LiLT Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled
output) e.g. for GLUE tasks.`),_r=h(),nt=n("p"),br=a("This model inherits from "),Qt=n("a"),vr=a("PreTrainedModel"),wr=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Tr=h(),st=n("p"),yr=a("This model is also a PyTorch "),rt=n("a"),kr=a("torch.nn.Module"),Lr=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),$r=h(),P=n("div"),w(at.$$.fragment),xr=h(),te=n("p"),Cr=a("The "),Wt=n("a"),qr=a("LiltForSequenceClassification"),Er=a(" forward method, overrides the "),Lo=n("code"),zr=a("__call__"),Mr=a(" special method."),Ar=h(),w(we.$$.fragment),Fr=h(),w(Te.$$.fragment),hn=h(),oe=n("h2"),ye=n("a"),$o=n("span"),w(it.$$.fragment),jr=h(),xo=n("span"),Sr=a("LiltForTokenClassification"),fn=h(),z=n("div"),w(lt.$$.fragment),Pr=h(),Co=n("p"),Or=a(`Lilt Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
Named-Entity-Recognition (NER) tasks.`),Dr=h(),dt=n("p"),Nr=a("This model inherits from "),Vt=n("a"),Ir=a("PreTrainedModel"),Ur=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Qr=h(),ct=n("p"),Wr=a("This model is also a PyTorch "),pt=n("a"),Vr=a("torch.nn.Module"),Rr=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Br=h(),O=n("div"),w(ht.$$.fragment),Hr=h(),ne=n("p"),Gr=a("The "),Rt=n("a"),Jr=a("LiltForTokenClassification"),Xr=a(" forward method, overrides the "),qo=n("code"),Kr=a("__call__"),Yr=a(" special method."),Zr=h(),w(ke.$$.fragment),ea=h(),w(Le.$$.fragment),un=h(),se=n("h2"),$e=n("a"),Eo=n("span"),w(ft.$$.fragment),ta=h(),zo=n("span"),oa=a("LiltForQuestionAnswering"),mn=h(),M=n("div"),w(ut.$$.fragment),na=h(),re=n("p"),sa=a(`Lilt Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear
layers on top of the hidden-states output to compute `),Mo=n("code"),ra=a("span start logits"),aa=a(" and "),Ao=n("code"),ia=a("span end logits"),la=a(")."),da=h(),mt=n("p"),ca=a("This model inherits from "),Bt=n("a"),pa=a("PreTrainedModel"),ha=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),fa=h(),gt=n("p"),ua=a("This model is also a PyTorch "),_t=n("a"),ma=a("torch.nn.Module"),ga=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),_a=h(),D=n("div"),w(bt.$$.fragment),ba=h(),ae=n("p"),va=a("The "),Ht=n("a"),wa=a("LiltForQuestionAnswering"),Ta=a(" forward method, overrides the "),Fo=n("code"),ya=a("__call__"),ka=a(" special method."),La=h(),w(xe.$$.fragment),$a=h(),w(Ce.$$.fragment),this.h()},l(t){const p=Xi('[data-svelte="svelte-1phssyn"]',document.head);c=s(p,"META",{name:!0,content:!0}),p.forEach(o),v=f(t),_=s(t,"H1",{class:!0});var vt=r(_);g=s(vt,"A",{id:!0,class:!0,href:!0});var jo=r(g);b=s(jo,"SPAN",{});var So=r(b);T(l.$$.fragment,So),So.forEach(o),jo.forEach(o),m=f(vt),C=s(vt,"SPAN",{});var Po=r(C);Sn=i(Po,"LiLT"),Po.forEach(o),vt.forEach(o),Qo=f(t),J=s(t,"H2",{class:!0});var wt=r(J);de=s(wt,"A",{id:!0,class:!0,href:!0});var Oo=r(de);no=s(Oo,"SPAN",{});var Do=r(no);T(je.$$.fragment,Do),Do.forEach(o),Oo.forEach(o),Pn=f(wt),so=s(wt,"SPAN",{});var No=r(so);On=i(No,"Overview"),No.forEach(o),wt.forEach(o),Wo=f(t),U=s(t,"P",{});var ie=r(U);Dn=i(ie,"The LiLT model was proposed in "),Se=s(ie,"A",{href:!0,rel:!0});var Ca=r(Se);Nn=i(Ca,"LiLT: A Simple yet Effective Language-Independent Layout Transformer for Structured Document Understanding"),Ca.forEach(o),In=i(ie,` by Jiapeng Wang, Lianwen Jin, Kai Ding.
LiLT allows to combine any pre-trained RoBERTa text encoder with a lightweight Layout Transformer, to enable `),Tt=s(ie,"A",{href:!0});var qa=r(Tt);Un=i(qa,"LayoutLM"),qa.forEach(o),Qn=i(ie,`-like document understanding for many
languages.`),ie.forEach(o),Vo=f(t),yt=s(t,"P",{});var Ea=r(yt);Wn=i(Ea,"The abstract from the paper is the following:"),Ea.forEach(o),Ro=f(t),kt=s(t,"P",{});var za=r(kt);ro=s(za,"EM",{});var Ma=r(ro);Vn=i(Ma,"Structured document understanding has attracted considerable attention and made significant progress recently, owing to its crucial role in intelligent document processing. However, most existing related models can only deal with the document data of specific language(s) (typically English) included in the pre-training collection, which is extremely limited. To address this issue, we propose a simple yet effective Language-independent Layout Transformer (LiLT) for structured document understanding. LiLT can be pre-trained on the structured documents of a single language and then directly fine-tuned on other languages with the corresponding off-the-shelf monolingual/multilingual pre-trained textual models. Experimental results on eight languages have shown that LiLT can achieve competitive or even superior performance on diverse widely-used downstream benchmarks, which enables language-independent benefit from the pre-training of document layout structure."),Ma.forEach(o),za.forEach(o),Bo=f(t),Lt=s(t,"P",{});var Aa=r(Lt);Rn=i(Aa,"Tips:"),Aa.forEach(o),Ho=f(t),$t=s(t,"UL",{});var Fa=r($t);A=s(Fa,"LI",{});var V=r(A);Bn=i(V,"To combine the Language-Independent Layout Transformer with a new RoBERTa checkpoint from the "),Pe=s(V,"A",{href:!0,rel:!0});var ja=r(Pe);Hn=i(ja,"hub"),ja.forEach(o),Gn=i(V,", refer to "),Oe=s(V,"A",{href:!0,rel:!0});var Sa=r(Oe);Jn=i(Sa,"this guide"),Sa.forEach(o),Xn=i(V,`.
The script will result in `),ao=s(V,"CODE",{});var Pa=r(ao);Kn=i(Pa,"config.json"),Pa.forEach(o),Yn=i(V," and "),io=s(V,"CODE",{});var Oa=r(io);Zn=i(Oa,"pytorch_model.bin"),Oa.forEach(o),es=i(V," files being stored locally. After doing this, one can do the following (assuming you\u2019re logged in with your HuggingFace account):"),V.forEach(o),Fa.forEach(o),Go=f(t),T(De.$$.fragment,t),Jo=f(t),ce=s(t,"UL",{});var _n=r(ce);lo=s(_n,"LI",{});var Da=r(lo);ts=i(Da,"When preparing data for the model, make sure to use the token vocabulary that corresponds to the RoBERTa checkpoint you combined with the Layout Transformer."),Da.forEach(o),os=f(_n),q=s(_n,"LI",{});var N=r(q);ns=i(N,"As "),Ne=s(N,"A",{href:!0,rel:!0});var Na=r(Ne);ss=i(Na,"lilt-roberta-en-base"),Na.forEach(o),rs=i(N," uses the same vocabulary as "),xt=s(N,"A",{href:!0});var Ia=r(xt);as=i(Ia,"LayoutLMv3"),Ia.forEach(o),is=i(N,", one can use "),Ct=s(N,"A",{href:!0});var Ua=r(Ct);ls=i(Ua,"LayoutLMv3TokenizerFast"),Ua.forEach(o),ds=i(N,` to prepare data for the model.
The same is true for `),Ie=s(N,"A",{href:!0,rel:!0});var Qa=r(Ie);cs=i(Qa,"lilt-roberta-en-base"),Qa.forEach(o),ps=i(N,": one can use "),qt=s(N,"A",{href:!0});var Wa=r(qt);hs=i(Wa,"LayoutXLMTokenizerFast"),Wa.forEach(o),fs=i(N," for that model."),N.forEach(o),_n.forEach(o),Xo=f(t),pe=s(t,"IMG",{src:!0,alt:!0,width:!0}),Ko=f(t),he=s(t,"SMALL",{});var bn=r(he);us=i(bn,"LiLT architecture. Taken from the "),Et=s(bn,"A",{href:!0});var Va=r(Et);ms=i(Va,"original paper"),Va.forEach(o),gs=i(bn,"."),bn.forEach(o),Yo=f(t),Q=s(t,"P",{});var Gt=r(Q);_s=i(Gt,"This model was contributed by "),Ue=s(Gt,"A",{href:!0,rel:!0});var Ra=r(Ue);bs=i(Ra,"nielsr"),Ra.forEach(o),vs=i(Gt,`.
The original code can be found `),Qe=s(Gt,"A",{href:!0,rel:!0});var Ba=r(Qe);ws=i(Ba,"here"),Ba.forEach(o),Ts=i(Gt,"."),Gt.forEach(o),Zo=f(t),X=s(t,"H2",{class:!0});var vn=r(X);fe=s(vn,"A",{id:!0,class:!0,href:!0});var Ha=r(fe);co=s(Ha,"SPAN",{});var Ga=r(co);T(We.$$.fragment,Ga),Ga.forEach(o),Ha.forEach(o),ys=f(vn),po=s(vn,"SPAN",{});var Ja=r(po);ks=i(Ja,"Resources"),Ja.forEach(o),vn.forEach(o),en=f(t),zt=s(t,"P",{});var Xa=r(zt);Ls=i(Xa,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with LiLT."),Xa.forEach(o),tn=f(t),Mt=s(t,"UL",{});var Ka=r(Mt);Ve=s(Ka,"LI",{});var wn=r(Ve);$s=i(wn,"Demo notebooks for LiLT can be found "),Re=s(wn,"A",{href:!0,rel:!0});var Ya=r(Re);xs=i(Ya,"here"),Ya.forEach(o),Cs=i(wn,"."),wn.forEach(o),Ka.forEach(o),on=f(t),At=s(t,"P",{});var Za=r(At);ho=s(Za,"STRONG",{});var ei=r(ho);qs=i(ei,"Documentation resources"),ei.forEach(o),Za.forEach(o),nn=f(t),W=s(t,"UL",{});var Jt=r(W);fo=s(Jt,"LI",{});var ti=r(fo);Ft=s(ti,"A",{href:!0});var oi=r(Ft);Es=i(oi,"Text classification task guide"),oi.forEach(o),ti.forEach(o),zs=f(Jt),uo=s(Jt,"LI",{});var ni=r(uo);jt=s(ni,"A",{href:!0});var si=r(jt);Ms=i(si,"Token classification task guide"),si.forEach(o),ni.forEach(o),As=f(Jt),mo=s(Jt,"LI",{});var ri=r(mo);St=s(ri,"A",{href:!0});var ai=r(St);Fs=i(ai,"Question answering task guide"),ai.forEach(o),ri.forEach(o),Jt.forEach(o),sn=f(t),Pt=s(t,"P",{});var ii=r(Pt);js=i(ii,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),ii.forEach(o),rn=f(t),K=s(t,"H2",{class:!0});var Tn=r(K);ue=s(Tn,"A",{id:!0,class:!0,href:!0});var li=r(ue);go=s(li,"SPAN",{});var di=r(go);T(Be.$$.fragment,di),di.forEach(o),li.forEach(o),Ss=f(Tn),_o=s(Tn,"SPAN",{});var ci=r(_o);Ps=i(ci,"LiltConfig"),ci.forEach(o),Tn.forEach(o),an=f(t),I=s(t,"DIV",{class:!0});var Xt=r(I);T(He.$$.fragment,Xt),Os=f(Xt),F=s(Xt,"P",{});var R=r(F);Ds=i(R,"This is the configuration class to store the configuration of a "),Ot=s(R,"A",{href:!0});var pi=r(Ot);Ns=i(pi,"LiltModel"),pi.forEach(o),Is=i(R,`. It is used to instantiate a LiLT
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configuration to that of the LiLT
`),Ge=s(R,"A",{href:!0,rel:!0});var hi=r(Ge);Us=i(hi,"SCUT-DLVCLab/lilt-roberta-en-base"),hi.forEach(o),Qs=i(R,` architecture.
Configuration objects inherit from `),Dt=s(R,"A",{href:!0});var fi=r(Dt);Ws=i(fi,"PretrainedConfig"),fi.forEach(o),Vs=i(R,` and can be used to control the model outputs. Read the
documentation from `),Nt=s(R,"A",{href:!0});var ui=r(Nt);Rs=i(ui,"PretrainedConfig"),ui.forEach(o),Bs=i(R," for more information."),R.forEach(o),Hs=f(Xt),T(me.$$.fragment,Xt),Xt.forEach(o),ln=f(t),Y=s(t,"H2",{class:!0});var yn=r(Y);ge=s(yn,"A",{id:!0,class:!0,href:!0});var mi=r(ge);bo=s(mi,"SPAN",{});var gi=r(bo);T(Je.$$.fragment,gi),gi.forEach(o),mi.forEach(o),Gs=f(yn),vo=s(yn,"SPAN",{});var _i=r(vo);Js=i(_i,"LiltModel"),_i.forEach(o),yn.forEach(o),dn=f(t),j=s(t,"DIV",{class:!0});var qe=r(j);T(Xe.$$.fragment,qe),Xs=f(qe),Ke=s(qe,"P",{});var kn=r(Ke);Ks=i(kn,`The bare LiLT Model transformer outputting raw hidden-states without any specific head on top.
This model inherits from `),It=s(kn,"A",{href:!0});var bi=r(It);Ys=i(bi,"PreTrainedModel"),bi.forEach(o),Zs=i(kn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),kn.forEach(o),er=f(qe),Ye=s(qe,"P",{});var Ln=r(Ye);tr=i(Ln,"This model is also a PyTorch "),Ze=s(Ln,"A",{href:!0,rel:!0});var vi=r(Ze);or=i(vi,"torch.nn.Module"),vi.forEach(o),nr=i(Ln,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ln.forEach(o),sr=f(qe),S=s(qe,"DIV",{class:!0});var Ee=r(S);T(et.$$.fragment,Ee),rr=f(Ee),Z=s(Ee,"P",{});var Kt=r(Z);ar=i(Kt,"The "),Ut=s(Kt,"A",{href:!0});var wi=r(Ut);ir=i(wi,"LiltModel"),wi.forEach(o),lr=i(Kt," forward method, overrides the "),wo=s(Kt,"CODE",{});var Ti=r(wo);dr=i(Ti,"__call__"),Ti.forEach(o),cr=i(Kt," special method."),Kt.forEach(o),pr=f(Ee),T(_e.$$.fragment,Ee),hr=f(Ee),T(be.$$.fragment,Ee),Ee.forEach(o),qe.forEach(o),cn=f(t),ee=s(t,"H2",{class:!0});var $n=r(ee);ve=s($n,"A",{id:!0,class:!0,href:!0});var yi=r(ve);To=s(yi,"SPAN",{});var ki=r(To);T(tt.$$.fragment,ki),ki.forEach(o),yi.forEach(o),fr=f($n),yo=s($n,"SPAN",{});var Li=r(yo);ur=i(Li,"LiltForSequenceClassification"),Li.forEach(o),$n.forEach(o),pn=f(t),E=s(t,"DIV",{class:!0});var B=r(E);T(ot.$$.fragment,B),mr=f(B),ko=s(B,"P",{});var $i=r(ko);gr=i($i,`LiLT Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled
output) e.g. for GLUE tasks.`),$i.forEach(o),_r=f(B),nt=s(B,"P",{});var xn=r(nt);br=i(xn,"This model inherits from "),Qt=s(xn,"A",{href:!0});var xi=r(Qt);vr=i(xi,"PreTrainedModel"),xi.forEach(o),wr=i(xn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),xn.forEach(o),Tr=f(B),st=s(B,"P",{});var Cn=r(st);yr=i(Cn,"This model is also a PyTorch "),rt=s(Cn,"A",{href:!0,rel:!0});var Ci=r(rt);kr=i(Ci,"torch.nn.Module"),Ci.forEach(o),Lr=i(Cn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Cn.forEach(o),$r=f(B),P=s(B,"DIV",{class:!0});var ze=r(P);T(at.$$.fragment,ze),xr=f(ze),te=s(ze,"P",{});var Yt=r(te);Cr=i(Yt,"The "),Wt=s(Yt,"A",{href:!0});var qi=r(Wt);qr=i(qi,"LiltForSequenceClassification"),qi.forEach(o),Er=i(Yt," forward method, overrides the "),Lo=s(Yt,"CODE",{});var Ei=r(Lo);zr=i(Ei,"__call__"),Ei.forEach(o),Mr=i(Yt," special method."),Yt.forEach(o),Ar=f(ze),T(we.$$.fragment,ze),Fr=f(ze),T(Te.$$.fragment,ze),ze.forEach(o),B.forEach(o),hn=f(t),oe=s(t,"H2",{class:!0});var qn=r(oe);ye=s(qn,"A",{id:!0,class:!0,href:!0});var zi=r(ye);$o=s(zi,"SPAN",{});var Mi=r($o);T(it.$$.fragment,Mi),Mi.forEach(o),zi.forEach(o),jr=f(qn),xo=s(qn,"SPAN",{});var Ai=r(xo);Sr=i(Ai,"LiltForTokenClassification"),Ai.forEach(o),qn.forEach(o),fn=f(t),z=s(t,"DIV",{class:!0});var H=r(z);T(lt.$$.fragment,H),Pr=f(H),Co=s(H,"P",{});var Fi=r(Co);Or=i(Fi,`Lilt Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
Named-Entity-Recognition (NER) tasks.`),Fi.forEach(o),Dr=f(H),dt=s(H,"P",{});var En=r(dt);Nr=i(En,"This model inherits from "),Vt=s(En,"A",{href:!0});var ji=r(Vt);Ir=i(ji,"PreTrainedModel"),ji.forEach(o),Ur=i(En,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),En.forEach(o),Qr=f(H),ct=s(H,"P",{});var zn=r(ct);Wr=i(zn,"This model is also a PyTorch "),pt=s(zn,"A",{href:!0,rel:!0});var Si=r(pt);Vr=i(Si,"torch.nn.Module"),Si.forEach(o),Rr=i(zn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),zn.forEach(o),Br=f(H),O=s(H,"DIV",{class:!0});var Me=r(O);T(ht.$$.fragment,Me),Hr=f(Me),ne=s(Me,"P",{});var Zt=r(ne);Gr=i(Zt,"The "),Rt=s(Zt,"A",{href:!0});var Pi=r(Rt);Jr=i(Pi,"LiltForTokenClassification"),Pi.forEach(o),Xr=i(Zt," forward method, overrides the "),qo=s(Zt,"CODE",{});var Oi=r(qo);Kr=i(Oi,"__call__"),Oi.forEach(o),Yr=i(Zt," special method."),Zt.forEach(o),Zr=f(Me),T(ke.$$.fragment,Me),ea=f(Me),T(Le.$$.fragment,Me),Me.forEach(o),H.forEach(o),un=f(t),se=s(t,"H2",{class:!0});var Mn=r(se);$e=s(Mn,"A",{id:!0,class:!0,href:!0});var Di=r($e);Eo=s(Di,"SPAN",{});var Ni=r(Eo);T(ft.$$.fragment,Ni),Ni.forEach(o),Di.forEach(o),ta=f(Mn),zo=s(Mn,"SPAN",{});var Ii=r(zo);oa=i(Ii,"LiltForQuestionAnswering"),Ii.forEach(o),Mn.forEach(o),mn=f(t),M=s(t,"DIV",{class:!0});var G=r(M);T(ut.$$.fragment,G),na=f(G),re=s(G,"P",{});var eo=r(re);sa=i(eo,`Lilt Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear
layers on top of the hidden-states output to compute `),Mo=s(eo,"CODE",{});var Ui=r(Mo);ra=i(Ui,"span start logits"),Ui.forEach(o),aa=i(eo," and "),Ao=s(eo,"CODE",{});var Qi=r(Ao);ia=i(Qi,"span end logits"),Qi.forEach(o),la=i(eo,")."),eo.forEach(o),da=f(G),mt=s(G,"P",{});var An=r(mt);ca=i(An,"This model inherits from "),Bt=s(An,"A",{href:!0});var Wi=r(Bt);pa=i(Wi,"PreTrainedModel"),Wi.forEach(o),ha=i(An,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),An.forEach(o),fa=f(G),gt=s(G,"P",{});var Fn=r(gt);ua=i(Fn,"This model is also a PyTorch "),_t=s(Fn,"A",{href:!0,rel:!0});var Vi=r(_t);ma=i(Vi,"torch.nn.Module"),Vi.forEach(o),ga=i(Fn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Fn.forEach(o),_a=f(G),D=s(G,"DIV",{class:!0});var Ae=r(D);T(bt.$$.fragment,Ae),ba=f(Ae),ae=s(Ae,"P",{});var to=r(ae);va=i(to,"The "),Ht=s(to,"A",{href:!0});var Ri=r(Ht);wa=i(Ri,"LiltForQuestionAnswering"),Ri.forEach(o),Ta=i(to," forward method, overrides the "),Fo=s(to,"CODE",{});var Bi=r(Fo);ya=i(Bi,"__call__"),Bi.forEach(o),ka=i(to," special method."),to.forEach(o),La=f(Ae),T(xe.$$.fragment,Ae),$a=f(Ae),T(Ce.$$.fragment,Ae),Ae.forEach(o),G.forEach(o),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(dl)),d(g,"id","lilt"),d(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(g,"href","#lilt"),d(_,"class","relative group"),d(de,"id","overview"),d(de,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(de,"href","#overview"),d(J,"class","relative group"),d(Se,"href","https://arxiv.org/abs/2202.13669"),d(Se,"rel","nofollow"),d(Tt,"href","layoutlm"),d(Pe,"href","https://huggingface.co/models?search=roberta"),d(Pe,"rel","nofollow"),d(Oe,"href","https://github.com/jpWang/LiLT#or-generate-your-own-checkpoint-optional"),d(Oe,"rel","nofollow"),d(Ne,"href","https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base"),d(Ne,"rel","nofollow"),d(xt,"href","layoutlmv3"),d(Ct,"href","/docs/transformers/v4.27.1/en/model_doc/layoutlmv3#transformers.LayoutLMv3TokenizerFast"),d(Ie,"href","https://huggingface.co/SCUT-DLVCLab/lilt-infoxlm-base"),d(Ie,"rel","nofollow"),d(qt,"href","/docs/transformers/v4.27.1/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizerFast"),Ki(pe.src,xa="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/lilt_architecture.jpg")||d(pe,"src",xa),d(pe,"alt","drawing"),d(pe,"width","600"),d(Et,"href","https://arxiv.org/abs/2202.13669"),d(Ue,"href","https://huggingface.co/nielsr"),d(Ue,"rel","nofollow"),d(Qe,"href","https://github.com/jpwang/lilt"),d(Qe,"rel","nofollow"),d(fe,"id","resources"),d(fe,"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"),d(fe,"href","#resources"),d(X,"class","relative group"),d(Re,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/LiLT"),d(Re,"rel","nofollow"),d(Ft,"href","./tasks/sequence_classification"),d(jt,"href","./tasks/token_classification"),d(St,"href","./tasks/question_answering"),d(ue,"id","transformers.LiltConfig"),d(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"),d(ue,"href","#transformers.LiltConfig"),d(K,"class","relative group"),d(Ot,"href","/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltModel"),d(Ge,"href","https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base"),d(Ge,"rel","nofollow"),d(Dt,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),d(Nt,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),d(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ge,"id","transformers.LiltModel"),d(ge,"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"),d(ge,"href","#transformers.LiltModel"),d(Y,"class","relative group"),d(It,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),d(Ze,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Ze,"rel","nofollow"),d(Ut,"href","/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltModel"),d(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ve,"id","transformers.LiltForSequenceClassification"),d(ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ve,"href","#transformers.LiltForSequenceClassification"),d(ee,"class","relative group"),d(Qt,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),d(rt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(rt,"rel","nofollow"),d(Wt,"href","/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltForSequenceClassification"),d(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ye,"id","transformers.LiltForTokenClassification"),d(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ye,"href","#transformers.LiltForTokenClassification"),d(oe,"class","relative group"),d(Vt,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),d(pt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(pt,"rel","nofollow"),d(Rt,"href","/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltForTokenClassification"),d(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d($e,"id","transformers.LiltForQuestionAnswering"),d($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"),d($e,"href","#transformers.LiltForQuestionAnswering"),d(se,"class","relative group"),d(Bt,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),d(_t,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(_t,"rel","nofollow"),d(Ht,"href","/docs/transformers/v4.27.1/en/model_doc/lilt#transformers.LiltForQuestionAnswering"),d(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,p){e(document.head,c),u(t,v,p),u(t,_,p),e(_,g),e(g,b),y(l,b,null),e(_,m),e(_,C),e(C,Sn),u(t,Qo,p),u(t,J,p),e(J,de),e(de,no),y(je,no,null),e(J,Pn),e(J,so),e(so,On),u(t,Wo,p),u(t,U,p),e(U,Dn),e(U,Se),e(Se,Nn),e(U,In),e(U,Tt),e(Tt,Un),e(U,Qn),u(t,Vo,p),u(t,yt,p),e(yt,Wn),u(t,Ro,p),u(t,kt,p),e(kt,ro),e(ro,Vn),u(t,Bo,p),u(t,Lt,p),e(Lt,Rn),u(t,Ho,p),u(t,$t,p),e($t,A),e(A,Bn),e(A,Pe),e(Pe,Hn),e(A,Gn),e(A,Oe),e(Oe,Jn),e(A,Xn),e(A,ao),e(ao,Kn),e(A,Yn),e(A,io),e(io,Zn),e(A,es),u(t,Go,p),y(De,t,p),u(t,Jo,p),u(t,ce,p),e(ce,lo),e(lo,ts),e(ce,os),e(ce,q),e(q,ns),e(q,Ne),e(Ne,ss),e(q,rs),e(q,xt),e(xt,as),e(q,is),e(q,Ct),e(Ct,ls),e(q,ds),e(q,Ie),e(Ie,cs),e(q,ps),e(q,qt),e(qt,hs),e(q,fs),u(t,Xo,p),u(t,pe,p),u(t,Ko,p),u(t,he,p),e(he,us),e(he,Et),e(Et,ms),e(he,gs),u(t,Yo,p),u(t,Q,p),e(Q,_s),e(Q,Ue),e(Ue,bs),e(Q,vs),e(Q,Qe),e(Qe,ws),e(Q,Ts),u(t,Zo,p),u(t,X,p),e(X,fe),e(fe,co),y(We,co,null),e(X,ys),e(X,po),e(po,ks),u(t,en,p),u(t,zt,p),e(zt,Ls),u(t,tn,p),u(t,Mt,p),e(Mt,Ve),e(Ve,$s),e(Ve,Re),e(Re,xs),e(Ve,Cs),u(t,on,p),u(t,At,p),e(At,ho),e(ho,qs),u(t,nn,p),u(t,W,p),e(W,fo),e(fo,Ft),e(Ft,Es),e(W,zs),e(W,uo),e(uo,jt),e(jt,Ms),e(W,As),e(W,mo),e(mo,St),e(St,Fs),u(t,sn,p),u(t,Pt,p),e(Pt,js),u(t,rn,p),u(t,K,p),e(K,ue),e(ue,go),y(Be,go,null),e(K,Ss),e(K,_o),e(_o,Ps),u(t,an,p),u(t,I,p),y(He,I,null),e(I,Os),e(I,F),e(F,Ds),e(F,Ot),e(Ot,Ns),e(F,Is),e(F,Ge),e(Ge,Us),e(F,Qs),e(F,Dt),e(Dt,Ws),e(F,Vs),e(F,Nt),e(Nt,Rs),e(F,Bs),e(I,Hs),y(me,I,null),u(t,ln,p),u(t,Y,p),e(Y,ge),e(ge,bo),y(Je,bo,null),e(Y,Gs),e(Y,vo),e(vo,Js),u(t,dn,p),u(t,j,p),y(Xe,j,null),e(j,Xs),e(j,Ke),e(Ke,Ks),e(Ke,It),e(It,Ys),e(Ke,Zs),e(j,er),e(j,Ye),e(Ye,tr),e(Ye,Ze),e(Ze,or),e(Ye,nr),e(j,sr),e(j,S),y(et,S,null),e(S,rr),e(S,Z),e(Z,ar),e(Z,Ut),e(Ut,ir),e(Z,lr),e(Z,wo),e(wo,dr),e(Z,cr),e(S,pr),y(_e,S,null),e(S,hr),y(be,S,null),u(t,cn,p),u(t,ee,p),e(ee,ve),e(ve,To),y(tt,To,null),e(ee,fr),e(ee,yo),e(yo,ur),u(t,pn,p),u(t,E,p),y(ot,E,null),e(E,mr),e(E,ko),e(ko,gr),e(E,_r),e(E,nt),e(nt,br),e(nt,Qt),e(Qt,vr),e(nt,wr),e(E,Tr),e(E,st),e(st,yr),e(st,rt),e(rt,kr),e(st,Lr),e(E,$r),e(E,P),y(at,P,null),e(P,xr),e(P,te),e(te,Cr),e(te,Wt),e(Wt,qr),e(te,Er),e(te,Lo),e(Lo,zr),e(te,Mr),e(P,Ar),y(we,P,null),e(P,Fr),y(Te,P,null),u(t,hn,p),u(t,oe,p),e(oe,ye),e(ye,$o),y(it,$o,null),e(oe,jr),e(oe,xo),e(xo,Sr),u(t,fn,p),u(t,z,p),y(lt,z,null),e(z,Pr),e(z,Co),e(Co,Or),e(z,Dr),e(z,dt),e(dt,Nr),e(dt,Vt),e(Vt,Ir),e(dt,Ur),e(z,Qr),e(z,ct),e(ct,Wr),e(ct,pt),e(pt,Vr),e(ct,Rr),e(z,Br),e(z,O),y(ht,O,null),e(O,Hr),e(O,ne),e(ne,Gr),e(ne,Rt),e(Rt,Jr),e(ne,Xr),e(ne,qo),e(qo,Kr),e(ne,Yr),e(O,Zr),y(ke,O,null),e(O,ea),y(Le,O,null),u(t,un,p),u(t,se,p),e(se,$e),e($e,Eo),y(ft,Eo,null),e(se,ta),e(se,zo),e(zo,oa),u(t,mn,p),u(t,M,p),y(ut,M,null),e(M,na),e(M,re),e(re,sa),e(re,Mo),e(Mo,ra),e(re,aa),e(re,Ao),e(Ao,ia),e(re,la),e(M,da),e(M,mt),e(mt,ca),e(mt,Bt),e(Bt,pa),e(mt,ha),e(M,fa),e(M,gt),e(gt,ua),e(gt,_t),e(_t,ma),e(gt,ga),e(M,_a),e(M,D),y(bt,D,null),e(D,ba),e(D,ae),e(ae,va),e(ae,Ht),e(Ht,wa),e(ae,Ta),e(ae,Fo),e(Fo,ya),e(ae,ka),e(D,La),y(xe,D,null),e(D,$a),y(Ce,D,null),gn=!0},p(t,[p]){const vt={};p&2&&(vt.$$scope={dirty:p,ctx:t}),me.$set(vt);const jo={};p&2&&(jo.$$scope={dirty:p,ctx:t}),_e.$set(jo);const So={};p&2&&(So.$$scope={dirty:p,ctx:t}),be.$set(So);const Po={};p&2&&(Po.$$scope={dirty:p,ctx:t}),we.$set(Po);const wt={};p&2&&(wt.$$scope={dirty:p,ctx:t}),Te.$set(wt);const Oo={};p&2&&(Oo.$$scope={dirty:p,ctx:t}),ke.$set(Oo);const Do={};p&2&&(Do.$$scope={dirty:p,ctx:t}),Le.$set(Do);const No={};p&2&&(No.$$scope={dirty:p,ctx:t}),xe.$set(No);const ie={};p&2&&(ie.$$scope={dirty:p,ctx:t}),Ce.$set(ie)},i(t){gn||(k(l.$$.fragment,t),k(je.$$.fragment,t),k(De.$$.fragment,t),k(We.$$.fragment,t),k(Be.$$.fragment,t),k(He.$$.fragment,t),k(me.$$.fragment,t),k(Je.$$.fragment,t),k(Xe.$$.fragment,t),k(et.$$.fragment,t),k(_e.$$.fragment,t),k(be.$$.fragment,t),k(tt.$$.fragment,t),k(ot.$$.fragment,t),k(at.$$.fragment,t),k(we.$$.fragment,t),k(Te.$$.fragment,t),k(it.$$.fragment,t),k(lt.$$.fragment,t),k(ht.$$.fragment,t),k(ke.$$.fragment,t),k(Le.$$.fragment,t),k(ft.$$.fragment,t),k(ut.$$.fragment,t),k(bt.$$.fragment,t),k(xe.$$.fragment,t),k(Ce.$$.fragment,t),gn=!0)},o(t){L(l.$$.fragment,t),L(je.$$.fragment,t),L(De.$$.fragment,t),L(We.$$.fragment,t),L(Be.$$.fragment,t),L(He.$$.fragment,t),L(me.$$.fragment,t),L(Je.$$.fragment,t),L(Xe.$$.fragment,t),L(et.$$.fragment,t),L(_e.$$.fragment,t),L(be.$$.fragment,t),L(tt.$$.fragment,t),L(ot.$$.fragment,t),L(at.$$.fragment,t),L(we.$$.fragment,t),L(Te.$$.fragment,t),L(it.$$.fragment,t),L(lt.$$.fragment,t),L(ht.$$.fragment,t),L(ke.$$.fragment,t),L(Le.$$.fragment,t),L(ft.$$.fragment,t),L(ut.$$.fragment,t),L(bt.$$.fragment,t),L(xe.$$.fragment,t),L(Ce.$$.fragment,t),gn=!1},d(t){o(c),t&&o(v),t&&o(_),$(l),t&&o(Qo),t&&o(J),$(je),t&&o(Wo),t&&o(U),t&&o(Vo),t&&o(yt),t&&o(Ro),t&&o(kt),t&&o(Bo),t&&o(Lt),t&&o(Ho),t&&o($t),t&&o(Go),$(De,t),t&&o(Jo),t&&o(ce),t&&o(Xo),t&&o(pe),t&&o(Ko),t&&o(he),t&&o(Yo),t&&o(Q),t&&o(Zo),t&&o(X),$(We),t&&o(en),t&&o(zt),t&&o(tn),t&&o(Mt),t&&o(on),t&&o(At),t&&o(nn),t&&o(W),t&&o(sn),t&&o(Pt),t&&o(rn),t&&o(K),$(Be),t&&o(an),t&&o(I),$(He),$(me),t&&o(ln),t&&o(Y),$(Je),t&&o(dn),t&&o(j),$(Xe),$(et),$(_e),$(be),t&&o(cn),t&&o(ee),$(tt),t&&o(pn),t&&o(E),$(ot),$(at),$(we),$(Te),t&&o(hn),t&&o(oe),$(it),t&&o(fn),t&&o(z),$(lt),$(ht),$(ke),$(Le),t&&o(un),t&&o(se),$(ft),t&&o(mn),t&&o(M),$(ut),$(bt),$(xe),$(Ce)}}}const dl={local:"lilt",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.LiltConfig",title:"LiltConfig"},{local:"transformers.LiltModel",title:"LiltModel"},{local:"transformers.LiltForSequenceClassification",title:"LiltForSequenceClassification"},{local:"transformers.LiltForTokenClassification",title:"LiltForTokenClassification"},{local:"transformers.LiltForQuestionAnswering",title:"LiltForQuestionAnswering"}],title:"LiLT"};function cl(x){return Yi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _l extends Hi{constructor(c){super();Gi(this,c,cl,ll,Ji,{})}}export{_l as default,dl as metadata};
