import{s as Fn,o as qn,n as D}from"../chunks/scheduler.25b97de1.js";import{S as Nn,i as Rn,g as c,s as r,r as y,A as Zn,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.d9030fc9.js";import{T as zt}from"../chunks/Tip.baa67368.js";import{D as H}from"../chunks/Docstring.e257edda.js";import{C as Tt}from"../chunks/CodeBlock.e6cd0d95.js";import{F as Vn,M as In}from"../chunks/Markdown.7217f838.js";import{E as At}from"../chunks/ExampleCodeBlock.20db4b6e.js";import{P as xn}from"../chunks/PipelineTag.5f100392.js";import{H as Se,E as Wn}from"../chunks/EditOnGithub.91d95064.js";function Bn(U){let e,g="Examples:",s,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,s=r(),y(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),s=l(t),b(a.$$.fragment,t)},m(t,_){d(t,e,_),d(t,s,_),T(a,t,_),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(s)),L(a,t)}}}function Qn(U){let e,g="pair mask has the following format:",s,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,s=r(),y(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-qjgeij"&&(e.textContent=g),s=l(t),b(a.$$.fragment,t)},m(t,_){d(t,e,_),d(t,s,_),T(a,t,_),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(s)),L(a,t)}}}function Hn(U){let e,g="pair mask has the following format:",s,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,s=r(),y(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-qjgeij"&&(e.textContent=g),s=l(t),b(a.$$.fragment,t)},m(t,_){d(t,e,_),d(t,s,_),T(a,t,_),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(s)),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(s){e=p(s,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(s,a){d(s,e,a)},p:D,d(s){s&&o(e)}}}function Gn(U){let e,g="Examples:",s,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,s=r(),y(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),s=l(t),b(a.$$.fragment,t)},m(t,_){d(t,e,_),d(t,s,_),T(a,t,_),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(s)),L(a,t)}}}function En(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(s){e=p(s,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(s,a){d(s,e,a)},p:D,d(s){s&&o(e)}}}function Xn(U){let e,g="Examples:",s,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,s=r(),y(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),s=l(t),b(a.$$.fragment,t)},m(t,_){d(t,e,_),d(t,s,_),T(a,t,_),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(s)),L(a,t)}}}function Sn(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(s){e=p(s,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(s,a){d(s,e,a)},p:D,d(s){s&&o(e)}}}function Dn(U){let e,g="Examples:",s,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,s=r(),y(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),s=l(t),b(a.$$.fragment,t)},m(t,_){d(t,e,_),d(t,s,_),T(a,t,_),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(s)),L(a,t)}}}function Yn(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(s){e=p(s,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(s,a){d(s,e,a)},p:D,d(s){s&&o(e)}}}function Pn(U){let e,g="Examples:",s,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,s=r(),y(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),s=l(t),b(a.$$.fragment,t)},m(t,_){d(t,e,_),d(t,s,_),T(a,t,_),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(s)),L(a,t)}}}function On(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(){y(e.$$.fragment)},l(s){b(e.$$.fragment,s)},m(s,a){T(e,s,a),g=!0},p:D,i(s){g||(w(e.$$.fragment,s),g=!0)},o(s){k(e.$$.fragment,s),g=!1},d(s){L(e,s)}}}function Kn(U){let e,g,s,a,M,t,_=`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,I,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,m,J='The <a href="/docs/transformers/pr_30929/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/pr_30929/en/model_doc/layoutlm#transformers.LayoutLMForMaskedLM">LayoutLMForMaskedLM</a> forward method, overrides the <code>__call__</code> special method.',It,Pe,it,ge,Oe,pe,He,X,$e,Lt,Ft,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,A=`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,_e,sn,pt,Ae='The <a href="/docs/transformers/pr_30929/en/model_doc/layoutlm#transformers.LayoutLMForSequenceClassification">LayoutLMForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',on,Ge,Ne,Ut,qt,ae,Nt,F,ue,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,ut=`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,mt,Ee,Et='The <a href="/docs/transformers/pr_30929/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,Q,We,Bt=`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.`,Qt,Ht,_t="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 H({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/pr_30929/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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_layoutlm.py#L702"}}),$=new H({props:{name:"forward",anchor:"transformers.LayoutLMModel.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"bbox",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"encoder_hidden_states",val:": Optional = None"},{name:"encoder_attention_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/pr_30929/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/layoutlm/modeling_layoutlm.py#L732",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/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/pr_30929/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/pr_30929/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:[An]},$$scope:{ctx:U}}}),de=new At({props:{anchor:"transformers.LayoutLMModel.forward.example",$$slots:{default:[Gn]},$$scope:{ctx:U}}}),De=new Se({props:{title:"LayoutLMForMaskedLM",local:"transformers.LayoutLMForMaskedLM",headingTag:"h2"}}),oe=new H({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/pr_30929/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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_layoutlm.py#L854"}}),Ye=new H({props:{name:"forward",anchor:"transformers.LayoutLMForMaskedLM.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"bbox",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"encoder_hidden_states",val:": Optional = None"},{name:"encoder_attention_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_layoutlm.py#L877",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/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/pr_30929/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/pr_30929/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:[En]},$$scope:{ctx:U}}}),ge=new At({props:{anchor:"transformers.LayoutLMForMaskedLM.forward.example",$$slots:{default:[Xn]},$$scope:{ctx:U}}}),pe=new Se({props:{title:"LayoutLMForSequenceClassification",local:"transformers.LayoutLMForSequenceClassification",headingTag:"h2"}}),$e=new H({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/pr_30929/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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_layoutlm.py#L980"}}),_e=new H({props:{name:"forward",anchor:"transformers.LayoutLMForSequenceClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"bbox",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_layoutlm.py#L1001",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/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/pr_30929/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/pr_30929/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:[Sn]},$$scope:{ctx:U}}}),Ut=new At({props:{anchor:"transformers.LayoutLMForSequenceClassification.forward.example",$$slots:{default:[Dn]},$$scope:{ctx:U}}}),ae=new Se({props:{title:"LayoutLMForTokenClassification",local:"transformers.LayoutLMForTokenClassification",headingTag:"h2"}}),ue=new H({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/pr_30929/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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_layoutlm.py#L1116"}}),N=new H({props:{name:"forward",anchor:"transformers.LayoutLMForTokenClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"bbox",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_layoutlm.py#L1138",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/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/pr_30929/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/pr_30929/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:[Yn]},$$scope:{ctx:U}}}),ht=new At({props:{anchor:"transformers.LayoutLMForTokenClassification.forward.example",$$slots:{default:[Pn]},$$scope:{ctx:U}}}),we=new Se({props:{title:"LayoutLMForQuestionAnswering",local:"transformers.LayoutLMForQuestionAnswering",headingTag:"h2"}}),Re=new H({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/pr_30929/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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_layoutlm.py#L1234"}}),K=new H({props:{name:"forward",anchor:"transformers.LayoutLMForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"bbox",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"start_positions",val:": Optional = None"},{name:"end_positions",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/layoutlm/modeling_layoutlm.py#L1256",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/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/pr_30929/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/pr_30929/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ue=new At({props:{anchor:"transformers.LayoutLMForQuestionAnswering.forward.example",$$slots:{default:[On]},$$scope:{ctx:U}}}),{c(){y(e.$$.fragment),g=r(),s=c("div"),y(a.$$.fragment),M=r(),t=c("p"),t.innerHTML=_,E=r(),I=c("p"),I.innerHTML=x,V=r(),z=c("div"),y($.$$.fragment),W=r(),m=c("p"),m.innerHTML=J,se=r(),y(Je.$$.fragment),Gt=r(),y(de.$$.fragment),Ot=r(),y(De.$$.fragment),be=r(),he=c("div"),y(oe.$$.fragment),Xt=r(),Ce=c("p"),Ce.innerHTML=rt,Y=r(),fe=c("p"),fe.innerHTML=nn,lt=r(),ce=c("div"),y(Ye.$$.fragment),qe=r(),wt=c("p"),wt.innerHTML=kt,It=r(),y(Pe.$$.fragment),it=r(),y(ge.$$.fragment),Oe=r(),y(pe.$$.fragment),He=r(),X=c("div"),y($e.$$.fragment),Lt=r(),Ft=c("p"),Ft.innerHTML=Ke,dt=r(),ke=c("p"),ke.innerHTML=ct,jt=r(),et=c("p"),et.innerHTML=A,vt=r(),Te=c("div"),y(_e.$$.fragment),sn=r(),pt=c("p"),pt.innerHTML=Ae,on=r(),y(Ge.$$.fragment),Ne=r(),y(Ut.$$.fragment),qt=r(),y(ae.$$.fragment),Nt=r(),F=c("div"),y(ue.$$.fragment),St=r(),Le=c("p"),Le.innerHTML=cn,Dt=r(),Me=c("p"),Me.innerHTML=an,tt=r(),je=c("p"),je.innerHTML=ut,nt=r(),q=c("div"),y(N.$$.fragment),mt=r(),Ee=c("p"),Ee.innerHTML=Et,Kt=r(),y(xe.$$.fragment),Rt=r(),y(ht.$$.fragment),ft=r(),y(we.$$.fragment),st=r(),G=c("div"),y(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"),y(K.$$.fragment),Q=r(),We=c("p"),We.innerHTML=Bt,Qt=r(),Ht=c("p"),Ht.textContent=_t,Ct=r(),ot=c("p"),ot.textContent=rn,$t=r(),y(Ue.$$.fragment),this.h()},l(h){b(e.$$.fragment,h),g=l(h),s=p(h,"DIV",{class:!0});var C=R(s);b(a.$$.fragment,C),M=l(C),t=p(C,"P",{"data-svelte-h":!0}),f(t)!=="svelte-1fcq938"&&(t.innerHTML=_),E=l(C),I=p(C,"P",{"data-svelte-h":!0}),f(I)!=="svelte-68lg8f"&&(I.innerHTML=x),V=l(C),z=p(C,"DIV",{class:!0});var S=R(z);b($.$$.fragment,S),W=l(S),m=p(S,"P",{"data-svelte-h":!0}),f(m)!=="svelte-1h9x1x1"&&(m.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 me=R(ce);b(Ye.$$.fragment,me),qe=l(me),wt=p(me,"P",{"data-svelte-h":!0}),f(wt)!=="svelte-1c2mzs5"&&(wt.innerHTML=kt),It=l(me),b(Pe.$$.fragment,me),it=l(me),b(ge.$$.fragment,me),me.forEach(o),re.forEach(o),Oe=l(h),b(pe.$$.fragment,h),He=l(h),X=p(h,"DIV",{class:!0});var ee=R(X);b($e.$$.fragment,ee),Lt=l(ee),Ft=p(ee,"P",{"data-svelte-h":!0}),f(Ft)!=="svelte-36uopi"&&(Ft.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=A),vt=l(ee),Te=p(ee,"DIV",{class:!0});var B=R(Te);b(_e.$$.fragment,B),sn=l(B),pt=p(B,"P",{"data-svelte-h":!0}),f(pt)!=="svelte-1fil7zh"&&(pt.innerHTML=Ae),on=l(B),b(Ge.$$.fragment,B),Ne=l(B),b(Ut.$$.fragment,B),B.forEach(o),ee.forEach(o),qt=l(h),b(ae.$$.fragment,h),Nt=l(h),F=p(h,"DIV",{class:!0});var te=R(F);b(ue.$$.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=ut),nt=l(te),q=p(te,"DIV",{class:!0});var le=R(q);b(N.$$.fragment,le),mt=l(le),Ee=p(le,"P",{"data-svelte-h":!0}),f(Ee)!=="svelte-1ddskxv"&&(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),Q=l(ne),We=p(ne,"P",{"data-svelte-h":!0}),f(We)!=="svelte-19yueks"&&(We.innerHTML=Bt),Qt=l(ne),Ht=p(ne,"P",{"data-svelte-h":!0}),f(Ht)!=="svelte-11lpom8"&&(Ht.textContent=_t),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(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(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(F,"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,s,C),T(a,s,null),i(s,M),i(s,t),i(s,E),i(s,I),i(s,V),i(s,z),T($,z,null),i(z,W),i(z,m),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,It),T(Pe,ce,null),i(ce,it),T(ge,ce,null),d(h,Oe,C),T(pe,h,C),d(h,He,C),d(h,X,C),T($e,X,null),i(X,Lt),i(X,Ft),i(X,dt),i(X,ke),i(X,jt),i(X,et),i(X,vt),i(X,Te),T(_e,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,F,C),T(ue,F,null),i(F,St),i(F,Le),i(F,Dt),i(F,Me),i(F,tt),i(F,je),i(F,nt),i(F,q),T(N,q,null),i(q,mt),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,Q),i(P,We),i(P,Qt),i(P,Ht),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 me={};C&2&&(me.$$scope={dirty:C,ctx:h}),Pe.$set(me);const ee={};C&2&&(ee.$$scope={dirty:C,ctx:h}),ge.$set(ee);const B={};C&2&&(B.$$scope={dirty:C,ctx:h}),Ge.$set(B);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(_e.$$.fragment,h),w(Ge.$$.fragment,h),w(Ut.$$.fragment,h),w(ae.$$.fragment,h),w(ue.$$.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(_e.$$.fragment,h),k(Ge.$$.fragment,h),k(Ut.$$.fragment,h),k(ae.$$.fragment,h),k(ue.$$.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(s),o(Ot),o(be),o(he),o(Oe),o(He),o(X),o(qt),o(Nt),o(F),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(_e),L(Ge),L(Ut),L(ae,h),L(ue),L(N),L(xe),L(ht),L(we,h),L(Re),L(K),L(Ue)}}}function es(U){let e,g;return e=new In({props:{$$slots:{default:[Kn]},$$scope:{ctx:U}}}),{c(){y(e.$$.fragment)},l(s){b(e.$$.fragment,s)},m(s,a){T(e,s,a),g=!0},p(s,a){const M={};a&2&&(M.$$scope={dirty:a,ctx:s}),e.$set(M)},i(s){g||(w(e.$$.fragment,s),g=!0)},o(s){k(e.$$.fragment,s),g=!1},d(s){L(e,s)}}}function ts(U){let e,g="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",s,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,_,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:`,I,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,s=r(),a=c("ul"),a.innerHTML=M,t=r(),_=c("p"),_.innerHTML=E,I=r(),x=c("ul"),x.innerHTML=V,z=r(),$=c("p"),$.innerHTML=W},l(m){e=p(m,"P",{"data-svelte-h":!0}),f(e)!=="svelte-1ajbfxg"&&(e.innerHTML=g),s=l(m),a=p(m,"UL",{"data-svelte-h":!0}),f(a)!=="svelte-qm1t26"&&(a.innerHTML=M),t=l(m),_=p(m,"P",{"data-svelte-h":!0}),f(_)!=="svelte-1v9qsc5"&&(_.innerHTML=E),I=l(m),x=p(m,"UL",{"data-svelte-h":!0}),f(x)!=="svelte-15scerc"&&(x.innerHTML=V),z=l(m),$=p(m,"P",{"data-svelte-h":!0}),f($)!=="svelte-1an3odd"&&($.innerHTML=W)},m(m,J){d(m,e,J),d(m,s,J),d(m,a,J),d(m,t,J),d(m,_,J),d(m,I,J),d(m,x,J),d(m,z,J),d(m,$,J)},p:D,d(m){m&&(o(e),o(s),o(a),o(t),o(_),o(I),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(s){e=p(s,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(s,a){d(s,e,a)},p:D,d(s){s&&o(e)}}}function ss(U){let e,g="Examples:",s,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,s=r(),y(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),s=l(t),b(a.$$.fragment,t)},m(t,_){d(t,e,_),d(t,s,_),T(a,t,_),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(s)),L(a,t)}}}function os(U){let e,g="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",s,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,_,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:`,I,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,s=r(),a=c("ul"),a.innerHTML=M,t=r(),_=c("p"),_.innerHTML=E,I=r(),x=c("ul"),x.innerHTML=V,z=r(),$=c("p"),$.innerHTML=W},l(m){e=p(m,"P",{"data-svelte-h":!0}),f(e)!=="svelte-1ajbfxg"&&(e.innerHTML=g),s=l(m),a=p(m,"UL",{"data-svelte-h":!0}),f(a)!=="svelte-qm1t26"&&(a.innerHTML=M),t=l(m),_=p(m,"P",{"data-svelte-h":!0}),f(_)!=="svelte-1v9qsc5"&&(_.innerHTML=E),I=l(m),x=p(m,"UL",{"data-svelte-h":!0}),f(x)!=="svelte-15scerc"&&(x.innerHTML=V),z=l(m),$=p(m,"P",{"data-svelte-h":!0}),f($)!=="svelte-1an3odd"&&($.innerHTML=W)},m(m,J){d(m,e,J),d(m,s,J),d(m,a,J),d(m,t,J),d(m,_,J),d(m,I,J),d(m,x,J),d(m,z,J),d(m,$,J)},p:D,d(m){m&&(o(e),o(s),o(a),o(t),o(_),o(I),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(s){e=p(s,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(s,a){d(s,e,a)},p:D,d(s){s&&o(e)}}}function rs(U){let e,g="Examples:",s,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,s=r(),y(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),s=l(t),b(a.$$.fragment,t)},m(t,_){d(t,e,_),d(t,s,_),T(a,t,_),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(s)),L(a,t)}}}function ls(U){let e,g="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",s,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,_,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:`,I,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,s=r(),a=c("ul"),a.innerHTML=M,t=r(),_=c("p"),_.innerHTML=E,I=r(),x=c("ul"),x.innerHTML=V,z=r(),$=c("p"),$.innerHTML=W},l(m){e=p(m,"P",{"data-svelte-h":!0}),f(e)!=="svelte-1ajbfxg"&&(e.innerHTML=g),s=l(m),a=p(m,"UL",{"data-svelte-h":!0}),f(a)!=="svelte-qm1t26"&&(a.innerHTML=M),t=l(m),_=p(m,"P",{"data-svelte-h":!0}),f(_)!=="svelte-1v9qsc5"&&(_.innerHTML=E),I=l(m),x=p(m,"UL",{"data-svelte-h":!0}),f(x)!=="svelte-15scerc"&&(x.innerHTML=V),z=l(m),$=p(m,"P",{"data-svelte-h":!0}),f($)!=="svelte-1an3odd"&&($.innerHTML=W)},m(m,J){d(m,e,J),d(m,s,J),d(m,a,J),d(m,t,J),d(m,_,J),d(m,I,J),d(m,x,J),d(m,z,J),d(m,$,J)},p:D,d(m){m&&(o(e),o(s),o(a),o(t),o(_),o(I),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(s){e=p(s,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(s,a){d(s,e,a)},p:D,d(s){s&&o(e)}}}function ds(U){let e,g="Examples:",s,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,s=r(),y(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),s=l(t),b(a.$$.fragment,t)},m(t,_){d(t,e,_),d(t,s,_),T(a,t,_),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(s)),L(a,t)}}}function cs(U){let e,g="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",s,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,_,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:`,I,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,s=r(),a=c("ul"),a.innerHTML=M,t=r(),_=c("p"),_.innerHTML=E,I=r(),x=c("ul"),x.innerHTML=V,z=r(),$=c("p"),$.innerHTML=W},l(m){e=p(m,"P",{"data-svelte-h":!0}),f(e)!=="svelte-1ajbfxg"&&(e.innerHTML=g),s=l(m),a=p(m,"UL",{"data-svelte-h":!0}),f(a)!=="svelte-qm1t26"&&(a.innerHTML=M),t=l(m),_=p(m,"P",{"data-svelte-h":!0}),f(_)!=="svelte-1v9qsc5"&&(_.innerHTML=E),I=l(m),x=p(m,"UL",{"data-svelte-h":!0}),f(x)!=="svelte-15scerc"&&(x.innerHTML=V),z=l(m),$=p(m,"P",{"data-svelte-h":!0}),f($)!=="svelte-1an3odd"&&($.innerHTML=W)},m(m,J){d(m,e,J),d(m,s,J),d(m,a,J),d(m,t,J),d(m,_,J),d(m,I,J),d(m,x,J),d(m,z,J),d(m,$,J)},p:D,d(m){m&&(o(e),o(s),o(a),o(t),o(_),o(I),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(s){e=p(s,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(s,a){d(s,e,a)},p:D,d(s){s&&o(e)}}}function us(U){let e,g="Examples:",s,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,s=r(),y(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),s=l(t),b(a.$$.fragment,t)},m(t,_){d(t,e,_),d(t,s,_),T(a,t,_),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(s)),L(a,t)}}}function ms(U){let e,g="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",s,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,_,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:`,I,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,s=r(),a=c("ul"),a.innerHTML=M,t=r(),_=c("p"),_.innerHTML=E,I=r(),x=c("ul"),x.innerHTML=V,z=r(),$=c("p"),$.innerHTML=W},l(m){e=p(m,"P",{"data-svelte-h":!0}),f(e)!=="svelte-1ajbfxg"&&(e.innerHTML=g),s=l(m),a=p(m,"UL",{"data-svelte-h":!0}),f(a)!=="svelte-qm1t26"&&(a.innerHTML=M),t=l(m),_=p(m,"P",{"data-svelte-h":!0}),f(_)!=="svelte-1v9qsc5"&&(_.innerHTML=E),I=l(m),x=p(m,"UL",{"data-svelte-h":!0}),f(x)!=="svelte-15scerc"&&(x.innerHTML=V),z=l(m),$=p(m,"P",{"data-svelte-h":!0}),f($)!=="svelte-1an3odd"&&($.innerHTML=W)},m(m,J){d(m,e,J),d(m,s,J),d(m,a,J),d(m,t,J),d(m,_,J),d(m,I,J),d(m,x,J),d(m,z,J),d(m,$,J)},p:D,d(m){m&&(o(e),o(s),o(a),o(t),o(_),o(I),o(x),o(z),o($))}}}function hs(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(s){e=p(s,"P",{"data-svelte-h":!0}),f(e)!=="svelte-fincs2"&&(e.innerHTML=g)},m(s,a){d(s,e,a)},p:D,d(s){s&&o(e)}}}function fs(U){let e,g="Examples:",s,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,s=r(),y(a.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),f(e)!=="svelte-kvfsh7"&&(e.textContent=g),s=l(t),b(a.$$.fragment,t)},m(t,_){d(t,e,_),d(t,s,_),T(a,t,_),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(s)),L(a,t)}}}function gs(U){let e,g,s,a,M,t,_="The bare LayoutLM Model transformer outputting raw hidden-states without any specific head on top.",E,I,x=`This model inherits from <a href="/docs/transformers/pr_30929/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">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,m,J,se,Je,Gt,de,Ot='The <a href="/docs/transformers/pr_30929/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/pr_30929/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,It,Pe=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">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,He,X,$e,Lt='The <a href="/docs/transformers/pr_30929/en/model_doc/layoutlm#transformers.TFLayoutLMForMaskedLM">TFLayoutLMForMaskedLM</a> forward method, overrides the <code>__call__</code> special method.',Ft,Ke,dt,ke,ct,jt,et,A,vt,Te,_e,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,Ae,on=`This model inherits from <a href="/docs/transformers/pr_30929/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">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,F,ue,St,Le,cn='The <a href="/docs/transformers/pr_30929/en/model_doc/layoutlm#transformers.TFLayoutLMForSequenceClassification">TFLayoutLMForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',Dt,Me,an,tt,je,ut,nt,q,N,mt,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/pr_30929/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">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/pr_30929/en/model_doc/layoutlm#transformers.TFLayoutLMForTokenClassification">TFLayoutLMForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',gt,ve,Jt,Ve,Yt,P,K,Q,We,Bt,Qt,Ht=`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>).`,_t,Ct,ot=`This model inherits from <a href="/docs/transformers/pr_30929/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">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,me,ee,B='The <a href="/docs/transformers/pr_30929/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 H({props:{name:"class transformers.TFLayoutLMModel",anchor:"transformers.TFLayoutLMModel",parameters:[{name:"config",val:": LayoutLMConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30929/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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1047"}}),m=new zt({props:{$$slots:{default:[ts]},$$scope:{ctx:U}}}),Je=new H({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/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1057",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/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/pr_30929/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/pr_30929/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:[ns]},$$scope:{ctx:U}}}),oe=new At({props:{anchor:"transformers.TFLayoutLMModel.call.example",$$slots:{default:[ss]},$$scope:{ctx:U}}}),Ce=new Se({props:{title:"TFLayoutLMForMaskedLM",local:"transformers.TFLayoutLMForMaskedLM",headingTag:"h2"}}),fe=new H({props:{name:"class transformers.TFLayoutLMForMaskedLM",anchor:"transformers.TFLayoutLMForMaskedLM",parameters:[{name:"config",val:": LayoutLMConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30929/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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1137"}}),ge=new zt({props:{$$slots:{default:[os]},$$scope:{ctx:U}}}),He=new H({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/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1166",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/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/pr_30929/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/pr_30929/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:[as]},$$scope:{ctx:U}}}),ke=new At({props:{anchor:"transformers.TFLayoutLMForMaskedLM.call.example",$$slots:{default:[rs]},$$scope:{ctx:U}}}),jt=new Se({props:{title:"TFLayoutLMForSequenceClassification",local:"transformers.TFLayoutLMForSequenceClassification",headingTag:"h2"}}),vt=new H({props:{name:"class transformers.TFLayoutLMForSequenceClassification",anchor:"transformers.TFLayoutLMForSequenceClassification",parameters:[{name:"config",val:": LayoutLMConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30929/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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1269"}}),ae=new zt({props:{$$slots:{default:[ls]},$$scope:{ctx:U}}}),ue=new H({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/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1295",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/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/pr_30929/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/pr_30929/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:[is]},$$scope:{ctx:U}}}),tt=new At({props:{anchor:"transformers.TFLayoutLMForSequenceClassification.call.example",$$slots:{default:[ds]},$$scope:{ctx:U}}}),ut=new Se({props:{title:"TFLayoutLMForTokenClassification",local:"transformers.TFLayoutLMForTokenClassification",headingTag:"h2"}}),N=new H({props:{name:"class transformers.TFLayoutLMForTokenClassification",anchor:"transformers.TFLayoutLMForTokenClassification",parameters:[{name:"config",val:": LayoutLMConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30929/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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1399"}}),G=new zt({props:{$$slots:{default:[cs]},$$scope:{ctx:U}}}),Ze=new H({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/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1431",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/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/pr_30929/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/pr_30929/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:[ps]},$$scope:{ctx:U}}}),Ve=new At({props:{anchor:"transformers.TFLayoutLMForTokenClassification.call.example",$$slots:{default:[us]},$$scope:{ctx:U}}}),P=new Se({props:{title:"TFLayoutLMForQuestionAnswering",local:"transformers.TFLayoutLMForQuestionAnswering",headingTag:"h2"}}),We=new H({props:{name:"class transformers.TFLayoutLMForQuestionAnswering",anchor:"transformers.TFLayoutLMForQuestionAnswering",parameters:[{name:"config",val:": LayoutLMConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30929/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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1533"}}),h=new zt({props:{$$slots:{default:[ms]},$$scope:{ctx:U}}}),re=new H({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/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1563",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/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/pr_30929/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/pr_30929/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:[hs]},$$scope:{ctx:U}}}),ne=new At({props:{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.example",$$slots:{default:[fs]},$$scope:{ctx:U}}}),{c(){y(e.$$.fragment),g=r(),s=c("div"),y(a.$$.fragment),M=r(),t=c("p"),t.textContent=_,E=r(),I=c("p"),I.innerHTML=x,V=r(),z=c("p"),z.innerHTML=$,W=r(),y(m.$$.fragment),J=r(),se=c("div"),y(Je.$$.fragment),Gt=r(),de=c("p"),de.innerHTML=Ot,De=r(),y(be.$$.fragment),he=r(),y(oe.$$.fragment),Xt=r(),y(Ce.$$.fragment),rt=r(),Y=c("div"),y(fe.$$.fragment),nn=r(),lt=c("p"),lt.innerHTML=ce,Ye=r(),qe=c("p"),qe.innerHTML=wt,kt=r(),It=c("p"),It.innerHTML=Pe,it=r(),y(ge.$$.fragment),Oe=r(),pe=c("div"),y(He.$$.fragment),X=r(),$e=c("p"),$e.innerHTML=Lt,Ft=r(),y(Ke.$$.fragment),dt=r(),y(ke.$$.fragment),ct=r(),y(jt.$$.fragment),et=r(),A=c("div"),y(vt.$$.fragment),Te=r(),_e=c("p"),_e.textContent=sn,pt=r(),Ae=c("p"),Ae.innerHTML=on,Ge=r(),Ne=c("p"),Ne.innerHTML=Ut,qt=r(),y(ae.$$.fragment),Nt=r(),F=c("div"),y(ue.$$.fragment),St=r(),Le=c("p"),Le.innerHTML=cn,Dt=r(),y(Me.$$.fragment),an=r(),y(tt.$$.fragment),je=r(),y(ut.$$.fragment),nt=r(),q=c("div"),y(N.$$.fragment),mt=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(),y(G.$$.fragment),Re=r(),ze=c("div"),y(Ze.$$.fragment),Zt=r(),Vt=c("p"),Vt.innerHTML=Wt,gt=r(),y(ve.$$.fragment),Jt=r(),y(Ve.$$.fragment),Yt=r(),y(P.$$.fragment),K=r(),Q=c("div"),y(We.$$.fragment),Bt=r(),Qt=c("p"),Qt.innerHTML=Ht,_t=r(),Ct=c("p"),Ct.innerHTML=ot,rn=r(),$t=c("p"),$t.innerHTML=Ue,at=r(),y(h.$$.fragment),C=r(),S=c("div"),y(re.$$.fragment),me=r(),ee=c("p"),ee.innerHTML=B,te=r(),y(le.$$.fragment),ie=r(),y(ne.$$.fragment),this.h()},l(u){b(e.$$.fragment,u),g=l(u),s=p(u,"DIV",{class:!0});var v=R(s);b(a.$$.fragment,v),M=l(v),t=p(v,"P",{"data-svelte-h":!0}),f(t)!=="svelte-1491dki"&&(t.textContent=_),E=l(v),I=p(v,"P",{"data-svelte-h":!0}),f(I)!=="svelte-8iywvb"&&(I.innerHTML=x),V=l(v),z=p(v,"P",{"data-svelte-h":!0}),f(z)!=="svelte-1be7e3c"&&(z.innerHTML=$),W=l(v),b(m.$$.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-g54ztd"&&(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(u),b(Ce.$$.fragment,u),rt=l(u),Y=p(u,"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-8iywvb"&&(qe.innerHTML=wt),kt=l(O),It=p(O,"P",{"data-svelte-h":!0}),f(It)!=="svelte-1be7e3c"&&(It.innerHTML=Pe),it=l(O),b(ge.$$.fragment,O),Oe=l(O),pe=p(O,"DIV",{class:!0});var Ie=R(pe);b(He.$$.fragment,Ie),X=l(Ie),$e=p(Ie,"P",{"data-svelte-h":!0}),f($e)!=="svelte-vl7ho1"&&($e.innerHTML=Lt),Ft=l(Ie),b(Ke.$$.fragment,Ie),dt=l(Ie),b(ke.$$.fragment,Ie),Ie.forEach(o),O.forEach(o),ct=l(u),b(jt.$$.fragment,u),et=l(u),A=p(u,"DIV",{class:!0});var Fe=R(A);b(vt.$$.fragment,Fe),Te=l(Fe),_e=p(Fe,"P",{"data-svelte-h":!0}),f(_e)!=="svelte-1wflwnx"&&(_e.textContent=sn),pt=l(Fe),Ae=p(Fe,"P",{"data-svelte-h":!0}),f(Ae)!=="svelte-8iywvb"&&(Ae.innerHTML=on),Ge=l(Fe),Ne=p(Fe,"P",{"data-svelte-h":!0}),f(Ne)!=="svelte-1be7e3c"&&(Ne.innerHTML=Ut),qt=l(Fe),b(ae.$$.fragment,Fe),Nt=l(Fe),F=p(Fe,"DIV",{class:!0});var Be=R(F);b(ue.$$.fragment,Be),St=l(Be),Le=p(Be,"P",{"data-svelte-h":!0}),f(Le)!=="svelte-i0hxjx"&&(Le.innerHTML=cn),Dt=l(Be),b(Me.$$.fragment,Be),an=l(Be),b(tt.$$.fragment,Be),Be.forEach(o),Fe.forEach(o),je=l(u),b(ut.$$.fragment,u),nt=l(u),q=p(u,"DIV",{class:!0});var Qe=R(q);b(N.$$.fragment,Qe),mt=l(Qe),Ee=p(Qe,"P",{"data-svelte-h":!0}),f(Ee)!=="svelte-1s4zjay"&&(Ee.textContent=Et),Kt=l(Qe),xe=p(Qe,"P",{"data-svelte-h":!0}),f(xe)!=="svelte-8iywvb"&&(xe.innerHTML=Rt),ht=l(Qe),ft=p(Qe,"P",{"data-svelte-h":!0}),f(ft)!=="svelte-1be7e3c"&&(ft.innerHTML=we),st=l(Qe),b(G.$$.fragment,Qe),Re=l(Qe),ze=p(Qe,"DIV",{class:!0});var yt=R(ze);b(Ze.$$.fragment,yt),Zt=l(yt),Vt=p(yt,"P",{"data-svelte-h":!0}),f(Vt)!=="svelte-rklxuj"&&(Vt.innerHTML=Wt),gt=l(yt),b(ve.$$.fragment,yt),Jt=l(yt),b(Ve.$$.fragment,yt),yt.forEach(o),Qe.forEach(o),Yt=l(u),b(P.$$.fragment,u),K=l(u),Q=p(u,"DIV",{class:!0});var ye=R(Q);b(We.$$.fragment,ye),Bt=l(ye),Qt=p(ye,"P",{"data-svelte-h":!0}),f(Qt)!=="svelte-1uah9q8"&&(Qt.innerHTML=Ht),_t=l(ye),Ct=p(ye,"P",{"data-svelte-h":!0}),f(Ct)!=="svelte-8iywvb"&&(Ct.innerHTML=ot),rn=l(ye),$t=p(ye,"P",{"data-svelte-h":!0}),f($t)!=="svelte-1be7e3c"&&($t.innerHTML=Ue),at=l(ye),b(h.$$.fragment,ye),C=l(ye),S=p(ye,"DIV",{class:!0});var xt=R(S);b(re.$$.fragment,xt),me=l(xt),ee=p(xt,"P",{"data-svelte-h":!0}),f(ee)!=="svelte-1scjxed"&&(ee.innerHTML=B),te=l(xt),b(le.$$.fragment,xt),ie=l(xt),b(ne.$$.fragment,xt),xt.forEach(o),ye.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(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(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(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(A,"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(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(u,v){T(e,u,v),d(u,g,v),d(u,s,v),T(a,s,null),i(s,M),i(s,t),i(s,E),i(s,I),i(s,V),i(s,z),i(s,W),T(m,s,null),i(s,J),i(s,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(u,Xt,v),T(Ce,u,v),d(u,rt,v),d(u,Y,v),T(fe,Y,null),i(Y,nn),i(Y,lt),i(Y,Ye),i(Y,qe),i(Y,kt),i(Y,It),i(Y,it),T(ge,Y,null),i(Y,Oe),i(Y,pe),T(He,pe,null),i(pe,X),i(pe,$e),i(pe,Ft),T(Ke,pe,null),i(pe,dt),T(ke,pe,null),d(u,ct,v),T(jt,u,v),d(u,et,v),d(u,A,v),T(vt,A,null),i(A,Te),i(A,_e),i(A,pt),i(A,Ae),i(A,Ge),i(A,Ne),i(A,qt),T(ae,A,null),i(A,Nt),i(A,F),T(ue,F,null),i(F,St),i(F,Le),i(F,Dt),T(Me,F,null),i(F,an),T(tt,F,null),d(u,je,v),T(ut,u,v),d(u,nt,v),d(u,q,v),T(N,q,null),i(q,mt),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(u,Yt,v),T(P,u,v),d(u,K,v),d(u,Q,v),T(We,Q,null),i(Q,Bt),i(Q,Qt),i(Q,_t),i(Q,Ct),i(Q,rn),i(Q,$t),i(Q,at),T(h,Q,null),i(Q,C),i(Q,S),T(re,S,null),i(S,me),i(S,ee),i(S,te),T(le,S,null),i(S,ie),T(ne,S,null),pn=!0},p(u,v){const Mt={};v&2&&(Mt.$$scope={dirty:v,ctx:u}),m.$set(Mt);const O={};v&2&&(O.$$scope={dirty:v,ctx:u}),be.$set(O);const Ie={};v&2&&(Ie.$$scope={dirty:v,ctx:u}),oe.$set(Ie);const Fe={};v&2&&(Fe.$$scope={dirty:v,ctx:u}),ge.$set(Fe);const Be={};v&2&&(Be.$$scope={dirty:v,ctx:u}),Ke.$set(Be);const Qe={};v&2&&(Qe.$$scope={dirty:v,ctx:u}),ke.$set(Qe);const yt={};v&2&&(yt.$$scope={dirty:v,ctx:u}),ae.$set(yt);const ye={};v&2&&(ye.$$scope={dirty:v,ctx:u}),Me.$set(ye);const xt={};v&2&&(xt.$$scope={dirty:v,ctx:u}),tt.$set(xt);const Mn={};v&2&&(Mn.$$scope={dirty:v,ctx:u}),G.$set(Mn);const bt={};v&2&&(bt.$$scope={dirty:v,ctx:u}),ve.$set(bt);const en={};v&2&&(en.$$scope={dirty:v,ctx:u}),Ve.$set(en);const yn={};v&2&&(yn.$$scope={dirty:v,ctx:u}),h.$set(yn);const ln={};v&2&&(ln.$$scope={dirty:v,ctx:u}),le.$set(ln);const wn={};v&2&&(wn.$$scope={dirty:v,ctx:u}),ne.$set(wn)},i(u){pn||(w(e.$$.fragment,u),w(a.$$.fragment,u),w(m.$$.fragment,u),w(Je.$$.fragment,u),w(be.$$.fragment,u),w(oe.$$.fragment,u),w(Ce.$$.fragment,u),w(fe.$$.fragment,u),w(ge.$$.fragment,u),w(He.$$.fragment,u),w(Ke.$$.fragment,u),w(ke.$$.fragment,u),w(jt.$$.fragment,u),w(vt.$$.fragment,u),w(ae.$$.fragment,u),w(ue.$$.fragment,u),w(Me.$$.fragment,u),w(tt.$$.fragment,u),w(ut.$$.fragment,u),w(N.$$.fragment,u),w(G.$$.fragment,u),w(Ze.$$.fragment,u),w(ve.$$.fragment,u),w(Ve.$$.fragment,u),w(P.$$.fragment,u),w(We.$$.fragment,u),w(h.$$.fragment,u),w(re.$$.fragment,u),w(le.$$.fragment,u),w(ne.$$.fragment,u),pn=!0)},o(u){k(e.$$.fragment,u),k(a.$$.fragment,u),k(m.$$.fragment,u),k(Je.$$.fragment,u),k(be.$$.fragment,u),k(oe.$$.fragment,u),k(Ce.$$.fragment,u),k(fe.$$.fragment,u),k(ge.$$.fragment,u),k(He.$$.fragment,u),k(Ke.$$.fragment,u),k(ke.$$.fragment,u),k(jt.$$.fragment,u),k(vt.$$.fragment,u),k(ae.$$.fragment,u),k(ue.$$.fragment,u),k(Me.$$.fragment,u),k(tt.$$.fragment,u),k(ut.$$.fragment,u),k(N.$$.fragment,u),k(G.$$.fragment,u),k(Ze.$$.fragment,u),k(ve.$$.fragment,u),k(Ve.$$.fragment,u),k(P.$$.fragment,u),k(We.$$.fragment,u),k(h.$$.fragment,u),k(re.$$.fragment,u),k(le.$$.fragment,u),k(ne.$$.fragment,u),pn=!1},d(u){u&&(o(g),o(s),o(Xt),o(rt),o(Y),o(ct),o(et),o(A),o(je),o(nt),o(q),o(Yt),o(K),o(Q)),L(e,u),L(a),L(m),L(Je),L(be),L(oe),L(Ce,u),L(fe),L(ge),L(He),L(Ke),L(ke),L(jt,u),L(vt),L(ae),L(ue),L(Me),L(tt),L(ut,u),L(N),L(G),L(Ze),L(ve),L(Ve),L(P,u),L(We),L(h),L(re),L(le),L(ne)}}}function _s(U){let e,g;return e=new In({props:{$$slots:{default:[gs]},$$scope:{ctx:U}}}),{c(){y(e.$$.fragment)},l(s){b(e.$$.fragment,s)},m(s,a){T(e,s,a),g=!0},p(s,a){const M={};a&2&&(M.$$scope={dirty:a,ctx:s}),e.$set(M)},i(s){g||(w(e.$$.fragment,s),g=!0)},o(s){k(e.$$.fragment,s),g=!1},d(s){L(e,s)}}}function Ms(U){let e,g,s,a,M,t,_,E,I,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,m=`<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/pr_30929/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,It="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>`,He,X,$e,Lt,Ft='<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,A,vt="<strong>Other resources</strong>",Te,_e,sn='<li><a href="../tasks/masked_language_modeling">Masked language modeling task guide</a></li>',pt,Ae,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,F,ue,St,Le,cn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_30929/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/pr_30929/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/pr_30929/en/model_doc/bert#transformers.BertConfig">BertConfig</a> for more information.`,tt,je,ut,nt,q,N,mt,Ee,Et,Kt="Construct a LayoutLM tokenizer. Based on WordPiece.",xe,Rt,ht=`This tokenizer inherits from <a href="/docs/transformers/pr_30929/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,Q,We,Bt,Qt="Create a mask from the two sequences passed to be used in a sequence-pair classification task. A LayoutLM sequence",Ht,_t,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,me,ee,B,te,le,ie,ne="Construct a “fast” LayoutLM tokenizer (backed by HuggingFace’s <em>tokenizers</em> library). Based on WordPiece.",pn,u,v=`This tokenizer inherits from <a href="/docs/transformers/pr_30929/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,Ie,Fe,Be,Qe=`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:`,yt,ye,xt="<li>single sequence: <code>[CLS] X [SEP]</code></li> <li>pair of sequences: <code>[CLS] A [SEP] B [SEP]</code></li>",Mn,bt,en,yn,ln,wn="Create a mask from the two sequences passed to be used in a sequence-pair classification task. A LayoutLM sequence",Cn,un,$n,bn,zn="If <code>token_ids_1</code> is <code>None</code>, this method only returns the first portion of the mask (0s).",Ln,mn,jn,gn,vn,kn,Un;return M=new Se({props:{title:"LayoutLM",local:"layoutlm",headingTag:"h1"}}),I=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 xn({props:{pipeline:"document-question-answering"}}),X=new xn({props:{pipeline:"text-classification"}}),dt=new xn({props:{pipeline:"token-classification"}}),ae=new Se({props:{title:"LayoutLMConfig",local:"transformers.LayoutLMConfig",headingTag:"h2"}}),ue=new H({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/pr_30929/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/pr_30929/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/vr_30929/src/transformers/models/layoutlm/configuration_layoutlm.py#L28"}}),je=new At({props:{anchor:"transformers.LayoutLMConfig.example",$$slots:{default:[Bn]},$$scope:{ctx:U}}}),nt=new Se({props:{title:"LayoutLMTokenizer",local:"transformers.LayoutLMTokenizer",headingTag:"h2"}}),mt=new H({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/vr_30929/src/transformers/models/layoutlm/tokenization_layoutlm.py#L54"}}),st=new H({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.LayoutLMTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = 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/vr_30929/src/transformers/models/layoutlm/tokenization_layoutlm.py#L184",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 H({props:{name:"convert_tokens_to_string",anchor:"transformers.LayoutLMTokenizer.convert_tokens_to_string",parameters:[{name:"tokens",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/layoutlm/tokenization_layoutlm.py#L179"}}),Q=new H({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.LayoutLMTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = 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/vr_30929/src/transformers/models/layoutlm/tokenization_layoutlm.py#L237",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>
`}}),_t=new At({props:{anchor:"transformers.LayoutLMTokenizer.create_token_type_ids_from_sequences.example",$$slots:{default:[Qn]},$$scope:{ctx:U}}}),at=new H({props:{name:"get_special_tokens_mask",anchor:"transformers.LayoutLMTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = 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/vr_30929/src/transformers/models/layoutlm/tokenization_layoutlm.py#L209",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>
`}}),me=new Se({props:{title:"LayoutLMTokenizerFast",local:"transformers.LayoutLMTokenizerFast",headingTag:"h2"}}),te=new H({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/vr_30929/src/transformers/models/layoutlm/tokenization_layoutlm_fast.py#L33"}}),Ie=new H({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/vr_30929/src/transformers/models/layoutlm/tokenization_layoutlm_fast.py#L118",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 H({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.LayoutLMTokenizerFast.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = 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/vr_30929/src/transformers/models/layoutlm/tokenization_layoutlm_fast.py#L142",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>
`}}),un=new At({props:{anchor:"transformers.LayoutLMTokenizerFast.create_token_type_ids_from_sequences.example",$$slots:{default:[Hn]},$$scope:{ctx:U}}}),mn=new Vn({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[_s],pytorch:[es]},$$scope:{ctx:U}}}),gn=new Wn({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/layoutlm.md"}}),{c(){e=c("meta"),g=r(),s=c("p"),a=r(),y(M.$$.fragment),t=r(),_=c("a"),E=r(),y(I.$$.fragment),x=r(),V=c("p"),V.innerHTML=z,$=r(),W=c("ul"),W.innerHTML=m,J=r(),se=c("p"),se.textContent=Je,Gt=r(),de=c("p"),de.innerHTML=Ot,De=r(),y(be.$$.fragment),he=r(),oe=c("ul"),oe.innerHTML=Xt,Ce=r(),y(rt.$$.fragment),Y=r(),fe=c("p"),fe.innerHTML=nn,lt=r(),y(ce.$$.fragment),Ye=r(),y(qe.$$.fragment),wt=r(),kt=c("p"),kt.textContent=It,Pe=r(),y(it.$$.fragment),ge=r(),Oe=c("ul"),Oe.innerHTML=pe,He=r(),y(X.$$.fragment),$e=r(),Lt=c("ul"),Lt.innerHTML=Ft,Ke=r(),y(dt.$$.fragment),ke=r(),ct=c("ul"),ct.innerHTML=jt,et=r(),A=c("p"),A.innerHTML=vt,Te=r(),_e=c("ul"),_e.innerHTML=sn,pt=r(),Ae=c("p"),Ae.textContent=on,Ge=r(),Ne=c("ul"),Ne.innerHTML=Ut,qt=r(),y(ae.$$.fragment),Nt=r(),F=c("div"),y(ue.$$.fragment),St=r(),Le=c("p"),Le.innerHTML=cn,Dt=r(),Me=c("p"),Me.innerHTML=an,tt=r(),y(je.$$.fragment),ut=r(),y(nt.$$.fragment),q=r(),N=c("div"),y(mt.$$.fragment),Ee=r(),Et=c("p"),Et.textContent=Kt,xe=r(),Rt=c("p"),Rt.innerHTML=ht,ft=r(),we=c("div"),y(st.$$.fragment),G=r(),Re=c("p"),Re.textContent=ze,Ze=r(),Zt=c("ul"),Zt.innerHTML=Vt,Wt=r(),gt=c("div"),y(ve.$$.fragment),Jt=r(),Ve=c("p"),Ve.textContent=Yt,P=r(),K=c("div"),y(Q.$$.fragment),We=r(),Bt=c("p"),Bt.textContent=Qt,Ht=r(),y(_t.$$.fragment),Ct=r(),ot=c("p"),ot.innerHTML=rn,$t=r(),Ue=c("div"),y(at.$$.fragment),h=r(),C=c("p"),C.innerHTML=S,re=r(),y(me.$$.fragment),ee=r(),B=c("div"),y(te.$$.fragment),le=r(),ie=c("p"),ie.innerHTML=ne,pn=r(),u=c("p"),u.innerHTML=v,Mt=r(),O=c("div"),y(Ie.$$.fragment),Fe=r(),Be=c("p"),Be.textContent=Qe,yt=r(),ye=c("ul"),ye.innerHTML=xt,Mn=r(),bt=c("div"),y(en.$$.fragment),yn=r(),ln=c("p"),ln.textContent=wn,Cn=r(),y(un.$$.fragment),$n=r(),bn=c("p"),bn.innerHTML=zn,Ln=r(),y(mn.$$.fragment),jn=r(),y(gn.$$.fragment),vn=r(),kn=c("p"),this.h()},l(n){const j=Zn("svelte-u9bgzb",document.head);e=p(j,"META",{name:!0,content:!0}),j.forEach(o),g=l(n),s=p(n,"P",{}),R(s).forEach(o),a=l(n),b(M.$$.fragment,n),t=l(n),_=p(n,"A",{id:!0}),R(_).forEach(o),E=l(n),b(I.$$.fragment,n),x=l(n),V=p(n,"P",{"data-svelte-h":!0}),f(V)!=="svelte-i3mer4"&&(V.innerHTML=z),$=l(n),W=p(n,"UL",{"data-svelte-h":!0}),f(W)!=="svelte-1x85dj3"&&(W.innerHTML=m),J=l(n),se=p(n,"P",{"data-svelte-h":!0}),f(se)!=="svelte-vfdo9a"&&(se.textContent=Je),Gt=l(n),de=p(n,"P",{"data-svelte-h":!0}),f(de)!=="svelte-f1ebc4"&&(de.innerHTML=Ot),De=l(n),b(be.$$.fragment,n),he=l(n),oe=p(n,"UL",{"data-svelte-h":!0}),f(oe)!=="svelte-17pl3rm"&&(oe.innerHTML=Xt),Ce=l(n),b(rt.$$.fragment,n),Y=l(n),fe=p(n,"P",{"data-svelte-h":!0}),f(fe)!=="svelte-rq1xjz"&&(fe.innerHTML=nn),lt=l(n),b(ce.$$.fragment,n),Ye=l(n),b(qe.$$.fragment,n),wt=l(n),kt=p(n,"P",{"data-svelte-h":!0}),f(kt)!=="svelte-gbqnu4"&&(kt.textContent=It),Pe=l(n),b(it.$$.fragment,n),ge=l(n),Oe=p(n,"UL",{"data-svelte-h":!0}),f(Oe)!=="svelte-vg3xzb"&&(Oe.innerHTML=pe),He=l(n),b(X.$$.fragment,n),$e=l(n),Lt=p(n,"UL",{"data-svelte-h":!0}),f(Lt)!=="svelte-10wsljn"&&(Lt.innerHTML=Ft),Ke=l(n),b(dt.$$.fragment,n),ke=l(n),ct=p(n,"UL",{"data-svelte-h":!0}),f(ct)!=="svelte-rjvoj7"&&(ct.innerHTML=jt),et=l(n),A=p(n,"P",{"data-svelte-h":!0}),f(A)!=="svelte-vy0wpy"&&(A.innerHTML=vt),Te=l(n),_e=p(n,"UL",{"data-svelte-h":!0}),f(_e)!=="svelte-1uvyu41"&&(_e.innerHTML=sn),pt=l(n),Ae=p(n,"P",{"data-svelte-h":!0}),f(Ae)!=="svelte-lk14e4"&&(Ae.textContent=on),Ge=l(n),Ne=p(n,"UL",{"data-svelte-h":!0}),f(Ne)!=="svelte-1or3vl3"&&(Ne.innerHTML=Ut),qt=l(n),b(ae.$$.fragment,n),Nt=l(n),F=p(n,"DIV",{class:!0});var Pt=R(F);b(ue.$$.fragment,Pt),St=l(Pt),Le=p(Pt,"P",{"data-svelte-h":!0}),f(Le)!=="svelte-qqwngv"&&(Le.innerHTML=cn),Dt=l(Pt),Me=p(Pt,"P",{"data-svelte-h":!0}),f(Me)!=="svelte-lbv5a3"&&(Me.innerHTML=an),tt=l(Pt),b(je.$$.fragment,Pt),Pt.forEach(o),ut=l(n),b(nt.$$.fragment,n),q=l(n),N=p(n,"DIV",{class:!0});var Xe=R(N);b(mt.$$.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-ng7ul1"&&(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 _n=R(gt);b(ve.$$.fragment,_n),Jt=l(_n),Ve=p(_n,"P",{"data-svelte-h":!0}),f(Ve)!=="svelte-b3k2yi"&&(Ve.textContent=Yt),_n.forEach(o),P=l(Xe),K=p(Xe,"DIV",{class:!0});var hn=R(K);b(Q.$$.fragment,hn),We=l(hn),Bt=p(hn,"P",{"data-svelte-h":!0}),f(Bt)!=="svelte-tq3kpx"&&(Bt.textContent=Qt),Ht=l(hn),b(_t.$$.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 Jn=R(Ue);b(at.$$.fragment,Jn),h=l(Jn),C=p(Jn,"P",{"data-svelte-h":!0}),f(C)!=="svelte-1f4f5kp"&&(C.innerHTML=S),Jn.forEach(o),Xe.forEach(o),re=l(n),b(me.$$.fragment,n),ee=l(n),B=p(n,"DIV",{class:!0});var tn=R(B);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),u=p(tn,"P",{"data-svelte-h":!0}),f(u)!=="svelte-1fi81bd"&&(u.innerHTML=v),Mt=l(tn),O=p(tn,"DIV",{class:!0});var Tn=R(O);b(Ie.$$.fragment,Tn),Fe=l(Tn),Be=p(Tn,"P",{"data-svelte-h":!0}),f(Be)!=="svelte-175z7u0"&&(Be.textContent=Qe),yt=l(Tn),ye=p(Tn,"UL",{"data-svelte-h":!0}),f(ye)!=="svelte-xi6653"&&(ye.innerHTML=xt),Tn.forEach(o),Mn=l(tn),bt=p(tn,"DIV",{class:!0});var fn=R(bt);b(en.$$.fragment,fn),yn=l(fn),ln=p(fn,"P",{"data-svelte-h":!0}),f(ln)!=="svelte-tq3kpx"&&(ln.textContent=wn),Cn=l(fn),b(un.$$.fragment,fn),$n=l(fn),bn=p(fn,"P",{"data-svelte-h":!0}),f(bn)!=="svelte-owoxgn"&&(bn.innerHTML=zn),fn.forEach(o),tn.forEach(o),Ln=l(n),b(mn.$$.fragment,n),jn=l(n),b(gn.$$.fragment,n),vn=l(n),kn=p(n,"P",{}),R(kn).forEach(o),this.h()},h(){Z(e,"name","hf:doc:metadata"),Z(e,"content",ys),Z(_,"id","Overview"),Z(F,"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(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(n,j){i(document.head,e),d(n,g,j),d(n,s,j),d(n,a,j),T(M,n,j),d(n,t,j),d(n,_,j),d(n,E,j),T(I,n,j),d(n,x,j),d(n,V,j),d(n,$,j),d(n,W,j),d(n,J,j),d(n,se,j),d(n,Gt,j),d(n,de,j),d(n,De,j),T(be,n,j),d(n,he,j),d(n,oe,j),d(n,Ce,j),T(rt,n,j),d(n,Y,j),d(n,fe,j),d(n,lt,j),T(ce,n,j),d(n,Ye,j),T(qe,n,j),d(n,wt,j),d(n,kt,j),d(n,Pe,j),T(it,n,j),d(n,ge,j),d(n,Oe,j),d(n,He,j),T(X,n,j),d(n,$e,j),d(n,Lt,j),d(n,Ke,j),T(dt,n,j),d(n,ke,j),d(n,ct,j),d(n,et,j),d(n,A,j),d(n,Te,j),d(n,_e,j),d(n,pt,j),d(n,Ae,j),d(n,Ge,j),d(n,Ne,j),d(n,qt,j),T(ae,n,j),d(n,Nt,j),d(n,F,j),T(ue,F,null),i(F,St),i(F,Le),i(F,Dt),i(F,Me),i(F,tt),T(je,F,null),d(n,ut,j),T(nt,n,j),d(n,q,j),d(n,N,j),T(mt,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(Q,K,null),i(K,We),i(K,Bt),i(K,Ht),T(_t,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(n,re,j),T(me,n,j),d(n,ee,j),d(n,B,j),T(te,B,null),i(B,le),i(B,ie),i(B,pn),i(B,u),i(B,Mt),i(B,O),T(Ie,O,null),i(O,Fe),i(O,Be),i(O,yt),i(O,ye),i(B,Mn),i(B,bt),T(en,bt,null),i(bt,yn),i(bt,ln),i(bt,Cn),T(un,bt,null),i(bt,$n),i(bt,bn),d(n,Ln,j),T(mn,n,j),d(n,jn,j),T(gn,n,j),d(n,vn,j),d(n,kn,j),Un=!0},p(n,[j]){const Pt={};j&2&&(Pt.$$scope={dirty:j,ctx:n}),je.$set(Pt);const Xe={};j&2&&(Xe.$$scope={dirty:j,ctx:n}),_t.$set(Xe);const dn={};j&2&&(dn.$$scope={dirty:j,ctx:n}),un.$set(dn);const _n={};j&2&&(_n.$$scope={dirty:j,ctx:n}),mn.$set(_n)},i(n){Un||(w(M.$$.fragment,n),w(I.$$.fragment,n),w(be.$$.fragment,n),w(rt.$$.fragment,n),w(ce.$$.fragment,n),w(qe.$$.fragment,n),w(it.$$.fragment,n),w(X.$$.fragment,n),w(dt.$$.fragment,n),w(ae.$$.fragment,n),w(ue.$$.fragment,n),w(je.$$.fragment,n),w(nt.$$.fragment,n),w(mt.$$.fragment,n),w(st.$$.fragment,n),w(ve.$$.fragment,n),w(Q.$$.fragment,n),w(_t.$$.fragment,n),w(at.$$.fragment,n),w(me.$$.fragment,n),w(te.$$.fragment,n),w(Ie.$$.fragment,n),w(en.$$.fragment,n),w(un.$$.fragment,n),w(mn.$$.fragment,n),w(gn.$$.fragment,n),Un=!0)},o(n){k(M.$$.fragment,n),k(I.$$.fragment,n),k(be.$$.fragment,n),k(rt.$$.fragment,n),k(ce.$$.fragment,n),k(qe.$$.fragment,n),k(it.$$.fragment,n),k(X.$$.fragment,n),k(dt.$$.fragment,n),k(ae.$$.fragment,n),k(ue.$$.fragment,n),k(je.$$.fragment,n),k(nt.$$.fragment,n),k(mt.$$.fragment,n),k(st.$$.fragment,n),k(ve.$$.fragment,n),k(Q.$$.fragment,n),k(_t.$$.fragment,n),k(at.$$.fragment,n),k(me.$$.fragment,n),k(te.$$.fragment,n),k(Ie.$$.fragment,n),k(en.$$.fragment,n),k(un.$$.fragment,n),k(mn.$$.fragment,n),k(gn.$$.fragment,n),Un=!1},d(n){n&&(o(g),o(s),o(a),o(t),o(_),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(He),o($e),o(Lt),o(Ke),o(ke),o(ct),o(et),o(A),o(Te),o(_e),o(pt),o(Ae),o(Ge),o(Ne),o(qt),o(Nt),o(F),o(ut),o(q),o(N),o(re),o(ee),o(B),o(Ln),o(jn),o(vn),o(kn)),o(e),L(M,n),L(I,n),L(be,n),L(rt,n),L(ce,n),L(qe,n),L(it,n),L(X,n),L(dt,n),L(ae,n),L(ue),L(je),L(nt,n),L(mt),L(st),L(ve),L(Q),L(_t),L(at),L(me,n),L(te),L(Ie),L(en),L(un),L(mn,n),L(gn,n)}}}const ys='{"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 bs(U){return qn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $s extends Nn{constructor(e){super(),Rn(this,e,bs,Ms,Fn,{})}}export{$s as component};
