import{S as yi,i as Ti,s as ki,e as r,k as h,w,t as n,M as Li,c as a,d as o,m,a as i,x as y,h as s,b as d,N as $i,G as e,g as u,y as T,q as k,o as L,B as $,v as xi,L as Mo}from"../../chunks/vendor-hf-doc-builder.js";import{T as Tn}from"../../chunks/Tip-hf-doc-builder.js";import{D as ie}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Xt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Fe}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as zo}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Ci(x){let c,v,_,g,b;return g=new Xt({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=r("p"),v=n("Examples:"),_=h(),w(g.$$.fragment)},l(l){c=a(l,"P",{});var f=i(c);v=s(f,"Examples:"),f.forEach(o),_=m(l),y(g.$$.fragment,l)},m(l,f){u(l,c,f),e(c,v),u(l,_,f),T(g,l,f),b=!0},p:Mo,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 qi(x){let c,v,_,g,b;return{c(){c=r("p"),v=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),g=n("Module"),b=n(`
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=a(l,"P",{});var f=i(c);v=s(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(f,"CODE",{});var C=i(_);g=s(C,"Module"),C.forEach(o),b=s(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){u(l,c,f),e(c,v),e(c,_),e(_,g),e(c,b)},d(l){l&&o(c)}}}function Ei(x){let c,v,_,g,b;return g=new Xt({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=r("p"),v=n("Examples:"),_=h(),w(g.$$.fragment)},l(l){c=a(l,"P",{});var f=i(c);v=s(f,"Examples:"),f.forEach(o),_=m(l),y(g.$$.fragment,l)},m(l,f){u(l,c,f),e(c,v),u(l,_,f),T(g,l,f),b=!0},p:Mo,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 zi(x){let c,v,_,g,b;return{c(){c=r("p"),v=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),g=n("Module"),b=n(`
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=a(l,"P",{});var f=i(c);v=s(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(f,"CODE",{});var C=i(_);g=s(C,"Module"),C.forEach(o),b=s(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){u(l,c,f),e(c,v),e(c,_),e(_,g),e(c,b)},d(l){l&&o(c)}}}function Mi(x){let c,v,_,g,b;return g=new Xt({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=r("p"),v=n("Examples:"),_=h(),w(g.$$.fragment)},l(l){c=a(l,"P",{});var f=i(c);v=s(f,"Examples:"),f.forEach(o),_=m(l),y(g.$$.fragment,l)},m(l,f){u(l,c,f),e(c,v),u(l,_,f),T(g,l,f),b=!0},p:Mo,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 Fi(x){let c,v,_,g,b;return{c(){c=r("p"),v=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),g=n("Module"),b=n(`
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=a(l,"P",{});var f=i(c);v=s(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(f,"CODE",{});var C=i(_);g=s(C,"Module"),C.forEach(o),b=s(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){u(l,c,f),e(c,v),e(c,_),e(_,g),e(c,b)},d(l){l&&o(c)}}}function Ai(x){let c,v,_,g,b;return g=new Xt({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=r("p"),v=n("Examples:"),_=h(),w(g.$$.fragment)},l(l){c=a(l,"P",{});var f=i(c);v=s(f,"Examples:"),f.forEach(o),_=m(l),y(g.$$.fragment,l)},m(l,f){u(l,c,f),e(c,v),u(l,_,f),T(g,l,f),b=!0},p:Mo,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 ji(x){let c,v,_,g,b;return{c(){c=r("p"),v=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),g=n("Module"),b=n(`
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=a(l,"P",{});var f=i(c);v=s(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(f,"CODE",{});var C=i(_);g=s(C,"Module"),C.forEach(o),b=s(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){u(l,c,f),e(c,v),e(c,_),e(_,g),e(c,b)},d(l){l&&o(c)}}}function Si(x){let c,v,_,g,b;return g=new Xt({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=r("p"),v=n("Examples:"),_=h(),w(g.$$.fragment)},l(l){c=a(l,"P",{});var f=i(c);v=s(f,"Examples:"),f.forEach(o),_=m(l),y(g.$$.fragment,l)},m(l,f){u(l,c,f),e(c,v),u(l,_,f),T(g,l,f),b=!0},p:Mo,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 Pi(x){let c,v,_,g,b,l,f,C,kn,Fo,J,le,Kt,Ae,Ln,Yt,$n,Ao,U,xn,je,Cn,qn,wt,En,zn,jo,yt,Mn,So,Tt,Zt,Fn,Po,kt,An,Oo,Lt,F,jn,Se,Sn,Pn,Pe,On,Dn,eo,Nn,In,to,Un,Wn,Do,Oe,No,de,oo,Qn,Vn,q,Bn,De,Rn,Hn,$t,Jn,Gn,xt,Xn,Kn,Ne,Yn,Zn,Ct,es,ts,Io,ce,la,Uo,pe,os,qt,ns,ss,Wo,W,rs,Ie,as,is,Ue,ls,ds,Qo,G,he,no,We,cs,so,ps,Vo,Et,hs,Bo,zt,Qe,ms,Ve,fs,us,Ro,Mt,gs,Ho,X,me,ro,Be,_s,ao,bs,Jo,I,Re,vs,A,ws,Ft,ys,Ts,He,ks,Ls,At,$s,xs,jt,Cs,qs,Es,fe,Go,K,ue,io,Je,zs,lo,Ms,Xo,j,Ge,Fs,Xe,As,St,js,Ss,Ps,Ke,Os,Ye,Ds,Ns,Is,S,Ze,Us,Y,Ws,Pt,Qs,Vs,co,Bs,Rs,Hs,ge,Js,_e,Ko,Z,be,po,et,Gs,ho,Xs,Yo,E,tt,Ks,mo,Ys,Zs,ot,er,Ot,tr,or,nr,nt,sr,st,rr,ar,ir,P,rt,lr,ee,dr,Dt,cr,pr,fo,hr,mr,fr,ve,ur,we,Zo,te,ye,uo,at,gr,go,_r,en,z,it,br,_o,vr,wr,lt,yr,Nt,Tr,kr,Lr,dt,$r,ct,xr,Cr,qr,O,pt,Er,oe,zr,It,Mr,Fr,bo,Ar,jr,Sr,Te,Pr,ke,tn,ne,Le,vo,ht,Or,wo,Dr,on,M,mt,Nr,se,Ir,yo,Ur,Wr,To,Qr,Vr,Br,ft,Rr,Ut,Hr,Jr,Gr,ut,Xr,gt,Kr,Yr,Zr,D,_t,ea,re,ta,Wt,oa,na,ko,sa,ra,aa,$e,ia,xe,nn;return l=new Fe({}),Ae=new Fe({}),Oe=new Xt({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({}),Re=new ie({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/main/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/main/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/main/src/transformers/models/lilt/configuration_lilt.py#L30"}}),fe=new zo({props:{anchor:"transformers.LiltConfig.example",$$slots:{default:[Ci]},$$scope:{ctx:x}}}),Je=new Fe({}),Ge=new ie({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/main/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/main/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/main/src/transformers/models/lilt/modeling_lilt.py#L700"}}),Ze=new ie({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/lilt/modeling_lilt.py#L730",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ge=new Tn({props:{$$slots:{default:[qi]},$$scope:{ctx:x}}}),_e=new zo({props:{anchor:"transformers.LiltModel.forward.example",$$slots:{default:[Ei]},$$scope:{ctx:x}}}),et=new Fe({}),tt=new ie({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/main/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/main/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/main/src/transformers/models/lilt/modeling_lilt.py#L850"}}),rt=new ie({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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/main/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/main/src/transformers/models/lilt/modeling_lilt.py#L865",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ve=new Tn({props:{$$slots:{default:[zi]},$$scope:{ctx:x}}}),we=new zo({props:{anchor:"transformers.LiltForSequenceClassification.forward.example",$$slots:{default:[Mi]},$$scope:{ctx:x}}}),at=new Fe({}),it=new ie({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/main/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/main/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/main/src/transformers/models/lilt/modeling_lilt.py#L968"}}),pt=new ie({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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/main/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/main/src/transformers/models/lilt/modeling_lilt.py#L987",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Te=new Tn({props:{$$slots:{default:[Fi]},$$scope:{ctx:x}}}),ke=new zo({props:{anchor:"transformers.LiltForTokenClassification.forward.example",$$slots:{default:[Ai]},$$scope:{ctx:x}}}),ht=new Fe({}),mt=new ie({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/main/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/main/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/main/src/transformers/models/lilt/modeling_lilt.py#L1095"}}),_t=new ie({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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/main/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/main/src/transformers/models/lilt/modeling_lilt.py#L1110",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),$e=new Tn({props:{$$slots:{default:[ji]},$$scope:{ctx:x}}}),xe=new zo({props:{anchor:"transformers.LiltForQuestionAnswering.forward.example",$$slots:{default:[Si]},$$scope:{ctx:x}}}),{c(){c=r("meta"),v=h(),_=r("h1"),g=r("a"),b=r("span"),w(l.$$.fragment),f=h(),C=r("span"),kn=n("LiLT"),Fo=h(),J=r("h2"),le=r("a"),Kt=r("span"),w(Ae.$$.fragment),Ln=h(),Yt=r("span"),$n=n("Overview"),Ao=h(),U=r("p"),xn=n("The LiLT model was proposed in "),je=r("a"),Cn=n("LiLT: A Simple yet Effective Language-Independent Layout Transformer for Structured Document Understanding"),qn=n(` by Jiapeng Wang, Lianwen Jin, Kai Ding.
LiLT allows to combine any pre-trained RoBERTa text encoder with a lightweight Layout Transformer, to enable `),wt=r("a"),En=n("LayoutLM"),zn=n(`-like document understanding for many
languages.`),jo=h(),yt=r("p"),Mn=n("The abstract from the paper is the following:"),So=h(),Tt=r("p"),Zt=r("em"),Fn=n("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."),Po=h(),kt=r("p"),An=n("Tips:"),Oo=h(),Lt=r("ul"),F=r("li"),jn=n("To combine the Language-Independent Layout Transformer with a new RoBERTa checkpoint from the "),Se=r("a"),Sn=n("hub"),Pn=n(", refer to "),Pe=r("a"),On=n("this guide"),Dn=n(`.
The script will result in `),eo=r("code"),Nn=n("config.json"),In=n(" and "),to=r("code"),Un=n("pytorch_model.bin"),Wn=n(" files being stored locally. After doing this, one can do the following (assuming you\u2019re logged in with your HuggingFace account):"),Do=h(),w(Oe.$$.fragment),No=h(),de=r("ul"),oo=r("li"),Qn=n("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."),Vn=h(),q=r("li"),Bn=n("As "),De=r("a"),Rn=n("lilt-roberta-en-base"),Hn=n(" uses the same vocabulary as "),$t=r("a"),Jn=n("LayoutLMv3"),Gn=n(", one can use "),xt=r("a"),Xn=n("LayoutLMv3TokenizerFast"),Kn=n(` to prepare data for the model.
The same is true for `),Ne=r("a"),Yn=n("lilt-roberta-en-base"),Zn=n(": one can use "),Ct=r("a"),es=n("LayoutXLMTokenizerFast"),ts=n(" for that model."),Io=h(),ce=r("img"),Uo=h(),pe=r("small"),os=n("LiLT architecture. Taken from the "),qt=r("a"),ns=n("original paper"),ss=n("."),Wo=h(),W=r("p"),rs=n("This model was contributed by "),Ie=r("a"),as=n("nielsr"),is=n(`.
The original code can be found `),Ue=r("a"),ls=n("here"),ds=n("."),Qo=h(),G=r("h2"),he=r("a"),no=r("span"),w(We.$$.fragment),cs=h(),so=r("span"),ps=n("Resources"),Vo=h(),Et=r("p"),hs=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with LiLT."),Bo=h(),zt=r("ul"),Qe=r("li"),ms=n("Demo notebooks for LiLT can be found "),Ve=r("a"),fs=n("here"),us=n("."),Ro=h(),Mt=r("p"),gs=n("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."),Ho=h(),X=r("h2"),me=r("a"),ro=r("span"),w(Be.$$.fragment),_s=h(),ao=r("span"),bs=n("LiltConfig"),Jo=h(),I=r("div"),w(Re.$$.fragment),vs=h(),A=r("p"),ws=n("This is the configuration class to store the configuration of a "),Ft=r("a"),ys=n("LiltModel"),Ts=n(`. 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
`),He=r("a"),ks=n("SCUT-DLVCLab/lilt-roberta-en-base"),Ls=n(` architecture.
Configuration objects inherit from `),At=r("a"),$s=n("PretrainedConfig"),xs=n(` and can be used to control the model outputs. Read the
documentation from `),jt=r("a"),Cs=n("PretrainedConfig"),qs=n(" for more information."),Es=h(),w(fe.$$.fragment),Go=h(),K=r("h2"),ue=r("a"),io=r("span"),w(Je.$$.fragment),zs=h(),lo=r("span"),Ms=n("LiltModel"),Xo=h(),j=r("div"),w(Ge.$$.fragment),Fs=h(),Xe=r("p"),As=n(`The bare LiLT Model transformer outputting raw hidden-states without any specific head on top.
This model inherits from `),St=r("a"),js=n("PreTrainedModel"),Ss=n(`. 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.)`),Ps=h(),Ke=r("p"),Os=n("This model is also a PyTorch "),Ye=r("a"),Ds=n("torch.nn.Module"),Ns=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Is=h(),S=r("div"),w(Ze.$$.fragment),Us=h(),Y=r("p"),Ws=n("The "),Pt=r("a"),Qs=n("LiltModel"),Vs=n(" forward method, overrides the "),co=r("code"),Bs=n("__call__"),Rs=n(" special method."),Hs=h(),w(ge.$$.fragment),Js=h(),w(_e.$$.fragment),Ko=h(),Z=r("h2"),be=r("a"),po=r("span"),w(et.$$.fragment),Gs=h(),ho=r("span"),Xs=n("LiltForSequenceClassification"),Yo=h(),E=r("div"),w(tt.$$.fragment),Ks=h(),mo=r("p"),Ys=n(`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.`),Zs=h(),ot=r("p"),er=n("This model inherits from "),Ot=r("a"),tr=n("PreTrainedModel"),or=n(`. 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.)`),nr=h(),nt=r("p"),sr=n("This model is also a PyTorch "),st=r("a"),rr=n("torch.nn.Module"),ar=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ir=h(),P=r("div"),w(rt.$$.fragment),lr=h(),ee=r("p"),dr=n("The "),Dt=r("a"),cr=n("LiltForSequenceClassification"),pr=n(" forward method, overrides the "),fo=r("code"),hr=n("__call__"),mr=n(" special method."),fr=h(),w(ve.$$.fragment),ur=h(),w(we.$$.fragment),Zo=h(),te=r("h2"),ye=r("a"),uo=r("span"),w(at.$$.fragment),gr=h(),go=r("span"),_r=n("LiltForTokenClassification"),en=h(),z=r("div"),w(it.$$.fragment),br=h(),_o=r("p"),vr=n(`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.`),wr=h(),lt=r("p"),yr=n("This model inherits from "),Nt=r("a"),Tr=n("PreTrainedModel"),kr=n(`. 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.)`),Lr=h(),dt=r("p"),$r=n("This model is also a PyTorch "),ct=r("a"),xr=n("torch.nn.Module"),Cr=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),qr=h(),O=r("div"),w(pt.$$.fragment),Er=h(),oe=r("p"),zr=n("The "),It=r("a"),Mr=n("LiltForTokenClassification"),Fr=n(" forward method, overrides the "),bo=r("code"),Ar=n("__call__"),jr=n(" special method."),Sr=h(),w(Te.$$.fragment),Pr=h(),w(ke.$$.fragment),tn=h(),ne=r("h2"),Le=r("a"),vo=r("span"),w(ht.$$.fragment),Or=h(),wo=r("span"),Dr=n("LiltForQuestionAnswering"),on=h(),M=r("div"),w(mt.$$.fragment),Nr=h(),se=r("p"),Ir=n(`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 `),yo=r("code"),Ur=n("span start logits"),Wr=n(" and "),To=r("code"),Qr=n("span end logits"),Vr=n(")."),Br=h(),ft=r("p"),Rr=n("This model inherits from "),Ut=r("a"),Hr=n("PreTrainedModel"),Jr=n(`. 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.)`),Gr=h(),ut=r("p"),Xr=n("This model is also a PyTorch "),gt=r("a"),Kr=n("torch.nn.Module"),Yr=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Zr=h(),D=r("div"),w(_t.$$.fragment),ea=h(),re=r("p"),ta=n("The "),Wt=r("a"),oa=n("LiltForQuestionAnswering"),na=n(" forward method, overrides the "),ko=r("code"),sa=n("__call__"),ra=n(" special method."),aa=h(),w($e.$$.fragment),ia=h(),w(xe.$$.fragment),this.h()},l(t){const p=Li('[data-svelte="svelte-1phssyn"]',document.head);c=a(p,"META",{name:!0,content:!0}),p.forEach(o),v=m(t),_=a(t,"H1",{class:!0});var bt=i(_);g=a(bt,"A",{id:!0,class:!0,href:!0});var Lo=i(g);b=a(Lo,"SPAN",{});var $o=i(b);y(l.$$.fragment,$o),$o.forEach(o),Lo.forEach(o),f=m(bt),C=a(bt,"SPAN",{});var xo=i(C);kn=s(xo,"LiLT"),xo.forEach(o),bt.forEach(o),Fo=m(t),J=a(t,"H2",{class:!0});var vt=i(J);le=a(vt,"A",{id:!0,class:!0,href:!0});var Co=i(le);Kt=a(Co,"SPAN",{});var qo=i(Kt);y(Ae.$$.fragment,qo),qo.forEach(o),Co.forEach(o),Ln=m(vt),Yt=a(vt,"SPAN",{});var Eo=i(Yt);$n=s(Eo,"Overview"),Eo.forEach(o),vt.forEach(o),Ao=m(t),U=a(t,"P",{});var ae=i(U);xn=s(ae,"The LiLT model was proposed in "),je=a(ae,"A",{href:!0,rel:!0});var da=i(je);Cn=s(da,"LiLT: A Simple yet Effective Language-Independent Layout Transformer for Structured Document Understanding"),da.forEach(o),qn=s(ae,` by Jiapeng Wang, Lianwen Jin, Kai Ding.
LiLT allows to combine any pre-trained RoBERTa text encoder with a lightweight Layout Transformer, to enable `),wt=a(ae,"A",{href:!0});var ca=i(wt);En=s(ca,"LayoutLM"),ca.forEach(o),zn=s(ae,`-like document understanding for many
languages.`),ae.forEach(o),jo=m(t),yt=a(t,"P",{});var pa=i(yt);Mn=s(pa,"The abstract from the paper is the following:"),pa.forEach(o),So=m(t),Tt=a(t,"P",{});var ha=i(Tt);Zt=a(ha,"EM",{});var ma=i(Zt);Fn=s(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),ha.forEach(o),Po=m(t),kt=a(t,"P",{});var fa=i(kt);An=s(fa,"Tips:"),fa.forEach(o),Oo=m(t),Lt=a(t,"UL",{});var ua=i(Lt);F=a(ua,"LI",{});var Q=i(F);jn=s(Q,"To combine the Language-Independent Layout Transformer with a new RoBERTa checkpoint from the "),Se=a(Q,"A",{href:!0,rel:!0});var ga=i(Se);Sn=s(ga,"hub"),ga.forEach(o),Pn=s(Q,", refer to "),Pe=a(Q,"A",{href:!0,rel:!0});var _a=i(Pe);On=s(_a,"this guide"),_a.forEach(o),Dn=s(Q,`.
The script will result in `),eo=a(Q,"CODE",{});var ba=i(eo);Nn=s(ba,"config.json"),ba.forEach(o),In=s(Q," and "),to=a(Q,"CODE",{});var va=i(to);Un=s(va,"pytorch_model.bin"),va.forEach(o),Wn=s(Q," files being stored locally. After doing this, one can do the following (assuming you\u2019re logged in with your HuggingFace account):"),Q.forEach(o),ua.forEach(o),Do=m(t),y(Oe.$$.fragment,t),No=m(t),de=a(t,"UL",{});var sn=i(de);oo=a(sn,"LI",{});var wa=i(oo);Qn=s(wa,"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."),wa.forEach(o),Vn=m(sn),q=a(sn,"LI",{});var N=i(q);Bn=s(N,"As "),De=a(N,"A",{href:!0,rel:!0});var ya=i(De);Rn=s(ya,"lilt-roberta-en-base"),ya.forEach(o),Hn=s(N," uses the same vocabulary as "),$t=a(N,"A",{href:!0});var Ta=i($t);Jn=s(Ta,"LayoutLMv3"),Ta.forEach(o),Gn=s(N,", one can use "),xt=a(N,"A",{href:!0});var ka=i(xt);Xn=s(ka,"LayoutLMv3TokenizerFast"),ka.forEach(o),Kn=s(N,` to prepare data for the model.
The same is true for `),Ne=a(N,"A",{href:!0,rel:!0});var La=i(Ne);Yn=s(La,"lilt-roberta-en-base"),La.forEach(o),Zn=s(N,": one can use "),Ct=a(N,"A",{href:!0});var $a=i(Ct);es=s($a,"LayoutXLMTokenizerFast"),$a.forEach(o),ts=s(N," for that model."),N.forEach(o),sn.forEach(o),Io=m(t),ce=a(t,"IMG",{src:!0,alt:!0,width:!0}),Uo=m(t),pe=a(t,"SMALL",{});var rn=i(pe);os=s(rn,"LiLT architecture. Taken from the "),qt=a(rn,"A",{href:!0});var xa=i(qt);ns=s(xa,"original paper"),xa.forEach(o),ss=s(rn,"."),rn.forEach(o),Wo=m(t),W=a(t,"P",{});var Qt=i(W);rs=s(Qt,"This model was contributed by "),Ie=a(Qt,"A",{href:!0,rel:!0});var Ca=i(Ie);as=s(Ca,"nielsr"),Ca.forEach(o),is=s(Qt,`.
The original code can be found `),Ue=a(Qt,"A",{href:!0,rel:!0});var qa=i(Ue);ls=s(qa,"here"),qa.forEach(o),ds=s(Qt,"."),Qt.forEach(o),Qo=m(t),G=a(t,"H2",{class:!0});var an=i(G);he=a(an,"A",{id:!0,class:!0,href:!0});var Ea=i(he);no=a(Ea,"SPAN",{});var za=i(no);y(We.$$.fragment,za),za.forEach(o),Ea.forEach(o),cs=m(an),so=a(an,"SPAN",{});var Ma=i(so);ps=s(Ma,"Resources"),Ma.forEach(o),an.forEach(o),Vo=m(t),Et=a(t,"P",{});var Fa=i(Et);hs=s(Fa,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with LiLT."),Fa.forEach(o),Bo=m(t),zt=a(t,"UL",{});var Aa=i(zt);Qe=a(Aa,"LI",{});var ln=i(Qe);ms=s(ln,"Demo notebooks for LiLT can be found "),Ve=a(ln,"A",{href:!0,rel:!0});var ja=i(Ve);fs=s(ja,"here"),ja.forEach(o),us=s(ln,"."),ln.forEach(o),Aa.forEach(o),Ro=m(t),Mt=a(t,"P",{});var Sa=i(Mt);gs=s(Sa,"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."),Sa.forEach(o),Ho=m(t),X=a(t,"H2",{class:!0});var dn=i(X);me=a(dn,"A",{id:!0,class:!0,href:!0});var Pa=i(me);ro=a(Pa,"SPAN",{});var Oa=i(ro);y(Be.$$.fragment,Oa),Oa.forEach(o),Pa.forEach(o),_s=m(dn),ao=a(dn,"SPAN",{});var Da=i(ao);bs=s(Da,"LiltConfig"),Da.forEach(o),dn.forEach(o),Jo=m(t),I=a(t,"DIV",{class:!0});var Vt=i(I);y(Re.$$.fragment,Vt),vs=m(Vt),A=a(Vt,"P",{});var V=i(A);ws=s(V,"This is the configuration class to store the configuration of a "),Ft=a(V,"A",{href:!0});var Na=i(Ft);ys=s(Na,"LiltModel"),Na.forEach(o),Ts=s(V,`. 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
`),He=a(V,"A",{href:!0,rel:!0});var Ia=i(He);ks=s(Ia,"SCUT-DLVCLab/lilt-roberta-en-base"),Ia.forEach(o),Ls=s(V,` architecture.
Configuration objects inherit from `),At=a(V,"A",{href:!0});var Ua=i(At);$s=s(Ua,"PretrainedConfig"),Ua.forEach(o),xs=s(V,` and can be used to control the model outputs. Read the
documentation from `),jt=a(V,"A",{href:!0});var Wa=i(jt);Cs=s(Wa,"PretrainedConfig"),Wa.forEach(o),qs=s(V," for more information."),V.forEach(o),Es=m(Vt),y(fe.$$.fragment,Vt),Vt.forEach(o),Go=m(t),K=a(t,"H2",{class:!0});var cn=i(K);ue=a(cn,"A",{id:!0,class:!0,href:!0});var Qa=i(ue);io=a(Qa,"SPAN",{});var Va=i(io);y(Je.$$.fragment,Va),Va.forEach(o),Qa.forEach(o),zs=m(cn),lo=a(cn,"SPAN",{});var Ba=i(lo);Ms=s(Ba,"LiltModel"),Ba.forEach(o),cn.forEach(o),Xo=m(t),j=a(t,"DIV",{class:!0});var Ce=i(j);y(Ge.$$.fragment,Ce),Fs=m(Ce),Xe=a(Ce,"P",{});var pn=i(Xe);As=s(pn,`The bare LiLT Model transformer outputting raw hidden-states without any specific head on top.
This model inherits from `),St=a(pn,"A",{href:!0});var Ra=i(St);js=s(Ra,"PreTrainedModel"),Ra.forEach(o),Ss=s(pn,`. 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.)`),pn.forEach(o),Ps=m(Ce),Ke=a(Ce,"P",{});var hn=i(Ke);Os=s(hn,"This model is also a PyTorch "),Ye=a(hn,"A",{href:!0,rel:!0});var Ha=i(Ye);Ds=s(Ha,"torch.nn.Module"),Ha.forEach(o),Ns=s(hn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),hn.forEach(o),Is=m(Ce),S=a(Ce,"DIV",{class:!0});var qe=i(S);y(Ze.$$.fragment,qe),Us=m(qe),Y=a(qe,"P",{});var Bt=i(Y);Ws=s(Bt,"The "),Pt=a(Bt,"A",{href:!0});var Ja=i(Pt);Qs=s(Ja,"LiltModel"),Ja.forEach(o),Vs=s(Bt," forward method, overrides the "),co=a(Bt,"CODE",{});var Ga=i(co);Bs=s(Ga,"__call__"),Ga.forEach(o),Rs=s(Bt," special method."),Bt.forEach(o),Hs=m(qe),y(ge.$$.fragment,qe),Js=m(qe),y(_e.$$.fragment,qe),qe.forEach(o),Ce.forEach(o),Ko=m(t),Z=a(t,"H2",{class:!0});var mn=i(Z);be=a(mn,"A",{id:!0,class:!0,href:!0});var Xa=i(be);po=a(Xa,"SPAN",{});var Ka=i(po);y(et.$$.fragment,Ka),Ka.forEach(o),Xa.forEach(o),Gs=m(mn),ho=a(mn,"SPAN",{});var Ya=i(ho);Xs=s(Ya,"LiltForSequenceClassification"),Ya.forEach(o),mn.forEach(o),Yo=m(t),E=a(t,"DIV",{class:!0});var B=i(E);y(tt.$$.fragment,B),Ks=m(B),mo=a(B,"P",{});var Za=i(mo);Ys=s(Za,`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.`),Za.forEach(o),Zs=m(B),ot=a(B,"P",{});var fn=i(ot);er=s(fn,"This model inherits from "),Ot=a(fn,"A",{href:!0});var ei=i(Ot);tr=s(ei,"PreTrainedModel"),ei.forEach(o),or=s(fn,`. 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.)`),fn.forEach(o),nr=m(B),nt=a(B,"P",{});var un=i(nt);sr=s(un,"This model is also a PyTorch "),st=a(un,"A",{href:!0,rel:!0});var ti=i(st);rr=s(ti,"torch.nn.Module"),ti.forEach(o),ar=s(un,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),un.forEach(o),ir=m(B),P=a(B,"DIV",{class:!0});var Ee=i(P);y(rt.$$.fragment,Ee),lr=m(Ee),ee=a(Ee,"P",{});var Rt=i(ee);dr=s(Rt,"The "),Dt=a(Rt,"A",{href:!0});var oi=i(Dt);cr=s(oi,"LiltForSequenceClassification"),oi.forEach(o),pr=s(Rt," forward method, overrides the "),fo=a(Rt,"CODE",{});var ni=i(fo);hr=s(ni,"__call__"),ni.forEach(o),mr=s(Rt," special method."),Rt.forEach(o),fr=m(Ee),y(ve.$$.fragment,Ee),ur=m(Ee),y(we.$$.fragment,Ee),Ee.forEach(o),B.forEach(o),Zo=m(t),te=a(t,"H2",{class:!0});var gn=i(te);ye=a(gn,"A",{id:!0,class:!0,href:!0});var si=i(ye);uo=a(si,"SPAN",{});var ri=i(uo);y(at.$$.fragment,ri),ri.forEach(o),si.forEach(o),gr=m(gn),go=a(gn,"SPAN",{});var ai=i(go);_r=s(ai,"LiltForTokenClassification"),ai.forEach(o),gn.forEach(o),en=m(t),z=a(t,"DIV",{class:!0});var R=i(z);y(it.$$.fragment,R),br=m(R),_o=a(R,"P",{});var ii=i(_o);vr=s(ii,`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.`),ii.forEach(o),wr=m(R),lt=a(R,"P",{});var _n=i(lt);yr=s(_n,"This model inherits from "),Nt=a(_n,"A",{href:!0});var li=i(Nt);Tr=s(li,"PreTrainedModel"),li.forEach(o),kr=s(_n,`. 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.)`),_n.forEach(o),Lr=m(R),dt=a(R,"P",{});var bn=i(dt);$r=s(bn,"This model is also a PyTorch "),ct=a(bn,"A",{href:!0,rel:!0});var di=i(ct);xr=s(di,"torch.nn.Module"),di.forEach(o),Cr=s(bn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),bn.forEach(o),qr=m(R),O=a(R,"DIV",{class:!0});var ze=i(O);y(pt.$$.fragment,ze),Er=m(ze),oe=a(ze,"P",{});var Ht=i(oe);zr=s(Ht,"The "),It=a(Ht,"A",{href:!0});var ci=i(It);Mr=s(ci,"LiltForTokenClassification"),ci.forEach(o),Fr=s(Ht," forward method, overrides the "),bo=a(Ht,"CODE",{});var pi=i(bo);Ar=s(pi,"__call__"),pi.forEach(o),jr=s(Ht," special method."),Ht.forEach(o),Sr=m(ze),y(Te.$$.fragment,ze),Pr=m(ze),y(ke.$$.fragment,ze),ze.forEach(o),R.forEach(o),tn=m(t),ne=a(t,"H2",{class:!0});var vn=i(ne);Le=a(vn,"A",{id:!0,class:!0,href:!0});var hi=i(Le);vo=a(hi,"SPAN",{});var mi=i(vo);y(ht.$$.fragment,mi),mi.forEach(o),hi.forEach(o),Or=m(vn),wo=a(vn,"SPAN",{});var fi=i(wo);Dr=s(fi,"LiltForQuestionAnswering"),fi.forEach(o),vn.forEach(o),on=m(t),M=a(t,"DIV",{class:!0});var H=i(M);y(mt.$$.fragment,H),Nr=m(H),se=a(H,"P",{});var Jt=i(se);Ir=s(Jt,`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 `),yo=a(Jt,"CODE",{});var ui=i(yo);Ur=s(ui,"span start logits"),ui.forEach(o),Wr=s(Jt," and "),To=a(Jt,"CODE",{});var gi=i(To);Qr=s(gi,"span end logits"),gi.forEach(o),Vr=s(Jt,")."),Jt.forEach(o),Br=m(H),ft=a(H,"P",{});var wn=i(ft);Rr=s(wn,"This model inherits from "),Ut=a(wn,"A",{href:!0});var _i=i(Ut);Hr=s(_i,"PreTrainedModel"),_i.forEach(o),Jr=s(wn,`. 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.)`),wn.forEach(o),Gr=m(H),ut=a(H,"P",{});var yn=i(ut);Xr=s(yn,"This model is also a PyTorch "),gt=a(yn,"A",{href:!0,rel:!0});var bi=i(gt);Kr=s(bi,"torch.nn.Module"),bi.forEach(o),Yr=s(yn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),yn.forEach(o),Zr=m(H),D=a(H,"DIV",{class:!0});var Me=i(D);y(_t.$$.fragment,Me),ea=m(Me),re=a(Me,"P",{});var Gt=i(re);ta=s(Gt,"The "),Wt=a(Gt,"A",{href:!0});var vi=i(Wt);oa=s(vi,"LiltForQuestionAnswering"),vi.forEach(o),na=s(Gt," forward method, overrides the "),ko=a(Gt,"CODE",{});var wi=i(ko);sa=s(wi,"__call__"),wi.forEach(o),ra=s(Gt," special method."),Gt.forEach(o),aa=m(Me),y($e.$$.fragment,Me),ia=m(Me),y(xe.$$.fragment,Me),Me.forEach(o),H.forEach(o),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(Oi)),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(le,"id","overview"),d(le,"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(le,"href","#overview"),d(J,"class","relative group"),d(je,"href","https://arxiv.org/abs/2202.13669"),d(je,"rel","nofollow"),d(wt,"href","layoutlm"),d(Se,"href","https://huggingface.co/models?search=roberta"),d(Se,"rel","nofollow"),d(Pe,"href","https://github.com/jpWang/LiLT#or-generate-your-own-checkpoint-optional"),d(Pe,"rel","nofollow"),d(De,"href","https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base"),d(De,"rel","nofollow"),d($t,"href","layoutlmv3"),d(xt,"href","/docs/transformers/main/en/model_doc/layoutlmv3#transformers.LayoutLMv3TokenizerFast"),d(Ne,"href","https://huggingface.co/SCUT-DLVCLab/lilt-infoxlm-base"),d(Ne,"rel","nofollow"),d(Ct,"href","/docs/transformers/main/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizerFast"),$i(ce.src,la="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/lilt_architecture.jpg")||d(ce,"src",la),d(ce,"alt","drawing"),d(ce,"width","600"),d(qt,"href","https://arxiv.org/abs/2202.13669"),d(Ie,"href","https://huggingface.co/nielsr"),d(Ie,"rel","nofollow"),d(Ue,"href","https://github.com/jpwang/lilt"),d(Ue,"rel","nofollow"),d(he,"id","resources"),d(he,"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(he,"href","#resources"),d(G,"class","relative group"),d(Ve,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/LiLT"),d(Ve,"rel","nofollow"),d(me,"id","transformers.LiltConfig"),d(me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(me,"href","#transformers.LiltConfig"),d(X,"class","relative group"),d(Ft,"href","/docs/transformers/main/en/model_doc/lilt#transformers.LiltModel"),d(He,"href","https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base"),d(He,"rel","nofollow"),d(At,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),d(jt,"href","/docs/transformers/main/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(ue,"id","transformers.LiltModel"),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.LiltModel"),d(K,"class","relative group"),d(St,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),d(Ye,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Ye,"rel","nofollow"),d(Pt,"href","/docs/transformers/main/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(be,"id","transformers.LiltForSequenceClassification"),d(be,"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(be,"href","#transformers.LiltForSequenceClassification"),d(Z,"class","relative group"),d(Ot,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),d(st,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(st,"rel","nofollow"),d(Dt,"href","/docs/transformers/main/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(te,"class","relative group"),d(Nt,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),d(ct,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(ct,"rel","nofollow"),d(It,"href","/docs/transformers/main/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(Le,"id","transformers.LiltForQuestionAnswering"),d(Le,"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(Le,"href","#transformers.LiltForQuestionAnswering"),d(ne,"class","relative group"),d(Ut,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),d(gt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(gt,"rel","nofollow"),d(Wt,"href","/docs/transformers/main/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),T(l,b,null),e(_,f),e(_,C),e(C,kn),u(t,Fo,p),u(t,J,p),e(J,le),e(le,Kt),T(Ae,Kt,null),e(J,Ln),e(J,Yt),e(Yt,$n),u(t,Ao,p),u(t,U,p),e(U,xn),e(U,je),e(je,Cn),e(U,qn),e(U,wt),e(wt,En),e(U,zn),u(t,jo,p),u(t,yt,p),e(yt,Mn),u(t,So,p),u(t,Tt,p),e(Tt,Zt),e(Zt,Fn),u(t,Po,p),u(t,kt,p),e(kt,An),u(t,Oo,p),u(t,Lt,p),e(Lt,F),e(F,jn),e(F,Se),e(Se,Sn),e(F,Pn),e(F,Pe),e(Pe,On),e(F,Dn),e(F,eo),e(eo,Nn),e(F,In),e(F,to),e(to,Un),e(F,Wn),u(t,Do,p),T(Oe,t,p),u(t,No,p),u(t,de,p),e(de,oo),e(oo,Qn),e(de,Vn),e(de,q),e(q,Bn),e(q,De),e(De,Rn),e(q,Hn),e(q,$t),e($t,Jn),e(q,Gn),e(q,xt),e(xt,Xn),e(q,Kn),e(q,Ne),e(Ne,Yn),e(q,Zn),e(q,Ct),e(Ct,es),e(q,ts),u(t,Io,p),u(t,ce,p),u(t,Uo,p),u(t,pe,p),e(pe,os),e(pe,qt),e(qt,ns),e(pe,ss),u(t,Wo,p),u(t,W,p),e(W,rs),e(W,Ie),e(Ie,as),e(W,is),e(W,Ue),e(Ue,ls),e(W,ds),u(t,Qo,p),u(t,G,p),e(G,he),e(he,no),T(We,no,null),e(G,cs),e(G,so),e(so,ps),u(t,Vo,p),u(t,Et,p),e(Et,hs),u(t,Bo,p),u(t,zt,p),e(zt,Qe),e(Qe,ms),e(Qe,Ve),e(Ve,fs),e(Qe,us),u(t,Ro,p),u(t,Mt,p),e(Mt,gs),u(t,Ho,p),u(t,X,p),e(X,me),e(me,ro),T(Be,ro,null),e(X,_s),e(X,ao),e(ao,bs),u(t,Jo,p),u(t,I,p),T(Re,I,null),e(I,vs),e(I,A),e(A,ws),e(A,Ft),e(Ft,ys),e(A,Ts),e(A,He),e(He,ks),e(A,Ls),e(A,At),e(At,$s),e(A,xs),e(A,jt),e(jt,Cs),e(A,qs),e(I,Es),T(fe,I,null),u(t,Go,p),u(t,K,p),e(K,ue),e(ue,io),T(Je,io,null),e(K,zs),e(K,lo),e(lo,Ms),u(t,Xo,p),u(t,j,p),T(Ge,j,null),e(j,Fs),e(j,Xe),e(Xe,As),e(Xe,St),e(St,js),e(Xe,Ss),e(j,Ps),e(j,Ke),e(Ke,Os),e(Ke,Ye),e(Ye,Ds),e(Ke,Ns),e(j,Is),e(j,S),T(Ze,S,null),e(S,Us),e(S,Y),e(Y,Ws),e(Y,Pt),e(Pt,Qs),e(Y,Vs),e(Y,co),e(co,Bs),e(Y,Rs),e(S,Hs),T(ge,S,null),e(S,Js),T(_e,S,null),u(t,Ko,p),u(t,Z,p),e(Z,be),e(be,po),T(et,po,null),e(Z,Gs),e(Z,ho),e(ho,Xs),u(t,Yo,p),u(t,E,p),T(tt,E,null),e(E,Ks),e(E,mo),e(mo,Ys),e(E,Zs),e(E,ot),e(ot,er),e(ot,Ot),e(Ot,tr),e(ot,or),e(E,nr),e(E,nt),e(nt,sr),e(nt,st),e(st,rr),e(nt,ar),e(E,ir),e(E,P),T(rt,P,null),e(P,lr),e(P,ee),e(ee,dr),e(ee,Dt),e(Dt,cr),e(ee,pr),e(ee,fo),e(fo,hr),e(ee,mr),e(P,fr),T(ve,P,null),e(P,ur),T(we,P,null),u(t,Zo,p),u(t,te,p),e(te,ye),e(ye,uo),T(at,uo,null),e(te,gr),e(te,go),e(go,_r),u(t,en,p),u(t,z,p),T(it,z,null),e(z,br),e(z,_o),e(_o,vr),e(z,wr),e(z,lt),e(lt,yr),e(lt,Nt),e(Nt,Tr),e(lt,kr),e(z,Lr),e(z,dt),e(dt,$r),e(dt,ct),e(ct,xr),e(dt,Cr),e(z,qr),e(z,O),T(pt,O,null),e(O,Er),e(O,oe),e(oe,zr),e(oe,It),e(It,Mr),e(oe,Fr),e(oe,bo),e(bo,Ar),e(oe,jr),e(O,Sr),T(Te,O,null),e(O,Pr),T(ke,O,null),u(t,tn,p),u(t,ne,p),e(ne,Le),e(Le,vo),T(ht,vo,null),e(ne,Or),e(ne,wo),e(wo,Dr),u(t,on,p),u(t,M,p),T(mt,M,null),e(M,Nr),e(M,se),e(se,Ir),e(se,yo),e(yo,Ur),e(se,Wr),e(se,To),e(To,Qr),e(se,Vr),e(M,Br),e(M,ft),e(ft,Rr),e(ft,Ut),e(Ut,Hr),e(ft,Jr),e(M,Gr),e(M,ut),e(ut,Xr),e(ut,gt),e(gt,Kr),e(ut,Yr),e(M,Zr),e(M,D),T(_t,D,null),e(D,ea),e(D,re),e(re,ta),e(re,Wt),e(Wt,oa),e(re,na),e(re,ko),e(ko,sa),e(re,ra),e(D,aa),T($e,D,null),e(D,ia),T(xe,D,null),nn=!0},p(t,[p]){const bt={};p&2&&(bt.$$scope={dirty:p,ctx:t}),fe.$set(bt);const Lo={};p&2&&(Lo.$$scope={dirty:p,ctx:t}),ge.$set(Lo);const $o={};p&2&&($o.$$scope={dirty:p,ctx:t}),_e.$set($o);const xo={};p&2&&(xo.$$scope={dirty:p,ctx:t}),ve.$set(xo);const vt={};p&2&&(vt.$$scope={dirty:p,ctx:t}),we.$set(vt);const Co={};p&2&&(Co.$$scope={dirty:p,ctx:t}),Te.$set(Co);const qo={};p&2&&(qo.$$scope={dirty:p,ctx:t}),ke.$set(qo);const Eo={};p&2&&(Eo.$$scope={dirty:p,ctx:t}),$e.$set(Eo);const ae={};p&2&&(ae.$$scope={dirty:p,ctx:t}),xe.$set(ae)},i(t){nn||(k(l.$$.fragment,t),k(Ae.$$.fragment,t),k(Oe.$$.fragment,t),k(We.$$.fragment,t),k(Be.$$.fragment,t),k(Re.$$.fragment,t),k(fe.$$.fragment,t),k(Je.$$.fragment,t),k(Ge.$$.fragment,t),k(Ze.$$.fragment,t),k(ge.$$.fragment,t),k(_e.$$.fragment,t),k(et.$$.fragment,t),k(tt.$$.fragment,t),k(rt.$$.fragment,t),k(ve.$$.fragment,t),k(we.$$.fragment,t),k(at.$$.fragment,t),k(it.$$.fragment,t),k(pt.$$.fragment,t),k(Te.$$.fragment,t),k(ke.$$.fragment,t),k(ht.$$.fragment,t),k(mt.$$.fragment,t),k(_t.$$.fragment,t),k($e.$$.fragment,t),k(xe.$$.fragment,t),nn=!0)},o(t){L(l.$$.fragment,t),L(Ae.$$.fragment,t),L(Oe.$$.fragment,t),L(We.$$.fragment,t),L(Be.$$.fragment,t),L(Re.$$.fragment,t),L(fe.$$.fragment,t),L(Je.$$.fragment,t),L(Ge.$$.fragment,t),L(Ze.$$.fragment,t),L(ge.$$.fragment,t),L(_e.$$.fragment,t),L(et.$$.fragment,t),L(tt.$$.fragment,t),L(rt.$$.fragment,t),L(ve.$$.fragment,t),L(we.$$.fragment,t),L(at.$$.fragment,t),L(it.$$.fragment,t),L(pt.$$.fragment,t),L(Te.$$.fragment,t),L(ke.$$.fragment,t),L(ht.$$.fragment,t),L(mt.$$.fragment,t),L(_t.$$.fragment,t),L($e.$$.fragment,t),L(xe.$$.fragment,t),nn=!1},d(t){o(c),t&&o(v),t&&o(_),$(l),t&&o(Fo),t&&o(J),$(Ae),t&&o(Ao),t&&o(U),t&&o(jo),t&&o(yt),t&&o(So),t&&o(Tt),t&&o(Po),t&&o(kt),t&&o(Oo),t&&o(Lt),t&&o(Do),$(Oe,t),t&&o(No),t&&o(de),t&&o(Io),t&&o(ce),t&&o(Uo),t&&o(pe),t&&o(Wo),t&&o(W),t&&o(Qo),t&&o(G),$(We),t&&o(Vo),t&&o(Et),t&&o(Bo),t&&o(zt),t&&o(Ro),t&&o(Mt),t&&o(Ho),t&&o(X),$(Be),t&&o(Jo),t&&o(I),$(Re),$(fe),t&&o(Go),t&&o(K),$(Je),t&&o(Xo),t&&o(j),$(Ge),$(Ze),$(ge),$(_e),t&&o(Ko),t&&o(Z),$(et),t&&o(Yo),t&&o(E),$(tt),$(rt),$(ve),$(we),t&&o(Zo),t&&o(te),$(at),t&&o(en),t&&o(z),$(it),$(pt),$(Te),$(ke),t&&o(tn),t&&o(ne),$(ht),t&&o(on),t&&o(M),$(mt),$(_t),$($e),$(xe)}}}const Oi={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 Di(x){return xi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Bi extends yi{constructor(c){super();Ti(this,c,Di,Pi,ki,{})}}export{Bi as default,Oi as metadata};
