import{s as zn,o as Fn,n as D}from"../chunks/scheduler.9bc65507.js";import{S as In,i as qn,g as c,s as r,r as _,A as Nn,h as p,f as o,c as l,j as R,u as b,x as f,k as Z,y as i,a as d,v as T,d as w,t as k,w as L}from"../chunks/index.707bf1b6.js";import{T as zt}from"../chunks/Tip.c2ecdbf4.js";import{D as A}from"../chunks/Docstring.17db21ae.js";import{C as Tt}from"../chunks/CodeBlock.54a9f38d.js";import{F as Rn,M as xn}from"../chunks/Markdown.8ab98a13.js";import{E as Bt}from"../chunks/ExampleCodeBlock.4f515aa9.js";import{P as Cn}from"../chunks/PipelineTag.44585822.js";import{H as Se}from"../chunks/Heading.342b1fa6.js";function Zn(U){let e,g="Examples:",n,a,M;return a=new Tt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExheW91dExNQ29uZmlnJTJDJTIwTGF5b3V0TE1Nb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBMYXlvdXRMTSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwTGF5b3V0TE1Db25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwTGF5b3V0TE1Nb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LayoutLMConfig, LayoutLMModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a LayoutLM configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = LayoutLMConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LayoutLMModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){e=c("p"),e.textContent=g,n=r(),_(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),n=l(t),b(a.$$.fragment,t)},m(t,y){d(t,e,y),d(t,n,y),T(a,t,y),M=!0},p:D,i(t){M||(w(a.$$.fragment,t),M=!0)},o(t){k(a.$$.fragment,t),M=!1},d(t){t&&(o(e),o(n)),L(a,t)}}}function Vn(U){let e,g="sequence pair mask has the following format:",n,a,M;return a=new Tt({props:{code:"MCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMEElN0MlMjBmaXJzdCUyMHNlcXVlbmNlJTIwJTIwJTIwJTIwJTdDJTIwc2Vjb25kJTIwc2VxdWVuY2UlMjAlN0M=",highlighted:`0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1 1
| first sequence    | second sequence |`,wrap:!1}}),{c(){e=c("p"),e.textContent=g,n=r(),_(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-16klr56"&&(e.textContent=g),n=l(t),b(a.$$.fragment,t)},m(t,y){d(t,e,y),d(t,n,y),T(a,t,y),M=!0},p:D,i(t){M||(w(a.$$.fragment,t),M=!0)},o(t){k(a.$$.fragment,t),M=!1},d(t){t&&(o(e),o(n)),L(a,t)}}}function Wn(U){let e,g="sequence pair mask has the following format:",n,a,M;return a=new Tt({props:{code:"MCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMEElN0MlMjBmaXJzdCUyMHNlcXVlbmNlJTIwJTIwJTIwJTIwJTdDJTIwc2Vjb25kJTIwc2VxdWVuY2UlMjAlN0M=",highlighted:`0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1 1
| first sequence    | second sequence |`,wrap:!1}}),{c(){e=c("p"),e.textContent=g,n=r(),_(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-16klr56"&&(e.textContent=g),n=l(t),b(a.$$.fragment,t)},m(t,y){d(t,e,y),d(t,n,y),T(a,t,y),M=!0},p:D,i(t){M||(w(a.$$.fragment,t),M=!0)},o(t){k(a.$$.fragment,t),M=!1},d(t){t&&(o(e),o(n)),L(a,t)}}}function Qn(U){let e,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=g},l(n){e=p(n,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(n,a){d(n,e,a)},p:D,d(n){n&&o(e)}}}function Hn(U){let e,g="Examples:",n,a,M;return a=new Tt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMYXlvdXRMTU1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZsYXlvdXRsbS1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBMYXlvdXRMTU1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZsYXlvdXRsbS1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBd29yZHMlMjAlM0QlMjAlNUIlMjJIZWxsbyUyMiUyQyUyMCUyMndvcmxkJTIyJTVEJTBBbm9ybWFsaXplZF93b3JkX2JveGVzJTIwJTNEJTIwJTVCNjM3JTJDJTIwNzczJTJDJTIwNjkzJTJDJTIwNzgyJTVEJTJDJTIwJTVCNjk4JTJDJTIwNzczJTJDJTIwNzMzJTJDJTIwNzgyJTVEJTBBJTBBdG9rZW5fYm94ZXMlMjAlM0QlMjAlNUIlNUQlMEFmb3IlMjB3b3JkJTJDJTIwYm94JTIwaW4lMjB6aXAod29yZHMlMkMlMjBub3JtYWxpemVkX3dvcmRfYm94ZXMpJTNBJTBBJTIwJTIwJTIwJTIwd29yZF90b2tlbnMlMjAlM0QlMjB0b2tlbml6ZXIudG9rZW5pemUod29yZCklMEElMjAlMjAlMjAlMjB0b2tlbl9ib3hlcy5leHRlbmQoJTVCYm94JTVEJTIwKiUyMGxlbih3b3JkX3Rva2VucykpJTBBJTIzJTIwYWRkJTIwYm91bmRpbmclMjBib3hlcyUyMG9mJTIwY2xzJTIwJTJCJTIwc2VwJTIwdG9rZW5zJTBBdG9rZW5fYm94ZXMlMjAlM0QlMjAlNUIlNUIwJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTVEJTVEJTIwJTJCJTIwdG9rZW5fYm94ZXMlMjAlMkIlMjAlNUIlNUIxMDAwJTJDJTIwMTAwMCUyQyUyMDEwMDAlMkMlMjAxMDAwJTVEJTVEJTBBJTBBZW5jb2RpbmclMjAlM0QlMjB0b2tlbml6ZXIoJTIyJTIwJTIyLmpvaW4od29yZHMpJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFpbnB1dF9pZHMlMjAlM0QlMjBlbmNvZGluZyU1QiUyMmlucHV0X2lkcyUyMiU1RCUwQWF0dGVudGlvbl9tYXNrJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJhdHRlbnRpb25fbWFzayUyMiU1RCUwQXRva2VuX3R5cGVfaWRzJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJ0b2tlbl90eXBlX2lkcyUyMiU1RCUwQWJib3glMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCdG9rZW5fYm94ZXMlNUQpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUyMGJib3glM0RiYm94JTJDJTIwYXR0ZW50aW9uX21hc2slM0RhdHRlbnRpb25fbWFzayUyQyUyMHRva2VuX3R5cGVfaWRzJTNEdG9rZW5fdHlwZV9pZHMlMEEpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, LayoutLMModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LayoutLMModel.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>words = [<span class="hljs-string">&quot;Hello&quot;</span>, <span class="hljs-string">&quot;world&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>normalized_word_boxes = [<span class="hljs-number">637</span>, <span class="hljs-number">773</span>, <span class="hljs-number">693</span>, <span class="hljs-number">782</span>], [<span class="hljs-number">698</span>, <span class="hljs-number">773</span>, <span class="hljs-number">733</span>, <span class="hljs-number">782</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> word, box <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(words, normalized_word_boxes):
<span class="hljs-meta">... </span>    word_tokens = tokenizer.tokenize(word)
<span class="hljs-meta">... </span>    token_boxes.extend([box] * <span class="hljs-built_in">len</span>(word_tokens))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># add bounding boxes of cls + sep tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = [[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]] + token_boxes + [[<span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(<span class="hljs-string">&quot; &quot;</span>.join(words), return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = encoding[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>attention_mask = encoding[<span class="hljs-string">&quot;attention_mask&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>token_type_ids = encoding[<span class="hljs-string">&quot;token_type_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>bbox = torch.tensor([token_boxes])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(
<span class="hljs-meta">... </span>    input_ids=input_ids, bbox=bbox, attention_mask=attention_mask, token_type_ids=token_type_ids
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`,wrap:!1}}),{c(){e=c("p"),e.textContent=g,n=r(),_(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),n=l(t),b(a.$$.fragment,t)},m(t,y){d(t,e,y),d(t,n,y),T(a,t,y),M=!0},p:D,i(t){M||(w(a.$$.fragment,t),M=!0)},o(t){k(a.$$.fragment,t),M=!1},d(t){t&&(o(e),o(n)),L(a,t)}}}function An(U){let e,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=g},l(n){e=p(n,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(n,a){d(n,e,a)},p:D,d(n){n&&o(e)}}}function Bn(U){let e,g="Examples:",n,a,M;return a=new Tt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMYXlvdXRMTUZvck1hc2tlZExNJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZsYXlvdXRsbS1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBMYXlvdXRMTUZvck1hc2tlZExNLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZsYXlvdXRsbS1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBd29yZHMlMjAlM0QlMjAlNUIlMjJIZWxsbyUyMiUyQyUyMCUyMiU1Qk1BU0slNUQlMjIlNUQlMEFub3JtYWxpemVkX3dvcmRfYm94ZXMlMjAlM0QlMjAlNUI2MzclMkMlMjA3NzMlMkMlMjA2OTMlMkMlMjA3ODIlNUQlMkMlMjAlNUI2OTglMkMlMjA3NzMlMkMlMjA3MzMlMkMlMjA3ODIlNUQlMEElMEF0b2tlbl9ib3hlcyUyMCUzRCUyMCU1QiU1RCUwQWZvciUyMHdvcmQlMkMlMjBib3glMjBpbiUyMHppcCh3b3JkcyUyQyUyMG5vcm1hbGl6ZWRfd29yZF9ib3hlcyklM0ElMEElMjAlMjAlMjAlMjB3b3JkX3Rva2VucyUyMCUzRCUyMHRva2VuaXplci50b2tlbml6ZSh3b3JkKSUwQSUyMCUyMCUyMCUyMHRva2VuX2JveGVzLmV4dGVuZCglNUJib3glNUQlMjAqJTIwbGVuKHdvcmRfdG9rZW5zKSklMEElMjMlMjBhZGQlMjBib3VuZGluZyUyMGJveGVzJTIwb2YlMjBjbHMlMjAlMkIlMjBzZXAlMjB0b2tlbnMlMEF0b2tlbl9ib3hlcyUyMCUzRCUyMCU1QiU1QjAlMkMlMjAwJTJDJTIwMCUyQyUyMDAlNUQlNUQlMjAlMkIlMjB0b2tlbl9ib3hlcyUyMCUyQiUyMCU1QiU1QjEwMDAlMkMlMjAxMDAwJTJDJTIwMTAwMCUyQyUyMDEwMDAlNUQlNUQlMEElMEFlbmNvZGluZyUyMCUzRCUyMHRva2VuaXplciglMjIlMjAlMjIuam9pbih3b3JkcyklMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQWlucHV0X2lkcyUyMCUzRCUyMGVuY29kaW5nJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBYXR0ZW50aW9uX21hc2slMjAlM0QlMjBlbmNvZGluZyU1QiUyMmF0dGVudGlvbl9tYXNrJTIyJTVEJTBBdG9rZW5fdHlwZV9pZHMlMjAlM0QlMjBlbmNvZGluZyU1QiUyMnRva2VuX3R5cGVfaWRzJTIyJTVEJTBBYmJveCUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUJ0b2tlbl9ib3hlcyU1RCklMEElMEFsYWJlbHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMjB3b3JsZCUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUwQSUyMCUyMCUyMCUyMGJib3glM0RiYm94JTJDJTBBJTIwJTIwJTIwJTIwYXR0ZW50aW9uX21hc2slM0RhdHRlbnRpb25fbWFzayUyQyUwQSUyMCUyMCUyMCUyMHRva2VuX3R5cGVfaWRzJTNEdG9rZW5fdHlwZV9pZHMlMkMlMEElMjAlMjAlMjAlMjBsYWJlbHMlM0RsYWJlbHMlMkMlMEEpJTBBJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, LayoutLMForMaskedLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LayoutLMForMaskedLM.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>words = [<span class="hljs-string">&quot;Hello&quot;</span>, <span class="hljs-string">&quot;[MASK]&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>normalized_word_boxes = [<span class="hljs-number">637</span>, <span class="hljs-number">773</span>, <span class="hljs-number">693</span>, <span class="hljs-number">782</span>], [<span class="hljs-number">698</span>, <span class="hljs-number">773</span>, <span class="hljs-number">733</span>, <span class="hljs-number">782</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> word, box <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(words, normalized_word_boxes):
<span class="hljs-meta">... </span>    word_tokens = tokenizer.tokenize(word)
<span class="hljs-meta">... </span>    token_boxes.extend([box] * <span class="hljs-built_in">len</span>(word_tokens))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># add bounding boxes of cls + sep tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = [[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]] + token_boxes + [[<span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(<span class="hljs-string">&quot; &quot;</span>.join(words), return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = encoding[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>attention_mask = encoding[<span class="hljs-string">&quot;attention_mask&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>token_type_ids = encoding[<span class="hljs-string">&quot;token_type_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>bbox = torch.tensor([token_boxes])

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(
<span class="hljs-meta">... </span>    input_ids=input_ids,
<span class="hljs-meta">... </span>    bbox=bbox,
<span class="hljs-meta">... </span>    attention_mask=attention_mask,
<span class="hljs-meta">... </span>    token_type_ids=token_type_ids,
<span class="hljs-meta">... </span>    labels=labels,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss`,wrap:!1}}),{c(){e=c("p"),e.textContent=g,n=r(),_(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),n=l(t),b(a.$$.fragment,t)},m(t,y){d(t,e,y),d(t,n,y),T(a,t,y),M=!0},p:D,i(t){M||(w(a.$$.fragment,t),M=!0)},o(t){k(a.$$.fragment,t),M=!1},d(t){t&&(o(e),o(n)),L(a,t)}}}function Gn(U){let e,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=g},l(n){e=p(n,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(n,a){d(n,e,a)},p:D,d(n){n&&o(e)}}}function En(U){let e,g="Examples:",n,a,M;return a=new Tt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMYXlvdXRMTUZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRmxheW91dGxtLWJhc2UtdW5jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMExheW91dExNRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGbGF5b3V0bG0tYmFzZS11bmNhc2VkJTIyKSUwQSUwQXdvcmRzJTIwJTNEJTIwJTVCJTIySGVsbG8lMjIlMkMlMjAlMjJ3b3JsZCUyMiU1RCUwQW5vcm1hbGl6ZWRfd29yZF9ib3hlcyUyMCUzRCUyMCU1QjYzNyUyQyUyMDc3MyUyQyUyMDY5MyUyQyUyMDc4MiU1RCUyQyUyMCU1QjY5OCUyQyUyMDc3MyUyQyUyMDczMyUyQyUyMDc4MiU1RCUwQSUwQXRva2VuX2JveGVzJTIwJTNEJTIwJTVCJTVEJTBBZm9yJTIwd29yZCUyQyUyMGJveCUyMGluJTIwemlwKHdvcmRzJTJDJTIwbm9ybWFsaXplZF93b3JkX2JveGVzKSUzQSUwQSUyMCUyMCUyMCUyMHdvcmRfdG9rZW5zJTIwJTNEJTIwdG9rZW5pemVyLnRva2VuaXplKHdvcmQpJTBBJTIwJTIwJTIwJTIwdG9rZW5fYm94ZXMuZXh0ZW5kKCU1QmJveCU1RCUyMColMjBsZW4od29yZF90b2tlbnMpKSUwQSUyMyUyMGFkZCUyMGJvdW5kaW5nJTIwYm94ZXMlMjBvZiUyMGNscyUyMCUyQiUyMHNlcCUyMHRva2VucyUwQXRva2VuX2JveGVzJTIwJTNEJTIwJTVCJTVCMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCU1RCU1RCUyMCUyQiUyMHRva2VuX2JveGVzJTIwJTJCJTIwJTVCJTVCMTAwMCUyQyUyMDEwMDAlMkMlMjAxMDAwJTJDJTIwMTAwMCU1RCU1RCUwQSUwQWVuY29kaW5nJTIwJTNEJTIwdG9rZW5pemVyKCUyMiUyMCUyMi5qb2luKHdvcmRzKSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBaW5wdXRfaWRzJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEFhdHRlbnRpb25fbWFzayUyMCUzRCUyMGVuY29kaW5nJTVCJTIyYXR0ZW50aW9uX21hc2slMjIlNUQlMEF0b2tlbl90eXBlX2lkcyUyMCUzRCUyMGVuY29kaW5nJTVCJTIydG9rZW5fdHlwZV9pZHMlMjIlNUQlMEFiYm94JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QnRva2VuX2JveGVzJTVEKSUwQXNlcXVlbmNlX2xhYmVsJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QjElNUQpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUwQSUyMCUyMCUyMCUyMGJib3glM0RiYm94JTJDJTBBJTIwJTIwJTIwJTIwYXR0ZW50aW9uX21hc2slM0RhdHRlbnRpb25fbWFzayUyQyUwQSUyMCUyMCUyMCUyMHRva2VuX3R5cGVfaWRzJTNEdG9rZW5fdHlwZV9pZHMlMkMlMEElMjAlMjAlMjAlMjBsYWJlbHMlM0RzZXF1ZW5jZV9sYWJlbCUyQyUwQSklMEElMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, LayoutLMForSequenceClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LayoutLMForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>words = [<span class="hljs-string">&quot;Hello&quot;</span>, <span class="hljs-string">&quot;world&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>normalized_word_boxes = [<span class="hljs-number">637</span>, <span class="hljs-number">773</span>, <span class="hljs-number">693</span>, <span class="hljs-number">782</span>], [<span class="hljs-number">698</span>, <span class="hljs-number">773</span>, <span class="hljs-number">733</span>, <span class="hljs-number">782</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> word, box <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(words, normalized_word_boxes):
<span class="hljs-meta">... </span>    word_tokens = tokenizer.tokenize(word)
<span class="hljs-meta">... </span>    token_boxes.extend([box] * <span class="hljs-built_in">len</span>(word_tokens))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># add bounding boxes of cls + sep tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = [[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]] + token_boxes + [[<span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(<span class="hljs-string">&quot; &quot;</span>.join(words), return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = encoding[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>attention_mask = encoding[<span class="hljs-string">&quot;attention_mask&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>token_type_ids = encoding[<span class="hljs-string">&quot;token_type_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>bbox = torch.tensor([token_boxes])
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_label = torch.tensor([<span class="hljs-number">1</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(
<span class="hljs-meta">... </span>    input_ids=input_ids,
<span class="hljs-meta">... </span>    bbox=bbox,
<span class="hljs-meta">... </span>    attention_mask=attention_mask,
<span class="hljs-meta">... </span>    token_type_ids=token_type_ids,
<span class="hljs-meta">... </span>    labels=sequence_label,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=g,n=r(),_(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),n=l(t),b(a.$$.fragment,t)},m(t,y){d(t,e,y),d(t,n,y),T(a,t,y),M=!0},p:D,i(t){M||(w(a.$$.fragment,t),M=!0)},o(t){k(a.$$.fragment,t),M=!1},d(t){t&&(o(e),o(n)),L(a,t)}}}function Xn(U){let e,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=g},l(n){e=p(n,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(n,a){d(n,e,a)},p:D,d(n){n&&o(e)}}}function Sn(U){let e,g="Examples:",n,a,M;return a=new Tt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMYXlvdXRMTUZvclRva2VuQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRmxheW91dGxtLWJhc2UtdW5jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMExheW91dExNRm9yVG9rZW5DbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGbGF5b3V0bG0tYmFzZS11bmNhc2VkJTIyKSUwQSUwQXdvcmRzJTIwJTNEJTIwJTVCJTIySGVsbG8lMjIlMkMlMjAlMjJ3b3JsZCUyMiU1RCUwQW5vcm1hbGl6ZWRfd29yZF9ib3hlcyUyMCUzRCUyMCU1QjYzNyUyQyUyMDc3MyUyQyUyMDY5MyUyQyUyMDc4MiU1RCUyQyUyMCU1QjY5OCUyQyUyMDc3MyUyQyUyMDczMyUyQyUyMDc4MiU1RCUwQSUwQXRva2VuX2JveGVzJTIwJTNEJTIwJTVCJTVEJTBBZm9yJTIwd29yZCUyQyUyMGJveCUyMGluJTIwemlwKHdvcmRzJTJDJTIwbm9ybWFsaXplZF93b3JkX2JveGVzKSUzQSUwQSUyMCUyMCUyMCUyMHdvcmRfdG9rZW5zJTIwJTNEJTIwdG9rZW5pemVyLnRva2VuaXplKHdvcmQpJTBBJTIwJTIwJTIwJTIwdG9rZW5fYm94ZXMuZXh0ZW5kKCU1QmJveCU1RCUyMColMjBsZW4od29yZF90b2tlbnMpKSUwQSUyMyUyMGFkZCUyMGJvdW5kaW5nJTIwYm94ZXMlMjBvZiUyMGNscyUyMCUyQiUyMHNlcCUyMHRva2VucyUwQXRva2VuX2JveGVzJTIwJTNEJTIwJTVCJTVCMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCU1RCU1RCUyMCUyQiUyMHRva2VuX2JveGVzJTIwJTJCJTIwJTVCJTVCMTAwMCUyQyUyMDEwMDAlMkMlMjAxMDAwJTJDJTIwMTAwMCU1RCU1RCUwQSUwQWVuY29kaW5nJTIwJTNEJTIwdG9rZW5pemVyKCUyMiUyMCUyMi5qb2luKHdvcmRzKSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBaW5wdXRfaWRzJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEFhdHRlbnRpb25fbWFzayUyMCUzRCUyMGVuY29kaW5nJTVCJTIyYXR0ZW50aW9uX21hc2slMjIlNUQlMEF0b2tlbl90eXBlX2lkcyUyMCUzRCUyMGVuY29kaW5nJTVCJTIydG9rZW5fdHlwZV9pZHMlMjIlNUQlMEFiYm94JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QnRva2VuX2JveGVzJTVEKSUwQXRva2VuX2xhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTJDJTIwMSUyQyUyMDAlMkMlMjAwJTVEKS51bnNxdWVlemUoMCklMjAlMjAlMjMlMjBiYXRjaCUyMHNpemUlMjBvZiUyMDElMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoJTBBJTIwJTIwJTIwJTIwaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTBBJTIwJTIwJTIwJTIwYmJveCUzRGJib3glMkMlMEElMjAlMjAlMjAlMjBhdHRlbnRpb25fbWFzayUzRGF0dGVudGlvbl9tYXNrJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5fdHlwZV9pZHMlM0R0b2tlbl90eXBlX2lkcyUyQyUwQSUyMCUyMCUyMCUyMGxhYmVscyUzRHRva2VuX2xhYmVscyUyQyUwQSklMEElMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, LayoutLMForTokenClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LayoutLMForTokenClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>words = [<span class="hljs-string">&quot;Hello&quot;</span>, <span class="hljs-string">&quot;world&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>normalized_word_boxes = [<span class="hljs-number">637</span>, <span class="hljs-number">773</span>, <span class="hljs-number">693</span>, <span class="hljs-number">782</span>], [<span class="hljs-number">698</span>, <span class="hljs-number">773</span>, <span class="hljs-number">733</span>, <span class="hljs-number">782</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> word, box <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(words, normalized_word_boxes):
<span class="hljs-meta">... </span>    word_tokens = tokenizer.tokenize(word)
<span class="hljs-meta">... </span>    token_boxes.extend([box] * <span class="hljs-built_in">len</span>(word_tokens))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># add bounding boxes of cls + sep tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = [[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]] + token_boxes + [[<span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(<span class="hljs-string">&quot; &quot;</span>.join(words), return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = encoding[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>attention_mask = encoding[<span class="hljs-string">&quot;attention_mask&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>token_type_ids = encoding[<span class="hljs-string">&quot;token_type_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>bbox = torch.tensor([token_boxes])
<span class="hljs-meta">&gt;&gt;&gt; </span>token_labels = torch.tensor([<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]).unsqueeze(<span class="hljs-number">0</span>)  <span class="hljs-comment"># batch size of 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(
<span class="hljs-meta">... </span>    input_ids=input_ids,
<span class="hljs-meta">... </span>    bbox=bbox,
<span class="hljs-meta">... </span>    attention_mask=attention_mask,
<span class="hljs-meta">... </span>    token_type_ids=token_type_ids,
<span class="hljs-meta">... </span>    labels=token_labels,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=g,n=r(),_(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),n=l(t),b(a.$$.fragment,t)},m(t,y){d(t,e,y),d(t,n,y),T(a,t,y),M=!0},p:D,i(t){M||(w(a.$$.fragment,t),M=!0)},o(t){k(a.$$.fragment,t),M=!1},d(t){t&&(o(e),o(n)),L(a,t)}}}function Dn(U){let e,g;return e=new Tt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMYXlvdXRMTUZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJpbXBpcmElMkZsYXlvdXRsbS1kb2N1bWVudC1xYSUyMiUyQyUyMGFkZF9wcmVmaXhfc3BhY2UlM0RUcnVlKSUwQW1vZGVsJTIwJTNEJTIwTGF5b3V0TE1Gb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyaW1waXJhJTJGbGF5b3V0bG0tZG9jdW1lbnQtcWElMjIlMkMlMjByZXZpc2lvbiUzRCUyMjFlM2ViYWMlMjIpJTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJuaWVsc3IlMkZmdW5zZCUyMiUyQyUyMHNwbGl0JTNEJTIydHJhaW4lMjIpJTBBZXhhbXBsZSUyMCUzRCUyMGRhdGFzZXQlNUIwJTVEJTBBcXVlc3Rpb24lMjAlM0QlMjAlMjJ3aGF0J3MlMjBoaXMlMjBuYW1lJTNGJTIyJTBBd29yZHMlMjAlM0QlMjBleGFtcGxlJTVCJTIyd29yZHMlMjIlNUQlMEFib3hlcyUyMCUzRCUyMGV4YW1wbGUlNUIlMjJiYm94ZXMlMjIlNUQlMEElMEFlbmNvZGluZyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjBxdWVzdGlvbi5zcGxpdCgpJTJDJTIwd29yZHMlMkMlMjBpc19zcGxpdF9pbnRvX3dvcmRzJTNEVHJ1ZSUyQyUyMHJldHVybl90b2tlbl90eXBlX2lkcyUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKSUwQWJib3glMjAlM0QlMjAlNUIlNUQlMEFmb3IlMjBpJTJDJTIwcyUyQyUyMHclMjBpbiUyMHppcChlbmNvZGluZy5pbnB1dF9pZHMlNUIwJTVEJTJDJTIwZW5jb2Rpbmcuc2VxdWVuY2VfaWRzKDApJTJDJTIwZW5jb2Rpbmcud29yZF9pZHMoMCkpJTNBJTBBJTIwJTIwJTIwJTIwaWYlMjBzJTIwJTNEJTNEJTIwMSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJib3guYXBwZW5kKGJveGVzJTVCdyU1RCklMEElMjAlMjAlMjAlMjBlbGlmJTIwaSUyMCUzRCUzRCUyMHRva2VuaXplci5zZXBfdG9rZW5faWQlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBiYm94LmFwcGVuZCglNUIxMDAwJTVEJTIwKiUyMDQpJTBBJTIwJTIwJTIwJTIwZWxzZSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJib3guYXBwZW5kKCU1QjAlNUQlMjAqJTIwNCklMEFlbmNvZGluZyU1QiUyMmJib3glMjIlNUQlMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCYmJveCU1RCklMEElMEF3b3JkX2lkcyUyMCUzRCUyMGVuY29kaW5nLndvcmRfaWRzKDApJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqZW5jb2RpbmcpJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcyUwQXN0YXJ0X3Njb3JlcyUyMCUzRCUyMG91dHB1dHMuc3RhcnRfbG9naXRzJTBBZW5kX3Njb3JlcyUyMCUzRCUyMG91dHB1dHMuZW5kX2xvZ2l0cyUwQXN0YXJ0JTJDJTIwZW5kJTIwJTNEJTIwd29yZF9pZHMlNUJzdGFydF9zY29yZXMuYXJnbWF4KC0xKSU1RCUyQyUyMHdvcmRfaWRzJTVCZW5kX3Njb3Jlcy5hcmdtYXgoLTEpJTVEJTBBcHJpbnQoJTIyJTIwJTIyLmpvaW4od29yZHMlNUJzdGFydCUyMCUzQSUyMGVuZCUyMCUyQiUyMDElNUQpKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, LayoutLMForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;impira/layoutlm-document-qa&quot;</span>, add_prefix_space=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LayoutLMForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;impira/layoutlm-document-qa&quot;</span>, revision=<span class="hljs-string">&quot;1e3ebac&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;nielsr/funsd&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>example = dataset[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>question = <span class="hljs-string">&quot;what&#x27;s his name?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>words = example[<span class="hljs-string">&quot;words&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes = example[<span class="hljs-string">&quot;bboxes&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(
<span class="hljs-meta">... </span>    question.split(), words, is_split_into_words=<span class="hljs-literal">True</span>, return_token_type_ids=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>bbox = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> i, s, w <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(encoding.input_ids[<span class="hljs-number">0</span>], encoding.sequence_ids(<span class="hljs-number">0</span>), encoding.word_ids(<span class="hljs-number">0</span>)):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> s == <span class="hljs-number">1</span>:
<span class="hljs-meta">... </span>        bbox.append(boxes[w])
<span class="hljs-meta">... </span>    <span class="hljs-keyword">elif</span> i == tokenizer.sep_token_id:
<span class="hljs-meta">... </span>        bbox.append([<span class="hljs-number">1000</span>] * <span class="hljs-number">4</span>)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">else</span>:
<span class="hljs-meta">... </span>        bbox.append([<span class="hljs-number">0</span>] * <span class="hljs-number">4</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding[<span class="hljs-string">&quot;bbox&quot;</span>] = torch.tensor([bbox])

<span class="hljs-meta">&gt;&gt;&gt; </span>word_ids = encoding.word_ids(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>start_scores = outputs.start_logits
<span class="hljs-meta">&gt;&gt;&gt; </span>end_scores = outputs.end_logits
<span class="hljs-meta">&gt;&gt;&gt; </span>start, end = word_ids[start_scores.argmax(-<span class="hljs-number">1</span>)], word_ids[end_scores.argmax(-<span class="hljs-number">1</span>)]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot; &quot;</span>.join(words[start : end + <span class="hljs-number">1</span>]))
M. Hamann P. Harper, P. Martinez`,wrap:!1}}),{c(){_(e.$$.fragment)},l(n){b(e.$$.fragment,n)},m(n,a){T(e,n,a),g=!0},p:D,i(n){g||(w(e.$$.fragment,n),g=!0)},o(n){k(e.$$.fragment,n),g=!1},d(n){L(e,n)}}}function Yn(U){let e,g,n,a,M,t,y=`The bare LayoutLM Model transformer outputting raw hidden-states without any specific head on top.
The LayoutLM model was proposed in <a href="https://arxiv.org/abs/1912.13318" rel="nofollow">LayoutLM: Pre-training of Text and Layout for Document Image
Understanding</a> by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`,E,F,x=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,V,z,$,W,u,J='The <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMModel">LayoutLMModel</a> forward method, overrides the <code>__call__</code> special method.',se,Je,Gt,de,Ot,De,be,he,oe,Xt,Ce,rt=`LayoutLM Model with a <code>language modeling</code> head on top.
The LayoutLM model was proposed in <a href="https://arxiv.org/abs/1912.13318" rel="nofollow">LayoutLM: Pre-training of Text and Layout for Document Image
Understanding</a> by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`,Y,fe,nn=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,lt,ce,Ye,qe,wt,kt='The <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMForMaskedLM">LayoutLMForMaskedLM</a> forward method, overrides the <code>__call__</code> special method.',Ft,Pe,it,ge,Oe,pe,Ae,X,$e,Lt,It,Ke=`LayoutLM Model with a sequence classification head on top (a linear layer on top of the pooled output) e.g. for
document image classification tasks such as the <a href="https://www.cs.cmu.edu/~aharley/rvl-cdip/" rel="nofollow">RVL-CDIP</a> dataset.`,dt,ke,ct=`The LayoutLM model was proposed in <a href="https://arxiv.org/abs/1912.13318" rel="nofollow">LayoutLM: Pre-training of Text and Layout for Document Image
Understanding</a> by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`,jt,et,B=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,vt,Te,ye,sn,pt,Be='The <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMForSequenceClassification">LayoutLMForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',on,Ge,Ne,Ut,qt,ae,Nt,I,me,St,Le,cn=`LayoutLM Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
sequence labeling (information extraction) tasks such as the <a href="https://guillaumejaume.github.io/FUNSD/" rel="nofollow">FUNSD</a>
dataset and the <a href="https://rrc.cvc.uab.es/?ch=13" rel="nofollow">SROIE</a> dataset.`,Dt,Me,an=`The LayoutLM model was proposed in <a href="https://arxiv.org/abs/1912.13318" rel="nofollow">LayoutLM: Pre-training of Text and Layout for Document Image
Understanding</a> by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`,tt,je,mt=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,nt,q,N,ut,Ee,Et='The <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMForTokenClassification">LayoutLMForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',Kt,xe,Rt,ht,ft,we,st,G,Re,ze,Ze,Zt=`LayoutLM Model with a span classification head on top for extractive question-answering tasks such as
<a href="https://rrc.cvc.uab.es/?ch=17" rel="nofollow">DocVQA</a> (a linear layer on top of the final hidden-states output to compute <code>span start logits</code> and <code>span end logits</code>).`,Vt,Wt,gt=`The LayoutLM model was proposed in <a href="https://arxiv.org/abs/1912.13318" rel="nofollow">LayoutLM: Pre-training of Text and Layout for Document Image
Understanding</a> by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`,ve,Jt,Ve=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Yt,P,K,H,We,Qt=`start_positions (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>):
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.
end_positions (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>):
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,Ht,At,yt="Example:",Ct,ot,rn=`In the example below, we prepare a question + context pair for the LayoutLM model. It will give us a prediction
of what it thinks the answer is (the span of the answer within the texts parsed from the image).`,$t,Ue,at;return e=new Se({props:{title:"LayoutLMModel",local:"transformers.LayoutLMModel",headingTag:"h2"}}),a=new A({props:{name:"class transformers.LayoutLMModel",anchor:"transformers.LayoutLMModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig">LayoutLMConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_layoutlm.py#L703"}}),$=new A({props:{name:"forward",anchor:"transformers.LayoutLMModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LayoutLMModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LayoutLMModel.forward.bbox",description:`<strong>bbox</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings-1]</code>. Each bounding box should be a normalized version in (x0, y0, x1, y1)
format, where (x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1,
y1) represents the position of the lower right corner. See <a href="#Overview">Overview</a> for normalization.`,name:"bbox"},{anchor:"transformers.LayoutLMModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>: <code>1</code> for
tokens that are NOT MASKED, <code>0</code> for MASKED tokens.</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LayoutLMModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>: <code>0</code> corresponds to a <em>sentence A</em> token, <code>1</code> corresponds to a <em>sentence B</em> token</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LayoutLMModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LayoutLMModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>: <code>1</code>
indicates the head is <strong>not masked</strong>, <code>0</code> indicates the head is <strong>masked</strong>.`,name:"head_mask"},{anchor:"transformers.LayoutLMModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LayoutLMModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the attentions tensors of all attention layers are returned. See <code>attentions</code> under
returned tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LayoutLMModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the hidden states of all layers are returned. See <code>hidden_states</code> under returned tensors
for more detail.`,name:"output_hidden_states"},{anchor:"transformers.LayoutLMModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the model will return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_layoutlm.py#L729",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig"
>LayoutLMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> and <code>config.add_cross_attention=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder’s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
<code>config.is_encoder_decoder=True</code> in the cross-attention blocks) that can be used (see <code>past_key_values</code>
input) to speed up sequential decoding.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Je=new zt({props:{$$slots:{default:[Qn]},$$scope:{ctx:U}}}),de=new Bt({props:{anchor:"transformers.LayoutLMModel.forward.example",$$slots:{default:[Hn]},$$scope:{ctx:U}}}),De=new Se({props:{title:"LayoutLMForMaskedLM",local:"transformers.LayoutLMForMaskedLM",headingTag:"h2"}}),oe=new A({props:{name:"class transformers.LayoutLMForMaskedLM",anchor:"transformers.LayoutLMForMaskedLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig">LayoutLMConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_layoutlm.py#L852"}}),Ye=new A({props:{name:"forward",anchor:"transformers.LayoutLMForMaskedLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LayoutLMForMaskedLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LayoutLMForMaskedLM.forward.bbox",description:`<strong>bbox</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings-1]</code>. Each bounding box should be a normalized version in (x0, y0, x1, y1)
format, where (x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1,
y1) represents the position of the lower right corner. See <a href="#Overview">Overview</a> for normalization.`,name:"bbox"},{anchor:"transformers.LayoutLMForMaskedLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>: <code>1</code> for
tokens that are NOT MASKED, <code>0</code> for MASKED tokens.</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LayoutLMForMaskedLM.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>: <code>0</code> corresponds to a <em>sentence A</em> token, <code>1</code> corresponds to a <em>sentence B</em> token</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LayoutLMForMaskedLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LayoutLMForMaskedLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>: <code>1</code>
indicates the head is <strong>not masked</strong>, <code>0</code> indicates the head is <strong>masked</strong>.`,name:"head_mask"},{anchor:"transformers.LayoutLMForMaskedLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LayoutLMForMaskedLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the attentions tensors of all attention layers are returned. See <code>attentions</code> under
returned tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LayoutLMForMaskedLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the hidden states of all layers are returned. See <code>hidden_states</code> under returned tensors
for more detail.`,name:"output_hidden_states"},{anchor:"transformers.LayoutLMForMaskedLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the model will return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LayoutLMForMaskedLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked), the
loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_layoutlm.py#L873",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig"
>LayoutLMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Masked language modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Pe=new zt({props:{$$slots:{default:[An]},$$scope:{ctx:U}}}),ge=new Bt({props:{anchor:"transformers.LayoutLMForMaskedLM.forward.example",$$slots:{default:[Bn]},$$scope:{ctx:U}}}),pe=new Se({props:{title:"LayoutLMForSequenceClassification",local:"transformers.LayoutLMForSequenceClassification",headingTag:"h2"}}),$e=new A({props:{name:"class transformers.LayoutLMForSequenceClassification",anchor:"transformers.LayoutLMForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig">LayoutLMConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_layoutlm.py#L983"}}),ye=new A({props:{name:"forward",anchor:"transformers.LayoutLMForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LayoutLMForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LayoutLMForSequenceClassification.forward.bbox",description:`<strong>bbox</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings-1]</code>. Each bounding box should be a normalized version in (x0, y0, x1, y1)
format, where (x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1,
y1) represents the position of the lower right corner. See <a href="#Overview">Overview</a> for normalization.`,name:"bbox"},{anchor:"transformers.LayoutLMForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>: <code>1</code> for
tokens that are NOT MASKED, <code>0</code> for MASKED tokens.</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LayoutLMForSequenceClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>: <code>0</code> corresponds to a <em>sentence A</em> token, <code>1</code> corresponds to a <em>sentence B</em> token</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LayoutLMForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LayoutLMForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>: <code>1</code>
indicates the head is <strong>not masked</strong>, <code>0</code> indicates the head is <strong>masked</strong>.`,name:"head_mask"},{anchor:"transformers.LayoutLMForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LayoutLMForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the attentions tensors of all attention layers are returned. See <code>attentions</code> under
returned tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LayoutLMForSequenceClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the hidden states of all layers are returned. See <code>hidden_states</code> under returned tensors
for more detail.`,name:"output_hidden_states"},{anchor:"transformers.LayoutLMForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the model will return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LayoutLMForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_layoutlm.py#L997",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig"
>LayoutLMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ge=new zt({props:{$$slots:{default:[Gn]},$$scope:{ctx:U}}}),Ut=new Bt({props:{anchor:"transformers.LayoutLMForSequenceClassification.forward.example",$$slots:{default:[En]},$$scope:{ctx:U}}}),ae=new Se({props:{title:"LayoutLMForTokenClassification",local:"transformers.LayoutLMForTokenClassification",headingTag:"h2"}}),me=new A({props:{name:"class transformers.LayoutLMForTokenClassification",anchor:"transformers.LayoutLMForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig">LayoutLMConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_layoutlm.py#L1120"}}),N=new A({props:{name:"forward",anchor:"transformers.LayoutLMForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LayoutLMForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LayoutLMForTokenClassification.forward.bbox",description:`<strong>bbox</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings-1]</code>. Each bounding box should be a normalized version in (x0, y0, x1, y1)
format, where (x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1,
y1) represents the position of the lower right corner. See <a href="#Overview">Overview</a> for normalization.`,name:"bbox"},{anchor:"transformers.LayoutLMForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>: <code>1</code> for
tokens that are NOT MASKED, <code>0</code> for MASKED tokens.</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LayoutLMForTokenClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>: <code>0</code> corresponds to a <em>sentence A</em> token, <code>1</code> corresponds to a <em>sentence B</em> token</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LayoutLMForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LayoutLMForTokenClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>: <code>1</code>
indicates the head is <strong>not masked</strong>, <code>0</code> indicates the head is <strong>masked</strong>.`,name:"head_mask"},{anchor:"transformers.LayoutLMForTokenClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LayoutLMForTokenClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the attentions tensors of all attention layers are returned. See <code>attentions</code> under
returned tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LayoutLMForTokenClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the hidden states of all layers are returned. See <code>hidden_states</code> under returned tensors
for more detail.`,name:"output_hidden_states"},{anchor:"transformers.LayoutLMForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the model will return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LayoutLMForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_layoutlm.py#L1134",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig"
>LayoutLMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided)  — Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) — Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),xe=new zt({props:{$$slots:{default:[Xn]},$$scope:{ctx:U}}}),ht=new Bt({props:{anchor:"transformers.LayoutLMForTokenClassification.forward.example",$$slots:{default:[Sn]},$$scope:{ctx:U}}}),we=new Se({props:{title:"LayoutLMForQuestionAnswering",local:"transformers.LayoutLMForQuestionAnswering",headingTag:"h2"}}),Re=new A({props:{name:"class transformers.LayoutLMForQuestionAnswering",anchor:"transformers.LayoutLMForQuestionAnswering",parameters:[{name:"config",val:""},{name:"has_visual_segment_embedding",val:" = True"}],parametersDescription:[{anchor:"transformers.LayoutLMForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig">LayoutLMConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_layoutlm.py#L1238"}}),K=new A({props:{name:"forward",anchor:"transformers.LayoutLMForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"end_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_layoutlm.py#L1252",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig"
>LayoutLMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) — Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) — Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ue=new Bt({props:{anchor:"transformers.LayoutLMForQuestionAnswering.forward.example",$$slots:{default:[Dn]},$$scope:{ctx:U}}}),{c(){_(e.$$.fragment),g=r(),n=c("div"),_(a.$$.fragment),M=r(),t=c("p"),t.innerHTML=y,E=r(),F=c("p"),F.innerHTML=x,V=r(),z=c("div"),_($.$$.fragment),W=r(),u=c("p"),u.innerHTML=J,se=r(),_(Je.$$.fragment),Gt=r(),_(de.$$.fragment),Ot=r(),_(De.$$.fragment),be=r(),he=c("div"),_(oe.$$.fragment),Xt=r(),Ce=c("p"),Ce.innerHTML=rt,Y=r(),fe=c("p"),fe.innerHTML=nn,lt=r(),ce=c("div"),_(Ye.$$.fragment),qe=r(),wt=c("p"),wt.innerHTML=kt,Ft=r(),_(Pe.$$.fragment),it=r(),_(ge.$$.fragment),Oe=r(),_(pe.$$.fragment),Ae=r(),X=c("div"),_($e.$$.fragment),Lt=r(),It=c("p"),It.innerHTML=Ke,dt=r(),ke=c("p"),ke.innerHTML=ct,jt=r(),et=c("p"),et.innerHTML=B,vt=r(),Te=c("div"),_(ye.$$.fragment),sn=r(),pt=c("p"),pt.innerHTML=Be,on=r(),_(Ge.$$.fragment),Ne=r(),_(Ut.$$.fragment),qt=r(),_(ae.$$.fragment),Nt=r(),I=c("div"),_(me.$$.fragment),St=r(),Le=c("p"),Le.innerHTML=cn,Dt=r(),Me=c("p"),Me.innerHTML=an,tt=r(),je=c("p"),je.innerHTML=mt,nt=r(),q=c("div"),_(N.$$.fragment),ut=r(),Ee=c("p"),Ee.innerHTML=Et,Kt=r(),_(xe.$$.fragment),Rt=r(),_(ht.$$.fragment),ft=r(),_(we.$$.fragment),st=r(),G=c("div"),_(Re.$$.fragment),ze=r(),Ze=c("p"),Ze.innerHTML=Zt,Vt=r(),Wt=c("p"),Wt.innerHTML=gt,ve=r(),Jt=c("p"),Jt.innerHTML=Ve,Yt=r(),P=c("div"),_(K.$$.fragment),H=r(),We=c("p"),We.innerHTML=Qt,Ht=r(),At=c("p"),At.textContent=yt,Ct=r(),ot=c("p"),ot.textContent=rn,$t=r(),_(Ue.$$.fragment),this.h()},l(h){b(e.$$.fragment,h),g=l(h),n=p(h,"DIV",{class:!0});var C=R(n);b(a.$$.fragment,C),M=l(C),t=p(C,"P",{"data-svelte-h":!0}),f(t)!=="svelte-1fcq938"&&(t.innerHTML=y),E=l(C),F=p(C,"P",{"data-svelte-h":!0}),f(F)!=="svelte-68lg8f"&&(F.innerHTML=x),V=l(C),z=p(C,"DIV",{class:!0});var S=R(z);b($.$$.fragment,S),W=l(S),u=p(S,"P",{"data-svelte-h":!0}),f(u)!=="svelte-1d78prc"&&(u.innerHTML=J),se=l(S),b(Je.$$.fragment,S),Gt=l(S),b(de.$$.fragment,S),S.forEach(o),C.forEach(o),Ot=l(h),b(De.$$.fragment,h),be=l(h),he=p(h,"DIV",{class:!0});var re=R(he);b(oe.$$.fragment,re),Xt=l(re),Ce=p(re,"P",{"data-svelte-h":!0}),f(Ce)!=="svelte-1lmwwjj"&&(Ce.innerHTML=rt),Y=l(re),fe=p(re,"P",{"data-svelte-h":!0}),f(fe)!=="svelte-68lg8f"&&(fe.innerHTML=nn),lt=l(re),ce=p(re,"DIV",{class:!0});var ue=R(ce);b(Ye.$$.fragment,ue),qe=l(ue),wt=p(ue,"P",{"data-svelte-h":!0}),f(wt)!=="svelte-1x92z6g"&&(wt.innerHTML=kt),Ft=l(ue),b(Pe.$$.fragment,ue),it=l(ue),b(ge.$$.fragment,ue),ue.forEach(o),re.forEach(o),Oe=l(h),b(pe.$$.fragment,h),Ae=l(h),X=p(h,"DIV",{class:!0});var ee=R(X);b($e.$$.fragment,ee),Lt=l(ee),It=p(ee,"P",{"data-svelte-h":!0}),f(It)!=="svelte-36uopi"&&(It.innerHTML=Ke),dt=l(ee),ke=p(ee,"P",{"data-svelte-h":!0}),f(ke)!=="svelte-38rmt8"&&(ke.innerHTML=ct),jt=l(ee),et=p(ee,"P",{"data-svelte-h":!0}),f(et)!=="svelte-68lg8f"&&(et.innerHTML=B),vt=l(ee),Te=p(ee,"DIV",{class:!0});var Q=R(Te);b(ye.$$.fragment,Q),sn=l(Q),pt=p(Q,"P",{"data-svelte-h":!0}),f(pt)!=="svelte-152eti8"&&(pt.innerHTML=Be),on=l(Q),b(Ge.$$.fragment,Q),Ne=l(Q),b(Ut.$$.fragment,Q),Q.forEach(o),ee.forEach(o),qt=l(h),b(ae.$$.fragment,h),Nt=l(h),I=p(h,"DIV",{class:!0});var te=R(I);b(me.$$.fragment,te),St=l(te),Le=p(te,"P",{"data-svelte-h":!0}),f(Le)!=="svelte-1yummv5"&&(Le.innerHTML=cn),Dt=l(te),Me=p(te,"P",{"data-svelte-h":!0}),f(Me)!=="svelte-38rmt8"&&(Me.innerHTML=an),tt=l(te),je=p(te,"P",{"data-svelte-h":!0}),f(je)!=="svelte-68lg8f"&&(je.innerHTML=mt),nt=l(te),q=p(te,"DIV",{class:!0});var le=R(q);b(N.$$.fragment,le),ut=l(le),Ee=p(le,"P",{"data-svelte-h":!0}),f(Ee)!=="svelte-1iwkpyq"&&(Ee.innerHTML=Et),Kt=l(le),b(xe.$$.fragment,le),Rt=l(le),b(ht.$$.fragment,le),le.forEach(o),te.forEach(o),ft=l(h),b(we.$$.fragment,h),st=l(h),G=p(h,"DIV",{class:!0});var ie=R(G);b(Re.$$.fragment,ie),ze=l(ie),Ze=p(ie,"P",{"data-svelte-h":!0}),f(Ze)!=="svelte-1uah9q8"&&(Ze.innerHTML=Zt),Vt=l(ie),Wt=p(ie,"P",{"data-svelte-h":!0}),f(Wt)!=="svelte-38rmt8"&&(Wt.innerHTML=gt),ve=l(ie),Jt=p(ie,"P",{"data-svelte-h":!0}),f(Jt)!=="svelte-68lg8f"&&(Jt.innerHTML=Ve),Yt=l(ie),P=p(ie,"DIV",{class:!0});var ne=R(P);b(K.$$.fragment,ne),H=l(ne),We=p(ne,"P",{"data-svelte-h":!0}),f(We)!=="svelte-19yueks"&&(We.innerHTML=Qt),Ht=l(ne),At=p(ne,"P",{"data-svelte-h":!0}),f(At)!=="svelte-11lpom8"&&(At.textContent=yt),Ct=l(ne),ot=p(ne,"P",{"data-svelte-h":!0}),f(ot)!=="svelte-1jlo8qy"&&(ot.textContent=rn),$t=l(ne),b(Ue.$$.fragment,ne),ne.forEach(o),ie.forEach(o),this.h()},h(){Z(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(n,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(Te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(h,C){T(e,h,C),d(h,g,C),d(h,n,C),T(a,n,null),i(n,M),i(n,t),i(n,E),i(n,F),i(n,V),i(n,z),T($,z,null),i(z,W),i(z,u),i(z,se),T(Je,z,null),i(z,Gt),T(de,z,null),d(h,Ot,C),T(De,h,C),d(h,be,C),d(h,he,C),T(oe,he,null),i(he,Xt),i(he,Ce),i(he,Y),i(he,fe),i(he,lt),i(he,ce),T(Ye,ce,null),i(ce,qe),i(ce,wt),i(ce,Ft),T(Pe,ce,null),i(ce,it),T(ge,ce,null),d(h,Oe,C),T(pe,h,C),d(h,Ae,C),d(h,X,C),T($e,X,null),i(X,Lt),i(X,It),i(X,dt),i(X,ke),i(X,jt),i(X,et),i(X,vt),i(X,Te),T(ye,Te,null),i(Te,sn),i(Te,pt),i(Te,on),T(Ge,Te,null),i(Te,Ne),T(Ut,Te,null),d(h,qt,C),T(ae,h,C),d(h,Nt,C),d(h,I,C),T(me,I,null),i(I,St),i(I,Le),i(I,Dt),i(I,Me),i(I,tt),i(I,je),i(I,nt),i(I,q),T(N,q,null),i(q,ut),i(q,Ee),i(q,Kt),T(xe,q,null),i(q,Rt),T(ht,q,null),d(h,ft,C),T(we,h,C),d(h,st,C),d(h,G,C),T(Re,G,null),i(G,ze),i(G,Ze),i(G,Vt),i(G,Wt),i(G,ve),i(G,Jt),i(G,Yt),i(G,P),T(K,P,null),i(P,H),i(P,We),i(P,Ht),i(P,At),i(P,Ct),i(P,ot),i(P,$t),T(Ue,P,null),at=!0},p(h,C){const S={};C&2&&(S.$$scope={dirty:C,ctx:h}),Je.$set(S);const re={};C&2&&(re.$$scope={dirty:C,ctx:h}),de.$set(re);const ue={};C&2&&(ue.$$scope={dirty:C,ctx:h}),Pe.$set(ue);const ee={};C&2&&(ee.$$scope={dirty:C,ctx:h}),ge.$set(ee);const Q={};C&2&&(Q.$$scope={dirty:C,ctx:h}),Ge.$set(Q);const te={};C&2&&(te.$$scope={dirty:C,ctx:h}),Ut.$set(te);const le={};C&2&&(le.$$scope={dirty:C,ctx:h}),xe.$set(le);const ie={};C&2&&(ie.$$scope={dirty:C,ctx:h}),ht.$set(ie);const ne={};C&2&&(ne.$$scope={dirty:C,ctx:h}),Ue.$set(ne)},i(h){at||(w(e.$$.fragment,h),w(a.$$.fragment,h),w($.$$.fragment,h),w(Je.$$.fragment,h),w(de.$$.fragment,h),w(De.$$.fragment,h),w(oe.$$.fragment,h),w(Ye.$$.fragment,h),w(Pe.$$.fragment,h),w(ge.$$.fragment,h),w(pe.$$.fragment,h),w($e.$$.fragment,h),w(ye.$$.fragment,h),w(Ge.$$.fragment,h),w(Ut.$$.fragment,h),w(ae.$$.fragment,h),w(me.$$.fragment,h),w(N.$$.fragment,h),w(xe.$$.fragment,h),w(ht.$$.fragment,h),w(we.$$.fragment,h),w(Re.$$.fragment,h),w(K.$$.fragment,h),w(Ue.$$.fragment,h),at=!0)},o(h){k(e.$$.fragment,h),k(a.$$.fragment,h),k($.$$.fragment,h),k(Je.$$.fragment,h),k(de.$$.fragment,h),k(De.$$.fragment,h),k(oe.$$.fragment,h),k(Ye.$$.fragment,h),k(Pe.$$.fragment,h),k(ge.$$.fragment,h),k(pe.$$.fragment,h),k($e.$$.fragment,h),k(ye.$$.fragment,h),k(Ge.$$.fragment,h),k(Ut.$$.fragment,h),k(ae.$$.fragment,h),k(me.$$.fragment,h),k(N.$$.fragment,h),k(xe.$$.fragment,h),k(ht.$$.fragment,h),k(we.$$.fragment,h),k(Re.$$.fragment,h),k(K.$$.fragment,h),k(Ue.$$.fragment,h),at=!1},d(h){h&&(o(g),o(n),o(Ot),o(be),o(he),o(Oe),o(Ae),o(X),o(qt),o(Nt),o(I),o(ft),o(st),o(G)),L(e,h),L(a),L($),L(Je),L(de),L(De,h),L(oe),L(Ye),L(Pe),L(ge),L(pe,h),L($e),L(ye),L(Ge),L(Ut),L(ae,h),L(me),L(N),L(xe),L(ht),L(we,h),L(Re),L(K),L(Ue)}}}function Pn(U){let e,g;return e=new xn({props:{$$slots:{default:[Yn]},$$scope:{ctx:U}}}),{c(){_(e.$$.fragment)},l(n){b(e.$$.fragment,n)},m(n,a){T(e,n,a),g=!0},p(n,a){const M={};a&2&&(M.$$scope={dirty:a,ctx:n}),e.$set(M)},i(n){g||(w(e.$$.fragment,n),g=!0)},o(n){k(e.$$.fragment,n),g=!1},d(n){L(e,n)}}}function On(U){let e,g="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,a,M="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,y,E=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just
pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second
format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with
the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`,F,x,V=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
<code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring:
<code>model({&quot;input_ids&quot;: input_ids, &quot;token_type_ids&quot;: token_type_ids})</code></li>`,z,$,W=`Note that when creating models and layers with
<a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=g,n=r(),a=c("ul"),a.innerHTML=M,t=r(),y=c("p"),y.innerHTML=E,F=r(),x=c("ul"),x.innerHTML=V,z=r(),$=c("p"),$.innerHTML=W},l(u){e=p(u,"P",{"data-svelte-h":!0}),f(e)!=="svelte-1ajbfxg"&&(e.innerHTML=g),n=l(u),a=p(u,"UL",{"data-svelte-h":!0}),f(a)!=="svelte-qm1t26"&&(a.innerHTML=M),t=l(u),y=p(u,"P",{"data-svelte-h":!0}),f(y)!=="svelte-1v9qsc5"&&(y.innerHTML=E),F=l(u),x=p(u,"UL",{"data-svelte-h":!0}),f(x)!=="svelte-15scerc"&&(x.innerHTML=V),z=l(u),$=p(u,"P",{"data-svelte-h":!0}),f($)!=="svelte-1an3odd"&&($.innerHTML=W)},m(u,J){d(u,e,J),d(u,n,J),d(u,a,J),d(u,t,J),d(u,y,J),d(u,F,J),d(u,x,J),d(u,z,J),d(u,$,J)},p:D,d(u){u&&(o(e),o(n),o(a),o(t),o(y),o(F),o(x),o(z),o($))}}}function Kn(U){let e,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=g},l(n){e=p(n,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(n,a){d(n,e,a)},p:D,d(n){n&&o(e)}}}function es(U){let e,g="Examples:",n,a,M;return a=new Tt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkxheW91dExNTW9kZWwlMEFpbXBvcnQlMjB0ZW5zb3JmbG93JTIwYXMlMjB0ZiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRmxheW91dGxtLWJhc2UtdW5jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGTGF5b3V0TE1Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGbGF5b3V0bG0tYmFzZS11bmNhc2VkJTIyKSUwQSUwQXdvcmRzJTIwJTNEJTIwJTVCJTIySGVsbG8lMjIlMkMlMjAlMjJ3b3JsZCUyMiU1RCUwQW5vcm1hbGl6ZWRfd29yZF9ib3hlcyUyMCUzRCUyMCU1QjYzNyUyQyUyMDc3MyUyQyUyMDY5MyUyQyUyMDc4MiU1RCUyQyUyMCU1QjY5OCUyQyUyMDc3MyUyQyUyMDczMyUyQyUyMDc4MiU1RCUwQSUwQXRva2VuX2JveGVzJTIwJTNEJTIwJTVCJTVEJTBBZm9yJTIwd29yZCUyQyUyMGJveCUyMGluJTIwemlwKHdvcmRzJTJDJTIwbm9ybWFsaXplZF93b3JkX2JveGVzKSUzQSUwQSUyMCUyMCUyMCUyMHdvcmRfdG9rZW5zJTIwJTNEJTIwdG9rZW5pemVyLnRva2VuaXplKHdvcmQpJTBBJTIwJTIwJTIwJTIwdG9rZW5fYm94ZXMuZXh0ZW5kKCU1QmJveCU1RCUyMColMjBsZW4od29yZF90b2tlbnMpKSUwQSUyMyUyMGFkZCUyMGJvdW5kaW5nJTIwYm94ZXMlMjBvZiUyMGNscyUyMCUyQiUyMHNlcCUyMHRva2VucyUwQXRva2VuX2JveGVzJTIwJTNEJTIwJTVCJTVCMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCU1RCU1RCUyMCUyQiUyMHRva2VuX2JveGVzJTIwJTJCJTIwJTVCJTVCMTAwMCUyQyUyMDEwMDAlMkMlMjAxMDAwJTJDJTIwMTAwMCU1RCU1RCUwQSUwQWVuY29kaW5nJTIwJTNEJTIwdG9rZW5pemVyKCUyMiUyMCUyMi5qb2luKHdvcmRzKSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBaW5wdXRfaWRzJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEFhdHRlbnRpb25fbWFzayUyMCUzRCUyMGVuY29kaW5nJTVCJTIyYXR0ZW50aW9uX21hc2slMjIlNUQlMEF0b2tlbl90eXBlX2lkcyUyMCUzRCUyMGVuY29kaW5nJTVCJTIydG9rZW5fdHlwZV9pZHMlMjIlNUQlMEFiYm94JTIwJTNEJTIwdGYuY29udmVydF90b190ZW5zb3IoJTVCdG9rZW5fYm94ZXMlNUQpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUyMGJib3glM0RiYm94JTJDJTIwYXR0ZW50aW9uX21hc2slM0RhdHRlbnRpb25fbWFzayUyQyUyMHRva2VuX3R5cGVfaWRzJTNEdG9rZW5fdHlwZV9pZHMlMEEpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFLayoutLMModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFLayoutLMModel.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>words = [<span class="hljs-string">&quot;Hello&quot;</span>, <span class="hljs-string">&quot;world&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>normalized_word_boxes = [<span class="hljs-number">637</span>, <span class="hljs-number">773</span>, <span class="hljs-number">693</span>, <span class="hljs-number">782</span>], [<span class="hljs-number">698</span>, <span class="hljs-number">773</span>, <span class="hljs-number">733</span>, <span class="hljs-number">782</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> word, box <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(words, normalized_word_boxes):
<span class="hljs-meta">... </span>    word_tokens = tokenizer.tokenize(word)
<span class="hljs-meta">... </span>    token_boxes.extend([box] * <span class="hljs-built_in">len</span>(word_tokens))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># add bounding boxes of cls + sep tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = [[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]] + token_boxes + [[<span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(<span class="hljs-string">&quot; &quot;</span>.join(words), return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = encoding[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>attention_mask = encoding[<span class="hljs-string">&quot;attention_mask&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>token_type_ids = encoding[<span class="hljs-string">&quot;token_type_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>bbox = tf.convert_to_tensor([token_boxes])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(
<span class="hljs-meta">... </span>    input_ids=input_ids, bbox=bbox, attention_mask=attention_mask, token_type_ids=token_type_ids
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`,wrap:!1}}),{c(){e=c("p"),e.textContent=g,n=r(),_(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),n=l(t),b(a.$$.fragment,t)},m(t,y){d(t,e,y),d(t,n,y),T(a,t,y),M=!0},p:D,i(t){M||(w(a.$$.fragment,t),M=!0)},o(t){k(a.$$.fragment,t),M=!1},d(t){t&&(o(e),o(n)),L(a,t)}}}function ts(U){let e,g="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,a,M="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,y,E=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just
pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second
format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with
the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`,F,x,V=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
<code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring:
<code>model({&quot;input_ids&quot;: input_ids, &quot;token_type_ids&quot;: token_type_ids})</code></li>`,z,$,W=`Note that when creating models and layers with
<a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=g,n=r(),a=c("ul"),a.innerHTML=M,t=r(),y=c("p"),y.innerHTML=E,F=r(),x=c("ul"),x.innerHTML=V,z=r(),$=c("p"),$.innerHTML=W},l(u){e=p(u,"P",{"data-svelte-h":!0}),f(e)!=="svelte-1ajbfxg"&&(e.innerHTML=g),n=l(u),a=p(u,"UL",{"data-svelte-h":!0}),f(a)!=="svelte-qm1t26"&&(a.innerHTML=M),t=l(u),y=p(u,"P",{"data-svelte-h":!0}),f(y)!=="svelte-1v9qsc5"&&(y.innerHTML=E),F=l(u),x=p(u,"UL",{"data-svelte-h":!0}),f(x)!=="svelte-15scerc"&&(x.innerHTML=V),z=l(u),$=p(u,"P",{"data-svelte-h":!0}),f($)!=="svelte-1an3odd"&&($.innerHTML=W)},m(u,J){d(u,e,J),d(u,n,J),d(u,a,J),d(u,t,J),d(u,y,J),d(u,F,J),d(u,x,J),d(u,z,J),d(u,$,J)},p:D,d(u){u&&(o(e),o(n),o(a),o(t),o(y),o(F),o(x),o(z),o($))}}}function ns(U){let e,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=g},l(n){e=p(n,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(n,a){d(n,e,a)},p:D,d(n){n&&o(e)}}}function ss(U){let e,g="Examples:",n,a,M;return a=new Tt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkxheW91dExNRm9yTWFza2VkTE0lMEFpbXBvcnQlMjB0ZW5zb3JmbG93JTIwYXMlMjB0ZiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRmxheW91dGxtLWJhc2UtdW5jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGTGF5b3V0TE1Gb3JNYXNrZWRMTS5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGbGF5b3V0bG0tYmFzZS11bmNhc2VkJTIyKSUwQSUwQXdvcmRzJTIwJTNEJTIwJTVCJTIySGVsbG8lMjIlMkMlMjAlMjIlNUJNQVNLJTVEJTIyJTVEJTBBbm9ybWFsaXplZF93b3JkX2JveGVzJTIwJTNEJTIwJTVCNjM3JTJDJTIwNzczJTJDJTIwNjkzJTJDJTIwNzgyJTVEJTJDJTIwJTVCNjk4JTJDJTIwNzczJTJDJTIwNzMzJTJDJTIwNzgyJTVEJTBBJTBBdG9rZW5fYm94ZXMlMjAlM0QlMjAlNUIlNUQlMEFmb3IlMjB3b3JkJTJDJTIwYm94JTIwaW4lMjB6aXAod29yZHMlMkMlMjBub3JtYWxpemVkX3dvcmRfYm94ZXMpJTNBJTBBJTIwJTIwJTIwJTIwd29yZF90b2tlbnMlMjAlM0QlMjB0b2tlbml6ZXIudG9rZW5pemUod29yZCklMEElMjAlMjAlMjAlMjB0b2tlbl9ib3hlcy5leHRlbmQoJTVCYm94JTVEJTIwKiUyMGxlbih3b3JkX3Rva2VucykpJTBBJTIzJTIwYWRkJTIwYm91bmRpbmclMjBib3hlcyUyMG9mJTIwY2xzJTIwJTJCJTIwc2VwJTIwdG9rZW5zJTBBdG9rZW5fYm94ZXMlMjAlM0QlMjAlNUIlNUIwJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTVEJTVEJTIwJTJCJTIwdG9rZW5fYm94ZXMlMjAlMkIlMjAlNUIlNUIxMDAwJTJDJTIwMTAwMCUyQyUyMDEwMDAlMkMlMjAxMDAwJTVEJTVEJTBBJTBBZW5jb2RpbmclMjAlM0QlMjB0b2tlbml6ZXIoJTIyJTIwJTIyLmpvaW4od29yZHMpJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFpbnB1dF9pZHMlMjAlM0QlMjBlbmNvZGluZyU1QiUyMmlucHV0X2lkcyUyMiU1RCUwQWF0dGVudGlvbl9tYXNrJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJhdHRlbnRpb25fbWFzayUyMiU1RCUwQXRva2VuX3R5cGVfaWRzJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJ0b2tlbl90eXBlX2lkcyUyMiU1RCUwQWJib3glMjAlM0QlMjB0Zi5jb252ZXJ0X3RvX3RlbnNvciglNUJ0b2tlbl9ib3hlcyU1RCklMEElMEFsYWJlbHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMjB3b3JsZCUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUwQSUyMCUyMCUyMCUyMGJib3glM0RiYm94JTJDJTBBJTIwJTIwJTIwJTIwYXR0ZW50aW9uX21hc2slM0RhdHRlbnRpb25fbWFzayUyQyUwQSUyMCUyMCUyMCUyMHRva2VuX3R5cGVfaWRzJTNEdG9rZW5fdHlwZV9pZHMlMkMlMEElMjAlMjAlMjAlMjBsYWJlbHMlM0RsYWJlbHMlMkMlMEEpJTBBJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFLayoutLMForMaskedLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFLayoutLMForMaskedLM.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>words = [<span class="hljs-string">&quot;Hello&quot;</span>, <span class="hljs-string">&quot;[MASK]&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>normalized_word_boxes = [<span class="hljs-number">637</span>, <span class="hljs-number">773</span>, <span class="hljs-number">693</span>, <span class="hljs-number">782</span>], [<span class="hljs-number">698</span>, <span class="hljs-number">773</span>, <span class="hljs-number">733</span>, <span class="hljs-number">782</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> word, box <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(words, normalized_word_boxes):
<span class="hljs-meta">... </span>    word_tokens = tokenizer.tokenize(word)
<span class="hljs-meta">... </span>    token_boxes.extend([box] * <span class="hljs-built_in">len</span>(word_tokens))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># add bounding boxes of cls + sep tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = [[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]] + token_boxes + [[<span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(<span class="hljs-string">&quot; &quot;</span>.join(words), return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = encoding[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>attention_mask = encoding[<span class="hljs-string">&quot;attention_mask&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>token_type_ids = encoding[<span class="hljs-string">&quot;token_type_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>bbox = tf.convert_to_tensor([token_boxes])

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(
<span class="hljs-meta">... </span>    input_ids=input_ids,
<span class="hljs-meta">... </span>    bbox=bbox,
<span class="hljs-meta">... </span>    attention_mask=attention_mask,
<span class="hljs-meta">... </span>    token_type_ids=token_type_ids,
<span class="hljs-meta">... </span>    labels=labels,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss`,wrap:!1}}),{c(){e=c("p"),e.textContent=g,n=r(),_(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),n=l(t),b(a.$$.fragment,t)},m(t,y){d(t,e,y),d(t,n,y),T(a,t,y),M=!0},p:D,i(t){M||(w(a.$$.fragment,t),M=!0)},o(t){k(a.$$.fragment,t),M=!1},d(t){t&&(o(e),o(n)),L(a,t)}}}function os(U){let e,g="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,a,M="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,y,E=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just
pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second
format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with
the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`,F,x,V=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
<code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring:
<code>model({&quot;input_ids&quot;: input_ids, &quot;token_type_ids&quot;: token_type_ids})</code></li>`,z,$,W=`Note that when creating models and layers with
<a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=g,n=r(),a=c("ul"),a.innerHTML=M,t=r(),y=c("p"),y.innerHTML=E,F=r(),x=c("ul"),x.innerHTML=V,z=r(),$=c("p"),$.innerHTML=W},l(u){e=p(u,"P",{"data-svelte-h":!0}),f(e)!=="svelte-1ajbfxg"&&(e.innerHTML=g),n=l(u),a=p(u,"UL",{"data-svelte-h":!0}),f(a)!=="svelte-qm1t26"&&(a.innerHTML=M),t=l(u),y=p(u,"P",{"data-svelte-h":!0}),f(y)!=="svelte-1v9qsc5"&&(y.innerHTML=E),F=l(u),x=p(u,"UL",{"data-svelte-h":!0}),f(x)!=="svelte-15scerc"&&(x.innerHTML=V),z=l(u),$=p(u,"P",{"data-svelte-h":!0}),f($)!=="svelte-1an3odd"&&($.innerHTML=W)},m(u,J){d(u,e,J),d(u,n,J),d(u,a,J),d(u,t,J),d(u,y,J),d(u,F,J),d(u,x,J),d(u,z,J),d(u,$,J)},p:D,d(u){u&&(o(e),o(n),o(a),o(t),o(y),o(F),o(x),o(z),o($))}}}function as(U){let e,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=g},l(n){e=p(n,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(n,a){d(n,e,a)},p:D,d(n){n&&o(e)}}}function rs(U){let e,g="Examples:",n,a,M;return a=new Tt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkxheW91dExNRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGbGF5b3V0bG0tYmFzZS11bmNhc2VkJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZMYXlvdXRMTUZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRmxheW91dGxtLWJhc2UtdW5jYXNlZCUyMiklMEElMEF3b3JkcyUyMCUzRCUyMCU1QiUyMkhlbGxvJTIyJTJDJTIwJTIyd29ybGQlMjIlNUQlMEFub3JtYWxpemVkX3dvcmRfYm94ZXMlMjAlM0QlMjAlNUI2MzclMkMlMjA3NzMlMkMlMjA2OTMlMkMlMjA3ODIlNUQlMkMlMjAlNUI2OTglMkMlMjA3NzMlMkMlMjA3MzMlMkMlMjA3ODIlNUQlMEElMEF0b2tlbl9ib3hlcyUyMCUzRCUyMCU1QiU1RCUwQWZvciUyMHdvcmQlMkMlMjBib3glMjBpbiUyMHppcCh3b3JkcyUyQyUyMG5vcm1hbGl6ZWRfd29yZF9ib3hlcyklM0ElMEElMjAlMjAlMjAlMjB3b3JkX3Rva2VucyUyMCUzRCUyMHRva2VuaXplci50b2tlbml6ZSh3b3JkKSUwQSUyMCUyMCUyMCUyMHRva2VuX2JveGVzLmV4dGVuZCglNUJib3glNUQlMjAqJTIwbGVuKHdvcmRfdG9rZW5zKSklMEElMjMlMjBhZGQlMjBib3VuZGluZyUyMGJveGVzJTIwb2YlMjBjbHMlMjAlMkIlMjBzZXAlMjB0b2tlbnMlMEF0b2tlbl9ib3hlcyUyMCUzRCUyMCU1QiU1QjAlMkMlMjAwJTJDJTIwMCUyQyUyMDAlNUQlNUQlMjAlMkIlMjB0b2tlbl9ib3hlcyUyMCUyQiUyMCU1QiU1QjEwMDAlMkMlMjAxMDAwJTJDJTIwMTAwMCUyQyUyMDEwMDAlNUQlNUQlMEElMEFlbmNvZGluZyUyMCUzRCUyMHRva2VuaXplciglMjIlMjAlMjIuam9pbih3b3JkcyklMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQWlucHV0X2lkcyUyMCUzRCUyMGVuY29kaW5nJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBYXR0ZW50aW9uX21hc2slMjAlM0QlMjBlbmNvZGluZyU1QiUyMmF0dGVudGlvbl9tYXNrJTIyJTVEJTBBdG9rZW5fdHlwZV9pZHMlMjAlM0QlMjBlbmNvZGluZyU1QiUyMnRva2VuX3R5cGVfaWRzJTIyJTVEJTBBYmJveCUyMCUzRCUyMHRmLmNvbnZlcnRfdG9fdGVuc29yKCU1QnRva2VuX2JveGVzJTVEKSUwQXNlcXVlbmNlX2xhYmVsJTIwJTNEJTIwdGYuY29udmVydF90b190ZW5zb3IoJTVCMSU1RCklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoJTBBJTIwJTIwJTIwJTIwaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTBBJTIwJTIwJTIwJTIwYmJveCUzRGJib3glMkMlMEElMjAlMjAlMjAlMjBhdHRlbnRpb25fbWFzayUzRGF0dGVudGlvbl9tYXNrJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5fdHlwZV9pZHMlM0R0b2tlbl90eXBlX2lkcyUyQyUwQSUyMCUyMCUyMCUyMGxhYmVscyUzRHNlcXVlbmNlX2xhYmVsJTJDJTBBKSUwQSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFLayoutLMForSequenceClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFLayoutLMForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>words = [<span class="hljs-string">&quot;Hello&quot;</span>, <span class="hljs-string">&quot;world&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>normalized_word_boxes = [<span class="hljs-number">637</span>, <span class="hljs-number">773</span>, <span class="hljs-number">693</span>, <span class="hljs-number">782</span>], [<span class="hljs-number">698</span>, <span class="hljs-number">773</span>, <span class="hljs-number">733</span>, <span class="hljs-number">782</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> word, box <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(words, normalized_word_boxes):
<span class="hljs-meta">... </span>    word_tokens = tokenizer.tokenize(word)
<span class="hljs-meta">... </span>    token_boxes.extend([box] * <span class="hljs-built_in">len</span>(word_tokens))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># add bounding boxes of cls + sep tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = [[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]] + token_boxes + [[<span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(<span class="hljs-string">&quot; &quot;</span>.join(words), return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = encoding[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>attention_mask = encoding[<span class="hljs-string">&quot;attention_mask&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>token_type_ids = encoding[<span class="hljs-string">&quot;token_type_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>bbox = tf.convert_to_tensor([token_boxes])
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_label = tf.convert_to_tensor([<span class="hljs-number">1</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(
<span class="hljs-meta">... </span>    input_ids=input_ids,
<span class="hljs-meta">... </span>    bbox=bbox,
<span class="hljs-meta">... </span>    attention_mask=attention_mask,
<span class="hljs-meta">... </span>    token_type_ids=token_type_ids,
<span class="hljs-meta">... </span>    labels=sequence_label,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=g,n=r(),_(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),n=l(t),b(a.$$.fragment,t)},m(t,y){d(t,e,y),d(t,n,y),T(a,t,y),M=!0},p:D,i(t){M||(w(a.$$.fragment,t),M=!0)},o(t){k(a.$$.fragment,t),M=!1},d(t){t&&(o(e),o(n)),L(a,t)}}}function ls(U){let e,g="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,a,M="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,y,E=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just
pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second
format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with
the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`,F,x,V=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
<code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring:
<code>model({&quot;input_ids&quot;: input_ids, &quot;token_type_ids&quot;: token_type_ids})</code></li>`,z,$,W=`Note that when creating models and layers with
<a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=g,n=r(),a=c("ul"),a.innerHTML=M,t=r(),y=c("p"),y.innerHTML=E,F=r(),x=c("ul"),x.innerHTML=V,z=r(),$=c("p"),$.innerHTML=W},l(u){e=p(u,"P",{"data-svelte-h":!0}),f(e)!=="svelte-1ajbfxg"&&(e.innerHTML=g),n=l(u),a=p(u,"UL",{"data-svelte-h":!0}),f(a)!=="svelte-qm1t26"&&(a.innerHTML=M),t=l(u),y=p(u,"P",{"data-svelte-h":!0}),f(y)!=="svelte-1v9qsc5"&&(y.innerHTML=E),F=l(u),x=p(u,"UL",{"data-svelte-h":!0}),f(x)!=="svelte-15scerc"&&(x.innerHTML=V),z=l(u),$=p(u,"P",{"data-svelte-h":!0}),f($)!=="svelte-1an3odd"&&($.innerHTML=W)},m(u,J){d(u,e,J),d(u,n,J),d(u,a,J),d(u,t,J),d(u,y,J),d(u,F,J),d(u,x,J),d(u,z,J),d(u,$,J)},p:D,d(u){u&&(o(e),o(n),o(a),o(t),o(y),o(F),o(x),o(z),o($))}}}function is(U){let e,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=g},l(n){e=p(n,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(n,a){d(n,e,a)},p:D,d(n){n&&o(e)}}}function ds(U){let e,g="Examples:",n,a,M;return a=new Tt({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMFRGTGF5b3V0TE1Gb3JUb2tlbkNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGbGF5b3V0bG0tYmFzZS11bmNhc2VkJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZMYXlvdXRMTUZvclRva2VuQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRmxheW91dGxtLWJhc2UtdW5jYXNlZCUyMiklMEElMEF3b3JkcyUyMCUzRCUyMCU1QiUyMkhlbGxvJTIyJTJDJTIwJTIyd29ybGQlMjIlNUQlMEFub3JtYWxpemVkX3dvcmRfYm94ZXMlMjAlM0QlMjAlNUI2MzclMkMlMjA3NzMlMkMlMjA2OTMlMkMlMjA3ODIlNUQlMkMlMjAlNUI2OTglMkMlMjA3NzMlMkMlMjA3MzMlMkMlMjA3ODIlNUQlMEElMEF0b2tlbl9ib3hlcyUyMCUzRCUyMCU1QiU1RCUwQWZvciUyMHdvcmQlMkMlMjBib3glMjBpbiUyMHppcCh3b3JkcyUyQyUyMG5vcm1hbGl6ZWRfd29yZF9ib3hlcyklM0ElMEElMjAlMjAlMjAlMjB3b3JkX3Rva2VucyUyMCUzRCUyMHRva2VuaXplci50b2tlbml6ZSh3b3JkKSUwQSUyMCUyMCUyMCUyMHRva2VuX2JveGVzLmV4dGVuZCglNUJib3glNUQlMjAqJTIwbGVuKHdvcmRfdG9rZW5zKSklMEElMjMlMjBhZGQlMjBib3VuZGluZyUyMGJveGVzJTIwb2YlMjBjbHMlMjAlMkIlMjBzZXAlMjB0b2tlbnMlMEF0b2tlbl9ib3hlcyUyMCUzRCUyMCU1QiU1QjAlMkMlMjAwJTJDJTIwMCUyQyUyMDAlNUQlNUQlMjAlMkIlMjB0b2tlbl9ib3hlcyUyMCUyQiUyMCU1QiU1QjEwMDAlMkMlMjAxMDAwJTJDJTIwMTAwMCUyQyUyMDEwMDAlNUQlNUQlMEElMEFlbmNvZGluZyUyMCUzRCUyMHRva2VuaXplciglMjIlMjAlMjIuam9pbih3b3JkcyklMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQWlucHV0X2lkcyUyMCUzRCUyMGVuY29kaW5nJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBYXR0ZW50aW9uX21hc2slMjAlM0QlMjBlbmNvZGluZyU1QiUyMmF0dGVudGlvbl9tYXNrJTIyJTVEJTBBdG9rZW5fdHlwZV9pZHMlMjAlM0QlMjBlbmNvZGluZyU1QiUyMnRva2VuX3R5cGVfaWRzJTIyJTVEJTBBYmJveCUyMCUzRCUyMHRmLmNvbnZlcnRfdG9fdGVuc29yKCU1QnRva2VuX2JveGVzJTVEKSUwQXRva2VuX2xhYmVscyUyMCUzRCUyMHRmLmNvbnZlcnRfdG9fdGVuc29yKCU1QjElMkMlMjAxJTJDJTIwMCUyQyUyMDAlNUQpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUwQSUyMCUyMCUyMCUyMGJib3glM0RiYm94JTJDJTBBJTIwJTIwJTIwJTIwYXR0ZW50aW9uX21hc2slM0RhdHRlbnRpb25fbWFzayUyQyUwQSUyMCUyMCUyMCUyMHRva2VuX3R5cGVfaWRzJTNEdG9rZW5fdHlwZV9pZHMlMkMlMEElMjAlMjAlMjAlMjBsYWJlbHMlM0R0b2tlbl9sYWJlbHMlMkMlMEEpJTBBJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcyUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFLayoutLMForTokenClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFLayoutLMForTokenClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlm-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>words = [<span class="hljs-string">&quot;Hello&quot;</span>, <span class="hljs-string">&quot;world&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>normalized_word_boxes = [<span class="hljs-number">637</span>, <span class="hljs-number">773</span>, <span class="hljs-number">693</span>, <span class="hljs-number">782</span>], [<span class="hljs-number">698</span>, <span class="hljs-number">773</span>, <span class="hljs-number">733</span>, <span class="hljs-number">782</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> word, box <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(words, normalized_word_boxes):
<span class="hljs-meta">... </span>    word_tokens = tokenizer.tokenize(word)
<span class="hljs-meta">... </span>    token_boxes.extend([box] * <span class="hljs-built_in">len</span>(word_tokens))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># add bounding boxes of cls + sep tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>token_boxes = [[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]] + token_boxes + [[<span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>, <span class="hljs-number">1000</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(<span class="hljs-string">&quot; &quot;</span>.join(words), return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = encoding[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>attention_mask = encoding[<span class="hljs-string">&quot;attention_mask&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>token_type_ids = encoding[<span class="hljs-string">&quot;token_type_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>bbox = tf.convert_to_tensor([token_boxes])
<span class="hljs-meta">&gt;&gt;&gt; </span>token_labels = tf.convert_to_tensor([<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(
<span class="hljs-meta">... </span>    input_ids=input_ids,
<span class="hljs-meta">... </span>    bbox=bbox,
<span class="hljs-meta">... </span>    attention_mask=attention_mask,
<span class="hljs-meta">... </span>    token_type_ids=token_type_ids,
<span class="hljs-meta">... </span>    labels=token_labels,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=g,n=r(),_(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),n=l(t),b(a.$$.fragment,t)},m(t,y){d(t,e,y),d(t,n,y),T(a,t,y),M=!0},p:D,i(t){M||(w(a.$$.fragment,t),M=!0)},o(t){k(a.$$.fragment,t),M=!1},d(t){t&&(o(e),o(n)),L(a,t)}}}function cs(U){let e,g="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,a,M="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,y,E=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just
pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second
format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with
the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`,F,x,V=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
<code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring:
<code>model({&quot;input_ids&quot;: input_ids, &quot;token_type_ids&quot;: token_type_ids})</code></li>`,z,$,W=`Note that when creating models and layers with
<a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=g,n=r(),a=c("ul"),a.innerHTML=M,t=r(),y=c("p"),y.innerHTML=E,F=r(),x=c("ul"),x.innerHTML=V,z=r(),$=c("p"),$.innerHTML=W},l(u){e=p(u,"P",{"data-svelte-h":!0}),f(e)!=="svelte-1ajbfxg"&&(e.innerHTML=g),n=l(u),a=p(u,"UL",{"data-svelte-h":!0}),f(a)!=="svelte-qm1t26"&&(a.innerHTML=M),t=l(u),y=p(u,"P",{"data-svelte-h":!0}),f(y)!=="svelte-1v9qsc5"&&(y.innerHTML=E),F=l(u),x=p(u,"UL",{"data-svelte-h":!0}),f(x)!=="svelte-15scerc"&&(x.innerHTML=V),z=l(u),$=p(u,"P",{"data-svelte-h":!0}),f($)!=="svelte-1an3odd"&&($.innerHTML=W)},m(u,J){d(u,e,J),d(u,n,J),d(u,a,J),d(u,t,J),d(u,y,J),d(u,F,J),d(u,x,J),d(u,z,J),d(u,$,J)},p:D,d(u){u&&(o(e),o(n),o(a),o(t),o(y),o(F),o(x),o(z),o($))}}}function ps(U){let e,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=g},l(n){e=p(n,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(n,a){d(n,e,a)},p:D,d(n){n&&o(e)}}}function ms(U){let e,g="Examples:",n,a,M;return a=new Tt({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMFRGTGF5b3V0TE1Gb3JRdWVzdGlvbkFuc3dlcmluZyUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmltcGlyYSUyRmxheW91dGxtLWRvY3VtZW50LXFhJTIyJTJDJTIwYWRkX3ByZWZpeF9zcGFjZSUzRFRydWUpJTBBbW9kZWwlMjAlM0QlMjBURkxheW91dExNRm9yUXVlc3Rpb25BbnN3ZXJpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMmltcGlyYSUyRmxheW91dGxtLWRvY3VtZW50LXFhJTIyJTJDJTIwcmV2aXNpb24lM0QlMjIxZTNlYmFjJTIyKSUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIybmllbHNyJTJGZnVuc2QlMjIlMkMlMjBzcGxpdCUzRCUyMnRyYWluJTIyKSUwQWV4YW1wbGUlMjAlM0QlMjBkYXRhc2V0JTVCMCU1RCUwQXF1ZXN0aW9uJTIwJTNEJTIwJTIyd2hhdCdzJTIwaGlzJTIwbmFtZSUzRiUyMiUwQXdvcmRzJTIwJTNEJTIwZXhhbXBsZSU1QiUyMndvcmRzJTIyJTVEJTBBYm94ZXMlMjAlM0QlMjBleGFtcGxlJTVCJTIyYmJveGVzJTIyJTVEJTBBJTBBZW5jb2RpbmclMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwcXVlc3Rpb24uc3BsaXQoKSUyQyUyMHdvcmRzJTJDJTIwaXNfc3BsaXRfaW50b193b3JkcyUzRFRydWUlMkMlMjByZXR1cm5fdG9rZW5fdHlwZV9pZHMlM0RUcnVlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiUwQSklMEFiYm94JTIwJTNEJTIwJTVCJTVEJTBBZm9yJTIwaSUyQyUyMHMlMkMlMjB3JTIwaW4lMjB6aXAoZW5jb2RpbmcuaW5wdXRfaWRzJTVCMCU1RCUyQyUyMGVuY29kaW5nLnNlcXVlbmNlX2lkcygwKSUyQyUyMGVuY29kaW5nLndvcmRfaWRzKDApKSUzQSUwQSUyMCUyMCUyMCUyMGlmJTIwcyUyMCUzRCUzRCUyMDElM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBiYm94LmFwcGVuZChib3hlcyU1QnclNUQpJTBBJTIwJTIwJTIwJTIwZWxpZiUyMGklMjAlM0QlM0QlMjB0b2tlbml6ZXIuc2VwX3Rva2VuX2lkJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYmJveC5hcHBlbmQoJTVCMTAwMCU1RCUyMColMjA0KSUwQSUyMCUyMCUyMCUyMGVsc2UlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBiYm94LmFwcGVuZCglNUIwJTVEJTIwKiUyMDQpJTBBZW5jb2RpbmclNUIlMjJiYm94JTIyJTVEJTIwJTNEJTIwdGYuY29udmVydF90b190ZW5zb3IoJTVCYmJveCU1RCklMEElMEF3b3JkX2lkcyUyMCUzRCUyMGVuY29kaW5nLndvcmRfaWRzKDApJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqZW5jb2RpbmcpJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcyUwQXN0YXJ0X3Njb3JlcyUyMCUzRCUyMG91dHB1dHMuc3RhcnRfbG9naXRzJTBBZW5kX3Njb3JlcyUyMCUzRCUyMG91dHB1dHMuZW5kX2xvZ2l0cyUwQXN0YXJ0JTJDJTIwZW5kJTIwJTNEJTIwd29yZF9pZHMlNUJ0Zi5tYXRoLmFyZ21heChzdGFydF9zY29yZXMlMkMlMjAtMSklNUIwJTVEJTVEJTJDJTIwd29yZF9pZHMlNUJ0Zi5tYXRoLmFyZ21heChlbmRfc2NvcmVzJTJDJTIwLTEpJTVCMCU1RCU1RCUwQXByaW50KCUyMiUyMCUyMi5qb2luKHdvcmRzJTVCc3RhcnQlMjAlM0ElMjBlbmQlMjAlMkIlMjAxJTVEKSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFLayoutLMForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;impira/layoutlm-document-qa&quot;</span>, add_prefix_space=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFLayoutLMForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;impira/layoutlm-document-qa&quot;</span>, revision=<span class="hljs-string">&quot;1e3ebac&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;nielsr/funsd&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>example = dataset[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>question = <span class="hljs-string">&quot;what&#x27;s his name?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>words = example[<span class="hljs-string">&quot;words&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes = example[<span class="hljs-string">&quot;bboxes&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(
<span class="hljs-meta">... </span>    question.split(), words, is_split_into_words=<span class="hljs-literal">True</span>, return_token_type_ids=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>bbox = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> i, s, w <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(encoding.input_ids[<span class="hljs-number">0</span>], encoding.sequence_ids(<span class="hljs-number">0</span>), encoding.word_ids(<span class="hljs-number">0</span>)):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> s == <span class="hljs-number">1</span>:
<span class="hljs-meta">... </span>        bbox.append(boxes[w])
<span class="hljs-meta">... </span>    <span class="hljs-keyword">elif</span> i == tokenizer.sep_token_id:
<span class="hljs-meta">... </span>        bbox.append([<span class="hljs-number">1000</span>] * <span class="hljs-number">4</span>)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">else</span>:
<span class="hljs-meta">... </span>        bbox.append([<span class="hljs-number">0</span>] * <span class="hljs-number">4</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding[<span class="hljs-string">&quot;bbox&quot;</span>] = tf.convert_to_tensor([bbox])

<span class="hljs-meta">&gt;&gt;&gt; </span>word_ids = encoding.word_ids(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>start_scores = outputs.start_logits
<span class="hljs-meta">&gt;&gt;&gt; </span>end_scores = outputs.end_logits
<span class="hljs-meta">&gt;&gt;&gt; </span>start, end = word_ids[tf.math.argmax(start_scores, -<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>]], word_ids[tf.math.argmax(end_scores, -<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot; &quot;</span>.join(words[start : end + <span class="hljs-number">1</span>]))
M. Hamann P. Harper, P. Martinez`,wrap:!1}}),{c(){e=c("p"),e.textContent=g,n=r(),_(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),n=l(t),b(a.$$.fragment,t)},m(t,y){d(t,e,y),d(t,n,y),T(a,t,y),M=!0},p:D,i(t){M||(w(a.$$.fragment,t),M=!0)},o(t){k(a.$$.fragment,t),M=!1},d(t){t&&(o(e),o(n)),L(a,t)}}}function us(U){let e,g,n,a,M,t,y="The bare LayoutLM Model transformer outputting raw hidden-states without any specific head on top.",E,F,x=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,V,z,$=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,W,u,J,se,Je,Gt,de,Ot='The <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.TFLayoutLMModel">TFLayoutLMModel</a> forward method, overrides the <code>__call__</code> special method.',De,be,he,oe,Xt,Ce,rt,Y,fe,nn,lt,ce="LayoutLM Model with a <code>language modeling</code> head on top.",Ye,qe,wt=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,kt,Ft,Pe=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,it,ge,Oe,pe,Ae,X,$e,Lt='The <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.TFLayoutLMForMaskedLM">TFLayoutLMForMaskedLM</a> forward method, overrides the <code>__call__</code> special method.',It,Ke,dt,ke,ct,jt,et,B,vt,Te,ye,sn=`LayoutLM Model transformer with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.`,pt,Be,on=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Ge,Ne,Ut=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,qt,ae,Nt,I,me,St,Le,cn='The <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.TFLayoutLMForSequenceClassification">TFLayoutLMForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',Dt,Me,an,tt,je,mt,nt,q,N,ut,Ee,Et=`LayoutLM Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
Named-Entity-Recognition (NER) tasks.`,Kt,xe,Rt=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,ht,ft,we=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,st,G,Re,ze,Ze,Zt,Vt,Wt='The <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.TFLayoutLMForTokenClassification">TFLayoutLMForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',gt,ve,Jt,Ve,Yt,P,K,H,We,Qt,Ht,At=`LayoutLM Model with a span classification head on top for extractive question-answering tasks such as
<a href="https://rrc.cvc.uab.es/?ch=17" rel="nofollow">DocVQA</a> (a linear layer on top of the final hidden-states output to compute <code>span start logits</code> and <code>span end logits</code>).`,yt,Ct,ot=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,rn,$t,Ue=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,at,h,C,S,re,ue,ee,Q='The <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.TFLayoutLMForQuestionAnswering">TFLayoutLMForQuestionAnswering</a> forward method, overrides the <code>__call__</code> special method.',te,le,ie,ne,pn;return e=new Se({props:{title:"TFLayoutLMModel",local:"transformers.TFLayoutLMModel",headingTag:"h2"}}),a=new A({props:{name:"class transformers.TFLayoutLMModel",anchor:"transformers.TFLayoutLMModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig">LayoutLMConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L912"}}),u=new zt({props:{$$slots:{default:[On]},$$scope:{ctx:U}}}),Je=new A({props:{name:"call",anchor:"transformers.TFLayoutLMModel.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"bbox",val:": np.ndarray | tf.Tensor | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"encoder_hidden_states",val:": np.ndarray | tf.Tensor | None = None"},{name:"encoder_attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFLayoutLMModel.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMModel.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMModel.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMModel.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMModel.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TFLayoutLMModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L918",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig"
>LayoutLMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) further processed by a
Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
prediction (classification) objective during pretraining.</p>
<p>This output is usually <em>not</em> a good summary of the semantic content of the input, you’re often better with
averaging or pooling the sequence of hidden-states for the whole input sequence.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>List[tf.Tensor]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — List of <code>tf.Tensor</code> of length <code>config.n_layers</code>, with each tensor of shape <code>(2, batch_size, num_heads, sequence_length, embed_size_per_head)</code>).</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder’s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions</a> or <code>tuple(tf.Tensor)</code></p>
`}}),be=new zt({props:{$$slots:{default:[Kn]},$$scope:{ctx:U}}}),oe=new Bt({props:{anchor:"transformers.TFLayoutLMModel.call.example",$$slots:{default:[es]},$$scope:{ctx:U}}}),Ce=new Se({props:{title:"TFLayoutLMForMaskedLM",local:"transformers.TFLayoutLMForMaskedLM",headingTag:"h2"}}),fe=new A({props:{name:"class transformers.TFLayoutLMForMaskedLM",anchor:"transformers.TFLayoutLMForMaskedLM",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig">LayoutLMConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L991"}}),ge=new zt({props:{$$slots:{default:[ts]},$$scope:{ctx:U}}}),Ae=new A({props:{name:"call",anchor:"transformers.TFLayoutLMForMaskedLM.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"bbox",val:": np.ndarray | tf.Tensor | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFLayoutLMForMaskedLM.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> or <code>np.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked), the
loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1019",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFMaskedLMOutput"
>transformers.modeling_tf_outputs.TFMaskedLMOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig"
>LayoutLMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(n,)</code>, <em>optional</em>, where n is the number of non-masked labels, returned when <code>labels</code> is provided) — Masked language modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFMaskedLMOutput"
>transformers.modeling_tf_outputs.TFMaskedLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Ke=new zt({props:{$$slots:{default:[ns]},$$scope:{ctx:U}}}),ke=new Bt({props:{anchor:"transformers.TFLayoutLMForMaskedLM.call.example",$$slots:{default:[ss]},$$scope:{ctx:U}}}),jt=new Se({props:{title:"TFLayoutLMForSequenceClassification",local:"transformers.TFLayoutLMForSequenceClassification",headingTag:"h2"}}),vt=new A({props:{name:"class transformers.TFLayoutLMForSequenceClassification",anchor:"transformers.TFLayoutLMForSequenceClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig">LayoutLMConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1118"}}),ae=new zt({props:{$$slots:{default:[os]},$$scope:{ctx:U}}}),me=new A({props:{name:"call",anchor:"transformers.TFLayoutLMForSequenceClassification.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"bbox",val:": np.ndarray | tf.Tensor | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFLayoutLMForSequenceClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> or <code>np.ndarray</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1136",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig"
>LayoutLMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.num_labels)</code>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Me=new zt({props:{$$slots:{default:[as]},$$scope:{ctx:U}}}),tt=new Bt({props:{anchor:"transformers.TFLayoutLMForSequenceClassification.call.example",$$slots:{default:[rs]},$$scope:{ctx:U}}}),mt=new Se({props:{title:"TFLayoutLMForTokenClassification",local:"transformers.TFLayoutLMForTokenClassification",headingTag:"h2"}}),N=new A({props:{name:"class transformers.TFLayoutLMForTokenClassification",anchor:"transformers.TFLayoutLMForTokenClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig">LayoutLMConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1236"}}),G=new zt({props:{$$slots:{default:[ls]},$$scope:{ctx:U}}}),Ze=new A({props:{name:"call",anchor:"transformers.TFLayoutLMForTokenClassification.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"bbox",val:": np.ndarray | tf.Tensor | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFLayoutLMForTokenClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> or <code>np.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1260",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFTokenClassifierOutput"
>transformers.modeling_tf_outputs.TFTokenClassifierOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig"
>LayoutLMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(n,)</code>, <em>optional</em>, where n is the number of unmasked labels, returned when <code>labels</code> is provided)  — Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) — Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFTokenClassifierOutput"
>transformers.modeling_tf_outputs.TFTokenClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),ve=new zt({props:{$$slots:{default:[is]},$$scope:{ctx:U}}}),Ve=new Bt({props:{anchor:"transformers.TFLayoutLMForTokenClassification.call.example",$$slots:{default:[ds]},$$scope:{ctx:U}}}),P=new Se({props:{title:"TFLayoutLMForQuestionAnswering",local:"transformers.TFLayoutLMForQuestionAnswering",headingTag:"h2"}}),We=new A({props:{name:"class transformers.TFLayoutLMForQuestionAnswering",anchor:"transformers.TFLayoutLMForQuestionAnswering",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig">LayoutLMConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1359"}}),h=new zt({props:{$$slots:{default:[cs]},$$scope:{ctx:U}}}),re=new A({props:{name:"call",anchor:"transformers.TFLayoutLMForQuestionAnswering.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"bbox",val:": np.ndarray | tf.Tensor | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"start_positions",val:": np.ndarray | tf.Tensor | None = None"},{name:"end_positions",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.start_positions",description:`<strong>start_positions</strong> (<code>tf.Tensor</code> or <code>np.ndarray</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.end_positions",description:`<strong>end_positions</strong> (<code>tf.Tensor</code> or <code>np.ndarray</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1380",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput"
>transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMConfig"
>LayoutLMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>, returned when <code>start_positions</code> and <code>end_positions</code> are provided) — Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput"
>transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),le=new zt({props:{$$slots:{default:[ps]},$$scope:{ctx:U}}}),ne=new Bt({props:{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.example",$$slots:{default:[ms]},$$scope:{ctx:U}}}),{c(){_(e.$$.fragment),g=r(),n=c("div"),_(a.$$.fragment),M=r(),t=c("p"),t.textContent=y,E=r(),F=c("p"),F.innerHTML=x,V=r(),z=c("p"),z.innerHTML=$,W=r(),_(u.$$.fragment),J=r(),se=c("div"),_(Je.$$.fragment),Gt=r(),de=c("p"),de.innerHTML=Ot,De=r(),_(be.$$.fragment),he=r(),_(oe.$$.fragment),Xt=r(),_(Ce.$$.fragment),rt=r(),Y=c("div"),_(fe.$$.fragment),nn=r(),lt=c("p"),lt.innerHTML=ce,Ye=r(),qe=c("p"),qe.innerHTML=wt,kt=r(),Ft=c("p"),Ft.innerHTML=Pe,it=r(),_(ge.$$.fragment),Oe=r(),pe=c("div"),_(Ae.$$.fragment),X=r(),$e=c("p"),$e.innerHTML=Lt,It=r(),_(Ke.$$.fragment),dt=r(),_(ke.$$.fragment),ct=r(),_(jt.$$.fragment),et=r(),B=c("div"),_(vt.$$.fragment),Te=r(),ye=c("p"),ye.textContent=sn,pt=r(),Be=c("p"),Be.innerHTML=on,Ge=r(),Ne=c("p"),Ne.innerHTML=Ut,qt=r(),_(ae.$$.fragment),Nt=r(),I=c("div"),_(me.$$.fragment),St=r(),Le=c("p"),Le.innerHTML=cn,Dt=r(),_(Me.$$.fragment),an=r(),_(tt.$$.fragment),je=r(),_(mt.$$.fragment),nt=r(),q=c("div"),_(N.$$.fragment),ut=r(),Ee=c("p"),Ee.textContent=Et,Kt=r(),xe=c("p"),xe.innerHTML=Rt,ht=r(),ft=c("p"),ft.innerHTML=we,st=r(),_(G.$$.fragment),Re=r(),ze=c("div"),_(Ze.$$.fragment),Zt=r(),Vt=c("p"),Vt.innerHTML=Wt,gt=r(),_(ve.$$.fragment),Jt=r(),_(Ve.$$.fragment),Yt=r(),_(P.$$.fragment),K=r(),H=c("div"),_(We.$$.fragment),Qt=r(),Ht=c("p"),Ht.innerHTML=At,yt=r(),Ct=c("p"),Ct.innerHTML=ot,rn=r(),$t=c("p"),$t.innerHTML=Ue,at=r(),_(h.$$.fragment),C=r(),S=c("div"),_(re.$$.fragment),ue=r(),ee=c("p"),ee.innerHTML=Q,te=r(),_(le.$$.fragment),ie=r(),_(ne.$$.fragment),this.h()},l(m){b(e.$$.fragment,m),g=l(m),n=p(m,"DIV",{class:!0});var v=R(n);b(a.$$.fragment,v),M=l(v),t=p(v,"P",{"data-svelte-h":!0}),f(t)!=="svelte-1491dki"&&(t.textContent=y),E=l(v),F=p(v,"P",{"data-svelte-h":!0}),f(F)!=="svelte-1qaxm70"&&(F.innerHTML=x),V=l(v),z=p(v,"P",{"data-svelte-h":!0}),f(z)!=="svelte-1ivrf8m"&&(z.innerHTML=$),W=l(v),b(u.$$.fragment,v),J=l(v),se=p(v,"DIV",{class:!0});var Mt=R(se);b(Je.$$.fragment,Mt),Gt=l(Mt),de=p(Mt,"P",{"data-svelte-h":!0}),f(de)!=="svelte-1t2vxks"&&(de.innerHTML=Ot),De=l(Mt),b(be.$$.fragment,Mt),he=l(Mt),b(oe.$$.fragment,Mt),Mt.forEach(o),v.forEach(o),Xt=l(m),b(Ce.$$.fragment,m),rt=l(m),Y=p(m,"DIV",{class:!0});var O=R(Y);b(fe.$$.fragment,O),nn=l(O),lt=p(O,"P",{"data-svelte-h":!0}),f(lt)!=="svelte-jd1dcp"&&(lt.innerHTML=ce),Ye=l(O),qe=p(O,"P",{"data-svelte-h":!0}),f(qe)!=="svelte-1qaxm70"&&(qe.innerHTML=wt),kt=l(O),Ft=p(O,"P",{"data-svelte-h":!0}),f(Ft)!=="svelte-1ivrf8m"&&(Ft.innerHTML=Pe),it=l(O),b(ge.$$.fragment,O),Oe=l(O),pe=p(O,"DIV",{class:!0});var Fe=R(pe);b(Ae.$$.fragment,Fe),X=l(Fe),$e=p(Fe,"P",{"data-svelte-h":!0}),f($e)!=="svelte-i69w7w"&&($e.innerHTML=Lt),It=l(Fe),b(Ke.$$.fragment,Fe),dt=l(Fe),b(ke.$$.fragment,Fe),Fe.forEach(o),O.forEach(o),ct=l(m),b(jt.$$.fragment,m),et=l(m),B=p(m,"DIV",{class:!0});var Ie=R(B);b(vt.$$.fragment,Ie),Te=l(Ie),ye=p(Ie,"P",{"data-svelte-h":!0}),f(ye)!=="svelte-1wflwnx"&&(ye.textContent=sn),pt=l(Ie),Be=p(Ie,"P",{"data-svelte-h":!0}),f(Be)!=="svelte-1qaxm70"&&(Be.innerHTML=on),Ge=l(Ie),Ne=p(Ie,"P",{"data-svelte-h":!0}),f(Ne)!=="svelte-1ivrf8m"&&(Ne.innerHTML=Ut),qt=l(Ie),b(ae.$$.fragment,Ie),Nt=l(Ie),I=p(Ie,"DIV",{class:!0});var Qe=R(I);b(me.$$.fragment,Qe),St=l(Qe),Le=p(Qe,"P",{"data-svelte-h":!0}),f(Le)!=="svelte-1f1oeq8"&&(Le.innerHTML=cn),Dt=l(Qe),b(Me.$$.fragment,Qe),an=l(Qe),b(tt.$$.fragment,Qe),Qe.forEach(o),Ie.forEach(o),je=l(m),b(mt.$$.fragment,m),nt=l(m),q=p(m,"DIV",{class:!0});var He=R(q);b(N.$$.fragment,He),ut=l(He),Ee=p(He,"P",{"data-svelte-h":!0}),f(Ee)!=="svelte-1s4zjay"&&(Ee.textContent=Et),Kt=l(He),xe=p(He,"P",{"data-svelte-h":!0}),f(xe)!=="svelte-1qaxm70"&&(xe.innerHTML=Rt),ht=l(He),ft=p(He,"P",{"data-svelte-h":!0}),f(ft)!=="svelte-1ivrf8m"&&(ft.innerHTML=we),st=l(He),b(G.$$.fragment,He),Re=l(He),ze=p(He,"DIV",{class:!0});var _t=R(ze);b(Ze.$$.fragment,_t),Zt=l(_t),Vt=p(_t,"P",{"data-svelte-h":!0}),f(Vt)!=="svelte-1tctbyi"&&(Vt.innerHTML=Wt),gt=l(_t),b(ve.$$.fragment,_t),Jt=l(_t),b(Ve.$$.fragment,_t),_t.forEach(o),He.forEach(o),Yt=l(m),b(P.$$.fragment,m),K=l(m),H=p(m,"DIV",{class:!0});var _e=R(H);b(We.$$.fragment,_e),Qt=l(_e),Ht=p(_e,"P",{"data-svelte-h":!0}),f(Ht)!=="svelte-1uah9q8"&&(Ht.innerHTML=At),yt=l(_e),Ct=p(_e,"P",{"data-svelte-h":!0}),f(Ct)!=="svelte-1qaxm70"&&(Ct.innerHTML=ot),rn=l(_e),$t=p(_e,"P",{"data-svelte-h":!0}),f($t)!=="svelte-1ivrf8m"&&($t.innerHTML=Ue),at=l(_e),b(h.$$.fragment,_e),C=l(_e),S=p(_e,"DIV",{class:!0});var xt=R(S);b(re.$$.fragment,xt),ue=l(xt),ee=p(xt,"P",{"data-svelte-h":!0}),f(ee)!=="svelte-w107wo"&&(ee.innerHTML=Q),te=l(xt),b(le.$$.fragment,xt),ie=l(xt),b(ne.$$.fragment,xt),xt.forEach(o),_e.forEach(o),this.h()},h(){Z(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(n,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(m,v){T(e,m,v),d(m,g,v),d(m,n,v),T(a,n,null),i(n,M),i(n,t),i(n,E),i(n,F),i(n,V),i(n,z),i(n,W),T(u,n,null),i(n,J),i(n,se),T(Je,se,null),i(se,Gt),i(se,de),i(se,De),T(be,se,null),i(se,he),T(oe,se,null),d(m,Xt,v),T(Ce,m,v),d(m,rt,v),d(m,Y,v),T(fe,Y,null),i(Y,nn),i(Y,lt),i(Y,Ye),i(Y,qe),i(Y,kt),i(Y,Ft),i(Y,it),T(ge,Y,null),i(Y,Oe),i(Y,pe),T(Ae,pe,null),i(pe,X),i(pe,$e),i(pe,It),T(Ke,pe,null),i(pe,dt),T(ke,pe,null),d(m,ct,v),T(jt,m,v),d(m,et,v),d(m,B,v),T(vt,B,null),i(B,Te),i(B,ye),i(B,pt),i(B,Be),i(B,Ge),i(B,Ne),i(B,qt),T(ae,B,null),i(B,Nt),i(B,I),T(me,I,null),i(I,St),i(I,Le),i(I,Dt),T(Me,I,null),i(I,an),T(tt,I,null),d(m,je,v),T(mt,m,v),d(m,nt,v),d(m,q,v),T(N,q,null),i(q,ut),i(q,Ee),i(q,Kt),i(q,xe),i(q,ht),i(q,ft),i(q,st),T(G,q,null),i(q,Re),i(q,ze),T(Ze,ze,null),i(ze,Zt),i(ze,Vt),i(ze,gt),T(ve,ze,null),i(ze,Jt),T(Ve,ze,null),d(m,Yt,v),T(P,m,v),d(m,K,v),d(m,H,v),T(We,H,null),i(H,Qt),i(H,Ht),i(H,yt),i(H,Ct),i(H,rn),i(H,$t),i(H,at),T(h,H,null),i(H,C),i(H,S),T(re,S,null),i(S,ue),i(S,ee),i(S,te),T(le,S,null),i(S,ie),T(ne,S,null),pn=!0},p(m,v){const Mt={};v&2&&(Mt.$$scope={dirty:v,ctx:m}),u.$set(Mt);const O={};v&2&&(O.$$scope={dirty:v,ctx:m}),be.$set(O);const Fe={};v&2&&(Fe.$$scope={dirty:v,ctx:m}),oe.$set(Fe);const Ie={};v&2&&(Ie.$$scope={dirty:v,ctx:m}),ge.$set(Ie);const Qe={};v&2&&(Qe.$$scope={dirty:v,ctx:m}),Ke.$set(Qe);const He={};v&2&&(He.$$scope={dirty:v,ctx:m}),ke.$set(He);const _t={};v&2&&(_t.$$scope={dirty:v,ctx:m}),ae.$set(_t);const _e={};v&2&&(_e.$$scope={dirty:v,ctx:m}),Me.$set(_e);const xt={};v&2&&(xt.$$scope={dirty:v,ctx:m}),tt.$set(xt);const yn={};v&2&&(yn.$$scope={dirty:v,ctx:m}),G.$set(yn);const bt={};v&2&&(bt.$$scope={dirty:v,ctx:m}),ve.$set(bt);const en={};v&2&&(en.$$scope={dirty:v,ctx:m}),Ve.$set(en);const Mn={};v&2&&(Mn.$$scope={dirty:v,ctx:m}),h.$set(Mn);const ln={};v&2&&(ln.$$scope={dirty:v,ctx:m}),le.$set(ln);const Tn={};v&2&&(Tn.$$scope={dirty:v,ctx:m}),ne.$set(Tn)},i(m){pn||(w(e.$$.fragment,m),w(a.$$.fragment,m),w(u.$$.fragment,m),w(Je.$$.fragment,m),w(be.$$.fragment,m),w(oe.$$.fragment,m),w(Ce.$$.fragment,m),w(fe.$$.fragment,m),w(ge.$$.fragment,m),w(Ae.$$.fragment,m),w(Ke.$$.fragment,m),w(ke.$$.fragment,m),w(jt.$$.fragment,m),w(vt.$$.fragment,m),w(ae.$$.fragment,m),w(me.$$.fragment,m),w(Me.$$.fragment,m),w(tt.$$.fragment,m),w(mt.$$.fragment,m),w(N.$$.fragment,m),w(G.$$.fragment,m),w(Ze.$$.fragment,m),w(ve.$$.fragment,m),w(Ve.$$.fragment,m),w(P.$$.fragment,m),w(We.$$.fragment,m),w(h.$$.fragment,m),w(re.$$.fragment,m),w(le.$$.fragment,m),w(ne.$$.fragment,m),pn=!0)},o(m){k(e.$$.fragment,m),k(a.$$.fragment,m),k(u.$$.fragment,m),k(Je.$$.fragment,m),k(be.$$.fragment,m),k(oe.$$.fragment,m),k(Ce.$$.fragment,m),k(fe.$$.fragment,m),k(ge.$$.fragment,m),k(Ae.$$.fragment,m),k(Ke.$$.fragment,m),k(ke.$$.fragment,m),k(jt.$$.fragment,m),k(vt.$$.fragment,m),k(ae.$$.fragment,m),k(me.$$.fragment,m),k(Me.$$.fragment,m),k(tt.$$.fragment,m),k(mt.$$.fragment,m),k(N.$$.fragment,m),k(G.$$.fragment,m),k(Ze.$$.fragment,m),k(ve.$$.fragment,m),k(Ve.$$.fragment,m),k(P.$$.fragment,m),k(We.$$.fragment,m),k(h.$$.fragment,m),k(re.$$.fragment,m),k(le.$$.fragment,m),k(ne.$$.fragment,m),pn=!1},d(m){m&&(o(g),o(n),o(Xt),o(rt),o(Y),o(ct),o(et),o(B),o(je),o(nt),o(q),o(Yt),o(K),o(H)),L(e,m),L(a),L(u),L(Je),L(be),L(oe),L(Ce,m),L(fe),L(ge),L(Ae),L(Ke),L(ke),L(jt,m),L(vt),L(ae),L(me),L(Me),L(tt),L(mt,m),L(N),L(G),L(Ze),L(ve),L(Ve),L(P,m),L(We),L(h),L(re),L(le),L(ne)}}}function hs(U){let e,g;return e=new xn({props:{$$slots:{default:[us]},$$scope:{ctx:U}}}),{c(){_(e.$$.fragment)},l(n){b(e.$$.fragment,n)},m(n,a){T(e,n,a),g=!0},p(n,a){const M={};a&2&&(M.$$scope={dirty:a,ctx:n}),e.$set(M)},i(n){g||(w(e.$$.fragment,n),g=!0)},o(n){k(e.$$.fragment,n),g=!1},d(n){L(e,n)}}}function fs(U){let e,g,n,a,M,t,y,E,F,x,V,z=`The LayoutLM model was proposed in the paper <a href="https://arxiv.org/abs/1912.13318" rel="nofollow">LayoutLM: Pre-training of Text and Layout for Document Image
Understanding</a> by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, and
Ming Zhou. It’s a simple but effective pretraining method of text and layout for document image understanding and
information extraction tasks, such as form understanding and receipt understanding. It obtains state-of-the-art results
on several downstream tasks:`,$,W,u=`<li>form understanding: the <a href="https://guillaumejaume.github.io/FUNSD/" rel="nofollow">FUNSD</a> dataset (a collection of 199 annotated
forms comprising more than 30,000 words).</li> <li>receipt understanding: the <a href="https://rrc.cvc.uab.es/?ch=13" rel="nofollow">SROIE</a> dataset (a collection of 626 receipts for
training and 347 receipts for testing).</li> <li>document image classification: the <a href="https://www.cs.cmu.edu/~aharley/rvl-cdip/" rel="nofollow">RVL-CDIP</a> dataset (a collection of
400,000 images belonging to one of 16 classes).</li>`,J,se,Je="The abstract from the paper is the following:",Gt,de,Ot=`<em>Pre-training techniques have been verified successfully in a variety of NLP tasks in recent years. Despite the
widespread use of pretraining models for NLP applications, they almost exclusively focus on text-level manipulation,
while neglecting layout and style information that is vital for document image understanding. In this paper, we propose
the LayoutLM to jointly model interactions between text and layout information across scanned document images, which is
beneficial for a great number of real-world document image understanding tasks such as information extraction from
scanned documents. Furthermore, we also leverage image features to incorporate words’ visual information into LayoutLM.
To the best of our knowledge, this is the first time that text and layout are jointly learned in a single framework for
document-level pretraining. It achieves new state-of-the-art results in several downstream tasks, including form
understanding (from 70.72 to 79.27), receipt understanding (from 94.02 to 95.24) and document image classification
(from 93.07 to 94.42).</em>`,De,be,he,oe,Xt=`<li>In addition to <em>input_ids</em>, <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMModel.forward">forward()</a> also expects the input <code>bbox</code>, which are
the bounding boxes (i.e. 2D-positions) of the input tokens. These can be obtained using an external OCR engine such
as Google’s <a href="https://github.com/tesseract-ocr/tesseract" rel="nofollow">Tesseract</a> (there’s a <a href="https://pypi.org/project/pytesseract/" rel="nofollow">Python wrapper</a> available). Each bounding box should be in (x0, y0, x1, y1) format, where
(x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1, y1) represents the
position of the lower right corner. Note that one first needs to normalize the bounding boxes to be on a 0-1000
scale. To normalize, you can use the following function:</li>`,Ce,rt,Y,fe,nn=`Here, <code>width</code> and <code>height</code> correspond to the width and height of the original document in which the token
occurs. Those can be obtained using the Python Image Library (PIL) library for example, as follows:`,lt,ce,Ye,qe,wt,kt,Ft="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with LayoutLM. If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",Pe,it,ge,Oe,pe=`<li><p>A blog post on <a href="https://www.philschmid.de/fine-tuning-layoutlm-keras" rel="nofollow">fine-tuning
LayoutLM for document-understanding using Keras &amp; Hugging Face
Transformers</a>.</p></li> <li><p>A blog post on how to <a href="https://www.philschmid.de/fine-tuning-layoutlm" rel="nofollow">fine-tune LayoutLM for document-understanding using only Hugging Face Transformers</a>.</p></li> <li><p>A notebook on how to <a href="https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Add_image_embeddings_to_LayoutLM.ipynb" rel="nofollow">fine-tune LayoutLM on the FUNSD dataset with image embeddings</a>.</p></li> <li><p>See also: <a href="../tasks/document_question_answering">Document question answering task guide</a></p></li>`,Ae,X,$e,Lt,It='<li>A notebook on how to <a href="https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForSequenceClassification_on_RVL_CDIP.ipynb" rel="nofollow">fine-tune LayoutLM for sequence classification on the RVL-CDIP dataset</a>.</li> <li><a href="../tasks/sequence_classification">Text classification task guide</a></li>',Ke,dt,ke,ct,jt='<li>A notebook on how to <a href="https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForTokenClassification_on_FUNSD.ipynb" rel="nofollow">fine-tune LayoutLM for token classification on the FUNSD dataset</a>.</li> <li><a href="../tasks/token_classification">Token classification task guide</a></li>',et,B,vt="<strong>Other resources</strong>",Te,ye,sn='<li><a href="../tasks/masked_language_modeling">Masked language modeling task guide</a></li>',pt,Be,on="🚀 Deploy",Ge,Ne,Ut='<li>A blog post on how to <a href="https://www.philschmid.de/inference-endpoints-layoutlm" rel="nofollow">Deploy LayoutLM with Hugging Face Inference Endpoints</a>.</li>',qt,ae,Nt,I,me,St,Le,cn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMModel">LayoutLMModel</a>. It is used to instantiate a
LayoutLM model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the LayoutLM
<a href="https://huggingface.co/microsoft/layoutlm-base-uncased" rel="nofollow">microsoft/layoutlm-base-uncased</a> architecture.`,Dt,Me,an=`Configuration objects inherit from <a href="/docs/transformers/main/en/model_doc/bert#transformers.BertConfig">BertConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/model_doc/bert#transformers.BertConfig">BertConfig</a> for more information.`,tt,je,mt,nt,q,N,ut,Ee,Et,Kt="Construct a LayoutLM tokenizer. Based on WordPiece.",xe,Rt,ht=`This tokenizer inherits from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a> which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`,ft,we,st,G,Re,ze=`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A LayoutLM sequence has the following format:`,Ze,Zt,Vt="<li>single sequence: <code>[CLS] X [SEP]</code></li> <li>pair of sequences: <code>[CLS] A [SEP] B [SEP]</code></li>",Wt,gt,ve,Jt,Ve,Yt="Converts a sequence of tokens (string) in a single string.",P,K,H,We,Qt,Ht="Create a mask from the two sequences passed to be used in a sequence-pair classification task. A LayoutLM",At,yt,Ct,ot,rn="If <code>token_ids_1</code> is <code>None</code>, this method only returns the first portion of the mask (0s).",$t,Ue,at,h,C,S=`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer <code>prepare_for_model</code> method.`,re,ue,ee,Q,te,le,ie,ne="Construct a “fast” LayoutLM tokenizer (backed by HuggingFace’s <em>tokenizers</em> library). Based on WordPiece.",pn,m,v=`This tokenizer inherits from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a> which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`,Mt,O,Fe,Ie,Qe,He=`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A LayoutLM sequence has the following format:`,_t,_e,xt="<li>single sequence: <code>[CLS] X [SEP]</code></li> <li>pair of sequences: <code>[CLS] A [SEP] B [SEP]</code></li>",yn,bt,en,Mn,ln,Tn="Create a mask from the two sequences passed to be used in a sequence-pair classification task. A LayoutLM",Un,mn,Jn,_n,$n="If <code>token_ids_1</code> is <code>None</code>, this method only returns the first portion of the mask (0s).",kn,un,Ln,wn,jn;return M=new Se({props:{title:"LayoutLM",local:"layoutlm",headingTag:"h1"}}),F=new Se({props:{title:"Overview",local:"overview",headingTag:"h2"}}),be=new Se({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),rt=new Tt({props:{code:"ZGVmJTIwbm9ybWFsaXplX2Jib3goYmJveCUyQyUyMHdpZHRoJTJDJTIwaGVpZ2h0KSUzQSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGludCgxMDAwJTIwKiUyMChiYm94JTVCMCU1RCUyMCUyRiUyMHdpZHRoKSklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpbnQoMTAwMCUyMColMjAoYmJveCU1QjElNUQlMjAlMkYlMjBoZWlnaHQpKSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGludCgxMDAwJTIwKiUyMChiYm94JTVCMiU1RCUyMCUyRiUyMHdpZHRoKSklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpbnQoMTAwMCUyMColMjAoYmJveCU1QjMlNUQlMjAlMkYlMjBoZWlnaHQpKSUyQyUwQSUyMCUyMCUyMCUyMCU1RA==",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">normalize_bbox</span>(<span class="hljs-params">bbox, width, height</span>):
    <span class="hljs-keyword">return</span> [
        <span class="hljs-built_in">int</span>(<span class="hljs-number">1000</span> * (bbox[<span class="hljs-number">0</span>] / width)),
        <span class="hljs-built_in">int</span>(<span class="hljs-number">1000</span> * (bbox[<span class="hljs-number">1</span>] / height)),
        <span class="hljs-built_in">int</span>(<span class="hljs-number">1000</span> * (bbox[<span class="hljs-number">2</span>] / width)),
        <span class="hljs-built_in">int</span>(<span class="hljs-number">1000</span> * (bbox[<span class="hljs-number">3</span>] / height)),
    ]`,wrap:!1}}),ce=new Tt({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBJTBBJTIzJTIwRG9jdW1lbnQlMjBjYW4lMjBiZSUyMGElMjBwbmclMkMlMjBqcGclMkMlMjBldGMuJTIwUERGcyUyMG11c3QlMjBiZSUyMGNvbnZlcnRlZCUyMHRvJTIwaW1hZ2VzLiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihuYW1lX29mX3lvdXJfZG9jdW1lbnQpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQSUwQXdpZHRoJTJDJTIwaGVpZ2h0JTIwJTNEJTIwaW1hZ2Uuc2l6ZQ==",highlighted:`<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

<span class="hljs-comment"># Document can be a png, jpg, etc. PDFs must be converted to images.</span>
image = Image.<span class="hljs-built_in">open</span>(name_of_your_document).convert(<span class="hljs-string">&quot;RGB&quot;</span>)

width, height = image.size`,wrap:!1}}),qe=new Se({props:{title:"Resources",local:"resources",headingTag:"h2"}}),it=new Cn({props:{pipeline:"document-question-answering"}}),X=new Cn({props:{pipeline:"text-classification"}}),dt=new Cn({props:{pipeline:"token-classification"}}),ae=new Se({props:{title:"LayoutLMConfig",local:"transformers.LayoutLMConfig",headingTag:"h2"}}),me=new A({props:{name:"class transformers.LayoutLMConfig",anchor:"transformers.LayoutLMConfig",parameters:[{name:"vocab_size",val:" = 30522"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"max_position_embeddings",val:" = 512"},{name:"type_vocab_size",val:" = 2"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"pad_token_id",val:" = 0"},{name:"position_embedding_type",val:" = 'absolute'"},{name:"use_cache",val:" = True"},{name:"max_2d_position_embeddings",val:" = 1024"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the LayoutLM model. Defines the different tokens that can be represented by the
<em>inputs_ids</em> passed to the forward method of <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMModel">LayoutLMModel</a>.`,name:"vocab_size"},{anchor:"transformers.LayoutLMConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.LayoutLMConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.LayoutLMConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.LayoutLMConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.LayoutLMConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.LayoutLMConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.LayoutLMConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.LayoutLMConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.LayoutLMConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed into <a href="/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMModel">LayoutLMModel</a>.`,name:"type_vocab_size"},{anchor:"transformers.LayoutLMConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.LayoutLMConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.LayoutLMConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The value used to pad input_ids.`,name:"pad_token_id"},{anchor:"transformers.LayoutLMConfig.position_embedding_type",description:`<strong>position_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;absolute&quot;</code>) &#x2014;
Type of position embedding. Choose one of <code>&quot;absolute&quot;</code>, <code>&quot;relative_key&quot;</code>, <code>&quot;relative_key_query&quot;</code>. For
positional embeddings use <code>&quot;absolute&quot;</code>. For more information on <code>&quot;relative_key&quot;</code>, please refer to
<a href="https://arxiv.org/abs/1803.02155" rel="nofollow">Self-Attention with Relative Position Representations (Shaw et al.)</a>.
For more information on <code>&quot;relative_key_query&quot;</code>, please refer to <em>Method 4</em> in <a href="https://arxiv.org/abs/2009.13658" rel="nofollow">Improve Transformer Models
with Better Relative Position Embeddings (Huang et al.)</a>.`,name:"position_embedding_type"},{anchor:"transformers.LayoutLMConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if <code>config.is_decoder=True</code>.`,name:"use_cache"},{anchor:"transformers.LayoutLMConfig.max_2d_position_embeddings",description:`<strong>max_2d_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
The maximum value that the 2D position embedding might ever used. Typically set this to something large
just in case (e.g., 1024).`,name:"max_2d_position_embeddings"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/configuration_layoutlm.py#L36"}}),je=new Bt({props:{anchor:"transformers.LayoutLMConfig.example",$$slots:{default:[Zn]},$$scope:{ctx:U}}}),nt=new Se({props:{title:"LayoutLMTokenizer",local:"transformers.LayoutLMTokenizer",headingTag:"h2"}}),ut=new A({props:{name:"class transformers.LayoutLMTokenizer",anchor:"transformers.LayoutLMTokenizer",parameters:[{name:"vocab_file",val:""},{name:"do_lower_case",val:" = True"},{name:"do_basic_tokenize",val:" = True"},{name:"never_split",val:" = None"},{name:"unk_token",val:" = '[UNK]'"},{name:"sep_token",val:" = '[SEP]'"},{name:"pad_token",val:" = '[PAD]'"},{name:"cls_token",val:" = '[CLS]'"},{name:"mask_token",val:" = '[MASK]'"},{name:"tokenize_chinese_chars",val:" = True"},{name:"strip_accents",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
File containing the vocabulary.`,name:"vocab_file"},{anchor:"transformers.LayoutLMTokenizer.do_lower_case",description:`<strong>do_lower_case</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to lowercase the input when tokenizing.`,name:"do_lower_case"},{anchor:"transformers.LayoutLMTokenizer.do_basic_tokenize",description:`<strong>do_basic_tokenize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to do basic tokenization before WordPiece.`,name:"do_basic_tokenize"},{anchor:"transformers.LayoutLMTokenizer.never_split",description:`<strong>never_split</strong> (<code>Iterable</code>, <em>optional</em>) &#x2014;
Collection of tokens which will never be split during tokenization. Only has an effect when
<code>do_basic_tokenize=True</code>`,name:"never_split"},{anchor:"transformers.LayoutLMTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[UNK]&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.LayoutLMTokenizer.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[SEP]&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.LayoutLMTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[PAD]&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.LayoutLMTokenizer.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[CLS]&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.LayoutLMTokenizer.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[MASK]&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.LayoutLMTokenizer.tokenize_chinese_chars",description:`<strong>tokenize_chinese_chars</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to tokenize Chinese characters.</p>
<p>This should likely be deactivated for Japanese (see this
<a href="https://github.com/huggingface/transformers/issues/328" rel="nofollow">issue</a>).`,name:"tokenize_chinese_chars"},{anchor:"transformers.LayoutLMTokenizer.strip_accents",description:`<strong>strip_accents</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to strip all accents. If this option is not specified, then it will be determined by the
value for <code>lowercase</code> (as in the original LayoutLM).`,name:"strip_accents"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/tokenization_layoutlm.py#L75"}}),st=new A({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.LayoutLMTokenizer.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.LayoutLMTokenizer.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.LayoutLMTokenizer.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/main/src/transformers/models/layoutlm/tokenization_layoutlm.py#L208",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),ve=new A({props:{name:"convert_tokens_to_string",anchor:"transformers.LayoutLMTokenizer.convert_tokens_to_string",parameters:[{name:"tokens",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/tokenization_layoutlm.py#L203"}}),H=new A({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.LayoutLMTokenizer.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.LayoutLMTokenizer.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.LayoutLMTokenizer.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/main/src/transformers/models/layoutlm/tokenization_layoutlm.py#L261",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),yt=new Bt({props:{anchor:"transformers.LayoutLMTokenizer.create_token_type_ids_from_sequences.example",$$slots:{default:[Vn]},$$scope:{ctx:U}}}),at=new A({props:{name:"get_special_tokens_mask",anchor:"transformers.LayoutLMTokenizer.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.LayoutLMTokenizer.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.LayoutLMTokenizer.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.LayoutLMTokenizer.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/main/src/transformers/models/layoutlm/tokenization_layoutlm.py#L233",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),ue=new Se({props:{title:"LayoutLMTokenizerFast",local:"transformers.LayoutLMTokenizerFast",headingTag:"h2"}}),te=new A({props:{name:"class transformers.LayoutLMTokenizerFast",anchor:"transformers.LayoutLMTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"do_lower_case",val:" = True"},{name:"unk_token",val:" = '[UNK]'"},{name:"sep_token",val:" = '[SEP]'"},{name:"pad_token",val:" = '[PAD]'"},{name:"cls_token",val:" = '[CLS]'"},{name:"mask_token",val:" = '[MASK]'"},{name:"tokenize_chinese_chars",val:" = True"},{name:"strip_accents",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
File containing the vocabulary.`,name:"vocab_file"},{anchor:"transformers.LayoutLMTokenizerFast.do_lower_case",description:`<strong>do_lower_case</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to lowercase the input when tokenizing.`,name:"do_lower_case"},{anchor:"transformers.LayoutLMTokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[UNK]&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.LayoutLMTokenizerFast.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[SEP]&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.LayoutLMTokenizerFast.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[PAD]&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.LayoutLMTokenizerFast.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[CLS]&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.LayoutLMTokenizerFast.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[MASK]&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.LayoutLMTokenizerFast.clean_text",description:`<strong>clean_text</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the text before tokenization by removing any control characters and replacing all
whitespaces by the classic one.`,name:"clean_text"},{anchor:"transformers.LayoutLMTokenizerFast.tokenize_chinese_chars",description:`<strong>tokenize_chinese_chars</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to tokenize Chinese characters. This should likely be deactivated for Japanese (see <a href="https://github.com/huggingface/transformers/issues/328" rel="nofollow">this
issue</a>).`,name:"tokenize_chinese_chars"},{anchor:"transformers.LayoutLMTokenizerFast.strip_accents",description:`<strong>strip_accents</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to strip all accents. If this option is not specified, then it will be determined by the
value for <code>lowercase</code> (as in the original LayoutLM).`,name:"strip_accents"},{anchor:"transformers.LayoutLMTokenizerFast.wordpieces_prefix",description:`<strong>wordpieces_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;##&quot;</code>) &#x2014;
The prefix for subwords.`,name:"wordpieces_prefix"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlm/tokenization_layoutlm_fast.py#L62"}}),Fe=new A({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.LayoutLMTokenizerFast.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:""},{name:"token_ids_1",val:" = None"}],parametersDescription:[{anchor:"transformers.LayoutLMTokenizerFast.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.LayoutLMTokenizerFast.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/main/src/transformers/models/layoutlm/tokenization_layoutlm_fast.py#L150",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),en=new A({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.LayoutLMTokenizerFast.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.LayoutLMTokenizerFast.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.LayoutLMTokenizerFast.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/main/src/transformers/models/layoutlm/tokenization_layoutlm_fast.py#L174",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),mn=new Bt({props:{anchor:"transformers.LayoutLMTokenizerFast.create_token_type_ids_from_sequences.example",$$slots:{default:[Wn]},$$scope:{ctx:U}}}),un=new Rn({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[hs],pytorch:[Pn]},$$scope:{ctx:U}}}),{c(){e=c("meta"),g=r(),n=c("p"),a=r(),_(M.$$.fragment),t=r(),y=c("a"),E=r(),_(F.$$.fragment),x=r(),V=c("p"),V.innerHTML=z,$=r(),W=c("ul"),W.innerHTML=u,J=r(),se=c("p"),se.textContent=Je,Gt=r(),de=c("p"),de.innerHTML=Ot,De=r(),_(be.$$.fragment),he=r(),oe=c("ul"),oe.innerHTML=Xt,Ce=r(),_(rt.$$.fragment),Y=r(),fe=c("p"),fe.innerHTML=nn,lt=r(),_(ce.$$.fragment),Ye=r(),_(qe.$$.fragment),wt=r(),kt=c("p"),kt.textContent=Ft,Pe=r(),_(it.$$.fragment),ge=r(),Oe=c("ul"),Oe.innerHTML=pe,Ae=r(),_(X.$$.fragment),$e=r(),Lt=c("ul"),Lt.innerHTML=It,Ke=r(),_(dt.$$.fragment),ke=r(),ct=c("ul"),ct.innerHTML=jt,et=r(),B=c("p"),B.innerHTML=vt,Te=r(),ye=c("ul"),ye.innerHTML=sn,pt=r(),Be=c("p"),Be.textContent=on,Ge=r(),Ne=c("ul"),Ne.innerHTML=Ut,qt=r(),_(ae.$$.fragment),Nt=r(),I=c("div"),_(me.$$.fragment),St=r(),Le=c("p"),Le.innerHTML=cn,Dt=r(),Me=c("p"),Me.innerHTML=an,tt=r(),_(je.$$.fragment),mt=r(),_(nt.$$.fragment),q=r(),N=c("div"),_(ut.$$.fragment),Ee=r(),Et=c("p"),Et.textContent=Kt,xe=r(),Rt=c("p"),Rt.innerHTML=ht,ft=r(),we=c("div"),_(st.$$.fragment),G=r(),Re=c("p"),Re.textContent=ze,Ze=r(),Zt=c("ul"),Zt.innerHTML=Vt,Wt=r(),gt=c("div"),_(ve.$$.fragment),Jt=r(),Ve=c("p"),Ve.textContent=Yt,P=r(),K=c("div"),_(H.$$.fragment),We=r(),Qt=c("p"),Qt.textContent=Ht,At=r(),_(yt.$$.fragment),Ct=r(),ot=c("p"),ot.innerHTML=rn,$t=r(),Ue=c("div"),_(at.$$.fragment),h=r(),C=c("p"),C.innerHTML=S,re=r(),_(ue.$$.fragment),ee=r(),Q=c("div"),_(te.$$.fragment),le=r(),ie=c("p"),ie.innerHTML=ne,pn=r(),m=c("p"),m.innerHTML=v,Mt=r(),O=c("div"),_(Fe.$$.fragment),Ie=r(),Qe=c("p"),Qe.textContent=He,_t=r(),_e=c("ul"),_e.innerHTML=xt,yn=r(),bt=c("div"),_(en.$$.fragment),Mn=r(),ln=c("p"),ln.textContent=Tn,Un=r(),_(mn.$$.fragment),Jn=r(),_n=c("p"),_n.innerHTML=$n,kn=r(),_(un.$$.fragment),Ln=r(),wn=c("p"),this.h()},l(s){const j=Nn("svelte-u9bgzb",document.head);e=p(j,"META",{name:!0,content:!0}),j.forEach(o),g=l(s),n=p(s,"P",{}),R(n).forEach(o),a=l(s),b(M.$$.fragment,s),t=l(s),y=p(s,"A",{id:!0}),R(y).forEach(o),E=l(s),b(F.$$.fragment,s),x=l(s),V=p(s,"P",{"data-svelte-h":!0}),f(V)!=="svelte-i3mer4"&&(V.innerHTML=z),$=l(s),W=p(s,"UL",{"data-svelte-h":!0}),f(W)!=="svelte-1x85dj3"&&(W.innerHTML=u),J=l(s),se=p(s,"P",{"data-svelte-h":!0}),f(se)!=="svelte-vfdo9a"&&(se.textContent=Je),Gt=l(s),de=p(s,"P",{"data-svelte-h":!0}),f(de)!=="svelte-f1ebc4"&&(de.innerHTML=Ot),De=l(s),b(be.$$.fragment,s),he=l(s),oe=p(s,"UL",{"data-svelte-h":!0}),f(oe)!=="svelte-1f0pvrx"&&(oe.innerHTML=Xt),Ce=l(s),b(rt.$$.fragment,s),Y=l(s),fe=p(s,"P",{"data-svelte-h":!0}),f(fe)!=="svelte-rq1xjz"&&(fe.innerHTML=nn),lt=l(s),b(ce.$$.fragment,s),Ye=l(s),b(qe.$$.fragment,s),wt=l(s),kt=p(s,"P",{"data-svelte-h":!0}),f(kt)!=="svelte-gbqnu4"&&(kt.textContent=Ft),Pe=l(s),b(it.$$.fragment,s),ge=l(s),Oe=p(s,"UL",{"data-svelte-h":!0}),f(Oe)!=="svelte-vg3xzb"&&(Oe.innerHTML=pe),Ae=l(s),b(X.$$.fragment,s),$e=l(s),Lt=p(s,"UL",{"data-svelte-h":!0}),f(Lt)!=="svelte-10wsljn"&&(Lt.innerHTML=It),Ke=l(s),b(dt.$$.fragment,s),ke=l(s),ct=p(s,"UL",{"data-svelte-h":!0}),f(ct)!=="svelte-rjvoj7"&&(ct.innerHTML=jt),et=l(s),B=p(s,"P",{"data-svelte-h":!0}),f(B)!=="svelte-vy0wpy"&&(B.innerHTML=vt),Te=l(s),ye=p(s,"UL",{"data-svelte-h":!0}),f(ye)!=="svelte-1uvyu41"&&(ye.innerHTML=sn),pt=l(s),Be=p(s,"P",{"data-svelte-h":!0}),f(Be)!=="svelte-lk14e4"&&(Be.textContent=on),Ge=l(s),Ne=p(s,"UL",{"data-svelte-h":!0}),f(Ne)!=="svelte-1or3vl3"&&(Ne.innerHTML=Ut),qt=l(s),b(ae.$$.fragment,s),Nt=l(s),I=p(s,"DIV",{class:!0});var Pt=R(I);b(me.$$.fragment,Pt),St=l(Pt),Le=p(Pt,"P",{"data-svelte-h":!0}),f(Le)!=="svelte-1kau11e"&&(Le.innerHTML=cn),Dt=l(Pt),Me=p(Pt,"P",{"data-svelte-h":!0}),f(Me)!=="svelte-1gq55o3"&&(Me.innerHTML=an),tt=l(Pt),b(je.$$.fragment,Pt),Pt.forEach(o),mt=l(s),b(nt.$$.fragment,s),q=l(s),N=p(s,"DIV",{class:!0});var Xe=R(N);b(ut.$$.fragment,Xe),Ee=l(Xe),Et=p(Xe,"P",{"data-svelte-h":!0}),f(Et)!=="svelte-10n506g"&&(Et.textContent=Kt),xe=l(Xe),Rt=p(Xe,"P",{"data-svelte-h":!0}),f(Rt)!=="svelte-1c3t5ty"&&(Rt.innerHTML=ht),ft=l(Xe),we=p(Xe,"DIV",{class:!0});var dn=R(we);b(st.$$.fragment,dn),G=l(dn),Re=p(dn,"P",{"data-svelte-h":!0}),f(Re)!=="svelte-175z7u0"&&(Re.textContent=ze),Ze=l(dn),Zt=p(dn,"UL",{"data-svelte-h":!0}),f(Zt)!=="svelte-xi6653"&&(Zt.innerHTML=Vt),dn.forEach(o),Wt=l(Xe),gt=p(Xe,"DIV",{class:!0});var gn=R(gt);b(ve.$$.fragment,gn),Jt=l(gn),Ve=p(gn,"P",{"data-svelte-h":!0}),f(Ve)!=="svelte-b3k2yi"&&(Ve.textContent=Yt),gn.forEach(o),P=l(Xe),K=p(Xe,"DIV",{class:!0});var hn=R(K);b(H.$$.fragment,hn),We=l(hn),Qt=p(hn,"P",{"data-svelte-h":!0}),f(Qt)!=="svelte-rcct5a"&&(Qt.textContent=Ht),At=l(hn),b(yt.$$.fragment,hn),Ct=l(hn),ot=p(hn,"P",{"data-svelte-h":!0}),f(ot)!=="svelte-owoxgn"&&(ot.innerHTML=rn),hn.forEach(o),$t=l(Xe),Ue=p(Xe,"DIV",{class:!0});var vn=R(Ue);b(at.$$.fragment,vn),h=l(vn),C=p(vn,"P",{"data-svelte-h":!0}),f(C)!=="svelte-1f4f5kp"&&(C.innerHTML=S),vn.forEach(o),Xe.forEach(o),re=l(s),b(ue.$$.fragment,s),ee=l(s),Q=p(s,"DIV",{class:!0});var tn=R(Q);b(te.$$.fragment,tn),le=l(tn),ie=p(tn,"P",{"data-svelte-h":!0}),f(ie)!=="svelte-gn4u9l"&&(ie.innerHTML=ne),pn=l(tn),m=p(tn,"P",{"data-svelte-h":!0}),f(m)!=="svelte-fh0aq"&&(m.innerHTML=v),Mt=l(tn),O=p(tn,"DIV",{class:!0});var bn=R(O);b(Fe.$$.fragment,bn),Ie=l(bn),Qe=p(bn,"P",{"data-svelte-h":!0}),f(Qe)!=="svelte-175z7u0"&&(Qe.textContent=He),_t=l(bn),_e=p(bn,"UL",{"data-svelte-h":!0}),f(_e)!=="svelte-xi6653"&&(_e.innerHTML=xt),bn.forEach(o),yn=l(tn),bt=p(tn,"DIV",{class:!0});var fn=R(bt);b(en.$$.fragment,fn),Mn=l(fn),ln=p(fn,"P",{"data-svelte-h":!0}),f(ln)!=="svelte-rcct5a"&&(ln.textContent=Tn),Un=l(fn),b(mn.$$.fragment,fn),Jn=l(fn),_n=p(fn,"P",{"data-svelte-h":!0}),f(_n)!=="svelte-owoxgn"&&(_n.innerHTML=$n),fn.forEach(o),tn.forEach(o),kn=l(s),b(un.$$.fragment,s),Ln=l(s),wn=p(s,"P",{}),R(wn).forEach(o),this.h()},h(){Z(e,"name","hf:doc:metadata"),Z(e,"content",gs),Z(y,"id","Overview"),Z(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(gt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(bt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(s,j){i(document.head,e),d(s,g,j),d(s,n,j),d(s,a,j),T(M,s,j),d(s,t,j),d(s,y,j),d(s,E,j),T(F,s,j),d(s,x,j),d(s,V,j),d(s,$,j),d(s,W,j),d(s,J,j),d(s,se,j),d(s,Gt,j),d(s,de,j),d(s,De,j),T(be,s,j),d(s,he,j),d(s,oe,j),d(s,Ce,j),T(rt,s,j),d(s,Y,j),d(s,fe,j),d(s,lt,j),T(ce,s,j),d(s,Ye,j),T(qe,s,j),d(s,wt,j),d(s,kt,j),d(s,Pe,j),T(it,s,j),d(s,ge,j),d(s,Oe,j),d(s,Ae,j),T(X,s,j),d(s,$e,j),d(s,Lt,j),d(s,Ke,j),T(dt,s,j),d(s,ke,j),d(s,ct,j),d(s,et,j),d(s,B,j),d(s,Te,j),d(s,ye,j),d(s,pt,j),d(s,Be,j),d(s,Ge,j),d(s,Ne,j),d(s,qt,j),T(ae,s,j),d(s,Nt,j),d(s,I,j),T(me,I,null),i(I,St),i(I,Le),i(I,Dt),i(I,Me),i(I,tt),T(je,I,null),d(s,mt,j),T(nt,s,j),d(s,q,j),d(s,N,j),T(ut,N,null),i(N,Ee),i(N,Et),i(N,xe),i(N,Rt),i(N,ft),i(N,we),T(st,we,null),i(we,G),i(we,Re),i(we,Ze),i(we,Zt),i(N,Wt),i(N,gt),T(ve,gt,null),i(gt,Jt),i(gt,Ve),i(N,P),i(N,K),T(H,K,null),i(K,We),i(K,Qt),i(K,At),T(yt,K,null),i(K,Ct),i(K,ot),i(N,$t),i(N,Ue),T(at,Ue,null),i(Ue,h),i(Ue,C),d(s,re,j),T(ue,s,j),d(s,ee,j),d(s,Q,j),T(te,Q,null),i(Q,le),i(Q,ie),i(Q,pn),i(Q,m),i(Q,Mt),i(Q,O),T(Fe,O,null),i(O,Ie),i(O,Qe),i(O,_t),i(O,_e),i(Q,yn),i(Q,bt),T(en,bt,null),i(bt,Mn),i(bt,ln),i(bt,Un),T(mn,bt,null),i(bt,Jn),i(bt,_n),d(s,kn,j),T(un,s,j),d(s,Ln,j),d(s,wn,j),jn=!0},p(s,[j]){const Pt={};j&2&&(Pt.$$scope={dirty:j,ctx:s}),je.$set(Pt);const Xe={};j&2&&(Xe.$$scope={dirty:j,ctx:s}),yt.$set(Xe);const dn={};j&2&&(dn.$$scope={dirty:j,ctx:s}),mn.$set(dn);const gn={};j&2&&(gn.$$scope={dirty:j,ctx:s}),un.$set(gn)},i(s){jn||(w(M.$$.fragment,s),w(F.$$.fragment,s),w(be.$$.fragment,s),w(rt.$$.fragment,s),w(ce.$$.fragment,s),w(qe.$$.fragment,s),w(it.$$.fragment,s),w(X.$$.fragment,s),w(dt.$$.fragment,s),w(ae.$$.fragment,s),w(me.$$.fragment,s),w(je.$$.fragment,s),w(nt.$$.fragment,s),w(ut.$$.fragment,s),w(st.$$.fragment,s),w(ve.$$.fragment,s),w(H.$$.fragment,s),w(yt.$$.fragment,s),w(at.$$.fragment,s),w(ue.$$.fragment,s),w(te.$$.fragment,s),w(Fe.$$.fragment,s),w(en.$$.fragment,s),w(mn.$$.fragment,s),w(un.$$.fragment,s),jn=!0)},o(s){k(M.$$.fragment,s),k(F.$$.fragment,s),k(be.$$.fragment,s),k(rt.$$.fragment,s),k(ce.$$.fragment,s),k(qe.$$.fragment,s),k(it.$$.fragment,s),k(X.$$.fragment,s),k(dt.$$.fragment,s),k(ae.$$.fragment,s),k(me.$$.fragment,s),k(je.$$.fragment,s),k(nt.$$.fragment,s),k(ut.$$.fragment,s),k(st.$$.fragment,s),k(ve.$$.fragment,s),k(H.$$.fragment,s),k(yt.$$.fragment,s),k(at.$$.fragment,s),k(ue.$$.fragment,s),k(te.$$.fragment,s),k(Fe.$$.fragment,s),k(en.$$.fragment,s),k(mn.$$.fragment,s),k(un.$$.fragment,s),jn=!1},d(s){s&&(o(g),o(n),o(a),o(t),o(y),o(E),o(x),o(V),o($),o(W),o(J),o(se),o(Gt),o(de),o(De),o(he),o(oe),o(Ce),o(Y),o(fe),o(lt),o(Ye),o(wt),o(kt),o(Pe),o(ge),o(Oe),o(Ae),o($e),o(Lt),o(Ke),o(ke),o(ct),o(et),o(B),o(Te),o(ye),o(pt),o(Be),o(Ge),o(Ne),o(qt),o(Nt),o(I),o(mt),o(q),o(N),o(re),o(ee),o(Q),o(kn),o(Ln),o(wn)),o(e),L(M,s),L(F,s),L(be,s),L(rt,s),L(ce,s),L(qe,s),L(it,s),L(X,s),L(dt,s),L(ae,s),L(me),L(je),L(nt,s),L(ut),L(st),L(ve),L(H),L(yt),L(at),L(ue,s),L(te),L(Fe),L(en),L(mn),L(un,s)}}}const gs='{"title":"LayoutLM","local":"layoutlm","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"LayoutLMConfig","local":"transformers.LayoutLMConfig","sections":[],"depth":2},{"title":"LayoutLMTokenizer","local":"transformers.LayoutLMTokenizer","sections":[],"depth":2},{"title":"LayoutLMTokenizerFast","local":"transformers.LayoutLMTokenizerFast","sections":[],"depth":2},{"title":"LayoutLMModel","local":"transformers.LayoutLMModel","sections":[],"depth":2},{"title":"LayoutLMForMaskedLM","local":"transformers.LayoutLMForMaskedLM","sections":[],"depth":2},{"title":"LayoutLMForSequenceClassification","local":"transformers.LayoutLMForSequenceClassification","sections":[],"depth":2},{"title":"LayoutLMForTokenClassification","local":"transformers.LayoutLMForTokenClassification","sections":[],"depth":2},{"title":"LayoutLMForQuestionAnswering","local":"transformers.LayoutLMForQuestionAnswering","sections":[],"depth":2},{"title":"TFLayoutLMModel","local":"transformers.TFLayoutLMModel","sections":[],"depth":2},{"title":"TFLayoutLMForMaskedLM","local":"transformers.TFLayoutLMForMaskedLM","sections":[],"depth":2},{"title":"TFLayoutLMForSequenceClassification","local":"transformers.TFLayoutLMForSequenceClassification","sections":[],"depth":2},{"title":"TFLayoutLMForTokenClassification","local":"transformers.TFLayoutLMForTokenClassification","sections":[],"depth":2},{"title":"TFLayoutLMForQuestionAnswering","local":"transformers.TFLayoutLMForQuestionAnswering","sections":[],"depth":2}],"depth":1}';function ys(U){return Fn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Us extends In{constructor(e){super(),qn(this,e,ys,fs,zn,{})}}export{Us as component};
