import{S as As,i as Is,s as Ss,e as a,k as d,w as k,t as n,M as Os,c as s,d as o,m as c,a as i,x as y,h as r,b as l,G as e,g as m,y as b,L as Us,q as L,o as v,B as w,v as Ws}from"../../chunks/vendor-hf-doc-builder.js";import{D as S}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ds}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as jt}from"../../chunks/IconCopyLink-hf-doc-builder.js";function Cs(ga){let O,Gt,U,V,dt,ne,Mo,ct,Xo,Jt,W,j,ut,re,Eo,mt,qo,Zt,q,$o,ae,Fo,Po,se,No,Do,Ht,Fe,Ao,Yt,Pe,pt,Io,Qt,Ne,So,Kt,ie,eo,$,Oo,De,Uo,Wo,Ae,Co,Ro,to,le,oo,z,Bo,Ie,Vo,jo,Se,Go,Jo,Oe,Zo,Ho,Ue,Yo,Qo,no,G,Ko,We,en,tn,ro,F,on,de,nn,rn,ce,an,sn,ao,C,J,ft,ue,ln,ht,dn,so,_,me,cn,E,un,Ce,mn,pn,Re,fn,hn,pe,_n,gn,kn,fe,yn,Be,bn,Ln,vn,Z,he,wn,_t,xn,Tn,P,_e,zn,gt,Mn,Xn,ge,Ve,En,kt,qn,$n,je,Fn,yt,Pn,Nn,H,ke,Dn,ye,An,bt,In,Sn,On,Y,be,Un,Lt,Wn,Cn,Ge,Le,io,R,Q,vt,ve,Rn,wt,Bn,lo,M,we,Vn,X,jn,xt,Gn,Jn,Je,Zn,Hn,Ze,Yn,Qn,xe,Kn,er,tr,Te,or,He,nr,rr,ar,K,ze,sr,Tt,ir,co,B,ee,zt,Me,lr,Mt,dr,uo,T,Xe,cr,Xt,ur,mr,Ye,Qe,pr,fr,hr,h,_r,Ke,gr,kr,et,yr,br,tt,Lr,vr,Et,wr,xr,qt,Tr,zr,$t,Mr,Xr,Ft,Er,qr,Pt,$r,Fr,Nt,Pr,Nr,Dr,N,Ee,Ar,p,Ir,Dt,Sr,Or,qe,At,Ur,Wr,Cr,ot,Rr,Br,It,Vr,jr,St,Gr,Jr,$e,Ot,Zr,Hr,Yr,Ut,Qr,Kr,nt,ea,ta,Wt,oa,na,Ct,ra,aa,Rt,sa,ia,Bt,la,da,ca,Vt,ua,mo;return ne=new jt({}),re=new jt({}),ie=new Ds({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExheW91dExNdjJNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwTGF5b3V0TE12Mk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZsYXlvdXR4bG0tYmFzZSUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LayoutLMv2Model

model = LayoutLMv2Model.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutxlm-base&quot;</span>)`}}),le=new Ds({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExheW91dFhMTVRva2VuaXplciUwQSUwQXRva2VuaXplciUyMCUzRCUyMExheW91dFhMTVRva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGbGF5b3V0eGxtLWJhc2UlMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LayoutXLMTokenizer

tokenizer = LayoutXLMTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutxlm-base&quot;</span>)`}}),ue=new jt({}),me=new S({props:{name:"class transformers.LayoutXLMTokenizer",anchor:"transformers.LayoutXLMTokenizer",parameters:[{name:"vocab_file",val:""},{name:"bos_token",val:" = '<s>'"},{name:"eos_token",val:" = '</s>'"},{name:"sep_token",val:" = '</s>'"},{name:"cls_token",val:" = '<s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"pad_token",val:" = '<pad>'"},{name:"mask_token",val:" = '<mask>'"},{name:"cls_token_box",val:" = [0, 0, 0, 0]"},{name:"sep_token_box",val:" = [1000, 1000, 1000, 1000]"},{name:"pad_token_box",val:" = [0, 0, 0, 0]"},{name:"pad_token_label",val:" = -100"},{name:"only_label_first_subword",val:" = True"},{name:"sp_model_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutXLMTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.LayoutXLMTokenizer.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the beginning of
sequence. The token used is the <code>cls_token</code>.</p>

					</div>`,name:"bos_token"},{anchor:"transformers.LayoutXLMTokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the end of sequence.
The token used is the <code>sep_token</code>.</p>

					</div>`,name:"eos_token"},{anchor:"transformers.LayoutXLMTokenizer.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.`,name:"sep_token"},{anchor:"transformers.LayoutXLMTokenizer.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.`,name:"cls_token"},{anchor:"transformers.LayoutXLMTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.LayoutXLMTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.LayoutXLMTokenizer.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;mask&gt;&quot;</code>) &#x2014;
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.`,name:"mask_token"},{anchor:"transformers.LayoutXLMTokenizer.cls_token_box",description:`<strong>cls_token_box</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[0, 0, 0, 0]</code>) &#x2014;
The bounding box to use for the special [CLS] token.`,name:"cls_token_box"},{anchor:"transformers.LayoutXLMTokenizer.sep_token_box",description:`<strong>sep_token_box</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[1000, 1000, 1000, 1000]</code>) &#x2014;
The bounding box to use for the special [SEP] token.`,name:"sep_token_box"},{anchor:"transformers.LayoutXLMTokenizer.pad_token_box",description:`<strong>pad_token_box</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[0, 0, 0, 0]</code>) &#x2014;
The bounding box to use for the special [PAD] token.`,name:"pad_token_box"},{anchor:"transformers.LayoutXLMTokenizer.pad_token_label",description:`<strong>pad_token_label</strong> (<code>int</code>, <em>optional</em>, defaults to -100) &#x2014;
The label to use for padding tokens. Defaults to -100, which is the <code>ignore_index</code> of PyTorch&#x2019;s
CrossEntropyLoss.`,name:"pad_token_label"},{anchor:"transformers.LayoutXLMTokenizer.only_label_first_subword",description:`<strong>only_label_first_subword</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to only label the first subword, in case word labels are provided.`,name:"only_label_first_subword"},{anchor:"transformers.LayoutXLMTokenizer.additional_special_tokens",description:`<strong>additional_special_tokens</strong> (<code>List[str]</code>, <em>optional</em>, defaults to <code>[&quot;&lt;s&gt;NOTUSED&quot;, &quot;&lt;/s&gt;NOTUSED&quot;]</code>) &#x2014;
Additional special tokens used by the tokenizer.`,name:"additional_special_tokens"},{anchor:"transformers.LayoutXLMTokenizer.sp_model_kwargs",description:`<strong>sp_model_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Will be passed to the <code>SentencePieceProcessor.__init__()</code> method. The <a href="https://github.com/google/sentencepiece/tree/master/python" rel="nofollow">Python wrapper for
SentencePiece</a> can be used, among other things,
to set:</p>
<ul>
<li>
<p><code>enable_sampling</code>: Enable subword regularization.</p>
</li>
<li>
<p><code>nbest_size</code>: Sampling parameters for unigram. Invalid for BPE-Dropout.</p>
<ul>
<li><code>nbest_size = {0,1}</code>: No sampling is performed.</li>
<li><code>nbest_size &gt; 1</code>: samples from the nbest_size results.</li>
<li><code>nbest_size &lt; 0</code>: assuming that nbest_size is infinite and samples from the all hypothesis (lattice)
using forward-filtering-and-backward-sampling algorithm.</li>
</ul>
</li>
<li>
<p><code>alpha</code>: Smoothing parameter for unigram sampling, and dropout probability of merge operations for
BPE-dropout.</p>
</li>
</ul>`,name:"sp_model_kwargs"},{anchor:"transformers.LayoutXLMTokenizer.sp_model",description:`<strong>sp_model</strong> (<code>SentencePieceProcessor</code>) &#x2014;
The <em>SentencePiece</em> processor that is used for every conversion (string, tokens and IDs).`,name:"sp_model"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/layoutxlm/tokenization_layoutxlm.py#L149"}}),he=new S({props:{name:"__call__",anchor:"transformers.LayoutXLMTokenizer.__call__",parameters:[{name:"text",val:": typing.Union[str, typing.List[str], typing.List[typing.List[str]]]"},{name:"text_pair",val:": typing.Union[typing.List[str], typing.List[typing.List[str]], NoneType] = None"},{name:"boxes",val:": typing.Union[typing.List[typing.List[int]], typing.List[typing.List[typing.List[int]]]] = None"},{name:"word_labels",val:": typing.Union[typing.List[int], typing.List[typing.List[int]], NoneType] = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy] = False"},{name:"truncation",val:": typing.Union[bool, str, transformers.tokenization_utils_base.TruncationStrategy] = None"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"stride",val:": int = 0"},{name:"pad_to_multiple_of",val:": typing.Optional[int] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"return_token_type_ids",val:": typing.Optional[bool] = None"},{name:"return_attention_mask",val:": typing.Optional[bool] = None"},{name:"return_overflowing_tokens",val:": bool = False"},{name:"return_special_tokens_mask",val:": bool = False"},{name:"return_offsets_mapping",val:": bool = False"},{name:"return_length",val:": bool = False"},{name:"verbose",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutXLMTokenizer.__call__.text",description:`<strong>text</strong> (<code>str</code>, <code>List[str]</code>, <code>List[List[str]]</code>) &#x2014;
The sequence or batch of sequences to be encoded. Each sequence can be a string, a list of strings
(words of a single example or questions of a batch of examples) or a list of list of strings (batch of
words).`,name:"text"},{anchor:"transformers.LayoutXLMTokenizer.__call__.text_pair",description:`<strong>text_pair</strong> (<code>List[str]</code>, <code>List[List[str]]</code>) &#x2014;
The sequence or batch of sequences to be encoded. Each sequence should be a list of strings
(pretokenized string).`,name:"text_pair"},{anchor:"transformers.LayoutXLMTokenizer.__call__.boxes",description:`<strong>boxes</strong> (<code>List[List[int]]</code>, <code>List[List[List[int]]]</code>) &#x2014;
Word-level bounding boxes. Each bounding box should be normalized to be on a 0-1000 scale.`,name:"boxes"},{anchor:"transformers.LayoutXLMTokenizer.__call__.word_labels",description:`<strong>word_labels</strong> (<code>List[int]</code>, <code>List[List[int]]</code>, <em>optional</em>) &#x2014;
Word-level integer labels (for token classification tasks such as FUNSD, CORD).`,name:"word_labels"},{anchor:"transformers.LayoutXLMTokenizer.__call__.add_special_tokens",description:`<strong>add_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to encode the sequences with the special tokens relative to their model.`,name:"add_special_tokens"},{anchor:"transformers.LayoutXLMTokenizer.__call__.padding",description:`<strong>padding</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/v4.30.0/en/internal/file_utils#transformers.utils.PaddingStrategy">PaddingStrategy</a>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates and controls padding. Accepts the following values:</p>
<ul>
<li><code>True</code> or <code>&apos;longest&apos;</code>: Pad to the longest sequence in the batch (or no padding if only a single
sequence if provided).</li>
<li><code>&apos;max_length&apos;</code>: Pad to a maximum length specified with the argument <code>max_length</code> or to the maximum
acceptable input length for the model if that argument is not provided.</li>
<li><code>False</code> or <code>&apos;do_not_pad&apos;</code> (default): No padding (i.e., can output a batch with sequences of different
lengths).</li>
</ul>`,name:"padding"},{anchor:"transformers.LayoutXLMTokenizer.__call__.truncation",description:`<strong>truncation</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.tokenization_utils_base.TruncationStrategy">TruncationStrategy</a>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates and controls truncation. Accepts the following values:</p>
<ul>
<li><code>True</code> or <code>&apos;longest_first&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or
to the maximum acceptable input length for the model if that argument is not provided. This will
truncate token by token, removing a token from the longest sequence in the pair if a pair of
sequences (or a batch of pairs) is provided.</li>
<li><code>&apos;only_first&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or to the
maximum acceptable input length for the model if that argument is not provided. This will only
truncate the first sequence of a pair if a pair of sequences (or a batch of pairs) is provided.</li>
<li><code>&apos;only_second&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or to the
maximum acceptable input length for the model if that argument is not provided. This will only
truncate the second sequence of a pair if a pair of sequences (or a batch of pairs) is provided.</li>
<li><code>False</code> or <code>&apos;do_not_truncate&apos;</code> (default): No truncation (i.e., can output batch with sequence lengths
greater than the model maximum admissible input size).</li>
</ul>`,name:"truncation"},{anchor:"transformers.LayoutXLMTokenizer.__call__.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Controls the maximum length to use by one of the truncation/padding parameters.</p>
<p>If left unset or set to <code>None</code>, this will use the predefined model maximum length if a maximum length
is required by one of the truncation/padding parameters. If the model has no specific maximum input
length (like XLNet) truncation/padding to a maximum length will be deactivated.`,name:"max_length"},{anchor:"transformers.LayoutXLMTokenizer.__call__.stride",description:`<strong>stride</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
If set to a number along with <code>max_length</code>, the overflowing tokens returned when
<code>return_overflowing_tokens=True</code> will contain some tokens from the end of the truncated sequence
returned to provide some overlap between truncated and overflowing sequences. The value of this
argument defines the number of overlapping tokens.`,name:"stride"},{anchor:"transformers.LayoutXLMTokenizer.__call__.pad_to_multiple_of",description:`<strong>pad_to_multiple_of</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If set will pad the sequence to a multiple of the provided value. This is especially useful to enable
the use of Tensor Cores on NVIDIA hardware with compute capability <code>&gt;= 7.5</code> (Volta).`,name:"pad_to_multiple_of"},{anchor:"transformers.LayoutXLMTokenizer.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/v4.30.0/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of list of python integers. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return Numpy <code>np.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.LayoutXLMTokenizer.__call__.return_token_type_ids",description:`<strong>return_token_type_ids</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return token type IDs. If left to the default, will return the token type IDs according to
the specific tokenizer&#x2019;s default, defined by the <code>return_outputs</code> attribute.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"return_token_type_ids"},{anchor:"transformers.LayoutXLMTokenizer.__call__.return_attention_mask",description:`<strong>return_attention_mask</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return the attention mask. If left to the default, will return the attention mask according
to the specific tokenizer&#x2019;s default, defined by the <code>return_outputs</code> attribute.</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"return_attention_mask"},{anchor:"transformers.LayoutXLMTokenizer.__call__.return_overflowing_tokens",description:`<strong>return_overflowing_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return overflowing token sequences. If a pair of sequences of input ids (or a batch
of pairs) is provided with <code>truncation_strategy = longest_first</code> or <code>True</code>, an error is raised instead
of returning overflowing tokens.`,name:"return_overflowing_tokens"},{anchor:"transformers.LayoutXLMTokenizer.__call__.return_special_tokens_mask",description:`<strong>return_special_tokens_mask</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return special tokens mask information.`,name:"return_special_tokens_mask"},{anchor:"transformers.LayoutXLMTokenizer.__call__.return_offsets_mapping",description:`<strong>return_offsets_mapping</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return <code>(char_start, char_end)</code> for each token.</p>
<p>This is only available on fast tokenizers inheriting from <a href="/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a>, if using
Python&#x2019;s tokenizer, this method will raise <code>NotImplementedError</code>.`,name:"return_offsets_mapping"},{anchor:"transformers.LayoutXLMTokenizer.__call__.return_length",description:`<strong>return_length</strong>  (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return the lengths of the encoded inputs.`,name:"return_length"},{anchor:"transformers.LayoutXLMTokenizer.__call__.verbose",description:`<strong>verbose</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to print more information and warnings.
**kwargs &#x2014; passed to the <code>self.tokenize()</code> method`,name:"verbose"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/layoutxlm/tokenization_layoutxlm.py#L444",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a> with the following fields:</p>
<ul>
<li>
<p><strong>input_ids</strong> \u2014 List of token ids to be fed to a model.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
</li>
<li>
<p><strong>bbox</strong> \u2014 List of bounding boxes to be fed to a model.</p>
</li>
<li>
<p><strong>token_type_ids</strong> \u2014 List of token type ids to be fed to a model (when <code>return_token_type_ids=True</code> or
if <em>\u201Ctoken_type_ids\u201D</em> is in <code>self.model_input_names</code>).</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a></p>
</li>
<li>
<p><strong>attention_mask</strong> \u2014 List of indices specifying which tokens should be attended to by the model (when
<code>return_attention_mask=True</code> or if <em>\u201Cattention_mask\u201D</em> is in <code>self.model_input_names</code>).</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
</li>
<li>
<p><strong>labels</strong> \u2014 List of labels to be fed to a model. (when <code>word_labels</code> is specified).</p>
</li>
<li>
<p><strong>overflowing_tokens</strong> \u2014 List of overflowing tokens sequences (when a <code>max_length</code> is specified and
<code>return_overflowing_tokens=True</code>).</p>
</li>
<li>
<p><strong>num_truncated_tokens</strong> \u2014 Number of tokens truncated (when a <code>max_length</code> is specified and
<code>return_overflowing_tokens=True</code>).</p>
</li>
<li>
<p><strong>special_tokens_mask</strong> \u2014 List of 0s and 1s, with 1 specifying added special tokens and 0 specifying
regular sequence tokens (when <code>add_special_tokens=True</code> and <code>return_special_tokens_mask=True</code>).</p>
</li>
<li>
<p><strong>length</strong> \u2014 The length of the inputs (when <code>return_length=True</code>).</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),_e=new S({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.LayoutXLMTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.LayoutXLMTokenizer.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.LayoutXLMTokenizer.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/layoutxlm/tokenization_layoutxlm.py#L316",returnDescription:`
<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),ke=new S({props:{name:"get_special_tokens_mask",anchor:"transformers.LayoutXLMTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.LayoutXLMTokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.LayoutXLMTokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.LayoutXLMTokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/layoutxlm/tokenization_layoutxlm.py#L342",returnDescription:`
<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),be=new S({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.LayoutXLMTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.LayoutXLMTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.LayoutXLMTokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/layoutxlm/tokenization_layoutxlm.py#L370",returnDescription:`
<p>List of zeros.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Le=new S({props:{name:"save_vocabulary",anchor:"transformers.LayoutXLMTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/layoutxlm/tokenization_layoutxlm.py#L427"}}),ve=new jt({}),we=new S({props:{name:"class transformers.LayoutXLMTokenizerFast",anchor:"transformers.LayoutXLMTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"bos_token",val:" = '<s>'"},{name:"eos_token",val:" = '</s>'"},{name:"sep_token",val:" = '</s>'"},{name:"cls_token",val:" = '<s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"pad_token",val:" = '<pad>'"},{name:"mask_token",val:" = '<mask>'"},{name:"cls_token_box",val:" = [0, 0, 0, 0]"},{name:"sep_token_box",val:" = [1000, 1000, 1000, 1000]"},{name:"pad_token_box",val:" = [0, 0, 0, 0]"},{name:"pad_token_label",val:" = -100"},{name:"only_label_first_subword",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutXLMTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.LayoutXLMTokenizerFast.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the beginning of
sequence. The token used is the <code>cls_token</code>.</p>

					</div>`,name:"bos_token"},{anchor:"transformers.LayoutXLMTokenizerFast.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the end of sequence.
The token used is the <code>sep_token</code>.</p>

					</div>`,name:"eos_token"},{anchor:"transformers.LayoutXLMTokenizerFast.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.`,name:"sep_token"},{anchor:"transformers.LayoutXLMTokenizerFast.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.`,name:"cls_token"},{anchor:"transformers.LayoutXLMTokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.LayoutXLMTokenizerFast.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.LayoutXLMTokenizerFast.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;mask&gt;&quot;</code>) &#x2014;
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.`,name:"mask_token"},{anchor:"transformers.LayoutXLMTokenizerFast.cls_token_box",description:`<strong>cls_token_box</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[0, 0, 0, 0]</code>) &#x2014;
The bounding box to use for the special [CLS] token.`,name:"cls_token_box"},{anchor:"transformers.LayoutXLMTokenizerFast.sep_token_box",description:`<strong>sep_token_box</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[1000, 1000, 1000, 1000]</code>) &#x2014;
The bounding box to use for the special [SEP] token.`,name:"sep_token_box"},{anchor:"transformers.LayoutXLMTokenizerFast.pad_token_box",description:`<strong>pad_token_box</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[0, 0, 0, 0]</code>) &#x2014;
The bounding box to use for the special [PAD] token.`,name:"pad_token_box"},{anchor:"transformers.LayoutXLMTokenizerFast.pad_token_label",description:`<strong>pad_token_label</strong> (<code>int</code>, <em>optional</em>, defaults to -100) &#x2014;
The label to use for padding tokens. Defaults to -100, which is the <code>ignore_index</code> of PyTorch&#x2019;s
CrossEntropyLoss.`,name:"pad_token_label"},{anchor:"transformers.LayoutXLMTokenizerFast.only_label_first_subword",description:`<strong>only_label_first_subword</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to only label the first subword, in case word labels are provided.`,name:"only_label_first_subword"},{anchor:"transformers.LayoutXLMTokenizerFast.additional_special_tokens",description:`<strong>additional_special_tokens</strong> (<code>List[str]</code>, <em>optional</em>, defaults to <code>[&quot;&lt;s&gt;NOTUSED&quot;, &quot;&lt;/s&gt;NOTUSED&quot;]</code>) &#x2014;
Additional special tokens used by the tokenizer.`,name:"additional_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/layoutxlm/tokenization_layoutxlm_fast.py#L152"}}),ze=new S({props:{name:"__call__",anchor:"transformers.LayoutXLMTokenizerFast.__call__",parameters:[{name:"text",val:": typing.Union[str, typing.List[str], typing.List[typing.List[str]]]"},{name:"text_pair",val:": typing.Union[typing.List[str], typing.List[typing.List[str]], NoneType] = None"},{name:"boxes",val:": typing.Union[typing.List[typing.List[int]], typing.List[typing.List[typing.List[int]]]] = None"},{name:"word_labels",val:": typing.Union[typing.List[int], typing.List[typing.List[int]], NoneType] = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy] = False"},{name:"truncation",val:": typing.Union[bool, str, transformers.tokenization_utils_base.TruncationStrategy] = None"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"stride",val:": int = 0"},{name:"pad_to_multiple_of",val:": typing.Optional[int] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"return_token_type_ids",val:": typing.Optional[bool] = None"},{name:"return_attention_mask",val:": typing.Optional[bool] = None"},{name:"return_overflowing_tokens",val:": bool = False"},{name:"return_special_tokens_mask",val:": bool = False"},{name:"return_offsets_mapping",val:": bool = False"},{name:"return_length",val:": bool = False"},{name:"verbose",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutXLMTokenizerFast.__call__.text",description:`<strong>text</strong> (<code>str</code>, <code>List[str]</code>, <code>List[List[str]]</code>) &#x2014;
The sequence or batch of sequences to be encoded. Each sequence can be a string, a list of strings
(words of a single example or questions of a batch of examples) or a list of list of strings (batch of
words).`,name:"text"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.text_pair",description:`<strong>text_pair</strong> (<code>List[str]</code>, <code>List[List[str]]</code>) &#x2014;
The sequence or batch of sequences to be encoded. Each sequence should be a list of strings
(pretokenized string).`,name:"text_pair"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.boxes",description:`<strong>boxes</strong> (<code>List[List[int]]</code>, <code>List[List[List[int]]]</code>) &#x2014;
Word-level bounding boxes. Each bounding box should be normalized to be on a 0-1000 scale.`,name:"boxes"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.word_labels",description:`<strong>word_labels</strong> (<code>List[int]</code>, <code>List[List[int]]</code>, <em>optional</em>) &#x2014;
Word-level integer labels (for token classification tasks such as FUNSD, CORD).`,name:"word_labels"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.add_special_tokens",description:`<strong>add_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to encode the sequences with the special tokens relative to their model.`,name:"add_special_tokens"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.padding",description:`<strong>padding</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/v4.30.0/en/internal/file_utils#transformers.utils.PaddingStrategy">PaddingStrategy</a>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates and controls padding. Accepts the following values:</p>
<ul>
<li><code>True</code> or <code>&apos;longest&apos;</code>: Pad to the longest sequence in the batch (or no padding if only a single
sequence if provided).</li>
<li><code>&apos;max_length&apos;</code>: Pad to a maximum length specified with the argument <code>max_length</code> or to the maximum
acceptable input length for the model if that argument is not provided.</li>
<li><code>False</code> or <code>&apos;do_not_pad&apos;</code> (default): No padding (i.e., can output a batch with sequences of different
lengths).</li>
</ul>`,name:"padding"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.truncation",description:`<strong>truncation</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.tokenization_utils_base.TruncationStrategy">TruncationStrategy</a>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates and controls truncation. Accepts the following values:</p>
<ul>
<li><code>True</code> or <code>&apos;longest_first&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or
to the maximum acceptable input length for the model if that argument is not provided. This will
truncate token by token, removing a token from the longest sequence in the pair if a pair of
sequences (or a batch of pairs) is provided.</li>
<li><code>&apos;only_first&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or to the
maximum acceptable input length for the model if that argument is not provided. This will only
truncate the first sequence of a pair if a pair of sequences (or a batch of pairs) is provided.</li>
<li><code>&apos;only_second&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or to the
maximum acceptable input length for the model if that argument is not provided. This will only
truncate the second sequence of a pair if a pair of sequences (or a batch of pairs) is provided.</li>
<li><code>False</code> or <code>&apos;do_not_truncate&apos;</code> (default): No truncation (i.e., can output batch with sequence lengths
greater than the model maximum admissible input size).</li>
</ul>`,name:"truncation"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Controls the maximum length to use by one of the truncation/padding parameters.</p>
<p>If left unset or set to <code>None</code>, this will use the predefined model maximum length if a maximum length
is required by one of the truncation/padding parameters. If the model has no specific maximum input
length (like XLNet) truncation/padding to a maximum length will be deactivated.`,name:"max_length"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.stride",description:`<strong>stride</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
If set to a number along with <code>max_length</code>, the overflowing tokens returned when
<code>return_overflowing_tokens=True</code> will contain some tokens from the end of the truncated sequence
returned to provide some overlap between truncated and overflowing sequences. The value of this
argument defines the number of overlapping tokens.`,name:"stride"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.pad_to_multiple_of",description:`<strong>pad_to_multiple_of</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If set will pad the sequence to a multiple of the provided value. This is especially useful to enable
the use of Tensor Cores on NVIDIA hardware with compute capability <code>&gt;= 7.5</code> (Volta).`,name:"pad_to_multiple_of"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/v4.30.0/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of list of python integers. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return Numpy <code>np.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.return_token_type_ids",description:`<strong>return_token_type_ids</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return token type IDs. If left to the default, will return the token type IDs according to
the specific tokenizer&#x2019;s default, defined by the <code>return_outputs</code> attribute.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"return_token_type_ids"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.return_attention_mask",description:`<strong>return_attention_mask</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return the attention mask. If left to the default, will return the attention mask according
to the specific tokenizer&#x2019;s default, defined by the <code>return_outputs</code> attribute.</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"return_attention_mask"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.return_overflowing_tokens",description:`<strong>return_overflowing_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return overflowing token sequences. If a pair of sequences of input ids (or a batch
of pairs) is provided with <code>truncation_strategy = longest_first</code> or <code>True</code>, an error is raised instead
of returning overflowing tokens.`,name:"return_overflowing_tokens"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.return_special_tokens_mask",description:`<strong>return_special_tokens_mask</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return special tokens mask information.`,name:"return_special_tokens_mask"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.return_offsets_mapping",description:`<strong>return_offsets_mapping</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return <code>(char_start, char_end)</code> for each token.</p>
<p>This is only available on fast tokenizers inheriting from <a href="/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a>, if using
Python&#x2019;s tokenizer, this method will raise <code>NotImplementedError</code>.`,name:"return_offsets_mapping"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.return_length",description:`<strong>return_length</strong>  (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return the lengths of the encoded inputs.`,name:"return_length"},{anchor:"transformers.LayoutXLMTokenizerFast.__call__.verbose",description:`<strong>verbose</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to print more information and warnings.
**kwargs &#x2014; passed to the <code>self.tokenize()</code> method`,name:"verbose"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/layoutxlm/tokenization_layoutxlm_fast.py#L269",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a> with the following fields:</p>
<ul>
<li>
<p><strong>input_ids</strong> \u2014 List of token ids to be fed to a model.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
</li>
<li>
<p><strong>bbox</strong> \u2014 List of bounding boxes to be fed to a model.</p>
</li>
<li>
<p><strong>token_type_ids</strong> \u2014 List of token type ids to be fed to a model (when <code>return_token_type_ids=True</code> or
if <em>\u201Ctoken_type_ids\u201D</em> is in <code>self.model_input_names</code>).</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a></p>
</li>
<li>
<p><strong>attention_mask</strong> \u2014 List of indices specifying which tokens should be attended to by the model (when
<code>return_attention_mask=True</code> or if <em>\u201Cattention_mask\u201D</em> is in <code>self.model_input_names</code>).</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
</li>
<li>
<p><strong>labels</strong> \u2014 List of labels to be fed to a model. (when <code>word_labels</code> is specified).</p>
</li>
<li>
<p><strong>overflowing_tokens</strong> \u2014 List of overflowing tokens sequences (when a <code>max_length</code> is specified and
<code>return_overflowing_tokens=True</code>).</p>
</li>
<li>
<p><strong>num_truncated_tokens</strong> \u2014 Number of tokens truncated (when a <code>max_length</code> is specified and
<code>return_overflowing_tokens=True</code>).</p>
</li>
<li>
<p><strong>special_tokens_mask</strong> \u2014 List of 0s and 1s, with 1 specifying added special tokens and 0 specifying
regular sequence tokens (when <code>add_special_tokens=True</code> and <code>return_special_tokens_mask=True</code>).</p>
</li>
<li>
<p><strong>length</strong> \u2014 The length of the inputs (when <code>return_length=True</code>).</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),Me=new jt({}),Xe=new S({props:{name:"class transformers.LayoutXLMProcessor",anchor:"transformers.LayoutXLMProcessor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutXLMProcessor.feature_extractor",description:`<strong>feature_extractor</strong> (<code>LayoutLMv2FeatureExtractor</code>) &#x2014;
An instance of <a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor">LayoutLMv2FeatureExtractor</a>. The feature extractor is a required input.`,name:"feature_extractor"},{anchor:"transformers.LayoutXLMProcessor.tokenizer",description:`<strong>tokenizer</strong> (<code>LayoutXLMTokenizer</code> or <code>LayoutXLMTokenizerFast</code>) &#x2014;
An instance of <a href="/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer">LayoutXLMTokenizer</a> or <a href="/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizerFast">LayoutXLMTokenizerFast</a>. The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/layoutxlm/processing_layoutxlm.py#L25"}}),Ee=new S({props:{name:"__call__",anchor:"transformers.LayoutXLMProcessor.__call__",parameters:[{name:"images",val:""},{name:"text",val:": typing.Union[str, typing.List[str], typing.List[typing.List[str]]] = None"},{name:"text_pair",val:": typing.Union[typing.List[str], typing.List[typing.List[str]], NoneType] = None"},{name:"boxes",val:": typing.Union[typing.List[typing.List[int]], typing.List[typing.List[typing.List[int]]]] = None"},{name:"word_labels",val:": typing.Union[typing.List[int], typing.List[typing.List[int]], NoneType] = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy] = False"},{name:"truncation",val:": typing.Union[bool, str, transformers.tokenization_utils_base.TruncationStrategy] = None"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"stride",val:": int = 0"},{name:"pad_to_multiple_of",val:": typing.Optional[int] = None"},{name:"return_token_type_ids",val:": typing.Optional[bool] = None"},{name:"return_attention_mask",val:": typing.Optional[bool] = None"},{name:"return_overflowing_tokens",val:": bool = False"},{name:"return_special_tokens_mask",val:": bool = False"},{name:"return_offsets_mapping",val:": bool = False"},{name:"return_length",val:": bool = False"},{name:"verbose",val:": bool = True"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/layoutxlm/processing_layoutxlm.py#L47"}}),{c(){O=a("meta"),Gt=d(),U=a("h1"),V=a("a"),dt=a("span"),k(ne.$$.fragment),Mo=d(),ct=a("span"),Xo=n("LayoutXLM"),Jt=d(),W=a("h2"),j=a("a"),ut=a("span"),k(re.$$.fragment),Eo=d(),mt=a("span"),qo=n("Overview"),Zt=d(),q=a("p"),$o=n("LayoutXLM was proposed in "),ae=a("a"),Fo=n("LayoutXLM: Multimodal Pre-training for Multilingual Visually-rich Document Understanding"),Po=n(` by Yiheng Xu, Tengchao Lv, Lei Cui, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha
Zhang, Furu Wei. It\u2019s a multilingual extension of the `),se=a("a"),No=n("LayoutLMv2 model"),Do=n(` trained
on 53 languages.`),Ht=d(),Fe=a("p"),Ao=n("The abstract from the paper is the following:"),Yt=d(),Pe=a("p"),pt=a("em"),Io=n(`Multimodal pre-training with text, layout, and image has achieved SOTA performance for visually-rich document
understanding tasks recently, which demonstrates the great potential for joint learning across different modalities. In
this paper, we present LayoutXLM, a multimodal pre-trained model for multilingual document understanding, which aims to
bridge the language barriers for visually-rich document understanding. To accurately evaluate LayoutXLM, we also
introduce a multilingual form understanding benchmark dataset named XFUN, which includes form understanding samples in
7 languages (Chinese, Japanese, Spanish, French, Italian, German, Portuguese), and key-value pairs are manually labeled
for each language. Experiment results show that the LayoutXLM model has significantly outperformed the existing SOTA
cross-lingual pre-trained models on the XFUN dataset.`),Qt=d(),Ne=a("p"),So=n("One can directly plug in the weights of LayoutXLM into a LayoutLMv2 model, like so:"),Kt=d(),k(ie.$$.fragment),eo=d(),$=a("p"),Oo=n(`Note that LayoutXLM has its own tokenizer, based on
`),De=a("a"),Uo=n("LayoutXLMTokenizer"),Wo=n("/"),Ae=a("a"),Co=n("LayoutXLMTokenizerFast"),Ro=n(`. You can initialize it as
follows:`),to=d(),k(le.$$.fragment),oo=d(),z=a("p"),Bo=n("Similar to LayoutLMv2, you can use "),Ie=a("a"),Vo=n("LayoutXLMProcessor"),jo=n(` (which internally applies
`),Se=a("a"),Go=n("LayoutLMv2FeatureExtractor"),Jo=n(` and
`),Oe=a("a"),Zo=n("LayoutXLMTokenizer"),Ho=n("/"),Ue=a("a"),Yo=n("LayoutXLMTokenizerFast"),Qo=n(` in sequence) to prepare all
data for the model.`),no=d(),G=a("p"),Ko=n("As LayoutXLM\u2019s architecture is equivalent to that of LayoutLMv2, one can refer to "),We=a("a"),en=n("LayoutLMv2\u2019s documentation page"),tn=n(" for all tips, code examples and notebooks."),ro=d(),F=a("p"),on=n("This model was contributed by "),de=a("a"),nn=n("nielsr"),rn=n(". The original code can be found "),ce=a("a"),an=n("here"),sn=n("."),ao=d(),C=a("h2"),J=a("a"),ft=a("span"),k(ue.$$.fragment),ln=d(),ht=a("span"),dn=n("LayoutXLMTokenizer"),so=d(),_=a("div"),k(me.$$.fragment),cn=d(),E=a("p"),un=n("Adapted from "),Ce=a("a"),mn=n("RobertaTokenizer"),pn=n(" and "),Re=a("a"),fn=n("XLNetTokenizer"),hn=n(`. Based on
`),pe=a("a"),_n=n("SentencePiece"),gn=n("."),kn=d(),fe=a("p"),yn=n("This tokenizer inherits from "),Be=a("a"),bn=n("PreTrainedTokenizer"),Ln=n(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),vn=d(),Z=a("div"),k(he.$$.fragment),wn=d(),_t=a("p"),xn=n(`Main method to tokenize and prepare for the model one or several sequence(s) or one or several pair(s) of
sequences with word-level normalized bounding boxes and optional labels.`),Tn=d(),P=a("div"),k(_e.$$.fragment),zn=d(),gt=a("p"),Mn=n(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. An XLM-RoBERTa sequence has the following format:`),Xn=d(),ge=a("ul"),Ve=a("li"),En=n("single sequence: "),kt=a("code"),qn=n("<s> X </s>"),$n=d(),je=a("li"),Fn=n("pair of sequences: "),yt=a("code"),Pn=n("<s> A </s></s> B </s>"),Nn=d(),H=a("div"),k(ke.$$.fragment),Dn=d(),ye=a("p"),An=n(`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),bt=a("code"),In=n("prepare_for_model"),Sn=n(" method."),On=d(),Y=a("div"),k(be.$$.fragment),Un=d(),Lt=a("p"),Wn=n(`Create a mask from the two sequences passed to be used in a sequence-pair classification task. XLM-RoBERTa does
not make use of token type ids, therefore a list of zeros is returned.`),Cn=d(),Ge=a("div"),k(Le.$$.fragment),io=d(),R=a("h2"),Q=a("a"),vt=a("span"),k(ve.$$.fragment),Rn=d(),wt=a("span"),Bn=n("LayoutXLMTokenizerFast"),lo=d(),M=a("div"),k(we.$$.fragment),Vn=d(),X=a("p"),jn=n("Construct a \u201Cfast\u201D LayoutXLM tokenizer (backed by HuggingFace\u2019s "),xt=a("em"),Gn=n("tokenizers"),Jn=n(` library). Adapted from
`),Je=a("a"),Zn=n("RobertaTokenizer"),Hn=n(" and "),Ze=a("a"),Yn=n("XLNetTokenizer"),Qn=n(`. Based on
`),xe=a("a"),Kn=n("BPE"),er=n("."),tr=d(),Te=a("p"),or=n("This tokenizer inherits from "),He=a("a"),nr=n("PreTrainedTokenizerFast"),rr=n(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),ar=d(),K=a("div"),k(ze.$$.fragment),sr=d(),Tt=a("p"),ir=n(`Main method to tokenize and prepare for the model one or several sequence(s) or one or several pair(s) of
sequences with word-level normalized bounding boxes and optional labels.`),co=d(),B=a("h2"),ee=a("a"),zt=a("span"),k(Me.$$.fragment),lr=d(),Mt=a("span"),dr=n("LayoutXLMProcessor"),uo=d(),T=a("div"),k(Xe.$$.fragment),cr=d(),Xt=a("p"),ur=n(`Constructs a LayoutXLM processor which combines a LayoutXLM feature extractor and a LayoutXLM tokenizer into a
single processor.`),mr=d(),Ye=a("p"),Qe=a("a"),pr=n("LayoutXLMProcessor"),fr=n(" offers all the functionalities you need to prepare data for the model."),hr=d(),h=a("p"),_r=n("It first uses "),Ke=a("a"),gr=n("LayoutLMv2FeatureExtractor"),kr=n(` to resize document images to a fixed size, and optionally applies OCR
to get words and normalized bounding boxes. These are then provided to `),et=a("a"),yr=n("LayoutXLMTokenizer"),br=n(` or
`),tt=a("a"),Lr=n("LayoutXLMTokenizerFast"),vr=n(", which turns the words and bounding boxes into token-level "),Et=a("code"),wr=n("input_ids"),xr=n(`,
`),qt=a("code"),Tr=n("attention_mask"),zr=n(", "),$t=a("code"),Mr=n("token_type_ids"),Xr=n(", "),Ft=a("code"),Er=n("bbox"),qr=n(". Optionally, one can provide integer "),Pt=a("code"),$r=n("word_labels"),Fr=n(`, which are turned
into token-level `),Nt=a("code"),Pr=n("labels"),Nr=n(" for token classification tasks (such as FUNSD, CORD)."),Dr=d(),N=a("div"),k(Ee.$$.fragment),Ar=d(),p=a("p"),Ir=n("This method first forwards the "),Dt=a("code"),Sr=n("images"),Or=n(" argument to "),qe=a("a"),At=a("strong"),Ur=n("call"),Wr=n("()"),Cr=n(`. In case
`),ot=a("a"),Rr=n("LayoutLMv2FeatureExtractor"),Br=n(" was initialized with "),It=a("code"),Vr=n("apply_ocr"),jr=n(" set to "),St=a("code"),Gr=n("True"),Jr=n(`, it passes the obtained words and
bounding boxes along with the additional arguments to `),$e=a("a"),Ot=a("strong"),Zr=n("call"),Hr=n("()"),Yr=n(` and returns the output,
together with resized `),Ut=a("code"),Qr=n("images"),Kr=n(". In case "),nt=a("a"),ea=n("LayoutLMv2FeatureExtractor"),ta=n(" was initialized with "),Wt=a("code"),oa=n("apply_ocr"),na=n(` set to
`),Ct=a("code"),ra=n("False"),aa=n(", it passes the words ("),Rt=a("code"),sa=n("text"),ia=n("/"),Bt=a("code"),la=n("text_pair`) and `boxes` specified by the user along with the additional arguments to [__call__()](/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer.__call__) and returns the output, together with resized `images"),da=n("."),ca=d(),Vt=a("p"),ua=n("Please refer to the docstring of the above two methods for more information."),this.h()},l(t){const u=Os('[data-svelte="svelte-1phssyn"]',document.head);O=s(u,"META",{name:!0,content:!0}),u.forEach(o),Gt=c(t),U=s(t,"H1",{class:!0});var po=i(U);V=s(po,"A",{id:!0,class:!0,href:!0});var ka=i(V);dt=s(ka,"SPAN",{});var ya=i(dt);y(ne.$$.fragment,ya),ya.forEach(o),ka.forEach(o),Mo=c(po),ct=s(po,"SPAN",{});var ba=i(ct);Xo=r(ba,"LayoutXLM"),ba.forEach(o),po.forEach(o),Jt=c(t),W=s(t,"H2",{class:!0});var fo=i(W);j=s(fo,"A",{id:!0,class:!0,href:!0});var La=i(j);ut=s(La,"SPAN",{});var va=i(ut);y(re.$$.fragment,va),va.forEach(o),La.forEach(o),Eo=c(fo),mt=s(fo,"SPAN",{});var wa=i(mt);qo=r(wa,"Overview"),wa.forEach(o),fo.forEach(o),Zt=c(t),q=s(t,"P",{});var rt=i(q);$o=r(rt,"LayoutXLM was proposed in "),ae=s(rt,"A",{href:!0,rel:!0});var xa=i(ae);Fo=r(xa,"LayoutXLM: Multimodal Pre-training for Multilingual Visually-rich Document Understanding"),xa.forEach(o),Po=r(rt,` by Yiheng Xu, Tengchao Lv, Lei Cui, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha
Zhang, Furu Wei. It\u2019s a multilingual extension of the `),se=s(rt,"A",{href:!0,rel:!0});var Ta=i(se);No=r(Ta,"LayoutLMv2 model"),Ta.forEach(o),Do=r(rt,` trained
on 53 languages.`),rt.forEach(o),Ht=c(t),Fe=s(t,"P",{});var za=i(Fe);Ao=r(za,"The abstract from the paper is the following:"),za.forEach(o),Yt=c(t),Pe=s(t,"P",{});var Ma=i(Pe);pt=s(Ma,"EM",{});var Xa=i(pt);Io=r(Xa,`Multimodal pre-training with text, layout, and image has achieved SOTA performance for visually-rich document
understanding tasks recently, which demonstrates the great potential for joint learning across different modalities. In
this paper, we present LayoutXLM, a multimodal pre-trained model for multilingual document understanding, which aims to
bridge the language barriers for visually-rich document understanding. To accurately evaluate LayoutXLM, we also
introduce a multilingual form understanding benchmark dataset named XFUN, which includes form understanding samples in
7 languages (Chinese, Japanese, Spanish, French, Italian, German, Portuguese), and key-value pairs are manually labeled
for each language. Experiment results show that the LayoutXLM model has significantly outperformed the existing SOTA
cross-lingual pre-trained models on the XFUN dataset.`),Xa.forEach(o),Ma.forEach(o),Qt=c(t),Ne=s(t,"P",{});var Ea=i(Ne);So=r(Ea,"One can directly plug in the weights of LayoutXLM into a LayoutLMv2 model, like so:"),Ea.forEach(o),Kt=c(t),y(ie.$$.fragment,t),eo=c(t),$=s(t,"P",{});var at=i($);Oo=r(at,`Note that LayoutXLM has its own tokenizer, based on
`),De=s(at,"A",{href:!0});var qa=i(De);Uo=r(qa,"LayoutXLMTokenizer"),qa.forEach(o),Wo=r(at,"/"),Ae=s(at,"A",{href:!0});var $a=i(Ae);Co=r($a,"LayoutXLMTokenizerFast"),$a.forEach(o),Ro=r(at,`. You can initialize it as
follows:`),at.forEach(o),to=c(t),y(le.$$.fragment,t),oo=c(t),z=s(t,"P",{});var D=i(z);Bo=r(D,"Similar to LayoutLMv2, you can use "),Ie=s(D,"A",{href:!0});var Fa=i(Ie);Vo=r(Fa,"LayoutXLMProcessor"),Fa.forEach(o),jo=r(D,` (which internally applies
`),Se=s(D,"A",{href:!0});var Pa=i(Se);Go=r(Pa,"LayoutLMv2FeatureExtractor"),Pa.forEach(o),Jo=r(D,` and
`),Oe=s(D,"A",{href:!0});var Na=i(Oe);Zo=r(Na,"LayoutXLMTokenizer"),Na.forEach(o),Ho=r(D,"/"),Ue=s(D,"A",{href:!0});var Da=i(Ue);Yo=r(Da,"LayoutXLMTokenizerFast"),Da.forEach(o),Qo=r(D,` in sequence) to prepare all
data for the model.`),D.forEach(o),no=c(t),G=s(t,"P",{});var ho=i(G);Ko=r(ho,"As LayoutXLM\u2019s architecture is equivalent to that of LayoutLMv2, one can refer to "),We=s(ho,"A",{href:!0});var Aa=i(We);en=r(Aa,"LayoutLMv2\u2019s documentation page"),Aa.forEach(o),tn=r(ho," for all tips, code examples and notebooks."),ho.forEach(o),ro=c(t),F=s(t,"P",{});var st=i(F);on=r(st,"This model was contributed by "),de=s(st,"A",{href:!0,rel:!0});var Ia=i(de);nn=r(Ia,"nielsr"),Ia.forEach(o),rn=r(st,". The original code can be found "),ce=s(st,"A",{href:!0,rel:!0});var Sa=i(ce);an=r(Sa,"here"),Sa.forEach(o),sn=r(st,"."),st.forEach(o),ao=c(t),C=s(t,"H2",{class:!0});var _o=i(C);J=s(_o,"A",{id:!0,class:!0,href:!0});var Oa=i(J);ft=s(Oa,"SPAN",{});var Ua=i(ft);y(ue.$$.fragment,Ua),Ua.forEach(o),Oa.forEach(o),ln=c(_o),ht=s(_o,"SPAN",{});var Wa=i(ht);dn=r(Wa,"LayoutXLMTokenizer"),Wa.forEach(o),_o.forEach(o),so=c(t),_=s(t,"DIV",{class:!0});var x=i(_);y(me.$$.fragment,x),cn=c(x),E=s(x,"P",{});var te=i(E);un=r(te,"Adapted from "),Ce=s(te,"A",{href:!0});var Ca=i(Ce);mn=r(Ca,"RobertaTokenizer"),Ca.forEach(o),pn=r(te," and "),Re=s(te,"A",{href:!0});var Ra=i(Re);fn=r(Ra,"XLNetTokenizer"),Ra.forEach(o),hn=r(te,`. Based on
`),pe=s(te,"A",{href:!0,rel:!0});var Ba=i(pe);_n=r(Ba,"SentencePiece"),Ba.forEach(o),gn=r(te,"."),te.forEach(o),kn=c(x),fe=s(x,"P",{});var go=i(fe);yn=r(go,"This tokenizer inherits from "),Be=s(go,"A",{href:!0});var Va=i(Be);bn=r(Va,"PreTrainedTokenizer"),Va.forEach(o),Ln=r(go,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),go.forEach(o),vn=c(x),Z=s(x,"DIV",{class:!0});var ko=i(Z);y(he.$$.fragment,ko),wn=c(ko),_t=s(ko,"P",{});var ja=i(_t);xn=r(ja,`Main method to tokenize and prepare for the model one or several sequence(s) or one or several pair(s) of
sequences with word-level normalized bounding boxes and optional labels.`),ja.forEach(o),ko.forEach(o),Tn=c(x),P=s(x,"DIV",{class:!0});var it=i(P);y(_e.$$.fragment,it),zn=c(it),gt=s(it,"P",{});var Ga=i(gt);Mn=r(Ga,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. An XLM-RoBERTa sequence has the following format:`),Ga.forEach(o),Xn=c(it),ge=s(it,"UL",{});var yo=i(ge);Ve=s(yo,"LI",{});var ma=i(Ve);En=r(ma,"single sequence: "),kt=s(ma,"CODE",{});var Ja=i(kt);qn=r(Ja,"<s> X </s>"),Ja.forEach(o),ma.forEach(o),$n=c(yo),je=s(yo,"LI",{});var pa=i(je);Fn=r(pa,"pair of sequences: "),yt=s(pa,"CODE",{});var Za=i(yt);Pn=r(Za,"<s> A </s></s> B </s>"),Za.forEach(o),pa.forEach(o),yo.forEach(o),it.forEach(o),Nn=c(x),H=s(x,"DIV",{class:!0});var bo=i(H);y(ke.$$.fragment,bo),Dn=c(bo),ye=s(bo,"P",{});var Lo=i(ye);An=r(Lo,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),bt=s(Lo,"CODE",{});var Ha=i(bt);In=r(Ha,"prepare_for_model"),Ha.forEach(o),Sn=r(Lo," method."),Lo.forEach(o),bo.forEach(o),On=c(x),Y=s(x,"DIV",{class:!0});var vo=i(Y);y(be.$$.fragment,vo),Un=c(vo),Lt=s(vo,"P",{});var Ya=i(Lt);Wn=r(Ya,`Create a mask from the two sequences passed to be used in a sequence-pair classification task. XLM-RoBERTa does
not make use of token type ids, therefore a list of zeros is returned.`),Ya.forEach(o),vo.forEach(o),Cn=c(x),Ge=s(x,"DIV",{class:!0});var Qa=i(Ge);y(Le.$$.fragment,Qa),Qa.forEach(o),x.forEach(o),io=c(t),R=s(t,"H2",{class:!0});var wo=i(R);Q=s(wo,"A",{id:!0,class:!0,href:!0});var Ka=i(Q);vt=s(Ka,"SPAN",{});var es=i(vt);y(ve.$$.fragment,es),es.forEach(o),Ka.forEach(o),Rn=c(wo),wt=s(wo,"SPAN",{});var ts=i(wt);Bn=r(ts,"LayoutXLMTokenizerFast"),ts.forEach(o),wo.forEach(o),lo=c(t),M=s(t,"DIV",{class:!0});var oe=i(M);y(we.$$.fragment,oe),Vn=c(oe),X=s(oe,"P",{});var A=i(X);jn=r(A,"Construct a \u201Cfast\u201D LayoutXLM tokenizer (backed by HuggingFace\u2019s "),xt=s(A,"EM",{});var os=i(xt);Gn=r(os,"tokenizers"),os.forEach(o),Jn=r(A,` library). Adapted from
`),Je=s(A,"A",{href:!0});var ns=i(Je);Zn=r(ns,"RobertaTokenizer"),ns.forEach(o),Hn=r(A," and "),Ze=s(A,"A",{href:!0});var rs=i(Ze);Yn=r(rs,"XLNetTokenizer"),rs.forEach(o),Qn=r(A,`. Based on
`),xe=s(A,"A",{href:!0,rel:!0});var as=i(xe);Kn=r(as,"BPE"),as.forEach(o),er=r(A,"."),A.forEach(o),tr=c(oe),Te=s(oe,"P",{});var xo=i(Te);or=r(xo,"This tokenizer inherits from "),He=s(xo,"A",{href:!0});var ss=i(He);nr=r(ss,"PreTrainedTokenizerFast"),ss.forEach(o),rr=r(xo,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),xo.forEach(o),ar=c(oe),K=s(oe,"DIV",{class:!0});var To=i(K);y(ze.$$.fragment,To),sr=c(To),Tt=s(To,"P",{});var is=i(Tt);ir=r(is,`Main method to tokenize and prepare for the model one or several sequence(s) or one or several pair(s) of
sequences with word-level normalized bounding boxes and optional labels.`),is.forEach(o),To.forEach(o),oe.forEach(o),co=c(t),B=s(t,"H2",{class:!0});var zo=i(B);ee=s(zo,"A",{id:!0,class:!0,href:!0});var ls=i(ee);zt=s(ls,"SPAN",{});var ds=i(zt);y(Me.$$.fragment,ds),ds.forEach(o),ls.forEach(o),lr=c(zo),Mt=s(zo,"SPAN",{});var cs=i(Mt);dr=r(cs,"LayoutXLMProcessor"),cs.forEach(o),zo.forEach(o),uo=c(t),T=s(t,"DIV",{class:!0});var I=i(T);y(Xe.$$.fragment,I),cr=c(I),Xt=s(I,"P",{});var us=i(Xt);ur=r(us,`Constructs a LayoutXLM processor which combines a LayoutXLM feature extractor and a LayoutXLM tokenizer into a
single processor.`),us.forEach(o),mr=c(I),Ye=s(I,"P",{});var fa=i(Ye);Qe=s(fa,"A",{href:!0});var ms=i(Qe);pr=r(ms,"LayoutXLMProcessor"),ms.forEach(o),fr=r(fa," offers all the functionalities you need to prepare data for the model."),fa.forEach(o),hr=c(I),h=s(I,"P",{});var g=i(h);_r=r(g,"It first uses "),Ke=s(g,"A",{href:!0});var ps=i(Ke);gr=r(ps,"LayoutLMv2FeatureExtractor"),ps.forEach(o),kr=r(g,` to resize document images to a fixed size, and optionally applies OCR
to get words and normalized bounding boxes. These are then provided to `),et=s(g,"A",{href:!0});var fs=i(et);yr=r(fs,"LayoutXLMTokenizer"),fs.forEach(o),br=r(g,` or
`),tt=s(g,"A",{href:!0});var hs=i(tt);Lr=r(hs,"LayoutXLMTokenizerFast"),hs.forEach(o),vr=r(g,", which turns the words and bounding boxes into token-level "),Et=s(g,"CODE",{});var _s=i(Et);wr=r(_s,"input_ids"),_s.forEach(o),xr=r(g,`,
`),qt=s(g,"CODE",{});var gs=i(qt);Tr=r(gs,"attention_mask"),gs.forEach(o),zr=r(g,", "),$t=s(g,"CODE",{});var ks=i($t);Mr=r(ks,"token_type_ids"),ks.forEach(o),Xr=r(g,", "),Ft=s(g,"CODE",{});var ys=i(Ft);Er=r(ys,"bbox"),ys.forEach(o),qr=r(g,". Optionally, one can provide integer "),Pt=s(g,"CODE",{});var bs=i(Pt);$r=r(bs,"word_labels"),bs.forEach(o),Fr=r(g,`, which are turned
into token-level `),Nt=s(g,"CODE",{});var Ls=i(Nt);Pr=r(Ls,"labels"),Ls.forEach(o),Nr=r(g," for token classification tasks (such as FUNSD, CORD)."),g.forEach(o),Dr=c(I),N=s(I,"DIV",{class:!0});var lt=i(N);y(Ee.$$.fragment,lt),Ar=c(lt),p=s(lt,"P",{});var f=i(p);Ir=r(f,"This method first forwards the "),Dt=s(f,"CODE",{});var vs=i(Dt);Sr=r(vs,"images"),vs.forEach(o),Or=r(f," argument to "),qe=s(f,"A",{href:!0});var ha=i(qe);At=s(ha,"STRONG",{});var ws=i(At);Ur=r(ws,"call"),ws.forEach(o),Wr=r(ha,"()"),ha.forEach(o),Cr=r(f,`. In case
`),ot=s(f,"A",{href:!0});var xs=i(ot);Rr=r(xs,"LayoutLMv2FeatureExtractor"),xs.forEach(o),Br=r(f," was initialized with "),It=s(f,"CODE",{});var Ts=i(It);Vr=r(Ts,"apply_ocr"),Ts.forEach(o),jr=r(f," set to "),St=s(f,"CODE",{});var zs=i(St);Gr=r(zs,"True"),zs.forEach(o),Jr=r(f,`, it passes the obtained words and
bounding boxes along with the additional arguments to `),$e=s(f,"A",{href:!0});var _a=i($e);Ot=s(_a,"STRONG",{});var Ms=i(Ot);Zr=r(Ms,"call"),Ms.forEach(o),Hr=r(_a,"()"),_a.forEach(o),Yr=r(f,` and returns the output,
together with resized `),Ut=s(f,"CODE",{});var Xs=i(Ut);Qr=r(Xs,"images"),Xs.forEach(o),Kr=r(f,". In case "),nt=s(f,"A",{href:!0});var Es=i(nt);ea=r(Es,"LayoutLMv2FeatureExtractor"),Es.forEach(o),ta=r(f," was initialized with "),Wt=s(f,"CODE",{});var qs=i(Wt);oa=r(qs,"apply_ocr"),qs.forEach(o),na=r(f,` set to
`),Ct=s(f,"CODE",{});var $s=i(Ct);ra=r($s,"False"),$s.forEach(o),aa=r(f,", it passes the words ("),Rt=s(f,"CODE",{});var Fs=i(Rt);sa=r(Fs,"text"),Fs.forEach(o),ia=r(f,"/"),Bt=s(f,"CODE",{});var Ps=i(Bt);la=r(Ps,"text_pair`) and `boxes` specified by the user along with the additional arguments to [__call__()](/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer.__call__) and returns the output, together with resized `images"),Ps.forEach(o),da=r(f,"."),f.forEach(o),ca=c(lt),Vt=s(lt,"P",{});var Ns=i(Vt);ua=r(Ns,"Please refer to the docstring of the above two methods for more information."),Ns.forEach(o),lt.forEach(o),I.forEach(o),this.h()},h(){l(O,"name","hf:doc:metadata"),l(O,"content",JSON.stringify(Rs)),l(V,"id","layoutxlm"),l(V,"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"),l(V,"href","#layoutxlm"),l(U,"class","relative group"),l(j,"id","overview"),l(j,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(j,"href","#overview"),l(W,"class","relative group"),l(ae,"href","https://arxiv.org/abs/2104.08836"),l(ae,"rel","nofollow"),l(se,"href","https://arxiv.org/abs/2012.14740"),l(se,"rel","nofollow"),l(De,"href","/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer"),l(Ae,"href","/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizerFast"),l(Ie,"href","/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMProcessor"),l(Se,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor"),l(Oe,"href","/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer"),l(Ue,"href","/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizerFast"),l(We,"href","layoutlmv2"),l(de,"href","https://huggingface.co/nielsr"),l(de,"rel","nofollow"),l(ce,"href","https://github.com/microsoft/unilm"),l(ce,"rel","nofollow"),l(J,"id","transformers.LayoutXLMTokenizer"),l(J,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(J,"href","#transformers.LayoutXLMTokenizer"),l(C,"class","relative group"),l(Ce,"href","/docs/transformers/v4.30.0/en/model_doc/roberta#transformers.RobertaTokenizer"),l(Re,"href","/docs/transformers/v4.30.0/en/model_doc/xlnet#transformers.XLNetTokenizer"),l(pe,"href","https://github.com/google/sentencepiece"),l(pe,"rel","nofollow"),l(Be,"href","/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),l(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Q,"id","transformers.LayoutXLMTokenizerFast"),l(Q,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Q,"href","#transformers.LayoutXLMTokenizerFast"),l(R,"class","relative group"),l(Je,"href","/docs/transformers/v4.30.0/en/model_doc/roberta#transformers.RobertaTokenizer"),l(Ze,"href","/docs/transformers/v4.30.0/en/model_doc/xlnet#transformers.XLNetTokenizer"),l(xe,"href","https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=BPE#models"),l(xe,"rel","nofollow"),l(He,"href","/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),l(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ee,"id","transformers.LayoutXLMProcessor"),l(ee,"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"),l(ee,"href","#transformers.LayoutXLMProcessor"),l(B,"class","relative group"),l(Qe,"href","/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMProcessor"),l(Ke,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor"),l(et,"href","/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer"),l(tt,"href","/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizerFast"),l(qe,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__"),l(ot,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor"),l($e,"href","/docs/transformers/v4.30.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer.__call__"),l(nt,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor"),l(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(T,"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,u){e(document.head,O),m(t,Gt,u),m(t,U,u),e(U,V),e(V,dt),b(ne,dt,null),e(U,Mo),e(U,ct),e(ct,Xo),m(t,Jt,u),m(t,W,u),e(W,j),e(j,ut),b(re,ut,null),e(W,Eo),e(W,mt),e(mt,qo),m(t,Zt,u),m(t,q,u),e(q,$o),e(q,ae),e(ae,Fo),e(q,Po),e(q,se),e(se,No),e(q,Do),m(t,Ht,u),m(t,Fe,u),e(Fe,Ao),m(t,Yt,u),m(t,Pe,u),e(Pe,pt),e(pt,Io),m(t,Qt,u),m(t,Ne,u),e(Ne,So),m(t,Kt,u),b(ie,t,u),m(t,eo,u),m(t,$,u),e($,Oo),e($,De),e(De,Uo),e($,Wo),e($,Ae),e(Ae,Co),e($,Ro),m(t,to,u),b(le,t,u),m(t,oo,u),m(t,z,u),e(z,Bo),e(z,Ie),e(Ie,Vo),e(z,jo),e(z,Se),e(Se,Go),e(z,Jo),e(z,Oe),e(Oe,Zo),e(z,Ho),e(z,Ue),e(Ue,Yo),e(z,Qo),m(t,no,u),m(t,G,u),e(G,Ko),e(G,We),e(We,en),e(G,tn),m(t,ro,u),m(t,F,u),e(F,on),e(F,de),e(de,nn),e(F,rn),e(F,ce),e(ce,an),e(F,sn),m(t,ao,u),m(t,C,u),e(C,J),e(J,ft),b(ue,ft,null),e(C,ln),e(C,ht),e(ht,dn),m(t,so,u),m(t,_,u),b(me,_,null),e(_,cn),e(_,E),e(E,un),e(E,Ce),e(Ce,mn),e(E,pn),e(E,Re),e(Re,fn),e(E,hn),e(E,pe),e(pe,_n),e(E,gn),e(_,kn),e(_,fe),e(fe,yn),e(fe,Be),e(Be,bn),e(fe,Ln),e(_,vn),e(_,Z),b(he,Z,null),e(Z,wn),e(Z,_t),e(_t,xn),e(_,Tn),e(_,P),b(_e,P,null),e(P,zn),e(P,gt),e(gt,Mn),e(P,Xn),e(P,ge),e(ge,Ve),e(Ve,En),e(Ve,kt),e(kt,qn),e(ge,$n),e(ge,je),e(je,Fn),e(je,yt),e(yt,Pn),e(_,Nn),e(_,H),b(ke,H,null),e(H,Dn),e(H,ye),e(ye,An),e(ye,bt),e(bt,In),e(ye,Sn),e(_,On),e(_,Y),b(be,Y,null),e(Y,Un),e(Y,Lt),e(Lt,Wn),e(_,Cn),e(_,Ge),b(Le,Ge,null),m(t,io,u),m(t,R,u),e(R,Q),e(Q,vt),b(ve,vt,null),e(R,Rn),e(R,wt),e(wt,Bn),m(t,lo,u),m(t,M,u),b(we,M,null),e(M,Vn),e(M,X),e(X,jn),e(X,xt),e(xt,Gn),e(X,Jn),e(X,Je),e(Je,Zn),e(X,Hn),e(X,Ze),e(Ze,Yn),e(X,Qn),e(X,xe),e(xe,Kn),e(X,er),e(M,tr),e(M,Te),e(Te,or),e(Te,He),e(He,nr),e(Te,rr),e(M,ar),e(M,K),b(ze,K,null),e(K,sr),e(K,Tt),e(Tt,ir),m(t,co,u),m(t,B,u),e(B,ee),e(ee,zt),b(Me,zt,null),e(B,lr),e(B,Mt),e(Mt,dr),m(t,uo,u),m(t,T,u),b(Xe,T,null),e(T,cr),e(T,Xt),e(Xt,ur),e(T,mr),e(T,Ye),e(Ye,Qe),e(Qe,pr),e(Ye,fr),e(T,hr),e(T,h),e(h,_r),e(h,Ke),e(Ke,gr),e(h,kr),e(h,et),e(et,yr),e(h,br),e(h,tt),e(tt,Lr),e(h,vr),e(h,Et),e(Et,wr),e(h,xr),e(h,qt),e(qt,Tr),e(h,zr),e(h,$t),e($t,Mr),e(h,Xr),e(h,Ft),e(Ft,Er),e(h,qr),e(h,Pt),e(Pt,$r),e(h,Fr),e(h,Nt),e(Nt,Pr),e(h,Nr),e(T,Dr),e(T,N),b(Ee,N,null),e(N,Ar),e(N,p),e(p,Ir),e(p,Dt),e(Dt,Sr),e(p,Or),e(p,qe),e(qe,At),e(At,Ur),e(qe,Wr),e(p,Cr),e(p,ot),e(ot,Rr),e(p,Br),e(p,It),e(It,Vr),e(p,jr),e(p,St),e(St,Gr),e(p,Jr),e(p,$e),e($e,Ot),e(Ot,Zr),e($e,Hr),e(p,Yr),e(p,Ut),e(Ut,Qr),e(p,Kr),e(p,nt),e(nt,ea),e(p,ta),e(p,Wt),e(Wt,oa),e(p,na),e(p,Ct),e(Ct,ra),e(p,aa),e(p,Rt),e(Rt,sa),e(p,ia),e(p,Bt),e(Bt,la),e(p,da),e(N,ca),e(N,Vt),e(Vt,ua),mo=!0},p:Us,i(t){mo||(L(ne.$$.fragment,t),L(re.$$.fragment,t),L(ie.$$.fragment,t),L(le.$$.fragment,t),L(ue.$$.fragment,t),L(me.$$.fragment,t),L(he.$$.fragment,t),L(_e.$$.fragment,t),L(ke.$$.fragment,t),L(be.$$.fragment,t),L(Le.$$.fragment,t),L(ve.$$.fragment,t),L(we.$$.fragment,t),L(ze.$$.fragment,t),L(Me.$$.fragment,t),L(Xe.$$.fragment,t),L(Ee.$$.fragment,t),mo=!0)},o(t){v(ne.$$.fragment,t),v(re.$$.fragment,t),v(ie.$$.fragment,t),v(le.$$.fragment,t),v(ue.$$.fragment,t),v(me.$$.fragment,t),v(he.$$.fragment,t),v(_e.$$.fragment,t),v(ke.$$.fragment,t),v(be.$$.fragment,t),v(Le.$$.fragment,t),v(ve.$$.fragment,t),v(we.$$.fragment,t),v(ze.$$.fragment,t),v(Me.$$.fragment,t),v(Xe.$$.fragment,t),v(Ee.$$.fragment,t),mo=!1},d(t){o(O),t&&o(Gt),t&&o(U),w(ne),t&&o(Jt),t&&o(W),w(re),t&&o(Zt),t&&o(q),t&&o(Ht),t&&o(Fe),t&&o(Yt),t&&o(Pe),t&&o(Qt),t&&o(Ne),t&&o(Kt),w(ie,t),t&&o(eo),t&&o($),t&&o(to),w(le,t),t&&o(oo),t&&o(z),t&&o(no),t&&o(G),t&&o(ro),t&&o(F),t&&o(ao),t&&o(C),w(ue),t&&o(so),t&&o(_),w(me),w(he),w(_e),w(ke),w(be),w(Le),t&&o(io),t&&o(R),w(ve),t&&o(lo),t&&o(M),w(we),w(ze),t&&o(co),t&&o(B),w(Me),t&&o(uo),t&&o(T),w(Xe),w(Ee)}}}const Rs={local:"layoutxlm",sections:[{local:"overview",title:"Overview"},{local:"transformers.LayoutXLMTokenizer",title:"LayoutXLMTokenizer"},{local:"transformers.LayoutXLMTokenizerFast",title:"LayoutXLMTokenizerFast"},{local:"transformers.LayoutXLMProcessor",title:"LayoutXLMProcessor"}],title:"LayoutXLM"};function Bs(ga){return Ws(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Zs extends As{constructor(O){super();Is(this,O,Bs,Cs,Ss,{})}}export{Zs as default,Rs as metadata};
