import{S as Fs,i as Ns,s as Is,e as a,k as d,w as k,t as n,M as Ds,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 As,q as L,o as v,B as w,v as Os}from"../../chunks/vendor-hf-doc-builder.js";import{D as O}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ps}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Vt}from"../../chunks/IconCopyLink-hf-doc-builder.js";function Ss(fa){let S,jt,C,V,st,ne,zo,it,Mo,Gt,U,j,lt,re,Xo,dt,qo,Jt,E,Eo,ae,$o,Po,se,Fo,No,Zt,$e,Io,Ht,Pe,ct,Do,Yt,Fe,Ao,Qt,ie,Kt,$,Oo,Ne,So,Co,Ie,Uo,Wo,eo,le,to,z,Ro,De,Bo,Vo,Ae,jo,Go,Oe,Jo,Zo,Se,Ho,Yo,oo,G,Qo,Ce,Ko,en,no,P,tn,de,on,nn,ce,rn,an,ro,W,J,ut,ue,sn,mt,ln,ao,_,me,dn,q,cn,Ue,un,mn,We,pn,fn,pe,hn,_n,gn,fe,kn,Re,yn,bn,Ln,Z,he,vn,pt,wn,Tn,F,_e,xn,ft,zn,Mn,ge,Be,Xn,ht,qn,En,Ve,$n,_t,Pn,Fn,H,ke,Nn,ye,In,gt,Dn,An,On,Y,be,Sn,kt,Cn,Un,je,Le,so,R,Q,yt,ve,Wn,bt,Rn,io,M,we,Bn,X,Vn,Lt,jn,Gn,Ge,Jn,Zn,Je,Hn,Yn,Te,Qn,Kn,er,xe,tr,Ze,or,nr,rr,K,ze,ar,vt,sr,lo,B,ee,wt,Me,ir,Tt,lr,co,x,Xe,dr,xt,cr,ur,He,Ye,mr,pr,fr,h,hr,Qe,_r,gr,Ke,kr,yr,et,br,Lr,zt,vr,wr,Mt,Tr,xr,Xt,zr,Mr,qt,Xr,qr,Et,Er,$r,$t,Pr,Fr,Nr,N,qe,Ir,p,Dr,Pt,Ar,Or,Ft,Sr,Cr,Nt,Ur,Wr,It,Rr,Br,Dt,Vr,jr,Ee,At,Gr,Jr,Zr,Ot,Hr,Yr,St,Qr,Kr,Ct,ea,ta,Ut,oa,na,Wt,ra,aa,Rt,sa,ia,la,Bt,da,uo;return ne=new Vt({}),re=new Vt({}),ie=new Ps({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 Ps({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 Vt({}),me=new O({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.33.0/src/transformers/models/layoutxlm/tokenization_layoutxlm.py#L149"}}),he=new O({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.33.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.33.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.33.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.33.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.33.0/src/transformers/models/layoutxlm/tokenization_layoutxlm.py#L444",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.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.33.0/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),_e=new O({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.33.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 O({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.33.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 O({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.33.0/src/transformers/models/layoutxlm/tokenization_layoutxlm.py#L370",returnDescription:`
<p>List of zeros.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Le=new O({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.33.0/src/transformers/models/layoutxlm/tokenization_layoutxlm.py#L427"}}),ve=new Vt({}),we=new O({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.33.0/src/transformers/models/layoutxlm/tokenization_layoutxlm_fast.py#L152"}}),ze=new O({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.33.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.33.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.33.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.33.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.33.0/src/transformers/models/layoutxlm/tokenization_layoutxlm_fast.py#L272",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.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.33.0/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),Me=new Vt({}),Xe=new O({props:{name:"class transformers.LayoutXLMProcessor",anchor:"transformers.LayoutXLMProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutXLMProcessor.image_processor",description:`<strong>image_processor</strong> (<code>LayoutLMv2ImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/v4.33.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor">LayoutLMv2ImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.LayoutXLMProcessor.tokenizer",description:`<strong>tokenizer</strong> (<code>LayoutXLMTokenizer</code> or <code>LayoutXLMTokenizerFast</code>) &#x2014;
An instance of <a href="/docs/transformers/v4.33.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer">LayoutXLMTokenizer</a> or <a href="/docs/transformers/v4.33.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.33.0/src/transformers/models/layoutxlm/processing_layoutxlm.py#L26"}}),qe=new O({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.33.0/src/transformers/models/layoutxlm/processing_layoutxlm.py#L67"}}),{c(){S=a("meta"),jt=d(),C=a("h1"),V=a("a"),st=a("span"),k(ne.$$.fragment),zo=d(),it=a("span"),Mo=n("LayoutXLM"),Gt=d(),U=a("h2"),j=a("a"),lt=a("span"),k(re.$$.fragment),Xo=d(),dt=a("span"),qo=n("Overview"),Jt=d(),E=a("p"),Eo=n("LayoutXLM was proposed in "),ae=a("a"),$o=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"),Fo=n("LayoutLMv2 model"),No=n(` trained
on 53 languages.`),Zt=d(),$e=a("p"),Io=n("The abstract from the paper is the following:"),Ht=d(),Pe=a("p"),ct=a("em"),Do=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.`),Yt=d(),Fe=a("p"),Ao=n("One can directly plug in the weights of LayoutXLM into a LayoutLMv2 model, like so:"),Qt=d(),k(ie.$$.fragment),Kt=d(),$=a("p"),Oo=n(`Note that LayoutXLM has its own tokenizer, based on
`),Ne=a("a"),So=n("LayoutXLMTokenizer"),Co=n("/"),Ie=a("a"),Uo=n("LayoutXLMTokenizerFast"),Wo=n(`. You can initialize it as
follows:`),eo=d(),k(le.$$.fragment),to=d(),z=a("p"),Ro=n("Similar to LayoutLMv2, you can use "),De=a("a"),Bo=n("LayoutXLMProcessor"),Vo=n(` (which internally applies
`),Ae=a("a"),jo=n("LayoutLMv2ImageProcessor"),Go=n(` and
`),Oe=a("a"),Jo=n("LayoutXLMTokenizer"),Zo=n("/"),Se=a("a"),Ho=n("LayoutXLMTokenizerFast"),Yo=n(` in sequence) to prepare all
data for the model.`),oo=d(),G=a("p"),Qo=n("As LayoutXLM\u2019s architecture is equivalent to that of LayoutLMv2, one can refer to "),Ce=a("a"),Ko=n("LayoutLMv2\u2019s documentation page"),en=n(" for all tips, code examples and notebooks."),no=d(),P=a("p"),tn=n("This model was contributed by "),de=a("a"),on=n("nielsr"),nn=n(". The original code can be found "),ce=a("a"),rn=n("here"),an=n("."),ro=d(),W=a("h2"),J=a("a"),ut=a("span"),k(ue.$$.fragment),sn=d(),mt=a("span"),ln=n("LayoutXLMTokenizer"),ao=d(),_=a("div"),k(me.$$.fragment),dn=d(),q=a("p"),cn=n("Adapted from "),Ue=a("a"),un=n("RobertaTokenizer"),mn=n(" and "),We=a("a"),pn=n("XLNetTokenizer"),fn=n(`. Based on
`),pe=a("a"),hn=n("SentencePiece"),_n=n("."),gn=d(),fe=a("p"),kn=n("This tokenizer inherits from "),Re=a("a"),yn=n("PreTrainedTokenizer"),bn=n(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Ln=d(),Z=a("div"),k(he.$$.fragment),vn=d(),pt=a("p"),wn=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(),F=a("div"),k(_e.$$.fragment),xn=d(),ft=a("p"),zn=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:`),Mn=d(),ge=a("ul"),Be=a("li"),Xn=n("single sequence: "),ht=a("code"),qn=n("<s> X </s>"),En=d(),Ve=a("li"),$n=n("pair of sequences: "),_t=a("code"),Pn=n("<s> A </s></s> B </s>"),Fn=d(),H=a("div"),k(ke.$$.fragment),Nn=d(),ye=a("p"),In=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 `),gt=a("code"),Dn=n("prepare_for_model"),An=n(" method."),On=d(),Y=a("div"),k(be.$$.fragment),Sn=d(),kt=a("p"),Cn=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.`),Un=d(),je=a("div"),k(Le.$$.fragment),so=d(),R=a("h2"),Q=a("a"),yt=a("span"),k(ve.$$.fragment),Wn=d(),bt=a("span"),Rn=n("LayoutXLMTokenizerFast"),io=d(),M=a("div"),k(we.$$.fragment),Bn=d(),X=a("p"),Vn=n("Construct a \u201Cfast\u201D LayoutXLM tokenizer (backed by HuggingFace\u2019s "),Lt=a("em"),jn=n("tokenizers"),Gn=n(` library). Adapted from
`),Ge=a("a"),Jn=n("RobertaTokenizer"),Zn=n(" and "),Je=a("a"),Hn=n("XLNetTokenizer"),Yn=n(`. Based on
`),Te=a("a"),Qn=n("BPE"),Kn=n("."),er=d(),xe=a("p"),tr=n("This tokenizer inherits from "),Ze=a("a"),or=n("PreTrainedTokenizerFast"),nr=n(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),rr=d(),K=a("div"),k(ze.$$.fragment),ar=d(),vt=a("p"),sr=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.`),lo=d(),B=a("h2"),ee=a("a"),wt=a("span"),k(Me.$$.fragment),ir=d(),Tt=a("span"),lr=n("LayoutXLMProcessor"),co=d(),x=a("div"),k(Xe.$$.fragment),dr=d(),xt=a("p"),cr=n(`Constructs a LayoutXLM processor which combines a LayoutXLM image processor and a LayoutXLM tokenizer into a single
processor.`),ur=d(),He=a("p"),Ye=a("a"),mr=n("LayoutXLMProcessor"),pr=n(" offers all the functionalities you need to prepare data for the model."),fr=d(),h=a("p"),hr=n("It first uses "),Qe=a("a"),_r=n("LayoutLMv2ImageProcessor"),gr=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 `),Ke=a("a"),kr=n("LayoutXLMTokenizer"),yr=n(` or
`),et=a("a"),br=n("LayoutXLMTokenizerFast"),Lr=n(", which turns the words and bounding boxes into token-level "),zt=a("code"),vr=n("input_ids"),wr=n(`,
`),Mt=a("code"),Tr=n("attention_mask"),xr=n(", "),Xt=a("code"),zr=n("token_type_ids"),Mr=n(", "),qt=a("code"),Xr=n("bbox"),qr=n(". Optionally, one can provide integer "),Et=a("code"),Er=n("word_labels"),$r=n(`, which are turned
into token-level `),$t=a("code"),Pr=n("labels"),Fr=n(" for token classification tasks (such as FUNSD, CORD)."),Nr=d(),N=a("div"),k(qe.$$.fragment),Ir=d(),p=a("p"),Dr=n("This method first forwards the "),Pt=a("code"),Ar=n("images"),Or=n(" argument to "),Ft=a("code"),Sr=n("~LayoutLMv2ImagePrpcessor.__call__"),Cr=n(`. In case
`),Nt=a("code"),Ur=n("LayoutLMv2ImagePrpcessor"),Wr=n(" was initialized with "),It=a("code"),Rr=n("apply_ocr"),Br=n(" set to "),Dt=a("code"),Vr=n("True"),jr=n(`, it passes the obtained words and
bounding boxes along with the additional arguments to `),Ee=a("a"),At=a("strong"),Gr=n("call"),Jr=n("()"),Zr=n(` and returns the output,
together with resized `),Ot=a("code"),Hr=n("images"),Yr=n(". In case "),St=a("code"),Qr=n("LayoutLMv2ImagePrpcessor"),Kr=n(" was initialized with "),Ct=a("code"),ea=n("apply_ocr"),ta=n(` set to
`),Ut=a("code"),oa=n("False"),na=n(", it passes the words ("),Wt=a("code"),ra=n("text"),aa=n("/"),Rt=a("code"),sa=n("text_pair`) and `boxes` specified by the user along with the additional arguments to [__call__()](/docs/transformers/v4.33.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer.__call__) and returns the output, together with resized `images"),ia=n("."),la=d(),Bt=a("p"),da=n("Please refer to the docstring of the above two methods for more information."),this.h()},l(t){const u=Ds('[data-svelte="svelte-1phssyn"]',document.head);S=s(u,"META",{name:!0,content:!0}),u.forEach(o),jt=c(t),C=s(t,"H1",{class:!0});var mo=i(C);V=s(mo,"A",{id:!0,class:!0,href:!0});var ha=i(V);st=s(ha,"SPAN",{});var _a=i(st);y(ne.$$.fragment,_a),_a.forEach(o),ha.forEach(o),zo=c(mo),it=s(mo,"SPAN",{});var ga=i(it);Mo=r(ga,"LayoutXLM"),ga.forEach(o),mo.forEach(o),Gt=c(t),U=s(t,"H2",{class:!0});var po=i(U);j=s(po,"A",{id:!0,class:!0,href:!0});var ka=i(j);lt=s(ka,"SPAN",{});var ya=i(lt);y(re.$$.fragment,ya),ya.forEach(o),ka.forEach(o),Xo=c(po),dt=s(po,"SPAN",{});var ba=i(dt);qo=r(ba,"Overview"),ba.forEach(o),po.forEach(o),Jt=c(t),E=s(t,"P",{});var tt=i(E);Eo=r(tt,"LayoutXLM was proposed in "),ae=s(tt,"A",{href:!0,rel:!0});var La=i(ae);$o=r(La,"LayoutXLM: Multimodal Pre-training for Multilingual Visually-rich Document Understanding"),La.forEach(o),Po=r(tt,` 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(tt,"A",{href:!0,rel:!0});var va=i(se);Fo=r(va,"LayoutLMv2 model"),va.forEach(o),No=r(tt,` trained
on 53 languages.`),tt.forEach(o),Zt=c(t),$e=s(t,"P",{});var wa=i($e);Io=r(wa,"The abstract from the paper is the following:"),wa.forEach(o),Ht=c(t),Pe=s(t,"P",{});var Ta=i(Pe);ct=s(Ta,"EM",{});var xa=i(ct);Do=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),Ta.forEach(o),Yt=c(t),Fe=s(t,"P",{});var za=i(Fe);Ao=r(za,"One can directly plug in the weights of LayoutXLM into a LayoutLMv2 model, like so:"),za.forEach(o),Qt=c(t),y(ie.$$.fragment,t),Kt=c(t),$=s(t,"P",{});var ot=i($);Oo=r(ot,`Note that LayoutXLM has its own tokenizer, based on
`),Ne=s(ot,"A",{href:!0});var Ma=i(Ne);So=r(Ma,"LayoutXLMTokenizer"),Ma.forEach(o),Co=r(ot,"/"),Ie=s(ot,"A",{href:!0});var Xa=i(Ie);Uo=r(Xa,"LayoutXLMTokenizerFast"),Xa.forEach(o),Wo=r(ot,`. You can initialize it as
follows:`),ot.forEach(o),eo=c(t),y(le.$$.fragment,t),to=c(t),z=s(t,"P",{});var I=i(z);Ro=r(I,"Similar to LayoutLMv2, you can use "),De=s(I,"A",{href:!0});var qa=i(De);Bo=r(qa,"LayoutXLMProcessor"),qa.forEach(o),Vo=r(I,` (which internally applies
`),Ae=s(I,"A",{href:!0});var Ea=i(Ae);jo=r(Ea,"LayoutLMv2ImageProcessor"),Ea.forEach(o),Go=r(I,` and
`),Oe=s(I,"A",{href:!0});var $a=i(Oe);Jo=r($a,"LayoutXLMTokenizer"),$a.forEach(o),Zo=r(I,"/"),Se=s(I,"A",{href:!0});var Pa=i(Se);Ho=r(Pa,"LayoutXLMTokenizerFast"),Pa.forEach(o),Yo=r(I,` in sequence) to prepare all
data for the model.`),I.forEach(o),oo=c(t),G=s(t,"P",{});var fo=i(G);Qo=r(fo,"As LayoutXLM\u2019s architecture is equivalent to that of LayoutLMv2, one can refer to "),Ce=s(fo,"A",{href:!0});var Fa=i(Ce);Ko=r(Fa,"LayoutLMv2\u2019s documentation page"),Fa.forEach(o),en=r(fo," for all tips, code examples and notebooks."),fo.forEach(o),no=c(t),P=s(t,"P",{});var nt=i(P);tn=r(nt,"This model was contributed by "),de=s(nt,"A",{href:!0,rel:!0});var Na=i(de);on=r(Na,"nielsr"),Na.forEach(o),nn=r(nt,". The original code can be found "),ce=s(nt,"A",{href:!0,rel:!0});var Ia=i(ce);rn=r(Ia,"here"),Ia.forEach(o),an=r(nt,"."),nt.forEach(o),ro=c(t),W=s(t,"H2",{class:!0});var ho=i(W);J=s(ho,"A",{id:!0,class:!0,href:!0});var Da=i(J);ut=s(Da,"SPAN",{});var Aa=i(ut);y(ue.$$.fragment,Aa),Aa.forEach(o),Da.forEach(o),sn=c(ho),mt=s(ho,"SPAN",{});var Oa=i(mt);ln=r(Oa,"LayoutXLMTokenizer"),Oa.forEach(o),ho.forEach(o),ao=c(t),_=s(t,"DIV",{class:!0});var T=i(_);y(me.$$.fragment,T),dn=c(T),q=s(T,"P",{});var te=i(q);cn=r(te,"Adapted from "),Ue=s(te,"A",{href:!0});var Sa=i(Ue);un=r(Sa,"RobertaTokenizer"),Sa.forEach(o),mn=r(te," and "),We=s(te,"A",{href:!0});var Ca=i(We);pn=r(Ca,"XLNetTokenizer"),Ca.forEach(o),fn=r(te,`. Based on
`),pe=s(te,"A",{href:!0,rel:!0});var Ua=i(pe);hn=r(Ua,"SentencePiece"),Ua.forEach(o),_n=r(te,"."),te.forEach(o),gn=c(T),fe=s(T,"P",{});var _o=i(fe);kn=r(_o,"This tokenizer inherits from "),Re=s(_o,"A",{href:!0});var Wa=i(Re);yn=r(Wa,"PreTrainedTokenizer"),Wa.forEach(o),bn=r(_o,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),_o.forEach(o),Ln=c(T),Z=s(T,"DIV",{class:!0});var go=i(Z);y(he.$$.fragment,go),vn=c(go),pt=s(go,"P",{});var Ra=i(pt);wn=r(Ra,`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.`),Ra.forEach(o),go.forEach(o),Tn=c(T),F=s(T,"DIV",{class:!0});var rt=i(F);y(_e.$$.fragment,rt),xn=c(rt),ft=s(rt,"P",{});var Ba=i(ft);zn=r(Ba,`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:`),Ba.forEach(o),Mn=c(rt),ge=s(rt,"UL",{});var ko=i(ge);Be=s(ko,"LI",{});var ca=i(Be);Xn=r(ca,"single sequence: "),ht=s(ca,"CODE",{});var Va=i(ht);qn=r(Va,"<s> X </s>"),Va.forEach(o),ca.forEach(o),En=c(ko),Ve=s(ko,"LI",{});var ua=i(Ve);$n=r(ua,"pair of sequences: "),_t=s(ua,"CODE",{});var ja=i(_t);Pn=r(ja,"<s> A </s></s> B </s>"),ja.forEach(o),ua.forEach(o),ko.forEach(o),rt.forEach(o),Fn=c(T),H=s(T,"DIV",{class:!0});var yo=i(H);y(ke.$$.fragment,yo),Nn=c(yo),ye=s(yo,"P",{});var bo=i(ye);In=r(bo,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),gt=s(bo,"CODE",{});var Ga=i(gt);Dn=r(Ga,"prepare_for_model"),Ga.forEach(o),An=r(bo," method."),bo.forEach(o),yo.forEach(o),On=c(T),Y=s(T,"DIV",{class:!0});var Lo=i(Y);y(be.$$.fragment,Lo),Sn=c(Lo),kt=s(Lo,"P",{});var Ja=i(kt);Cn=r(Ja,`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.`),Ja.forEach(o),Lo.forEach(o),Un=c(T),je=s(T,"DIV",{class:!0});var Za=i(je);y(Le.$$.fragment,Za),Za.forEach(o),T.forEach(o),so=c(t),R=s(t,"H2",{class:!0});var vo=i(R);Q=s(vo,"A",{id:!0,class:!0,href:!0});var Ha=i(Q);yt=s(Ha,"SPAN",{});var Ya=i(yt);y(ve.$$.fragment,Ya),Ya.forEach(o),Ha.forEach(o),Wn=c(vo),bt=s(vo,"SPAN",{});var Qa=i(bt);Rn=r(Qa,"LayoutXLMTokenizerFast"),Qa.forEach(o),vo.forEach(o),io=c(t),M=s(t,"DIV",{class:!0});var oe=i(M);y(we.$$.fragment,oe),Bn=c(oe),X=s(oe,"P",{});var D=i(X);Vn=r(D,"Construct a \u201Cfast\u201D LayoutXLM tokenizer (backed by HuggingFace\u2019s "),Lt=s(D,"EM",{});var Ka=i(Lt);jn=r(Ka,"tokenizers"),Ka.forEach(o),Gn=r(D,` library). Adapted from
`),Ge=s(D,"A",{href:!0});var es=i(Ge);Jn=r(es,"RobertaTokenizer"),es.forEach(o),Zn=r(D," and "),Je=s(D,"A",{href:!0});var ts=i(Je);Hn=r(ts,"XLNetTokenizer"),ts.forEach(o),Yn=r(D,`. Based on
`),Te=s(D,"A",{href:!0,rel:!0});var os=i(Te);Qn=r(os,"BPE"),os.forEach(o),Kn=r(D,"."),D.forEach(o),er=c(oe),xe=s(oe,"P",{});var wo=i(xe);tr=r(wo,"This tokenizer inherits from "),Ze=s(wo,"A",{href:!0});var ns=i(Ze);or=r(ns,"PreTrainedTokenizerFast"),ns.forEach(o),nr=r(wo,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),wo.forEach(o),rr=c(oe),K=s(oe,"DIV",{class:!0});var To=i(K);y(ze.$$.fragment,To),ar=c(To),vt=s(To,"P",{});var rs=i(vt);sr=r(rs,`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.`),rs.forEach(o),To.forEach(o),oe.forEach(o),lo=c(t),B=s(t,"H2",{class:!0});var xo=i(B);ee=s(xo,"A",{id:!0,class:!0,href:!0});var as=i(ee);wt=s(as,"SPAN",{});var ss=i(wt);y(Me.$$.fragment,ss),ss.forEach(o),as.forEach(o),ir=c(xo),Tt=s(xo,"SPAN",{});var is=i(Tt);lr=r(is,"LayoutXLMProcessor"),is.forEach(o),xo.forEach(o),co=c(t),x=s(t,"DIV",{class:!0});var A=i(x);y(Xe.$$.fragment,A),dr=c(A),xt=s(A,"P",{});var ls=i(xt);cr=r(ls,`Constructs a LayoutXLM processor which combines a LayoutXLM image processor and a LayoutXLM tokenizer into a single
processor.`),ls.forEach(o),ur=c(A),He=s(A,"P",{});var ma=i(He);Ye=s(ma,"A",{href:!0});var ds=i(Ye);mr=r(ds,"LayoutXLMProcessor"),ds.forEach(o),pr=r(ma," offers all the functionalities you need to prepare data for the model."),ma.forEach(o),fr=c(A),h=s(A,"P",{});var g=i(h);hr=r(g,"It first uses "),Qe=s(g,"A",{href:!0});var cs=i(Qe);_r=r(cs,"LayoutLMv2ImageProcessor"),cs.forEach(o),gr=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 `),Ke=s(g,"A",{href:!0});var us=i(Ke);kr=r(us,"LayoutXLMTokenizer"),us.forEach(o),yr=r(g,` or
`),et=s(g,"A",{href:!0});var ms=i(et);br=r(ms,"LayoutXLMTokenizerFast"),ms.forEach(o),Lr=r(g,", which turns the words and bounding boxes into token-level "),zt=s(g,"CODE",{});var ps=i(zt);vr=r(ps,"input_ids"),ps.forEach(o),wr=r(g,`,
`),Mt=s(g,"CODE",{});var fs=i(Mt);Tr=r(fs,"attention_mask"),fs.forEach(o),xr=r(g,", "),Xt=s(g,"CODE",{});var hs=i(Xt);zr=r(hs,"token_type_ids"),hs.forEach(o),Mr=r(g,", "),qt=s(g,"CODE",{});var _s=i(qt);Xr=r(_s,"bbox"),_s.forEach(o),qr=r(g,". Optionally, one can provide integer "),Et=s(g,"CODE",{});var gs=i(Et);Er=r(gs,"word_labels"),gs.forEach(o),$r=r(g,`, which are turned
into token-level `),$t=s(g,"CODE",{});var ks=i($t);Pr=r(ks,"labels"),ks.forEach(o),Fr=r(g," for token classification tasks (such as FUNSD, CORD)."),g.forEach(o),Nr=c(A),N=s(A,"DIV",{class:!0});var at=i(N);y(qe.$$.fragment,at),Ir=c(at),p=s(at,"P",{});var f=i(p);Dr=r(f,"This method first forwards the "),Pt=s(f,"CODE",{});var ys=i(Pt);Ar=r(ys,"images"),ys.forEach(o),Or=r(f," argument to "),Ft=s(f,"CODE",{});var bs=i(Ft);Sr=r(bs,"~LayoutLMv2ImagePrpcessor.__call__"),bs.forEach(o),Cr=r(f,`. In case
`),Nt=s(f,"CODE",{});var Ls=i(Nt);Ur=r(Ls,"LayoutLMv2ImagePrpcessor"),Ls.forEach(o),Wr=r(f," was initialized with "),It=s(f,"CODE",{});var vs=i(It);Rr=r(vs,"apply_ocr"),vs.forEach(o),Br=r(f," set to "),Dt=s(f,"CODE",{});var ws=i(Dt);Vr=r(ws,"True"),ws.forEach(o),jr=r(f,`, it passes the obtained words and
bounding boxes along with the additional arguments to `),Ee=s(f,"A",{href:!0});var pa=i(Ee);At=s(pa,"STRONG",{});var Ts=i(At);Gr=r(Ts,"call"),Ts.forEach(o),Jr=r(pa,"()"),pa.forEach(o),Zr=r(f,` and returns the output,
together with resized `),Ot=s(f,"CODE",{});var xs=i(Ot);Hr=r(xs,"images"),xs.forEach(o),Yr=r(f,". In case "),St=s(f,"CODE",{});var zs=i(St);Qr=r(zs,"LayoutLMv2ImagePrpcessor"),zs.forEach(o),Kr=r(f," was initialized with "),Ct=s(f,"CODE",{});var Ms=i(Ct);ea=r(Ms,"apply_ocr"),Ms.forEach(o),ta=r(f,` set to
`),Ut=s(f,"CODE",{});var Xs=i(Ut);oa=r(Xs,"False"),Xs.forEach(o),na=r(f,", it passes the words ("),Wt=s(f,"CODE",{});var qs=i(Wt);ra=r(qs,"text"),qs.forEach(o),aa=r(f,"/"),Rt=s(f,"CODE",{});var Es=i(Rt);sa=r(Es,"text_pair`) and `boxes` specified by the user along with the additional arguments to [__call__()](/docs/transformers/v4.33.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer.__call__) and returns the output, together with resized `images"),Es.forEach(o),ia=r(f,"."),f.forEach(o),la=c(at),Bt=s(at,"P",{});var $s=i(Bt);da=r($s,"Please refer to the docstring of the above two methods for more information."),$s.forEach(o),at.forEach(o),A.forEach(o),this.h()},h(){l(S,"name","hf:doc:metadata"),l(S,"content",JSON.stringify(Cs)),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(C,"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(U,"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(Ne,"href","/docs/transformers/v4.33.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer"),l(Ie,"href","/docs/transformers/v4.33.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizerFast"),l(De,"href","/docs/transformers/v4.33.0/en/model_doc/layoutxlm#transformers.LayoutXLMProcessor"),l(Ae,"href","/docs/transformers/v4.33.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor"),l(Oe,"href","/docs/transformers/v4.33.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer"),l(Se,"href","/docs/transformers/v4.33.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizerFast"),l(Ce,"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(W,"class","relative group"),l(Ue,"href","/docs/transformers/v4.33.0/en/model_doc/roberta#transformers.RobertaTokenizer"),l(We,"href","/docs/transformers/v4.33.0/en/model_doc/xlnet#transformers.XLNetTokenizer"),l(pe,"href","https://github.com/google/sentencepiece"),l(pe,"rel","nofollow"),l(Re,"href","/docs/transformers/v4.33.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(F,"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(je,"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(Ge,"href","/docs/transformers/v4.33.0/en/model_doc/roberta#transformers.RobertaTokenizer"),l(Je,"href","/docs/transformers/v4.33.0/en/model_doc/xlnet#transformers.XLNetTokenizer"),l(Te,"href","https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=BPE#models"),l(Te,"rel","nofollow"),l(Ze,"href","/docs/transformers/v4.33.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(Ye,"href","/docs/transformers/v4.33.0/en/model_doc/layoutxlm#transformers.LayoutXLMProcessor"),l(Qe,"href","/docs/transformers/v4.33.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor"),l(Ke,"href","/docs/transformers/v4.33.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer"),l(et,"href","/docs/transformers/v4.33.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizerFast"),l(Ee,"href","/docs/transformers/v4.33.0/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer.__call__"),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(x,"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,S),m(t,jt,u),m(t,C,u),e(C,V),e(V,st),b(ne,st,null),e(C,zo),e(C,it),e(it,Mo),m(t,Gt,u),m(t,U,u),e(U,j),e(j,lt),b(re,lt,null),e(U,Xo),e(U,dt),e(dt,qo),m(t,Jt,u),m(t,E,u),e(E,Eo),e(E,ae),e(ae,$o),e(E,Po),e(E,se),e(se,Fo),e(E,No),m(t,Zt,u),m(t,$e,u),e($e,Io),m(t,Ht,u),m(t,Pe,u),e(Pe,ct),e(ct,Do),m(t,Yt,u),m(t,Fe,u),e(Fe,Ao),m(t,Qt,u),b(ie,t,u),m(t,Kt,u),m(t,$,u),e($,Oo),e($,Ne),e(Ne,So),e($,Co),e($,Ie),e(Ie,Uo),e($,Wo),m(t,eo,u),b(le,t,u),m(t,to,u),m(t,z,u),e(z,Ro),e(z,De),e(De,Bo),e(z,Vo),e(z,Ae),e(Ae,jo),e(z,Go),e(z,Oe),e(Oe,Jo),e(z,Zo),e(z,Se),e(Se,Ho),e(z,Yo),m(t,oo,u),m(t,G,u),e(G,Qo),e(G,Ce),e(Ce,Ko),e(G,en),m(t,no,u),m(t,P,u),e(P,tn),e(P,de),e(de,on),e(P,nn),e(P,ce),e(ce,rn),e(P,an),m(t,ro,u),m(t,W,u),e(W,J),e(J,ut),b(ue,ut,null),e(W,sn),e(W,mt),e(mt,ln),m(t,ao,u),m(t,_,u),b(me,_,null),e(_,dn),e(_,q),e(q,cn),e(q,Ue),e(Ue,un),e(q,mn),e(q,We),e(We,pn),e(q,fn),e(q,pe),e(pe,hn),e(q,_n),e(_,gn),e(_,fe),e(fe,kn),e(fe,Re),e(Re,yn),e(fe,bn),e(_,Ln),e(_,Z),b(he,Z,null),e(Z,vn),e(Z,pt),e(pt,wn),e(_,Tn),e(_,F),b(_e,F,null),e(F,xn),e(F,ft),e(ft,zn),e(F,Mn),e(F,ge),e(ge,Be),e(Be,Xn),e(Be,ht),e(ht,qn),e(ge,En),e(ge,Ve),e(Ve,$n),e(Ve,_t),e(_t,Pn),e(_,Fn),e(_,H),b(ke,H,null),e(H,Nn),e(H,ye),e(ye,In),e(ye,gt),e(gt,Dn),e(ye,An),e(_,On),e(_,Y),b(be,Y,null),e(Y,Sn),e(Y,kt),e(kt,Cn),e(_,Un),e(_,je),b(Le,je,null),m(t,so,u),m(t,R,u),e(R,Q),e(Q,yt),b(ve,yt,null),e(R,Wn),e(R,bt),e(bt,Rn),m(t,io,u),m(t,M,u),b(we,M,null),e(M,Bn),e(M,X),e(X,Vn),e(X,Lt),e(Lt,jn),e(X,Gn),e(X,Ge),e(Ge,Jn),e(X,Zn),e(X,Je),e(Je,Hn),e(X,Yn),e(X,Te),e(Te,Qn),e(X,Kn),e(M,er),e(M,xe),e(xe,tr),e(xe,Ze),e(Ze,or),e(xe,nr),e(M,rr),e(M,K),b(ze,K,null),e(K,ar),e(K,vt),e(vt,sr),m(t,lo,u),m(t,B,u),e(B,ee),e(ee,wt),b(Me,wt,null),e(B,ir),e(B,Tt),e(Tt,lr),m(t,co,u),m(t,x,u),b(Xe,x,null),e(x,dr),e(x,xt),e(xt,cr),e(x,ur),e(x,He),e(He,Ye),e(Ye,mr),e(He,pr),e(x,fr),e(x,h),e(h,hr),e(h,Qe),e(Qe,_r),e(h,gr),e(h,Ke),e(Ke,kr),e(h,yr),e(h,et),e(et,br),e(h,Lr),e(h,zt),e(zt,vr),e(h,wr),e(h,Mt),e(Mt,Tr),e(h,xr),e(h,Xt),e(Xt,zr),e(h,Mr),e(h,qt),e(qt,Xr),e(h,qr),e(h,Et),e(Et,Er),e(h,$r),e(h,$t),e($t,Pr),e(h,Fr),e(x,Nr),e(x,N),b(qe,N,null),e(N,Ir),e(N,p),e(p,Dr),e(p,Pt),e(Pt,Ar),e(p,Or),e(p,Ft),e(Ft,Sr),e(p,Cr),e(p,Nt),e(Nt,Ur),e(p,Wr),e(p,It),e(It,Rr),e(p,Br),e(p,Dt),e(Dt,Vr),e(p,jr),e(p,Ee),e(Ee,At),e(At,Gr),e(Ee,Jr),e(p,Zr),e(p,Ot),e(Ot,Hr),e(p,Yr),e(p,St),e(St,Qr),e(p,Kr),e(p,Ct),e(Ct,ea),e(p,ta),e(p,Ut),e(Ut,oa),e(p,na),e(p,Wt),e(Wt,ra),e(p,aa),e(p,Rt),e(Rt,sa),e(p,ia),e(N,la),e(N,Bt),e(Bt,da),uo=!0},p:As,i(t){uo||(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(qe.$$.fragment,t),uo=!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(qe.$$.fragment,t),uo=!1},d(t){o(S),t&&o(jt),t&&o(C),w(ne),t&&o(Gt),t&&o(U),w(re),t&&o(Jt),t&&o(E),t&&o(Zt),t&&o($e),t&&o(Ht),t&&o(Pe),t&&o(Yt),t&&o(Fe),t&&o(Qt),w(ie,t),t&&o(Kt),t&&o($),t&&o(eo),w(le,t),t&&o(to),t&&o(z),t&&o(oo),t&&o(G),t&&o(no),t&&o(P),t&&o(ro),t&&o(W),w(ue),t&&o(ao),t&&o(_),w(me),w(he),w(_e),w(ke),w(be),w(Le),t&&o(so),t&&o(R),w(ve),t&&o(io),t&&o(M),w(we),w(ze),t&&o(lo),t&&o(B),w(Me),t&&o(co),t&&o(x),w(Xe),w(qe)}}}const Cs={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 Us(fa){return Os(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class js extends Fs{constructor(S){super();Ns(this,S,Us,Ss,Is,{})}}export{js as default,Cs as metadata};
