import{S as VM,i as WM,s as BM,e as a,k as c,w,t as s,M as QM,c as r,d as t,m as p,a as l,x as k,h as n,b as u,G as e,g as m,y as v,q as L,o as j,B as U,v as GM,L as gt}from"../../chunks/vendor-hf-doc-builder.js";import{T as pt}from"../../chunks/Tip-hf-doc-builder.js";import{D as se}from"../../chunks/Docstring-hf-doc-builder.js";import{C as it}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as ot}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ft}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Hg}from"../../chunks/PipelineTag-hf-doc-builder.js";function DM(I){let d,b,f,g,M;return g=new it({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`}}),{c(){d=a("p"),b=s("Examples:"),f=c(),w(g.$$.fragment)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Examples:"),h.forEach(t),f=p(i),k(g.$$.fragment,i)},m(i,h){m(i,d,h),e(d,b),m(i,f,h),v(g,i,h),M=!0},p:gt,i(i){M||(L(g.$$.fragment,i),M=!0)},o(i){j(g.$$.fragment,i),M=!1},d(i){i&&t(d),i&&t(f),U(g,i)}}}function XM(I){let d,b,f,g,M;return g=new it({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 |`}}),{c(){d=a("p"),b=s("sequence pair mask has the following format:"),f=c(),w(g.$$.fragment)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"sequence pair mask has the following format:"),h.forEach(t),f=p(i),k(g.$$.fragment,i)},m(i,h){m(i,d,h),e(d,b),m(i,f,h),v(g,i,h),M=!0},p:gt,i(i){M||(L(g.$$.fragment,i),M=!0)},o(i){j(g.$$.fragment,i),M=!1},d(i){i&&t(d),i&&t(f),U(g,i)}}}function SM(I){let d,b,f,g,M;return g=new it({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 |`}}),{c(){d=a("p"),b=s("sequence pair mask has the following format:"),f=c(),w(g.$$.fragment)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"sequence pair mask has the following format:"),h.forEach(t),f=p(i),k(g.$$.fragment,i)},m(i,h){m(i,d,h),e(d,b),m(i,f,h),v(g,i,h),M=!0},p:gt,i(i){M||(L(g.$$.fragment,i),M=!0)},o(i){j(g.$$.fragment,i),M=!1},d(i){i&&t(d),i&&t(f),U(g,i)}}}function PM(I){let d,b,f,g,M;return{c(){d=a("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),g=s("Module"),M=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var E=l(f);g=n(E,"Module"),E.forEach(t),M=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(i,h){m(i,d,h),e(d,b),e(d,f),e(f,g),e(d,M)},d(i){i&&t(d)}}}function HM(I){let d,b,f,g,M;return g=new it({props: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XMlMjAlMkIlMjAlNUIlNUIxMDAwJTJDJTIwMTAwMCUyQyUyMDEwMDAlMkMlMjAxMDAwJTVEJTVEJTBBJTBBZW5jb2RpbmclMjAlM0QlMjB0b2tlbml6ZXIoJTIyJTIwJTIyLmpvaW4od29yZHMpJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFpbnB1dF9pZHMlMjAlM0QlMjBlbmNvZGluZyU1QiUyMmlucHV0X2lkcyUyMiU1RCUwQWF0dGVudGlvbl9tYXNrJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJhdHRlbnRpb25fbWFzayUyMiU1RCUwQXRva2VuX3R5cGVfaWRzJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJ0b2tlbl90eXBlX2lkcyUyMiU1RCUwQWJib3glMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCdG9rZW5fYm94ZXMlNUQpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUyMGJib3glM0RiYm94JTJDJTIwYXR0ZW50aW9uX21hc2slM0RhdHRlbnRpb25fbWFzayUyQyUyMHRva2VuX3R5cGVfaWRzJTNEdG9rZW5fdHlwZV9pZHMlMEEpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",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`}}),{c(){d=a("p"),b=s("Examples:"),f=c(),w(g.$$.fragment)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Examples:"),h.forEach(t),f=p(i),k(g.$$.fragment,i)},m(i,h){m(i,d,h),e(d,b),m(i,f,h),v(g,i,h),M=!0},p:gt,i(i){M||(L(g.$$.fragment,i),M=!0)},o(i){j(g.$$.fragment,i),M=!1},d(i){i&&t(d),i&&t(f),U(g,i)}}}function OM(I){let d,b,f,g,M;return{c(){d=a("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),g=s("Module"),M=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var E=l(f);g=n(E,"Module"),E.forEach(t),M=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(i,h){m(i,d,h),e(d,b),e(d,f),e(f,g),e(d,M)},d(i){i&&t(d)}}}function YM(I){let d,b,f,g,M;return g=new it({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMYXlvdXRMTUZvck1hc2tlZExNJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZsYXlvdXRsbS1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBMYXlvdXRMTUZvck1hc2tlZExNLm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slMjAlM0QlMjBlbmNvZGluZyU1QiUyMmF0dGVudGlvbl9tYXNrJTIyJTVEJTBBdG9rZW5fdHlwZV9pZHMlMjAlM0QlMjBlbmNvZGluZyU1QiUyMnRva2VuX3R5cGVfaWRzJTIyJTVEJTBBYmJveCUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUJ0b2tlbl9ib3hlcyU1RCklMEElMEFsYWJlbHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMjB3b3JsZCUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUwQSUyMCUyMCUyMCUyMGJib3glM0RiYm94JTJDJTBBJTIwJTIwJTIwJTIwYXR0ZW50aW9uX21hc2slM0RhdHRlbnRpb25fbWFzayUyQyUwQSUyMCUyMCUyMCUyMHRva2VuX3R5cGVfaWRzJTNEdG9rZW5fdHlwZV9pZHMlMkMlMEElMjAlMjAlMjAlMjBsYWJlbHMlM0RsYWJlbHMlMkMlMEEpJTBBJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcw==",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`}}),{c(){d=a("p"),b=s("Examples:"),f=c(),w(g.$$.fragment)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Examples:"),h.forEach(t),f=p(i),k(g.$$.fragment,i)},m(i,h){m(i,d,h),e(d,b),m(i,f,h),v(g,i,h),M=!0},p:gt,i(i){M||(L(g.$$.fragment,i),M=!0)},o(i){j(g.$$.fragment,i),M=!1},d(i){i&&t(d),i&&t(f),U(g,i)}}}function KM(I){let d,b,f,g,M;return{c(){d=a("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),g=s("Module"),M=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var E=l(f);g=n(E,"Module"),E.forEach(t),M=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(i,h){m(i,d,h),e(d,b),e(d,f),e(f,g),e(d,M)},d(i){i&&t(d)}}}function eb(I){let d,b,f,g,M;return g=new it({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMYXlvdXRMTUZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9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MiUyMCUyMi5qb2luKHdvcmRzKSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBaW5wdXRfaWRzJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEFhdHRlbnRpb25fbWFzayUyMCUzRCUyMGVuY29kaW5nJTVCJTIyYXR0ZW50aW9uX21hc2slMjIlNUQlMEF0b2tlbl90eXBlX2lkcyUyMCUzRCUyMGVuY29kaW5nJTVCJTIydG9rZW5fdHlwZV9pZHMlMjIlNUQlMEFiYm94JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QnRva2VuX2JveGVzJTVEKSUwQXNlcXVlbmNlX2xhYmVsJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QjElNUQpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUwQSUyMCUyMCUyMCUyMGJib3glM0RiYm94JTJDJTBBJTIwJTIwJTIwJTIwYXR0ZW50aW9uX21hc2slM0RhdHRlbnRpb25fbWFzayUyQyUwQSUyMCUyMCUyMCUyMHRva2VuX3R5cGVfaWRzJTNEdG9rZW5fdHlwZV9pZHMlMkMlMEElMjAlMjAlMjAlMjBsYWJlbHMlM0RzZXF1ZW5jZV9sYWJlbCUyQyUwQSklMEElMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",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`}}),{c(){d=a("p"),b=s("Examples:"),f=c(),w(g.$$.fragment)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Examples:"),h.forEach(t),f=p(i),k(g.$$.fragment,i)},m(i,h){m(i,d,h),e(d,b),m(i,f,h),v(g,i,h),M=!0},p:gt,i(i){M||(L(g.$$.fragment,i),M=!0)},o(i){j(g.$$.fragment,i),M=!1},d(i){i&&t(d),i&&t(f),U(g,i)}}}function tb(I){let d,b,f,g,M;return{c(){d=a("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),g=s("Module"),M=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var E=l(f);g=n(E,"Module"),E.forEach(t),M=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(i,h){m(i,d,h),e(d,b),e(d,f),e(f,g),e(d,M)},d(i){i&&t(d)}}}function ob(I){let d,b,f,g,M;return g=new it({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjB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yQyUyMDEwMDAlMkMlMjAxMDAwJTJDJTIwMTAwMCU1RCU1RCUwQSUwQWVuY29kaW5nJTIwJTNEJTIwdG9rZW5pemVyKCUyMiUyMCUyMi5qb2luKHdvcmRzKSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBaW5wdXRfaWRzJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEFhdHRlbnRpb25fbWFzayUyMCUzRCUyMGVuY29kaW5nJTVCJTIyYXR0ZW50aW9uX21hc2slMjIlNUQlMEF0b2tlbl90eXBlX2lkcyUyMCUzRCUyMGVuY29kaW5nJTVCJTIydG9rZW5fdHlwZV9pZHMlMjIlNUQlMEFiYm94JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QnRva2VuX2JveGVzJTVEKSUwQXRva2VuX2xhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTJDJTIwMSUyQyUyMDAlMkMlMjAwJTVEKS51bnNxdWVlemUoMCklMjAlMjAlMjMlMjBiYXRjaCUyMHNpemUlMjBvZiUyMDElMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoJTBBJTIwJTIwJTIwJTIwaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTBBJTIwJTIwJTIwJTIwYmJveCUzRGJib3glMkMlMEElMjAlMjAlMjAlMjBhdHRlbnRpb25fbWFzayUzRGF0dGVudGlvbl9tYXNrJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5fdHlwZV9pZHMlM0R0b2tlbl90eXBlX2lkcyUyQyUwQSUyMCUyMCUyMCUyMGxhYmVscyUzRHRva2VuX2xhYmVscyUyQyUwQSklMEElMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",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`}}),{c(){d=a("p"),b=s("Examples:"),f=c(),w(g.$$.fragment)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Examples:"),h.forEach(t),f=p(i),k(g.$$.fragment,i)},m(i,h){m(i,d,h),e(d,b),m(i,f,h),v(g,i,h),M=!0},p:gt,i(i){M||(L(g.$$.fragment,i),M=!0)},o(i){j(g.$$.fragment,i),M=!1},d(i){i&&t(d),i&&t(f),U(g,i)}}}function sb(I){let d,b;return d=new it({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMYXlvdXRMTUZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZ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uY2VfaWRzKDApJTJDJTIwZW5jb2Rpbmcud29yZF9pZHMoMCkpJTNBJTBBJTIwJTIwJTIwJTIwaWYlMjBzJTIwJTNEJTNEJTIwMSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJib3guYXBwZW5kKGJveGVzJTVCdyU1RCklMEElMjAlMjAlMjAlMjBlbGlmJTIwaSUyMCUzRCUzRCUyMHRva2VuaXplci5zZXBfdG9rZW5faWQlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBiYm94LmFwcGVuZCglNUIxMDAwJTVEJTIwKiUyMDQpJTBBJTIwJTIwJTIwJTIwZWxzZSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJib3guYXBwZW5kKCU1QjAlNUQlMjAqJTIwNCklMEFlbmNvZGluZyU1QiUyMmJib3glMjIlNUQlMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCYmJveCU1RCklMEElMEF3b3JkX2lkcyUyMCUzRCUyMGVuY29kaW5nLndvcmRfaWRzKDApJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqZW5jb2RpbmcpJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcyUwQXN0YXJ0X3Njb3JlcyUyMCUzRCUyMG91dHB1dHMuc3RhcnRfbG9naXRzJTBBZW5kX3Njb3JlcyUyMCUzRCUyMG91dHB1dHMuZW5kX2xvZ2l0cyUwQXN0YXJ0JTJDJTIwZW5kJTIwJTNEJTIwd29yZF9pZHMlNUJzdGFydF9zY29yZXMuYXJnbWF4KC0xKSU1RCUyQyUyMHdvcmRfaWRzJTVCZW5kX3Njb3Jlcy5hcmdtYXgoLTEpJTVEJTBBcHJpbnQoJTIyJTIwJTIyLmpvaW4od29yZHMlNUJzdGFydCUyMCUzQSUyMGVuZCUyMCUyQiUyMDElNUQpKQ==",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`}}),{c(){w(d.$$.fragment)},l(f){k(d.$$.fragment,f)},m(f,g){v(d,f,g),b=!0},p:gt,i(f){b||(L(d.$$.fragment,f),b=!0)},o(f){j(d.$$.fragment,f),b=!1},d(f){U(d,f)}}}function nb(I){let d,b,f,g,M,i,h,E,Le,ye,W,_e,G,T,he,R,je,me,D,Me,ne,X,le,Ue,S,be,oe,Z,Je,ie,ae,$,F,de,P,ce,Ce,H,Ee,pe,z,ue,O,$e,Te,B,Ie,we,A,fe,Y,ke,ee,x,ve,N,Q,Fe;return{c(){d=a("p"),b=s("TensorFlow models and layers in "),f=a("code"),g=s("transformers"),M=s(" accept two formats as input:"),i=c(),h=a("ul"),E=a("li"),Le=s("having all inputs as keyword arguments (like PyTorch models), or"),ye=c(),W=a("li"),_e=s("having all inputs as a list, tuple or dict in the first positional argument."),G=c(),T=a("p"),he=s(`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 `),R=a("code"),je=s("model.fit()"),me=s(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=a("code"),Me=s("model.fit()"),ne=s(` supports! If, however, you want to use the second
format outside of Keras methods like `),X=a("code"),le=s("fit()"),Ue=s(" and "),S=a("code"),be=s("predict()"),oe=s(`, such as when creating your own layers or models with
the Keras `),Z=a("code"),Je=s("Functional"),ie=s(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),ae=c(),$=a("ul"),F=a("li"),de=s("a single Tensor with "),P=a("code"),ce=s("input_ids"),Ce=s(" only and nothing else: "),H=a("code"),Ee=s("model(input_ids)"),pe=c(),z=a("li"),ue=s(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),O=a("code"),$e=s("model([input_ids, attention_mask])"),Te=s(" or "),B=a("code"),Ie=s("model([input_ids, attention_mask, token_type_ids])"),we=c(),A=a("li"),fe=s(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=a("code"),ke=s('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=c(),x=a("p"),ve=s(`Note that when creating models and layers with
`),N=a("a"),Q=s("subclassing"),Fe=s(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(_){d=r(_,"P",{});var J=l(d);b=n(J,"TensorFlow models and layers in "),f=r(J,"CODE",{});var Ve=l(f);g=n(Ve,"transformers"),Ve.forEach(t),M=n(J," accept two formats as input:"),J.forEach(t),i=p(_),h=r(_,"UL",{});var te=l(h);E=r(te,"LI",{});var We=l(E);Le=n(We,"having all inputs as keyword arguments (like PyTorch models), or"),We.forEach(t),ye=p(te),W=r(te,"LI",{});var Be=l(W);_e=n(Be,"having all inputs as a list, tuple or dict in the first positional argument."),Be.forEach(t),te.forEach(t),G=p(_),T=r(_,"P",{});var C=l(T);he=n(C,`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 `),R=r(C,"CODE",{});var Qe=l(R);je=n(Qe,"model.fit()"),Qe.forEach(t),me=n(C,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=r(C,"CODE",{});var Ge=l(D);Me=n(Ge,"model.fit()"),Ge.forEach(t),ne=n(C,` supports! If, however, you want to use the second
format outside of Keras methods like `),X=r(C,"CODE",{});var xe=l(X);le=n(xe,"fit()"),xe.forEach(t),Ue=n(C," and "),S=r(C,"CODE",{});var De=l(S);be=n(De,"predict()"),De.forEach(t),oe=n(C,`, such as when creating your own layers or models with
the Keras `),Z=r(C,"CODE",{});var Xe=l(Z);Je=n(Xe,"Functional"),Xe.forEach(t),ie=n(C,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),C.forEach(t),ae=p(_),$=r(_,"UL",{});var q=l($);F=r(q,"LI",{});var K=l(F);de=n(K,"a single Tensor with "),P=r(K,"CODE",{});var Se=l(P);ce=n(Se,"input_ids"),Se.forEach(t),Ce=n(K," only and nothing else: "),H=r(K,"CODE",{});var Ae=l(H);Ee=n(Ae,"model(input_ids)"),Ae.forEach(t),K.forEach(t),pe=p(q),z=r(q,"LI",{});var V=l(z);ue=n(V,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),O=r(V,"CODE",{});var Re=l(O);$e=n(Re,"model([input_ids, attention_mask])"),Re.forEach(t),Te=n(V," or "),B=r(V,"CODE",{});var ge=l(B);Ie=n(ge,"model([input_ids, attention_mask, token_type_ids])"),ge.forEach(t),V.forEach(t),we=p(q),A=r(q,"LI",{});var ze=l(A);fe=n(ze,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=r(ze,"CODE",{});var qe=l(Y);ke=n(qe,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),qe.forEach(t),ze.forEach(t),q.forEach(t),ee=p(_),x=r(_,"P",{});var re=l(x);ve=n(re,`Note that when creating models and layers with
`),N=r(re,"A",{href:!0,rel:!0});var Pe=l(N);Q=n(Pe,"subclassing"),Pe.forEach(t),Fe=n(re,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),re.forEach(t),this.h()},h(){u(N,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(N,"rel","nofollow")},m(_,J){m(_,d,J),e(d,b),e(d,f),e(f,g),e(d,M),m(_,i,J),m(_,h,J),e(h,E),e(E,Le),e(h,ye),e(h,W),e(W,_e),m(_,G,J),m(_,T,J),e(T,he),e(T,R),e(R,je),e(T,me),e(T,D),e(D,Me),e(T,ne),e(T,X),e(X,le),e(T,Ue),e(T,S),e(S,be),e(T,oe),e(T,Z),e(Z,Je),e(T,ie),m(_,ae,J),m(_,$,J),e($,F),e(F,de),e(F,P),e(P,ce),e(F,Ce),e(F,H),e(H,Ee),e($,pe),e($,z),e(z,ue),e(z,O),e(O,$e),e(z,Te),e(z,B),e(B,Ie),e($,we),e($,A),e(A,fe),e(A,Y),e(Y,ke),m(_,ee,J),m(_,x,J),e(x,ve),e(x,N),e(N,Q),e(x,Fe)},d(_){_&&t(d),_&&t(i),_&&t(h),_&&t(G),_&&t(T),_&&t(ae),_&&t($),_&&t(ee),_&&t(x)}}}function ab(I){let d,b,f,g,M;return{c(){d=a("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),g=s("Module"),M=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var E=l(f);g=n(E,"Module"),E.forEach(t),M=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(i,h){m(i,d,h),e(d,b),e(d,f),e(f,g),e(d,M)},d(i){i&&t(d)}}}function rb(I){let d,b,f,g,M;return g=new it({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`}}),{c(){d=a("p"),b=s("Examples:"),f=c(),w(g.$$.fragment)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Examples:"),h.forEach(t),f=p(i),k(g.$$.fragment,i)},m(i,h){m(i,d,h),e(d,b),m(i,f,h),v(g,i,h),M=!0},p:gt,i(i){M||(L(g.$$.fragment,i),M=!0)},o(i){j(g.$$.fragment,i),M=!1},d(i){i&&t(d),i&&t(f),U(g,i)}}}function lb(I){let d,b,f,g,M,i,h,E,Le,ye,W,_e,G,T,he,R,je,me,D,Me,ne,X,le,Ue,S,be,oe,Z,Je,ie,ae,$,F,de,P,ce,Ce,H,Ee,pe,z,ue,O,$e,Te,B,Ie,we,A,fe,Y,ke,ee,x,ve,N,Q,Fe;return{c(){d=a("p"),b=s("TensorFlow models and layers in "),f=a("code"),g=s("transformers"),M=s(" accept two formats as input:"),i=c(),h=a("ul"),E=a("li"),Le=s("having all inputs as keyword arguments (like PyTorch models), or"),ye=c(),W=a("li"),_e=s("having all inputs as a list, tuple or dict in the first positional argument."),G=c(),T=a("p"),he=s(`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 `),R=a("code"),je=s("model.fit()"),me=s(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=a("code"),Me=s("model.fit()"),ne=s(` supports! If, however, you want to use the second
format outside of Keras methods like `),X=a("code"),le=s("fit()"),Ue=s(" and "),S=a("code"),be=s("predict()"),oe=s(`, such as when creating your own layers or models with
the Keras `),Z=a("code"),Je=s("Functional"),ie=s(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),ae=c(),$=a("ul"),F=a("li"),de=s("a single Tensor with "),P=a("code"),ce=s("input_ids"),Ce=s(" only and nothing else: "),H=a("code"),Ee=s("model(input_ids)"),pe=c(),z=a("li"),ue=s(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),O=a("code"),$e=s("model([input_ids, attention_mask])"),Te=s(" or "),B=a("code"),Ie=s("model([input_ids, attention_mask, token_type_ids])"),we=c(),A=a("li"),fe=s(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=a("code"),ke=s('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=c(),x=a("p"),ve=s(`Note that when creating models and layers with
`),N=a("a"),Q=s("subclassing"),Fe=s(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(_){d=r(_,"P",{});var J=l(d);b=n(J,"TensorFlow models and layers in "),f=r(J,"CODE",{});var Ve=l(f);g=n(Ve,"transformers"),Ve.forEach(t),M=n(J," accept two formats as input:"),J.forEach(t),i=p(_),h=r(_,"UL",{});var te=l(h);E=r(te,"LI",{});var We=l(E);Le=n(We,"having all inputs as keyword arguments (like PyTorch models), or"),We.forEach(t),ye=p(te),W=r(te,"LI",{});var Be=l(W);_e=n(Be,"having all inputs as a list, tuple or dict in the first positional argument."),Be.forEach(t),te.forEach(t),G=p(_),T=r(_,"P",{});var C=l(T);he=n(C,`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 `),R=r(C,"CODE",{});var Qe=l(R);je=n(Qe,"model.fit()"),Qe.forEach(t),me=n(C,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=r(C,"CODE",{});var Ge=l(D);Me=n(Ge,"model.fit()"),Ge.forEach(t),ne=n(C,` supports! If, however, you want to use the second
format outside of Keras methods like `),X=r(C,"CODE",{});var xe=l(X);le=n(xe,"fit()"),xe.forEach(t),Ue=n(C," and "),S=r(C,"CODE",{});var De=l(S);be=n(De,"predict()"),De.forEach(t),oe=n(C,`, such as when creating your own layers or models with
the Keras `),Z=r(C,"CODE",{});var Xe=l(Z);Je=n(Xe,"Functional"),Xe.forEach(t),ie=n(C,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),C.forEach(t),ae=p(_),$=r(_,"UL",{});var q=l($);F=r(q,"LI",{});var K=l(F);de=n(K,"a single Tensor with "),P=r(K,"CODE",{});var Se=l(P);ce=n(Se,"input_ids"),Se.forEach(t),Ce=n(K," only and nothing else: "),H=r(K,"CODE",{});var Ae=l(H);Ee=n(Ae,"model(input_ids)"),Ae.forEach(t),K.forEach(t),pe=p(q),z=r(q,"LI",{});var V=l(z);ue=n(V,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),O=r(V,"CODE",{});var Re=l(O);$e=n(Re,"model([input_ids, attention_mask])"),Re.forEach(t),Te=n(V," or "),B=r(V,"CODE",{});var ge=l(B);Ie=n(ge,"model([input_ids, attention_mask, token_type_ids])"),ge.forEach(t),V.forEach(t),we=p(q),A=r(q,"LI",{});var ze=l(A);fe=n(ze,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=r(ze,"CODE",{});var qe=l(Y);ke=n(qe,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),qe.forEach(t),ze.forEach(t),q.forEach(t),ee=p(_),x=r(_,"P",{});var re=l(x);ve=n(re,`Note that when creating models and layers with
`),N=r(re,"A",{href:!0,rel:!0});var Pe=l(N);Q=n(Pe,"subclassing"),Pe.forEach(t),Fe=n(re,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),re.forEach(t),this.h()},h(){u(N,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(N,"rel","nofollow")},m(_,J){m(_,d,J),e(d,b),e(d,f),e(f,g),e(d,M),m(_,i,J),m(_,h,J),e(h,E),e(E,Le),e(h,ye),e(h,W),e(W,_e),m(_,G,J),m(_,T,J),e(T,he),e(T,R),e(R,je),e(T,me),e(T,D),e(D,Me),e(T,ne),e(T,X),e(X,le),e(T,Ue),e(T,S),e(S,be),e(T,oe),e(T,Z),e(Z,Je),e(T,ie),m(_,ae,J),m(_,$,J),e($,F),e(F,de),e(F,P),e(P,ce),e(F,Ce),e(F,H),e(H,Ee),e($,pe),e($,z),e(z,ue),e(z,O),e(O,$e),e(z,Te),e(z,B),e(B,Ie),e($,we),e($,A),e(A,fe),e(A,Y),e(Y,ke),m(_,ee,J),m(_,x,J),e(x,ve),e(x,N),e(N,Q),e(x,Fe)},d(_){_&&t(d),_&&t(i),_&&t(h),_&&t(G),_&&t(T),_&&t(ae),_&&t($),_&&t(ee),_&&t(x)}}}function ib(I){let d,b,f,g,M;return{c(){d=a("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),g=s("Module"),M=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var E=l(f);g=n(E,"Module"),E.forEach(t),M=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(i,h){m(i,d,h),e(d,b),e(d,f),e(f,g),e(d,M)},d(i){i&&t(d)}}}function db(I){let d,b,f,g,M;return g=new it({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkxheW91dExNRm9yTWFza2VkTE0lMEFpbXBvcnQlMjB0ZW5zb3JmbG93JTIwYXMlMjB0ZiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMm1p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vcnMlM0QlMjJ0ZiUyMiklMEFpbnB1dF9pZHMlMjAlM0QlMjBlbmNvZGluZyU1QiUyMmlucHV0X2lkcyUyMiU1RCUwQWF0dGVudGlvbl9tYXNrJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJhdHRlbnRpb25fbWFzayUyMiU1RCUwQXRva2VuX3R5cGVfaWRzJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJ0b2tlbl90eXBlX2lkcyUyMiU1RCUwQWJib3glMjAlM0QlMjB0Zi5jb252ZXJ0X3RvX3RlbnNvciglNUJ0b2tlbl9ib3hlcyU1RCklMEElMEFsYWJlbHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMjB3b3JsZCUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUwQSUyMCUyMCUyMCUyMGJib3glM0RiYm94JTJDJTBBJTIwJTIwJTIwJTIwYXR0ZW50aW9uX21hc2slM0RhdHRlbnRpb25fbWFzayUyQyUwQSUyMCUyMCUyMCUyMHRva2VuX3R5cGVfaWRzJTNEdG9rZW5fdHlwZV9pZHMlMkMlMEElMjAlMjAlMjAlMjBsYWJlbHMlM0RsYWJlbHMlMkMlMEEpJTBBJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcw==",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`}}),{c(){d=a("p"),b=s("Examples:"),f=c(),w(g.$$.fragment)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Examples:"),h.forEach(t),f=p(i),k(g.$$.fragment,i)},m(i,h){m(i,d,h),e(d,b),m(i,f,h),v(g,i,h),M=!0},p:gt,i(i){M||(L(g.$$.fragment,i),M=!0)},o(i){j(g.$$.fragment,i),M=!1},d(i){i&&t(d),i&&t(f),U(g,i)}}}function cb(I){let d,b,f,g,M,i,h,E,Le,ye,W,_e,G,T,he,R,je,me,D,Me,ne,X,le,Ue,S,be,oe,Z,Je,ie,ae,$,F,de,P,ce,Ce,H,Ee,pe,z,ue,O,$e,Te,B,Ie,we,A,fe,Y,ke,ee,x,ve,N,Q,Fe;return{c(){d=a("p"),b=s("TensorFlow models and layers in "),f=a("code"),g=s("transformers"),M=s(" accept two formats as input:"),i=c(),h=a("ul"),E=a("li"),Le=s("having all inputs as keyword arguments (like PyTorch models), or"),ye=c(),W=a("li"),_e=s("having all inputs as a list, tuple or dict in the first positional argument."),G=c(),T=a("p"),he=s(`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 `),R=a("code"),je=s("model.fit()"),me=s(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=a("code"),Me=s("model.fit()"),ne=s(` supports! If, however, you want to use the second
format outside of Keras methods like `),X=a("code"),le=s("fit()"),Ue=s(" and "),S=a("code"),be=s("predict()"),oe=s(`, such as when creating your own layers or models with
the Keras `),Z=a("code"),Je=s("Functional"),ie=s(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),ae=c(),$=a("ul"),F=a("li"),de=s("a single Tensor with "),P=a("code"),ce=s("input_ids"),Ce=s(" only and nothing else: "),H=a("code"),Ee=s("model(input_ids)"),pe=c(),z=a("li"),ue=s(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),O=a("code"),$e=s("model([input_ids, attention_mask])"),Te=s(" or "),B=a("code"),Ie=s("model([input_ids, attention_mask, token_type_ids])"),we=c(),A=a("li"),fe=s(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=a("code"),ke=s('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=c(),x=a("p"),ve=s(`Note that when creating models and layers with
`),N=a("a"),Q=s("subclassing"),Fe=s(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(_){d=r(_,"P",{});var J=l(d);b=n(J,"TensorFlow models and layers in "),f=r(J,"CODE",{});var Ve=l(f);g=n(Ve,"transformers"),Ve.forEach(t),M=n(J," accept two formats as input:"),J.forEach(t),i=p(_),h=r(_,"UL",{});var te=l(h);E=r(te,"LI",{});var We=l(E);Le=n(We,"having all inputs as keyword arguments (like PyTorch models), or"),We.forEach(t),ye=p(te),W=r(te,"LI",{});var Be=l(W);_e=n(Be,"having all inputs as a list, tuple or dict in the first positional argument."),Be.forEach(t),te.forEach(t),G=p(_),T=r(_,"P",{});var C=l(T);he=n(C,`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 `),R=r(C,"CODE",{});var Qe=l(R);je=n(Qe,"model.fit()"),Qe.forEach(t),me=n(C,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=r(C,"CODE",{});var Ge=l(D);Me=n(Ge,"model.fit()"),Ge.forEach(t),ne=n(C,` supports! If, however, you want to use the second
format outside of Keras methods like `),X=r(C,"CODE",{});var xe=l(X);le=n(xe,"fit()"),xe.forEach(t),Ue=n(C," and "),S=r(C,"CODE",{});var De=l(S);be=n(De,"predict()"),De.forEach(t),oe=n(C,`, such as when creating your own layers or models with
the Keras `),Z=r(C,"CODE",{});var Xe=l(Z);Je=n(Xe,"Functional"),Xe.forEach(t),ie=n(C,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),C.forEach(t),ae=p(_),$=r(_,"UL",{});var q=l($);F=r(q,"LI",{});var K=l(F);de=n(K,"a single Tensor with "),P=r(K,"CODE",{});var Se=l(P);ce=n(Se,"input_ids"),Se.forEach(t),Ce=n(K," only and nothing else: "),H=r(K,"CODE",{});var Ae=l(H);Ee=n(Ae,"model(input_ids)"),Ae.forEach(t),K.forEach(t),pe=p(q),z=r(q,"LI",{});var V=l(z);ue=n(V,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),O=r(V,"CODE",{});var Re=l(O);$e=n(Re,"model([input_ids, attention_mask])"),Re.forEach(t),Te=n(V," or "),B=r(V,"CODE",{});var ge=l(B);Ie=n(ge,"model([input_ids, attention_mask, token_type_ids])"),ge.forEach(t),V.forEach(t),we=p(q),A=r(q,"LI",{});var ze=l(A);fe=n(ze,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=r(ze,"CODE",{});var qe=l(Y);ke=n(qe,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),qe.forEach(t),ze.forEach(t),q.forEach(t),ee=p(_),x=r(_,"P",{});var re=l(x);ve=n(re,`Note that when creating models and layers with
`),N=r(re,"A",{href:!0,rel:!0});var Pe=l(N);Q=n(Pe,"subclassing"),Pe.forEach(t),Fe=n(re,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),re.forEach(t),this.h()},h(){u(N,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(N,"rel","nofollow")},m(_,J){m(_,d,J),e(d,b),e(d,f),e(f,g),e(d,M),m(_,i,J),m(_,h,J),e(h,E),e(E,Le),e(h,ye),e(h,W),e(W,_e),m(_,G,J),m(_,T,J),e(T,he),e(T,R),e(R,je),e(T,me),e(T,D),e(D,Me),e(T,ne),e(T,X),e(X,le),e(T,Ue),e(T,S),e(S,be),e(T,oe),e(T,Z),e(Z,Je),e(T,ie),m(_,ae,J),m(_,$,J),e($,F),e(F,de),e(F,P),e(P,ce),e(F,Ce),e(F,H),e(H,Ee),e($,pe),e($,z),e(z,ue),e(z,O),e(O,$e),e(z,Te),e(z,B),e(B,Ie),e($,we),e($,A),e(A,fe),e(A,Y),e(Y,ke),m(_,ee,J),m(_,x,J),e(x,ve),e(x,N),e(N,Q),e(x,Fe)},d(_){_&&t(d),_&&t(i),_&&t(h),_&&t(G),_&&t(T),_&&t(ae),_&&t($),_&&t(ee),_&&t(x)}}}function pb(I){let d,b,f,g,M;return{c(){d=a("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),g=s("Module"),M=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var E=l(f);g=n(E,"Module"),E.forEach(t),M=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(i,h){m(i,d,h),e(d,b),e(d,f),e(f,g),e(d,M)},d(i){i&&t(d)}}}function ub(I){let d,b,f,g,M;return g=new it({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkxheW91dExNRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQW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wMTAwMCUyQyUyMDEwMDAlNUQlNUQlMEElMEFlbmNvZGluZyUyMCUzRCUyMHRva2VuaXplciglMjIlMjAlMjIuam9pbih3b3JkcyklMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQWlucHV0X2lkcyUyMCUzRCUyMGVuY29kaW5nJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBYXR0ZW50aW9uX21hc2slMjAlM0QlMjBlbmNvZGluZyU1QiUyMmF0dGVudGlvbl9tYXNrJTIyJTVEJTBBdG9rZW5fdHlwZV9pZHMlMjAlM0QlMjBlbmNvZGluZyU1QiUyMnRva2VuX3R5cGVfaWRzJTIyJTVEJTBBYmJveCUyMCUzRCUyMHRmLmNvbnZlcnRfdG9fdGVuc29yKCU1QnRva2VuX2JveGVzJTVEKSUwQXNlcXVlbmNlX2xhYmVsJTIwJTNEJTIwdGYuY29udmVydF90b190ZW5zb3IoJTVCMSU1RCklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoJTBBJTIwJTIwJTIwJTIwaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTBBJTIwJTIwJTIwJTIwYmJveCUzRGJib3glMkMlMEElMjAlMjAlMjAlMjBhdHRlbnRpb25fbWFzayUzRGF0dGVudGlvbl9tYXNrJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5fdHlwZV9pZHMlM0R0b2tlbl90eXBlX2lkcyUyQyUwQSUyMCUyMCUyMCUyMGxhYmVscyUzRHNlcXVlbmNlX2xhYmVsJTJDJTBBKSUwQSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",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`}}),{c(){d=a("p"),b=s("Examples:"),f=c(),w(g.$$.fragment)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Examples:"),h.forEach(t),f=p(i),k(g.$$.fragment,i)},m(i,h){m(i,d,h),e(d,b),m(i,f,h),v(g,i,h),M=!0},p:gt,i(i){M||(L(g.$$.fragment,i),M=!0)},o(i){j(g.$$.fragment,i),M=!1},d(i){i&&t(d),i&&t(f),U(g,i)}}}function hb(I){let d,b,f,g,M,i,h,E,Le,ye,W,_e,G,T,he,R,je,me,D,Me,ne,X,le,Ue,S,be,oe,Z,Je,ie,ae,$,F,de,P,ce,Ce,H,Ee,pe,z,ue,O,$e,Te,B,Ie,we,A,fe,Y,ke,ee,x,ve,N,Q,Fe;return{c(){d=a("p"),b=s("TensorFlow models and layers in "),f=a("code"),g=s("transformers"),M=s(" accept two formats as input:"),i=c(),h=a("ul"),E=a("li"),Le=s("having all inputs as keyword arguments (like PyTorch models), or"),ye=c(),W=a("li"),_e=s("having all inputs as a list, tuple or dict in the first positional argument."),G=c(),T=a("p"),he=s(`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 `),R=a("code"),je=s("model.fit()"),me=s(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=a("code"),Me=s("model.fit()"),ne=s(` supports! If, however, you want to use the second
format outside of Keras methods like `),X=a("code"),le=s("fit()"),Ue=s(" and "),S=a("code"),be=s("predict()"),oe=s(`, such as when creating your own layers or models with
the Keras `),Z=a("code"),Je=s("Functional"),ie=s(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),ae=c(),$=a("ul"),F=a("li"),de=s("a single Tensor with "),P=a("code"),ce=s("input_ids"),Ce=s(" only and nothing else: "),H=a("code"),Ee=s("model(input_ids)"),pe=c(),z=a("li"),ue=s(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),O=a("code"),$e=s("model([input_ids, attention_mask])"),Te=s(" or "),B=a("code"),Ie=s("model([input_ids, attention_mask, token_type_ids])"),we=c(),A=a("li"),fe=s(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=a("code"),ke=s('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=c(),x=a("p"),ve=s(`Note that when creating models and layers with
`),N=a("a"),Q=s("subclassing"),Fe=s(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(_){d=r(_,"P",{});var J=l(d);b=n(J,"TensorFlow models and layers in "),f=r(J,"CODE",{});var Ve=l(f);g=n(Ve,"transformers"),Ve.forEach(t),M=n(J," accept two formats as input:"),J.forEach(t),i=p(_),h=r(_,"UL",{});var te=l(h);E=r(te,"LI",{});var We=l(E);Le=n(We,"having all inputs as keyword arguments (like PyTorch models), or"),We.forEach(t),ye=p(te),W=r(te,"LI",{});var Be=l(W);_e=n(Be,"having all inputs as a list, tuple or dict in the first positional argument."),Be.forEach(t),te.forEach(t),G=p(_),T=r(_,"P",{});var C=l(T);he=n(C,`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 `),R=r(C,"CODE",{});var Qe=l(R);je=n(Qe,"model.fit()"),Qe.forEach(t),me=n(C,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=r(C,"CODE",{});var Ge=l(D);Me=n(Ge,"model.fit()"),Ge.forEach(t),ne=n(C,` supports! If, however, you want to use the second
format outside of Keras methods like `),X=r(C,"CODE",{});var xe=l(X);le=n(xe,"fit()"),xe.forEach(t),Ue=n(C," and "),S=r(C,"CODE",{});var De=l(S);be=n(De,"predict()"),De.forEach(t),oe=n(C,`, such as when creating your own layers or models with
the Keras `),Z=r(C,"CODE",{});var Xe=l(Z);Je=n(Xe,"Functional"),Xe.forEach(t),ie=n(C,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),C.forEach(t),ae=p(_),$=r(_,"UL",{});var q=l($);F=r(q,"LI",{});var K=l(F);de=n(K,"a single Tensor with "),P=r(K,"CODE",{});var Se=l(P);ce=n(Se,"input_ids"),Se.forEach(t),Ce=n(K," only and nothing else: "),H=r(K,"CODE",{});var Ae=l(H);Ee=n(Ae,"model(input_ids)"),Ae.forEach(t),K.forEach(t),pe=p(q),z=r(q,"LI",{});var V=l(z);ue=n(V,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),O=r(V,"CODE",{});var Re=l(O);$e=n(Re,"model([input_ids, attention_mask])"),Re.forEach(t),Te=n(V," or "),B=r(V,"CODE",{});var ge=l(B);Ie=n(ge,"model([input_ids, attention_mask, token_type_ids])"),ge.forEach(t),V.forEach(t),we=p(q),A=r(q,"LI",{});var ze=l(A);fe=n(ze,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=r(ze,"CODE",{});var qe=l(Y);ke=n(qe,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),qe.forEach(t),ze.forEach(t),q.forEach(t),ee=p(_),x=r(_,"P",{});var re=l(x);ve=n(re,`Note that when creating models and layers with
`),N=r(re,"A",{href:!0,rel:!0});var Pe=l(N);Q=n(Pe,"subclassing"),Pe.forEach(t),Fe=n(re,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),re.forEach(t),this.h()},h(){u(N,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(N,"rel","nofollow")},m(_,J){m(_,d,J),e(d,b),e(d,f),e(f,g),e(d,M),m(_,i,J),m(_,h,J),e(h,E),e(E,Le),e(h,ye),e(h,W),e(W,_e),m(_,G,J),m(_,T,J),e(T,he),e(T,R),e(R,je),e(T,me),e(T,D),e(D,Me),e(T,ne),e(T,X),e(X,le),e(T,Ue),e(T,S),e(S,be),e(T,oe),e(T,Z),e(Z,Je),e(T,ie),m(_,ae,J),m(_,$,J),e($,F),e(F,de),e(F,P),e(P,ce),e(F,Ce),e(F,H),e(H,Ee),e($,pe),e($,z),e(z,ue),e(z,O),e(O,$e),e(z,Te),e(z,B),e(B,Ie),e($,we),e($,A),e(A,fe),e(A,Y),e(Y,ke),m(_,ee,J),m(_,x,J),e(x,ve),e(x,N),e(N,Q),e(x,Fe)},d(_){_&&t(d),_&&t(i),_&&t(h),_&&t(G),_&&t(T),_&&t(ae),_&&t($),_&&t(ee),_&&t(x)}}}function mb(I){let d,b,f,g,M;return{c(){d=a("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),g=s("Module"),M=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var E=l(f);g=n(E,"Module"),E.forEach(t),M=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(i,h){m(i,d,h),e(d,b),e(d,f),e(f,g),e(d,M)},d(i){i&&t(d)}}}function fb(I){let d,b,f,g,M;return g=new it({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTI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orflow <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`}}),{c(){d=a("p"),b=s("Examples:"),f=c(),w(g.$$.fragment)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Examples:"),h.forEach(t),f=p(i),k(g.$$.fragment,i)},m(i,h){m(i,d,h),e(d,b),m(i,f,h),v(g,i,h),M=!0},p:gt,i(i){M||(L(g.$$.fragment,i),M=!0)},o(i){j(g.$$.fragment,i),M=!1},d(i){i&&t(d),i&&t(f),U(g,i)}}}function gb(I){let d,b,f,g,M,i,h,E,Le,ye,W,_e,G,T,he,R,je,me,D,Me,ne,X,le,Ue,S,be,oe,Z,Je,ie,ae,$,F,de,P,ce,Ce,H,Ee,pe,z,ue,O,$e,Te,B,Ie,we,A,fe,Y,ke,ee,x,ve,N,Q,Fe;return{c(){d=a("p"),b=s("TensorFlow models and layers in "),f=a("code"),g=s("transformers"),M=s(" accept two formats as input:"),i=c(),h=a("ul"),E=a("li"),Le=s("having all inputs as keyword arguments (like PyTorch models), or"),ye=c(),W=a("li"),_e=s("having all inputs as a list, tuple or dict in the first positional argument."),G=c(),T=a("p"),he=s(`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 `),R=a("code"),je=s("model.fit()"),me=s(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=a("code"),Me=s("model.fit()"),ne=s(` supports! If, however, you want to use the second
format outside of Keras methods like `),X=a("code"),le=s("fit()"),Ue=s(" and "),S=a("code"),be=s("predict()"),oe=s(`, such as when creating your own layers or models with
the Keras `),Z=a("code"),Je=s("Functional"),ie=s(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),ae=c(),$=a("ul"),F=a("li"),de=s("a single Tensor with "),P=a("code"),ce=s("input_ids"),Ce=s(" only and nothing else: "),H=a("code"),Ee=s("model(input_ids)"),pe=c(),z=a("li"),ue=s(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),O=a("code"),$e=s("model([input_ids, attention_mask])"),Te=s(" or "),B=a("code"),Ie=s("model([input_ids, attention_mask, token_type_ids])"),we=c(),A=a("li"),fe=s(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=a("code"),ke=s('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=c(),x=a("p"),ve=s(`Note that when creating models and layers with
`),N=a("a"),Q=s("subclassing"),Fe=s(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(_){d=r(_,"P",{});var J=l(d);b=n(J,"TensorFlow models and layers in "),f=r(J,"CODE",{});var Ve=l(f);g=n(Ve,"transformers"),Ve.forEach(t),M=n(J," accept two formats as input:"),J.forEach(t),i=p(_),h=r(_,"UL",{});var te=l(h);E=r(te,"LI",{});var We=l(E);Le=n(We,"having all inputs as keyword arguments (like PyTorch models), or"),We.forEach(t),ye=p(te),W=r(te,"LI",{});var Be=l(W);_e=n(Be,"having all inputs as a list, tuple or dict in the first positional argument."),Be.forEach(t),te.forEach(t),G=p(_),T=r(_,"P",{});var C=l(T);he=n(C,`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 `),R=r(C,"CODE",{});var Qe=l(R);je=n(Qe,"model.fit()"),Qe.forEach(t),me=n(C,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=r(C,"CODE",{});var Ge=l(D);Me=n(Ge,"model.fit()"),Ge.forEach(t),ne=n(C,` supports! If, however, you want to use the second
format outside of Keras methods like `),X=r(C,"CODE",{});var xe=l(X);le=n(xe,"fit()"),xe.forEach(t),Ue=n(C," and "),S=r(C,"CODE",{});var De=l(S);be=n(De,"predict()"),De.forEach(t),oe=n(C,`, such as when creating your own layers or models with
the Keras `),Z=r(C,"CODE",{});var Xe=l(Z);Je=n(Xe,"Functional"),Xe.forEach(t),ie=n(C,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),C.forEach(t),ae=p(_),$=r(_,"UL",{});var q=l($);F=r(q,"LI",{});var K=l(F);de=n(K,"a single Tensor with "),P=r(K,"CODE",{});var Se=l(P);ce=n(Se,"input_ids"),Se.forEach(t),Ce=n(K," only and nothing else: "),H=r(K,"CODE",{});var Ae=l(H);Ee=n(Ae,"model(input_ids)"),Ae.forEach(t),K.forEach(t),pe=p(q),z=r(q,"LI",{});var V=l(z);ue=n(V,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),O=r(V,"CODE",{});var Re=l(O);$e=n(Re,"model([input_ids, attention_mask])"),Re.forEach(t),Te=n(V," or "),B=r(V,"CODE",{});var ge=l(B);Ie=n(ge,"model([input_ids, attention_mask, token_type_ids])"),ge.forEach(t),V.forEach(t),we=p(q),A=r(q,"LI",{});var ze=l(A);fe=n(ze,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=r(ze,"CODE",{});var qe=l(Y);ke=n(qe,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),qe.forEach(t),ze.forEach(t),q.forEach(t),ee=p(_),x=r(_,"P",{});var re=l(x);ve=n(re,`Note that when creating models and layers with
`),N=r(re,"A",{href:!0,rel:!0});var Pe=l(N);Q=n(Pe,"subclassing"),Pe.forEach(t),Fe=n(re,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),re.forEach(t),this.h()},h(){u(N,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(N,"rel","nofollow")},m(_,J){m(_,d,J),e(d,b),e(d,f),e(f,g),e(d,M),m(_,i,J),m(_,h,J),e(h,E),e(E,Le),e(h,ye),e(h,W),e(W,_e),m(_,G,J),m(_,T,J),e(T,he),e(T,R),e(R,je),e(T,me),e(T,D),e(D,Me),e(T,ne),e(T,X),e(X,le),e(T,Ue),e(T,S),e(S,be),e(T,oe),e(T,Z),e(Z,Je),e(T,ie),m(_,ae,J),m(_,$,J),e($,F),e(F,de),e(F,P),e(P,ce),e(F,Ce),e(F,H),e(H,Ee),e($,pe),e($,z),e(z,ue),e(z,O),e(O,$e),e(z,Te),e(z,B),e(B,Ie),e($,we),e($,A),e(A,fe),e(A,Y),e(Y,ke),m(_,ee,J),m(_,x,J),e(x,ve),e(x,N),e(N,Q),e(x,Fe)},d(_){_&&t(d),_&&t(i),_&&t(h),_&&t(G),_&&t(T),_&&t(ae),_&&t($),_&&t(ee),_&&t(x)}}}function yb(I){let d,b,f,g,M;return{c(){d=a("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),g=s("Module"),M=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var E=l(f);g=n(E,"Module"),E.forEach(t),M=n(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter sil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wQXN0YXJ0JTJDJTIwZW5kJTIwJTNEJTIwd29yZF9pZHMlNUJ0Zi5tYXRoLmFyZ21heChzdGFydF9zY29yZXMlMkMlMjAtMSklNUIwJTVEJTVEJTJDJTIwd29yZF9pZHMlNUJ0Zi5tYXRoLmFyZ21heChlbmRfc2NvcmVzJTJDJTIwLTEpJTVCMCU1RCU1RCUwQXByaW50KCUyMiUyMCUyMi5qb2luKHdvcmRzJTVCc3RhcnQlMjAlM0ElMjBlbmQlMjAlMkIlMjAxJTVEKSk=",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`}}),{c(){d=a("p"),b=s("Examples:"),f=c(),w(g.$$.fragment)},l(i){d=r(i,"P",{});var h=l(d);b=n(h,"Examples:"),h.forEach(t),f=p(i),k(g.$$.fragment,i)},m(i,h){m(i,d,h),e(d,b),m(i,f,h),v(g,i,h),M=!0},p:gt,i(i){M||(L(g.$$.fragment,i),M=!0)},o(i){j(g.$$.fragment,i),M=!1},d(i){i&&t(d),i&&t(f),U(g,i)}}}function Mb(I){let d,b,f,g,M,i,h,E,Le,ye,W,_e,G,T,he,R,je,me,D,Me,ne,X,le,Ue,S,be,oe,Z,Je,ie,ae,$,F,de,P,ce,Ce,H,Ee,pe,z,ue,O,$e,Te,B,Ie,we,A,fe,Y,ke,ee,x,ve,N,Q,Fe,_,J,Ve,te,We,Be,C,Qe,Ge,xe,De,Xe,q,K,Se,Ae,V,Re,ge,ze,qe,re,Pe,$r,rc,lc,ki,Js,vi,Bt,bo,Ir,Cs,ic,Fr,dc,Li,za,cc,ji,Es,Ui,yt,zr,$s,pc,Is,uc,hc,mc,xr,Fs,fc,zs,gc,yc,_c,Nr,xs,Mc,Ns,bc,Tc,wc,qr,xa,kc,Na,vc,Ji,qs,Ci,To,As,Lc,Rs,jc,Uc,Jc,Ar,qa,Cc,Ei,Zs,$i,wo,Vs,Ec,Ws,$c,Ic,Fc,Rr,Aa,zc,Ii,Ra,Zr,xc,Fi,Za,Vr,Va,Nc,zi,Wa,qc,xi,Ba,Bs,Ac,Qs,Rc,Zc,Ni,Qt,ko,Wr,Gs,Vc,Br,Wc,qi,ut,Ds,Bc,Gt,Qc,Qa,Gc,Dc,Xs,Xc,Sc,Pc,Dt,Hc,Ga,Oc,Yc,Da,Kc,ep,tp,vo,Ai,Xt,Lo,Qr,Ss,op,G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MHdpZHRoJTJDJTIwaGVpZ2h0KSUzQSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGludCgxMDAwJTIwKiUyMChiYm94JTVCMCU1RCUyMCUyRiUyMHdpZHRoKSklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpbnQoMTAwMCUyMColMjAoYmJveCU1QjElNUQlMjAlMkYlMjBoZWlnaHQpKSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGludCgxMDAwJTIwKiUyMChiYm94JTVCMiU1RCUyMCUyRiUyMHdpZHRoKSklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpbnQoMTAwMCUyMColMjAoYmJveCU1QjMlNUQlMjAlMkYlMjBoZWlnaHQpKSUyQyUwQSUyMCUyMCUyMCUyMCU1RA==",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)),
    ]`}}),Js=new it({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`}}),Cs=new ot({}),Es=new Hg({props:{pipeline:"document-question-answering"}}),qs=new Hg({props:{pipeline:"text-classification"}}),Zs=new Hg({props:{pipeline:"token-classification"}}),Gs=new ot({}),Ds=new se({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.30.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.30.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.30.0/src/transformers/models/layoutlm/configuration_layoutlm.py#L36"}}),vo=new ft({props:{anchor:"transformers.LayoutLMConfig.example",$$slots:{default:[DM]},$$scope:{ctx:I}}}),Ss=new ot({}),Ps=new se({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.30.0/src/transformers/models/layoutlm/tokenization_layoutlm.py#L75"}}),Os=new se({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.30.0/src/transformers/models/layoutlm/tokenization_layoutlm.py#L205",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>
`}}),Ks=new se({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.30.0/src/transformers/models/layoutlm/tokenization_layoutlm.py#L200"}}),en=new se({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.30.0/src/transformers/models/layoutlm/tokenization_layoutlm.py#L258",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>
`}}),Uo=new ft({props:{anchor:"transformers.LayoutLMTokenizer.create_token_type_ids_from_sequences.example",$$slots:{default:[XM]},$$scope:{ctx:I}}}),tn=new se({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.30.0/src/transformers/models/layoutlm/tokenization_layoutlm.py#L230",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>
`}}),sn=new ot({}),nn=new se({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.30.0/src/transformers/models/layoutlm/tokenization_layoutlm_fast.py#L62"}}),ln=new se({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.30.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>
`}}),cn=new se({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.30.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>
`}}),Eo=new ft({props:{anchor:"transformers.LayoutLMTokenizerFast.create_token_type_ids_from_sequences.example",$$slots:{default:[SM]},$$scope:{ctx:I}}}),pn=new ot({}),un=new se({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.30.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.30.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.30.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L711"}}),yn=new se({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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.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.30.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L737",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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\u2019s 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>) \u2014 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.30.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Io=new pt({props:{$$slots:{default:[PM]},$$scope:{ctx:I}}}),Fo=new ft({props:{anchor:"transformers.LayoutLMModel.forward.example",$$slots:{default:[HM]},$$scope:{ctx:I}}}),_n=new ot({}),Mn=new se({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.30.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.30.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.30.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L859"}}),kn=new se({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:" = None"},{name:"encoder_attention_mask",val:" = 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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.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.30.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L884",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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.30.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),xo=new pt({props:{$$slots:{default:[OM]},$$scope:{ctx:I}}}),No=new ft({props:{anchor:"transformers.LayoutLMForMaskedLM.forward.example",$$slots:{default:[YM]},$$scope:{ctx:I}}}),vn=new ot({}),Ln=new se({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.30.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.30.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.30.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L994"}}),In=new se({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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.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.30.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L1008",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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.30.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ao=new pt({props:{$$slots:{default:[KM]},$$scope:{ctx:I}}}),Ro=new ft({props:{anchor:"transformers.LayoutLMForSequenceClassification.forward.example",$$slots:{default:[eb]},$$scope:{ctx:I}}}),Fn=new ot({}),zn=new se({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.30.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.30.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.30.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L1131"}}),Vn=new se({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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.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.30.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L1145",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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)  \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 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>) \u2014 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>) \u2014 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.30.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Vo=new pt({props:{$$slots:{default:[tb]},$$scope:{ctx:I}}}),Wo=new ft({props:{anchor:"transformers.LayoutLMForTokenClassification.forward.example",$$slots:{default:[ob]},$$scope:{ctx:I}}}),Wn=new ot({}),Bn=new se({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.30.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.30.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.30.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L1249"}}),Pn=new se({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.30.0/src/transformers/models/layoutlm/modeling_layoutlm.py#L1263",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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.30.0/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Qo=new ft({props:{anchor:"transformers.LayoutLMForQuestionAnswering.forward.example",$$slots:{default:[sb]},$$scope:{ctx:I}}}),Hn=new ot({}),On=new se({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.30.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.30.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.30.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L912"}}),Do=new pt({props:{$$slots:{default:[nb]},$$scope:{ctx:I}}}),ta=new se({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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMModel.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMModel.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMModel.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMModel.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.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.30.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L918",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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>) \u2014 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>) \u2014 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\u2019re 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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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\u2019s 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.30.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Xo=new pt({props:{$$slots:{default:[ab]},$$scope:{ctx:I}}}),So=new ft({props:{anchor:"transformers.TFLayoutLMModel.call.example",$$slots:{default:[rb]},$$scope:{ctx:I}}}),oa=new ot({}),sa=new se({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.30.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.30.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.30.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L991"}}),Ho=new pt({props:{$$slots:{default:[lb]},$$scope:{ctx:I}}}),ia=new se({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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMForMaskedLM.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.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.30.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1019",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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.30.0/en/main_classes/output#transformers.modeling_tf_outputs.TFMaskedLMOutput"
>transformers.modeling_tf_outputs.TFMaskedLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Oo=new pt({props:{$$slots:{default:[ib]},$$scope:{ctx:I}}}),Yo=new ft({props:{anchor:"transformers.TFLayoutLMForMaskedLM.call.example",$$slots:{default:[db]},$$scope:{ctx:I}}}),da=new ot({}),ca=new se({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.30.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.30.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.30.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1118"}}),es=new pt({props:{$$slots:{default:[cb]},$$scope:{ctx:I}}}),ma=new se({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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMForSequenceClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.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.30.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1136",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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.30.0/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),ts=new pt({props:{$$slots:{default:[pb]},$$scope:{ctx:I}}}),os=new ft({props:{anchor:"transformers.TFLayoutLMForSequenceClassification.call.example",$$slots:{default:[ub]},$$scope:{ctx:I}}}),fa=new ot({}),ga=new se({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.30.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.30.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.30.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1236"}}),ns=new pt({props:{$$slots:{default:[hb]},$$scope:{ctx:I}}}),ba=new se({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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMForTokenClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.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.30.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1260",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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)  \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 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>) \u2014 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>) \u2014 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.30.0/en/main_classes/output#transformers.modeling_tf_outputs.TFTokenClassifierOutput"
>transformers.modeling_tf_outputs.TFTokenClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),as=new pt({props:{$$slots:{default:[mb]},$$scope:{ctx:I}}}),rs=new ft({props:{anchor:"transformers.TFLayoutLMForTokenClassification.call.example",$$slots:{default:[fb]},$$scope:{ctx:I}}}),Ta=new ot({}),wa=new se({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.30.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.30.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.30.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1359"}}),is=new pt({props:{$$slots:{default:[gb]},$$scope:{ctx:I}}}),Ua=new se({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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.bbox",description:`<strong>bbox</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding Boxes of each input sequence tokens. Selected in the range <code>[0, config.max_2d_position_embeddings- 1]</code>.`,name:"bbox"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.position_ids",description:`<strong>position_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.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.30.0/src/transformers/models/layoutlm/modeling_tf_layoutlm.py#L1380",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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.30.0/en/main_classes/output#transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput"
>transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),ds=new pt({props:{$$slots:{default:[yb]},$$scope:{ctx:I}}}),cs=new ft({props:{anchor:"transformers.TFLayoutLMForQuestionAnswering.call.example",$$slots:{default:[_b]},$$scope:{ctx:I}}}),{c(){d=a("meta"),b=c(),f=a("h1"),g=a("a"),M=a("span"),w(i.$$.fragment),h=c(),E=a("span"),Le=s("LayoutLM"),ye=c(),W=a("a"),_e=c(),G=a("h2"),T=a("a"),he=a("span"),w(R.$$.fragment),je=c(),me=a("span"),D=s("Overview"),Me=c(),ne=a("p"),X=s("The LayoutLM model was proposed in the paper "),le=a("a"),Ue=s(`LayoutLM: Pre-training of Text and Layout for Document Image
Understanding`),S=s(` by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, and
Ming Zhou. It\u2019s 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:`),be=c(),oe=a("ul"),Z=a("li"),Je=s("form understanding: the "),ie=a("a"),ae=s("FUNSD"),$=s(` dataset (a collection of 199 annotated
forms comprising more than 30,000 words).`),F=c(),de=a("li"),P=s("receipt understanding: the "),ce=a("a"),Ce=s("SROIE"),H=s(` dataset (a collection of 626 receipts for
training and 347 receipts for testing).`),Ee=c(),pe=a("li"),z=s("document image classification: the "),ue=a("a"),O=s("RVL-CDIP"),$e=s(` dataset (a collection of
400,000 images belonging to one of 16 classes).`),Te=c(),B=a("p"),Ie=s("The abstract from the paper is the following:"),we=c(),A=a("p"),fe=a("em"),Y=s(`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\u2019 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).`),ke=c(),ee=a("p"),x=s("Tips:"),ve=c(),N=a("ul"),Q=a("li"),Fe=s("In addition to "),_=a("em"),J=s("input_ids"),Ve=s(", "),te=a("a"),We=s("forward()"),Be=s(" also expects the input "),C=a("code"),Qe=s("bbox"),Ge=s(`, 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\u2019s `),xe=a("a"),De=s("Tesseract"),Xe=s(" (there\u2019s a "),q=a("a"),K=s("Python wrapper"),Se=s(` 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:`),Ae=c(),w(V.$$.fragment),Re=c(),ge=a("p"),ze=s("Here, "),qe=a("code"),re=s("width"),Pe=s(" and "),$r=a("code"),rc=s("height"),lc=s(` 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:`),ki=c(),w(Js.$$.fragment),vi=c(),Bt=a("h2"),bo=a("a"),Ir=a("span"),w(Cs.$$.fragment),ic=c(),Fr=a("span"),dc=s("Resources"),Li=c(),za=a("p"),cc=s("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with LayoutLM. If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),ji=c(),w(Es.$$.fragment),Ui=c(),yt=a("ul"),zr=a("li"),$s=a("p"),pc=s("A blog post on "),Is=a("a"),uc=s(`fine-tuning
LayoutLM for document-understanding using Keras & Hugging Face
Transformers`),hc=s("."),mc=c(),xr=a("li"),Fs=a("p"),fc=s("A blog post on how to "),zs=a("a"),gc=s("fine-tune LayoutLM for document-understanding using only Hugging Face Transformers"),yc=s("."),_c=c(),Nr=a("li"),xs=a("p"),Mc=s("A notebook on how to "),Ns=a("a"),bc=s("fine-tune LayoutLM on the FUNSD dataset with image embeddings"),Tc=s("."),wc=c(),qr=a("li"),xa=a("p"),kc=s("See also: "),Na=a("a"),vc=s("Document question answering task guide"),Ji=c(),w(qs.$$.fragment),Ci=c(),To=a("ul"),As=a("li"),Lc=s("A notebook on how to "),Rs=a("a"),jc=s("fine-tune LayoutLM for sequence classification on the RVL-CDIP dataset"),Uc=s("."),Jc=c(),Ar=a("li"),qa=a("a"),Cc=s("Text classification task guide"),Ei=c(),w(Zs.$$.fragment),$i=c(),wo=a("ul"),Vs=a("li"),Ec=s("A notebook on how to "),Ws=a("a"),$c=s("fine-tune LayoutLM for token classification on the FUNSD dataset"),Ic=s("."),Fc=c(),Rr=a("li"),Aa=a("a"),zc=s("Token classification task guide"),Ii=c(),Ra=a("p"),Zr=a("strong"),xc=s("Other resources"),Fi=c(),Za=a("ul"),Vr=a("li"),Va=a("a"),Nc=s("Masked language modeling task guide"),zi=c(),Wa=a("p"),qc=s("\u{1F680} Deploy"),xi=c(),Ba=a("ul"),Bs=a("li"),Ac=s("A blog post on how to "),Qs=a("a"),Rc=s("Deploy LayoutLM with Hugging Face Inference Endpoints"),Zc=s("."),Ni=c(),Qt=a("h2"),ko=a("a"),Wr=a("span"),w(Gs.$$.fragment),Vc=c(),Br=a("span"),Wc=s("LayoutLMConfig"),qi=c(),ut=a("div"),w(Ds.$$.fragment),Bc=c(),Gt=a("p"),Qc=s("This is the configuration class to store the configuration of a "),Qa=a("a"),Gc=s("LayoutLMModel"),Dc=s(`. 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
`),Xs=a("a"),Xc=s("microsoft/layoutlm-base-uncased"),Sc=s(" architecture."),Pc=c(),Dt=a("p"),Hc=s("Configuration objects inherit from "),Ga=a("a"),Oc=s("BertConfig"),Yc=s(` and can be used to control the model outputs. Read the
documentation from `),Da=a("a"),Kc=s("BertConfig"),ep=s(" for more information."),tp=c(),w(vo.$$.fragment),Ai=c(),Xt=a("h2"),Lo=a("a"),Qr=a("span"),w(Ss.$$.fragment),op=c(),Gr=a("span"),sp=s("LayoutLMTokenizer"),Ri=c(),Ze=a("div"),w(Ps.$$.fragment),np=c(),Dr=a("p"),ap=s("Construct a LayoutLM tokenizer. Based on WordPiece."),rp=c(),Hs=a("p"),lp=s("This tokenizer inherits from "),Xa=a("a"),ip=s("PreTrainedTokenizer"),dp=s(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),cp=c(),Nt=a("div"),w(Os.$$.fragment),pp=c(),Xr=a("p"),up=s(`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:`),hp=c(),Ys=a("ul"),Sa=a("li"),mp=s("single sequence: "),Sr=a("code"),fp=s("[CLS] X [SEP]"),gp=c(),Pa=a("li"),yp=s("pair of sequences: "),Pr=a("code"),_p=s("[CLS] A [SEP] B [SEP]"),Mp=c(),jo=a("div"),w(Ks.$$.fragment),bp=c(),Hr=a("p"),Tp=s("Converts a sequence of tokens (string) in a single string."),wp=c(),_t=a("div"),w(en.$$.fragment),kp=c(),Or=a("p"),vp=s("Create a mask from the two sequences passed to be used in a sequence-pair classification task. A LayoutLM"),Lp=c(),w(Uo.$$.fragment),jp=c(),St=a("p"),Up=s("If "),Yr=a("code"),Jp=s("token_ids_1"),Cp=s(" is "),Kr=a("code"),Ep=s("None"),$p=s(", this method only returns the first portion of the mask (0s)."),Ip=c(),Jo=a("div"),w(tn.$$.fragment),Fp=c(),on=a("p"),zp=s(`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),el=a("code"),xp=s("prepare_for_model"),Np=s(" method."),Zi=c(),Pt=a("h2"),Co=a("a"),tl=a("span"),w(sn.$$.fragment),qp=c(),ol=a("span"),Ap=s("LayoutLMTokenizerFast"),Vi=c(),st=a("div"),w(nn.$$.fragment),Rp=c(),an=a("p"),Zp=s("Construct a \u201Cfast\u201D LayoutLM tokenizer (backed by HuggingFace\u2019s "),sl=a("em"),Vp=s("tokenizers"),Wp=s(" library). Based on WordPiece."),Bp=c(),rn=a("p"),Qp=s("This tokenizer inherits from "),Ha=a("a"),Gp=s("PreTrainedTokenizerFast"),Dp=s(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Xp=c(),qt=a("div"),w(ln.$$.fragment),Sp=c(),nl=a("p"),Pp=s(`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:`),Hp=c(),dn=a("ul"),Oa=a("li"),Op=s("single sequence: "),al=a("code"),Yp=s("[CLS] X [SEP]"),Kp=c(),Ya=a("li"),eu=s("pair of sequences: "),rl=a("code"),tu=s("[CLS] A [SEP] B [SEP]"),ou=c(),Mt=a("div"),w(cn.$$.fragment),su=c(),ll=a("p"),nu=s("Create a mask from the two sequences passed to be used in a sequence-pair classification task. A LayoutLM"),au=c(),w(Eo.$$.fragment),ru=c(),Ht=a("p"),lu=s("If "),il=a("code"),iu=s("token_ids_1"),du=s(" is "),dl=a("code"),cu=s("None"),pu=s(", this method only returns the first portion of the mask (0s)."),Wi=c(),Ot=a("h2"),$o=a("a"),cl=a("span"),w(pn.$$.fragment),uu=c(),pl=a("span"),hu=s("LayoutLMModel"),Bi=c(),ht=a("div"),w(un.$$.fragment),mu=c(),hn=a("p"),fu=s(`The bare LayoutLM Model transformer outputting raw hidden-states without any specific head on top.
The LayoutLM model was proposed in `),mn=a("a"),gu=s(`LayoutLM: Pre-training of Text and Layout for Document Image
Understanding`),yu=s(` by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`),_u=c(),fn=a("p"),Mu=s("This model is a PyTorch "),gn=a("a"),bu=s("torch.nn.Module"),Tu=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),wu=c(),bt=a("div"),w(yn.$$.fragment),ku=c(),Yt=a("p"),vu=s("The "),Ka=a("a"),Lu=s("LayoutLMModel"),ju=s(" forward method, overrides the "),ul=a("code"),Uu=s("__call__"),Ju=s(" special method."),Cu=c(),w(Io.$$.fragment),Eu=c(),w(Fo.$$.fragment),Qi=c(),Kt=a("h2"),zo=a("a"),hl=a("span"),w(_n.$$.fragment),$u=c(),ml=a("span"),Iu=s("LayoutLMForMaskedLM"),Gi=c(),mt=a("div"),w(Mn.$$.fragment),Fu=c(),eo=a("p"),zu=s("LayoutLM Model with a "),fl=a("code"),xu=s("language modeling"),Nu=s(` head on top.
The LayoutLM model was proposed in `),bn=a("a"),qu=s(`LayoutLM: Pre-training of Text and Layout for Document Image
Understanding`),Au=s(` by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`),Ru=c(),Tn=a("p"),Zu=s("This model is a PyTorch "),wn=a("a"),Vu=s("torch.nn.Module"),Wu=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Bu=c(),Tt=a("div"),w(kn.$$.fragment),Qu=c(),to=a("p"),Gu=s("The "),er=a("a"),Du=s("LayoutLMForMaskedLM"),Xu=s(" forward method, overrides the "),gl=a("code"),Su=s("__call__"),Pu=s(" special method."),Hu=c(),w(xo.$$.fragment),Ou=c(),w(No.$$.fragment),Di=c(),oo=a("h2"),qo=a("a"),yl=a("span"),w(vn.$$.fragment),Yu=c(),_l=a("span"),Ku=s("LayoutLMForSequenceClassification"),Xi=c(),nt=a("div"),w(Ln.$$.fragment),eh=c(),jn=a("p"),th=s(`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 `),Un=a("a"),oh=s("RVL-CDIP"),sh=s(" dataset."),nh=c(),Jn=a("p"),ah=s("The LayoutLM model was proposed in "),Cn=a("a"),rh=s(`LayoutLM: Pre-training of Text and Layout for Document Image
Understanding`),lh=s(` by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`),ih=c(),En=a("p"),dh=s("This model is a PyTorch "),$n=a("a"),ch=s("torch.nn.Module"),ph=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),uh=c(),wt=a("div"),w(In.$$.fragment),hh=c(),so=a("p"),mh=s("The "),tr=a("a"),fh=s("LayoutLMForSequenceClassification"),gh=s(" forward method, overrides the "),Ml=a("code"),yh=s("__call__"),_h=s(" special method."),Mh=c(),w(Ao.$$.fragment),bh=c(),w(Ro.$$.fragment),Si=c(),no=a("h2"),Zo=a("a"),bl=a("span"),w(Fn.$$.fragment),Th=c(),Tl=a("span"),wh=s("LayoutLMForTokenClassification"),Pi=c(),at=a("div"),w(zn.$$.fragment),kh=c(),ao=a("p"),vh=s(`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 `),xn=a("a"),Lh=s("FUNSD"),jh=s(`
dataset and the `),Nn=a("a"),Uh=s("SROIE"),Jh=s(" dataset."),Ch=c(),qn=a("p"),Eh=s("The LayoutLM model was proposed in "),An=a("a"),$h=s(`LayoutLM: Pre-training of Text and Layout for Document Image
Understanding`),Ih=s(` by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`),Fh=c(),Rn=a("p"),zh=s("This model is a PyTorch "),Zn=a("a"),xh=s("torch.nn.Module"),Nh=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),qh=c(),kt=a("div"),w(Vn.$$.fragment),Ah=c(),ro=a("p"),Rh=s("The "),or=a("a"),Zh=s("LayoutLMForTokenClassification"),Vh=s(" forward method, overrides the "),wl=a("code"),Wh=s("__call__"),Bh=s(" special method."),Qh=c(),w(Vo.$$.fragment),Gh=c(),w(Wo.$$.fragment),Hi=c(),lo=a("h2"),Bo=a("a"),kl=a("span"),w(Wn.$$.fragment),Dh=c(),vl=a("span"),Xh=s("LayoutLMForQuestionAnswering"),Oi=c(),rt=a("div"),w(Bn.$$.fragment),Sh=c(),zt=a("p"),Ph=s(`LayoutLM Model with a span classification head on top for extractive question-answering tasks such as
`),Qn=a("a"),Hh=s("DocVQA"),Oh=s(" (a linear layer on top of the final hidden-states output to compute "),Ll=a("code"),Yh=s("span start logits"),Kh=s(" and "),jl=a("code"),em=s("span end logits"),tm=s(")."),om=c(),Gn=a("p"),sm=s("The LayoutLM model was proposed in "),Dn=a("a"),nm=s(`LayoutLM: Pre-training of Text and Layout for Document Image
Understanding`),am=s(` by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`),rm=c(),Xn=a("p"),lm=s("This model is a PyTorch "),Sn=a("a"),im=s("torch.nn.Module"),dm=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),cm=c(),dt=a("div"),w(Pn.$$.fragment),pm=c(),Ne=a("p"),um=s("start_positions ("),Ul=a("code"),hm=s("torch.LongTensor"),mm=s(" of shape "),Jl=a("code"),fm=s("(batch_size,)"),gm=s(", "),Cl=a("em"),ym=s("optional"),_m=s(`):
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 (`),El=a("code"),Mm=s("sequence_length"),bm=s(`). Position outside of the sequence
are not taken into account for computing the loss.
end_positions (`),$l=a("code"),Tm=s("torch.LongTensor"),wm=s(" of shape "),Il=a("code"),km=s("(batch_size,)"),vm=s(", "),Fl=a("em"),Lm=s("optional"),jm=s(`):
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 (`),zl=a("code"),Um=s("sequence_length"),Jm=s(`). Position outside of the sequence
are not taken into account for computing the loss.`),Cm=c(),xl=a("p"),Em=s("Example:"),$m=c(),Nl=a("p"),Im=s(`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).`),Fm=c(),w(Qo.$$.fragment),Yi=c(),io=a("h2"),Go=a("a"),ql=a("span"),w(Hn.$$.fragment),zm=c(),Al=a("span"),xm=s("TFLayoutLMModel"),Ki=c(),Oe=a("div"),w(On.$$.fragment),Nm=c(),Rl=a("p"),qm=s("The bare LayoutLM Model transformer outputting raw hidden-states without any specific head on top."),Am=c(),Yn=a("p"),Rm=s("This model inherits from "),sr=a("a"),Zm=s("TFPreTrainedModel"),Vm=s(`. 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.)`),Wm=c(),Kn=a("p"),Bm=s("This model is also a "),ea=a("a"),Qm=s("tf.keras.Model"),Gm=s(` 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.`),Dm=c(),w(Do.$$.fragment),Xm=c(),vt=a("div"),w(ta.$$.fragment),Sm=c(),co=a("p"),Pm=s("The "),nr=a("a"),Hm=s("TFLayoutLMModel"),Om=s(" forward method, overrides the "),Zl=a("code"),Ym=s("__call__"),Km=s(" special method."),ef=c(),w(Xo.$$.fragment),tf=c(),w(So.$$.fragment),ed=c(),po=a("h2"),Po=a("a"),Vl=a("span"),w(oa.$$.fragment),of=c(),Wl=a("span"),sf=s("TFLayoutLMForMaskedLM"),td=c(),Ye=a("div"),w(sa.$$.fragment),nf=c(),na=a("p"),af=s("LayoutLM Model with a "),Bl=a("code"),rf=s("language modeling"),lf=s(" head on top."),df=c(),aa=a("p"),cf=s("This model inherits from "),ar=a("a"),pf=s("TFPreTrainedModel"),uf=s(`. 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.)`),hf=c(),ra=a("p"),mf=s("This model is also a "),la=a("a"),ff=s("tf.keras.Model"),gf=s(` 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.`),yf=c(),w(Ho.$$.fragment),_f=c(),Lt=a("div"),w(ia.$$.fragment),Mf=c(),uo=a("p"),bf=s("The "),rr=a("a"),Tf=s("TFLayoutLMForMaskedLM"),wf=s(" forward method, overrides the "),Ql=a("code"),kf=s("__call__"),vf=s(" special method."),Lf=c(),w(Oo.$$.fragment),jf=c(),w(Yo.$$.fragment),od=c(),ho=a("h2"),Ko=a("a"),Gl=a("span"),w(da.$$.fragment),Uf=c(),Dl=a("span"),Jf=s("TFLayoutLMForSequenceClassification"),sd=c(),Ke=a("div"),w(ca.$$.fragment),Cf=c(),Xl=a("p"),Ef=s(`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.`),$f=c(),pa=a("p"),If=s("This model inherits from "),lr=a("a"),Ff=s("TFPreTrainedModel"),zf=s(`. 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.)`),xf=c(),ua=a("p"),Nf=s("This model is also a "),ha=a("a"),qf=s("tf.keras.Model"),Af=s(` 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.`),Rf=c(),w(es.$$.fragment),Zf=c(),jt=a("div"),w(ma.$$.fragment),Vf=c(),mo=a("p"),Wf=s("The "),ir=a("a"),Bf=s("TFLayoutLMForSequenceClassification"),Qf=s(" forward method, overrides the "),Sl=a("code"),Gf=s("__call__"),Df=s(" special method."),Xf=c(),w(ts.$$.fragment),Sf=c(),w(os.$$.fragment),nd=c(),fo=a("h2"),ss=a("a"),Pl=a("span"),w(fa.$$.fragment),Pf=c(),Hl=a("span"),Hf=s("TFLayoutLMForTokenClassification"),ad=c(),et=a("div"),w(ga.$$.fragment),Of=c(),Ol=a("p"),Yf=s(`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.`),Kf=c(),ya=a("p"),eg=s("This model inherits from "),dr=a("a"),tg=s("TFPreTrainedModel"),og=s(`. 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.)`),sg=c(),_a=a("p"),ng=s("This model is also a "),Ma=a("a"),ag=s("tf.keras.Model"),rg=s(` 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.`),lg=c(),w(ns.$$.fragment),ig=c(),Ut=a("div"),w(ba.$$.fragment),dg=c(),go=a("p"),cg=s("The "),cr=a("a"),pg=s("TFLayoutLMForTokenClassification"),ug=s(" forward method, overrides the "),Yl=a("code"),hg=s("__call__"),mg=s(" special method."),fg=c(),w(as.$$.fragment),gg=c(),w(rs.$$.fragment),rd=c(),yo=a("h2"),ls=a("a"),Kl=a("span"),w(Ta.$$.fragment),yg=c(),ei=a("span"),_g=s("TFLayoutLMForQuestionAnswering"),ld=c(),tt=a("div"),w(wa.$$.fragment),Mg=c(),xt=a("p"),bg=s(`LayoutLM Model with a span classification head on top for extractive question-answering tasks such as
`),ka=a("a"),Tg=s("DocVQA"),wg=s(" (a linear layer on top of the final hidden-states output to compute "),ti=a("code"),kg=s("span start logits"),vg=s(" and "),oi=a("code"),Lg=s("span end logits"),jg=s(")."),Ug=c(),va=a("p"),Jg=s("This model inherits from "),pr=a("a"),Cg=s("TFPreTrainedModel"),Eg=s(`. 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.)`),$g=c(),La=a("p"),Ig=s("This model is also a "),ja=a("a"),Fg=s("tf.keras.Model"),zg=s(` 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.`),xg=c(),w(is.$$.fragment),Ng=c(),Jt=a("div"),w(Ua.$$.fragment),qg=c(),_o=a("p"),Ag=s("The "),ur=a("a"),Rg=s("TFLayoutLMForQuestionAnswering"),Zg=s(" forward method, overrides the "),si=a("code"),Vg=s("__call__"),Wg=s(" special method."),Bg=c(),w(ds.$$.fragment),Qg=c(),w(cs.$$.fragment),this.h()},l(o){const y=QM('[data-svelte="svelte-1phssyn"]',document.head);d=r(y,"META",{name:!0,content:!0}),y.forEach(t),b=p(o),f=r(o,"H1",{class:!0});var Ja=l(f);g=r(Ja,"A",{id:!0,class:!0,href:!0});var ni=l(g);M=r(ni,"SPAN",{});var ai=l(M);k(i.$$.fragment,ai),ai.forEach(t),ni.forEach(t),h=p(Ja),E=r(Ja,"SPAN",{});var ri=l(E);Le=n(ri,"LayoutLM"),ri.forEach(t),Ja.forEach(t),ye=p(o),W=r(o,"A",{id:!0}),l(W).forEach(t),_e=p(o),G=r(o,"H2",{class:!0});var Ca=l(G);T=r(Ca,"A",{id:!0,class:!0,href:!0});var li=l(T);he=r(li,"SPAN",{});var ii=l(he);k(R.$$.fragment,ii),ii.forEach(t),li.forEach(t),je=p(Ca),me=r(Ca,"SPAN",{});var di=l(me);D=n(di,"Overview"),di.forEach(t),Ca.forEach(t),Me=p(o),ne=r(o,"P",{});var Ea=l(ne);X=n(Ea,"The LayoutLM model was proposed in the paper "),le=r(Ea,"A",{href:!0,rel:!0});var ci=l(le);Ue=n(ci,`LayoutLM: Pre-training of Text and Layout for Document Image
Understanding`),ci.forEach(t),S=n(Ea,` by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, and
Ming Zhou. It\u2019s 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:`),Ea.forEach(t),be=p(o),oe=r(o,"UL",{});var Mo=l(oe);Z=r(Mo,"LI",{});var $a=l(Z);Je=n($a,"form understanding: the "),ie=r($a,"A",{href:!0,rel:!0});var pi=l(ie);ae=n(pi,"FUNSD"),pi.forEach(t),$=n($a,` dataset (a collection of 199 annotated
forms comprising more than 30,000 words).`),$a.forEach(t),F=p(Mo),de=r(Mo,"LI",{});var Ia=l(de);P=n(Ia,"receipt understanding: the "),ce=r(Ia,"A",{href:!0,rel:!0});var ui=l(ce);Ce=n(ui,"SROIE"),ui.forEach(t),H=n(Ia,` dataset (a collection of 626 receipts for
training and 347 receipts for testing).`),Ia.forEach(t),Ee=p(Mo),pe=r(Mo,"LI",{});var Fa=l(pe);z=n(Fa,"document image classification: the "),ue=r(Fa,"A",{href:!0,rel:!0});var hi=l(ue);O=n(hi,"RVL-CDIP"),hi.forEach(t),$e=n(Fa,` dataset (a collection of
400,000 images belonging to one of 16 classes).`),Fa.forEach(t),Mo.forEach(t),Te=p(o),B=r(o,"P",{});var mi=l(B);Ie=n(mi,"The abstract from the paper is the following:"),mi.forEach(t),we=p(o),A=r(o,"P",{});var fi=l(A);fe=r(fi,"EM",{});var gi=l(fe);Y=n(gi,`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\u2019 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).`),gi.forEach(t),fi.forEach(t),ke=p(o),ee=r(o,"P",{});var yi=l(ee);x=n(yi,"Tips:"),yi.forEach(t),ve=p(o),N=r(o,"UL",{});var _i=l(N);Q=r(_i,"LI",{});var lt=l(Q);Fe=n(lt,"In addition to "),_=r(lt,"EM",{});var Mi=l(_);J=n(Mi,"input_ids"),Mi.forEach(t),Ve=n(lt,", "),te=r(lt,"A",{href:!0});var bi=l(te);We=n(bi,"forward()"),bi.forEach(t),Be=n(lt," also expects the input "),C=r(lt,"CODE",{});var Ti=l(C);Qe=n(Ti,"bbox"),Ti.forEach(t),Ge=n(lt,`, 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\u2019s `),xe=r(lt,"A",{href:!0,rel:!0});var wi=l(xe);De=n(wi,"Tesseract"),wi.forEach(t),Xe=n(lt," (there\u2019s a "),q=r(lt,"A",{href:!0,rel:!0});var Og=l(q);K=n(Og,"Python wrapper"),Og.forEach(t),Se=n(lt,` 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:`),lt.forEach(t),_i.forEach(t),Ae=p(o),k(V.$$.fragment,o),Re=p(o),ge=r(o,"P",{});var hr=l(ge);ze=n(hr,"Here, "),qe=r(hr,"CODE",{});var Yg=l(qe);re=n(Yg,"width"),Yg.forEach(t),Pe=n(hr," and "),$r=r(hr,"CODE",{});var Kg=l($r);rc=n(Kg,"height"),Kg.forEach(t),lc=n(hr,` 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:`),hr.forEach(t),ki=p(o),k(Js.$$.fragment,o),vi=p(o),Bt=r(o,"H2",{class:!0});var dd=l(Bt);bo=r(dd,"A",{id:!0,class:!0,href:!0});var ey=l(bo);Ir=r(ey,"SPAN",{});var ty=l(Ir);k(Cs.$$.fragment,ty),ty.forEach(t),ey.forEach(t),ic=p(dd),Fr=r(dd,"SPAN",{});var oy=l(Fr);dc=n(oy,"Resources"),oy.forEach(t),dd.forEach(t),Li=p(o),za=r(o,"P",{});var sy=l(za);cc=n(sy,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with LayoutLM. If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),sy.forEach(t),ji=p(o),k(Es.$$.fragment,o),Ui=p(o),yt=r(o,"UL",{});var ps=l(yt);zr=r(ps,"LI",{});var ny=l(zr);$s=r(ny,"P",{});var cd=l($s);pc=n(cd,"A blog post on "),Is=r(cd,"A",{href:!0,rel:!0});var ay=l(Is);uc=n(ay,`fine-tuning
LayoutLM for document-understanding using Keras & Hugging Face
Transformers`),ay.forEach(t),hc=n(cd,"."),cd.forEach(t),ny.forEach(t),mc=p(ps),xr=r(ps,"LI",{});var ry=l(xr);Fs=r(ry,"P",{});var pd=l(Fs);fc=n(pd,"A blog post on how to "),zs=r(pd,"A",{href:!0,rel:!0});var ly=l(zs);gc=n(ly,"fine-tune LayoutLM for document-understanding using only Hugging Face Transformers"),ly.forEach(t),yc=n(pd,"."),pd.forEach(t),ry.forEach(t),_c=p(ps),Nr=r(ps,"LI",{});var iy=l(Nr);xs=r(iy,"P",{});var ud=l(xs);Mc=n(ud,"A notebook on how to "),Ns=r(ud,"A",{href:!0,rel:!0});var dy=l(Ns);bc=n(dy,"fine-tune LayoutLM on the FUNSD dataset with image embeddings"),dy.forEach(t),Tc=n(ud,"."),ud.forEach(t),iy.forEach(t),wc=p(ps),qr=r(ps,"LI",{});var cy=l(qr);xa=r(cy,"P",{});var Gg=l(xa);kc=n(Gg,"See also: "),Na=r(Gg,"A",{href:!0});var py=l(Na);vc=n(py,"Document question answering task guide"),py.forEach(t),Gg.forEach(t),cy.forEach(t),ps.forEach(t),Ji=p(o),k(qs.$$.fragment,o),Ci=p(o),To=r(o,"UL",{});var hd=l(To);As=r(hd,"LI",{});var md=l(As);Lc=n(md,"A notebook on how to "),Rs=r(md,"A",{href:!0,rel:!0});var uy=l(Rs);jc=n(uy,"fine-tune LayoutLM for sequence classification on the RVL-CDIP dataset"),uy.forEach(t),Uc=n(md,"."),md.forEach(t),Jc=p(hd),Ar=r(hd,"LI",{});var hy=l(Ar);qa=r(hy,"A",{href:!0});var my=l(qa);Cc=n(my,"Text classification task guide"),my.forEach(t),hy.forEach(t),hd.forEach(t),Ei=p(o),k(Zs.$$.fragment,o),$i=p(o),wo=r(o,"UL",{});var fd=l(wo);Vs=r(fd,"LI",{});var gd=l(Vs);Ec=n(gd,"A notebook on how to "),Ws=r(gd,"A",{href:!0,rel:!0});var fy=l(Ws);$c=n(fy,"fine-tune LayoutLM for token classification on the FUNSD dataset"),fy.forEach(t),Ic=n(gd,"."),gd.forEach(t),Fc=p(fd),Rr=r(fd,"LI",{});var gy=l(Rr);Aa=r(gy,"A",{href:!0});var yy=l(Aa);zc=n(yy,"Token classification task guide"),yy.forEach(t),gy.forEach(t),fd.forEach(t),Ii=p(o),Ra=r(o,"P",{});var _y=l(Ra);Zr=r(_y,"STRONG",{});var My=l(Zr);xc=n(My,"Other resources"),My.forEach(t),_y.forEach(t),Fi=p(o),Za=r(o,"UL",{});var by=l(Za);Vr=r(by,"LI",{});var Ty=l(Vr);Va=r(Ty,"A",{href:!0});var wy=l(Va);Nc=n(wy,"Masked language modeling task guide"),wy.forEach(t),Ty.forEach(t),by.forEach(t),zi=p(o),Wa=r(o,"P",{});var ky=l(Wa);qc=n(ky,"\u{1F680} Deploy"),ky.forEach(t),xi=p(o),Ba=r(o,"UL",{});var vy=l(Ba);Bs=r(vy,"LI",{});var yd=l(Bs);Ac=n(yd,"A blog post on how to "),Qs=r(yd,"A",{href:!0,rel:!0});var Ly=l(Qs);Rc=n(Ly,"Deploy LayoutLM with Hugging Face Inference Endpoints"),Ly.forEach(t),Zc=n(yd,"."),yd.forEach(t),vy.forEach(t),Ni=p(o),Qt=r(o,"H2",{class:!0});var _d=l(Qt);ko=r(_d,"A",{id:!0,class:!0,href:!0});var jy=l(ko);Wr=r(jy,"SPAN",{});var Uy=l(Wr);k(Gs.$$.fragment,Uy),Uy.forEach(t),jy.forEach(t),Vc=p(_d),Br=r(_d,"SPAN",{});var Jy=l(Br);Wc=n(Jy,"LayoutLMConfig"),Jy.forEach(t),_d.forEach(t),qi=p(o),ut=r(o,"DIV",{class:!0});var us=l(ut);k(Ds.$$.fragment,us),Bc=p(us),Gt=r(us,"P",{});var mr=l(Gt);Qc=n(mr,"This is the configuration class to store the configuration of a "),Qa=r(mr,"A",{href:!0});var Cy=l(Qa);Gc=n(Cy,"LayoutLMModel"),Cy.forEach(t),Dc=n(mr,`. 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
`),Xs=r(mr,"A",{href:!0,rel:!0});var Ey=l(Xs);Xc=n(Ey,"microsoft/layoutlm-base-uncased"),Ey.forEach(t),Sc=n(mr," architecture."),mr.forEach(t),Pc=p(us),Dt=r(us,"P",{});var fr=l(Dt);Hc=n(fr,"Configuration objects inherit from "),Ga=r(fr,"A",{href:!0});var $y=l(Ga);Oc=n($y,"BertConfig"),$y.forEach(t),Yc=n(fr,` and can be used to control the model outputs. Read the
documentation from `),Da=r(fr,"A",{href:!0});var Iy=l(Da);Kc=n(Iy,"BertConfig"),Iy.forEach(t),ep=n(fr," for more information."),fr.forEach(t),tp=p(us),k(vo.$$.fragment,us),us.forEach(t),Ai=p(o),Xt=r(o,"H2",{class:!0});var Md=l(Xt);Lo=r(Md,"A",{id:!0,class:!0,href:!0});var Fy=l(Lo);Qr=r(Fy,"SPAN",{});var zy=l(Qr);k(Ss.$$.fragment,zy),zy.forEach(t),Fy.forEach(t),op=p(Md),Gr=r(Md,"SPAN",{});var xy=l(Gr);sp=n(xy,"LayoutLMTokenizer"),xy.forEach(t),Md.forEach(t),Ri=p(o),Ze=r(o,"DIV",{class:!0});var ct=l(Ze);k(Ps.$$.fragment,ct),np=p(ct),Dr=r(ct,"P",{});var Ny=l(Dr);ap=n(Ny,"Construct a LayoutLM tokenizer. Based on WordPiece."),Ny.forEach(t),rp=p(ct),Hs=r(ct,"P",{});var bd=l(Hs);lp=n(bd,"This tokenizer inherits from "),Xa=r(bd,"A",{href:!0});var qy=l(Xa);ip=n(qy,"PreTrainedTokenizer"),qy.forEach(t),dp=n(bd,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),bd.forEach(t),cp=p(ct),Nt=r(ct,"DIV",{class:!0});var gr=l(Nt);k(Os.$$.fragment,gr),pp=p(gr),Xr=r(gr,"P",{});var Ay=l(Xr);up=n(Ay,`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:`),Ay.forEach(t),hp=p(gr),Ys=r(gr,"UL",{});var Td=l(Ys);Sa=r(Td,"LI",{});var Dg=l(Sa);mp=n(Dg,"single sequence: "),Sr=r(Dg,"CODE",{});var Ry=l(Sr);fp=n(Ry,"[CLS] X [SEP]"),Ry.forEach(t),Dg.forEach(t),gp=p(Td),Pa=r(Td,"LI",{});var Xg=l(Pa);yp=n(Xg,"pair of sequences: "),Pr=r(Xg,"CODE",{});var Zy=l(Pr);_p=n(Zy,"[CLS] A [SEP] B [SEP]"),Zy.forEach(t),Xg.forEach(t),Td.forEach(t),gr.forEach(t),Mp=p(ct),jo=r(ct,"DIV",{class:!0});var wd=l(jo);k(Ks.$$.fragment,wd),bp=p(wd),Hr=r(wd,"P",{});var Vy=l(Hr);Tp=n(Vy,"Converts a sequence of tokens (string) in a single string."),Vy.forEach(t),wd.forEach(t),wp=p(ct),_t=r(ct,"DIV",{class:!0});var hs=l(_t);k(en.$$.fragment,hs),kp=p(hs),Or=r(hs,"P",{});var Wy=l(Or);vp=n(Wy,"Create a mask from the two sequences passed to be used in a sequence-pair classification task. A LayoutLM"),Wy.forEach(t),Lp=p(hs),k(Uo.$$.fragment,hs),jp=p(hs),St=r(hs,"P",{});var yr=l(St);Up=n(yr,"If "),Yr=r(yr,"CODE",{});var By=l(Yr);Jp=n(By,"token_ids_1"),By.forEach(t),Cp=n(yr," is "),Kr=r(yr,"CODE",{});var Qy=l(Kr);Ep=n(Qy,"None"),Qy.forEach(t),$p=n(yr,", this method only returns the first portion of the mask (0s)."),yr.forEach(t),hs.forEach(t),Ip=p(ct),Jo=r(ct,"DIV",{class:!0});var kd=l(Jo);k(tn.$$.fragment,kd),Fp=p(kd),on=r(kd,"P",{});var vd=l(on);zp=n(vd,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),el=r(vd,"CODE",{});var Gy=l(el);xp=n(Gy,"prepare_for_model"),Gy.forEach(t),Np=n(vd," method."),vd.forEach(t),kd.forEach(t),ct.forEach(t),Zi=p(o),Pt=r(o,"H2",{class:!0});var Ld=l(Pt);Co=r(Ld,"A",{id:!0,class:!0,href:!0});var Dy=l(Co);tl=r(Dy,"SPAN",{});var Xy=l(tl);k(sn.$$.fragment,Xy),Xy.forEach(t),Dy.forEach(t),qp=p(Ld),ol=r(Ld,"SPAN",{});var Sy=l(ol);Ap=n(Sy,"LayoutLMTokenizerFast"),Sy.forEach(t),Ld.forEach(t),Vi=p(o),st=r(o,"DIV",{class:!0});var At=l(st);k(nn.$$.fragment,At),Rp=p(At),an=r(At,"P",{});var jd=l(an);Zp=n(jd,"Construct a \u201Cfast\u201D LayoutLM tokenizer (backed by HuggingFace\u2019s "),sl=r(jd,"EM",{});var Py=l(sl);Vp=n(Py,"tokenizers"),Py.forEach(t),Wp=n(jd," library). Based on WordPiece."),jd.forEach(t),Bp=p(At),rn=r(At,"P",{});var Ud=l(rn);Qp=n(Ud,"This tokenizer inherits from "),Ha=r(Ud,"A",{href:!0});var Hy=l(Ha);Gp=n(Hy,"PreTrainedTokenizerFast"),Hy.forEach(t),Dp=n(Ud,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Ud.forEach(t),Xp=p(At),qt=r(At,"DIV",{class:!0});var _r=l(qt);k(ln.$$.fragment,_r),Sp=p(_r),nl=r(_r,"P",{});var Oy=l(nl);Pp=n(Oy,`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:`),Oy.forEach(t),Hp=p(_r),dn=r(_r,"UL",{});var Jd=l(dn);Oa=r(Jd,"LI",{});var Sg=l(Oa);Op=n(Sg,"single sequence: "),al=r(Sg,"CODE",{});var Yy=l(al);Yp=n(Yy,"[CLS] X [SEP]"),Yy.forEach(t),Sg.forEach(t),Kp=p(Jd),Ya=r(Jd,"LI",{});var Pg=l(Ya);eu=n(Pg,"pair of sequences: "),rl=r(Pg,"CODE",{});var Ky=l(rl);tu=n(Ky,"[CLS] A [SEP] B [SEP]"),Ky.forEach(t),Pg.forEach(t),Jd.forEach(t),_r.forEach(t),ou=p(At),Mt=r(At,"DIV",{class:!0});var ms=l(Mt);k(cn.$$.fragment,ms),su=p(ms),ll=r(ms,"P",{});var e_=l(ll);nu=n(e_,"Create a mask from the two sequences passed to be used in a sequence-pair classification task. A LayoutLM"),e_.forEach(t),au=p(ms),k(Eo.$$.fragment,ms),ru=p(ms),Ht=r(ms,"P",{});var Mr=l(Ht);lu=n(Mr,"If "),il=r(Mr,"CODE",{});var t_=l(il);iu=n(t_,"token_ids_1"),t_.forEach(t),du=n(Mr," is "),dl=r(Mr,"CODE",{});var o_=l(dl);cu=n(o_,"None"),o_.forEach(t),pu=n(Mr,", this method only returns the first portion of the mask (0s)."),Mr.forEach(t),ms.forEach(t),At.forEach(t),Wi=p(o),Ot=r(o,"H2",{class:!0});var Cd=l(Ot);$o=r(Cd,"A",{id:!0,class:!0,href:!0});var s_=l($o);cl=r(s_,"SPAN",{});var n_=l(cl);k(pn.$$.fragment,n_),n_.forEach(t),s_.forEach(t),uu=p(Cd),pl=r(Cd,"SPAN",{});var a_=l(pl);hu=n(a_,"LayoutLMModel"),a_.forEach(t),Cd.forEach(t),Bi=p(o),ht=r(o,"DIV",{class:!0});var fs=l(ht);k(un.$$.fragment,fs),mu=p(fs),hn=r(fs,"P",{});var Ed=l(hn);fu=n(Ed,`The bare LayoutLM Model transformer outputting raw hidden-states without any specific head on top.
The LayoutLM model was proposed in `),mn=r(Ed,"A",{href:!0,rel:!0});var r_=l(mn);gu=n(r_,`LayoutLM: Pre-training of Text and Layout for Document Image
Understanding`),r_.forEach(t),yu=n(Ed,` by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`),Ed.forEach(t),_u=p(fs),fn=r(fs,"P",{});var $d=l(fn);Mu=n($d,"This model is a PyTorch "),gn=r($d,"A",{href:!0,rel:!0});var l_=l(gn);bu=n(l_,"torch.nn.Module"),l_.forEach(t),Tu=n($d,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),$d.forEach(t),wu=p(fs),bt=r(fs,"DIV",{class:!0});var gs=l(bt);k(yn.$$.fragment,gs),ku=p(gs),Yt=r(gs,"P",{});var br=l(Yt);vu=n(br,"The "),Ka=r(br,"A",{href:!0});var i_=l(Ka);Lu=n(i_,"LayoutLMModel"),i_.forEach(t),ju=n(br," forward method, overrides the "),ul=r(br,"CODE",{});var d_=l(ul);Uu=n(d_,"__call__"),d_.forEach(t),Ju=n(br," special method."),br.forEach(t),Cu=p(gs),k(Io.$$.fragment,gs),Eu=p(gs),k(Fo.$$.fragment,gs),gs.forEach(t),fs.forEach(t),Qi=p(o),Kt=r(o,"H2",{class:!0});var Id=l(Kt);zo=r(Id,"A",{id:!0,class:!0,href:!0});var c_=l(zo);hl=r(c_,"SPAN",{});var p_=l(hl);k(_n.$$.fragment,p_),p_.forEach(t),c_.forEach(t),$u=p(Id),ml=r(Id,"SPAN",{});var u_=l(ml);Iu=n(u_,"LayoutLMForMaskedLM"),u_.forEach(t),Id.forEach(t),Gi=p(o),mt=r(o,"DIV",{class:!0});var ys=l(mt);k(Mn.$$.fragment,ys),Fu=p(ys),eo=r(ys,"P",{});var Tr=l(eo);zu=n(Tr,"LayoutLM Model with a "),fl=r(Tr,"CODE",{});var h_=l(fl);xu=n(h_,"language modeling"),h_.forEach(t),Nu=n(Tr,` head on top.
The LayoutLM model was proposed in `),bn=r(Tr,"A",{href:!0,rel:!0});var m_=l(bn);qu=n(m_,`LayoutLM: Pre-training of Text and Layout for Document Image
Understanding`),m_.forEach(t),Au=n(Tr,` by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`),Tr.forEach(t),Ru=p(ys),Tn=r(ys,"P",{});var Fd=l(Tn);Zu=n(Fd,"This model is a PyTorch "),wn=r(Fd,"A",{href:!0,rel:!0});var f_=l(wn);Vu=n(f_,"torch.nn.Module"),f_.forEach(t),Wu=n(Fd,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Fd.forEach(t),Bu=p(ys),Tt=r(ys,"DIV",{class:!0});var _s=l(Tt);k(kn.$$.fragment,_s),Qu=p(_s),to=r(_s,"P",{});var wr=l(to);Gu=n(wr,"The "),er=r(wr,"A",{href:!0});var g_=l(er);Du=n(g_,"LayoutLMForMaskedLM"),g_.forEach(t),Xu=n(wr," forward method, overrides the "),gl=r(wr,"CODE",{});var y_=l(gl);Su=n(y_,"__call__"),y_.forEach(t),Pu=n(wr," special method."),wr.forEach(t),Hu=p(_s),k(xo.$$.fragment,_s),Ou=p(_s),k(No.$$.fragment,_s),_s.forEach(t),ys.forEach(t),Di=p(o),oo=r(o,"H2",{class:!0});var zd=l(oo);qo=r(zd,"A",{id:!0,class:!0,href:!0});var __=l(qo);yl=r(__,"SPAN",{});var M_=l(yl);k(vn.$$.fragment,M_),M_.forEach(t),__.forEach(t),Yu=p(zd),_l=r(zd,"SPAN",{});var b_=l(_l);Ku=n(b_,"LayoutLMForSequenceClassification"),b_.forEach(t),zd.forEach(t),Xi=p(o),nt=r(o,"DIV",{class:!0});var Rt=l(nt);k(Ln.$$.fragment,Rt),eh=p(Rt),jn=r(Rt,"P",{});var xd=l(jn);th=n(xd,`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 `),Un=r(xd,"A",{href:!0,rel:!0});var T_=l(Un);oh=n(T_,"RVL-CDIP"),T_.forEach(t),sh=n(xd," dataset."),xd.forEach(t),nh=p(Rt),Jn=r(Rt,"P",{});var Nd=l(Jn);ah=n(Nd,"The LayoutLM model was proposed in "),Cn=r(Nd,"A",{href:!0,rel:!0});var w_=l(Cn);rh=n(w_,`LayoutLM: Pre-training of Text and Layout for Document Image
Understanding`),w_.forEach(t),lh=n(Nd,` by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`),Nd.forEach(t),ih=p(Rt),En=r(Rt,"P",{});var qd=l(En);dh=n(qd,"This model is a PyTorch "),$n=r(qd,"A",{href:!0,rel:!0});var k_=l($n);ch=n(k_,"torch.nn.Module"),k_.forEach(t),ph=n(qd,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),qd.forEach(t),uh=p(Rt),wt=r(Rt,"DIV",{class:!0});var Ms=l(wt);k(In.$$.fragment,Ms),hh=p(Ms),so=r(Ms,"P",{});var kr=l(so);mh=n(kr,"The "),tr=r(kr,"A",{href:!0});var v_=l(tr);fh=n(v_,"LayoutLMForSequenceClassification"),v_.forEach(t),gh=n(kr," forward method, overrides the "),Ml=r(kr,"CODE",{});var L_=l(Ml);yh=n(L_,"__call__"),L_.forEach(t),_h=n(kr," special method."),kr.forEach(t),Mh=p(Ms),k(Ao.$$.fragment,Ms),bh=p(Ms),k(Ro.$$.fragment,Ms),Ms.forEach(t),Rt.forEach(t),Si=p(o),no=r(o,"H2",{class:!0});var Ad=l(no);Zo=r(Ad,"A",{id:!0,class:!0,href:!0});var j_=l(Zo);bl=r(j_,"SPAN",{});var U_=l(bl);k(Fn.$$.fragment,U_),U_.forEach(t),j_.forEach(t),Th=p(Ad),Tl=r(Ad,"SPAN",{});var J_=l(Tl);wh=n(J_,"LayoutLMForTokenClassification"),J_.forEach(t),Ad.forEach(t),Pi=p(o),at=r(o,"DIV",{class:!0});var Zt=l(at);k(zn.$$.fragment,Zt),kh=p(Zt),ao=r(Zt,"P",{});var vr=l(ao);vh=n(vr,`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 `),xn=r(vr,"A",{href:!0,rel:!0});var C_=l(xn);Lh=n(C_,"FUNSD"),C_.forEach(t),jh=n(vr,`
dataset and the `),Nn=r(vr,"A",{href:!0,rel:!0});var E_=l(Nn);Uh=n(E_,"SROIE"),E_.forEach(t),Jh=n(vr," dataset."),vr.forEach(t),Ch=p(Zt),qn=r(Zt,"P",{});var Rd=l(qn);Eh=n(Rd,"The LayoutLM model was proposed in "),An=r(Rd,"A",{href:!0,rel:!0});var $_=l(An);$h=n($_,`LayoutLM: Pre-training of Text and Layout for Document Image
Understanding`),$_.forEach(t),Ih=n(Rd,` by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`),Rd.forEach(t),Fh=p(Zt),Rn=r(Zt,"P",{});var Zd=l(Rn);zh=n(Zd,"This model is a PyTorch "),Zn=r(Zd,"A",{href:!0,rel:!0});var I_=l(Zn);xh=n(I_,"torch.nn.Module"),I_.forEach(t),Nh=n(Zd,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Zd.forEach(t),qh=p(Zt),kt=r(Zt,"DIV",{class:!0});var bs=l(kt);k(Vn.$$.fragment,bs),Ah=p(bs),ro=r(bs,"P",{});var Lr=l(ro);Rh=n(Lr,"The "),or=r(Lr,"A",{href:!0});var F_=l(or);Zh=n(F_,"LayoutLMForTokenClassification"),F_.forEach(t),Vh=n(Lr," forward method, overrides the "),wl=r(Lr,"CODE",{});var z_=l(wl);Wh=n(z_,"__call__"),z_.forEach(t),Bh=n(Lr," special method."),Lr.forEach(t),Qh=p(bs),k(Vo.$$.fragment,bs),Gh=p(bs),k(Wo.$$.fragment,bs),bs.forEach(t),Zt.forEach(t),Hi=p(o),lo=r(o,"H2",{class:!0});var Vd=l(lo);Bo=r(Vd,"A",{id:!0,class:!0,href:!0});var x_=l(Bo);kl=r(x_,"SPAN",{});var N_=l(kl);k(Wn.$$.fragment,N_),N_.forEach(t),x_.forEach(t),Dh=p(Vd),vl=r(Vd,"SPAN",{});var q_=l(vl);Xh=n(q_,"LayoutLMForQuestionAnswering"),q_.forEach(t),Vd.forEach(t),Oi=p(o),rt=r(o,"DIV",{class:!0});var Vt=l(rt);k(Bn.$$.fragment,Vt),Sh=p(Vt),zt=r(Vt,"P",{});var Ts=l(zt);Ph=n(Ts,`LayoutLM Model with a span classification head on top for extractive question-answering tasks such as
`),Qn=r(Ts,"A",{href:!0,rel:!0});var A_=l(Qn);Hh=n(A_,"DocVQA"),A_.forEach(t),Oh=n(Ts," (a linear layer on top of the final hidden-states output to compute "),Ll=r(Ts,"CODE",{});var R_=l(Ll);Yh=n(R_,"span start logits"),R_.forEach(t),Kh=n(Ts," and "),jl=r(Ts,"CODE",{});var Z_=l(jl);em=n(Z_,"span end logits"),Z_.forEach(t),tm=n(Ts,")."),Ts.forEach(t),om=p(Vt),Gn=r(Vt,"P",{});var Wd=l(Gn);sm=n(Wd,"The LayoutLM model was proposed in "),Dn=r(Wd,"A",{href:!0,rel:!0});var V_=l(Dn);nm=n(V_,`LayoutLM: Pre-training of Text and Layout for Document Image
Understanding`),V_.forEach(t),am=n(Wd,` by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.`),Wd.forEach(t),rm=p(Vt),Xn=r(Vt,"P",{});var Bd=l(Xn);lm=n(Bd,"This model is a PyTorch "),Sn=r(Bd,"A",{href:!0,rel:!0});var W_=l(Sn);im=n(W_,"torch.nn.Module"),W_.forEach(t),dm=n(Bd,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Bd.forEach(t),cm=p(Vt),dt=r(Vt,"DIV",{class:!0});var Wt=l(dt);k(Pn.$$.fragment,Wt),pm=p(Wt),Ne=r(Wt,"P",{});var He=l(Ne);um=n(He,"start_positions ("),Ul=r(He,"CODE",{});var B_=l(Ul);hm=n(B_,"torch.LongTensor"),B_.forEach(t),mm=n(He," of shape "),Jl=r(He,"CODE",{});var Q_=l(Jl);fm=n(Q_,"(batch_size,)"),Q_.forEach(t),gm=n(He,", "),Cl=r(He,"EM",{});var G_=l(Cl);ym=n(G_,"optional"),G_.forEach(t),_m=n(He,`):
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 (`),El=r(He,"CODE",{});var D_=l(El);Mm=n(D_,"sequence_length"),D_.forEach(t),bm=n(He,`). Position outside of the sequence
are not taken into account for computing the loss.
end_positions (`),$l=r(He,"CODE",{});var X_=l($l);Tm=n(X_,"torch.LongTensor"),X_.forEach(t),wm=n(He," of shape "),Il=r(He,"CODE",{});var S_=l(Il);km=n(S_,"(batch_size,)"),S_.forEach(t),vm=n(He,", "),Fl=r(He,"EM",{});var P_=l(Fl);Lm=n(P_,"optional"),P_.forEach(t),jm=n(He,`):
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 (`),zl=r(He,"CODE",{});var H_=l(zl);Um=n(H_,"sequence_length"),H_.forEach(t),Jm=n(He,`). Position outside of the sequence
are not taken into account for computing the loss.`),He.forEach(t),Cm=p(Wt),xl=r(Wt,"P",{});var O_=l(xl);Em=n(O_,"Example:"),O_.forEach(t),$m=p(Wt),Nl=r(Wt,"P",{});var Y_=l(Nl);Im=n(Y_,`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).`),Y_.forEach(t),Fm=p(Wt),k(Qo.$$.fragment,Wt),Wt.forEach(t),Vt.forEach(t),Yi=p(o),io=r(o,"H2",{class:!0});var Qd=l(io);Go=r(Qd,"A",{id:!0,class:!0,href:!0});var K_=l(Go);ql=r(K_,"SPAN",{});var eM=l(ql);k(Hn.$$.fragment,eM),eM.forEach(t),K_.forEach(t),zm=p(Qd),Al=r(Qd,"SPAN",{});var tM=l(Al);xm=n(tM,"TFLayoutLMModel"),tM.forEach(t),Qd.forEach(t),Ki=p(o),Oe=r(o,"DIV",{class:!0});var Ct=l(Oe);k(On.$$.fragment,Ct),Nm=p(Ct),Rl=r(Ct,"P",{});var oM=l(Rl);qm=n(oM,"The bare LayoutLM Model transformer outputting raw hidden-states without any specific head on top."),oM.forEach(t),Am=p(Ct),Yn=r(Ct,"P",{});var Gd=l(Yn);Rm=n(Gd,"This model inherits from "),sr=r(Gd,"A",{href:!0});var sM=l(sr);Zm=n(sM,"TFPreTrainedModel"),sM.forEach(t),Vm=n(Gd,`. 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.)`),Gd.forEach(t),Wm=p(Ct),Kn=r(Ct,"P",{});var Dd=l(Kn);Bm=n(Dd,"This model is also a "),ea=r(Dd,"A",{href:!0,rel:!0});var nM=l(ea);Qm=n(nM,"tf.keras.Model"),nM.forEach(t),Gm=n(Dd,` 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.`),Dd.forEach(t),Dm=p(Ct),k(Do.$$.fragment,Ct),Xm=p(Ct),vt=r(Ct,"DIV",{class:!0});var ws=l(vt);k(ta.$$.fragment,ws),Sm=p(ws),co=r(ws,"P",{});var jr=l(co);Pm=n(jr,"The "),nr=r(jr,"A",{href:!0});var aM=l(nr);Hm=n(aM,"TFLayoutLMModel"),aM.forEach(t),Om=n(jr," forward method, overrides the "),Zl=r(jr,"CODE",{});var rM=l(Zl);Ym=n(rM,"__call__"),rM.forEach(t),Km=n(jr," special method."),jr.forEach(t),ef=p(ws),k(Xo.$$.fragment,ws),tf=p(ws),k(So.$$.fragment,ws),ws.forEach(t),Ct.forEach(t),ed=p(o),po=r(o,"H2",{class:!0});var Xd=l(po);Po=r(Xd,"A",{id:!0,class:!0,href:!0});var lM=l(Po);Vl=r(lM,"SPAN",{});var iM=l(Vl);k(oa.$$.fragment,iM),iM.forEach(t),lM.forEach(t),of=p(Xd),Wl=r(Xd,"SPAN",{});var dM=l(Wl);sf=n(dM,"TFLayoutLMForMaskedLM"),dM.forEach(t),Xd.forEach(t),td=p(o),Ye=r(o,"DIV",{class:!0});var Et=l(Ye);k(sa.$$.fragment,Et),nf=p(Et),na=r(Et,"P",{});var Sd=l(na);af=n(Sd,"LayoutLM Model with a "),Bl=r(Sd,"CODE",{});var cM=l(Bl);rf=n(cM,"language modeling"),cM.forEach(t),lf=n(Sd," head on top."),Sd.forEach(t),df=p(Et),aa=r(Et,"P",{});var Pd=l(aa);cf=n(Pd,"This model inherits from "),ar=r(Pd,"A",{href:!0});var pM=l(ar);pf=n(pM,"TFPreTrainedModel"),pM.forEach(t),uf=n(Pd,`. 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.)`),Pd.forEach(t),hf=p(Et),ra=r(Et,"P",{});var Hd=l(ra);mf=n(Hd,"This model is also a "),la=r(Hd,"A",{href:!0,rel:!0});var uM=l(la);ff=n(uM,"tf.keras.Model"),uM.forEach(t),gf=n(Hd,` 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.`),Hd.forEach(t),yf=p(Et),k(Ho.$$.fragment,Et),_f=p(Et),Lt=r(Et,"DIV",{class:!0});var ks=l(Lt);k(ia.$$.fragment,ks),Mf=p(ks),uo=r(ks,"P",{});var Ur=l(uo);bf=n(Ur,"The "),rr=r(Ur,"A",{href:!0});var hM=l(rr);Tf=n(hM,"TFLayoutLMForMaskedLM"),hM.forEach(t),wf=n(Ur," forward method, overrides the "),Ql=r(Ur,"CODE",{});var mM=l(Ql);kf=n(mM,"__call__"),mM.forEach(t),vf=n(Ur," special method."),Ur.forEach(t),Lf=p(ks),k(Oo.$$.fragment,ks),jf=p(ks),k(Yo.$$.fragment,ks),ks.forEach(t),Et.forEach(t),od=p(o),ho=r(o,"H2",{class:!0});var Od=l(ho);Ko=r(Od,"A",{id:!0,class:!0,href:!0});var fM=l(Ko);Gl=r(fM,"SPAN",{});var gM=l(Gl);k(da.$$.fragment,gM),gM.forEach(t),fM.forEach(t),Uf=p(Od),Dl=r(Od,"SPAN",{});var yM=l(Dl);Jf=n(yM,"TFLayoutLMForSequenceClassification"),yM.forEach(t),Od.forEach(t),sd=p(o),Ke=r(o,"DIV",{class:!0});var $t=l(Ke);k(ca.$$.fragment,$t),Cf=p($t),Xl=r($t,"P",{});var _M=l(Xl);Ef=n(_M,`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.`),_M.forEach(t),$f=p($t),pa=r($t,"P",{});var Yd=l(pa);If=n(Yd,"This model inherits from "),lr=r(Yd,"A",{href:!0});var MM=l(lr);Ff=n(MM,"TFPreTrainedModel"),MM.forEach(t),zf=n(Yd,`. 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.)`),Yd.forEach(t),xf=p($t),ua=r($t,"P",{});var Kd=l(ua);Nf=n(Kd,"This model is also a "),ha=r(Kd,"A",{href:!0,rel:!0});var bM=l(ha);qf=n(bM,"tf.keras.Model"),bM.forEach(t),Af=n(Kd,` 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.`),Kd.forEach(t),Rf=p($t),k(es.$$.fragment,$t),Zf=p($t),jt=r($t,"DIV",{class:!0});var vs=l(jt);k(ma.$$.fragment,vs),Vf=p(vs),mo=r(vs,"P",{});var Jr=l(mo);Wf=n(Jr,"The "),ir=r(Jr,"A",{href:!0});var TM=l(ir);Bf=n(TM,"TFLayoutLMForSequenceClassification"),TM.forEach(t),Qf=n(Jr," forward method, overrides the "),Sl=r(Jr,"CODE",{});var wM=l(Sl);Gf=n(wM,"__call__"),wM.forEach(t),Df=n(Jr," special method."),Jr.forEach(t),Xf=p(vs),k(ts.$$.fragment,vs),Sf=p(vs),k(os.$$.fragment,vs),vs.forEach(t),$t.forEach(t),nd=p(o),fo=r(o,"H2",{class:!0});var ec=l(fo);ss=r(ec,"A",{id:!0,class:!0,href:!0});var kM=l(ss);Pl=r(kM,"SPAN",{});var vM=l(Pl);k(fa.$$.fragment,vM),vM.forEach(t),kM.forEach(t),Pf=p(ec),Hl=r(ec,"SPAN",{});var LM=l(Hl);Hf=n(LM,"TFLayoutLMForTokenClassification"),LM.forEach(t),ec.forEach(t),ad=p(o),et=r(o,"DIV",{class:!0});var It=l(et);k(ga.$$.fragment,It),Of=p(It),Ol=r(It,"P",{});var jM=l(Ol);Yf=n(jM,`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.`),jM.forEach(t),Kf=p(It),ya=r(It,"P",{});var tc=l(ya);eg=n(tc,"This model inherits from "),dr=r(tc,"A",{href:!0});var UM=l(dr);tg=n(UM,"TFPreTrainedModel"),UM.forEach(t),og=n(tc,`. 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.)`),tc.forEach(t),sg=p(It),_a=r(It,"P",{});var oc=l(_a);ng=n(oc,"This model is also a "),Ma=r(oc,"A",{href:!0,rel:!0});var JM=l(Ma);ag=n(JM,"tf.keras.Model"),JM.forEach(t),rg=n(oc,` 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.`),oc.forEach(t),lg=p(It),k(ns.$$.fragment,It),ig=p(It),Ut=r(It,"DIV",{class:!0});var Ls=l(Ut);k(ba.$$.fragment,Ls),dg=p(Ls),go=r(Ls,"P",{});var Cr=l(go);cg=n(Cr,"The "),cr=r(Cr,"A",{href:!0});var CM=l(cr);pg=n(CM,"TFLayoutLMForTokenClassification"),CM.forEach(t),ug=n(Cr," forward method, overrides the "),Yl=r(Cr,"CODE",{});var EM=l(Yl);hg=n(EM,"__call__"),EM.forEach(t),mg=n(Cr," special method."),Cr.forEach(t),fg=p(Ls),k(as.$$.fragment,Ls),gg=p(Ls),k(rs.$$.fragment,Ls),Ls.forEach(t),It.forEach(t),rd=p(o),yo=r(o,"H2",{class:!0});var sc=l(yo);ls=r(sc,"A",{id:!0,class:!0,href:!0});var $M=l(ls);Kl=r($M,"SPAN",{});var IM=l(Kl);k(Ta.$$.fragment,IM),IM.forEach(t),$M.forEach(t),yg=p(sc),ei=r(sc,"SPAN",{});var FM=l(ei);_g=n(FM,"TFLayoutLMForQuestionAnswering"),FM.forEach(t),sc.forEach(t),ld=p(o),tt=r(o,"DIV",{class:!0});var Ft=l(tt);k(wa.$$.fragment,Ft),Mg=p(Ft),xt=r(Ft,"P",{});var js=l(xt);bg=n(js,`LayoutLM Model with a span classification head on top for extractive question-answering tasks such as
`),ka=r(js,"A",{href:!0,rel:!0});var zM=l(ka);Tg=n(zM,"DocVQA"),zM.forEach(t),wg=n(js," (a linear layer on top of the final hidden-states output to compute "),ti=r(js,"CODE",{});var xM=l(ti);kg=n(xM,"span start logits"),xM.forEach(t),vg=n(js," and "),oi=r(js,"CODE",{});var NM=l(oi);Lg=n(NM,"span end logits"),NM.forEach(t),jg=n(js,")."),js.forEach(t),Ug=p(Ft),va=r(Ft,"P",{});var nc=l(va);Jg=n(nc,"This model inherits from "),pr=r(nc,"A",{href:!0});var qM=l(pr);Cg=n(qM,"TFPreTrainedModel"),qM.forEach(t),Eg=n(nc,`. 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.)`),nc.forEach(t),$g=p(Ft),La=r(Ft,"P",{});var ac=l(La);Ig=n(ac,"This model is also a "),ja=r(ac,"A",{href:!0,rel:!0});var AM=l(ja);Fg=n(AM,"tf.keras.Model"),AM.forEach(t),zg=n(ac,` 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.`),ac.forEach(t),xg=p(Ft),k(is.$$.fragment,Ft),Ng=p(Ft),Jt=r(Ft,"DIV",{class:!0});var Us=l(Jt);k(Ua.$$.fragment,Us),qg=p(Us),_o=r(Us,"P",{});var Er=l(_o);Ag=n(Er,"The "),ur=r(Er,"A",{href:!0});var RM=l(ur);Rg=n(RM,"TFLayoutLMForQuestionAnswering"),RM.forEach(t),Zg=n(Er," forward method, overrides the "),si=r(Er,"CODE",{});var ZM=l(si);Vg=n(ZM,"__call__"),ZM.forEach(t),Wg=n(Er," special method."),Er.forEach(t),Bg=p(Us),k(ds.$$.fragment,Us),Qg=p(Us),k(cs.$$.fragment,Us),Us.forEach(t),Ft.forEach(t),this.h()},h(){u(d,"name","hf:doc:metadata"),u(d,"content",JSON.stringify(bb)),u(g,"id","layoutlm"),u(g,"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"),u(g,"href","#layoutlm"),u(f,"class","relative group"),u(W,"id","Overview"),u(T,"id","overview"),u(T,"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"),u(T,"href","#overview"),u(G,"class","relative group"),u(le,"href","https://arxiv.org/abs/1912.13318"),u(le,"rel","nofollow"),u(ie,"href","https://guillaumejaume.github.io/FUNSD/"),u(ie,"rel","nofollow"),u(ce,"href","https://rrc.cvc.uab.es/?ch=13"),u(ce,"rel","nofollow"),u(ue,"href","https://www.cs.cmu.edu/~aharley/rvl-cdip/"),u(ue,"rel","nofollow"),u(te,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlm#transformers.LayoutLMModel.forward"),u(xe,"href","https://github.com/tesseract-ocr/tesseract"),u(xe,"rel","nofollow"),u(q,"href","https://pypi.org/project/pytesseract/"),u(q,"rel","nofollow"),u(bo,"id","resources"),u(bo,"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"),u(bo,"href","#resources"),u(Bt,"class","relative group"),u(Is,"href","https://www.philschmid.de/fine-tuning-layoutlm-keras"),u(Is,"rel","nofollow"),u(zs,"href","https://www.philschmid.de/fine-tuning-layoutlm"),u(zs,"rel","nofollow"),u(Ns,"href","https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Add_image_embeddings_to_LayoutLM.ipynb"),u(Ns,"rel","nofollow"),u(Na,"href","../tasks/document_question_answering"),u(Rs,"href","https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForSequenceClassification_on_RVL_CDIP.ipynb"),u(Rs,"rel","nofollow"),u(qa,"href","../tasks/sequence_classification"),u(Ws,"href","https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForTokenClassification_on_FUNSD.ipynb"),u(Ws,"rel","nofollow"),u(Aa,"href","../tasks/token_classification"),u(Va,"href","../tasks/masked_language_modeling"),u(Qs,"href","https://www.philschmid.de/inference-endpoints-layoutlm"),u(Qs,"rel","nofollow"),u(ko,"id","transformers.LayoutLMConfig"),u(ko,"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"),u(ko,"href","#transformers.LayoutLMConfig"),u(Qt,"class","relative group"),u(Qa,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlm#transformers.LayoutLMModel"),u(Xs,"href","https://huggingface.co/microsoft/layoutlm-base-uncased"),u(Xs,"rel","nofollow"),u(Ga,"href","/docs/transformers/v4.30.0/en/model_doc/bert#transformers.BertConfig"),u(Da,"href","/docs/transformers/v4.30.0/en/model_doc/bert#transformers.BertConfig"),u(ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Lo,"id","transformers.LayoutLMTokenizer"),u(Lo,"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"),u(Lo,"href","#transformers.LayoutLMTokenizer"),u(Xt,"class","relative group"),u(Xa,"href","/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),u(Nt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(jo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(_t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Jo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Co,"id","transformers.LayoutLMTokenizerFast"),u(Co,"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"),u(Co,"href","#transformers.LayoutLMTokenizerFast"),u(Pt,"class","relative group"),u(Ha,"href","/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),u(qt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(st,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u($o,"id","transformers.LayoutLMModel"),u($o,"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"),u($o,"href","#transformers.LayoutLMModel"),u(Ot,"class","relative group"),u(mn,"href","https://arxiv.org/abs/1912.13318"),u(mn,"rel","nofollow"),u(gn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u(gn,"rel","nofollow"),u(Ka,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlm#transformers.LayoutLMModel"),u(bt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(zo,"id","transformers.LayoutLMForMaskedLM"),u(zo,"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"),u(zo,"href","#transformers.LayoutLMForMaskedLM"),u(Kt,"class","relative group"),u(bn,"href","https://arxiv.org/abs/1912.13318"),u(bn,"rel","nofollow"),u(wn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u(wn,"rel","nofollow"),u(er,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlm#transformers.LayoutLMForMaskedLM"),u(Tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(qo,"id","transformers.LayoutLMForSequenceClassification"),u(qo,"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"),u(qo,"href","#transformers.LayoutLMForSequenceClassification"),u(oo,"class","relative group"),u(Un,"href","https://www.cs.cmu.edu/~aharley/rvl-cdip/"),u(Un,"rel","nofollow"),u(Cn,"href","https://arxiv.org/abs/1912.13318"),u(Cn,"rel","nofollow"),u($n,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u($n,"rel","nofollow"),u(tr,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlm#transformers.LayoutLMForSequenceClassification"),u(wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(nt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Zo,"id","transformers.LayoutLMForTokenClassification"),u(Zo,"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"),u(Zo,"href","#transformers.LayoutLMForTokenClassification"),u(no,"class","relative group"),u(xn,"href","https://guillaumejaume.github.io/FUNSD/"),u(xn,"rel","nofollow"),u(Nn,"href","https://rrc.cvc.uab.es/?ch=13"),u(Nn,"rel","nofollow"),u(An,"href","https://arxiv.org/abs/1912.13318"),u(An,"rel","nofollow"),u(Zn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u(Zn,"rel","nofollow"),u(or,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlm#transformers.LayoutLMForTokenClassification"),u(kt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(at,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Bo,"id","transformers.LayoutLMForQuestionAnswering"),u(Bo,"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"),u(Bo,"href","#transformers.LayoutLMForQuestionAnswering"),u(lo,"class","relative group"),u(Qn,"href","https://rrc.cvc.uab.es/?ch=17"),u(Qn,"rel","nofollow"),u(Dn,"href","https://arxiv.org/abs/1912.13318"),u(Dn,"rel","nofollow"),u(Sn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u(Sn,"rel","nofollow"),u(dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Go,"id","transformers.TFLayoutLMModel"),u(Go,"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"),u(Go,"href","#transformers.TFLayoutLMModel"),u(io,"class","relative group"),u(sr,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel"),u(ea,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u(ea,"rel","nofollow"),u(nr,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlm#transformers.TFLayoutLMModel"),u(vt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Po,"id","transformers.TFLayoutLMForMaskedLM"),u(Po,"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"),u(Po,"href","#transformers.TFLayoutLMForMaskedLM"),u(po,"class","relative group"),u(ar,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel"),u(la,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u(la,"rel","nofollow"),u(rr,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlm#transformers.TFLayoutLMForMaskedLM"),u(Lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Ko,"id","transformers.TFLayoutLMForSequenceClassification"),u(Ko,"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"),u(Ko,"href","#transformers.TFLayoutLMForSequenceClassification"),u(ho,"class","relative group"),u(lr,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel"),u(ha,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u(ha,"rel","nofollow"),u(ir,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlm#transformers.TFLayoutLMForSequenceClassification"),u(jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ss,"id","transformers.TFLayoutLMForTokenClassification"),u(ss,"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"),u(ss,"href","#transformers.TFLayoutLMForTokenClassification"),u(fo,"class","relative group"),u(dr,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel"),u(Ma,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u(Ma,"rel","nofollow"),u(cr,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlm#transformers.TFLayoutLMForTokenClassification"),u(Ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ls,"id","transformers.TFLayoutLMForQuestionAnswering"),u(ls,"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"),u(ls,"href","#transformers.TFLayoutLMForQuestionAnswering"),u(yo,"class","relative group"),u(ka,"href","https://rrc.cvc.uab.es/?ch=17"),u(ka,"rel","nofollow"),u(pr,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel"),u(ja,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u(ja,"rel","nofollow"),u(ur,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlm#transformers.TFLayoutLMForQuestionAnswering"),u(Jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,y){e(document.head,d),m(o,b,y),m(o,f,y),e(f,g),e(g,M),v(i,M,null),e(f,h),e(f,E),e(E,Le),m(o,ye,y),m(o,W,y),m(o,_e,y),m(o,G,y),e(G,T),e(T,he),v(R,he,null),e(G,je),e(G,me),e(me,D),m(o,Me,y),m(o,ne,y),e(ne,X),e(ne,le),e(le,Ue),e(ne,S),m(o,be,y),m(o,oe,y),e(oe,Z),e(Z,Je),e(Z,ie),e(ie,ae),e(Z,$),e(oe,F),e(oe,de),e(de,P),e(de,ce),e(ce,Ce),e(de,H),e(oe,Ee),e(oe,pe),e(pe,z),e(pe,ue),e(ue,O),e(pe,$e),m(o,Te,y),m(o,B,y),e(B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Vu),e(Tn,Wu),e(mt,Bu),e(mt,Tt),v(kn,Tt,null),e(Tt,Qu),e(Tt,to),e(to,Gu),e(to,er),e(er,Du),e(to,Xu),e(to,gl),e(gl,Su),e(to,Pu),e(Tt,Hu),v(xo,Tt,null),e(Tt,Ou),v(No,Tt,null),m(o,Di,y),m(o,oo,y),e(oo,qo),e(qo,yl),v(vn,yl,null),e(oo,Yu),e(oo,_l),e(_l,Ku),m(o,Xi,y),m(o,nt,y),v(Ln,nt,null),e(nt,eh),e(nt,jn),e(jn,th),e(jn,Un),e(Un,oh),e(jn,sh),e(nt,nh),e(nt,Jn),e(Jn,ah),e(Jn,Cn),e(Cn,rh),e(Jn,lh),e(nt,ih),e(nt,En),e(En,dh),e(En,$n),e($n,ch),e(En,ph),e(nt,uh),e(nt,wt),v(In,wt,null),e(wt,hh),e(wt,so),e(so,mh),e(so,tr),e(tr,fh),e(so,gh),e(so,Ml),e(Ml,yh),e(so,_h),e(wt,Mh),v(Ao,wt,null),e(wt,bh),v(Ro,wt,null),m(o,Si,y),m(o,no,y),e(no,Zo),e(Zo,bl),v(Fn,bl,null),e(no,Th),e(no,Tl),e(Tl,wh),m(o,Pi,y),m(o,at,y),v(zn,at,null),e(at,kh),e(at,ao),e(ao,vh),e(ao,xn),e(xn,Lh),e(ao,jh),e(ao,Nn),e(Nn,Uh),e(ao,Jh),e(at,Ch),e(at,qn),e(qn,Eh),e(qn,An),e(An,$h),e(qn,Ih),e(at,Fh),e(at,Rn),e(Rn,zh),e(Rn,Zn),e(Zn,xh),e(Rn,Nh),e(at,qh),e(at,kt),v(Vn,kt,null),e(kt,Ah),e(kt,ro),e(ro,Rh),e(ro,or),e(or,Zh),e(ro,Vh),e(ro,wl),e(wl,Wh),e(ro,Bh),e(kt,Qh),v(Vo,kt,null),e(kt,Gh),v(Wo,kt,null),m(o,Hi,y),m(o,lo,y),e(lo,Bo),e(Bo,kl),v(Wn,kl,null),e(lo,Dh),e(lo,vl),e(vl,Xh),m(o,Oi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Wl),e(Wl,sf),m(o,td,y),m(o,Ye,y),v(sa,Ye,null),e(Ye,nf),e(Ye,na),e(na,af),e(na,Bl),e(Bl,rf),e(na,lf),e(Ye,df),e(Ye,aa),e(aa,cf),e(aa,ar),e(ar,pf),e(aa,uf),e(Ye,hf),e(Ye,ra),e(ra,mf),e(ra,la),e(la,ff),e(ra,gf),e(Ye,yf),v(Ho,Ye,null),e(Ye,_f),e(Ye,Lt),v(ia,Lt,null),e(Lt,Mf),e(Lt,uo),e(uo,bf),e(uo,rr),e(rr,Tf),e(uo,wf),e(uo,Ql),e(Ql,kf),e(uo,vf),e(Lt,Lf),v(Oo,Lt,null),e(Lt,jf),v(Yo,Lt,null),m(o,od,y),m(o,ho,y),e(ho,Ko),e(Ko,Gl),v(da,Gl,null),e(ho,Uf),e(ho,Dl),e(Dl,Jf),m(o,sd,y),m(o,Ke,y),v(ca,Ke,null),e(Ke,Cf),e(Ke,Xl),e(Xl,Ef),e(Ke,$f),e(Ke,pa),e(pa,If),e(pa,lr),e(lr,Ff),e(pa,zf),e(Ke,xf),e(Ke,ua),e(ua,Nf),e(ua,ha),e(ha,qf),e(ua,Af),e(Ke,Rf),v(es,Ke,null),e(Ke,Zf),e(Ke,jt),v(ma,jt,null),e(jt,Vf),e(jt,mo),e(mo,Wf),e(mo,ir),e(ir,Bf),e(mo,Qf),e(mo,Sl),e(Sl,Gf),e(mo,Df),e(jt,Xf),v(ts,jt,null),e(jt,Sf),v(os,jt,null),m(o,nd,y),m(o,fo,y),e(fo,ss),e(ss,Pl),v(fa,Pl,null),e(fo,Pf),e(fo,Hl),e(Hl,Hf),m(o,ad,y),m(o,et,y),v(ga,et,null),e(et,Of),e(et,Ol),e(Ol,Yf),e(et,Kf),e(et,ya),e(ya,eg),e(ya,dr),e(dr,tg),e(ya,og),e(et,sg),e(et,_a),e(_a,ng),e(_a,Ma),e(Ma,ag),e(_a,rg),e(et,lg),v(ns,et,null),e(et,ig),e(et,Ut),v(ba,Ut,null),e(Ut,dg),e(Ut,go),e(go,cg),e(go,cr),e(cr,pg),e(go,ug),e(go,Yl),e(Yl,hg),e(go,mg),e(Ut,fg),v(as,Ut,null),e(Ut,gg),v(rs,Ut,null),m(o,rd,y),m(o,yo,y),e(yo,ls),e(ls,Kl),v(Ta,Kl,null),e(yo,yg),e(yo,ei),e(ei,_g),m(o,ld,y),m(o,tt,y),v(wa,tt,null),e(tt,Mg),e(tt,xt),e(xt,bg),e(xt,ka),e(ka,Tg),e(xt,wg),e(xt,ti),e(ti,kg),e(xt,vg),e(xt,oi),e(oi,Lg),e(xt,jg),e(tt,Ug),e(tt,va),e(va,Jg),e(va,pr),e(pr,Cg),e(va,Eg),e(tt,$g),e(tt,La),e(La,Ig),e(La,ja),e(ja,Fg),e(La,zg),e(tt,xg),v(is,tt,null),e(tt,Ng),e(tt,Jt),v(Ua,Jt,null),e(Jt,qg),e(Jt,_o),e(_o,Ag),e(_o,ur),e(ur,Rg),e(_o,Zg),e(_o,si),e(si,Vg),e(_o,Wg),e(Jt,Bg),v(ds,Jt,null),e(Jt,Qg),v(cs,Jt,null),id=!0},p(o,[y]){const Ja={};y&2&&(Ja.$$scope={dirty:y,ctx:o}),vo.$set(Ja);const ni={};y&2&&(ni.$$scope={dirty:y,ctx:o}),Uo.$set(ni);const ai={};y&2&&(ai.$$scope={dirty:y,ctx:o}),Eo.$set(ai);const ri={};y&2&&(ri.$$scope={dirty:y,ctx:o}),Io.$set(ri);const Ca={};y&2&&(Ca.$$scope={dirty:y,ctx:o}),Fo.$set(Ca);const li={};y&2&&(li.$$scope={dirty:y,ctx:o}),xo.$set(li);const ii={};y&2&&(ii.$$scope={dirty:y,ctx:o}),No.$set(ii);const di={};y&2&&(di.$$scope={dirty:y,ctx:o}),Ao.$set(di);const Ea={};y&2&&(Ea.$$scope={dirty:y,ctx:o}),Ro.$set(Ea);const ci={};y&2&&(ci.$$scope={dirty:y,ctx:o}),Vo.$set(ci);const Mo={};y&2&&(Mo.$$scope={dirty:y,ctx:o}),Wo.$set(Mo);const $a={};y&2&&($a.$$scope={dirty:y,ctx:o}),Qo.$set($a);const pi={};y&2&&(pi.$$scope={dirty:y,ctx:o}),Do.$set(pi);const Ia={};y&2&&(Ia.$$scope={dirty:y,ctx:o}),Xo.$set(Ia);const ui={};y&2&&(ui.$$scope={dirty:y,ctx:o}),So.$set(ui);const Fa={};y&2&&(Fa.$$scope={dirty:y,ctx:o}),Ho.$set(Fa);const hi={};y&2&&(hi.$$scope={dirty:y,ctx:o}),Oo.$set(hi);const mi={};y&2&&(mi.$$scope={dirty:y,ctx:o}),Yo.$set(mi);const fi={};y&2&&(fi.$$scope={dirty:y,ctx:o}),es.$set(fi);const gi={};y&2&&(gi.$$scope={dirty:y,ctx:o}),ts.$set(gi);const yi={};y&2&&(yi.$$scope={dirty:y,ctx:o}),os.$set(yi);const _i={};y&2&&(_i.$$scope={dirty:y,ctx:o}),ns.$set(_i);const lt={};y&2&&(lt.$$scope={dirty:y,ctx:o}),as.$set(lt);const Mi={};y&2&&(Mi.$$scope={dirty:y,ctx:o}),rs.$set(Mi);const bi={};y&2&&(bi.$$scope={dirty:y,ctx:o}),is.$set(bi);const Ti={};y&2&&(Ti.$$scope={dirty:y,ctx:o}),ds.$set(Ti);const wi={};y&2&&(wi.$$scope={dirty:y,ctx:o}),cs.$set(wi)},i(o){id||(L(i.$$.fragment,o),L(R.$$.fragment,o),L(V.$$.fragment,o),L(Js.$$.fragment,o),L(Cs.$$.fragment,o),L(Es.$$.fragment,o),L(qs.$$.fragment,o),L(Zs.$$.fragment,o),L(Gs.$$.fragment,o),L(Ds.$$.fragment,o),L(vo.$$.fragment,o),L(Ss.$$.fragment,o),L(Ps.$$.fragment,o),L(Os.$$.fragment,o),L(Ks.$$.fragment,o),L(en.$$.fragment,o),L(Uo.$$.fragment,o),L(tn.$$.fragment,o),L(sn.$$.fragment,o),L(nn.$$.fragment,o),L(ln.$$.fragment,o),L(cn.$$.fragment,o),L(Eo.$$.fragment,o),L(pn.$$.fragment,o),L(un.$$.fragment,o),L(yn.$$.fragment,o),L(Io.$$.fragment,o),L(Fo.$$.fragment,o),L(_n.$$.fragment,o),L(Mn.$$.fragment,o),L(kn.$$.fragment,o),L(xo.$$.fragment,o),L(No.$$.fragment,o),L(vn.$$.fragment,o),L(Ln.$$.fragment,o),L(In.$$.fragment,o),L(Ao.$$.fragment,o),L(Ro.$$.fragment,o),L(Fn.$$.fragment,o),L(zn.$$.fragment,o),L(Vn.$$.fragment,o),L(Vo.$$.fragment,o),L(Wo.$$.fragment,o),L(Wn.$$.fragment,o),L(Bn.$$.fragment,o),L(Pn.$$.fragment,o),L(Qo.$$.fragment,o),L(Hn.$$.fragment,o),L(On.$$.fragment,o),L(Do.$$.fragment,o),L(ta.$$.fragment,o),L(Xo.$$.fragment,o),L(So.$$.fragment,o),L(oa.$$.fragment,o),L(sa.$$.fragment,o),L(Ho.$$.fragment,o),L(ia.$$.fragment,o),L(Oo.$$.fragment,o),L(Yo.$$.fragment,o),L(da.$$.fragment,o),L(ca.$$.fragment,o),L(es.$$.fragment,o),L(ma.$$.fragment,o),L(ts.$$.fragment,o),L(os.$$.fragment,o),L(fa.$$.fragment,o),L(ga.$$.fragment,o),L(ns.$$.fragment,o),L(ba.$$.fragment,o),L(as.$$.fragment,o),L(rs.$$.fragment,o),L(Ta.$$.fragment,o),L(wa.$$.fragment,o),L(is.$$.fragment,o),L(Ua.$$.fragment,o),L(ds.$$.fragment,o),L(cs.$$.fragment,o),id=!0)},o(o){j(i.$$.fragment,o),j(R.$$.fragment,o),j(V.$$.fragment,o),j(Js.$$.fragment,o),j(Cs.$$.fragment,o),j(Es.$$.fragment,o),j(qs.$$.fragment,o),j(Zs.$$.fragment,o),j(Gs.$$.fragment,o),j(Ds.$$.fragment,o),j(vo.$$.fragment,o),j(Ss.$$.fragment,o),j(Ps.$$.fragment,o),j(Os.$$.fragment,o),j(Ks.$$.fragment,o),j(en.$$.fragment,o),j(Uo.$$.fragment,o),j(tn.$$.fragment,o),j(sn.$$.fragment,o),j(nn.$$.fragment,o),j(ln.$$.fragment,o),j(cn.$$.fragment,o),j(Eo.$$.fragment,o),j(pn.$$.fragment,o),j(un.$$.fragment,o),j(yn.$$.fragment,o),j(Io.$$.fragment,o),j(Fo.$$.fragment,o),j(_n.$$.fragment,o),j(Mn.$$.fragment,o),j(kn.$$.fragment,o),j(xo.$$.fragment,o),j(No.$$.fragment,o),j(vn.$$.fragment,o),j(Ln.$$.fragment,o),j(In.$$.fragment,o),j(Ao.$$.fragment,o),j(Ro.$$.fragment,o),j(Fn.$$.fragment,o),j(zn.$$.fragment,o),j(Vn.$$.fragment,o),j(Vo.$$.fragment,o),j(Wo.$$.fragment,o),j(Wn.$$.fragment,o),j(Bn.$$.fragment,o),j(Pn.$$.fragment,o),j(Qo.$$.fragment,o),j(Hn.$$.fragment,o),j(On.$$.fragment,o),j(Do.$$.fragment,o),j(ta.$$.fragment,o),j(Xo.$$.fragment,o),j(So.$$.fragment,o),j(oa.$$.fragment,o),j(sa.$$.fragment,o),j(Ho.$$.fragment,o),j(ia.$$.fragment,o),j(Oo.$$.fragment,o),j(Yo.$$.fragment,o),j(da.$$.fragment,o),j(ca.$$.fragment,o),j(es.$$.fragment,o),j(ma.$$.fragment,o),j(ts.$$.fragment,o),j(os.$$.fragment,o),j(fa.$$.fragment,o),j(ga.$$.fragment,o),j(ns.$$.fragment,o),j(ba.$$.fragment,o),j(as.$$.fragment,o),j(rs.$$.fragment,o),j(Ta.$$.fragment,o),j(wa.$$.fragment,o),j(is.$$.fragment,o),j(Ua.$$.fragment,o),j(ds.$$.fragment,o),j(cs.$$.fragment,o),id=!1},d(o){t(d),o&&t(b),o&&t(f),U(i),o&&t(ye),o&&t(W),o&&t(_e),o&&t(G),U(R),o&&t(Me),o&&t(ne),o&&t(be),o&&t(oe),o&&t(Te),o&&t(B),o&&t(we),o&&t(A),o&&t(ke),o&&t(ee),o&&t(ve),o&&t(N),o&&t(Ae),U(V,o),o&&t(Re),o&&t(ge),o&&t(ki),U(Js,o),o&&t(vi),o&&t(Bt),U(Cs),o&&t(Li),o&&t(za),o&&t(ji),U(Es,o),o&&t(Ui),o&&t(yt),o&&t(Ji),U(qs,o),o&&t(Ci),o&&t(To),o&&t(Ei),U(Zs,o),o&&t($i),o&&t(wo),o&&t(Ii),o&&t(Ra),o&&t(Fi),o&&t(Za),o&&t(zi),o&&t(Wa),o&&t(xi),o&&t(Ba),o&&t(Ni),o&&t(Qt),U(Gs),o&&t(qi),o&&t(ut),U(Ds),U(vo),o&&t(Ai),o&&t(Xt),U(Ss),o&&t(Ri),o&&t(Ze),U(Ps),U(Os),U(Ks),U(en),U(Uo),U(tn),o&&t(Zi),o&&t(Pt),U(sn),o&&t(Vi),o&&t(st),U(nn),U(ln),U(cn),U(Eo),o&&t(Wi),o&&t(Ot),U(pn),o&&t(Bi),o&&t(ht),U(un),U(yn),U(Io),U(Fo),o&&t(Qi),o&&t(Kt),U(_n),o&&t(Gi),o&&t(mt),U(Mn),U(kn),U(xo),U(No),o&&t(Di),o&&t(oo),U(vn),o&&t(Xi),o&&t(nt),U(Ln),U(In),U(Ao),U(Ro),o&&t(Si),o&&t(no),U(Fn),o&&t(Pi),o&&t(at),U(zn),U(Vn),U(Vo),U(Wo),o&&t(Hi),o&&t(lo),U(Wn),o&&t(Oi),o&&t(rt),U(Bn),U(Pn),U(Qo),o&&t(Yi),o&&t(io),U(Hn),o&&t(Ki),o&&t(Oe),U(On),U(Do),U(ta),U(Xo),U(So),o&&t(ed),o&&t(po),U(oa),o&&t(td),o&&t(Ye),U(sa),U(Ho),U(ia),U(Oo),U(Yo),o&&t(od),o&&t(ho),U(da),o&&t(sd),o&&t(Ke),U(ca),U(es),U(ma),U(ts),U(os),o&&t(nd),o&&t(fo),U(fa),o&&t(ad),o&&t(et),U(ga),U(ns),U(ba),U(as),U(rs),o&&t(rd),o&&t(yo),U(Ta),o&&t(ld),o&&t(tt),U(wa),U(is),U(Ua),U(ds),U(cs)}}}const bb={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 Tb(I){return GM(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Cb extends VM{constructor(d){super();WM(this,d,Tb,Mb,BM,{})}}export{Cb as default,bb as metadata};
