import{s as pc,o as uc,n as F}from"../chunks/scheduler.9bc65507.js";import{S as mc,i as hc,g as s,s as l,u as y,A as fc,h as a,f as t,c as i,j as L,v as M,y as m,k as f,o as n,a as d,w as _,d as b,t as T,x as w}from"../chunks/index.78c82d43.js";import{T as Y}from"../chunks/Tip.87d55b76.js";import{D as $}from"../chunks/Docstring.4e7352e2.js";import{C as D}from"../chunks/CodeBlock.73e038be.js";import{I as Q}from"../chunks/IconCopyLink.bedaa44d.js";import{E as ne}from"../chunks/ExampleCodeBlock.872b014d.js";import{P as ui}from"../chunks/PipelineTag.75b0f707.js";function gc(U){let o,k="Examples:",u,p,v;return p=new D({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(){o=s("p"),o.textContent=k,u=l(),y(p.$$.fragment)},l(r){o=a(r,"P",{"data-svelte-h":!0}),m(o)!=="svelte-kvfsh7"&&(o.textContent=k),u=i(r),M(p.$$.fragment,r)},m(r,g){d(r,o,g),d(r,u,g),_(p,r,g),v=!0},p:F,i(r){v||(b(p.$$.fragment,r),v=!0)},o(r){T(p.$$.fragment,r),v=!1},d(r){r&&(t(o),t(u)),w(p,r)}}}function yc(U){let o,k="sequence pair mask has the following format:",u,p,v;return p=new D({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(){o=s("p"),o.textContent=k,u=l(),y(p.$$.fragment)},l(r){o=a(r,"P",{"data-svelte-h":!0}),m(o)!=="svelte-16klr56"&&(o.textContent=k),u=i(r),M(p.$$.fragment,r)},m(r,g){d(r,o,g),d(r,u,g),_(p,r,g),v=!0},p:F,i(r){v||(b(p.$$.fragment,r),v=!0)},o(r){T(p.$$.fragment,r),v=!1},d(r){r&&(t(o),t(u)),w(p,r)}}}function Mc(U){let o,k="sequence pair mask has the following format:",u,p,v;return p=new D({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(){o=s("p"),o.textContent=k,u=l(),y(p.$$.fragment)},l(r){o=a(r,"P",{"data-svelte-h":!0}),m(o)!=="svelte-16klr56"&&(o.textContent=k),u=i(r),M(p.$$.fragment,r)},m(r,g){d(r,o,g),d(r,u,g),_(p,r,g),v=!0},p:F,i(r){v||(b(p.$$.fragment,r),v=!0)},o(r){T(p.$$.fragment,r),v=!1},d(r){r&&(t(o),t(u)),w(p,r)}}}function _c(U){let o,k=`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(){o=s("p"),o.innerHTML=k},l(u){o=a(u,"P",{"data-svelte-h":!0}),m(o)!=="svelte-fincs2"&&(o.innerHTML=k)},m(u,p){d(u,o,p)},p:F,d(u){u&&t(o)}}}function bc(U){let o,k="Examples:",u,p,v;return p=new D({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(){o=s("p"),o.textContent=k,u=l(),y(p.$$.fragment)},l(r){o=a(r,"P",{"data-svelte-h":!0}),m(o)!=="svelte-kvfsh7"&&(o.textContent=k),u=i(r),M(p.$$.fragment,r)},m(r,g){d(r,o,g),d(r,u,g),_(p,r,g),v=!0},p:F,i(r){v||(b(p.$$.fragment,r),v=!0)},o(r){T(p.$$.fragment,r),v=!1},d(r){r&&(t(o),t(u)),w(p,r)}}}function Tc(U){let o,k=`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(){o=s("p"),o.innerHTML=k},l(u){o=a(u,"P",{"data-svelte-h":!0}),m(o)!=="svelte-fincs2"&&(o.innerHTML=k)},m(u,p){d(u,o,p)},p:F,d(u){u&&t(o)}}}function wc(U){let o,k="Examples:",u,p,v;return p=new D({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(){o=s("p"),o.textContent=k,u=l(),y(p.$$.fragment)},l(r){o=a(r,"P",{"data-svelte-h":!0}),m(o)!=="svelte-kvfsh7"&&(o.textContent=k),u=i(r),M(p.$$.fragment,r)},m(r,g){d(r,o,g),d(r,u,g),_(p,r,g),v=!0},p:F,i(r){v||(b(p.$$.fragment,r),v=!0)},o(r){T(p.$$.fragment,r),v=!1},d(r){r&&(t(o),t(u)),w(p,r)}}}function kc(U){let o,k=`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(){o=s("p"),o.innerHTML=k},l(u){o=a(u,"P",{"data-svelte-h":!0}),m(o)!=="svelte-fincs2"&&(o.innerHTML=k)},m(u,p){d(u,o,p)},p:F,d(u){u&&t(o)}}}function vc(U){let o,k="Examples:",u,p,v;return p=new D({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(){o=s("p"),o.textContent=k,u=l(),y(p.$$.fragment)},l(r){o=a(r,"P",{"data-svelte-h":!0}),m(o)!=="svelte-kvfsh7"&&(o.textContent=k),u=i(r),M(p.$$.fragment,r)},m(r,g){d(r,o,g),d(r,u,g),_(p,r,g),v=!0},p:F,i(r){v||(b(p.$$.fragment,r),v=!0)},o(r){T(p.$$.fragment,r),v=!1},d(r){r&&(t(o),t(u)),w(p,r)}}}function Lc(U){let o,k=`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(){o=s("p"),o.innerHTML=k},l(u){o=a(u,"P",{"data-svelte-h":!0}),m(o)!=="svelte-fincs2"&&(o.innerHTML=k)},m(u,p){d(u,o,p)},p:F,d(u){u&&t(o)}}}function jc(U){let o,k="Examples:",u,p,v;return p=new D({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(){o=s("p"),o.textContent=k,u=l(),y(p.$$.fragment)},l(r){o=a(r,"P",{"data-svelte-h":!0}),m(o)!=="svelte-kvfsh7"&&(o.textContent=k),u=i(r),M(p.$$.fragment,r)},m(r,g){d(r,o,g),d(r,u,g),_(p,r,g),v=!0},p:F,i(r){v||(b(p.$$.fragment,r),v=!0)},o(r){T(p.$$.fragment,r),v=!1},d(r){r&&(t(o),t(u)),w(p,r)}}}function Uc(U){let o,k;return o=new D({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(o.$$.fragment)},l(u){M(o.$$.fragment,u)},m(u,p){_(o,u,p),k=!0},p:F,i(u){k||(b(o.$$.fragment,u),k=!0)},o(u){T(o.$$.fragment,u),k=!1},d(u){w(o,u)}}}function Jc(U){let o,k="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",u,p,v="<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>",r,g,I=`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:`,z,J,R=`<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>`,x,C,q=`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(){o=s("p"),o.innerHTML=k,u=l(),p=s("ul"),p.innerHTML=v,r=l(),g=s("p"),g.innerHTML=I,z=l(),J=s("ul"),J.innerHTML=R,x=l(),C=s("p"),C.innerHTML=q},l(h){o=a(h,"P",{"data-svelte-h":!0}),m(o)!=="svelte-1ajbfxg"&&(o.innerHTML=k),u=i(h),p=a(h,"UL",{"data-svelte-h":!0}),m(p)!=="svelte-qm1t26"&&(p.innerHTML=v),r=i(h),g=a(h,"P",{"data-svelte-h":!0}),m(g)!=="svelte-1v9qsc5"&&(g.innerHTML=I),z=i(h),J=a(h,"UL",{"data-svelte-h":!0}),m(J)!=="svelte-15scerc"&&(J.innerHTML=R),x=i(h),C=a(h,"P",{"data-svelte-h":!0}),m(C)!=="svelte-1an3odd"&&(C.innerHTML=q)},m(h,j){d(h,o,j),d(h,u,j),d(h,p,j),d(h,r,j),d(h,g,j),d(h,z,j),d(h,J,j),d(h,x,j),d(h,C,j)},p:F,d(h){h&&(t(o),t(u),t(p),t(r),t(g),t(z),t(J),t(x),t(C))}}}function Cc(U){let o,k=`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(){o=s("p"),o.innerHTML=k},l(u){o=a(u,"P",{"data-svelte-h":!0}),m(o)!=="svelte-fincs2"&&(o.innerHTML=k)},m(u,p){d(u,o,p)},p:F,d(u){u&&t(o)}}}function xc(U){let o,k="Examples:",u,p,v;return p=new D({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(){o=s("p"),o.textContent=k,u=l(),y(p.$$.fragment)},l(r){o=a(r,"P",{"data-svelte-h":!0}),m(o)!=="svelte-kvfsh7"&&(o.textContent=k),u=i(r),M(p.$$.fragment,r)},m(r,g){d(r,o,g),d(r,u,g),_(p,r,g),v=!0},p:F,i(r){v||(b(p.$$.fragment,r),v=!0)},o(r){T(p.$$.fragment,r),v=!1},d(r){r&&(t(o),t(u)),w(p,r)}}}function $c(U){let o,k="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",u,p,v="<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>",r,g,I=`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:`,z,J,R=`<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>`,x,C,q=`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(){o=s("p"),o.innerHTML=k,u=l(),p=s("ul"),p.innerHTML=v,r=l(),g=s("p"),g.innerHTML=I,z=l(),J=s("ul"),J.innerHTML=R,x=l(),C=s("p"),C.innerHTML=q},l(h){o=a(h,"P",{"data-svelte-h":!0}),m(o)!=="svelte-1ajbfxg"&&(o.innerHTML=k),u=i(h),p=a(h,"UL",{"data-svelte-h":!0}),m(p)!=="svelte-qm1t26"&&(p.innerHTML=v),r=i(h),g=a(h,"P",{"data-svelte-h":!0}),m(g)!=="svelte-1v9qsc5"&&(g.innerHTML=I),z=i(h),J=a(h,"UL",{"data-svelte-h":!0}),m(J)!=="svelte-15scerc"&&(J.innerHTML=R),x=i(h),C=a(h,"P",{"data-svelte-h":!0}),m(C)!=="svelte-1an3odd"&&(C.innerHTML=q)},m(h,j){d(h,o,j),d(h,u,j),d(h,p,j),d(h,r,j),d(h,g,j),d(h,z,j),d(h,J,j),d(h,x,j),d(h,C,j)},p:F,d(h){h&&(t(o),t(u),t(p),t(r),t(g),t(z),t(J),t(x),t(C))}}}function zc(U){let o,k=`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(){o=s("p"),o.innerHTML=k},l(u){o=a(u,"P",{"data-svelte-h":!0}),m(o)!=="svelte-fincs2"&&(o.innerHTML=k)},m(u,p){d(u,o,p)},p:F,d(u){u&&t(o)}}}function Fc(U){let o,k="Examples:",u,p,v;return p=new D({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(){o=s("p"),o.textContent=k,u=l(),y(p.$$.fragment)},l(r){o=a(r,"P",{"data-svelte-h":!0}),m(o)!=="svelte-kvfsh7"&&(o.textContent=k),u=i(r),M(p.$$.fragment,r)},m(r,g){d(r,o,g),d(r,u,g),_(p,r,g),v=!0},p:F,i(r){v||(b(p.$$.fragment,r),v=!0)},o(r){T(p.$$.fragment,r),v=!1},d(r){r&&(t(o),t(u)),w(p,r)}}}function Ic(U){let o,k="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",u,p,v="<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>",r,g,I=`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:`,z,J,R=`<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>`,x,C,q=`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(){o=s("p"),o.innerHTML=k,u=l(),p=s("ul"),p.innerHTML=v,r=l(),g=s("p"),g.innerHTML=I,z=l(),J=s("ul"),J.innerHTML=R,x=l(),C=s("p"),C.innerHTML=q},l(h){o=a(h,"P",{"data-svelte-h":!0}),m(o)!=="svelte-1ajbfxg"&&(o.innerHTML=k),u=i(h),p=a(h,"UL",{"data-svelte-h":!0}),m(p)!=="svelte-qm1t26"&&(p.innerHTML=v),r=i(h),g=a(h,"P",{"data-svelte-h":!0}),m(g)!=="svelte-1v9qsc5"&&(g.innerHTML=I),z=i(h),J=a(h,"UL",{"data-svelte-h":!0}),m(J)!=="svelte-15scerc"&&(J.innerHTML=R),x=i(h),C=a(h,"P",{"data-svelte-h":!0}),m(C)!=="svelte-1an3odd"&&(C.innerHTML=q)},m(h,j){d(h,o,j),d(h,u,j),d(h,p,j),d(h,r,j),d(h,g,j),d(h,z,j),d(h,J,j),d(h,x,j),d(h,C,j)},p:F,d(h){h&&(t(o),t(u),t(p),t(r),t(g),t(z),t(J),t(x),t(C))}}}function qc(U){let o,k=`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(){o=s("p"),o.innerHTML=k},l(u){o=a(u,"P",{"data-svelte-h":!0}),m(o)!=="svelte-fincs2"&&(o.innerHTML=k)},m(u,p){d(u,o,p)},p:F,d(u){u&&t(o)}}}function Nc(U){let o,k="Examples:",u,p,v;return p=new D({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(){o=s("p"),o.textContent=k,u=l(),y(p.$$.fragment)},l(r){o=a(r,"P",{"data-svelte-h":!0}),m(o)!=="svelte-kvfsh7"&&(o.textContent=k),u=i(r),M(p.$$.fragment,r)},m(r,g){d(r,o,g),d(r,u,g),_(p,r,g),v=!0},p:F,i(r){v||(b(p.$$.fragment,r),v=!0)},o(r){T(p.$$.fragment,r),v=!1},d(r){r&&(t(o),t(u)),w(p,r)}}}function Rc(U){let o,k="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",u,p,v="<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>",r,g,I=`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:`,z,J,R=`<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>`,x,C,q=`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(){o=s("p"),o.innerHTML=k,u=l(),p=s("ul"),p.innerHTML=v,r=l(),g=s("p"),g.innerHTML=I,z=l(),J=s("ul"),J.innerHTML=R,x=l(),C=s("p"),C.innerHTML=q},l(h){o=a(h,"P",{"data-svelte-h":!0}),m(o)!=="svelte-1ajbfxg"&&(o.innerHTML=k),u=i(h),p=a(h,"UL",{"data-svelte-h":!0}),m(p)!=="svelte-qm1t26"&&(p.innerHTML=v),r=i(h),g=a(h,"P",{"data-svelte-h":!0}),m(g)!=="svelte-1v9qsc5"&&(g.innerHTML=I),z=i(h),J=a(h,"UL",{"data-svelte-h":!0}),m(J)!=="svelte-15scerc"&&(J.innerHTML=R),x=i(h),C=a(h,"P",{"data-svelte-h":!0}),m(C)!=="svelte-1an3odd"&&(C.innerHTML=q)},m(h,j){d(h,o,j),d(h,u,j),d(h,p,j),d(h,r,j),d(h,g,j),d(h,z,j),d(h,J,j),d(h,x,j),d(h,C,j)},p:F,d(h){h&&(t(o),t(u),t(p),t(r),t(g),t(z),t(J),t(x),t(C))}}}function Vc(U){let o,k=`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(){o=s("p"),o.innerHTML=k},l(u){o=a(u,"P",{"data-svelte-h":!0}),m(o)!=="svelte-fincs2"&&(o.innerHTML=k)},m(u,p){d(u,o,p)},p:F,d(u){u&&t(o)}}}function Zc(U){let o,k="Examples:",u,p,v;return p=new D({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(){o=s("p"),o.textContent=k,u=l(),y(p.$$.fragment)},l(r){o=a(r,"P",{"data-svelte-h":!0}),m(o)!=="svelte-kvfsh7"&&(o.textContent=k),u=i(r),M(p.$$.fragment,r)},m(r,g){d(r,o,g),d(r,u,g),_(p,r,g),v=!0},p:F,i(r){v||(b(p.$$.fragment,r),v=!0)},o(r){T(p.$$.fragment,r),v=!1},d(r){r&&(t(o),t(u)),w(p,r)}}}function Ac(U){let o,k="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",u,p,v="<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>",r,g,I=`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:`,z,J,R=`<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>`,x,C,q=`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(){o=s("p"),o.innerHTML=k,u=l(),p=s("ul"),p.innerHTML=v,r=l(),g=s("p"),g.innerHTML=I,z=l(),J=s("ul"),J.innerHTML=R,x=l(),C=s("p"),C.innerHTML=q},l(h){o=a(h,"P",{"data-svelte-h":!0}),m(o)!=="svelte-1ajbfxg"&&(o.innerHTML=k),u=i(h),p=a(h,"UL",{"data-svelte-h":!0}),m(p)!=="svelte-qm1t26"&&(p.innerHTML=v),r=i(h),g=a(h,"P",{"data-svelte-h":!0}),m(g)!=="svelte-1v9qsc5"&&(g.innerHTML=I),z=i(h),J=a(h,"UL",{"data-svelte-h":!0}),m(J)!=="svelte-15scerc"&&(J.innerHTML=R),x=i(h),C=a(h,"P",{"data-svelte-h":!0}),m(C)!=="svelte-1an3odd"&&(C.innerHTML=q)},m(h,j){d(h,o,j),d(h,u,j),d(h,p,j),d(h,r,j),d(h,g,j),d(h,z,j),d(h,J,j),d(h,x,j),d(h,C,j)},p:F,d(h){h&&(t(o),t(u),t(p),t(r),t(g),t(z),t(J),t(x),t(C))}}}function Wc(U){let o,k=`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(){o=s("p"),o.innerHTML=k},l(u){o=a(u,"P",{"data-svelte-h":!0}),m(o)!=="svelte-fincs2"&&(o.innerHTML=k)},m(u,p){d(u,o,p)},p:F,d(u){u&&t(o)}}}function Hc(U){let o,k="Examples:",u,p,v;return p=new D({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(){o=s("p"),o.textContent=k,u=l(),y(p.$$.fragment)},l(r){o=a(r,"P",{"data-svelte-h":!0}),m(o)!=="svelte-kvfsh7"&&(o.textContent=k),u=i(r),M(p.$$.fragment,r)},m(r,g){d(r,o,g),d(r,u,g),_(p,r,g),v=!0},p:F,i(r){v||(b(p.$$.fragment,r),v=!0)},o(r){T(p.$$.fragment,r),v=!1},d(r){r&&(t(o),t(u)),w(p,r)}}}function Ec(U){let o,k,u,p,v,r,g,I,z,J,R="LayoutLM",x,C,q,h,j,Us,Qt,rr,co,mi="Overview",ta,Bt,hi=`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:`,na,Gt,fi=`<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>`,oa,Xt,gi="The abstract from the paper is the following:",sa,St,yi=`<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>`,aa,Dt,Mi="Tips:",ra,Pt,_i=`<li>In addition to <em>input_ids</em>, <a href="/docs/transformers/v4.34.0/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>`,la,Yt,ia,Ot,bi=`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:`,da,Kt,ca,Je,Qe,Js,en,lr,po,Ti="Resources",pa,tn,wi="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.",ua,nn,ma,on,ki=`<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>`,ha,sn,fa,an,vi='<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>',ga,rn,ya,ln,Li='<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>',Ma,dn,ji="<strong>Other resources</strong>",_a,cn,Ui='<li><a href="../tasks/masked_language_modeling">Masked language modeling task guide</a></li>',ba,pn,Ji="🚀 Deploy",Ta,un,Ci='<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>',wa,Ce,Be,Cs,mn,ir,uo,xi="LayoutLMConfig",ka,O,hn,dr,mo,$i=`This is the configuration class to store the configuration of a <a href="/docs/transformers/v4.34.0/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.`,cr,ho,zi=`Configuration objects inherit from <a href="/docs/transformers/v4.34.0/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/v4.34.0/en/model_doc/bert#transformers.BertConfig">BertConfig</a> for more information.`,pr,Ge,va,xe,Xe,xs,fn,ur,fo,Fi="LayoutLMTokenizer",La,N,gn,mr,go,Ii="Construct a LayoutLM tokenizer. Based on WordPiece.",hr,yo,qi=`This tokenizer inherits from <a href="/docs/transformers/v4.34.0/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.`,fr,we,yn,gr,Mo,Ni=`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:`,yr,_o,Ri="<li>single sequence: <code>[CLS] X [SEP]</code></li> <li>pair of sequences: <code>[CLS] A [SEP] B [SEP]</code></li>",Mr,Se,Mn,_r,bo,Vi="Converts a sequence of tokens (string) in a single string.",br,oe,_n,Tr,To,Zi="Create a mask from the two sequences passed to be used in a sequence-pair classification task. A LayoutLM",wr,De,kr,wo,Ai="If <code>token_ids_1</code> is <code>None</code>, this method only returns the first portion of the mask (0s).",vr,Pe,bn,Lr,ko,Wi=`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.`,ja,$e,Ye,$s,Tn,jr,vo,Hi="LayoutLMTokenizerFast",Ua,B,wn,Ur,Lo,Ei="Construct a “fast” LayoutLM tokenizer (backed by HuggingFace’s <em>tokenizers</em> library). Based on WordPiece.",Jr,jo,Qi=`This tokenizer inherits from <a href="/docs/transformers/v4.34.0/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.`,Cr,ke,kn,xr,Uo,Bi=`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:`,$r,Jo,Gi="<li>single sequence: <code>[CLS] X [SEP]</code></li> <li>pair of sequences: <code>[CLS] A [SEP] B [SEP]</code></li>",zr,se,vn,Fr,Co,Xi="Create a mask from the two sequences passed to be used in a sequence-pair classification task. A LayoutLM",Ir,Oe,qr,xo,Si="If <code>token_ids_1</code> is <code>None</code>, this method only returns the first portion of the mask (0s).",Ja,ze,Ke,zs,Ln,Nr,$o,Di="LayoutLMModel",Ca,K,jn,Rr,zo,Pi=`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.`,Vr,Fo,Yi=`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.`,Zr,ae,Un,Ar,Io,Oi='The <a href="/docs/transformers/v4.34.0/en/model_doc/layoutlm#transformers.LayoutLMModel">LayoutLMModel</a> forward method, overrides the <code>__call__</code> special method.',Wr,et,Hr,tt,xa,Fe,nt,Fs,Jn,Er,qo,Ki="LayoutLMForMaskedLM",$a,ee,Cn,Qr,No,ed=`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.`,Br,Ro,td=`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.`,Gr,re,xn,Xr,Vo,nd='The <a href="/docs/transformers/v4.34.0/en/model_doc/layoutlm#transformers.LayoutLMForMaskedLM">LayoutLMForMaskedLM</a> forward method, overrides the <code>__call__</code> special method.',Sr,ot,Dr,st,za,Ie,at,Is,$n,Pr,Zo,od="LayoutLMForSequenceClassification",Fa,G,zn,Yr,Ao,sd=`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.`,Or,Wo,ad=`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.`,Kr,Ho,rd=`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.`,el,le,Fn,tl,Eo,ld='The <a href="/docs/transformers/v4.34.0/en/model_doc/layoutlm#transformers.LayoutLMForSequenceClassification">LayoutLMForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',nl,rt,ol,lt,Ia,qe,it,qs,In,sl,Qo,id="LayoutLMForTokenClassification",qa,X,qn,al,Bo,dd=`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.`,rl,Go,cd=`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.`,ll,Xo,pd=`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.`,il,ie,Nn,dl,So,ud='The <a href="/docs/transformers/v4.34.0/en/model_doc/layoutlm#transformers.LayoutLMForTokenClassification">LayoutLMForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',cl,dt,pl,ct,Na,Ne,pt,Ns,Rn,ul,Do,md="LayoutLMForQuestionAnswering",Ra,S,Vn,ml,Po,hd=`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>).`,hl,Yo,fd=`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.`,fl,Oo,gd=`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.`,gl,P,Zn,yl,Ko,yd=`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.`,Ml,es,Md="Example:",_l,ts,_d=`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).`,bl,ut,Va,Re,mt,Rs,An,Tl,ns,bd="TFLayoutLMModel",Za,V,Wn,wl,os,Td="The bare LayoutLM Model transformer outputting raw hidden-states without any specific head on top.",kl,ss,wd=`This model inherits from <a href="/docs/transformers/v4.34.0/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.)`,vl,as,kd=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,Ll,ht,jl,de,Hn,Ul,rs,vd='The <a href="/docs/transformers/v4.34.0/en/model_doc/layoutlm#transformers.TFLayoutLMModel">TFLayoutLMModel</a> forward method, overrides the <code>__call__</code> special method.',Jl,ft,Cl,gt,Aa,Ve,yt,Vs,En,xl,ls,Ld="TFLayoutLMForMaskedLM",Wa,Z,Qn,$l,is,jd="LayoutLM Model with a <code>language modeling</code> head on top.",zl,ds,Ud=`This model inherits from <a href="/docs/transformers/v4.34.0/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.)`,Fl,cs,Jd=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,Il,Mt,ql,ce,Bn,Nl,ps,Cd='The <a href="/docs/transformers/v4.34.0/en/model_doc/layoutlm#transformers.TFLayoutLMForMaskedLM">TFLayoutLMForMaskedLM</a> forward method, overrides the <code>__call__</code> special method.',Rl,_t,Vl,bt,Ha,Ze,Tt,Zs,Gn,Zl,us,xd="TFLayoutLMForSequenceClassification",Ea,A,Xn,Al,ms,$d=`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.`,Wl,hs,zd=`This model inherits from <a href="/docs/transformers/v4.34.0/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.)`,Hl,fs,Fd=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,El,wt,Ql,pe,Sn,Bl,gs,Id='The <a href="/docs/transformers/v4.34.0/en/model_doc/layoutlm#transformers.TFLayoutLMForSequenceClassification">TFLayoutLMForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',Gl,kt,Xl,vt,Qa,Ae,Lt,As,Dn,Sl,ys,qd="TFLayoutLMForTokenClassification",Ba,W,Pn,Dl,Ms,Nd=`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.`,Pl,_s,Rd=`This model inherits from <a href="/docs/transformers/v4.34.0/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.)`,Yl,bs,Vd=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,Ol,jt,Kl,ue,Yn,ei,Ts,Zd='The <a href="/docs/transformers/v4.34.0/en/model_doc/layoutlm#transformers.TFLayoutLMForTokenClassification">TFLayoutLMForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',ti,Ut,ni,Jt,Ga,We,Ct,Ws,On,oi,ws,Ad="TFLayoutLMForQuestionAnswering",Xa,H,Kn,si,ks,Wd=`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>).`,ai,vs,Hd=`This model inherits from <a href="/docs/transformers/v4.34.0/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.)`,ri,Ls,Ed=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,li,xt,ii,me,eo,di,js,Qd='The <a href="/docs/transformers/v4.34.0/en/model_doc/layoutlm#transformers.TFLayoutLMForQuestionAnswering">TFLayoutLMForQuestionAnswering</a> forward method, overrides the <code>__call__</code> special method.',ci,$t,pi,zt,Sa,Hs,Da;return I=new Q({}),Qt=new Q({}),Yt=new D({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}}),Kt=new D({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}}),en=new Q({}),nn=new ui({props:{pipeline:"document-question-answering"}}),sn=new ui({props:{pipeline:"text-classification"}}),rn=new ui({props:{pipeline:"token-classification"}}),mn=new Q({}),hn=new $({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/v4.34.0/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/v4.34.0/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.classifier_dropout",description:`<strong>classifier_dropout</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The dropout ratio for the classification head.`,name:"classifier_dropout"},{anchor:"transformers.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/v4.34.0/src/transformers/models/layoutlm/configuration_layoutlm.py#L36"}}),Ge=new ne({props:{anchor:"transformers.LayoutLMConfig.example",$$slots:{default:[gc]},$$scope:{ctx:U}}}),fn=new Q({}),gn=new $({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/v4.34.0/src/transformers/models/layoutlm/tokenization_layoutlm.py#L75"}}),yn=new $({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.LayoutLMTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.LayoutLMTokenizer.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.LayoutLMTokenizer.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/layoutlm/tokenization_layoutlm.py#L208",returnDescription:`
<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Mn=new $({props:{name:"convert_tokens_to_string",anchor:"transformers.LayoutLMTokenizer.convert_tokens_to_string",parameters:[{name:"tokens",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/layoutlm/tokenization_layoutlm.py#L203"}}),_n=new $({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.LayoutLMTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.LayoutLMTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.LayoutLMTokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/layoutlm/tokenization_layoutlm.py#L261",returnDescription:`
<p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),De=new ne({props:{anchor:"transformers.LayoutLMTokenizer.create_token_type_ids_from_sequences.example",$$slots:{default:[yc]},$$scope:{ctx:U}}}),bn=new $({props:{name:"get_special_tokens_mask",anchor:"transformers.LayoutLMTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.LayoutLMTokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.LayoutLMTokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.LayoutLMTokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/layoutlm/tokenization_layoutlm.py#L233",returnDescription:`
<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Tn=new Q({}),wn=new $({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/v4.34.0/src/transformers/models/layoutlm/tokenization_layoutlm_fast.py#L62"}}),kn=new $({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/v4.34.0/src/transformers/models/layoutlm/tokenization_layoutlm_fast.py#L150",returnDescription:`
<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),vn=new $({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.LayoutLMTokenizerFast.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.LayoutLMTokenizerFast.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.LayoutLMTokenizerFast.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/layoutlm/tokenization_layoutlm_fast.py#L174",returnDescription:`
<p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Oe=new ne({props:{anchor:"transformers.LayoutLMTokenizerFast.create_token_type_ids_from_sequences.example",$$slots:{default:[Mc]},$$scope:{ctx:U}}}),Ln=new Q({}),jn=new $({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/v4.34.0/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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L712"}}),Un=new $({props:{name:"forward",anchor:"transformers.LayoutLMModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LayoutLMModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__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/v4.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L738",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/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/v4.34.0/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:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),et=new Y({props:{$$slots:{default:[_c]},$$scope:{ctx:U}}}),tt=new ne({props:{anchor:"transformers.LayoutLMModel.forward.example",$$slots:{default:[bc]},$$scope:{ctx:U}}}),Jn=new Q({}),Cn=new $({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/v4.34.0/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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L861"}}),xn=new $({props:{name:"forward",anchor:"transformers.LayoutLMForMaskedLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LayoutLMForMaskedLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L882",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/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/v4.34.0/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:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ot=new Y({props:{$$slots:{default:[Tc]},$$scope:{ctx:U}}}),st=new ne({props:{anchor:"transformers.LayoutLMForMaskedLM.forward.example",$$slots:{default:[wc]},$$scope:{ctx:U}}}),$n=new Q({}),zn=new $({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/v4.34.0/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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L992"}}),Fn=new $({props:{name:"forward",anchor:"transformers.LayoutLMForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LayoutLMForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L1006",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/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/v4.34.0/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:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),rt=new Y({props:{$$slots:{default:[kc]},$$scope:{ctx:U}}}),lt=new ne({props:{anchor:"transformers.LayoutLMForSequenceClassification.forward.example",$$slots:{default:[vc]},$$scope:{ctx:U}}}),In=new Q({}),qn=new $({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/v4.34.0/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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L1129"}}),Nn=new $({props:{name:"forward",anchor:"transformers.LayoutLMForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.LayoutLMForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L1143",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/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/v4.34.0/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:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),dt=new Y({props:{$$slots:{default:[Lc]},$$scope:{ctx:U}}}),ct=new ne({props:{anchor:"transformers.LayoutLMForTokenClassification.forward.example",$$slots:{default:[jc]},$$scope:{ctx:U}}}),Rn=new Q({}),Vn=new $({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/v4.34.0/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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L1247"}}),Zn=new $({props:{name:"forward",anchor:"transformers.LayoutLMForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"end_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L1261",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/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/v4.34.0/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:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ut=new ne({props:{anchor:"transformers.LayoutLMForQuestionAnswering.forward.example",$$slots:{default:[Uc]},$$scope:{ctx:U}}}),An=new Q({}),Wn=new $({props:{name:"class transformers.TFLayoutLMModel",anchor:"transformers.TFLayoutLMModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.34.0/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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L912"}}),ht=new Y({props:{$$slots:{default:[Jc]},$$scope:{ctx:U}}}),Hn=new $({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/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMModel.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMModel.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMModel.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMModel.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L918",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/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/v4.34.0/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:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions</a> or <code>tuple(tf.Tensor)</code></p>
`}}),ft=new Y({props:{$$slots:{default:[Cc]},$$scope:{ctx:U}}}),gt=new ne({props:{anchor:"transformers.TFLayoutLMModel.call.example",$$slots:{default:[xc]},$$scope:{ctx:U}}}),En=new Q({}),Qn=new $({props:{name:"class transformers.TFLayoutLMForMaskedLM",anchor:"transformers.TFLayoutLMForMaskedLM",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.34.0/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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L991"}}),Mt=new Y({props:{$$slots:{default:[$c]},$$scope:{ctx:U}}}),Bn=new $({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/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1019",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/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/v4.34.0/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:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_tf_outputs.TFMaskedLMOutput"
>transformers.modeling_tf_outputs.TFMaskedLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),_t=new Y({props:{$$slots:{default:[zc]},$$scope:{ctx:U}}}),bt=new ne({props:{anchor:"transformers.TFLayoutLMForMaskedLM.call.example",$$slots:{default:[Fc]},$$scope:{ctx:U}}}),Gn=new Q({}),Xn=new $({props:{name:"class transformers.TFLayoutLMForSequenceClassification",anchor:"transformers.TFLayoutLMForSequenceClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.34.0/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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1118"}}),wt=new Y({props:{$$slots:{default:[Ic]},$$scope:{ctx:U}}}),Sn=new $({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/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1136",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/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/v4.34.0/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:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),kt=new Y({props:{$$slots:{default:[qc]},$$scope:{ctx:U}}}),vt=new ne({props:{anchor:"transformers.TFLayoutLMForSequenceClassification.call.example",$$slots:{default:[Nc]},$$scope:{ctx:U}}}),Dn=new Q({}),Pn=new $({props:{name:"class transformers.TFLayoutLMForTokenClassification",anchor:"transformers.TFLayoutLMForTokenClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.34.0/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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1236"}}),jt=new Y({props:{$$slots:{default:[Rc]},$$scope:{ctx:U}}}),Yn=new $({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/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1260",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/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/v4.34.0/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:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_tf_outputs.TFTokenClassifierOutput"
>transformers.modeling_tf_outputs.TFTokenClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Ut=new Y({props:{$$slots:{default:[Vc]},$$scope:{ctx:U}}}),Jt=new ne({props:{anchor:"transformers.TFLayoutLMForTokenClassification.call.example",$$slots:{default:[Zc]},$$scope:{ctx:U}}}),On=new Q({}),Kn=new $({props:{name:"class transformers.TFLayoutLMForQuestionAnswering",anchor:"transformers.TFLayoutLMForQuestionAnswering",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLayoutLMForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.34.0/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/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1359"}}),xt=new Y({props:{$$slots:{default:[Ac]},$$scope:{ctx:U}}}),eo=new $({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/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.34.0/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/v4.34.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1380",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/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/v4.34.0/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:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput"
>transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),$t=new Y({props:{$$slots:{default:[Wc]},$$scope:{ctx:U}}}),zt=new ne({props:{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.example",$$slots:{default:[Hc]},$$scope:{ctx:U}}}),{c(){o=s("meta"),k=l(),u=s("p"),p=l(),v=s("h1"),r=s("a"),g=s("span"),y(I.$$.fragment),z=l(),J=s("span"),J.textContent=R,x=l(),C=s("a"),q=l(),h=s("h2"),j=s("a"),Us=s("span"),y(Qt.$$.fragment),rr=l(),co=s("span"),co.textContent=mi,ta=l(),Bt=s("p"),Bt.innerHTML=hi,na=l(),Gt=s("ul"),Gt.innerHTML=fi,oa=l(),Xt=s("p"),Xt.textContent=gi,sa=l(),St=s("p"),St.innerHTML=yi,aa=l(),Dt=s("p"),Dt.textContent=Mi,ra=l(),Pt=s("ul"),Pt.innerHTML=_i,la=l(),y(Yt.$$.fragment),ia=l(),Ot=s("p"),Ot.innerHTML=bi,da=l(),y(Kt.$$.fragment),ca=l(),Je=s("h2"),Qe=s("a"),Js=s("span"),y(en.$$.fragment),lr=l(),po=s("span"),po.textContent=Ti,pa=l(),tn=s("p"),tn.textContent=wi,ua=l(),y(nn.$$.fragment),ma=l(),on=s("ul"),on.innerHTML=ki,ha=l(),y(sn.$$.fragment),fa=l(),an=s("ul"),an.innerHTML=vi,ga=l(),y(rn.$$.fragment),ya=l(),ln=s("ul"),ln.innerHTML=Li,Ma=l(),dn=s("p"),dn.innerHTML=ji,_a=l(),cn=s("ul"),cn.innerHTML=Ui,ba=l(),pn=s("p"),pn.textContent=Ji,Ta=l(),un=s("ul"),un.innerHTML=Ci,wa=l(),Ce=s("h2"),Be=s("a"),Cs=s("span"),y(mn.$$.fragment),ir=l(),uo=s("span"),uo.textContent=xi,ka=l(),O=s("div"),y(hn.$$.fragment),dr=l(),mo=s("p"),mo.innerHTML=$i,cr=l(),ho=s("p"),ho.innerHTML=zi,pr=l(),y(Ge.$$.fragment),va=l(),xe=s("h2"),Xe=s("a"),xs=s("span"),y(fn.$$.fragment),ur=l(),fo=s("span"),fo.textContent=Fi,La=l(),N=s("div"),y(gn.$$.fragment),mr=l(),go=s("p"),go.textContent=Ii,hr=l(),yo=s("p"),yo.innerHTML=qi,fr=l(),we=s("div"),y(yn.$$.fragment),gr=l(),Mo=s("p"),Mo.textContent=Ni,yr=l(),_o=s("ul"),_o.innerHTML=Ri,Mr=l(),Se=s("div"),y(Mn.$$.fragment),_r=l(),bo=s("p"),bo.textContent=Vi,br=l(),oe=s("div"),y(_n.$$.fragment),Tr=l(),To=s("p"),To.textContent=Zi,wr=l(),y(De.$$.fragment),kr=l(),wo=s("p"),wo.innerHTML=Ai,vr=l(),Pe=s("div"),y(bn.$$.fragment),Lr=l(),ko=s("p"),ko.innerHTML=Wi,ja=l(),$e=s("h2"),Ye=s("a"),$s=s("span"),y(Tn.$$.fragment),jr=l(),vo=s("span"),vo.textContent=Hi,Ua=l(),B=s("div"),y(wn.$$.fragment),Ur=l(),Lo=s("p"),Lo.innerHTML=Ei,Jr=l(),jo=s("p"),jo.innerHTML=Qi,Cr=l(),ke=s("div"),y(kn.$$.fragment),xr=l(),Uo=s("p"),Uo.textContent=Bi,$r=l(),Jo=s("ul"),Jo.innerHTML=Gi,zr=l(),se=s("div"),y(vn.$$.fragment),Fr=l(),Co=s("p"),Co.textContent=Xi,Ir=l(),y(Oe.$$.fragment),qr=l(),xo=s("p"),xo.innerHTML=Si,Ja=l(),ze=s("h2"),Ke=s("a"),zs=s("span"),y(Ln.$$.fragment),Nr=l(),$o=s("span"),$o.textContent=Di,Ca=l(),K=s("div"),y(jn.$$.fragment),Rr=l(),zo=s("p"),zo.innerHTML=Pi,Vr=l(),Fo=s("p"),Fo.innerHTML=Yi,Zr=l(),ae=s("div"),y(Un.$$.fragment),Ar=l(),Io=s("p"),Io.innerHTML=Oi,Wr=l(),y(et.$$.fragment),Hr=l(),y(tt.$$.fragment),xa=l(),Fe=s("h2"),nt=s("a"),Fs=s("span"),y(Jn.$$.fragment),Er=l(),qo=s("span"),qo.textContent=Ki,$a=l(),ee=s("div"),y(Cn.$$.fragment),Qr=l(),No=s("p"),No.innerHTML=ed,Br=l(),Ro=s("p"),Ro.innerHTML=td,Gr=l(),re=s("div"),y(xn.$$.fragment),Xr=l(),Vo=s("p"),Vo.innerHTML=nd,Sr=l(),y(ot.$$.fragment),Dr=l(),y(st.$$.fragment),za=l(),Ie=s("h2"),at=s("a"),Is=s("span"),y($n.$$.fragment),Pr=l(),Zo=s("span"),Zo.textContent=od,Fa=l(),G=s("div"),y(zn.$$.fragment),Yr=l(),Ao=s("p"),Ao.innerHTML=sd,Or=l(),Wo=s("p"),Wo.innerHTML=ad,Kr=l(),Ho=s("p"),Ho.innerHTML=rd,el=l(),le=s("div"),y(Fn.$$.fragment),tl=l(),Eo=s("p"),Eo.innerHTML=ld,nl=l(),y(rt.$$.fragment),ol=l(),y(lt.$$.fragment),Ia=l(),qe=s("h2"),it=s("a"),qs=s("span"),y(In.$$.fragment),sl=l(),Qo=s("span"),Qo.textContent=id,qa=l(),X=s("div"),y(qn.$$.fragment),al=l(),Bo=s("p"),Bo.innerHTML=dd,rl=l(),Go=s("p"),Go.innerHTML=cd,ll=l(),Xo=s("p"),Xo.innerHTML=pd,il=l(),ie=s("div"),y(Nn.$$.fragment),dl=l(),So=s("p"),So.innerHTML=ud,cl=l(),y(dt.$$.fragment),pl=l(),y(ct.$$.fragment),Na=l(),Ne=s("h2"),pt=s("a"),Ns=s("span"),y(Rn.$$.fragment),ul=l(),Do=s("span"),Do.textContent=md,Ra=l(),S=s("div"),y(Vn.$$.fragment),ml=l(),Po=s("p"),Po.innerHTML=hd,hl=l(),Yo=s("p"),Yo.innerHTML=fd,fl=l(),Oo=s("p"),Oo.innerHTML=gd,gl=l(),P=s("div"),y(Zn.$$.fragment),yl=l(),Ko=s("p"),Ko.innerHTML=yd,Ml=l(),es=s("p"),es.textContent=Md,_l=l(),ts=s("p"),ts.textContent=_d,bl=l(),y(ut.$$.fragment),Va=l(),Re=s("h2"),mt=s("a"),Rs=s("span"),y(An.$$.fragment),Tl=l(),ns=s("span"),ns.textContent=bd,Za=l(),V=s("div"),y(Wn.$$.fragment),wl=l(),os=s("p"),os.textContent=Td,kl=l(),ss=s("p"),ss.innerHTML=wd,vl=l(),as=s("p"),as.innerHTML=kd,Ll=l(),y(ht.$$.fragment),jl=l(),de=s("div"),y(Hn.$$.fragment),Ul=l(),rs=s("p"),rs.innerHTML=vd,Jl=l(),y(ft.$$.fragment),Cl=l(),y(gt.$$.fragment),Aa=l(),Ve=s("h2"),yt=s("a"),Vs=s("span"),y(En.$$.fragment),xl=l(),ls=s("span"),ls.textContent=Ld,Wa=l(),Z=s("div"),y(Qn.$$.fragment),$l=l(),is=s("p"),is.innerHTML=jd,zl=l(),ds=s("p"),ds.innerHTML=Ud,Fl=l(),cs=s("p"),cs.innerHTML=Jd,Il=l(),y(Mt.$$.fragment),ql=l(),ce=s("div"),y(Bn.$$.fragment),Nl=l(),ps=s("p"),ps.innerHTML=Cd,Rl=l(),y(_t.$$.fragment),Vl=l(),y(bt.$$.fragment),Ha=l(),Ze=s("h2"),Tt=s("a"),Zs=s("span"),y(Gn.$$.fragment),Zl=l(),us=s("span"),us.textContent=xd,Ea=l(),A=s("div"),y(Xn.$$.fragment),Al=l(),ms=s("p"),ms.textContent=$d,Wl=l(),hs=s("p"),hs.innerHTML=zd,Hl=l(),fs=s("p"),fs.innerHTML=Fd,El=l(),y(wt.$$.fragment),Ql=l(),pe=s("div"),y(Sn.$$.fragment),Bl=l(),gs=s("p"),gs.innerHTML=Id,Gl=l(),y(kt.$$.fragment),Xl=l(),y(vt.$$.fragment),Qa=l(),Ae=s("h2"),Lt=s("a"),As=s("span"),y(Dn.$$.fragment),Sl=l(),ys=s("span"),ys.textContent=qd,Ba=l(),W=s("div"),y(Pn.$$.fragment),Dl=l(),Ms=s("p"),Ms.textContent=Nd,Pl=l(),_s=s("p"),_s.innerHTML=Rd,Yl=l(),bs=s("p"),bs.innerHTML=Vd,Ol=l(),y(jt.$$.fragment),Kl=l(),ue=s("div"),y(Yn.$$.fragment),ei=l(),Ts=s("p"),Ts.innerHTML=Zd,ti=l(),y(Ut.$$.fragment),ni=l(),y(Jt.$$.fragment),Ga=l(),We=s("h2"),Ct=s("a"),Ws=s("span"),y(On.$$.fragment),oi=l(),ws=s("span"),ws.textContent=Ad,Xa=l(),H=s("div"),y(Kn.$$.fragment),si=l(),ks=s("p"),ks.innerHTML=Wd,ai=l(),vs=s("p"),vs.innerHTML=Hd,ri=l(),Ls=s("p"),Ls.innerHTML=Ed,li=l(),y(xt.$$.fragment),ii=l(),me=s("div"),y(eo.$$.fragment),di=l(),js=s("p"),js.innerHTML=Qd,ci=l(),y($t.$$.fragment),pi=l(),y(zt.$$.fragment),Sa=l(),Hs=s("p"),this.h()},l(e){const c=fc("svelte-1phssyn",document.head);o=a(c,"META",{name:!0,content:!0}),c.forEach(t),k=i(e),u=a(e,"P",{}),L(u).forEach(t),p=i(e),v=a(e,"H1",{class:!0});var to=L(v);r=a(to,"A",{id:!0,class:!0,href:!0});var Es=L(r);g=a(Es,"SPAN",{});var Qs=L(g);M(I.$$.fragment,Qs),Qs.forEach(t),Es.forEach(t),z=i(to),J=a(to,"SPAN",{"data-svelte-h":!0}),m(J)!=="svelte-qtayq"&&(J.textContent=R),to.forEach(t),x=i(e),C=a(e,"A",{id:!0}),L(C).forEach(t),q=i(e),h=a(e,"H2",{class:!0});var no=L(h);j=a(no,"A",{id:!0,class:!0,href:!0});var Bs=L(j);Us=a(Bs,"SPAN",{});var Gs=L(Us);M(Qt.$$.fragment,Gs),Gs.forEach(t),Bs.forEach(t),rr=i(no),co=a(no,"SPAN",{"data-svelte-h":!0}),m(co)!=="svelte-1jsw1pg"&&(co.textContent=mi),no.forEach(t),ta=i(e),Bt=a(e,"P",{"data-svelte-h":!0}),m(Bt)!=="svelte-i3mer4"&&(Bt.innerHTML=hi),na=i(e),Gt=a(e,"UL",{"data-svelte-h":!0}),m(Gt)!=="svelte-1x85dj3"&&(Gt.innerHTML=fi),oa=i(e),Xt=a(e,"P",{"data-svelte-h":!0}),m(Xt)!=="svelte-vfdo9a"&&(Xt.textContent=gi),sa=i(e),St=a(e,"P",{"data-svelte-h":!0}),m(St)!=="svelte-f1ebc4"&&(St.innerHTML=yi),aa=i(e),Dt=a(e,"P",{"data-svelte-h":!0}),m(Dt)!=="svelte-axv494"&&(Dt.textContent=Mi),ra=i(e),Pt=a(e,"UL",{"data-svelte-h":!0}),m(Pt)!=="svelte-1pm884p"&&(Pt.innerHTML=_i),la=i(e),M(Yt.$$.fragment,e),ia=i(e),Ot=a(e,"P",{"data-svelte-h":!0}),m(Ot)!=="svelte-rq1xjz"&&(Ot.innerHTML=bi),da=i(e),M(Kt.$$.fragment,e),ca=i(e),Je=a(e,"H2",{class:!0});var oo=L(Je);Qe=a(oo,"A",{id:!0,class:!0,href:!0});var Xs=L(Qe);Js=a(Xs,"SPAN",{});var Ss=L(Js);M(en.$$.fragment,Ss),Ss.forEach(t),Xs.forEach(t),lr=i(oo),po=a(oo,"SPAN",{"data-svelte-h":!0}),m(po)!=="svelte-w4zzv6"&&(po.textContent=Ti),oo.forEach(t),pa=i(e),tn=a(e,"P",{"data-svelte-h":!0}),m(tn)!=="svelte-gbqnu4"&&(tn.textContent=wi),ua=i(e),M(nn.$$.fragment,e),ma=i(e),on=a(e,"UL",{"data-svelte-h":!0}),m(on)!=="svelte-vg3xzb"&&(on.innerHTML=ki),ha=i(e),M(sn.$$.fragment,e),fa=i(e),an=a(e,"UL",{"data-svelte-h":!0}),m(an)!=="svelte-10wsljn"&&(an.innerHTML=vi),ga=i(e),M(rn.$$.fragment,e),ya=i(e),ln=a(e,"UL",{"data-svelte-h":!0}),m(ln)!=="svelte-rjvoj7"&&(ln.innerHTML=Li),Ma=i(e),dn=a(e,"P",{"data-svelte-h":!0}),m(dn)!=="svelte-vy0wpy"&&(dn.innerHTML=ji),_a=i(e),cn=a(e,"UL",{"data-svelte-h":!0}),m(cn)!=="svelte-1uvyu41"&&(cn.innerHTML=Ui),ba=i(e),pn=a(e,"P",{"data-svelte-h":!0}),m(pn)!=="svelte-lk14e4"&&(pn.textContent=Ji),Ta=i(e),un=a(e,"UL",{"data-svelte-h":!0}),m(un)!=="svelte-1or3vl3"&&(un.innerHTML=Ci),wa=i(e),Ce=a(e,"H2",{class:!0});var so=L(Ce);Be=a(so,"A",{id:!0,class:!0,href:!0});var Ds=L(Be);Cs=a(Ds,"SPAN",{});var Ps=L(Cs);M(mn.$$.fragment,Ps),Ps.forEach(t),Ds.forEach(t),ir=i(so),uo=a(so,"SPAN",{"data-svelte-h":!0}),m(uo)!=="svelte-fm2cys"&&(uo.textContent=xi),so.forEach(t),ka=i(e),O=a(e,"DIV",{class:!0});var _e=L(O);M(hn.$$.fragment,_e),dr=i(_e),mo=a(_e,"P",{"data-svelte-h":!0}),m(mo)!=="svelte-ebtnz4"&&(mo.innerHTML=$i),cr=i(_e),ho=a(_e,"P",{"data-svelte-h":!0}),m(ho)!=="svelte-1noo363"&&(ho.innerHTML=zi),pr=i(_e),M(Ge.$$.fragment,_e),_e.forEach(t),va=i(e),xe=a(e,"H2",{class:!0});var ao=L(xe);Xe=a(ao,"A",{id:!0,class:!0,href:!0});var Ys=L(Xe);xs=a(Ys,"SPAN",{});var Os=L(xs);M(fn.$$.fragment,Os),Os.forEach(t),Ys.forEach(t),ur=i(ao),fo=a(ao,"SPAN",{"data-svelte-h":!0}),m(fo)!=="svelte-1oo7mhx"&&(fo.textContent=Fi),ao.forEach(t),La=i(e),N=a(e,"DIV",{class:!0});var E=L(N);M(gn.$$.fragment,E),mr=i(E),go=a(E,"P",{"data-svelte-h":!0}),m(go)!=="svelte-10n506g"&&(go.textContent=Ii),hr=i(E),yo=a(E,"P",{"data-svelte-h":!0}),m(yo)!=="svelte-1b0fouy"&&(yo.innerHTML=qi),fr=i(E),we=a(E,"DIV",{class:!0});var He=L(we);M(yn.$$.fragment,He),gr=i(He),Mo=a(He,"P",{"data-svelte-h":!0}),m(Mo)!=="svelte-175z7u0"&&(Mo.textContent=Ni),yr=i(He),_o=a(He,"UL",{"data-svelte-h":!0}),m(_o)!=="svelte-xi6653"&&(_o.innerHTML=Ri),He.forEach(t),Mr=i(E),Se=a(E,"DIV",{class:!0});var ro=L(Se);M(Mn.$$.fragment,ro),_r=i(ro),bo=a(ro,"P",{"data-svelte-h":!0}),m(bo)!=="svelte-b3k2yi"&&(bo.textContent=Vi),ro.forEach(t),br=i(E),oe=a(E,"DIV",{class:!0});var be=L(oe);M(_n.$$.fragment,be),Tr=i(be),To=a(be,"P",{"data-svelte-h":!0}),m(To)!=="svelte-rcct5a"&&(To.textContent=Zi),wr=i(be),M(De.$$.fragment,be),kr=i(be),wo=a(be,"P",{"data-svelte-h":!0}),m(wo)!=="svelte-owoxgn"&&(wo.innerHTML=Ai),be.forEach(t),vr=i(E),Pe=a(E,"DIV",{class:!0});var lo=L(Pe);M(bn.$$.fragment,lo),Lr=i(lo),ko=a(lo,"P",{"data-svelte-h":!0}),m(ko)!=="svelte-1f4f5kp"&&(ko.innerHTML=Wi),lo.forEach(t),E.forEach(t),ja=i(e),$e=a(e,"H2",{class:!0});var io=L($e);Ye=a(io,"A",{id:!0,class:!0,href:!0});var Ks=L(Ye);$s=a(Ks,"SPAN",{});var ea=L($s);M(Tn.$$.fragment,ea),ea.forEach(t),Ks.forEach(t),jr=i(io),vo=a(io,"SPAN",{"data-svelte-h":!0}),m(vo)!=="svelte-13hbgj3"&&(vo.textContent=Hi),io.forEach(t),Ua=i(e),B=a(e,"DIV",{class:!0});var te=L(B);M(wn.$$.fragment,te),Ur=i(te),Lo=a(te,"P",{"data-svelte-h":!0}),m(Lo)!=="svelte-gn4u9l"&&(Lo.innerHTML=Ei),Jr=i(te),jo=a(te,"P",{"data-svelte-h":!0}),m(jo)!=="svelte-ttxvs6"&&(jo.innerHTML=Qi),Cr=i(te),ke=a(te,"DIV",{class:!0});var Ee=L(ke);M(kn.$$.fragment,Ee),xr=i(Ee),Uo=a(Ee,"P",{"data-svelte-h":!0}),m(Uo)!=="svelte-175z7u0"&&(Uo.textContent=Bi),$r=i(Ee),Jo=a(Ee,"UL",{"data-svelte-h":!0}),m(Jo)!=="svelte-xi6653"&&(Jo.innerHTML=Gi),Ee.forEach(t),zr=i(te),se=a(te,"DIV",{class:!0});var Te=L(se);M(vn.$$.fragment,Te),Fr=i(Te),Co=a(Te,"P",{"data-svelte-h":!0}),m(Co)!=="svelte-rcct5a"&&(Co.textContent=Xi),Ir=i(Te),M(Oe.$$.fragment,Te),qr=i(Te),xo=a(Te,"P",{"data-svelte-h":!0}),m(xo)!=="svelte-owoxgn"&&(xo.innerHTML=Si),Te.forEach(t),te.forEach(t),Ja=i(e),ze=a(e,"H2",{class:!0});var Pa=L(ze);Ke=a(Pa,"A",{id:!0,class:!0,href:!0});var Bd=L(Ke);zs=a(Bd,"SPAN",{});var Gd=L(zs);M(Ln.$$.fragment,Gd),Gd.forEach(t),Bd.forEach(t),Nr=i(Pa),$o=a(Pa,"SPAN",{"data-svelte-h":!0}),m($o)!=="svelte-ysa98l"&&($o.textContent=Di),Pa.forEach(t),Ca=i(e),K=a(e,"DIV",{class:!0});var Ft=L(K);M(jn.$$.fragment,Ft),Rr=i(Ft),zo=a(Ft,"P",{"data-svelte-h":!0}),m(zo)!=="svelte-1fcq938"&&(zo.innerHTML=Pi),Vr=i(Ft),Fo=a(Ft,"P",{"data-svelte-h":!0}),m(Fo)!=="svelte-68lg8f"&&(Fo.innerHTML=Yi),Zr=i(Ft),ae=a(Ft,"DIV",{class:!0});var It=L(ae);M(Un.$$.fragment,It),Ar=i(It),Io=a(It,"P",{"data-svelte-h":!0}),m(Io)!=="svelte-mf4rf8"&&(Io.innerHTML=Oi),Wr=i(It),M(et.$$.fragment,It),Hr=i(It),M(tt.$$.fragment,It),It.forEach(t),Ft.forEach(t),xa=i(e),Fe=a(e,"H2",{class:!0});var Ya=L(Fe);nt=a(Ya,"A",{id:!0,class:!0,href:!0});var Xd=L(nt);Fs=a(Xd,"SPAN",{});var Sd=L(Fs);M(Jn.$$.fragment,Sd),Sd.forEach(t),Xd.forEach(t),Er=i(Ya),qo=a(Ya,"SPAN",{"data-svelte-h":!0}),m(qo)!=="svelte-1ezqe8t"&&(qo.textContent=Ki),Ya.forEach(t),$a=i(e),ee=a(e,"DIV",{class:!0});var qt=L(ee);M(Cn.$$.fragment,qt),Qr=i(qt),No=a(qt,"P",{"data-svelte-h":!0}),m(No)!=="svelte-1lmwwjj"&&(No.innerHTML=ed),Br=i(qt),Ro=a(qt,"P",{"data-svelte-h":!0}),m(Ro)!=="svelte-68lg8f"&&(Ro.innerHTML=td),Gr=i(qt),re=a(qt,"DIV",{class:!0});var Nt=L(re);M(xn.$$.fragment,Nt),Xr=i(Nt),Vo=a(Nt,"P",{"data-svelte-h":!0}),m(Vo)!=="svelte-1covjgk"&&(Vo.innerHTML=nd),Sr=i(Nt),M(ot.$$.fragment,Nt),Dr=i(Nt),M(st.$$.fragment,Nt),Nt.forEach(t),qt.forEach(t),za=i(e),Ie=a(e,"H2",{class:!0});var Oa=L(Ie);at=a(Oa,"A",{id:!0,class:!0,href:!0});var Dd=L(at);Is=a(Dd,"SPAN",{});var Pd=L(Is);M($n.$$.fragment,Pd),Pd.forEach(t),Dd.forEach(t),Pr=i(Oa),Zo=a(Oa,"SPAN",{"data-svelte-h":!0}),m(Zo)!=="svelte-1hsehoa"&&(Zo.textContent=od),Oa.forEach(t),Fa=i(e),G=a(e,"DIV",{class:!0});var ve=L(G);M(zn.$$.fragment,ve),Yr=i(ve),Ao=a(ve,"P",{"data-svelte-h":!0}),m(Ao)!=="svelte-36uopi"&&(Ao.innerHTML=sd),Or=i(ve),Wo=a(ve,"P",{"data-svelte-h":!0}),m(Wo)!=="svelte-38rmt8"&&(Wo.innerHTML=ad),Kr=i(ve),Ho=a(ve,"P",{"data-svelte-h":!0}),m(Ho)!=="svelte-68lg8f"&&(Ho.innerHTML=rd),el=i(ve),le=a(ve,"DIV",{class:!0});var Rt=L(le);M(Fn.$$.fragment,Rt),tl=i(Rt),Eo=a(Rt,"P",{"data-svelte-h":!0}),m(Eo)!=="svelte-9knh4c"&&(Eo.innerHTML=ld),nl=i(Rt),M(rt.$$.fragment,Rt),ol=i(Rt),M(lt.$$.fragment,Rt),Rt.forEach(t),ve.forEach(t),Ia=i(e),qe=a(e,"H2",{class:!0});var Ka=L(qe);it=a(Ka,"A",{id:!0,class:!0,href:!0});var Yd=L(it);qs=a(Yd,"SPAN",{});var Od=L(qs);M(In.$$.fragment,Od),Od.forEach(t),Yd.forEach(t),sl=i(Ka),Qo=a(Ka,"SPAN",{"data-svelte-h":!0}),m(Qo)!=="svelte-zv43je"&&(Qo.textContent=id),Ka.forEach(t),qa=i(e),X=a(e,"DIV",{class:!0});var Le=L(X);M(qn.$$.fragment,Le),al=i(Le),Bo=a(Le,"P",{"data-svelte-h":!0}),m(Bo)!=="svelte-1yummv5"&&(Bo.innerHTML=dd),rl=i(Le),Go=a(Le,"P",{"data-svelte-h":!0}),m(Go)!=="svelte-38rmt8"&&(Go.innerHTML=cd),ll=i(Le),Xo=a(Le,"P",{"data-svelte-h":!0}),m(Xo)!=="svelte-68lg8f"&&(Xo.innerHTML=pd),il=i(Le),ie=a(Le,"DIV",{class:!0});var Vt=L(ie);M(Nn.$$.fragment,Vt),dl=i(Vt),So=a(Vt,"P",{"data-svelte-h":!0}),m(So)!=="svelte-6vbiti"&&(So.innerHTML=ud),cl=i(Vt),M(dt.$$.fragment,Vt),pl=i(Vt),M(ct.$$.fragment,Vt),Vt.forEach(t),Le.forEach(t),Na=i(e),Ne=a(e,"H2",{class:!0});var er=L(Ne);pt=a(er,"A",{id:!0,class:!0,href:!0});var Kd=L(pt);Ns=a(Kd,"SPAN",{});var ec=L(Ns);M(Rn.$$.fragment,ec),ec.forEach(t),Kd.forEach(t),ul=i(er),Do=a(er,"SPAN",{"data-svelte-h":!0}),m(Do)!=="svelte-qqb9kf"&&(Do.textContent=md),er.forEach(t),Ra=i(e),S=a(e,"DIV",{class:!0});var je=L(S);M(Vn.$$.fragment,je),ml=i(je),Po=a(je,"P",{"data-svelte-h":!0}),m(Po)!=="svelte-1uah9q8"&&(Po.innerHTML=hd),hl=i(je),Yo=a(je,"P",{"data-svelte-h":!0}),m(Yo)!=="svelte-38rmt8"&&(Yo.innerHTML=fd),fl=i(je),Oo=a(je,"P",{"data-svelte-h":!0}),m(Oo)!=="svelte-68lg8f"&&(Oo.innerHTML=gd),gl=i(je),P=a(je,"DIV",{class:!0});var Ue=L(P);M(Zn.$$.fragment,Ue),yl=i(Ue),Ko=a(Ue,"P",{"data-svelte-h":!0}),m(Ko)!=="svelte-19yueks"&&(Ko.innerHTML=yd),Ml=i(Ue),es=a(Ue,"P",{"data-svelte-h":!0}),m(es)!=="svelte-11lpom8"&&(es.textContent=Md),_l=i(Ue),ts=a(Ue,"P",{"data-svelte-h":!0}),m(ts)!=="svelte-1jlo8qy"&&(ts.textContent=_d),bl=i(Ue),M(ut.$$.fragment,Ue),Ue.forEach(t),je.forEach(t),Va=i(e),Re=a(e,"H2",{class:!0});var tr=L(Re);mt=a(tr,"A",{id:!0,class:!0,href:!0});var tc=L(mt);Rs=a(tc,"SPAN",{});var nc=L(Rs);M(An.$$.fragment,nc),nc.forEach(t),tc.forEach(t),Tl=i(tr),ns=a(tr,"SPAN",{"data-svelte-h":!0}),m(ns)!=="svelte-b9i5qz"&&(ns.textContent=bd),tr.forEach(t),Za=i(e),V=a(e,"DIV",{class:!0});var he=L(V);M(Wn.$$.fragment,he),wl=i(he),os=a(he,"P",{"data-svelte-h":!0}),m(os)!=="svelte-1491dki"&&(os.textContent=Td),kl=i(he),ss=a(he,"P",{"data-svelte-h":!0}),m(ss)!=="svelte-1i0vt4o"&&(ss.innerHTML=wd),vl=i(he),as=a(he,"P",{"data-svelte-h":!0}),m(as)!=="svelte-1ivrf8m"&&(as.innerHTML=kd),Ll=i(he),M(ht.$$.fragment,he),jl=i(he),de=a(he,"DIV",{class:!0});var Zt=L(de);M(Hn.$$.fragment,Zt),Ul=i(Zt),rs=a(Zt,"P",{"data-svelte-h":!0}),m(rs)!=="svelte-olvy0o"&&(rs.innerHTML=vd),Jl=i(Zt),M(ft.$$.fragment,Zt),Cl=i(Zt),M(gt.$$.fragment,Zt),Zt.forEach(t),he.forEach(t),Aa=i(e),Ve=a(e,"H2",{class:!0});var nr=L(Ve);yt=a(nr,"A",{id:!0,class:!0,href:!0});var oc=L(yt);Vs=a(oc,"SPAN",{});var sc=L(Vs);M(En.$$.fragment,sc),sc.forEach(t),oc.forEach(t),xl=i(nr),ls=a(nr,"SPAN",{"data-svelte-h":!0}),m(ls)!=="svelte-154fmer"&&(ls.textContent=Ld),nr.forEach(t),Wa=i(e),Z=a(e,"DIV",{class:!0});var fe=L(Z);M(Qn.$$.fragment,fe),$l=i(fe),is=a(fe,"P",{"data-svelte-h":!0}),m(is)!=="svelte-jd1dcp"&&(is.innerHTML=jd),zl=i(fe),ds=a(fe,"P",{"data-svelte-h":!0}),m(ds)!=="svelte-1i0vt4o"&&(ds.innerHTML=Ud),Fl=i(fe),cs=a(fe,"P",{"data-svelte-h":!0}),m(cs)!=="svelte-1ivrf8m"&&(cs.innerHTML=Jd),Il=i(fe),M(Mt.$$.fragment,fe),ql=i(fe),ce=a(fe,"DIV",{class:!0});var At=L(ce);M(Bn.$$.fragment,At),Nl=i(At),ps=a(At,"P",{"data-svelte-h":!0}),m(ps)!=="svelte-elye54"&&(ps.innerHTML=Cd),Rl=i(At),M(_t.$$.fragment,At),Vl=i(At),M(bt.$$.fragment,At),At.forEach(t),fe.forEach(t),Ha=i(e),Ze=a(e,"H2",{class:!0});var or=L(Ze);Tt=a(or,"A",{id:!0,class:!0,href:!0});var ac=L(Tt);Zs=a(ac,"SPAN",{});var rc=L(Zs);M(Gn.$$.fragment,rc),rc.forEach(t),ac.forEach(t),Zl=i(or),us=a(or,"SPAN",{"data-svelte-h":!0}),m(us)!=="svelte-ytwz0s"&&(us.textContent=xd),or.forEach(t),Ea=i(e),A=a(e,"DIV",{class:!0});var ge=L(A);M(Xn.$$.fragment,ge),Al=i(ge),ms=a(ge,"P",{"data-svelte-h":!0}),m(ms)!=="svelte-1wflwnx"&&(ms.textContent=$d),Wl=i(ge),hs=a(ge,"P",{"data-svelte-h":!0}),m(hs)!=="svelte-1i0vt4o"&&(hs.innerHTML=zd),Hl=i(ge),fs=a(ge,"P",{"data-svelte-h":!0}),m(fs)!=="svelte-1ivrf8m"&&(fs.innerHTML=Fd),El=i(ge),M(wt.$$.fragment,ge),Ql=i(ge),pe=a(ge,"DIV",{class:!0});var Wt=L(pe);M(Sn.$$.fragment,Wt),Bl=i(Wt),gs=a(Wt,"P",{"data-svelte-h":!0}),m(gs)!=="svelte-1kn4nrw"&&(gs.innerHTML=Id),Gl=i(Wt),M(kt.$$.fragment,Wt),Xl=i(Wt),M(vt.$$.fragment,Wt),Wt.forEach(t),ge.forEach(t),Qa=i(e),Ae=a(e,"H2",{class:!0});var sr=L(Ae);Lt=a(sr,"A",{id:!0,class:!0,href:!0});var lc=L(Lt);As=a(lc,"SPAN",{});var ic=L(As);M(Dn.$$.fragment,ic),ic.forEach(t),lc.forEach(t),Sl=i(sr),ys=a(sr,"SPAN",{"data-svelte-h":!0}),m(ys)!=="svelte-1b930po"&&(ys.textContent=qd),sr.forEach(t),Ba=i(e),W=a(e,"DIV",{class:!0});var ye=L(W);M(Pn.$$.fragment,ye),Dl=i(ye),Ms=a(ye,"P",{"data-svelte-h":!0}),m(Ms)!=="svelte-1s4zjay"&&(Ms.textContent=Nd),Pl=i(ye),_s=a(ye,"P",{"data-svelte-h":!0}),m(_s)!=="svelte-1i0vt4o"&&(_s.innerHTML=Rd),Yl=i(ye),bs=a(ye,"P",{"data-svelte-h":!0}),m(bs)!=="svelte-1ivrf8m"&&(bs.innerHTML=Vd),Ol=i(ye),M(jt.$$.fragment,ye),Kl=i(ye),ue=a(ye,"DIV",{class:!0});var Ht=L(ue);M(Yn.$$.fragment,Ht),ei=i(Ht),Ts=a(Ht,"P",{"data-svelte-h":!0}),m(Ts)!=="svelte-1j82y2m"&&(Ts.innerHTML=Zd),ti=i(Ht),M(Ut.$$.fragment,Ht),ni=i(Ht),M(Jt.$$.fragment,Ht),Ht.forEach(t),ye.forEach(t),Ga=i(e),We=a(e,"H2",{class:!0});var ar=L(We);Ct=a(ar,"A",{id:!0,class:!0,href:!0});var dc=L(Ct);Ws=a(dc,"SPAN",{});var cc=L(Ws);M(On.$$.fragment,cc),cc.forEach(t),dc.forEach(t),oi=i(ar),ws=a(ar,"SPAN",{"data-svelte-h":!0}),m(ws)!=="svelte-mm1lvd"&&(ws.textContent=Ad),ar.forEach(t),Xa=i(e),H=a(e,"DIV",{class:!0});var Me=L(H);M(Kn.$$.fragment,Me),si=i(Me),ks=a(Me,"P",{"data-svelte-h":!0}),m(ks)!=="svelte-1uah9q8"&&(ks.innerHTML=Wd),ai=i(Me),vs=a(Me,"P",{"data-svelte-h":!0}),m(vs)!=="svelte-1i0vt4o"&&(vs.innerHTML=Hd),ri=i(Me),Ls=a(Me,"P",{"data-svelte-h":!0}),m(Ls)!=="svelte-1ivrf8m"&&(Ls.innerHTML=Ed),li=i(Me),M(xt.$$.fragment,Me),ii=i(Me),me=a(Me,"DIV",{class:!0});var Et=L(me);M(eo.$$.fragment,Et),di=i(Et),js=a(Et,"P",{"data-svelte-h":!0}),m(js)!=="svelte-y4wz5g"&&(js.innerHTML=Qd),ci=i(Et),M($t.$$.fragment,Et),pi=i(Et),M(zt.$$.fragment,Et),Et.forEach(t),Me.forEach(t),Sa=i(e),Hs=a(e,"P",{}),L(Hs).forEach(t),this.h()},h(){f(o,"name","hf:doc:metadata"),f(o,"content",JSON.stringify(Qc)),f(r,"id","layoutlm"),f(r,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(r,"href","#layoutlm"),f(v,"class","relative group"),f(C,"id","Overview"),f(j,"id","overview"),f(j,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(j,"href","#overview"),f(h,"class","relative group"),f(Qe,"id","resources"),f(Qe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Qe,"href","#resources"),f(Je,"class","relative group"),f(Be,"id","transformers.LayoutLMConfig"),f(Be,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Be,"href","#transformers.LayoutLMConfig"),f(Ce,"class","relative group"),f(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Xe,"id","transformers.LayoutLMTokenizer"),f(Xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Xe,"href","#transformers.LayoutLMTokenizer"),f(xe,"class","relative group"),f(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Ye,"id","transformers.LayoutLMTokenizerFast"),f(Ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Ye,"href","#transformers.LayoutLMTokenizerFast"),f($e,"class","relative group"),f(ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Ke,"id","transformers.LayoutLMModel"),f(Ke,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Ke,"href","#transformers.LayoutLMModel"),f(ze,"class","relative group"),f(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(nt,"id","transformers.LayoutLMForMaskedLM"),f(nt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(nt,"href","#transformers.LayoutLMForMaskedLM"),f(Fe,"class","relative group"),f(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(at,"id","transformers.LayoutLMForSequenceClassification"),f(at,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(at,"href","#transformers.LayoutLMForSequenceClassification"),f(Ie,"class","relative group"),f(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(it,"id","transformers.LayoutLMForTokenClassification"),f(it,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(it,"href","#transformers.LayoutLMForTokenClassification"),f(qe,"class","relative group"),f(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(pt,"id","transformers.LayoutLMForQuestionAnswering"),f(pt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(pt,"href","#transformers.LayoutLMForQuestionAnswering"),f(Ne,"class","relative group"),f(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(mt,"id","transformers.TFLayoutLMModel"),f(mt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(mt,"href","#transformers.TFLayoutLMModel"),f(Re,"class","relative group"),f(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(yt,"id","transformers.TFLayoutLMForMaskedLM"),f(yt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(yt,"href","#transformers.TFLayoutLMForMaskedLM"),f(Ve,"class","relative group"),f(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Tt,"id","transformers.TFLayoutLMForSequenceClassification"),f(Tt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Tt,"href","#transformers.TFLayoutLMForSequenceClassification"),f(Ze,"class","relative group"),f(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Lt,"id","transformers.TFLayoutLMForTokenClassification"),f(Lt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Lt,"href","#transformers.TFLayoutLMForTokenClassification"),f(Ae,"class","relative group"),f(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Ct,"id","transformers.TFLayoutLMForQuestionAnswering"),f(Ct,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Ct,"href","#transformers.TFLayoutLMForQuestionAnswering"),f(We,"class","relative group"),f(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,c){n(document.head,o),d(e,k,c),d(e,u,c),d(e,p,c),d(e,v,c),n(v,r),n(r,g),_(I,g,null),n(v,z),n(v,J),d(e,x,c),d(e,C,c),d(e,q,c),d(e,h,c),n(h,j),n(j,Us),_(Qt,Us,null),n(h,rr),n(h,co),d(e,ta,c),d(e,Bt,c),d(e,na,c),d(e,Gt,c),d(e,oa,c),d(e,Xt,c),d(e,sa,c),d(e,St,c),d(e,aa,c),d(e,Dt,c),d(e,ra,c),d(e,Pt,c),d(e,la,c),_(Yt,e,c),d(e,ia,c),d(e,Ot,c),d(e,da,c),_(Kt,e,c),d(e,ca,c),d(e,Je,c),n(Je,Qe),n(Qe,Js),_(en,Js,null),n(Je,lr),n(Je,po),d(e,pa,c),d(e,tn,c),d(e,ua,c),_(nn,e,c),d(e,ma,c),d(e,on,c),d(e,ha,c),_(sn,e,c),d(e,fa,c),d(e,an,c),d(e,ga,c),_(rn,e,c),d(e,ya,c),d(e,ln,c),d(e,Ma,c),d(e,dn,c),d(e,_a,c),d(e,cn,c),d(e,ba,c),d(e,pn,c),d(e,Ta,c),d(e,un,c),d(e,wa,c),d(e,Ce,c),n(Ce,Be),n(Be,Cs),_(mn,Cs,null),n(Ce,ir),n(Ce,uo),d(e,ka,c),d(e,O,c),_(hn,O,null),n(O,dr),n(O,mo),n(O,cr),n(O,ho),n(O,pr),_(Ge,O,null),d(e,va,c),d(e,xe,c),n(xe,Xe),n(Xe,xs),_(fn,xs,null),n(xe,ur),n(xe,fo),d(e,La,c),d(e,N,c),_(gn,N,null),n(N,mr),n(N,go),n(N,hr),n(N,yo),n(N,fr),n(N,we),_(yn,we,null),n(we,gr),n(we,Mo),n(we,yr),n(we,_o),n(N,Mr),n(N,Se),_(Mn,Se,null),n(Se,_r),n(Se,bo),n(N,br),n(N,oe),_(_n,oe,null),n(oe,Tr),n(oe,To),n(oe,wr),_(De,oe,null),n(oe,kr),n(oe,wo),n(N,vr),n(N,Pe),_(bn,Pe,null),n(Pe,Lr),n(Pe,ko),d(e,ja,c),d(e,$e,c),n($e,Ye),n(Ye,$s),_(Tn,$s,null),n($e,jr),n($e,vo),d(e,Ua,c),d(e,B,c),_(wn,B,null),n(B,Ur),n(B,Lo),n(B,Jr),n(B,jo),n(B,Cr),n(B,ke),_(kn,ke,null),n(ke,xr),n(ke,Uo),n(ke,$r),n(ke,Jo),n(B,zr),n(B,se),_(vn,se,null),n(se,Fr),n(se,Co),n(se,Ir),_(Oe,se,null),n(se,qr),n(se,xo),d(e,Ja,c),d(e,ze,c),n(ze,Ke),n(Ke,zs),_(Ln,zs,null),n(ze,Nr),n(ze,$o),d(e,Ca,c),d(e,K,c),_(jn,K,null),n(K,Rr),n(K,zo),n(K,Vr),n(K,Fo),n(K,Zr),n(K,ae),_(Un,ae,null),n(ae,Ar),n(ae,Io),n(ae,Wr),_(et,ae,null),n(ae,Hr),_(tt,ae,null),d(e,xa,c),d(e,Fe,c),n(Fe,nt),n(nt,Fs),_(Jn,Fs,null),n(Fe,Er),n(Fe,qo),d(e,$a,c),d(e,ee,c),_(Cn,ee,null),n(ee,Qr),n(ee,No),n(ee,Br),n(ee,Ro),n(ee,Gr),n(ee,re),_(xn,re,null),n(re,Xr),n(re,Vo),n(re,Sr),_(ot,re,null),n(re,Dr),_(st,re,null),d(e,za,c),d(e,Ie,c),n(Ie,at),n(at,Is),_($n,Is,null),n(Ie,Pr),n(Ie,Zo),d(e,Fa,c),d(e,G,c),_(zn,G,null),n(G,Yr),n(G,Ao),n(G,Or),n(G,Wo),n(G,Kr),n(G,Ho),n(G,el),n(G,le),_(Fn,le,null),n(le,tl),n(le,Eo),n(le,nl),_(rt,le,null),n(le,ol),_(lt,le,null),d(e,Ia,c),d(e,qe,c),n(qe,it),n(it,qs),_(In,qs,null),n(qe,sl),n(qe,Qo),d(e,qa,c),d(e,X,c),_(qn,X,null),n(X,al),n(X,Bo),n(X,rl),n(X,Go),n(X,ll),n(X,Xo),n(X,il),n(X,ie),_(Nn,ie,null),n(ie,dl),n(ie,So),n(ie,cl),_(dt,ie,null),n(ie,pl),_(ct,ie,null),d(e,Na,c),d(e,Ne,c),n(Ne,pt),n(pt,Ns),_(Rn,Ns,null),n(Ne,ul),n(Ne,Do),d(e,Ra,c),d(e,S,c),_(Vn,S,null),n(S,ml),n(S,Po),n(S,hl),n(S,Yo),n(S,fl),n(S,Oo),n(S,gl),n(S,P),_(Zn,P,null),n(P,yl),n(P,Ko),n(P,Ml),n(P,es),n(P,_l),n(P,ts),n(P,bl),_(ut,P,null),d(e,Va,c),d(e,Re,c),n(Re,mt),n(mt,Rs),_(An,Rs,null),n(Re,Tl),n(Re,ns),d(e,Za,c),d(e,V,c),_(Wn,V,null),n(V,wl),n(V,os),n(V,kl),n(V,ss),n(V,vl),n(V,as),n(V,Ll),_(ht,V,null),n(V,jl),n(V,de),_(Hn,de,null),n(de,Ul),n(de,rs),n(de,Jl),_(ft,de,null),n(de,Cl),_(gt,de,null),d(e,Aa,c),d(e,Ve,c),n(Ve,yt),n(yt,Vs),_(En,Vs,null),n(Ve,xl),n(Ve,ls),d(e,Wa,c),d(e,Z,c),_(Qn,Z,null),n(Z,$l),n(Z,is),n(Z,zl),n(Z,ds),n(Z,Fl),n(Z,cs),n(Z,Il),_(Mt,Z,null),n(Z,ql),n(Z,ce),_(Bn,ce,null),n(ce,Nl),n(ce,ps),n(ce,Rl),_(_t,ce,null),n(ce,Vl),_(bt,ce,null),d(e,Ha,c),d(e,Ze,c),n(Ze,Tt),n(Tt,Zs),_(Gn,Zs,null),n(Ze,Zl),n(Ze,us),d(e,Ea,c),d(e,A,c),_(Xn,A,null),n(A,Al),n(A,ms),n(A,Wl),n(A,hs),n(A,Hl),n(A,fs),n(A,El),_(wt,A,null),n(A,Ql),n(A,pe),_(Sn,pe,null),n(pe,Bl),n(pe,gs),n(pe,Gl),_(kt,pe,null),n(pe,Xl),_(vt,pe,null),d(e,Qa,c),d(e,Ae,c),n(Ae,Lt),n(Lt,As),_(Dn,As,null),n(Ae,Sl),n(Ae,ys),d(e,Ba,c),d(e,W,c),_(Pn,W,null),n(W,Dl),n(W,Ms),n(W,Pl),n(W,_s),n(W,Yl),n(W,bs),n(W,Ol),_(jt,W,null),n(W,Kl),n(W,ue),_(Yn,ue,null),n(ue,ei),n(ue,Ts),n(ue,ti),_(Ut,ue,null),n(ue,ni),_(Jt,ue,null),d(e,Ga,c),d(e,We,c),n(We,Ct),n(Ct,Ws),_(On,Ws,null),n(We,oi),n(We,ws),d(e,Xa,c),d(e,H,c),_(Kn,H,null),n(H,si),n(H,ks),n(H,ai),n(H,vs),n(H,ri),n(H,Ls),n(H,li),_(xt,H,null),n(H,ii),n(H,me),_(eo,me,null),n(me,di),n(me,js),n(me,ci),_($t,me,null),n(me,pi),_(zt,me,null),d(e,Sa,c),d(e,Hs,c),Da=!0},p(e,[c]){const to={};c&2&&(to.$$scope={dirty:c,ctx:e}),Ge.$set(to);const Es={};c&2&&(Es.$$scope={dirty:c,ctx:e}),De.$set(Es);const Qs={};c&2&&(Qs.$$scope={dirty:c,ctx:e}),Oe.$set(Qs);const no={};c&2&&(no.$$scope={dirty:c,ctx:e}),et.$set(no);const Bs={};c&2&&(Bs.$$scope={dirty:c,ctx:e}),tt.$set(Bs);const Gs={};c&2&&(Gs.$$scope={dirty:c,ctx:e}),ot.$set(Gs);const oo={};c&2&&(oo.$$scope={dirty:c,ctx:e}),st.$set(oo);const Xs={};c&2&&(Xs.$$scope={dirty:c,ctx:e}),rt.$set(Xs);const Ss={};c&2&&(Ss.$$scope={dirty:c,ctx:e}),lt.$set(Ss);const so={};c&2&&(so.$$scope={dirty:c,ctx:e}),dt.$set(so);const Ds={};c&2&&(Ds.$$scope={dirty:c,ctx:e}),ct.$set(Ds);const Ps={};c&2&&(Ps.$$scope={dirty:c,ctx:e}),ut.$set(Ps);const _e={};c&2&&(_e.$$scope={dirty:c,ctx:e}),ht.$set(_e);const ao={};c&2&&(ao.$$scope={dirty:c,ctx:e}),ft.$set(ao);const Ys={};c&2&&(Ys.$$scope={dirty:c,ctx:e}),gt.$set(Ys);const Os={};c&2&&(Os.$$scope={dirty:c,ctx:e}),Mt.$set(Os);const E={};c&2&&(E.$$scope={dirty:c,ctx:e}),_t.$set(E);const He={};c&2&&(He.$$scope={dirty:c,ctx:e}),bt.$set(He);const ro={};c&2&&(ro.$$scope={dirty:c,ctx:e}),wt.$set(ro);const be={};c&2&&(be.$$scope={dirty:c,ctx:e}),kt.$set(be);const lo={};c&2&&(lo.$$scope={dirty:c,ctx:e}),vt.$set(lo);const io={};c&2&&(io.$$scope={dirty:c,ctx:e}),jt.$set(io);const Ks={};c&2&&(Ks.$$scope={dirty:c,ctx:e}),Ut.$set(Ks);const ea={};c&2&&(ea.$$scope={dirty:c,ctx:e}),Jt.$set(ea);const te={};c&2&&(te.$$scope={dirty:c,ctx:e}),xt.$set(te);const Ee={};c&2&&(Ee.$$scope={dirty:c,ctx:e}),$t.$set(Ee);const Te={};c&2&&(Te.$$scope={dirty:c,ctx:e}),zt.$set(Te)},i(e){Da||(b(I.$$.fragment,e),b(Qt.$$.fragment,e),b(Yt.$$.fragment,e),b(Kt.$$.fragment,e),b(en.$$.fragment,e),b(nn.$$.fragment,e),b(sn.$$.fragment,e),b(rn.$$.fragment,e),b(mn.$$.fragment,e),b(hn.$$.fragment,e),b(Ge.$$.fragment,e),b(fn.$$.fragment,e),b(gn.$$.fragment,e),b(yn.$$.fragment,e),b(Mn.$$.fragment,e),b(_n.$$.fragment,e),b(De.$$.fragment,e),b(bn.$$.fragment,e),b(Tn.$$.fragment,e),b(wn.$$.fragment,e),b(kn.$$.fragment,e),b(vn.$$.fragment,e),b(Oe.$$.fragment,e),b(Ln.$$.fragment,e),b(jn.$$.fragment,e),b(Un.$$.fragment,e),b(et.$$.fragment,e),b(tt.$$.fragment,e),b(Jn.$$.fragment,e),b(Cn.$$.fragment,e),b(xn.$$.fragment,e),b(ot.$$.fragment,e),b(st.$$.fragment,e),b($n.$$.fragment,e),b(zn.$$.fragment,e),b(Fn.$$.fragment,e),b(rt.$$.fragment,e),b(lt.$$.fragment,e),b(In.$$.fragment,e),b(qn.$$.fragment,e),b(Nn.$$.fragment,e),b(dt.$$.fragment,e),b(ct.$$.fragment,e),b(Rn.$$.fragment,e),b(Vn.$$.fragment,e),b(Zn.$$.fragment,e),b(ut.$$.fragment,e),b(An.$$.fragment,e),b(Wn.$$.fragment,e),b(ht.$$.fragment,e),b(Hn.$$.fragment,e),b(ft.$$.fragment,e),b(gt.$$.fragment,e),b(En.$$.fragment,e),b(Qn.$$.fragment,e),b(Mt.$$.fragment,e),b(Bn.$$.fragment,e),b(_t.$$.fragment,e),b(bt.$$.fragment,e),b(Gn.$$.fragment,e),b(Xn.$$.fragment,e),b(wt.$$.fragment,e),b(Sn.$$.fragment,e),b(kt.$$.fragment,e),b(vt.$$.fragment,e),b(Dn.$$.fragment,e),b(Pn.$$.fragment,e),b(jt.$$.fragment,e),b(Yn.$$.fragment,e),b(Ut.$$.fragment,e),b(Jt.$$.fragment,e),b(On.$$.fragment,e),b(Kn.$$.fragment,e),b(xt.$$.fragment,e),b(eo.$$.fragment,e),b($t.$$.fragment,e),b(zt.$$.fragment,e),Da=!0)},o(e){T(I.$$.fragment,e),T(Qt.$$.fragment,e),T(Yt.$$.fragment,e),T(Kt.$$.fragment,e),T(en.$$.fragment,e),T(nn.$$.fragment,e),T(sn.$$.fragment,e),T(rn.$$.fragment,e),T(mn.$$.fragment,e),T(hn.$$.fragment,e),T(Ge.$$.fragment,e),T(fn.$$.fragment,e),T(gn.$$.fragment,e),T(yn.$$.fragment,e),T(Mn.$$.fragment,e),T(_n.$$.fragment,e),T(De.$$.fragment,e),T(bn.$$.fragment,e),T(Tn.$$.fragment,e),T(wn.$$.fragment,e),T(kn.$$.fragment,e),T(vn.$$.fragment,e),T(Oe.$$.fragment,e),T(Ln.$$.fragment,e),T(jn.$$.fragment,e),T(Un.$$.fragment,e),T(et.$$.fragment,e),T(tt.$$.fragment,e),T(Jn.$$.fragment,e),T(Cn.$$.fragment,e),T(xn.$$.fragment,e),T(ot.$$.fragment,e),T(st.$$.fragment,e),T($n.$$.fragment,e),T(zn.$$.fragment,e),T(Fn.$$.fragment,e),T(rt.$$.fragment,e),T(lt.$$.fragment,e),T(In.$$.fragment,e),T(qn.$$.fragment,e),T(Nn.$$.fragment,e),T(dt.$$.fragment,e),T(ct.$$.fragment,e),T(Rn.$$.fragment,e),T(Vn.$$.fragment,e),T(Zn.$$.fragment,e),T(ut.$$.fragment,e),T(An.$$.fragment,e),T(Wn.$$.fragment,e),T(ht.$$.fragment,e),T(Hn.$$.fragment,e),T(ft.$$.fragment,e),T(gt.$$.fragment,e),T(En.$$.fragment,e),T(Qn.$$.fragment,e),T(Mt.$$.fragment,e),T(Bn.$$.fragment,e),T(_t.$$.fragment,e),T(bt.$$.fragment,e),T(Gn.$$.fragment,e),T(Xn.$$.fragment,e),T(wt.$$.fragment,e),T(Sn.$$.fragment,e),T(kt.$$.fragment,e),T(vt.$$.fragment,e),T(Dn.$$.fragment,e),T(Pn.$$.fragment,e),T(jt.$$.fragment,e),T(Yn.$$.fragment,e),T(Ut.$$.fragment,e),T(Jt.$$.fragment,e),T(On.$$.fragment,e),T(Kn.$$.fragment,e),T(xt.$$.fragment,e),T(eo.$$.fragment,e),T($t.$$.fragment,e),T(zt.$$.fragment,e),Da=!1},d(e){e&&(t(k),t(u),t(p),t(v),t(x),t(C),t(q),t(h),t(ta),t(Bt),t(na),t(Gt),t(oa),t(Xt),t(sa),t(St),t(aa),t(Dt),t(ra),t(Pt),t(la),t(ia),t(Ot),t(da),t(ca),t(Je),t(pa),t(tn),t(ua),t(ma),t(on),t(ha),t(fa),t(an),t(ga),t(ya),t(ln),t(Ma),t(dn),t(_a),t(cn),t(ba),t(pn),t(Ta),t(un),t(wa),t(Ce),t(ka),t(O),t(va),t(xe),t(La),t(N),t(ja),t($e),t(Ua),t(B),t(Ja),t(ze),t(Ca),t(K),t(xa),t(Fe),t($a),t(ee),t(za),t(Ie),t(Fa),t(G),t(Ia),t(qe),t(qa),t(X),t(Na),t(Ne),t(Ra),t(S),t(Va),t(Re),t(Za),t(V),t(Aa),t(Ve),t(Wa),t(Z),t(Ha),t(Ze),t(Ea),t(A),t(Qa),t(Ae),t(Ba),t(W),t(Ga),t(We),t(Xa),t(H),t(Sa),t(Hs)),t(o),w(I),w(Qt),w(Yt,e),w(Kt,e),w(en),w(nn,e),w(sn,e),w(rn,e),w(mn),w(hn),w(Ge),w(fn),w(gn),w(yn),w(Mn),w(_n),w(De),w(bn),w(Tn),w(wn),w(kn),w(vn),w(Oe),w(Ln),w(jn),w(Un),w(et),w(tt),w(Jn),w(Cn),w(xn),w(ot),w(st),w($n),w(zn),w(Fn),w(rt),w(lt),w(In),w(qn),w(Nn),w(dt),w(ct),w(Rn),w(Vn),w(Zn),w(ut),w(An),w(Wn),w(ht),w(Hn),w(ft),w(gt),w(En),w(Qn),w(Mt),w(Bn),w(_t),w(bt),w(Gn),w(Xn),w(wt),w(Sn),w(kt),w(vt),w(Dn),w(Pn),w(jt),w(Yn),w(Ut),w(Jt),w(On),w(Kn),w(xt),w(eo),w($t),w(zt)}}}const Qc={local:"layoutlm",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.LayoutLMConfig",title:"LayoutLMConfig"},{local:"transformers.LayoutLMTokenizer",title:"LayoutLMTokenizer"},{local:"transformers.LayoutLMTokenizerFast",title:"LayoutLMTokenizerFast"},{local:"transformers.LayoutLMModel",title:"LayoutLMModel"},{local:"transformers.LayoutLMForMaskedLM",title:"LayoutLMForMaskedLM"},{local:"transformers.LayoutLMForSequenceClassification",title:"LayoutLMForSequenceClassification"},{local:"transformers.LayoutLMForTokenClassification",title:"LayoutLMForTokenClassification"},{local:"transformers.LayoutLMForQuestionAnswering",title:"LayoutLMForQuestionAnswering"},{local:"transformers.TFLayoutLMModel",title:"TFLayoutLMModel"},{local:"transformers.TFLayoutLMForMaskedLM",title:"TFLayoutLMForMaskedLM"},{local:"transformers.TFLayoutLMForSequenceClassification",title:"TFLayoutLMForSequenceClassification"},{local:"transformers.TFLayoutLMForTokenClassification",title:"TFLayoutLMForTokenClassification"},{local:"transformers.TFLayoutLMForQuestionAnswering",title:"TFLayoutLMForQuestionAnswering"}],title:"LayoutLM"};function Bc(U){return uc(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ep extends mc{constructor(o){super(),hc(this,o,Bc,Ec,pc,{})}}export{ep as component};
