import{S as Mb,i as wb,s as Lb,e as a,k as d,w as g,t as n,M as kb,c as r,d as o,m as p,a as i,x as y,h as s,b as l,G as e,g as m,y as _,q as v,o as b,B as M,v as Tb,L as Ds}from"../../chunks/vendor-hf-doc-builder.js";import{T as Sl}from"../../chunks/Tip-hf-doc-builder.js";import{D as F}from"../../chunks/Docstring-hf-doc-builder.js";import{C as X}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Y}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ss}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Bg}from"../../chunks/PipelineTag-hf-doc-builder.js";function xb(I){let h,k,f,w,T;return w=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExheW91dExNdjJDb25maWclMkMlMjBMYXlvdXRMTXYyTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwTGF5b3V0TE12MiUyMG1pY3Jvc29mdCUyRmxheW91dGxtdjItYmFzZS11bmNhc2VkJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMExheW91dExNdjJDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwbWljcm9zb2Z0JTJGbGF5b3V0bG12Mi1iYXNlLXVuY2FzZWQlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMExheW91dExNdjJNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LayoutLMv2Config, LayoutLMv2Model

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a LayoutLMv2 microsoft/layoutlmv2-base-uncased style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = LayoutLMv2Config()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the microsoft/layoutlmv2-base-uncased style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LayoutLMv2Model(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(){h=a("p"),k=n("Example:"),f=d(),g(w.$$.fragment)},l(u){h=r(u,"P",{});var L=i(h);k=s(L,"Example:"),L.forEach(o),f=p(u),y(w.$$.fragment,u)},m(u,L){m(u,h,L),e(h,k),m(u,f,L),_(w,u,L),T=!0},p:Ds,i(u){T||(v(w.$$.fragment,u),T=!0)},o(u){b(w.$$.fragment,u),T=!1},d(u){u&&o(h),u&&o(f),M(w,u)}}}function jb(I){let h,k,f,w,T;return{c(){h=a("p"),k=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),w=n("Module"),T=n(`
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(u){h=r(u,"P",{});var L=i(h);k=s(L,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(L,"CODE",{});var N=i(f);w=s(N,"Module"),N.forEach(o),T=s(L,`
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.forEach(o)},m(u,L){m(u,h,L),e(h,k),e(h,f),e(f,w),e(h,T)},d(u){u&&o(h)}}}function Jb(I){let h,k,f,w,T;return w=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBMYXlvdXRMTXYyTW9kZWwlMkMlMjBzZXRfc2VlZCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBc2V0X3NlZWQoODgpJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGbGF5b3V0bG12Mi1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBMYXlvdXRMTXYyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRmxheW91dGxtdjItYmFzZS11bmNhc2VkJTIyKSUwQSUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRmZpeHR1cmVzX2RvY3ZxYSUyMiklMEFpbWFnZV9wYXRoJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIwJTVEJTVCJTIyZmlsZSUyMiU1RCUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihpbWFnZV9wYXRoKS5jb252ZXJ0KCUyMlJHQiUyMiklMEElMEFlbmNvZGluZyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqZW5jb2RpbmcpJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcy5zaGFwZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, LayoutLMv2Model, set_seed
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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>set_seed(<span class="hljs-number">88</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LayoutLMv2Model.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/fixtures_docvqa&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_path = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-number">0</span>][<span class="hljs-string">&quot;file&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(image_path).convert(<span class="hljs-string">&quot;RGB&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states.shape
torch.Size([<span class="hljs-number">1</span>, <span class="hljs-number">342</span>, <span class="hljs-number">768</span>])`}}),{c(){h=a("p"),k=n("Examples:"),f=d(),g(w.$$.fragment)},l(u){h=r(u,"P",{});var L=i(h);k=s(L,"Examples:"),L.forEach(o),f=p(u),y(w.$$.fragment,u)},m(u,L){m(u,h,L),e(h,k),m(u,f,L),_(w,u,L),T=!0},p:Ds,i(u){T||(v(w.$$.fragment,u),T=!0)},o(u){b(w.$$.fragment,u),T=!1},d(u){u&&o(h),u&&o(f),M(w,u)}}}function Ub(I){let h,k,f,w,T;return{c(){h=a("p"),k=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),w=n("Module"),T=n(`
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(u){h=r(u,"P",{});var L=i(h);k=s(L,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(L,"CODE",{});var N=i(f);w=s(N,"Module"),N.forEach(o),T=s(L,`
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.forEach(o)},m(u,L){m(u,h,L),e(h,k),e(h,f),e(f,w),e(h,T)},d(u){u&&o(h)}}}function Eb(I){let h,k,f,w,T;return w=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBMYXlvdXRMTXYyRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUyQyUyMHNldF9zZWVkJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFzZXRfc2VlZCg4OCklMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMnJ2bF9jZGlwJTIyJTJDJTIwc3BsaXQlM0QlMjJ0cmFpbiUyMiUyQyUyMHN0cmVhbWluZyUzRFRydWUpJTBBZGF0YSUyMCUzRCUyMG5leHQoaXRlcihkYXRhc2V0KSklMEFpbWFnZSUyMCUzRCUyMGRhdGElNUIlMjJpbWFnZSUyMiU1RC5jb252ZXJ0KCUyMlJHQiUyMiklMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZsYXlvdXRsbXYyLWJhc2UtdW5jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMExheW91dExNdjJGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJtaWNyb3NvZnQlMkZsYXlvdXRsbXYyLWJhc2UtdW5jYXNlZCUyMiUyQyUyMG51bV9sYWJlbHMlM0RkYXRhc2V0LmluZm8uZmVhdHVyZXMlNUIlMjJsYWJlbCUyMiU1RC5udW1fY2xhc3NlcyUwQSklMEElMEFlbmNvZGluZyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBc2VxdWVuY2VfbGFiZWwlMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCZGF0YSU1QiUyMmxhYmVsJTIyJTVEJTVEKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmVuY29kaW5nJTJDJTIwbGFiZWxzJTNEc2VxdWVuY2VfbGFiZWwpJTBBJTBBbG9zcyUyQyUyMGxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9zcyUyQyUyMG91dHB1dHMubG9naXRzJTBBcHJlZGljdGVkX2lkeCUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoZGltJTNELTEpLml0ZW0oKSUwQXByZWRpY3RlZF9hbnN3ZXIlMjAlM0QlMjBkYXRhc2V0LmluZm8uZmVhdHVyZXMlNUIlMjJsYWJlbCUyMiU1RC5uYW1lcyU1QjQlNUQlMEFwcmVkaWN0ZWRfaWR4JTJDJTIwcHJlZGljdGVkX2Fuc3dlcg==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, LayoutLMv2ForSequenceClassification, set_seed
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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>set_seed(<span class="hljs-number">88</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;rvl_cdip&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>, streaming=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>data = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(dataset))
<span class="hljs-meta">&gt;&gt;&gt; </span>image = data[<span class="hljs-string">&quot;image&quot;</span>].convert(<span class="hljs-string">&quot;RGB&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LayoutLMv2ForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>, num_labels=dataset.info.features[<span class="hljs-string">&quot;label&quot;</span>].num_classes
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_label = torch.tensor([data[<span class="hljs-string">&quot;label&quot;</span>]])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding, labels=sequence_label)

<span class="hljs-meta">&gt;&gt;&gt; </span>loss, logits = outputs.loss, outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_idx = logits.argmax(dim=-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_answer = dataset.info.features[<span class="hljs-string">&quot;label&quot;</span>].names[<span class="hljs-number">4</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_idx, predicted_answer
(<span class="hljs-number">4</span>, <span class="hljs-string">&#x27;advertisement&#x27;</span>)`}}),{c(){h=a("p"),k=n("Example:"),f=d(),g(w.$$.fragment)},l(u){h=r(u,"P",{});var L=i(h);k=s(L,"Example:"),L.forEach(o),f=p(u),y(w.$$.fragment,u)},m(u,L){m(u,h,L),e(h,k),m(u,f,L),_(w,u,L),T=!0},p:Ds,i(u){T||(v(w.$$.fragment,u),T=!0)},o(u){b(w.$$.fragment,u),T=!1},d(u){u&&o(h),u&&o(f),M(w,u)}}}function zb(I){let h,k,f,w,T;return{c(){h=a("p"),k=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),w=n("Module"),T=n(`
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(u){h=r(u,"P",{});var L=i(h);k=s(L,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(L,"CODE",{});var N=i(f);w=s(N,"Module"),N.forEach(o),T=s(L,`
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.forEach(o)},m(u,L){m(u,h,L),e(h,k),e(h,f),e(f,w),e(h,T)},d(u){u&&o(h)}}}function Ib(I){let h,k,f,w,T;return w=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBMYXlvdXRMTXYyRm9yVG9rZW5DbGFzc2lmaWNhdGlvbiUyQyUyMHNldF9zZWVkJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBc2V0X3NlZWQoODgpJTBBJTBBZGF0YXNldHMlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIybmllbHNyJTJGZnVuc2QlMjIlMkMlMjBzcGxpdCUzRCUyMnRlc3QlMjIpJTBBbGFiZWxzJTIwJTNEJTIwZGF0YXNldHMuZmVhdHVyZXMlNUIlMjJuZXJfdGFncyUyMiU1RC5mZWF0dXJlLm5hbWVzJTBBaWQybGFiZWwlMjAlM0QlMjAlN0J2JTNBJTIwayUyMGZvciUyMHYlMkMlMjBrJTIwaW4lMjBlbnVtZXJhdGUobGFiZWxzKSU3RCUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRmxheW91dGxtdjItYmFzZS11bmNhc2VkJTIyJTJDJTIwcmV2aXNpb24lM0QlMjJub19vY3IlMjIpJTBBbW9kZWwlMjAlM0QlMjBMYXlvdXRMTXYyRm9yVG9rZW5DbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIybWljcm9zb2Z0JTJGbGF5b3V0bG12Mi1iYXNlLXVuY2FzZWQlMjIlMkMlMjBudW1fbGFiZWxzJTNEbGVuKGxhYmVscyklMEEpJTBBJTBBZGF0YSUyMCUzRCUyMGRhdGFzZXRzJTVCMCU1RCUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihkYXRhJTVCJTIyaW1hZ2VfcGF0aCUyMiU1RCkuY29udmVydCglMjJSR0IlMjIpJTBBd29yZHMlMjAlM0QlMjBkYXRhJTVCJTIyd29yZHMlMjIlNUQlMEFib3hlcyUyMCUzRCUyMGRhdGElNUIlMjJiYm94ZXMlMjIlNUQlMjAlMjAlMjMlMjBtYWtlJTIwc3VyZSUyMHRvJTIwbm9ybWFsaXplJTIweW91ciUyMGJvdW5kaW5nJTIwYm94ZXMlMEF3b3JkX2xhYmVscyUyMCUzRCUyMGRhdGElNUIlMjJuZXJfdGFncyUyMiU1RCUwQWVuY29kaW5nJTIwJTNEJTIwcHJvY2Vzc29yKCUwQSUyMCUyMCUyMCUyMGltYWdlJTJDJTBBJTIwJTIwJTIwJTIwd29yZHMlMkMlMEElMjAlMjAlMjAlMjBib3hlcyUzRGJveGVzJTJDJTBBJTIwJTIwJTIwJTIwd29yZF9sYWJlbHMlM0R3b3JkX2xhYmVscyUyQyUwQSUyMCUyMCUyMCUyMHBhZGRpbmclM0QlMjJtYXhfbGVuZ3RoJTIyJTJDJTBBJTIwJTIwJTIwJTIwdHJ1bmNhdGlvbiUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTJDJTBBKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmVuY29kaW5nKSUwQWxvZ2l0cyUyQyUyMGxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cyUyQyUyMG91dHB1dHMubG9zcyUwQSUwQXByZWRpY3RlZF90b2tlbl9jbGFzc19pZHMlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KC0xKSUwQXByZWRpY3RlZF90b2tlbnNfY2xhc3NlcyUyMCUzRCUyMCU1QmlkMmxhYmVsJTVCdC5pdGVtKCklNUQlMjBmb3IlMjB0JTIwaW4lMjBwcmVkaWN0ZWRfdG9rZW5fY2xhc3NfaWRzJTVCMCU1RCU1RCUwQXByZWRpY3RlZF90b2tlbnNfY2xhc3NlcyU1QiUzQTUlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, LayoutLMv2ForTokenClassification, set_seed
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<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>set_seed(<span class="hljs-number">88</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>datasets = load_dataset(<span class="hljs-string">&quot;nielsr/funsd&quot;</span>, split=<span class="hljs-string">&quot;test&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = datasets.features[<span class="hljs-string">&quot;ner_tags&quot;</span>].feature.names
<span class="hljs-meta">&gt;&gt;&gt; </span>id2label = {v: k <span class="hljs-keyword">for</span> v, k <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(labels)}

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>, revision=<span class="hljs-string">&quot;no_ocr&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LayoutLMv2ForTokenClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>, num_labels=<span class="hljs-built_in">len</span>(labels)
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = datasets[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(data[<span class="hljs-string">&quot;image_path&quot;</span>]).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>words = data[<span class="hljs-string">&quot;words&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes = data[<span class="hljs-string">&quot;bboxes&quot;</span>]  <span class="hljs-comment"># make sure to normalize your bounding boxes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>word_labels = data[<span class="hljs-string">&quot;ner_tags&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = processor(
<span class="hljs-meta">... </span>    image,
<span class="hljs-meta">... </span>    words,
<span class="hljs-meta">... </span>    boxes=boxes,
<span class="hljs-meta">... </span>    word_labels=word_labels,
<span class="hljs-meta">... </span>    padding=<span class="hljs-string">&quot;max_length&quot;</span>,
<span class="hljs-meta">... </span>    truncation=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    return_tensors=<span class="hljs-string">&quot;pt&quot;</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits, loss = outputs.logits, outputs.loss

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_class_ids = logits.argmax(-<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_tokens_classes = [id2label[t.item()] <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> predicted_token_class_ids[<span class="hljs-number">0</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_tokens_classes[:<span class="hljs-number">5</span>]
[<span class="hljs-string">&#x27;B-ANSWER&#x27;</span>, <span class="hljs-string">&#x27;B-HEADER&#x27;</span>, <span class="hljs-string">&#x27;B-HEADER&#x27;</span>, <span class="hljs-string">&#x27;B-HEADER&#x27;</span>, <span class="hljs-string">&#x27;B-HEADER&#x27;</span>]`}}),{c(){h=a("p"),k=n("Example:"),f=d(),g(w.$$.fragment)},l(u){h=r(u,"P",{});var L=i(h);k=s(L,"Example:"),L.forEach(o),f=p(u),y(w.$$.fragment,u)},m(u,L){m(u,h,L),e(h,k),m(u,f,L),_(w,u,L),T=!0},p:Ds,i(u){T||(v(w.$$.fragment,u),T=!0)},o(u){b(w.$$.fragment,u),T=!1},d(u){u&&o(h),u&&o(f),M(w,u)}}}function Cb(I){let h,k,f,w,T;return{c(){h=a("p"),k=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),w=n("Module"),T=n(`
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(u){h=r(u,"P",{});var L=i(h);k=s(L,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(L,"CODE",{});var N=i(f);w=s(N,"Module"),N.forEach(o),T=s(L,`
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.forEach(o)},m(u,L){m(u,h,L),e(h,k),e(h,f),e(f,w),e(h,T)},d(u){u&&o(h)}}}function $b(I){let h,k;return h=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBMYXlvdXRMTXYyRm9yUXVlc3Rpb25BbnN3ZXJpbmclMkMlMjBzZXRfc2VlZCUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBc2V0X3NlZWQoODgpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGbGF5b3V0bG12Mi1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBMYXlvdXRMTXYyRm9yUXVlc3Rpb25BbnN3ZXJpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRmxheW91dGxtdjItYmFzZS11bmNhc2VkJTIyKSUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRmZpeHR1cmVzX2RvY3ZxYSUyMiklMEFpbWFnZV9wYXRoJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIwJTVEJTVCJTIyZmlsZSUyMiU1RCUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihpbWFnZV9wYXRoKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFxdWVzdGlvbiUyMCUzRCUyMCUyMldoZW4lMjBpcyUyMGNvZmZlZSUyMGJyZWFrJTNGJTIyJTBBZW5jb2RpbmclMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2UlMkMlMjBxdWVzdGlvbiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqZW5jb2RpbmcpJTBBcHJlZGljdGVkX3N0YXJ0X2lkeCUyMCUzRCUyMG91dHB1dHMuc3RhcnRfbG9naXRzLmFyZ21heCgtMSkuaXRlbSgpJTBBcHJlZGljdGVkX2VuZF9pZHglMjAlM0QlMjBvdXRwdXRzLmVuZF9sb2dpdHMuYXJnbWF4KC0xKS5pdGVtKCklMEFwcmVkaWN0ZWRfc3RhcnRfaWR4JTJDJTIwcHJlZGljdGVkX2VuZF9pZHglMEElMEFwcmVkaWN0ZWRfYW5zd2VyX3Rva2VucyUyMCUzRCUyMGVuY29kaW5nLmlucHV0X2lkcy5zcXVlZXplKCklNUJwcmVkaWN0ZWRfc3RhcnRfaWR4JTIwJTNBJTIwcHJlZGljdGVkX2VuZF9pZHglMjAlMkIlMjAxJTVEJTBBcHJlZGljdGVkX2Fuc3dlciUyMCUzRCUyMHByb2Nlc3Nvci50b2tlbml6ZXIuZGVjb2RlKHByZWRpY3RlZF9hbnN3ZXJfdG9rZW5zKSUwQXByZWRpY3RlZF9hbnN3ZXIlMjAlMjAlMjMlMjByZXN1bHRzJTIwYXJlJTIwbm90JTIwdmVyeSUyMGdvb2QlMjB3aXRob3V0JTIwZnVydGhlciUyMGZpbmUtdHVuaW5n",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, LayoutLMv2ForQuestionAnswering, set_seed
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<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>set_seed(<span class="hljs-number">88</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LayoutLMv2ForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/fixtures_docvqa&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_path = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-number">0</span>][<span class="hljs-string">&quot;file&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(image_path).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>question = <span class="hljs-string">&quot;When is coffee break?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = processor(image, question, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_start_idx = outputs.start_logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_end_idx = outputs.end_logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_start_idx, predicted_end_idx
(<span class="hljs-number">154</span>, <span class="hljs-number">287</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_answer_tokens = encoding.input_ids.squeeze()[predicted_start_idx : predicted_end_idx + <span class="hljs-number">1</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_answer = processor.tokenizer.decode(predicted_answer_tokens)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_answer  <span class="hljs-comment"># results are not very good without further fine-tuning</span>
<span class="hljs-string">&#x27;council mem - bers conducted by trrf treasurer philip g. kuehn to get answers which the public ...</span>`}}),{c(){g(h.$$.fragment)},l(f){y(h.$$.fragment,f)},m(f,w){_(h,f,w),k=!0},p:Ds,i(f){k||(v(h.$$.fragment,f),k=!0)},o(f){b(h.$$.fragment,f),k=!1},d(f){M(h,f)}}}function Fb(I){let h,k;return h=new X({props:{code:"dGFyZ2V0X3N0YXJ0X2luZGV4JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QjclNUQpJTBBdGFyZ2V0X2VuZF9pbmRleCUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxNCU1RCklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKiplbmNvZGluZyUyQyUyMHN0YXJ0X3Bvc2l0aW9ucyUzRHRhcmdldF9zdGFydF9pbmRleCUyQyUyMGVuZF9wb3NpdGlvbnMlM0R0YXJnZXRfZW5kX2luZGV4KSUwQXByZWRpY3RlZF9hbnN3ZXJfc3Bhbl9zdGFydCUyMCUzRCUyMG91dHB1dHMuc3RhcnRfbG9naXRzLmFyZ21heCgtMSkuaXRlbSgpJTBBcHJlZGljdGVkX2Fuc3dlcl9zcGFuX2VuZCUyMCUzRCUyMG91dHB1dHMuZW5kX2xvZ2l0cy5hcmdtYXgoLTEpLml0ZW0oKSUwQXByZWRpY3RlZF9hbnN3ZXJfc3Bhbl9zdGFydCUyQyUyMHByZWRpY3RlZF9hbnN3ZXJfc3Bhbl9lbmQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>target_start_index = torch.tensor([<span class="hljs-number">7</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>target_end_index = torch.tensor([<span class="hljs-number">14</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding, start_positions=target_start_index, end_positions=target_end_index)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_answer_span_start = outputs.start_logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_answer_span_end = outputs.end_logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_answer_span_start, predicted_answer_span_end
(<span class="hljs-number">154</span>, <span class="hljs-number">287</span>)`}}),{c(){g(h.$$.fragment)},l(f){y(h.$$.fragment,f)},m(f,w){_(h,f,w),k=!0},p:Ds,i(f){k||(v(h.$$.fragment,f),k=!0)},o(f){b(h.$$.fragment,f),k=!1},d(f){M(h,f)}}}function Zb(I){let h,k,f,w,T,u,L,N,Dl,Or,je,Qe,Qs,Ft,Ql,Ys,Yl,Hr,ue,Ol,Zt,Hl,Kl,Tn,ec,tc,Kr,he,O,oc,Wt,nc,sc,Nt,ac,rc,Rt,ic,lc,qt,cc,dc,pc,Bt,mc,At,uc,hc,fc,Gt,gc,Xt,yc,_c,ei,xn,vc,ti,jn,Os,bc,oi,se,Mc,Hs,wc,Lc,Ks,kc,Tc,ea,xc,jc,ni,Pt,si,Jn,Jc,ai,Un,Uc,ri,P,ta,Ec,zc,Vt,Ic,St,Cc,$c,Fc,Dt,Zc,Qt,Wc,Nc,Rc,Je,qc,Yt,Bc,Ac,Ot,Gc,Xc,Pc,x,Vc,oa,Sc,Dc,En,Qc,Yc,na,Oc,Hc,sa,Kc,ed,aa,td,od,ra,nd,sd,ia,ad,rd,la,id,ld,ca,cd,dd,zn,pd,md,Ht,ud,hd,Kt,fd,gd,ii,eo,li,fe,yd,da,_d,vd,pa,bd,Md,ci,to,di,Ye,wd,In,Ld,kd,pi,ge,Z,Td,Cn,xd,jd,ma,Jd,Ud,ua,Ed,zd,$n,Id,Cd,ha,$d,Fd,fa,Zd,Wd,ga,Nd,Rd,qd,oo,Bd,Fn,Ad,Gd,Xd,no,Pd,ya,Vd,Sd,mi,Oe,Dd,Zn,Qd,Yd,ui,Ue,He,_a,so,Od,va,Hd,hi,Wn,Kd,fi,ao,gi,Ke,ro,ep,io,tp,op,np,Nn,sp,Rn,ap,yi,lo,_i,ye,co,rp,po,ip,lp,cp,qn,dp,Bn,pp,mp,An,up,Gn,hp,vi,mo,bi,_e,uo,fp,ho,gp,yp,_p,fo,vp,go,bp,Mp,wp,Xn,Lp,Pn,kp,Mi,Ee,et,ba,yo,Tp,Ma,xp,wi,V,jp,Vn,Jp,Up,Sn,Ep,zp,Dn,Ip,Cp,Qn,$p,Fp,Li,_o,ki,J,Zp,Yn,Wp,Np,On,Rp,qp,wa,Bp,Ap,Hn,Gp,Xp,Kn,Pp,Vp,La,Sp,Dp,ka,Qp,Yp,Ta,Op,Hp,xa,Kp,em,ja,tm,om,Ti,A,es,nm,sm,vo,am,rm,ts,im,lm,Ja,cm,dm,Ua,pm,mm,xi,os,um,ji,ns,Ea,hm,Ji,ss,fm,Ui,bo,Ei,as,za,gm,zi,ve,ym,Ia,_m,vm,Ca,bm,Mm,Ii,Mo,Ci,rs,$a,wm,$i,S,Lm,Fa,km,Tm,Za,xm,jm,Wa,Jm,Um,Na,Em,zm,Fi,wo,Zi,is,Ra,Im,Wi,ls,Cm,Ni,Lo,Ri,cs,qa,$m,qi,ds,Fm,Bi,ko,Ai,ze,tt,Ba,To,Zm,Aa,Wm,Gi,H,xo,Nm,Ie,Rm,ps,qm,Bm,jo,Am,Gm,Xm,Ce,Pm,ms,Vm,Sm,us,Dm,Qm,Ym,ot,Xi,$e,nt,Ga,Jo,Om,Xa,Hm,Pi,Fe,Uo,Km,st,Eo,eu,Pa,tu,Vi,Ze,at,Va,zo,ou,Sa,nu,Si,ce,Io,su,Da,au,ru,rt,Co,iu,Qa,lu,Di,We,it,Ya,$o,cu,Oa,du,Qi,R,Fo,pu,q,mu,hs,uu,hu,Ha,fu,gu,Ka,yu,_u,er,vu,bu,tr,Mu,wu,or,Lu,ku,Tu,Zo,xu,fs,ju,Ju,Uu,gs,ys,Eu,zu,Iu,lt,Wo,Cu,nr,$u,Fu,_s,No,Yi,Ne,ct,sr,Ro,Zu,ar,Wu,Oi,K,qo,Nu,Bo,Ru,rr,qu,Bu,Au,Ao,Gu,vs,Xu,Pu,Vu,dt,Go,Su,ir,Du,Hi,Re,pt,lr,Xo,Qu,cr,Yu,Ki,G,Po,Ou,dr,Hu,Ku,bs,Ms,eh,th,oh,z,nh,ws,sh,ah,Ls,rh,ih,ks,lh,ch,pr,dh,ph,mr,mh,uh,ur,hh,fh,hr,gh,yh,fr,_h,vh,gr,bh,Mh,wh,be,Vo,Lh,j,kh,yr,Th,xh,So,_r,jh,Jh,Uh,Ts,Eh,zh,vr,Ih,Ch,br,$h,Fh,Do,Mr,Zh,Wh,Nh,wr,Rh,qh,xs,Bh,Ah,Lr,Gh,Xh,kr,Ph,Vh,Tr,Sh,Dh,xr,Qh,Yh,Oh,jr,Hh,el,qe,mt,Jr,Qo,Kh,Ur,ef,tl,de,Yo,tf,Oo,of,Ho,nf,sf,af,ae,Ko,rf,Be,lf,js,cf,df,Er,pf,mf,uf,ut,hf,ht,ol,Ae,ft,zr,en,ff,Ir,gf,nl,ee,tn,yf,on,_f,nn,vf,bf,Mf,sn,wf,an,Lf,kf,Tf,re,rn,xf,Ge,jf,Js,Jf,Uf,Cr,Ef,zf,If,gt,Cf,yt,sl,Xe,_t,$r,ln,$f,Fr,Ff,al,te,cn,Zf,oe,Wf,dn,Nf,Rf,pn,qf,Bf,mn,Af,Gf,un,Xf,Pf,Vf,hn,Sf,fn,Df,Qf,Yf,ie,gn,Of,Pe,Hf,Us,Kf,eg,Zr,tg,og,ng,vt,sg,bt,rl,Ve,Mt,Wr,yn,ag,Nr,rg,il,ne,_n,ig,pe,lg,vn,cg,dg,Rr,pg,mg,qr,ug,hg,fg,bn,gg,Mn,yg,_g,vg,W,wn,bg,Se,Mg,Es,wg,Lg,Br,kg,Tg,xg,wt,jg,Ar,Jg,Ug,Gr,Eg,zg,Lt,Ig,kt,ll;return u=new Y({}),Ft=new Y({}),Pt=new X({props:{code:"cHl0aG9uJTIwLW0lMjBwaXAlMjBpbnN0YWxsJTIwJ2dpdCUyQmh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmZhY2Vib29rcmVzZWFyY2glMkZkZXRlY3Ryb24yLmdpdCclMEFweXRob24lMjAtbSUyMHBpcCUyMGluc3RhbGwlMjB0b3JjaHZpc2lvbiUyMHRlc3NlcmFjdA==",highlighted:`<span class="hljs-keyword">python</span> -m pip install <span class="hljs-string">&#x27;git+https://github.com/facebookresearch/detectron2.git&#x27;</span>
<span class="hljs-keyword">python</span> -m pip install torchvision tesseract`}}),eo=new X({props:{code:"ZGVmJTIwbm9ybWFsaXplX2Jib3goYmJveCUyQyUyMHdpZHRoJTJDJTIwaGVpZ2h0KSUzQSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGludCgxMDAwJTIwKiUyMChiYm94JTVCMCU1RCUyMCUyRiUyMHdpZHRoKSklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpbnQoMTAwMCUyMColMjAoYmJveCU1QjElNUQlMjAlMkYlMjBoZWlnaHQpKSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGludCgxMDAwJTIwKiUyMChiYm94JTVCMiU1RCUyMCUyRiUyMHdpZHRoKSklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpbnQoMTAwMCUyMColMjAoYmJveCU1QjMlNUQlMjAlMkYlMjBoZWlnaHQpKSUyQyUwQSUyMCUyMCUyMCUyMCU1RA==",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">normalize_bbox</span>(<span class="hljs-params">bbox, width, height</span>):
    <span class="hljs-keyword">return</span> [
        <span class="hljs-built_in">int</span>(<span class="hljs-number">1000</span> * (bbox[<span class="hljs-number">0</span>] / width)),
        <span class="hljs-built_in">int</span>(<span class="hljs-number">1000</span> * (bbox[<span class="hljs-number">1</span>] / height)),
        <span class="hljs-built_in">int</span>(<span class="hljs-number">1000</span> * (bbox[<span class="hljs-number">2</span>] / width)),
        <span class="hljs-built_in">int</span>(<span class="hljs-number">1000</span> * (bbox[<span class="hljs-number">3</span>] / height)),
    ]`}}),to=new X({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKCUwQSUyMCUyMCUyMCUyMCUyMm5hbWVfb2ZfeW91cl9kb2N1bWVudCUyMC0lMjBjYW4lMjBiZSUyMGElMjBwbmclMkMlMjBqcGclMkMlMjBldGMuJTIwb2YlMjB5b3VyJTIwZG9jdW1lbnRzJTIwKFBERnMlMjBtdXN0JTIwYmUlMjBjb252ZXJ0ZWQlMjB0byUyMGltYWdlcykuJTIyJTBBKSUwQSUwQXdpZHRoJTJDJTIwaGVpZ2h0JTIwJTNEJTIwaW1hZ2Uuc2l6ZQ==",highlighted:`<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

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

width, height = image.size`}}),so=new Y({}),ao=new Bg({props:{pipeline:"text-classification"}}),lo=new Bg({props:{pipeline:"question-answering"}}),mo=new Bg({props:{pipeline:"token-classification"}}),yo=new Y({}),_o=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExheW91dExNdjJJbWFnZVByb2Nlc3NvciUyQyUyMExheW91dExNdjJUb2tlbml6ZXJGYXN0JTJDJTIwTGF5b3V0TE12MlByb2Nlc3NvciUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMExheW91dExNdjJJbWFnZVByb2Nlc3NvcigpJTIwJTIwJTIzJTIwYXBwbHlfb2NyJTIwaXMlMjBzZXQlMjB0byUyMFRydWUlMjBieSUyMGRlZmF1bHQlMEF0b2tlbml6ZXIlMjAlM0QlMjBMYXlvdXRMTXYyVG9rZW5pemVyRmFzdC5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGbGF5b3V0bG12Mi1iYXNlLXVuY2FzZWQlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwTGF5b3V0TE12MlByb2Nlc3NvcihpbWFnZV9wcm9jZXNzb3IlMkMlMjB0b2tlbml6ZXIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LayoutLMv2ImageProcessor, LayoutLMv2TokenizerFast, LayoutLMv2Processor

image_processor = LayoutLMv2ImageProcessor()  <span class="hljs-comment"># apply_ocr is set to True by default</span>
tokenizer = LayoutLMv2TokenizerFast.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>)
processor = LayoutLMv2Processor(image_processor, tokenizer)`}}),bo=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExheW91dExNdjJQcm9jZXNzb3IlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBMYXlvdXRMTXYyUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZsYXlvdXRsbXYyLWJhc2UtdW5jYXNlZCUyMiklMEElMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4oJTBBJTIwJTIwJTIwJTIwJTIybmFtZV9vZl95b3VyX2RvY3VtZW50JTIwLSUyMGNhbiUyMGJlJTIwYSUyMHBuZyUyQyUyMGpwZyUyQyUyMGV0Yy4lMjBvZiUyMHlvdXIlMjBkb2N1bWVudHMlMjAoUERGcyUyMG11c3QlMjBiZSUyMGNvbnZlcnRlZCUyMHRvJTIwaW1hZ2VzKS4lMjIlMEEpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQWVuY29kaW5nJTIwJTNEJTIwcHJvY2Vzc29yKCUwQSUyMCUyMCUyMCUyMGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUwQSklMjAlMjAlMjMlMjB5b3UlMjBjYW4lMjBhbHNvJTIwYWRkJTIwYWxsJTIwdG9rZW5pemVyJTIwcGFyYW1ldGVycyUyMGhlcmUlMjBzdWNoJTIwYXMlMjBwYWRkaW5nJTJDJTIwdHJ1bmNhdGlvbiUwQXByaW50KGVuY29kaW5nLmtleXMoKSklMEElMjMlMjBkaWN0X2tleXMoJTVCJ2lucHV0X2lkcyclMkMlMjAndG9rZW5fdHlwZV9pZHMnJTJDJTIwJ2F0dGVudGlvbl9tYXNrJyUyQyUyMCdiYm94JyUyQyUyMCdpbWFnZSclNUQp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LayoutLMv2Processor
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

processor = LayoutLMv2Processor.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>)

image = Image.<span class="hljs-built_in">open</span>(
    <span class="hljs-string">&quot;name_of_your_document - can be a png, jpg, etc. of your documents (PDFs must be converted to images).&quot;</span>
).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
encoding = processor(
    image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
)  <span class="hljs-comment"># you can also add all tokenizer parameters here such as padding, truncation</span>
<span class="hljs-built_in">print</span>(encoding.keys())
<span class="hljs-comment"># dict_keys([&#x27;input_ids&#x27;, &#x27;token_type_ids&#x27;, &#x27;attention_mask&#x27;, &#x27;bbox&#x27;, &#x27;image&#x27;])</span>`}}),Mo=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExheW91dExNdjJQcm9jZXNzb3IlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBMYXlvdXRMTXYyUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZsYXlvdXRsbXYyLWJhc2UtdW5jYXNlZCUyMiUyQyUyMHJldmlzaW9uJTNEJTIybm9fb2NyJTIyKSUwQSUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbiglMEElMjAlMjAlMjAlMjAlMjJuYW1lX29mX3lvdXJfZG9jdW1lbnQlMjAtJTIwY2FuJTIwYmUlMjBhJTIwcG5nJTJDJTIwanBnJTJDJTIwZXRjLiUyMG9mJTIweW91ciUyMGRvY3VtZW50cyUyMChQREZzJTIwbXVzdCUyMGJlJTIwY29udmVydGVkJTIwdG8lMjBpbWFnZXMpLiUyMiUwQSkuY29udmVydCglMjJSR0IlMjIpJTBBd29yZHMlMjAlM0QlMjAlNUIlMjJoZWxsbyUyMiUyQyUyMCUyMndvcmxkJTIyJTVEJTBBYm94ZXMlMjAlM0QlMjAlNUIlNUIxJTJDJTIwMiUyQyUyMDMlMkMlMjA0JTVEJTJDJTIwJTVCNSUyQyUyMDYlMkMlMjA3JTJDJTIwOCU1RCU1RCUyMCUyMCUyMyUyMG1ha2UlMjBzdXJlJTIwdG8lMjBub3JtYWxpemUlMjB5b3VyJTIwYm91bmRpbmclMjBib3hlcyUwQWVuY29kaW5nJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlJTJDJTIwd29yZHMlMkMlMjBib3hlcyUzRGJveGVzJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFwcmludChlbmNvZGluZy5rZXlzKCkpJTBBJTIzJTIwZGljdF9rZXlzKCU1QidpbnB1dF9pZHMnJTJDJTIwJ3Rva2VuX3R5cGVfaWRzJyUyQyUyMCdhdHRlbnRpb25fbWFzayclMkMlMjAnYmJveCclMkMlMjAnaW1hZ2UnJTVEKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LayoutLMv2Processor
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

processor = LayoutLMv2Processor.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>, revision=<span class="hljs-string">&quot;no_ocr&quot;</span>)

image = Image.<span class="hljs-built_in">open</span>(
    <span class="hljs-string">&quot;name_of_your_document - can be a png, jpg, etc. of your documents (PDFs must be converted to images).&quot;</span>
).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
words = [<span class="hljs-string">&quot;hello&quot;</span>, <span class="hljs-string">&quot;world&quot;</span>]
boxes = [[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>], [<span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>]]  <span class="hljs-comment"># make sure to normalize your bounding boxes</span>
encoding = processor(image, words, boxes=boxes, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-built_in">print</span>(encoding.keys())
<span class="hljs-comment"># dict_keys([&#x27;input_ids&#x27;, &#x27;token_type_ids&#x27;, &#x27;attention_mask&#x27;, &#x27;bbox&#x27;, &#x27;image&#x27;])</span>`}}),wo=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExheW91dExNdjJQcm9jZXNzb3IlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBMYXlvdXRMTXYyUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZsYXlvdXRsbXYyLWJhc2UtdW5jYXNlZCUyMiUyQyUyMHJldmlzaW9uJTNEJTIybm9fb2NyJTIyKSUwQSUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbiglMEElMjAlMjAlMjAlMjAlMjJuYW1lX29mX3lvdXJfZG9jdW1lbnQlMjAtJTIwY2FuJTIwYmUlMjBhJTIwcG5nJTJDJTIwanBnJTJDJTIwZXRjLiUyMG9mJTIweW91ciUyMGRvY3VtZW50cyUyMChQREZzJTIwbXVzdCUyMGJlJTIwY29udmVydGVkJTIwdG8lMjBpbWFnZXMpLiUyMiUwQSkuY29udmVydCglMjJSR0IlMjIpJTBBd29yZHMlMjAlM0QlMjAlNUIlMjJoZWxsbyUyMiUyQyUyMCUyMndvcmxkJTIyJTVEJTBBYm94ZXMlMjAlM0QlMjAlNUIlNUIxJTJDJTIwMiUyQyUyMDMlMkMlMjA0JTVEJTJDJTIwJTVCNSUyQyUyMDYlMkMlMjA3JTJDJTIwOCU1RCU1RCUyMCUyMCUyMyUyMG1ha2UlMjBzdXJlJTIwdG8lMjBub3JtYWxpemUlMjB5b3VyJTIwYm91bmRpbmclMjBib3hlcyUwQXdvcmRfbGFiZWxzJTIwJTNEJTIwJTVCMSUyQyUyMDIlNUQlMEFlbmNvZGluZyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZSUyQyUyMHdvcmRzJTJDJTIwYm94ZXMlM0Rib3hlcyUyQyUyMHdvcmRfbGFiZWxzJTNEd29yZF9sYWJlbHMlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXByaW50KGVuY29kaW5nLmtleXMoKSklMEElMjMlMjBkaWN0X2tleXMoJTVCJ2lucHV0X2lkcyclMkMlMjAndG9rZW5fdHlwZV9pZHMnJTJDJTIwJ2F0dGVudGlvbl9tYXNrJyUyQyUyMCdiYm94JyUyQyUyMCdsYWJlbHMnJTJDJTIwJ2ltYWdlJyU1RCk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LayoutLMv2Processor
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

processor = LayoutLMv2Processor.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>, revision=<span class="hljs-string">&quot;no_ocr&quot;</span>)

image = Image.<span class="hljs-built_in">open</span>(
    <span class="hljs-string">&quot;name_of_your_document - can be a png, jpg, etc. of your documents (PDFs must be converted to images).&quot;</span>
).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
words = [<span class="hljs-string">&quot;hello&quot;</span>, <span class="hljs-string">&quot;world&quot;</span>]
boxes = [[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>], [<span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>]]  <span class="hljs-comment"># make sure to normalize your bounding boxes</span>
word_labels = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>]
encoding = processor(image, words, boxes=boxes, word_labels=word_labels, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-built_in">print</span>(encoding.keys())
<span class="hljs-comment"># dict_keys([&#x27;input_ids&#x27;, &#x27;token_type_ids&#x27;, &#x27;attention_mask&#x27;, &#x27;bbox&#x27;, &#x27;labels&#x27;, &#x27;image&#x27;])</span>`}}),Lo=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExheW91dExNdjJQcm9jZXNzb3IlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBMYXlvdXRMTXYyUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZsYXlvdXRsbXYyLWJhc2UtdW5jYXNlZCUyMiklMEElMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4oJTBBJTIwJTIwJTIwJTIwJTIybmFtZV9vZl95b3VyX2RvY3VtZW50JTIwLSUyMGNhbiUyMGJlJTIwYSUyMHBuZyUyQyUyMGpwZyUyQyUyMGV0Yy4lMjBvZiUyMHlvdXIlMjBkb2N1bWVudHMlMjAoUERGcyUyMG11c3QlMjBiZSUyMGNvbnZlcnRlZCUyMHRvJTIwaW1hZ2VzKS4lMjIlMEEpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQXF1ZXN0aW9uJTIwJTNEJTIwJTIyV2hhdCdzJTIwaGlzJTIwbmFtZSUzRiUyMiUwQWVuY29kaW5nJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlJTJDJTIwcXVlc3Rpb24lMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXByaW50KGVuY29kaW5nLmtleXMoKSklMEElMjMlMjBkaWN0X2tleXMoJTVCJ2lucHV0X2lkcyclMkMlMjAndG9rZW5fdHlwZV9pZHMnJTJDJTIwJ2F0dGVudGlvbl9tYXNrJyUyQyUyMCdiYm94JyUyQyUyMCdpbWFnZSclNUQp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LayoutLMv2Processor
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

processor = LayoutLMv2Processor.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>)

image = Image.<span class="hljs-built_in">open</span>(
    <span class="hljs-string">&quot;name_of_your_document - can be a png, jpg, etc. of your documents (PDFs must be converted to images).&quot;</span>
).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
question = <span class="hljs-string">&quot;What&#x27;s his name?&quot;</span>
encoding = processor(image, question, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-built_in">print</span>(encoding.keys())
<span class="hljs-comment"># dict_keys([&#x27;input_ids&#x27;, &#x27;token_type_ids&#x27;, &#x27;attention_mask&#x27;, &#x27;bbox&#x27;, &#x27;image&#x27;])</span>`}}),ko=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExheW91dExNdjJQcm9jZXNzb3IlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBMYXlvdXRMTXYyUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZsYXlvdXRsbXYyLWJhc2UtdW5jYXNlZCUyMiUyQyUyMHJldmlzaW9uJTNEJTIybm9fb2NyJTIyKSUwQSUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbiglMEElMjAlMjAlMjAlMjAlMjJuYW1lX29mX3lvdXJfZG9jdW1lbnQlMjAtJTIwY2FuJTIwYmUlMjBhJTIwcG5nJTJDJTIwanBnJTJDJTIwZXRjLiUyMG9mJTIweW91ciUyMGRvY3VtZW50cyUyMChQREZzJTIwbXVzdCUyMGJlJTIwY29udmVydGVkJTIwdG8lMjBpbWFnZXMpLiUyMiUwQSkuY29udmVydCglMjJSR0IlMjIpJTBBcXVlc3Rpb24lMjAlM0QlMjAlMjJXaGF0J3MlMjBoaXMlMjBuYW1lJTNGJTIyJTBBd29yZHMlMjAlM0QlMjAlNUIlMjJoZWxsbyUyMiUyQyUyMCUyMndvcmxkJTIyJTVEJTBBYm94ZXMlMjAlM0QlMjAlNUIlNUIxJTJDJTIwMiUyQyUyMDMlMkMlMjA0JTVEJTJDJTIwJTVCNSUyQyUyMDYlMkMlMjA3JTJDJTIwOCU1RCU1RCUyMCUyMCUyMyUyMG1ha2UlMjBzdXJlJTIwdG8lMjBub3JtYWxpemUlMjB5b3VyJTIwYm91bmRpbmclMjBib3hlcyUwQWVuY29kaW5nJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlJTJDJTIwcXVlc3Rpb24lMkMlMjB3b3JkcyUyQyUyMGJveGVzJTNEYm94ZXMlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXByaW50KGVuY29kaW5nLmtleXMoKSklMEElMjMlMjBkaWN0X2tleXMoJTVCJ2lucHV0X2lkcyclMkMlMjAndG9rZW5fdHlwZV9pZHMnJTJDJTIwJ2F0dGVudGlvbl9tYXNrJyUyQyUyMCdiYm94JyUyQyUyMCdpbWFnZSclNUQp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LayoutLMv2Processor
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

processor = LayoutLMv2Processor.from_pretrained(<span class="hljs-string">&quot;microsoft/layoutlmv2-base-uncased&quot;</span>, revision=<span class="hljs-string">&quot;no_ocr&quot;</span>)

image = Image.<span class="hljs-built_in">open</span>(
    <span class="hljs-string">&quot;name_of_your_document - can be a png, jpg, etc. of your documents (PDFs must be converted to images).&quot;</span>
).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
question = <span class="hljs-string">&quot;What&#x27;s his name?&quot;</span>
words = [<span class="hljs-string">&quot;hello&quot;</span>, <span class="hljs-string">&quot;world&quot;</span>]
boxes = [[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>], [<span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>]]  <span class="hljs-comment"># make sure to normalize your bounding boxes</span>
encoding = processor(image, question, words, boxes=boxes, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-built_in">print</span>(encoding.keys())
<span class="hljs-comment"># dict_keys([&#x27;input_ids&#x27;, &#x27;token_type_ids&#x27;, &#x27;attention_mask&#x27;, &#x27;bbox&#x27;, &#x27;image&#x27;])</span>`}}),To=new Y({}),xo=new F({props:{name:"class transformers.LayoutLMv2Config",anchor:"transformers.LayoutLMv2Config",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:"max_2d_position_embeddings",val:" = 1024"},{name:"max_rel_pos",val:" = 128"},{name:"rel_pos_bins",val:" = 32"},{name:"fast_qkv",val:" = True"},{name:"max_rel_2d_pos",val:" = 256"},{name:"rel_2d_pos_bins",val:" = 64"},{name:"convert_sync_batchnorm",val:" = True"},{name:"image_feature_pool_shape",val:" = [7, 7, 256]"},{name:"coordinate_size",val:" = 128"},{name:"shape_size",val:" = 128"},{name:"has_relative_attention_bias",val:" = True"},{name:"has_spatial_attention_bias",val:" = True"},{name:"has_visual_segment_embedding",val:" = False"},{name:"detectron2_config_args",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMv2Config.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the LayoutLMv2 model. Defines the number of different tokens that can be represented by
the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Model">LayoutLMv2Model</a> or <code>TFLayoutLMv2Model</code>.`,name:"vocab_size"},{anchor:"transformers.LayoutLMv2Config.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimension of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.LayoutLMv2Config.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.LayoutLMv2Config.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.LayoutLMv2Config.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimension of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.LayoutLMv2Config.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;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.LayoutLMv2Config.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.LayoutLMv2Config.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.LayoutLMv2Config.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.LayoutLMv2Config.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 when calling <a href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Model">LayoutLMv2Model</a> or
<code>TFLayoutLMv2Model</code>.`,name:"type_vocab_size"},{anchor:"transformers.LayoutLMv2Config.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.LayoutLMv2Config.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.LayoutLMv2Config.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 be used with. Typically set this to something
large just in case (e.g., 1024).`,name:"max_2d_position_embeddings"},{anchor:"transformers.LayoutLMv2Config.max_rel_pos",description:`<strong>max_rel_pos</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The maximum number of relative positions to be used in the self-attention mechanism.`,name:"max_rel_pos"},{anchor:"transformers.LayoutLMv2Config.rel_pos_bins",description:`<strong>rel_pos_bins</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The number of relative position bins to be used in the self-attention mechanism.`,name:"rel_pos_bins"},{anchor:"transformers.LayoutLMv2Config.fast_qkv",description:`<strong>fast_qkv</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to use a single matrix for the queries, keys, values in the self-attention layers.`,name:"fast_qkv"},{anchor:"transformers.LayoutLMv2Config.max_rel_2d_pos",description:`<strong>max_rel_2d_pos</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
The maximum number of relative 2D positions in the self-attention mechanism.`,name:"max_rel_2d_pos"},{anchor:"transformers.LayoutLMv2Config.rel_2d_pos_bins",description:`<strong>rel_2d_pos_bins</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
The number of 2D relative position bins in the self-attention mechanism.`,name:"rel_2d_pos_bins"},{anchor:"transformers.LayoutLMv2Config.image_feature_pool_shape",description:`<strong>image_feature_pool_shape</strong> (<code>List[int]</code>, <em>optional</em>, defaults to [7, 7, 256]) &#x2014;
The shape of the average-pooled feature map.`,name:"image_feature_pool_shape"},{anchor:"transformers.LayoutLMv2Config.coordinate_size",description:`<strong>coordinate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Dimension of the coordinate embeddings.`,name:"coordinate_size"},{anchor:"transformers.LayoutLMv2Config.shape_size",description:`<strong>shape_size</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Dimension of the width and height embeddings.`,name:"shape_size"},{anchor:"transformers.LayoutLMv2Config.has_relative_attention_bias",description:`<strong>has_relative_attention_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to use a relative attention bias in the self-attention mechanism.`,name:"has_relative_attention_bias"},{anchor:"transformers.LayoutLMv2Config.has_spatial_attention_bias",description:`<strong>has_spatial_attention_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to use a spatial attention bias in the self-attention mechanism.`,name:"has_spatial_attention_bias"},{anchor:"transformers.LayoutLMv2Config.has_visual_segment_embedding",description:`<strong>has_visual_segment_embedding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add visual segment embeddings.`,name:"has_visual_segment_embedding"},{anchor:"transformers.LayoutLMv2Config.detectron2_config_args",description:`<strong>detectron2_config_args</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary containing the configuration arguments of the Detectron2 visual backbone. Refer to <a href="https://github.com/microsoft/unilm/blob/master/layoutlmft/layoutlmft/models/layoutlmv2/detectron2_config.py" rel="nofollow">this
file</a>
for details regarding default values.`,name:"detectron2_config_args"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/configuration_layoutlmv2.py#L34"}}),ot=new Ss({props:{anchor:"transformers.LayoutLMv2Config.example",$$slots:{default:[xb]},$$scope:{ctx:I}}}),Jo=new Y({}),Uo=new F({props:{name:"class transformers.LayoutLMv2FeatureExtractor",anchor:"transformers.LayoutLMv2FeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/feature_extraction_layoutlmv2.py#L28"}}),Eo=new F({props:{name:"__call__",anchor:"transformers.LayoutLMv2FeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_processing_utils.py#L516"}}),zo=new Y({}),Io=new F({props:{name:"class transformers.LayoutLMv2ImageProcessor",anchor:"transformers.LayoutLMv2ImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"apply_ocr",val:": bool = True"},{name:"ocr_lang",val:": typing.Optional[str] = None"},{name:"tesseract_config",val:": typing.Optional[str] = ''"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMv2ImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to <code>(size[&quot;height&quot;], size[&quot;width&quot;])</code>. Can be
overridden by <code>do_resize</code> in <code>preprocess</code>.`,name:"do_resize"},{anchor:"transformers.LayoutLMv2ImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;height&quot; -- 224, &quot;width&quot;: 224}</code>):
Size of the image after resizing. Can be overridden by <code>size</code> in <code>preprocess</code>.`,name:"size"},{anchor:"transformers.LayoutLMv2ImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by the <code>resample</code> parameter in the
<code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.LayoutLMv2ImageProcessor.apply_ocr",description:`<strong>apply_ocr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to apply the Tesseract OCR engine to get words + normalized bounding boxes. Can be overridden by
<code>apply_ocr</code> in <code>preprocess</code>.`,name:"apply_ocr"},{anchor:"transformers.LayoutLMv2ImageProcessor.ocr_lang",description:`<strong>ocr_lang</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The language, specified by its ISO code, to be used by the Tesseract OCR engine. By default, English is
used. Can be overridden by <code>ocr_lang</code> in <code>preprocess</code>.`,name:"ocr_lang"},{anchor:"transformers.LayoutLMv2ImageProcessor.tesseract_config",description:`<strong>tesseract_config</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Any additional custom configuration flags that are forwarded to the <code>config</code> parameter when calling
Tesseract. For example: &#x2018;&#x2014;psm 6&#x2019;. Can be overridden by <code>tesseract_config</code> in <code>preprocess</code>.`,name:"tesseract_config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/image_processing_layoutlmv2.py#L87"}}),Co=new F({props:{name:"preprocess",anchor:"transformers.LayoutLMv2ImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"do_resize",val:": bool = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = None"},{name:"apply_ocr",val:": bool = None"},{name:"ocr_lang",val:": typing.Optional[str] = None"},{name:"tesseract_config",val:": typing.Optional[str] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMv2ImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.LayoutLMv2ImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.LayoutLMv2ImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Desired size of the output image after resizing.`,name:"size"},{anchor:"transformers.LayoutLMv2ImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PIL.Image</code> resampling
filter. Only has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.LayoutLMv2ImageProcessor.preprocess.apply_ocr",description:`<strong>apply_ocr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.apply_ocr</code>) &#x2014;
Whether to apply the Tesseract OCR engine to get words + normalized bounding boxes.`,name:"apply_ocr"},{anchor:"transformers.LayoutLMv2ImageProcessor.preprocess.ocr_lang",description:`<strong>ocr_lang</strong> (<code>str</code>, <em>optional</em>, defaults to <code>self.ocr_lang</code>) &#x2014;
The language, specified by its ISO code, to be used by the Tesseract OCR engine. By default, English is
used.`,name:"ocr_lang"},{anchor:"transformers.LayoutLMv2ImageProcessor.preprocess.tesseract_config",description:`<strong>tesseract_config</strong> (<code>str</code>, <em>optional</em>, defaults to <code>self.tesseract_config</code>) &#x2014;
Any additional custom configuration flags that are forwarded to the <code>config</code> parameter when calling
Tesseract.`,name:"tesseract_config"},{anchor:"transformers.LayoutLMv2ImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.LayoutLMv2ImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/image_processing_layoutlmv2.py#L168"}}),$o=new Y({}),Fo=new F({props:{name:"class transformers.LayoutLMv2Tokenizer",anchor:"transformers.LayoutLMv2Tokenizer",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:"cls_token_box",val:" = [0, 0, 0, 0]"},{name:"sep_token_box",val:" = [1000, 1000, 1000, 1000]"},{name:"pad_token_box",val:" = [0, 0, 0, 0]"},{name:"pad_token_label",val:" = -100"},{name:"only_label_first_subword",val:" = True"},{name:"tokenize_chinese_chars",val:" = True"},{name:"strip_accents",val:" = None"},{name:"model_max_length",val:": int = 512"},{name:"additional_special_tokens",val:": typing.Optional[typing.List[str]] = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/tokenization_layoutlmv2.py#L206"}}),Wo=new F({props:{name:"__call__",anchor:"transformers.LayoutLMv2Tokenizer.__call__",parameters:[{name:"text",val:": typing.Union[str, typing.List[str], typing.List[typing.List[str]]]"},{name:"text_pair",val:": typing.Union[typing.List[str], typing.List[typing.List[str]], NoneType] = None"},{name:"boxes",val:": typing.Union[typing.List[typing.List[int]], typing.List[typing.List[typing.List[int]]]] = None"},{name:"word_labels",val:": typing.Union[typing.List[int], typing.List[typing.List[int]], NoneType] = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy] = False"},{name:"truncation",val:": typing.Union[bool, str, transformers.tokenization_utils_base.TruncationStrategy] = None"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"stride",val:": int = 0"},{name:"pad_to_multiple_of",val:": typing.Optional[int] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"return_token_type_ids",val:": typing.Optional[bool] = None"},{name:"return_attention_mask",val:": typing.Optional[bool] = None"},{name:"return_overflowing_tokens",val:": bool = False"},{name:"return_special_tokens_mask",val:": bool = False"},{name:"return_offsets_mapping",val:": bool = False"},{name:"return_length",val:": bool = False"},{name:"verbose",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMv2Tokenizer.__call__.text",description:`<strong>text</strong> (<code>str</code>, <code>List[str]</code>, <code>List[List[str]]</code>) &#x2014;
The sequence or batch of sequences to be encoded. Each sequence can be a string, a list of strings
(words of a single example or questions of a batch of examples) or a list of list of strings (batch of
words).`,name:"text"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.text_pair",description:`<strong>text_pair</strong> (<code>List[str]</code>, <code>List[List[str]]</code>) &#x2014;
The sequence or batch of sequences to be encoded. Each sequence should be a list of strings
(pretokenized string).`,name:"text_pair"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.boxes",description:`<strong>boxes</strong> (<code>List[List[int]]</code>, <code>List[List[List[int]]]</code>) &#x2014;
Word-level bounding boxes. Each bounding box should be normalized to be on a 0-1000 scale.`,name:"boxes"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.word_labels",description:`<strong>word_labels</strong> (<code>List[int]</code>, <code>List[List[int]]</code>, <em>optional</em>) &#x2014;
Word-level integer labels (for token classification tasks such as FUNSD, CORD).`,name:"word_labels"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.add_special_tokens",description:`<strong>add_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to encode the sequences with the special tokens relative to their model.`,name:"add_special_tokens"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.padding",description:`<strong>padding</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.utils.PaddingStrategy">PaddingStrategy</a>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates and controls padding. Accepts the following values:</p>
<ul>
<li><code>True</code> or <code>&apos;longest&apos;</code>: Pad to the longest sequence in the batch (or no padding if only a single
sequence if provided).</li>
<li><code>&apos;max_length&apos;</code>: Pad to a maximum length specified with the argument <code>max_length</code> or to the maximum
acceptable input length for the model if that argument is not provided.</li>
<li><code>False</code> or <code>&apos;do_not_pad&apos;</code> (default): No padding (i.e., can output a batch with sequences of different
lengths).</li>
</ul>`,name:"padding"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.truncation",description:`<strong>truncation</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.tokenization_utils_base.TruncationStrategy">TruncationStrategy</a>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates and controls truncation. Accepts the following values:</p>
<ul>
<li><code>True</code> or <code>&apos;longest_first&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or
to the maximum acceptable input length for the model if that argument is not provided. This will
truncate token by token, removing a token from the longest sequence in the pair if a pair of
sequences (or a batch of pairs) is provided.</li>
<li><code>&apos;only_first&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or to the
maximum acceptable input length for the model if that argument is not provided. This will only
truncate the first sequence of a pair if a pair of sequences (or a batch of pairs) is provided.</li>
<li><code>&apos;only_second&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or to the
maximum acceptable input length for the model if that argument is not provided. This will only
truncate the second sequence of a pair if a pair of sequences (or a batch of pairs) is provided.</li>
<li><code>False</code> or <code>&apos;do_not_truncate&apos;</code> (default): No truncation (i.e., can output batch with sequence lengths
greater than the model maximum admissible input size).</li>
</ul>`,name:"truncation"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Controls the maximum length to use by one of the truncation/padding parameters.</p>
<p>If left unset or set to <code>None</code>, this will use the predefined model maximum length if a maximum length
is required by one of the truncation/padding parameters. If the model has no specific maximum input
length (like XLNet) truncation/padding to a maximum length will be deactivated.`,name:"max_length"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.stride",description:`<strong>stride</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
If set to a number along with <code>max_length</code>, the overflowing tokens returned when
<code>return_overflowing_tokens=True</code> will contain some tokens from the end of the truncated sequence
returned to provide some overlap between truncated and overflowing sequences. The value of this
argument defines the number of overlapping tokens.`,name:"stride"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.pad_to_multiple_of",description:`<strong>pad_to_multiple_of</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If set will pad the sequence to a multiple of the provided value. This is especially useful to enable
the use of Tensor Cores on NVIDIA hardware with compute capability <code>&gt;= 7.5</code> (Volta).`,name:"pad_to_multiple_of"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of list of python integers. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return Numpy <code>np.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.return_token_type_ids",description:`<strong>return_token_type_ids</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return token type IDs. If left to the default, will return the token type IDs according to
the specific tokenizer&#x2019;s default, defined by the <code>return_outputs</code> attribute.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"return_token_type_ids"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.return_attention_mask",description:`<strong>return_attention_mask</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return the attention mask. If left to the default, will return the attention mask according
to the specific tokenizer&#x2019;s default, defined by the <code>return_outputs</code> attribute.</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"return_attention_mask"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.return_overflowing_tokens",description:`<strong>return_overflowing_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return overflowing token sequences. If a pair of sequences of input ids (or a batch
of pairs) is provided with <code>truncation_strategy = longest_first</code> or <code>True</code>, an error is raised instead
of returning overflowing tokens.`,name:"return_overflowing_tokens"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.return_special_tokens_mask",description:`<strong>return_special_tokens_mask</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return special tokens mask information.`,name:"return_special_tokens_mask"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.return_offsets_mapping",description:`<strong>return_offsets_mapping</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return <code>(char_start, char_end)</code> for each token.</p>
<p>This is only available on fast tokenizers inheriting from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a>, if using
Python&#x2019;s tokenizer, this method will raise <code>NotImplementedError</code>.`,name:"return_offsets_mapping"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.return_length",description:`<strong>return_length</strong>  (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return the lengths of the encoded inputs.`,name:"return_length"},{anchor:"transformers.LayoutLMv2Tokenizer.__call__.verbose",description:`<strong>verbose</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to print more information and warnings.
**kwargs &#x2014; passed to the <code>self.tokenize()</code> method`,name:"verbose"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/tokenization_layoutlmv2.py#L425",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a> with the following fields:</p>
<ul>
<li>
<p><strong>input_ids</strong> \u2014 List of token ids to be fed to a model.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
</li>
<li>
<p><strong>bbox</strong> \u2014 List of bounding boxes to be fed to a model.</p>
</li>
<li>
<p><strong>token_type_ids</strong> \u2014 List of token type ids to be fed to a model (when <code>return_token_type_ids=True</code> or
if <em>\u201Ctoken_type_ids\u201D</em> is in <code>self.model_input_names</code>).</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a></p>
</li>
<li>
<p><strong>attention_mask</strong> \u2014 List of indices specifying which tokens should be attended to by the model (when
<code>return_attention_mask=True</code> or if <em>\u201Cattention_mask\u201D</em> is in <code>self.model_input_names</code>).</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
</li>
<li>
<p><strong>labels</strong> \u2014 List of labels to be fed to a model. (when <code>word_labels</code> is specified).</p>
</li>
<li>
<p><strong>overflowing_tokens</strong> \u2014 List of overflowing tokens sequences (when a <code>max_length</code> is specified and
<code>return_overflowing_tokens=True</code>).</p>
</li>
<li>
<p><strong>num_truncated_tokens</strong> \u2014 Number of tokens truncated (when a <code>max_length</code> is specified and
<code>return_overflowing_tokens=True</code>).</p>
</li>
<li>
<p><strong>special_tokens_mask</strong> \u2014 List of 0s and 1s, with 1 specifying added special tokens and 0 specifying
regular sequence tokens (when <code>add_special_tokens=True</code> and <code>return_special_tokens_mask=True</code>).</p>
</li>
<li>
<p><strong>length</strong> \u2014 The length of the inputs (when <code>return_length=True</code>).</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),No=new F({props:{name:"save_vocabulary",anchor:"transformers.LayoutLMv2Tokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/tokenization_layoutlmv2.py#L405"}}),Ro=new Y({}),qo=new F({props:{name:"class transformers.LayoutLMv2TokenizerFast",anchor:"transformers.LayoutLMv2TokenizerFast",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:"cls_token_box",val:" = [0, 0, 0, 0]"},{name:"sep_token_box",val:" = [1000, 1000, 1000, 1000]"},{name:"pad_token_box",val:" = [0, 0, 0, 0]"},{name:"pad_token_label",val:" = -100"},{name:"only_label_first_subword",val:" = True"},{name:"tokenize_chinese_chars",val:" = True"},{name:"strip_accents",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMv2TokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
File containing the vocabulary.`,name:"vocab_file"},{anchor:"transformers.LayoutLMv2TokenizerFast.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.LayoutLMv2TokenizerFast.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.LayoutLMv2TokenizerFast.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.LayoutLMv2TokenizerFast.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.LayoutLMv2TokenizerFast.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.LayoutLMv2TokenizerFast.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.LayoutLMv2TokenizerFast.cls_token_box",description:`<strong>cls_token_box</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[0, 0, 0, 0]</code>) &#x2014;
The bounding box to use for the special [CLS] token.`,name:"cls_token_box"},{anchor:"transformers.LayoutLMv2TokenizerFast.sep_token_box",description:`<strong>sep_token_box</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[1000, 1000, 1000, 1000]</code>) &#x2014;
The bounding box to use for the special [SEP] token.`,name:"sep_token_box"},{anchor:"transformers.LayoutLMv2TokenizerFast.pad_token_box",description:`<strong>pad_token_box</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[0, 0, 0, 0]</code>) &#x2014;
The bounding box to use for the special [PAD] token.`,name:"pad_token_box"},{anchor:"transformers.LayoutLMv2TokenizerFast.pad_token_label",description:`<strong>pad_token_label</strong> (<code>int</code>, <em>optional</em>, defaults to -100) &#x2014;
The label to use for padding tokens. Defaults to -100, which is the <code>ignore_index</code> of PyTorch&#x2019;s
CrossEntropyLoss.`,name:"pad_token_label"},{anchor:"transformers.LayoutLMv2TokenizerFast.only_label_first_subword",description:`<strong>only_label_first_subword</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to only label the first subword, in case word labels are provided.`,name:"only_label_first_subword"},{anchor:"transformers.LayoutLMv2TokenizerFast.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.LayoutLMv2TokenizerFast.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 LayoutLMv2).`,name:"strip_accents"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/tokenization_layoutlmv2_fast.py#L70"}}),Go=new F({props:{name:"__call__",anchor:"transformers.LayoutLMv2TokenizerFast.__call__",parameters:[{name:"text",val:": typing.Union[str, typing.List[str], typing.List[typing.List[str]]]"},{name:"text_pair",val:": typing.Union[typing.List[str], typing.List[typing.List[str]], NoneType] = None"},{name:"boxes",val:": typing.Union[typing.List[typing.List[int]], typing.List[typing.List[typing.List[int]]]] = None"},{name:"word_labels",val:": typing.Union[typing.List[int], typing.List[typing.List[int]], NoneType] = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy] = False"},{name:"truncation",val:": typing.Union[bool, str, transformers.tokenization_utils_base.TruncationStrategy] = None"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"stride",val:": int = 0"},{name:"pad_to_multiple_of",val:": typing.Optional[int] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"return_token_type_ids",val:": typing.Optional[bool] = None"},{name:"return_attention_mask",val:": typing.Optional[bool] = None"},{name:"return_overflowing_tokens",val:": bool = False"},{name:"return_special_tokens_mask",val:": bool = False"},{name:"return_offsets_mapping",val:": bool = False"},{name:"return_length",val:": bool = False"},{name:"verbose",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.text",description:`<strong>text</strong> (<code>str</code>, <code>List[str]</code>, <code>List[List[str]]</code>) &#x2014;
The sequence or batch of sequences to be encoded. Each sequence can be a string, a list of strings
(words of a single example or questions of a batch of examples) or a list of list of strings (batch of
words).`,name:"text"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.text_pair",description:`<strong>text_pair</strong> (<code>List[str]</code>, <code>List[List[str]]</code>) &#x2014;
The sequence or batch of sequences to be encoded. Each sequence should be a list of strings
(pretokenized string).`,name:"text_pair"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.boxes",description:`<strong>boxes</strong> (<code>List[List[int]]</code>, <code>List[List[List[int]]]</code>) &#x2014;
Word-level bounding boxes. Each bounding box should be normalized to be on a 0-1000 scale.`,name:"boxes"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.word_labels",description:`<strong>word_labels</strong> (<code>List[int]</code>, <code>List[List[int]]</code>, <em>optional</em>) &#x2014;
Word-level integer labels (for token classification tasks such as FUNSD, CORD).`,name:"word_labels"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.add_special_tokens",description:`<strong>add_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to encode the sequences with the special tokens relative to their model.`,name:"add_special_tokens"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.padding",description:`<strong>padding</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.utils.PaddingStrategy">PaddingStrategy</a>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates and controls padding. Accepts the following values:</p>
<ul>
<li><code>True</code> or <code>&apos;longest&apos;</code>: Pad to the longest sequence in the batch (or no padding if only a single
sequence if provided).</li>
<li><code>&apos;max_length&apos;</code>: Pad to a maximum length specified with the argument <code>max_length</code> or to the maximum
acceptable input length for the model if that argument is not provided.</li>
<li><code>False</code> or <code>&apos;do_not_pad&apos;</code> (default): No padding (i.e., can output a batch with sequences of different
lengths).</li>
</ul>`,name:"padding"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.truncation",description:`<strong>truncation</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.tokenization_utils_base.TruncationStrategy">TruncationStrategy</a>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates and controls truncation. Accepts the following values:</p>
<ul>
<li><code>True</code> or <code>&apos;longest_first&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or
to the maximum acceptable input length for the model if that argument is not provided. This will
truncate token by token, removing a token from the longest sequence in the pair if a pair of
sequences (or a batch of pairs) is provided.</li>
<li><code>&apos;only_first&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or to the
maximum acceptable input length for the model if that argument is not provided. This will only
truncate the first sequence of a pair if a pair of sequences (or a batch of pairs) is provided.</li>
<li><code>&apos;only_second&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or to the
maximum acceptable input length for the model if that argument is not provided. This will only
truncate the second sequence of a pair if a pair of sequences (or a batch of pairs) is provided.</li>
<li><code>False</code> or <code>&apos;do_not_truncate&apos;</code> (default): No truncation (i.e., can output batch with sequence lengths
greater than the model maximum admissible input size).</li>
</ul>`,name:"truncation"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Controls the maximum length to use by one of the truncation/padding parameters.</p>
<p>If left unset or set to <code>None</code>, this will use the predefined model maximum length if a maximum length
is required by one of the truncation/padding parameters. If the model has no specific maximum input
length (like XLNet) truncation/padding to a maximum length will be deactivated.`,name:"max_length"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.stride",description:`<strong>stride</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
If set to a number along with <code>max_length</code>, the overflowing tokens returned when
<code>return_overflowing_tokens=True</code> will contain some tokens from the end of the truncated sequence
returned to provide some overlap between truncated and overflowing sequences. The value of this
argument defines the number of overlapping tokens.`,name:"stride"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.pad_to_multiple_of",description:`<strong>pad_to_multiple_of</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If set will pad the sequence to a multiple of the provided value. This is especially useful to enable
the use of Tensor Cores on NVIDIA hardware with compute capability <code>&gt;= 7.5</code> (Volta).`,name:"pad_to_multiple_of"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of list of python integers. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return Numpy <code>np.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.return_token_type_ids",description:`<strong>return_token_type_ids</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return token type IDs. If left to the default, will return the token type IDs according to
the specific tokenizer&#x2019;s default, defined by the <code>return_outputs</code> attribute.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"return_token_type_ids"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.return_attention_mask",description:`<strong>return_attention_mask</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return the attention mask. If left to the default, will return the attention mask according
to the specific tokenizer&#x2019;s default, defined by the <code>return_outputs</code> attribute.</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"return_attention_mask"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.return_overflowing_tokens",description:`<strong>return_overflowing_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return overflowing token sequences. If a pair of sequences of input ids (or a batch
of pairs) is provided with <code>truncation_strategy = longest_first</code> or <code>True</code>, an error is raised instead
of returning overflowing tokens.`,name:"return_overflowing_tokens"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.return_special_tokens_mask",description:`<strong>return_special_tokens_mask</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return special tokens mask information.`,name:"return_special_tokens_mask"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.return_offsets_mapping",description:`<strong>return_offsets_mapping</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return <code>(char_start, char_end)</code> for each token.</p>
<p>This is only available on fast tokenizers inheriting from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a>, if using
Python&#x2019;s tokenizer, this method will raise <code>NotImplementedError</code>.`,name:"return_offsets_mapping"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.return_length",description:`<strong>return_length</strong>  (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return the lengths of the encoded inputs.`,name:"return_length"},{anchor:"transformers.LayoutLMv2TokenizerFast.__call__.verbose",description:`<strong>verbose</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to print more information and warnings.
**kwargs &#x2014; passed to the <code>self.tokenize()</code> method`,name:"verbose"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/tokenization_layoutlmv2_fast.py#L179",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a> with the following fields:</p>
<ul>
<li>
<p><strong>input_ids</strong> \u2014 List of token ids to be fed to a model.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
</li>
<li>
<p><strong>bbox</strong> \u2014 List of bounding boxes to be fed to a model.</p>
</li>
<li>
<p><strong>token_type_ids</strong> \u2014 List of token type ids to be fed to a model (when <code>return_token_type_ids=True</code> or
if <em>\u201Ctoken_type_ids\u201D</em> is in <code>self.model_input_names</code>).</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a></p>
</li>
<li>
<p><strong>attention_mask</strong> \u2014 List of indices specifying which tokens should be attended to by the model (when
<code>return_attention_mask=True</code> or if <em>\u201Cattention_mask\u201D</em> is in <code>self.model_input_names</code>).</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
</li>
<li>
<p><strong>labels</strong> \u2014 List of labels to be fed to a model. (when <code>word_labels</code> is specified).</p>
</li>
<li>
<p><strong>overflowing_tokens</strong> \u2014 List of overflowing tokens sequences (when a <code>max_length</code> is specified and
<code>return_overflowing_tokens=True</code>).</p>
</li>
<li>
<p><strong>num_truncated_tokens</strong> \u2014 Number of tokens truncated (when a <code>max_length</code> is specified and
<code>return_overflowing_tokens=True</code>).</p>
</li>
<li>
<p><strong>special_tokens_mask</strong> \u2014 List of 0s and 1s, with 1 specifying added special tokens and 0 specifying
regular sequence tokens (when <code>add_special_tokens=True</code> and <code>return_special_tokens_mask=True</code>).</p>
</li>
<li>
<p><strong>length</strong> \u2014 The length of the inputs (when <code>return_length=True</code>).</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),Xo=new Y({}),Po=new F({props:{name:"class transformers.LayoutLMv2Processor",anchor:"transformers.LayoutLMv2Processor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMv2Processor.image_processor",description:`<strong>image_processor</strong> (<code>LayoutLMv2ImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor">LayoutLMv2ImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.LayoutLMv2Processor.tokenizer",description:`<strong>tokenizer</strong> (<code>LayoutLMv2Tokenizer</code> or <code>LayoutLMv2TokenizerFast</code>) &#x2014;
An instance of <a href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer">LayoutLMv2Tokenizer</a> or <a href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2TokenizerFast">LayoutLMv2TokenizerFast</a>. The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/processing_layoutlmv2.py#L27"}}),Vo=new F({props:{name:"__call__",anchor:"transformers.LayoutLMv2Processor.__call__",parameters:[{name:"images",val:""},{name:"text",val:": typing.Union[str, typing.List[str], typing.List[typing.List[str]]] = None"},{name:"text_pair",val:": typing.Union[typing.List[str], typing.List[typing.List[str]], NoneType] = None"},{name:"boxes",val:": typing.Union[typing.List[typing.List[int]], typing.List[typing.List[typing.List[int]]]] = None"},{name:"word_labels",val:": typing.Union[typing.List[int], typing.List[typing.List[int]], NoneType] = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy] = False"},{name:"truncation",val:": typing.Union[bool, str, transformers.tokenization_utils_base.TruncationStrategy] = False"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"stride",val:": int = 0"},{name:"pad_to_multiple_of",val:": typing.Optional[int] = None"},{name:"return_token_type_ids",val:": typing.Optional[bool] = None"},{name:"return_attention_mask",val:": typing.Optional[bool] = None"},{name:"return_overflowing_tokens",val:": bool = False"},{name:"return_special_tokens_mask",val:": bool = False"},{name:"return_offsets_mapping",val:": bool = False"},{name:"return_length",val:": bool = False"},{name:"verbose",val:": bool = True"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/processing_layoutlmv2.py#L68"}}),Qo=new Y({}),Yo=new F({props:{name:"class transformers.LayoutLMv2Model",anchor:"transformers.LayoutLMv2Model",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMv2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Config">LayoutLMv2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L713"}}),Ko=new F({props:{name:"forward",anchor:"transformers.LayoutLMv2Model.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"image",val:": typing.Optional[torch.FloatTensor] = 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:"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.LayoutLMv2Model.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.LayoutLMv2Model.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.`,name:"bbox"},{anchor:"transformers.LayoutLMv2Model.forward.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code> or <code>detectron.structures.ImageList</code> whose <code>tensors</code> is of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Batch of document images.`,name:"image"},{anchor:"transformers.LayoutLMv2Model.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>:</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.LayoutLMv2Model.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>:</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.LayoutLMv2Model.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.LayoutLMv2Model.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>:</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.LayoutLMv2Model.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.LayoutLMv2Model.forward.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.LayoutLMv2Model.forward.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.LayoutLMv2Model.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L823",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Config"
>LayoutLMv2Config</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>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/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ut=new Sl({props:{$$slots:{default:[jb]},$$scope:{ctx:I}}}),ht=new Ss({props:{anchor:"transformers.LayoutLMv2Model.forward.example",$$slots:{default:[Jb]},$$scope:{ctx:I}}}),en=new Y({}),tn=new F({props:{name:"class transformers.LayoutLMv2ForSequenceClassification",anchor:"transformers.LayoutLMv2ForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMv2ForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Config">LayoutLMv2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L974"}}),rn=new F({props:{name:"forward",anchor:"transformers.LayoutLMv2ForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"image",val:": typing.Optional[torch.FloatTensor] = 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.LayoutLMv2ForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>batch_size, sequence_length</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.LayoutLMv2ForSequenceClassification.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.`,name:"bbox"},{anchor:"transformers.LayoutLMv2ForSequenceClassification.forward.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code> or <code>detectron.structures.ImageList</code> whose <code>tensors</code> is of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Batch of document images.`,name:"image"},{anchor:"transformers.LayoutLMv2ForSequenceClassification.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>:</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.LayoutLMv2ForSequenceClassification.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>:</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.LayoutLMv2ForSequenceClassification.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.LayoutLMv2ForSequenceClassification.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>:</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.LayoutLMv2ForSequenceClassification.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.LayoutLMv2ForSequenceClassification.forward.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.LayoutLMv2ForSequenceClassification.forward.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.LayoutLMv2ForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LayoutLMv2ForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L988",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Config"
>LayoutLMv2Config</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/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),gt=new Sl({props:{$$slots:{default:[Ub]},$$scope:{ctx:I}}}),yt=new Ss({props:{anchor:"transformers.LayoutLMv2ForSequenceClassification.forward.example",$$slots:{default:[Eb]},$$scope:{ctx:I}}}),ln=new Y({}),cn=new F({props:{name:"class transformers.LayoutLMv2ForTokenClassification",anchor:"transformers.LayoutLMv2ForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LayoutLMv2ForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Config">LayoutLMv2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L1156"}}),gn=new F({props:{name:"forward",anchor:"transformers.LayoutLMv2ForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"image",val:": typing.Optional[torch.FloatTensor] = 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.LayoutLMv2ForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>batch_size, sequence_length</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.LayoutLMv2ForTokenClassification.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.`,name:"bbox"},{anchor:"transformers.LayoutLMv2ForTokenClassification.forward.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code> or <code>detectron.structures.ImageList</code> whose <code>tensors</code> is of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Batch of document images.`,name:"image"},{anchor:"transformers.LayoutLMv2ForTokenClassification.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>:</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.LayoutLMv2ForTokenClassification.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>:</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.LayoutLMv2ForTokenClassification.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.LayoutLMv2ForTokenClassification.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>:</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.LayoutLMv2ForTokenClassification.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.LayoutLMv2ForTokenClassification.forward.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.LayoutLMv2ForTokenClassification.forward.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.LayoutLMv2ForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LayoutLMv2ForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L1170",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Config"
>LayoutLMv2Config</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/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),vt=new Sl({props:{$$slots:{default:[zb]},$$scope:{ctx:I}}}),bt=new Ss({props:{anchor:"transformers.LayoutLMv2ForTokenClassification.forward.example",$$slots:{default:[Ib]},$$scope:{ctx:I}}}),yn=new Y({}),_n=new F({props:{name:"class transformers.LayoutLMv2ForQuestionAnswering",anchor:"transformers.LayoutLMv2ForQuestionAnswering",parameters:[{name:"config",val:""},{name:"has_visual_segment_embedding",val:" = True"}],parametersDescription:[{anchor:"transformers.LayoutLMv2ForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Config">LayoutLMv2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L1287"}}),wn=new F({props:{name:"forward",anchor:"transformers.LayoutLMv2ForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"bbox",val:": typing.Optional[torch.LongTensor] = None"},{name:"image",val:": typing.Optional[torch.FloatTensor] = 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"}],parametersDescription:[{anchor:"transformers.LayoutLMv2ForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>batch_size, sequence_length</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.LayoutLMv2ForQuestionAnswering.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.`,name:"bbox"},{anchor:"transformers.LayoutLMv2ForQuestionAnswering.forward.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code> or <code>detectron.structures.ImageList</code> whose <code>tensors</code> is of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Batch of document images.`,name:"image"},{anchor:"transformers.LayoutLMv2ForQuestionAnswering.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>:</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.LayoutLMv2ForQuestionAnswering.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>:</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.LayoutLMv2ForQuestionAnswering.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.LayoutLMv2ForQuestionAnswering.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>:</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.LayoutLMv2ForQuestionAnswering.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.LayoutLMv2ForQuestionAnswering.forward.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.LayoutLMv2ForQuestionAnswering.forward.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.LayoutLMv2ForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LayoutLMv2ForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</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.LayoutLMv2ForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L1301",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Config"
>LayoutLMv2Config</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/main/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),wt=new Sl({props:{$$slots:{default:[Cb]},$$scope:{ctx:I}}}),Lt=new Ss({props:{anchor:"transformers.LayoutLMv2ForQuestionAnswering.forward.example",$$slots:{default:[$b]},$$scope:{ctx:I}}}),kt=new Ss({props:{anchor:"transformers.LayoutLMv2ForQuestionAnswering.forward.example-2",$$slots:{default:[Fb]},$$scope:{ctx:I}}}),{c(){h=a("meta"),k=d(),f=a("h1"),w=a("a"),T=a("span"),g(u.$$.fragment),L=d(),N=a("span"),Dl=n("LayoutLMV2"),Or=d(),je=a("h2"),Qe=a("a"),Qs=a("span"),g(Ft.$$.fragment),Ql=d(),Ys=a("span"),Yl=n("Overview"),Hr=d(),ue=a("p"),Ol=n("The LayoutLMV2 model was proposed in "),Zt=a("a"),Hl=n("LayoutLMv2: Multi-modal Pre-training for Visually-Rich Document Understanding"),Kl=n(` by Yang Xu, Yiheng Xu, Tengchao Lv, Lei Cui, Furu Wei, Guoxin Wang, Yijuan Lu,
Dinei Florencio, Cha Zhang, Wanxiang Che, Min Zhang, Lidong Zhou. LayoutLMV2 improves `),Tn=a("a"),ec=n("LayoutLM"),tc=n(` to obtain
state-of-the-art results across several document image understanding benchmarks:`),Kr=d(),he=a("ul"),O=a("li"),oc=n("information extraction from scanned documents: the "),Wt=a("a"),nc=n("FUNSD"),sc=n(` dataset (a
collection of 199 annotated forms comprising more than 30,000 words), the `),Nt=a("a"),ac=n("CORD"),rc=n(`
dataset (a collection of 800 receipts for training, 100 for validation and 100 for testing), the `),Rt=a("a"),ic=n("SROIE"),lc=n(` dataset (a collection of 626 receipts for training and 347 receipts for testing)
and the `),qt=a("a"),cc=n("Kleister-NDA"),dc=n(` dataset (a collection of non-disclosure
agreements from the EDGAR database, including 254 documents for training, 83 documents for validation, and 203
documents for testing).`),pc=d(),Bt=a("li"),mc=n("document image classification: the "),At=a("a"),uc=n("RVL-CDIP"),hc=n(` dataset (a collection of
400,000 images belonging to one of 16 classes).`),fc=d(),Gt=a("li"),gc=n("document visual question answering: the "),Xt=a("a"),yc=n("DocVQA"),_c=n(` dataset (a collection of 50,000
questions defined on 12,000+ document images).`),ei=d(),xn=a("p"),vc=n("The abstract from the paper is the following:"),ti=d(),jn=a("p"),Os=a("em"),bc=n(`Pre-training of text and layout has proved effective in a variety of visually-rich document understanding tasks due to
its effective model architecture and the advantage of large-scale unlabeled scanned/digital-born documents. In this
paper, we present LayoutLMv2 by pre-training text, layout and image in a multi-modal framework, where new model
architectures and pre-training tasks are leveraged. Specifically, LayoutLMv2 not only uses the existing masked
visual-language modeling task but also the new text-image alignment and text-image matching tasks in the pre-training
stage, where cross-modality interaction is better learned. Meanwhile, it also integrates a spatial-aware self-attention
mechanism into the Transformer architecture, so that the model can fully understand the relative positional
relationship among different text blocks. Experiment results show that LayoutLMv2 outperforms strong baselines and
achieves new state-of-the-art results on a wide variety of downstream visually-rich document understanding tasks,
including FUNSD (0.7895 -> 0.8420), CORD (0.9493 -> 0.9601), SROIE (0.9524 -> 0.9781), Kleister-NDA (0.834 -> 0.852),
RVL-CDIP (0.9443 -> 0.9564), and DocVQA (0.7295 -> 0.8672). The pre-trained LayoutLMv2 model is publicly available at
this https URL.`),oi=d(),se=a("p"),Mc=n("LayoutLMv2 depends on "),Hs=a("code"),wc=n("detectron2"),Lc=n(", "),Ks=a("code"),kc=n("torchvision"),Tc=n(" and "),ea=a("code"),xc=n("tesseract"),jc=n(`. Run the
following to install them:`),ni=d(),g(Pt.$$.fragment),si=d(),Jn=a("p"),Jc=n("(If you are developing for LayoutLMv2, note that passing the doctests also requires the installation of these packages.)"),ai=d(),Un=a("p"),Uc=n("Tips:"),ri=d(),P=a("ul"),ta=a("li"),Ec=n(`The main difference between LayoutLMv1 and LayoutLMv2 is that the latter incorporates visual embeddings during
pre-training (while LayoutLMv1 only adds visual embeddings during fine-tuning).`),zc=d(),Vt=a("li"),Ic=n(`LayoutLMv2 adds both a relative 1D attention bias as well as a spatial 2D attention bias to the attention scores in
the self-attention layers. Details can be found on page 5 of the `),St=a("a"),Cc=n("paper"),$c=n("."),Fc=d(),Dt=a("li"),Zc=n("Demo notebooks on how to use the LayoutLMv2 model on RVL-CDIP, FUNSD, DocVQA, CORD can be found "),Qt=a("a"),Wc=n("here"),Nc=n("."),Rc=d(),Je=a("li"),qc=n("LayoutLMv2 uses Facebook AI\u2019s "),Yt=a("a"),Bc=n("Detectron2"),Ac=n(` package for its visual
backbone. See `),Ot=a("a"),Gc=n("this link"),Xc=n(` for installation
instructions.`),Pc=d(),x=a("li"),Vc=n("In addition to "),oa=a("code"),Sc=n("input_ids"),Dc=n(", "),En=a("a"),Qc=n("forward()"),Yc=n(` expects 2 additional inputs, namely
`),na=a("code"),Oc=n("image"),Hc=n(" and "),sa=a("code"),Kc=n("bbox"),ed=n(". The "),aa=a("code"),td=n("image"),od=n(` input corresponds to the original document image in which the text
tokens occur. The model expects each document image to be of size 224x224. This means that if you have a batch of
document images, `),ra=a("code"),nd=n("image"),sd=n(` should be a tensor of shape (batch_size, 3, 224, 224). This can be either a
`),ia=a("code"),ad=n("torch.Tensor"),rd=n(" or a "),la=a("code"),id=n("Detectron2.structures.ImageList"),ld=n(`. You don\u2019t need to normalize the channels, as this is
done by the model. Important to note is that the visual backbone expects BGR channels instead of RGB, as all models
in Detectron2 are pre-trained using the BGR format. The `),ca=a("code"),cd=n("bbox"),dd=n(` input are the bounding boxes (i.e. 2D-positions)
of the input text tokens. This is identical to `),zn=a("a"),pd=n("LayoutLMModel"),md=n(`. These can be obtained using an
external OCR engine such as Google\u2019s `),Ht=a("a"),ud=n("Tesseract"),hd=n(" (there\u2019s a "),Kt=a("a"),fd=n(`Python
wrapper`),gd=n(` 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:`),ii=d(),g(eo.$$.fragment),li=d(),fe=a("p"),yd=n("Here, "),da=a("code"),_d=n("width"),vd=n(" and "),pa=a("code"),bd=n("height"),Md=n(` correspond to the width and height of the original document in which the token
occurs (before resizing the image). Those can be obtained using the Python Image Library (PIL) library for example, as
follows:`),ci=d(),g(to.$$.fragment),di=d(),Ye=a("p"),wd=n("However, this model includes a brand new "),In=a("a"),Ld=n("LayoutLMv2Processor"),kd=n(` which can be used to directly
prepare data for the model (including applying OCR under the hood). More information can be found in the \u201CUsage\u201D
section below.`),pi=d(),ge=a("ul"),Z=a("li"),Td=n("Internally, "),Cn=a("a"),xd=n("LayoutLMv2Model"),jd=n(" will send the "),ma=a("code"),Jd=n("image"),Ud=n(` input through its visual backbone to
obtain a lower-resolution feature map, whose shape is equal to the `),ua=a("code"),Ed=n("image_feature_pool_shape"),zd=n(` attribute of
`),$n=a("a"),Id=n("LayoutLMv2Config"),Cd=n(`. This feature map is then flattened to obtain a sequence of image tokens. As
the size of the feature map is 7x7 by default, one obtains 49 image tokens. These are then concatenated with the text
tokens, and send through the Transformer encoder. This means that the last hidden states of the model will have a
length of 512 + 49 = 561, if you pad the text tokens up to the max length. More generally, the last hidden states
will have a shape of `),ha=a("code"),$d=n("seq_length"),Fd=n(" + "),fa=a("code"),Zd=n("image_feature_pool_shape[0]"),Wd=n(` *
`),ga=a("code"),Nd=n("config.image_feature_pool_shape[1]"),Rd=n("."),qd=d(),oo=a("li"),Bd=n("When calling "),Fn=a("a"),Ad=n("from_pretrained()"),Gd=n(`, a warning will be printed with a long list of
parameter names that are not initialized. This is not a problem, as these parameters are batch normalization
statistics, which are going to have values when fine-tuning on a custom dataset.`),Xd=d(),no=a("li"),Pd=n("If you want to train the model in a distributed environment, make sure to call "),ya=a("code"),Vd=n("synchronize_batch_norm"),Sd=n(` on the
model in order to properly synchronize the batch normalization layers of the visual backbone.`),mi=d(),Oe=a("p"),Dd=n(`In addition, there\u2019s LayoutXLM, which is a multilingual version of LayoutLMv2. More information can be found on
`),Zn=a("a"),Qd=n("LayoutXLM\u2019s documentation page"),Yd=n("."),ui=d(),Ue=a("h2"),He=a("a"),_a=a("span"),g(so.$$.fragment),Od=d(),va=a("span"),Hd=n("Resources"),hi=d(),Wn=a("p"),Kd=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with LayoutLMv2. 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."),fi=d(),g(ao.$$.fragment),gi=d(),Ke=a("ul"),ro=a("li"),ep=n("A notebook on how to "),io=a("a"),tp=n("finetune LayoutLMv2 for text-classification on RVL-CDIP dataset"),op=n("."),np=d(),Nn=a("li"),sp=n("See also: "),Rn=a("a"),ap=n("Text classification task guide"),yi=d(),g(lo.$$.fragment),_i=d(),ye=a("ul"),co=a("li"),rp=n("A notebook on how to "),po=a("a"),ip=n("finetune LayoutLMv2 for question-answering on DocVQA dataset"),lp=n("."),cp=d(),qn=a("li"),dp=n("See also: "),Bn=a("a"),pp=n("Question answering task guide"),mp=d(),An=a("li"),up=n("See also: "),Gn=a("a"),hp=n("Document question answering task guide"),vi=d(),g(mo.$$.fragment),bi=d(),_e=a("ul"),uo=a("li"),fp=n("A notebook on how to "),ho=a("a"),gp=n("finetune LayoutLMv2 for token-classification on CORD dataset"),yp=n("."),_p=d(),fo=a("li"),vp=n("A notebook on how to "),go=a("a"),bp=n("finetune LayoutLMv2 for token-classification on FUNSD dataset"),Mp=n("."),wp=d(),Xn=a("li"),Lp=n("See also: "),Pn=a("a"),kp=n("Token classification task guide"),Mi=d(),Ee=a("h2"),et=a("a"),ba=a("span"),g(yo.$$.fragment),Tp=d(),Ma=a("span"),xp=n("Usage: LayoutLMv2Processor"),wi=d(),V=a("p"),jp=n("The easiest way to prepare data for the model is to use "),Vn=a("a"),Jp=n("LayoutLMv2Processor"),Up=n(`, which internally
combines a image processor (`),Sn=a("a"),Ep=n("LayoutLMv2ImageProcessor"),zp=n(`) and a tokenizer
(`),Dn=a("a"),Ip=n("LayoutLMv2Tokenizer"),Cp=n(" or "),Qn=a("a"),$p=n("LayoutLMv2TokenizerFast"),Fp=n(`). The image processor
handles the image modality, while the tokenizer handles the text modality. A processor combines both, which is ideal
for a multi-modal model like LayoutLMv2. Note that you can still use both separately, if you only want to handle one
modality.`),Li=d(),g(_o.$$.fragment),ki=d(),J=a("p"),Zp=n("In short, one can provide a document image (and possibly additional data) to "),Yn=a("a"),Wp=n("LayoutLMv2Processor"),Np=n(`,
and it will create the inputs expected by the model. Internally, the processor first uses
`),On=a("a"),Rp=n("LayoutLMv2ImageProcessor"),qp=n(` to apply OCR on the image to get a list of words and normalized
bounding boxes, as well to resize the image to a given size in order to get the `),wa=a("code"),Bp=n("image"),Ap=n(` input. The words and
normalized bounding boxes are then provided to `),Hn=a("a"),Gp=n("LayoutLMv2Tokenizer"),Xp=n(` or
`),Kn=a("a"),Pp=n("LayoutLMv2TokenizerFast"),Vp=n(", which converts them to token-level "),La=a("code"),Sp=n("input_ids"),Dp=n(`,
`),ka=a("code"),Qp=n("attention_mask"),Yp=n(", "),Ta=a("code"),Op=n("token_type_ids"),Hp=n(", "),xa=a("code"),Kp=n("bbox"),em=n(`. Optionally, one can provide word labels to the processor,
which are turned into token-level `),ja=a("code"),tm=n("labels"),om=n("."),Ti=d(),A=a("p"),es=a("a"),nm=n("LayoutLMv2Processor"),sm=n(" uses "),vo=a("a"),am=n("PyTesseract"),rm=n(`, a Python
wrapper around Google\u2019s Tesseract OCR engine, under the hood. Note that you can still use your own OCR engine of
choice, and provide the words and normalized boxes yourself. This requires initializing
`),ts=a("a"),im=n("LayoutLMv2ImageProcessor"),lm=n(" with "),Ja=a("code"),cm=n("apply_ocr"),dm=n(" set to "),Ua=a("code"),pm=n("False"),mm=n("."),xi=d(),os=a("p"),um=n(`In total, there are 5 use cases that are supported by the processor. Below, we list them all. Note that each of these
use cases work for both batched and non-batched inputs (we illustrate them for non-batched inputs).`),ji=d(),ns=a("p"),Ea=a("strong"),hm=n(`Use case 1: document image classification (training, inference) + token classification (inference), apply_ocr =
True`),Ji=d(),ss=a("p"),fm=n(`This is the simplest case, in which the processor (actually the image processor) will perform OCR on the image to get
the words and normalized bounding boxes.`),Ui=d(),g(bo.$$.fragment),Ei=d(),as=a("p"),za=a("strong"),gm=n("Use case 2: document image classification (training, inference) + token classification (inference), apply_ocr=False"),zi=d(),ve=a("p"),ym=n("In case one wants to do OCR themselves, one can initialize the image processor with "),Ia=a("code"),_m=n("apply_ocr"),vm=n(` set to
`),Ca=a("code"),bm=n("False"),Mm=n(`. In that case, one should provide the words and corresponding (normalized) bounding boxes themselves to
the processor.`),Ii=d(),g(Mo.$$.fragment),Ci=d(),rs=a("p"),$a=a("strong"),wm=n("Use case 3: token classification (training), apply_ocr=False"),$i=d(),S=a("p"),Lm=n(`For token classification tasks (such as FUNSD, CORD, SROIE, Kleister-NDA), one can also provide the corresponding word
labels in order to train a model. The processor will then convert these into token-level `),Fa=a("code"),km=n("labels"),Tm=n(`. By default, it
will only label the first wordpiece of a word, and label the remaining wordpieces with -100, which is the
`),Za=a("code"),xm=n("ignore_index"),jm=n(` of PyTorch\u2019s CrossEntropyLoss. In case you want all wordpieces of a word to be labeled, you can
initialize the tokenizer with `),Wa=a("code"),Jm=n("only_label_first_subword"),Um=n(" set to "),Na=a("code"),Em=n("False"),zm=n("."),Fi=d(),g(wo.$$.fragment),Zi=d(),is=a("p"),Ra=a("strong"),Im=n("Use case 4: visual question answering (inference), apply_ocr=True"),Wi=d(),ls=a("p"),Cm=n(`For visual question answering tasks (such as DocVQA), you can provide a question to the processor. By default, the
processor will apply OCR on the image, and create [CLS] question tokens [SEP] word tokens [SEP].`),Ni=d(),g(Lo.$$.fragment),Ri=d(),cs=a("p"),qa=a("strong"),$m=n("Use case 5: visual question answering (inference), apply_ocr=False"),qi=d(),ds=a("p"),Fm=n(`For visual question answering tasks (such as DocVQA), you can provide a question to the processor. If you want to
perform OCR yourself, you can provide your own words and (normalized) bounding boxes to the processor.`),Bi=d(),g(ko.$$.fragment),Ai=d(),ze=a("h2"),tt=a("a"),Ba=a("span"),g(To.$$.fragment),Zm=d(),Aa=a("span"),Wm=n("LayoutLMv2Config"),Gi=d(),H=a("div"),g(xo.$$.fragment),Nm=d(),Ie=a("p"),Rm=n("This is the configuration class to store the configuration of a "),ps=a("a"),qm=n("LayoutLMv2Model"),Bm=n(`. It is used to instantiate an
LayoutLMv2 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 LayoutLMv2
`),jo=a("a"),Am=n("microsoft/layoutlmv2-base-uncased"),Gm=n(" architecture."),Xm=d(),Ce=a("p"),Pm=n("Configuration objects inherit from "),ms=a("a"),Vm=n("PretrainedConfig"),Sm=n(` and can be used to control the model outputs. Read the
documentation from `),us=a("a"),Dm=n("PretrainedConfig"),Qm=n(" for more information."),Ym=d(),g(ot.$$.fragment),Xi=d(),$e=a("h2"),nt=a("a"),Ga=a("span"),g(Jo.$$.fragment),Om=d(),Xa=a("span"),Hm=n("LayoutLMv2FeatureExtractor"),Pi=d(),Fe=a("div"),g(Uo.$$.fragment),Km=d(),st=a("div"),g(Eo.$$.fragment),eu=d(),Pa=a("p"),tu=n("Preprocess an image or a batch of images."),Vi=d(),Ze=a("h2"),at=a("a"),Va=a("span"),g(zo.$$.fragment),ou=d(),Sa=a("span"),nu=n("LayoutLMv2ImageProcessor"),Si=d(),ce=a("div"),g(Io.$$.fragment),su=d(),Da=a("p"),au=n("Constructs a LayoutLMv2 image processor."),ru=d(),rt=a("div"),g(Co.$$.fragment),iu=d(),Qa=a("p"),lu=n("Preprocess an image or batch of images."),Di=d(),We=a("h2"),it=a("a"),Ya=a("span"),g($o.$$.fragment),cu=d(),Oa=a("span"),du=n("LayoutLMv2Tokenizer"),Qi=d(),R=a("div"),g(Fo.$$.fragment),pu=d(),q=a("p"),mu=n("Construct a LayoutLMv2 tokenizer. Based on WordPiece. "),hs=a("a"),uu=n("LayoutLMv2Tokenizer"),hu=n(` can be used to turn words, word-level
bounding boxes and optional word labels to token-level `),Ha=a("code"),fu=n("input_ids"),gu=n(", "),Ka=a("code"),yu=n("attention_mask"),_u=n(", "),er=a("code"),vu=n("token_type_ids"),bu=n(", "),tr=a("code"),Mu=n("bbox"),wu=n(`, and
optional `),or=a("code"),Lu=n("labels"),ku=n(" (for token classification)."),Tu=d(),Zo=a("p"),xu=n("This tokenizer inherits from "),fs=a("a"),ju=n("PreTrainedTokenizer"),Ju=n(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Uu=d(),gs=a("p"),ys=a("a"),Eu=n("LayoutLMv2Tokenizer"),zu=n(` runs end-to-end tokenization: punctuation splitting and wordpiece. It also turns the
word-level bounding boxes into token-level bounding boxes.`),Iu=d(),lt=a("div"),g(Wo.$$.fragment),Cu=d(),nr=a("p"),$u=n(`Main method to tokenize and prepare for the model one or several sequence(s) or one or several pair(s) of
sequences with word-level normalized bounding boxes and optional labels.`),Fu=d(),_s=a("div"),g(No.$$.fragment),Yi=d(),Ne=a("h2"),ct=a("a"),sr=a("span"),g(Ro.$$.fragment),Zu=d(),ar=a("span"),Wu=n("LayoutLMv2TokenizerFast"),Oi=d(),K=a("div"),g(qo.$$.fragment),Nu=d(),Bo=a("p"),Ru=n("Construct a \u201Cfast\u201D LayoutLMv2 tokenizer (backed by HuggingFace\u2019s "),rr=a("em"),qu=n("tokenizers"),Bu=n(" library). Based on WordPiece."),Au=d(),Ao=a("p"),Gu=n("This tokenizer inherits from "),vs=a("a"),Xu=n("PreTrainedTokenizerFast"),Pu=n(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Vu=d(),dt=a("div"),g(Go.$$.fragment),Su=d(),ir=a("p"),Du=n(`Main method to tokenize and prepare for the model one or several sequence(s) or one or several pair(s) of
sequences with word-level normalized bounding boxes and optional labels.`),Hi=d(),Re=a("h2"),pt=a("a"),lr=a("span"),g(Xo.$$.fragment),Qu=d(),cr=a("span"),Yu=n("LayoutLMv2Processor"),Ki=d(),G=a("div"),g(Po.$$.fragment),Ou=d(),dr=a("p"),Hu=n(`Constructs a LayoutLMv2 processor which combines a LayoutLMv2 image processor and a LayoutLMv2 tokenizer into a
single processor.`),Ku=d(),bs=a("p"),Ms=a("a"),eh=n("LayoutLMv2Processor"),th=n(" offers all the functionalities you need to prepare data for the model."),oh=d(),z=a("p"),nh=n("It first uses "),ws=a("a"),sh=n("LayoutLMv2ImageProcessor"),ah=n(` to resize document images to a fixed size, and optionally applies OCR to
get words and normalized bounding boxes. These are then provided to `),Ls=a("a"),rh=n("LayoutLMv2Tokenizer"),ih=n(` or
`),ks=a("a"),lh=n("LayoutLMv2TokenizerFast"),ch=n(", which turns the words and bounding boxes into token-level "),pr=a("code"),dh=n("input_ids"),ph=n(`,
`),mr=a("code"),mh=n("attention_mask"),uh=n(", "),ur=a("code"),hh=n("token_type_ids"),fh=n(", "),hr=a("code"),gh=n("bbox"),yh=n(". Optionally, one can provide integer "),fr=a("code"),_h=n("word_labels"),vh=n(`, which are turned
into token-level `),gr=a("code"),bh=n("labels"),Mh=n(" for token classification tasks (such as FUNSD, CORD)."),wh=d(),be=a("div"),g(Vo.$$.fragment),Lh=d(),j=a("p"),kh=n("This method first forwards the "),yr=a("code"),Th=n("images"),xh=n(" argument to "),So=a("a"),_r=a("strong"),jh=n("call"),Jh=n("()"),Uh=n(`. In case
`),Ts=a("a"),Eh=n("LayoutLMv2ImageProcessor"),zh=n(" was initialized with "),vr=a("code"),Ih=n("apply_ocr"),Ch=n(" set to "),br=a("code"),$h=n("True"),Fh=n(`, it passes the obtained words and
bounding boxes along with the additional arguments to `),Do=a("a"),Mr=a("strong"),Zh=n("call"),Wh=n("()"),Nh=n(` and returns the output,
together with resized `),wr=a("code"),Rh=n("images"),qh=n(". In case "),xs=a("a"),Bh=n("LayoutLMv2ImageProcessor"),Ah=n(" was initialized with "),Lr=a("code"),Gh=n("apply_ocr"),Xh=n(` set to
`),kr=a("code"),Ph=n("False"),Vh=n(", it passes the words ("),Tr=a("code"),Sh=n("text"),Dh=n("/"),xr=a("code"),Qh=n("text_pair`) and `boxes` specified by the user along with the additional arguments to [__call__()](/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer.__call__) and returns the output, together with resized `images"),Yh=n("."),Oh=d(),jr=a("p"),Hh=n("Please refer to the docstring of the above two methods for more information."),el=d(),qe=a("h2"),mt=a("a"),Jr=a("span"),g(Qo.$$.fragment),Kh=d(),Ur=a("span"),ef=n("LayoutLMv2Model"),tl=d(),de=a("div"),g(Yo.$$.fragment),tf=d(),Oo=a("p"),of=n(`The bare LayoutLMv2 Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ho=a("a"),nf=n("torch.nn.Module"),sf=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),af=d(),ae=a("div"),g(Ko.$$.fragment),rf=d(),Be=a("p"),lf=n("The "),js=a("a"),cf=n("LayoutLMv2Model"),df=n(" forward method, overrides the "),Er=a("code"),pf=n("__call__"),mf=n(" special method."),uf=d(),g(ut.$$.fragment),hf=d(),g(ht.$$.fragment),ol=d(),Ae=a("h2"),ft=a("a"),zr=a("span"),g(en.$$.fragment),ff=d(),Ir=a("span"),gf=n("LayoutLMv2ForSequenceClassification"),nl=d(),ee=a("div"),g(tn.$$.fragment),yf=d(),on=a("p"),_f=n(`LayoutLMv2 Model with a sequence classification head on top (a linear layer on top of the concatenation of the
final hidden state of the [CLS] token, average-pooled initial visual embeddings and average-pooled final visual
embeddings, e.g. for document image classification tasks such as the
`),nn=a("a"),vf=n("RVL-CDIP"),bf=n(" dataset."),Mf=d(),sn=a("p"),wf=n("This model is a PyTorch "),an=a("a"),Lf=n("torch.nn.Module"),kf=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Tf=d(),re=a("div"),g(rn.$$.fragment),xf=d(),Ge=a("p"),jf=n("The "),Js=a("a"),Jf=n("LayoutLMv2ForSequenceClassification"),Uf=n(" forward method, overrides the "),Cr=a("code"),Ef=n("__call__"),zf=n(" special method."),If=d(),g(gt.$$.fragment),Cf=d(),g(yt.$$.fragment),sl=d(),Xe=a("h2"),_t=a("a"),$r=a("span"),g(ln.$$.fragment),$f=d(),Fr=a("span"),Ff=n("LayoutLMv2ForTokenClassification"),al=d(),te=a("div"),g(cn.$$.fragment),Zf=d(),oe=a("p"),Wf=n(`LayoutLMv2 Model with a token classification head on top (a linear layer on top of the text part of the hidden
states) e.g. for sequence labeling (information extraction) tasks such as
`),dn=a("a"),Nf=n("FUNSD"),Rf=n(", "),pn=a("a"),qf=n("SROIE"),Bf=n(`,
`),mn=a("a"),Af=n("CORD"),Gf=n(" and "),un=a("a"),Xf=n("Kleister-NDA"),Pf=n("."),Vf=d(),hn=a("p"),Sf=n("This model is a PyTorch "),fn=a("a"),Df=n("torch.nn.Module"),Qf=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Yf=d(),ie=a("div"),g(gn.$$.fragment),Of=d(),Pe=a("p"),Hf=n("The "),Us=a("a"),Kf=n("LayoutLMv2ForTokenClassification"),eg=n(" forward method, overrides the "),Zr=a("code"),tg=n("__call__"),og=n(" special method."),ng=d(),g(vt.$$.fragment),sg=d(),g(bt.$$.fragment),rl=d(),Ve=a("h2"),Mt=a("a"),Wr=a("span"),g(yn.$$.fragment),ag=d(),Nr=a("span"),rg=n("LayoutLMv2ForQuestionAnswering"),il=d(),ne=a("div"),g(_n.$$.fragment),ig=d(),pe=a("p"),lg=n(`LayoutLMv2 Model with a span classification head on top for extractive question-answering tasks such as
`),vn=a("a"),cg=n("DocVQA"),dg=n(` (a linear layer on top of the text part of the hidden-states output to
compute `),Rr=a("code"),pg=n("span start logits"),mg=n(" and "),qr=a("code"),ug=n("span end logits"),hg=n(")."),fg=d(),bn=a("p"),gg=n("This model is a PyTorch "),Mn=a("a"),yg=n("torch.nn.Module"),_g=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),vg=d(),W=a("div"),g(wn.$$.fragment),bg=d(),Se=a("p"),Mg=n("The "),Es=a("a"),wg=n("LayoutLMv2ForQuestionAnswering"),Lg=n(" forward method, overrides the "),Br=a("code"),kg=n("__call__"),Tg=n(" special method."),xg=d(),g(wt.$$.fragment),jg=d(),Ar=a("p"),Jg=n("Example:"),Ug=d(),Gr=a("p"),Eg=n(`In this example below, we give the LayoutLMv2 model an image (of texts) and ask it a question. 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).`),zg=d(),g(Lt.$$.fragment),Ig=d(),g(kt.$$.fragment),this.h()},l(t){const c=kb('[data-svelte="svelte-1phssyn"]',document.head);h=r(c,"META",{name:!0,content:!0}),c.forEach(o),k=p(t),f=r(t,"H1",{class:!0});var Ln=i(f);w=r(Ln,"A",{id:!0,class:!0,href:!0});var Xr=i(w);T=r(Xr,"SPAN",{});var Pr=i(T);y(u.$$.fragment,Pr),Pr.forEach(o),Xr.forEach(o),L=p(Ln),N=r(Ln,"SPAN",{});var Vr=i(N);Dl=s(Vr,"LayoutLMV2"),Vr.forEach(o),Ln.forEach(o),Or=p(t),je=r(t,"H2",{class:!0});var kn=i(je);Qe=r(kn,"A",{id:!0,class:!0,href:!0});var Sr=i(Qe);Qs=r(Sr,"SPAN",{});var Dr=i(Qs);y(Ft.$$.fragment,Dr),Dr.forEach(o),Sr.forEach(o),Ql=p(kn),Ys=r(kn,"SPAN",{});var Qr=i(Ys);Yl=s(Qr,"Overview"),Qr.forEach(o),kn.forEach(o),Hr=p(t),ue=r(t,"P",{});var De=i(ue);Ol=s(De,"The LayoutLMV2 model was proposed in "),Zt=r(De,"A",{href:!0,rel:!0});var Yr=i(Zt);Hl=s(Yr,"LayoutLMv2: Multi-modal Pre-training for Visually-Rich Document Understanding"),Yr.forEach(o),Kl=s(De,` by Yang Xu, Yiheng Xu, Tengchao Lv, Lei Cui, Furu Wei, Guoxin Wang, Yijuan Lu,
Dinei Florencio, Cha Zhang, Wanxiang Che, Min Zhang, Lidong Zhou. LayoutLMV2 improves `),Tn=r(De,"A",{href:!0});var Ag=i(Tn);ec=s(Ag,"LayoutLM"),Ag.forEach(o),tc=s(De,` to obtain
state-of-the-art results across several document image understanding benchmarks:`),De.forEach(o),Kr=p(t),he=r(t,"UL",{});var zs=i(he);O=r(zs,"LI",{});var Me=i(O);oc=s(Me,"information extraction from scanned documents: the "),Wt=r(Me,"A",{href:!0,rel:!0});var Gg=i(Wt);nc=s(Gg,"FUNSD"),Gg.forEach(o),sc=s(Me,` dataset (a
collection of 199 annotated forms comprising more than 30,000 words), the `),Nt=r(Me,"A",{href:!0,rel:!0});var Xg=i(Nt);ac=s(Xg,"CORD"),Xg.forEach(o),rc=s(Me,`
dataset (a collection of 800 receipts for training, 100 for validation and 100 for testing), the `),Rt=r(Me,"A",{href:!0,rel:!0});var Pg=i(Rt);ic=s(Pg,"SROIE"),Pg.forEach(o),lc=s(Me,` dataset (a collection of 626 receipts for training and 347 receipts for testing)
and the `),qt=r(Me,"A",{href:!0,rel:!0});var Vg=i(qt);cc=s(Vg,"Kleister-NDA"),Vg.forEach(o),dc=s(Me,` dataset (a collection of non-disclosure
agreements from the EDGAR database, including 254 documents for training, 83 documents for validation, and 203
documents for testing).`),Me.forEach(o),pc=p(zs),Bt=r(zs,"LI",{});var cl=i(Bt);mc=s(cl,"document image classification: the "),At=r(cl,"A",{href:!0,rel:!0});var Sg=i(At);uc=s(Sg,"RVL-CDIP"),Sg.forEach(o),hc=s(cl,` dataset (a collection of
400,000 images belonging to one of 16 classes).`),cl.forEach(o),fc=p(zs),Gt=r(zs,"LI",{});var dl=i(Gt);gc=s(dl,"document visual question answering: the "),Xt=r(dl,"A",{href:!0,rel:!0});var Dg=i(Xt);yc=s(Dg,"DocVQA"),Dg.forEach(o),_c=s(dl,` dataset (a collection of 50,000
questions defined on 12,000+ document images).`),dl.forEach(o),zs.forEach(o),ei=p(t),xn=r(t,"P",{});var Qg=i(xn);vc=s(Qg,"The abstract from the paper is the following:"),Qg.forEach(o),ti=p(t),jn=r(t,"P",{});var Yg=i(jn);Os=r(Yg,"EM",{});var Og=i(Os);bc=s(Og,`Pre-training of text and layout has proved effective in a variety of visually-rich document understanding tasks due to
its effective model architecture and the advantage of large-scale unlabeled scanned/digital-born documents. In this
paper, we present LayoutLMv2 by pre-training text, layout and image in a multi-modal framework, where new model
architectures and pre-training tasks are leveraged. Specifically, LayoutLMv2 not only uses the existing masked
visual-language modeling task but also the new text-image alignment and text-image matching tasks in the pre-training
stage, where cross-modality interaction is better learned. Meanwhile, it also integrates a spatial-aware self-attention
mechanism into the Transformer architecture, so that the model can fully understand the relative positional
relationship among different text blocks. Experiment results show that LayoutLMv2 outperforms strong baselines and
achieves new state-of-the-art results on a wide variety of downstream visually-rich document understanding tasks,
including FUNSD (0.7895 -> 0.8420), CORD (0.9493 -> 0.9601), SROIE (0.9524 -> 0.9781), Kleister-NDA (0.834 -> 0.852),
RVL-CDIP (0.9443 -> 0.9564), and DocVQA (0.7295 -> 0.8672). The pre-trained LayoutLMv2 model is publicly available at
this https URL.`),Og.forEach(o),Yg.forEach(o),oi=p(t),se=r(t,"P",{});var Tt=i(se);Mc=s(Tt,"LayoutLMv2 depends on "),Hs=r(Tt,"CODE",{});var Hg=i(Hs);wc=s(Hg,"detectron2"),Hg.forEach(o),Lc=s(Tt,", "),Ks=r(Tt,"CODE",{});var Kg=i(Ks);kc=s(Kg,"torchvision"),Kg.forEach(o),Tc=s(Tt," and "),ea=r(Tt,"CODE",{});var ey=i(ea);xc=s(ey,"tesseract"),ey.forEach(o),jc=s(Tt,`. Run the
following to install them:`),Tt.forEach(o),ni=p(t),y(Pt.$$.fragment,t),si=p(t),Jn=r(t,"P",{});var ty=i(Jn);Jc=s(ty,"(If you are developing for LayoutLMv2, note that passing the doctests also requires the installation of these packages.)"),ty.forEach(o),ai=p(t),Un=r(t,"P",{});var oy=i(Un);Uc=s(oy,"Tips:"),oy.forEach(o),ri=p(t),P=r(t,"UL",{});var we=i(P);ta=r(we,"LI",{});var ny=i(ta);Ec=s(ny,`The main difference between LayoutLMv1 and LayoutLMv2 is that the latter incorporates visual embeddings during
pre-training (while LayoutLMv1 only adds visual embeddings during fine-tuning).`),ny.forEach(o),zc=p(we),Vt=r(we,"LI",{});var pl=i(Vt);Ic=s(pl,`LayoutLMv2 adds both a relative 1D attention bias as well as a spatial 2D attention bias to the attention scores in
the self-attention layers. Details can be found on page 5 of the `),St=r(pl,"A",{href:!0,rel:!0});var sy=i(St);Cc=s(sy,"paper"),sy.forEach(o),$c=s(pl,"."),pl.forEach(o),Fc=p(we),Dt=r(we,"LI",{});var ml=i(Dt);Zc=s(ml,"Demo notebooks on how to use the LayoutLMv2 model on RVL-CDIP, FUNSD, DocVQA, CORD can be found "),Qt=r(ml,"A",{href:!0,rel:!0});var ay=i(Qt);Wc=s(ay,"here"),ay.forEach(o),Nc=s(ml,"."),ml.forEach(o),Rc=p(we),Je=r(we,"LI",{});var Is=i(Je);qc=s(Is,"LayoutLMv2 uses Facebook AI\u2019s "),Yt=r(Is,"A",{href:!0,rel:!0});var ry=i(Yt);Bc=s(ry,"Detectron2"),ry.forEach(o),Ac=s(Is,` package for its visual
backbone. See `),Ot=r(Is,"A",{href:!0,rel:!0});var iy=i(Ot);Gc=s(iy,"this link"),iy.forEach(o),Xc=s(Is,` for installation
instructions.`),Is.forEach(o),Pc=p(we),x=r(we,"LI",{});var U=i(x);Vc=s(U,"In addition to "),oa=r(U,"CODE",{});var ly=i(oa);Sc=s(ly,"input_ids"),ly.forEach(o),Dc=s(U,", "),En=r(U,"A",{href:!0});var cy=i(En);Qc=s(cy,"forward()"),cy.forEach(o),Yc=s(U,` expects 2 additional inputs, namely
`),na=r(U,"CODE",{});var dy=i(na);Oc=s(dy,"image"),dy.forEach(o),Hc=s(U," and "),sa=r(U,"CODE",{});var py=i(sa);Kc=s(py,"bbox"),py.forEach(o),ed=s(U,". The "),aa=r(U,"CODE",{});var my=i(aa);td=s(my,"image"),my.forEach(o),od=s(U,` input corresponds to the original document image in which the text
tokens occur. The model expects each document image to be of size 224x224. This means that if you have a batch of
document images, `),ra=r(U,"CODE",{});var uy=i(ra);nd=s(uy,"image"),uy.forEach(o),sd=s(U,` should be a tensor of shape (batch_size, 3, 224, 224). This can be either a
`),ia=r(U,"CODE",{});var hy=i(ia);ad=s(hy,"torch.Tensor"),hy.forEach(o),rd=s(U," or a "),la=r(U,"CODE",{});var fy=i(la);id=s(fy,"Detectron2.structures.ImageList"),fy.forEach(o),ld=s(U,`. You don\u2019t need to normalize the channels, as this is
done by the model. Important to note is that the visual backbone expects BGR channels instead of RGB, as all models
in Detectron2 are pre-trained using the BGR format. The `),ca=r(U,"CODE",{});var gy=i(ca);cd=s(gy,"bbox"),gy.forEach(o),dd=s(U,` input are the bounding boxes (i.e. 2D-positions)
of the input text tokens. This is identical to `),zn=r(U,"A",{href:!0});var yy=i(zn);pd=s(yy,"LayoutLMModel"),yy.forEach(o),md=s(U,`. These can be obtained using an
external OCR engine such as Google\u2019s `),Ht=r(U,"A",{href:!0,rel:!0});var _y=i(Ht);ud=s(_y,"Tesseract"),_y.forEach(o),hd=s(U," (there\u2019s a "),Kt=r(U,"A",{href:!0,rel:!0});var vy=i(Kt);fd=s(vy,`Python
wrapper`),vy.forEach(o),gd=s(U,` 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:`),U.forEach(o),we.forEach(o),ii=p(t),y(eo.$$.fragment,t),li=p(t),fe=r(t,"P",{});var Cs=i(fe);yd=s(Cs,"Here, "),da=r(Cs,"CODE",{});var by=i(da);_d=s(by,"width"),by.forEach(o),vd=s(Cs," and "),pa=r(Cs,"CODE",{});var My=i(pa);bd=s(My,"height"),My.forEach(o),Md=s(Cs,` correspond to the width and height of the original document in which the token
occurs (before resizing the image). Those can be obtained using the Python Image Library (PIL) library for example, as
follows:`),Cs.forEach(o),ci=p(t),y(to.$$.fragment,t),di=p(t),Ye=r(t,"P",{});var ul=i(Ye);wd=s(ul,"However, this model includes a brand new "),In=r(ul,"A",{href:!0});var wy=i(In);Ld=s(wy,"LayoutLMv2Processor"),wy.forEach(o),kd=s(ul,` which can be used to directly
prepare data for the model (including applying OCR under the hood). More information can be found in the \u201CUsage\u201D
section below.`),ul.forEach(o),pi=p(t),ge=r(t,"UL",{});var $s=i(ge);Z=r($s,"LI",{});var B=i(Z);Td=s(B,"Internally, "),Cn=r(B,"A",{href:!0});var Ly=i(Cn);xd=s(Ly,"LayoutLMv2Model"),Ly.forEach(o),jd=s(B," will send the "),ma=r(B,"CODE",{});var ky=i(ma);Jd=s(ky,"image"),ky.forEach(o),Ud=s(B,` input through its visual backbone to
obtain a lower-resolution feature map, whose shape is equal to the `),ua=r(B,"CODE",{});var Ty=i(ua);Ed=s(Ty,"image_feature_pool_shape"),Ty.forEach(o),zd=s(B,` attribute of
`),$n=r(B,"A",{href:!0});var xy=i($n);Id=s(xy,"LayoutLMv2Config"),xy.forEach(o),Cd=s(B,`. This feature map is then flattened to obtain a sequence of image tokens. As
the size of the feature map is 7x7 by default, one obtains 49 image tokens. These are then concatenated with the text
tokens, and send through the Transformer encoder. This means that the last hidden states of the model will have a
length of 512 + 49 = 561, if you pad the text tokens up to the max length. More generally, the last hidden states
will have a shape of `),ha=r(B,"CODE",{});var jy=i(ha);$d=s(jy,"seq_length"),jy.forEach(o),Fd=s(B," + "),fa=r(B,"CODE",{});var Jy=i(fa);Zd=s(Jy,"image_feature_pool_shape[0]"),Jy.forEach(o),Wd=s(B,` *
`),ga=r(B,"CODE",{});var Uy=i(ga);Nd=s(Uy,"config.image_feature_pool_shape[1]"),Uy.forEach(o),Rd=s(B,"."),B.forEach(o),qd=p($s),oo=r($s,"LI",{});var hl=i(oo);Bd=s(hl,"When calling "),Fn=r(hl,"A",{href:!0});var Ey=i(Fn);Ad=s(Ey,"from_pretrained()"),Ey.forEach(o),Gd=s(hl,`, a warning will be printed with a long list of
parameter names that are not initialized. This is not a problem, as these parameters are batch normalization
statistics, which are going to have values when fine-tuning on a custom dataset.`),hl.forEach(o),Xd=p($s),no=r($s,"LI",{});var fl=i(no);Pd=s(fl,"If you want to train the model in a distributed environment, make sure to call "),ya=r(fl,"CODE",{});var zy=i(ya);Vd=s(zy,"synchronize_batch_norm"),zy.forEach(o),Sd=s(fl,` on the
model in order to properly synchronize the batch normalization layers of the visual backbone.`),fl.forEach(o),$s.forEach(o),mi=p(t),Oe=r(t,"P",{});var gl=i(Oe);Dd=s(gl,`In addition, there\u2019s LayoutXLM, which is a multilingual version of LayoutLMv2. More information can be found on
`),Zn=r(gl,"A",{href:!0});var Iy=i(Zn);Qd=s(Iy,"LayoutXLM\u2019s documentation page"),Iy.forEach(o),Yd=s(gl,"."),gl.forEach(o),ui=p(t),Ue=r(t,"H2",{class:!0});var yl=i(Ue);He=r(yl,"A",{id:!0,class:!0,href:!0});var Cy=i(He);_a=r(Cy,"SPAN",{});var $y=i(_a);y(so.$$.fragment,$y),$y.forEach(o),Cy.forEach(o),Od=p(yl),va=r(yl,"SPAN",{});var Fy=i(va);Hd=s(Fy,"Resources"),Fy.forEach(o),yl.forEach(o),hi=p(t),Wn=r(t,"P",{});var Zy=i(Wn);Kd=s(Zy,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with LayoutLMv2. 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."),Zy.forEach(o),fi=p(t),y(ao.$$.fragment,t),gi=p(t),Ke=r(t,"UL",{});var _l=i(Ke);ro=r(_l,"LI",{});var vl=i(ro);ep=s(vl,"A notebook on how to "),io=r(vl,"A",{href:!0,rel:!0});var Wy=i(io);tp=s(Wy,"finetune LayoutLMv2 for text-classification on RVL-CDIP dataset"),Wy.forEach(o),op=s(vl,"."),vl.forEach(o),np=p(_l),Nn=r(_l,"LI",{});var Cg=i(Nn);sp=s(Cg,"See also: "),Rn=r(Cg,"A",{href:!0});var Ny=i(Rn);ap=s(Ny,"Text classification task guide"),Ny.forEach(o),Cg.forEach(o),_l.forEach(o),yi=p(t),y(lo.$$.fragment,t),_i=p(t),ye=r(t,"UL",{});var Fs=i(ye);co=r(Fs,"LI",{});var bl=i(co);rp=s(bl,"A notebook on how to "),po=r(bl,"A",{href:!0,rel:!0});var Ry=i(po);ip=s(Ry,"finetune LayoutLMv2 for question-answering on DocVQA dataset"),Ry.forEach(o),lp=s(bl,"."),bl.forEach(o),cp=p(Fs),qn=r(Fs,"LI",{});var $g=i(qn);dp=s($g,"See also: "),Bn=r($g,"A",{href:!0});var qy=i(Bn);pp=s(qy,"Question answering task guide"),qy.forEach(o),$g.forEach(o),mp=p(Fs),An=r(Fs,"LI",{});var Fg=i(An);up=s(Fg,"See also: "),Gn=r(Fg,"A",{href:!0});var By=i(Gn);hp=s(By,"Document question answering task guide"),By.forEach(o),Fg.forEach(o),Fs.forEach(o),vi=p(t),y(mo.$$.fragment,t),bi=p(t),_e=r(t,"UL",{});var Zs=i(_e);uo=r(Zs,"LI",{});var Ml=i(uo);fp=s(Ml,"A notebook on how to "),ho=r(Ml,"A",{href:!0,rel:!0});var Ay=i(ho);gp=s(Ay,"finetune LayoutLMv2 for token-classification on CORD dataset"),Ay.forEach(o),yp=s(Ml,"."),Ml.forEach(o),_p=p(Zs),fo=r(Zs,"LI",{});var wl=i(fo);vp=s(wl,"A notebook on how to "),go=r(wl,"A",{href:!0,rel:!0});var Gy=i(go);bp=s(Gy,"finetune LayoutLMv2 for token-classification on FUNSD dataset"),Gy.forEach(o),Mp=s(wl,"."),wl.forEach(o),wp=p(Zs),Xn=r(Zs,"LI",{});var Zg=i(Xn);Lp=s(Zg,"See also: "),Pn=r(Zg,"A",{href:!0});var Xy=i(Pn);kp=s(Xy,"Token classification task guide"),Xy.forEach(o),Zg.forEach(o),Zs.forEach(o),Mi=p(t),Ee=r(t,"H2",{class:!0});var Ll=i(Ee);et=r(Ll,"A",{id:!0,class:!0,href:!0});var Py=i(et);ba=r(Py,"SPAN",{});var Vy=i(ba);y(yo.$$.fragment,Vy),Vy.forEach(o),Py.forEach(o),Tp=p(Ll),Ma=r(Ll,"SPAN",{});var Sy=i(Ma);xp=s(Sy,"Usage: LayoutLMv2Processor"),Sy.forEach(o),Ll.forEach(o),wi=p(t),V=r(t,"P",{});var Le=i(V);jp=s(Le,"The easiest way to prepare data for the model is to use "),Vn=r(Le,"A",{href:!0});var Dy=i(Vn);Jp=s(Dy,"LayoutLMv2Processor"),Dy.forEach(o),Up=s(Le,`, which internally
combines a image processor (`),Sn=r(Le,"A",{href:!0});var Qy=i(Sn);Ep=s(Qy,"LayoutLMv2ImageProcessor"),Qy.forEach(o),zp=s(Le,`) and a tokenizer
(`),Dn=r(Le,"A",{href:!0});var Yy=i(Dn);Ip=s(Yy,"LayoutLMv2Tokenizer"),Yy.forEach(o),Cp=s(Le," or "),Qn=r(Le,"A",{href:!0});var Oy=i(Qn);$p=s(Oy,"LayoutLMv2TokenizerFast"),Oy.forEach(o),Fp=s(Le,`). The image processor
handles the image modality, while the tokenizer handles the text modality. A processor combines both, which is ideal
for a multi-modal model like LayoutLMv2. Note that you can still use both separately, if you only want to handle one
modality.`),Le.forEach(o),Li=p(t),y(_o.$$.fragment,t),ki=p(t),J=r(t,"P",{});var C=i(J);Zp=s(C,"In short, one can provide a document image (and possibly additional data) to "),Yn=r(C,"A",{href:!0});var Hy=i(Yn);Wp=s(Hy,"LayoutLMv2Processor"),Hy.forEach(o),Np=s(C,`,
and it will create the inputs expected by the model. Internally, the processor first uses
`),On=r(C,"A",{href:!0});var Ky=i(On);Rp=s(Ky,"LayoutLMv2ImageProcessor"),Ky.forEach(o),qp=s(C,` to apply OCR on the image to get a list of words and normalized
bounding boxes, as well to resize the image to a given size in order to get the `),wa=r(C,"CODE",{});var e_=i(wa);Bp=s(e_,"image"),e_.forEach(o),Ap=s(C,` input. The words and
normalized bounding boxes are then provided to `),Hn=r(C,"A",{href:!0});var t_=i(Hn);Gp=s(t_,"LayoutLMv2Tokenizer"),t_.forEach(o),Xp=s(C,` or
`),Kn=r(C,"A",{href:!0});var o_=i(Kn);Pp=s(o_,"LayoutLMv2TokenizerFast"),o_.forEach(o),Vp=s(C,", which converts them to token-level "),La=r(C,"CODE",{});var n_=i(La);Sp=s(n_,"input_ids"),n_.forEach(o),Dp=s(C,`,
`),ka=r(C,"CODE",{});var s_=i(ka);Qp=s(s_,"attention_mask"),s_.forEach(o),Yp=s(C,", "),Ta=r(C,"CODE",{});var a_=i(Ta);Op=s(a_,"token_type_ids"),a_.forEach(o),Hp=s(C,", "),xa=r(C,"CODE",{});var r_=i(xa);Kp=s(r_,"bbox"),r_.forEach(o),em=s(C,`. Optionally, one can provide word labels to the processor,
which are turned into token-level `),ja=r(C,"CODE",{});var i_=i(ja);tm=s(i_,"labels"),i_.forEach(o),om=s(C,"."),C.forEach(o),Ti=p(t),A=r(t,"P",{});var me=i(A);es=r(me,"A",{href:!0});var l_=i(es);nm=s(l_,"LayoutLMv2Processor"),l_.forEach(o),sm=s(me," uses "),vo=r(me,"A",{href:!0,rel:!0});var c_=i(vo);am=s(c_,"PyTesseract"),c_.forEach(o),rm=s(me,`, a Python
wrapper around Google\u2019s Tesseract OCR engine, under the hood. Note that you can still use your own OCR engine of
choice, and provide the words and normalized boxes yourself. This requires initializing
`),ts=r(me,"A",{href:!0});var d_=i(ts);im=s(d_,"LayoutLMv2ImageProcessor"),d_.forEach(o),lm=s(me," with "),Ja=r(me,"CODE",{});var p_=i(Ja);cm=s(p_,"apply_ocr"),p_.forEach(o),dm=s(me," set to "),Ua=r(me,"CODE",{});var m_=i(Ua);pm=s(m_,"False"),m_.forEach(o),mm=s(me,"."),me.forEach(o),xi=p(t),os=r(t,"P",{});var u_=i(os);um=s(u_,`In total, there are 5 use cases that are supported by the processor. Below, we list them all. Note that each of these
use cases work for both batched and non-batched inputs (we illustrate them for non-batched inputs).`),u_.forEach(o),ji=p(t),ns=r(t,"P",{});var h_=i(ns);Ea=r(h_,"STRONG",{});var f_=i(Ea);hm=s(f_,`Use case 1: document image classification (training, inference) + token classification (inference), apply_ocr =
True`),f_.forEach(o),h_.forEach(o),Ji=p(t),ss=r(t,"P",{});var g_=i(ss);fm=s(g_,`This is the simplest case, in which the processor (actually the image processor) will perform OCR on the image to get
the words and normalized bounding boxes.`),g_.forEach(o),Ui=p(t),y(bo.$$.fragment,t),Ei=p(t),as=r(t,"P",{});var y_=i(as);za=r(y_,"STRONG",{});var __=i(za);gm=s(__,"Use case 2: document image classification (training, inference) + token classification (inference), apply_ocr=False"),__.forEach(o),y_.forEach(o),zi=p(t),ve=r(t,"P",{});var Ws=i(ve);ym=s(Ws,"In case one wants to do OCR themselves, one can initialize the image processor with "),Ia=r(Ws,"CODE",{});var v_=i(Ia);_m=s(v_,"apply_ocr"),v_.forEach(o),vm=s(Ws,` set to
`),Ca=r(Ws,"CODE",{});var b_=i(Ca);bm=s(b_,"False"),b_.forEach(o),Mm=s(Ws,`. In that case, one should provide the words and corresponding (normalized) bounding boxes themselves to
the processor.`),Ws.forEach(o),Ii=p(t),y(Mo.$$.fragment,t),Ci=p(t),rs=r(t,"P",{});var M_=i(rs);$a=r(M_,"STRONG",{});var w_=i($a);wm=s(w_,"Use case 3: token classification (training), apply_ocr=False"),w_.forEach(o),M_.forEach(o),$i=p(t),S=r(t,"P",{});var ke=i(S);Lm=s(ke,`For token classification tasks (such as FUNSD, CORD, SROIE, Kleister-NDA), one can also provide the corresponding word
labels in order to train a model. The processor will then convert these into token-level `),Fa=r(ke,"CODE",{});var L_=i(Fa);km=s(L_,"labels"),L_.forEach(o),Tm=s(ke,`. By default, it
will only label the first wordpiece of a word, and label the remaining wordpieces with -100, which is the
`),Za=r(ke,"CODE",{});var k_=i(Za);xm=s(k_,"ignore_index"),k_.forEach(o),jm=s(ke,` of PyTorch\u2019s CrossEntropyLoss. In case you want all wordpieces of a word to be labeled, you can
initialize the tokenizer with `),Wa=r(ke,"CODE",{});var T_=i(Wa);Jm=s(T_,"only_label_first_subword"),T_.forEach(o),Um=s(ke," set to "),Na=r(ke,"CODE",{});var x_=i(Na);Em=s(x_,"False"),x_.forEach(o),zm=s(ke,"."),ke.forEach(o),Fi=p(t),y(wo.$$.fragment,t),Zi=p(t),is=r(t,"P",{});var j_=i(is);Ra=r(j_,"STRONG",{});var J_=i(Ra);Im=s(J_,"Use case 4: visual question answering (inference), apply_ocr=True"),J_.forEach(o),j_.forEach(o),Wi=p(t),ls=r(t,"P",{});var U_=i(ls);Cm=s(U_,`For visual question answering tasks (such as DocVQA), you can provide a question to the processor. By default, the
processor will apply OCR on the image, and create [CLS] question tokens [SEP] word tokens [SEP].`),U_.forEach(o),Ni=p(t),y(Lo.$$.fragment,t),Ri=p(t),cs=r(t,"P",{});var E_=i(cs);qa=r(E_,"STRONG",{});var z_=i(qa);$m=s(z_,"Use case 5: visual question answering (inference), apply_ocr=False"),z_.forEach(o),E_.forEach(o),qi=p(t),ds=r(t,"P",{});var I_=i(ds);Fm=s(I_,`For visual question answering tasks (such as DocVQA), you can provide a question to the processor. If you want to
perform OCR yourself, you can provide your own words and (normalized) bounding boxes to the processor.`),I_.forEach(o),Bi=p(t),y(ko.$$.fragment,t),Ai=p(t),ze=r(t,"H2",{class:!0});var kl=i(ze);tt=r(kl,"A",{id:!0,class:!0,href:!0});var C_=i(tt);Ba=r(C_,"SPAN",{});var $_=i(Ba);y(To.$$.fragment,$_),$_.forEach(o),C_.forEach(o),Zm=p(kl),Aa=r(kl,"SPAN",{});var F_=i(Aa);Wm=s(F_,"LayoutLMv2Config"),F_.forEach(o),kl.forEach(o),Gi=p(t),H=r(t,"DIV",{class:!0});var xt=i(H);y(xo.$$.fragment,xt),Nm=p(xt),Ie=r(xt,"P",{});var Ns=i(Ie);Rm=s(Ns,"This is the configuration class to store the configuration of a "),ps=r(Ns,"A",{href:!0});var Z_=i(ps);qm=s(Z_,"LayoutLMv2Model"),Z_.forEach(o),Bm=s(Ns,`. It is used to instantiate an
LayoutLMv2 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 LayoutLMv2
`),jo=r(Ns,"A",{href:!0,rel:!0});var W_=i(jo);Am=s(W_,"microsoft/layoutlmv2-base-uncased"),W_.forEach(o),Gm=s(Ns," architecture."),Ns.forEach(o),Xm=p(xt),Ce=r(xt,"P",{});var Rs=i(Ce);Pm=s(Rs,"Configuration objects inherit from "),ms=r(Rs,"A",{href:!0});var N_=i(ms);Vm=s(N_,"PretrainedConfig"),N_.forEach(o),Sm=s(Rs,` and can be used to control the model outputs. Read the
documentation from `),us=r(Rs,"A",{href:!0});var R_=i(us);Dm=s(R_,"PretrainedConfig"),R_.forEach(o),Qm=s(Rs," for more information."),Rs.forEach(o),Ym=p(xt),y(ot.$$.fragment,xt),xt.forEach(o),Xi=p(t),$e=r(t,"H2",{class:!0});var Tl=i($e);nt=r(Tl,"A",{id:!0,class:!0,href:!0});var q_=i(nt);Ga=r(q_,"SPAN",{});var B_=i(Ga);y(Jo.$$.fragment,B_),B_.forEach(o),q_.forEach(o),Om=p(Tl),Xa=r(Tl,"SPAN",{});var A_=i(Xa);Hm=s(A_,"LayoutLMv2FeatureExtractor"),A_.forEach(o),Tl.forEach(o),Pi=p(t),Fe=r(t,"DIV",{class:!0});var xl=i(Fe);y(Uo.$$.fragment,xl),Km=p(xl),st=r(xl,"DIV",{class:!0});var jl=i(st);y(Eo.$$.fragment,jl),eu=p(jl),Pa=r(jl,"P",{});var G_=i(Pa);tu=s(G_,"Preprocess an image or a batch of images."),G_.forEach(o),jl.forEach(o),xl.forEach(o),Vi=p(t),Ze=r(t,"H2",{class:!0});var Jl=i(Ze);at=r(Jl,"A",{id:!0,class:!0,href:!0});var X_=i(at);Va=r(X_,"SPAN",{});var P_=i(Va);y(zo.$$.fragment,P_),P_.forEach(o),X_.forEach(o),ou=p(Jl),Sa=r(Jl,"SPAN",{});var V_=i(Sa);nu=s(V_,"LayoutLMv2ImageProcessor"),V_.forEach(o),Jl.forEach(o),Si=p(t),ce=r(t,"DIV",{class:!0});var qs=i(ce);y(Io.$$.fragment,qs),su=p(qs),Da=r(qs,"P",{});var S_=i(Da);au=s(S_,"Constructs a LayoutLMv2 image processor."),S_.forEach(o),ru=p(qs),rt=r(qs,"DIV",{class:!0});var Ul=i(rt);y(Co.$$.fragment,Ul),iu=p(Ul),Qa=r(Ul,"P",{});var D_=i(Qa);lu=s(D_,"Preprocess an image or batch of images."),D_.forEach(o),Ul.forEach(o),qs.forEach(o),Di=p(t),We=r(t,"H2",{class:!0});var El=i(We);it=r(El,"A",{id:!0,class:!0,href:!0});var Q_=i(it);Ya=r(Q_,"SPAN",{});var Y_=i(Ya);y($o.$$.fragment,Y_),Y_.forEach(o),Q_.forEach(o),cu=p(El),Oa=r(El,"SPAN",{});var O_=i(Oa);du=s(O_,"LayoutLMv2Tokenizer"),O_.forEach(o),El.forEach(o),Qi=p(t),R=r(t,"DIV",{class:!0});var le=i(R);y(Fo.$$.fragment,le),pu=p(le),q=r(le,"P",{});var D=i(q);mu=s(D,"Construct a LayoutLMv2 tokenizer. Based on WordPiece. "),hs=r(D,"A",{href:!0});var H_=i(hs);uu=s(H_,"LayoutLMv2Tokenizer"),H_.forEach(o),hu=s(D,` can be used to turn words, word-level
bounding boxes and optional word labels to token-level `),Ha=r(D,"CODE",{});var K_=i(Ha);fu=s(K_,"input_ids"),K_.forEach(o),gu=s(D,", "),Ka=r(D,"CODE",{});var ev=i(Ka);yu=s(ev,"attention_mask"),ev.forEach(o),_u=s(D,", "),er=r(D,"CODE",{});var tv=i(er);vu=s(tv,"token_type_ids"),tv.forEach(o),bu=s(D,", "),tr=r(D,"CODE",{});var ov=i(tr);Mu=s(ov,"bbox"),ov.forEach(o),wu=s(D,`, and
optional `),or=r(D,"CODE",{});var nv=i(or);Lu=s(nv,"labels"),nv.forEach(o),ku=s(D," (for token classification)."),D.forEach(o),Tu=p(le),Zo=r(le,"P",{});var zl=i(Zo);xu=s(zl,"This tokenizer inherits from "),fs=r(zl,"A",{href:!0});var sv=i(fs);ju=s(sv,"PreTrainedTokenizer"),sv.forEach(o),Ju=s(zl,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),zl.forEach(o),Uu=p(le),gs=r(le,"P",{});var Wg=i(gs);ys=r(Wg,"A",{href:!0});var av=i(ys);Eu=s(av,"LayoutLMv2Tokenizer"),av.forEach(o),zu=s(Wg,` runs end-to-end tokenization: punctuation splitting and wordpiece. It also turns the
word-level bounding boxes into token-level bounding boxes.`),Wg.forEach(o),Iu=p(le),lt=r(le,"DIV",{class:!0});var Il=i(lt);y(Wo.$$.fragment,Il),Cu=p(Il),nr=r(Il,"P",{});var rv=i(nr);$u=s(rv,`Main method to tokenize and prepare for the model one or several sequence(s) or one or several pair(s) of
sequences with word-level normalized bounding boxes and optional labels.`),rv.forEach(o),Il.forEach(o),Fu=p(le),_s=r(le,"DIV",{class:!0});var iv=i(_s);y(No.$$.fragment,iv),iv.forEach(o),le.forEach(o),Yi=p(t),Ne=r(t,"H2",{class:!0});var Cl=i(Ne);ct=r(Cl,"A",{id:!0,class:!0,href:!0});var lv=i(ct);sr=r(lv,"SPAN",{});var cv=i(sr);y(Ro.$$.fragment,cv),cv.forEach(o),lv.forEach(o),Zu=p(Cl),ar=r(Cl,"SPAN",{});var dv=i(ar);Wu=s(dv,"LayoutLMv2TokenizerFast"),dv.forEach(o),Cl.forEach(o),Oi=p(t),K=r(t,"DIV",{class:!0});var jt=i(K);y(qo.$$.fragment,jt),Nu=p(jt),Bo=r(jt,"P",{});var $l=i(Bo);Ru=s($l,"Construct a \u201Cfast\u201D LayoutLMv2 tokenizer (backed by HuggingFace\u2019s "),rr=r($l,"EM",{});var pv=i(rr);qu=s(pv,"tokenizers"),pv.forEach(o),Bu=s($l," library). Based on WordPiece."),$l.forEach(o),Au=p(jt),Ao=r(jt,"P",{});var Fl=i(Ao);Gu=s(Fl,"This tokenizer inherits from "),vs=r(Fl,"A",{href:!0});var mv=i(vs);Xu=s(mv,"PreTrainedTokenizerFast"),mv.forEach(o),Pu=s(Fl,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Fl.forEach(o),Vu=p(jt),dt=r(jt,"DIV",{class:!0});var Zl=i(dt);y(Go.$$.fragment,Zl),Su=p(Zl),ir=r(Zl,"P",{});var uv=i(ir);Du=s(uv,`Main method to tokenize and prepare for the model one or several sequence(s) or one or several pair(s) of
sequences with word-level normalized bounding boxes and optional labels.`),uv.forEach(o),Zl.forEach(o),jt.forEach(o),Hi=p(t),Re=r(t,"H2",{class:!0});var Wl=i(Re);pt=r(Wl,"A",{id:!0,class:!0,href:!0});var hv=i(pt);lr=r(hv,"SPAN",{});var fv=i(lr);y(Xo.$$.fragment,fv),fv.forEach(o),hv.forEach(o),Qu=p(Wl),cr=r(Wl,"SPAN",{});var gv=i(cr);Yu=s(gv,"LayoutLMv2Processor"),gv.forEach(o),Wl.forEach(o),Ki=p(t),G=r(t,"DIV",{class:!0});var Te=i(G);y(Po.$$.fragment,Te),Ou=p(Te),dr=r(Te,"P",{});var yv=i(dr);Hu=s(yv,`Constructs a LayoutLMv2 processor which combines a LayoutLMv2 image processor and a LayoutLMv2 tokenizer into a
single processor.`),yv.forEach(o),Ku=p(Te),bs=r(Te,"P",{});var Ng=i(bs);Ms=r(Ng,"A",{href:!0});var _v=i(Ms);eh=s(_v,"LayoutLMv2Processor"),_v.forEach(o),th=s(Ng," offers all the functionalities you need to prepare data for the model."),Ng.forEach(o),oh=p(Te),z=r(Te,"P",{});var $=i(z);nh=s($,"It first uses "),ws=r($,"A",{href:!0});var vv=i(ws);sh=s(vv,"LayoutLMv2ImageProcessor"),vv.forEach(o),ah=s($,` to resize document images to a fixed size, and optionally applies OCR to
get words and normalized bounding boxes. These are then provided to `),Ls=r($,"A",{href:!0});var bv=i(Ls);rh=s(bv,"LayoutLMv2Tokenizer"),bv.forEach(o),ih=s($,` or
`),ks=r($,"A",{href:!0});var Mv=i(ks);lh=s(Mv,"LayoutLMv2TokenizerFast"),Mv.forEach(o),ch=s($,", which turns the words and bounding boxes into token-level "),pr=r($,"CODE",{});var wv=i(pr);dh=s(wv,"input_ids"),wv.forEach(o),ph=s($,`,
`),mr=r($,"CODE",{});var Lv=i(mr);mh=s(Lv,"attention_mask"),Lv.forEach(o),uh=s($,", "),ur=r($,"CODE",{});var kv=i(ur);hh=s(kv,"token_type_ids"),kv.forEach(o),fh=s($,", "),hr=r($,"CODE",{});var Tv=i(hr);gh=s(Tv,"bbox"),Tv.forEach(o),yh=s($,". Optionally, one can provide integer "),fr=r($,"CODE",{});var xv=i(fr);_h=s(xv,"word_labels"),xv.forEach(o),vh=s($,`, which are turned
into token-level `),gr=r($,"CODE",{});var jv=i(gr);bh=s(jv,"labels"),jv.forEach(o),Mh=s($," for token classification tasks (such as FUNSD, CORD)."),$.forEach(o),wh=p(Te),be=r(Te,"DIV",{class:!0});var Bs=i(be);y(Vo.$$.fragment,Bs),Lh=p(Bs),j=r(Bs,"P",{});var E=i(j);kh=s(E,"This method first forwards the "),yr=r(E,"CODE",{});var Jv=i(yr);Th=s(Jv,"images"),Jv.forEach(o),xh=s(E," argument to "),So=r(E,"A",{href:!0});var Rg=i(So);_r=r(Rg,"STRONG",{});var Uv=i(_r);jh=s(Uv,"call"),Uv.forEach(o),Jh=s(Rg,"()"),Rg.forEach(o),Uh=s(E,`. In case
`),Ts=r(E,"A",{href:!0});var Ev=i(Ts);Eh=s(Ev,"LayoutLMv2ImageProcessor"),Ev.forEach(o),zh=s(E," was initialized with "),vr=r(E,"CODE",{});var zv=i(vr);Ih=s(zv,"apply_ocr"),zv.forEach(o),Ch=s(E," set to "),br=r(E,"CODE",{});var Iv=i(br);$h=s(Iv,"True"),Iv.forEach(o),Fh=s(E,`, it passes the obtained words and
bounding boxes along with the additional arguments to `),Do=r(E,"A",{href:!0});var qg=i(Do);Mr=r(qg,"STRONG",{});var Cv=i(Mr);Zh=s(Cv,"call"),Cv.forEach(o),Wh=s(qg,"()"),qg.forEach(o),Nh=s(E,` and returns the output,
together with resized `),wr=r(E,"CODE",{});var $v=i(wr);Rh=s($v,"images"),$v.forEach(o),qh=s(E,". In case "),xs=r(E,"A",{href:!0});var Fv=i(xs);Bh=s(Fv,"LayoutLMv2ImageProcessor"),Fv.forEach(o),Ah=s(E," was initialized with "),Lr=r(E,"CODE",{});var Zv=i(Lr);Gh=s(Zv,"apply_ocr"),Zv.forEach(o),Xh=s(E,` set to
`),kr=r(E,"CODE",{});var Wv=i(kr);Ph=s(Wv,"False"),Wv.forEach(o),Vh=s(E,", it passes the words ("),Tr=r(E,"CODE",{});var Nv=i(Tr);Sh=s(Nv,"text"),Nv.forEach(o),Dh=s(E,"/"),xr=r(E,"CODE",{});var Rv=i(xr);Qh=s(Rv,"text_pair`) and `boxes` specified by the user along with the additional arguments to [__call__()](/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer.__call__) and returns the output, together with resized `images"),Rv.forEach(o),Yh=s(E,"."),E.forEach(o),Oh=p(Bs),jr=r(Bs,"P",{});var qv=i(jr);Hh=s(qv,"Please refer to the docstring of the above two methods for more information."),qv.forEach(o),Bs.forEach(o),Te.forEach(o),el=p(t),qe=r(t,"H2",{class:!0});var Nl=i(qe);mt=r(Nl,"A",{id:!0,class:!0,href:!0});var Bv=i(mt);Jr=r(Bv,"SPAN",{});var Av=i(Jr);y(Qo.$$.fragment,Av),Av.forEach(o),Bv.forEach(o),Kh=p(Nl),Ur=r(Nl,"SPAN",{});var Gv=i(Ur);ef=s(Gv,"LayoutLMv2Model"),Gv.forEach(o),Nl.forEach(o),tl=p(t),de=r(t,"DIV",{class:!0});var As=i(de);y(Yo.$$.fragment,As),tf=p(As),Oo=r(As,"P",{});var Rl=i(Oo);of=s(Rl,`The bare LayoutLMv2 Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ho=r(Rl,"A",{href:!0,rel:!0});var Xv=i(Ho);nf=s(Xv,"torch.nn.Module"),Xv.forEach(o),sf=s(Rl,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Rl.forEach(o),af=p(As),ae=r(As,"DIV",{class:!0});var Jt=i(ae);y(Ko.$$.fragment,Jt),rf=p(Jt),Be=r(Jt,"P",{});var Gs=i(Be);lf=s(Gs,"The "),js=r(Gs,"A",{href:!0});var Pv=i(js);cf=s(Pv,"LayoutLMv2Model"),Pv.forEach(o),df=s(Gs," forward method, overrides the "),Er=r(Gs,"CODE",{});var Vv=i(Er);pf=s(Vv,"__call__"),Vv.forEach(o),mf=s(Gs," special method."),Gs.forEach(o),uf=p(Jt),y(ut.$$.fragment,Jt),hf=p(Jt),y(ht.$$.fragment,Jt),Jt.forEach(o),As.forEach(o),ol=p(t),Ae=r(t,"H2",{class:!0});var ql=i(Ae);ft=r(ql,"A",{id:!0,class:!0,href:!0});var Sv=i(ft);zr=r(Sv,"SPAN",{});var Dv=i(zr);y(en.$$.fragment,Dv),Dv.forEach(o),Sv.forEach(o),ff=p(ql),Ir=r(ql,"SPAN",{});var Qv=i(Ir);gf=s(Qv,"LayoutLMv2ForSequenceClassification"),Qv.forEach(o),ql.forEach(o),nl=p(t),ee=r(t,"DIV",{class:!0});var Ut=i(ee);y(tn.$$.fragment,Ut),yf=p(Ut),on=r(Ut,"P",{});var Bl=i(on);_f=s(Bl,`LayoutLMv2 Model with a sequence classification head on top (a linear layer on top of the concatenation of the
final hidden state of the [CLS] token, average-pooled initial visual embeddings and average-pooled final visual
embeddings, e.g. for document image classification tasks such as the
`),nn=r(Bl,"A",{href:!0,rel:!0});var Yv=i(nn);vf=s(Yv,"RVL-CDIP"),Yv.forEach(o),bf=s(Bl," dataset."),Bl.forEach(o),Mf=p(Ut),sn=r(Ut,"P",{});var Al=i(sn);wf=s(Al,"This model is a PyTorch "),an=r(Al,"A",{href:!0,rel:!0});var Ov=i(an);Lf=s(Ov,"torch.nn.Module"),Ov.forEach(o),kf=s(Al,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Al.forEach(o),Tf=p(Ut),re=r(Ut,"DIV",{class:!0});var Et=i(re);y(rn.$$.fragment,Et),xf=p(Et),Ge=r(Et,"P",{});var Xs=i(Ge);jf=s(Xs,"The "),Js=r(Xs,"A",{href:!0});var Hv=i(Js);Jf=s(Hv,"LayoutLMv2ForSequenceClassification"),Hv.forEach(o),Uf=s(Xs," forward method, overrides the "),Cr=r(Xs,"CODE",{});var Kv=i(Cr);Ef=s(Kv,"__call__"),Kv.forEach(o),zf=s(Xs," special method."),Xs.forEach(o),If=p(Et),y(gt.$$.fragment,Et),Cf=p(Et),y(yt.$$.fragment,Et),Et.forEach(o),Ut.forEach(o),sl=p(t),Xe=r(t,"H2",{class:!0});var Gl=i(Xe);_t=r(Gl,"A",{id:!0,class:!0,href:!0});var eb=i(_t);$r=r(eb,"SPAN",{});var tb=i($r);y(ln.$$.fragment,tb),tb.forEach(o),eb.forEach(o),$f=p(Gl),Fr=r(Gl,"SPAN",{});var ob=i(Fr);Ff=s(ob,"LayoutLMv2ForTokenClassification"),ob.forEach(o),Gl.forEach(o),al=p(t),te=r(t,"DIV",{class:!0});var zt=i(te);y(cn.$$.fragment,zt),Zf=p(zt),oe=r(zt,"P",{});var xe=i(oe);Wf=s(xe,`LayoutLMv2 Model with a token classification head on top (a linear layer on top of the text part of the hidden
states) e.g. for sequence labeling (information extraction) tasks such as
`),dn=r(xe,"A",{href:!0,rel:!0});var nb=i(dn);Nf=s(nb,"FUNSD"),nb.forEach(o),Rf=s(xe,", "),pn=r(xe,"A",{href:!0,rel:!0});var sb=i(pn);qf=s(sb,"SROIE"),sb.forEach(o),Bf=s(xe,`,
`),mn=r(xe,"A",{href:!0,rel:!0});var ab=i(mn);Af=s(ab,"CORD"),ab.forEach(o),Gf=s(xe," and "),un=r(xe,"A",{href:!0,rel:!0});var rb=i(un);Xf=s(rb,"Kleister-NDA"),rb.forEach(o),Pf=s(xe,"."),xe.forEach(o),Vf=p(zt),hn=r(zt,"P",{});var Xl=i(hn);Sf=s(Xl,"This model is a PyTorch "),fn=r(Xl,"A",{href:!0,rel:!0});var ib=i(fn);Df=s(ib,"torch.nn.Module"),ib.forEach(o),Qf=s(Xl,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Xl.forEach(o),Yf=p(zt),ie=r(zt,"DIV",{class:!0});var It=i(ie);y(gn.$$.fragment,It),Of=p(It),Pe=r(It,"P",{});var Ps=i(Pe);Hf=s(Ps,"The "),Us=r(Ps,"A",{href:!0});var lb=i(Us);Kf=s(lb,"LayoutLMv2ForTokenClassification"),lb.forEach(o),eg=s(Ps," forward method, overrides the "),Zr=r(Ps,"CODE",{});var cb=i(Zr);tg=s(cb,"__call__"),cb.forEach(o),og=s(Ps," special method."),Ps.forEach(o),ng=p(It),y(vt.$$.fragment,It),sg=p(It),y(bt.$$.fragment,It),It.forEach(o),zt.forEach(o),rl=p(t),Ve=r(t,"H2",{class:!0});var Pl=i(Ve);Mt=r(Pl,"A",{id:!0,class:!0,href:!0});var db=i(Mt);Wr=r(db,"SPAN",{});var pb=i(Wr);y(yn.$$.fragment,pb),pb.forEach(o),db.forEach(o),ag=p(Pl),Nr=r(Pl,"SPAN",{});var mb=i(Nr);rg=s(mb,"LayoutLMv2ForQuestionAnswering"),mb.forEach(o),Pl.forEach(o),il=p(t),ne=r(t,"DIV",{class:!0});var Ct=i(ne);y(_n.$$.fragment,Ct),ig=p(Ct),pe=r(Ct,"P",{});var $t=i(pe);lg=s($t,`LayoutLMv2 Model with a span classification head on top for extractive question-answering tasks such as
`),vn=r($t,"A",{href:!0,rel:!0});var ub=i(vn);cg=s(ub,"DocVQA"),ub.forEach(o),dg=s($t,` (a linear layer on top of the text part of the hidden-states output to
compute `),Rr=r($t,"CODE",{});var hb=i(Rr);pg=s(hb,"span start logits"),hb.forEach(o),mg=s($t," and "),qr=r($t,"CODE",{});var fb=i(qr);ug=s(fb,"span end logits"),fb.forEach(o),hg=s($t,")."),$t.forEach(o),fg=p(Ct),bn=r(Ct,"P",{});var Vl=i(bn);gg=s(Vl,"This model is a PyTorch "),Mn=r(Vl,"A",{href:!0,rel:!0});var gb=i(Mn);yg=s(gb,"torch.nn.Module"),gb.forEach(o),_g=s(Vl,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Vl.forEach(o),vg=p(Ct),W=r(Ct,"DIV",{class:!0});var Q=i(W);y(wn.$$.fragment,Q),bg=p(Q),Se=r(Q,"P",{});var Vs=i(Se);Mg=s(Vs,"The "),Es=r(Vs,"A",{href:!0});var yb=i(Es);wg=s(yb,"LayoutLMv2ForQuestionAnswering"),yb.forEach(o),Lg=s(Vs," forward method, overrides the "),Br=r(Vs,"CODE",{});var _b=i(Br);kg=s(_b,"__call__"),_b.forEach(o),Tg=s(Vs," special method."),Vs.forEach(o),xg=p(Q),y(wt.$$.fragment,Q),jg=p(Q),Ar=r(Q,"P",{});var vb=i(Ar);Jg=s(vb,"Example:"),vb.forEach(o),Ug=p(Q),Gr=r(Q,"P",{});var bb=i(Gr);Eg=s(bb,`In this example below, we give the LayoutLMv2 model an image (of texts) and ask it a question. 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).`),bb.forEach(o),zg=p(Q),y(Lt.$$.fragment,Q),Ig=p(Q),y(kt.$$.fragment,Q),Q.forEach(o),Ct.forEach(o),this.h()},h(){l(h,"name","hf:doc:metadata"),l(h,"content",JSON.stringify(Wb)),l(w,"id","layoutlmv2"),l(w,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(w,"href","#layoutlmv2"),l(f,"class","relative group"),l(Qe,"id","overview"),l(Qe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Qe,"href","#overview"),l(je,"class","relative group"),l(Zt,"href","https://arxiv.org/abs/2012.14740"),l(Zt,"rel","nofollow"),l(Tn,"href","layoutlm"),l(Wt,"href","https://guillaumejaume.github.io/FUNSD/"),l(Wt,"rel","nofollow"),l(Nt,"href","https://github.com/clovaai/cord"),l(Nt,"rel","nofollow"),l(Rt,"href","https://rrc.cvc.uab.es/?ch=13"),l(Rt,"rel","nofollow"),l(qt,"href","https://github.com/applicaai/kleister-nda"),l(qt,"rel","nofollow"),l(At,"href","https://www.cs.cmu.edu/~aharley/rvl-cdip/"),l(At,"rel","nofollow"),l(Xt,"href","https://arxiv.org/abs/2007.00398"),l(Xt,"rel","nofollow"),l(St,"href","https://arxiv.org/abs/2012.14740"),l(St,"rel","nofollow"),l(Qt,"href","https://github.com/NielsRogge/Transformers-Tutorials"),l(Qt,"rel","nofollow"),l(Yt,"href","https://github.com/facebookresearch/detectron2/"),l(Yt,"rel","nofollow"),l(Ot,"href","https://detectron2.readthedocs.io/en/latest/tutorials/install.html"),l(Ot,"rel","nofollow"),l(En,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Model.forward"),l(zn,"href","/docs/transformers/main/en/model_doc/layoutlm#transformers.LayoutLMModel"),l(Ht,"href","https://github.com/tesseract-ocr/tesseract"),l(Ht,"rel","nofollow"),l(Kt,"href","https://pypi.org/project/pytesseract/"),l(Kt,"rel","nofollow"),l(In,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Processor"),l(Cn,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Model"),l($n,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Config"),l(Fn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained"),l(Zn,"href","layoutxlm"),l(He,"id","resources"),l(He,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(He,"href","#resources"),l(Ue,"class","relative group"),l(io,"href","https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLMv2/RVL-CDIP/Fine_tuning_LayoutLMv2ForSequenceClassification_on_RVL_CDIP.ipynb"),l(io,"rel","nofollow"),l(Rn,"href","../tasks/sequence_classification"),l(po,"href","https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLMv2/DocVQA/Fine_tuning_LayoutLMv2ForQuestionAnswering_on_DocVQA.ipynb"),l(po,"rel","nofollow"),l(Bn,"href","../tasks/question_answering"),l(Gn,"href","../tasks/document_question_answering"),l(ho,"href","https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLMv2/CORD/Fine_tuning_LayoutLMv2ForTokenClassification_on_CORD.ipynb"),l(ho,"rel","nofollow"),l(go,"href","https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLMv2/FUNSD/Fine_tuning_LayoutLMv2ForTokenClassification_on_FUNSD_using_HuggingFace_Trainer.ipynb"),l(go,"rel","nofollow"),l(Pn,"href","../tasks/token_classification"),l(et,"id","usage-layoutlmv2processor"),l(et,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(et,"href","#usage-layoutlmv2processor"),l(Ee,"class","relative group"),l(Vn,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Processor"),l(Sn,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor"),l(Dn,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer"),l(Qn,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2TokenizerFast"),l(Yn,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Processor"),l(On,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor"),l(Hn,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer"),l(Kn,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2TokenizerFast"),l(es,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Processor"),l(vo,"href","https://pypi.org/project/pytesseract/"),l(vo,"rel","nofollow"),l(ts,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor"),l(tt,"id","transformers.LayoutLMv2Config"),l(tt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(tt,"href","#transformers.LayoutLMv2Config"),l(ze,"class","relative group"),l(ps,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Model"),l(jo,"href","https://huggingface.co/microsoft/layoutlmv2-base-uncased"),l(jo,"rel","nofollow"),l(ms,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(us,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(nt,"id","transformers.LayoutLMv2FeatureExtractor"),l(nt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(nt,"href","#transformers.LayoutLMv2FeatureExtractor"),l($e,"class","relative group"),l(st,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(at,"id","transformers.LayoutLMv2ImageProcessor"),l(at,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(at,"href","#transformers.LayoutLMv2ImageProcessor"),l(Ze,"class","relative group"),l(rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(it,"id","transformers.LayoutLMv2Tokenizer"),l(it,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(it,"href","#transformers.LayoutLMv2Tokenizer"),l(We,"class","relative group"),l(hs,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer"),l(fs,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),l(ys,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer"),l(lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(_s,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ct,"id","transformers.LayoutLMv2TokenizerFast"),l(ct,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(ct,"href","#transformers.LayoutLMv2TokenizerFast"),l(Ne,"class","relative group"),l(vs,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),l(dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(pt,"id","transformers.LayoutLMv2Processor"),l(pt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(pt,"href","#transformers.LayoutLMv2Processor"),l(Re,"class","relative group"),l(Ms,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Processor"),l(ws,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor"),l(Ls,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer"),l(ks,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2TokenizerFast"),l(So,"href","/docs/transformers/main/en/model_doc/levit#transformers.LevitFeatureExtractor.__call__"),l(Ts,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor"),l(Do,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer.__call__"),l(xs,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor"),l(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(mt,"id","transformers.LayoutLMv2Model"),l(mt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(mt,"href","#transformers.LayoutLMv2Model"),l(qe,"class","relative group"),l(Ho,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Ho,"rel","nofollow"),l(js,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2Model"),l(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ft,"id","transformers.LayoutLMv2ForSequenceClassification"),l(ft,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(ft,"href","#transformers.LayoutLMv2ForSequenceClassification"),l(Ae,"class","relative group"),l(nn,"href","https://www.cs.cmu.edu/~aharley/rvl-cdip/"),l(nn,"rel","nofollow"),l(an,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(an,"rel","nofollow"),l(Js,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2ForSequenceClassification"),l(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(_t,"id","transformers.LayoutLMv2ForTokenClassification"),l(_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"),l(_t,"href","#transformers.LayoutLMv2ForTokenClassification"),l(Xe,"class","relative group"),l(dn,"href","https://guillaumejaume.github.io/FUNSD/"),l(dn,"rel","nofollow"),l(pn,"href","https://rrc.cvc.uab.es/?ch=13"),l(pn,"rel","nofollow"),l(mn,"href","https://github.com/clovaai/cord"),l(mn,"rel","nofollow"),l(un,"href","https://github.com/applicaai/kleister-nda"),l(un,"rel","nofollow"),l(fn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(fn,"rel","nofollow"),l(Us,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2ForTokenClassification"),l(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Mt,"id","transformers.LayoutLMv2ForQuestionAnswering"),l(Mt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Mt,"href","#transformers.LayoutLMv2ForQuestionAnswering"),l(Ve,"class","relative group"),l(vn,"href","https://rrc.cvc.uab.es/?ch=17"),l(vn,"rel","nofollow"),l(Mn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Mn,"rel","nofollow"),l(Es,"href","/docs/transformers/main/en/model_doc/layoutlmv2#transformers.LayoutLMv2ForQuestionAnswering"),l(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,c){e(document.head,h),m(t,k,c),m(t,f,c),e(f,w),e(w,T),_(u,T,null),e(f,L),e(f,N),e(N,Dl),m(t,Or,c),m(t,je,c),e(je,Qe),e(Qe,Qs),_(Ft,Qs,null),e(je,Ql),e(je,Ys),e(Ys,Yl),m(t,Hr,c),m(t,ue,c),e(ue,Ol),e(ue,Zt),e(Zt,Hl),e(ue,Kl),e(ue,Tn),e(Tn,ec),e(ue,tc),m(t,Kr,c),m(t,he,c),e(he,O),e(O,oc),e(O,Wt),e(Wt,nc),e(O,sc),e(O,Nt),e(Nt,ac),e(O,rc),e(O,Rt),e(Rt,ic),e(O,lc),e(O,qt),e(qt,cc),e(O,dc),e(he,pc),e(he,Bt),e(Bt,mc),e(Bt,At),e(At,uc),e(Bt,hc),e(he,fc),e(he,Gt),e(Gt,gc),e(Gt,Xt),e(Xt,yc),e(Gt,_c),m(t,ei,c),m(t,xn,c),e(xn,vc),m(t,ti,c),m(t,jn,c),e(jn,Os),e(Os,bc),m(t,oi,c),m(t,se,c),e(se,Mc),e(se,Hs),e(Hs,wc),e(se,Lc),e(se,Ks),e(Ks,kc),e(se,Tc),e(se,ea),e(ea,xc),e(se,jc),m(t,ni,c),_(Pt,t,c),m(t,si,c),m(t,Jn,c),e(Jn,Jc),m(t,ai,c),m(t,Un,c),e(Un,Uc),m(t,ri,c),m(t,P,c),e(P,ta),e(ta,Ec),e(P,zc),e(P,Vt),e(Vt,Ic),e(Vt,St),e(St,Cc),e(Vt,$c),e(P,Fc),e(P,Dt),e(Dt,Zc),e(Dt,Qt),e(Qt,Wc),e(Dt,Nc),e(P,Rc),e(P,Je),e(Je,qc),e(Je,Yt),e(Yt,Bc),e(Je,Ac),e(Je,Ot),e(Ot,Gc),e(Je,Xc),e(P,Pc),e(P,x),e(x,Vc),e(x,oa),e(oa,Sc),e(x,Dc),e(x,En),e(En,Qc),e(x,Yc),e(x,na),e(na,Oc),e(x,Hc),e(x,sa),e(sa,Kc),e(x,ed),e(x,aa),e(aa,td),e(x,od),e(x,ra),e(ra,nd),e(x,sd),e(x,ia),e(ia,ad),e(x,rd),e(x,la),e(la,id),e(x,ld),e(x,ca),e(ca,cd),e(x,dd),e(x,zn),e(zn,pd),e(x,md),e(x,Ht),e(Ht,ud),e(x,hd),e(x,Kt),e(Kt,fd),e(x,gd),m(t,ii,c),_(eo,t,c),m(t,li,c),m(t,fe,c),e(fe,yd),e(fe,da),e(da,_d),e(fe,vd),e(fe,pa),e(pa,bd),e(fe,Md),m(t,ci,c),_(to,t,c),m(t,di,c),m(t,Ye,c),e(Ye,wd),e(Ye,In),e(In,Ld),e(Ye,kd),m(t,pi,c),m(t,ge,c),e(ge,Z),e(Z,Td),e(Z,Cn),e(Cn,xd),e(Z,jd),e(Z,ma),e(ma,Jd),e(Z,Ud),e(Z,ua),e(ua,Ed),e(Z,zd),e(Z,$n),e($n,Id),e(Z,Cd),e(Z,ha),e(ha,$d),e(Z,Fd),e(Z,fa),e(fa,Zd),e(Z,Wd),e(Z,ga),e(ga,Nd),e(Z,Rd),e(ge,qd),e(ge,oo),e(oo,Bd),e(oo,Fn),e(Fn,Ad),e(oo,Gd),e(ge,Xd),e(ge,no),e(no,Pd),e(no,ya),e(ya,Vd),e(no,Sd),m(t,mi,c),m(t,Oe,c),e(Oe,Dd),e(Oe,Zn),e(Zn,Qd),e(Oe,Yd),m(t,ui,c),m(t,Ue,c),e(Ue,He),e(He,_a),_(so,_a,null),e(Ue,Od),e(Ue,va),e(va,Hd),m(t,hi,c),m(t,Wn,c),e(Wn,Kd),m(t,fi,c),_(ao,t,c),m(t,gi,c),m(t,Ke,c),e(Ke,ro),e(ro,ep),e(ro,io),e(io,tp),e(ro,op),e(Ke,np),e(Ke,Nn),e(Nn,sp),e(Nn,Rn),e(Rn,ap),m(t,yi,c),_(lo,t,c),m(t,_i,c),m(t,ye,c),e(ye,co),e(co,rp),e(co,po),e(po,ip),e(co,lp),e(ye,cp),e(ye,qn),e(qn,dp),e(qn,Bn),e(Bn,pp),e(ye,mp),e(ye,An),e(An,up),e(An,Gn),e(Gn,hp),m(t,vi,c),_(mo,t,c),m(t,bi,c),m(t,_e,c),e(_e,uo),e(uo,fp),e(uo,ho),e(ho,gp),e(uo,yp),e(_e,_p),e(_e,fo),e(fo,vp),e(fo,go),e(go,bp),e(fo,Mp),e(_e,wp),e(_e,Xn),e(Xn,Lp),e(Xn,Pn),e(Pn,kp),m(t,Mi,c),m(t,Ee,c),e(Ee,et),e(et,ba),_(yo,ba,null),e(Ee,Tp),e(Ee,Ma),e(Ma,xp),m(t,wi,c),m(t,V,c),e(V,jp),e(V,Vn),e(Vn,Jp),e(V,Up),e(V,Sn),e(Sn,Ep),e(V,zp),e(V,Dn),e(Dn,Ip),e(V,Cp),e(V,Qn),e(Qn,$p),e(V,Fp),m(t,Li,c),_(_o,t,c),m(t,ki,c),m(t,J,c),e(J,Zp),e(J,Yn),e(Yn,Wp),e(J,Np),e(J,On),e(On,Rp),e(J,qp),e(J,wa),e(wa,Bp),e(J,Ap),e(J,Hn),e(Hn,Gp),e(J,Xp),e(J,Kn),e(Kn,Pp),e(J,Vp),e(J,La),e(La,Sp),e(J,Dp),e(J,ka),e(ka,Qp),e(J,Yp),e(J,Ta),e(Ta,Op),e(J,Hp),e(J,xa),e(xa,Kp),e(J,em),e(J,ja),e(ja,tm),e(J,om),m(t,Ti,c),m(t,A,c),e(A,es),e(es,nm),e(A,sm),e(A,vo),e(vo,am),e(A,rm),e(A,ts),e(ts,im),e(A,lm),e(A,Ja),e(Ja,cm),e(A,dm),e(A,Ua),e(Ua,pm),e(A,mm),m(t,xi,c),m(t,os,c),e(os,um),m(t,ji,c),m(t,ns,c),e(ns,Ea),e(Ea,hm),m(t,Ji,c),m(t,ss,c),e(ss,fm),m(t,Ui,c),_(bo,t,c),m(t,Ei,c),m(t,as,c),e(as,za),e(za,gm),m(t,zi,c),m(t,ve,c),e(ve,ym),e(ve,Ia),e(Ia,_m),e(ve,vm),e(ve,Ca),e(Ca,bm),e(ve,Mm),m(t,Ii,c),_(Mo,t,c),m(t,Ci,c),m(t,rs,c),e(rs,$a),e($a,wm),m(t,$i,c),m(t,S,c),e(S,Lm),e(S,Fa),e(Fa,km),e(S,Tm),e(S,Za),e(Za,xm),e(S,jm),e(S,Wa),e(Wa,Jm),e(S,Um),e(S,Na),e(Na,Em),e(S,zm),m(t,Fi,c),_(wo,t,c),m(t,Zi,c),m(t,is,c),e(is,Ra),e(Ra,Im),m(t,Wi,c),m(t,ls,c),e(ls,Cm),m(t,Ni,c),_(Lo,t,c),m(t,Ri,c),m(t,cs,c),e(cs,qa),e(qa,$m),m(t,qi,c),m(t,ds,c),e(ds,Fm),m(t,Bi,c),_(ko,t,c),m(t,Ai,c),m(t,ze,c),e(ze,tt),e(tt,Ba),_(To,Ba,null),e(ze,Zm),e(ze,Aa),e(Aa,Wm),m(t,Gi,c),m(t,H,c),_(xo,H,null),e(H,Nm),e(H,Ie),e(Ie,Rm),e(Ie,ps),e(ps,qm),e(Ie,Bm),e(Ie,jo),e(jo,Am),e(Ie,Gm),e(H,Xm),e(H,Ce),e(Ce,Pm),e(Ce,ms),e(ms,Vm),e(Ce,Sm),e(Ce,us),e(us,Dm),e(Ce,Qm),e(H,Ym),_(ot,H,null),m(t,Xi,c),m(t,$e,c),e($e,nt),e(nt,Ga),_(Jo,Ga,null),e($e,Om),e($e,Xa),e(Xa,Hm),m(t,Pi,c),m(t,Fe,c),_(Uo,Fe,null),e(Fe,Km),e(Fe,st),_(Eo,st,null),e(st,eu),e(st,Pa),e(Pa,tu),m(t,Vi,c),m(t,Ze,c),e(Ze,at),e(at,Va),_(zo,Va,null),e(Ze,ou),e(Ze,Sa),e(Sa,nu),m(t,Si,c),m(t,ce,c),_(Io,ce,null),e(ce,su),e(ce,Da),e(Da,au),e(ce,ru),e(ce,rt),_(Co,rt,null),e(rt,iu),e(rt,Qa),e(Qa,lu),m(t,Di,c),m(t,We,c),e(We,it),e(it,Ya),_($o,Ya,null),e(We,cu),e(We,Oa),e(Oa,du),m(t,Qi,c),m(t,R,c),_(Fo,R,null),e(R,pu),e(R,q),e(q,mu),e(q,hs),e(hs,uu),e(q,hu),e(q,Ha),e(Ha,fu),e(q,gu),e(q,Ka),e(Ka,yu),e(q,_u),e(q,er),e(er,vu),e(q,bu),e(q,tr),e(tr,Mu),e(q,wu),e(q,or),e(or,Lu),e(q,ku),e(R,Tu),e(R,Zo),e(Zo,xu),e(Zo,fs),e(fs,ju),e(Zo,Ju),e(R,Uu),e(R,gs),e(gs,ys),e(ys,Eu),e(gs,zu),e(R,Iu),e(R,lt),_(Wo,lt,null),e(lt,Cu),e(lt,nr),e(nr,$u),e(R,Fu),e(R,_s),_(No,_s,null),m(t,Yi,c),m(t,Ne,c),e(Ne,ct),e(ct,sr),_(Ro,sr,null),e(Ne,Zu),e(Ne,ar),e(ar,Wu),m(t,Oi,c),m(t,K,c),_(qo,K,null),e(K,Nu),e(K,Bo),e(Bo,Ru),e(Bo,rr),e(rr,qu),e(Bo,Bu),e(K,Au),e(K,Ao),e(Ao,Gu),e(Ao,vs),e(vs,Xu),e(Ao,Pu),e(K,Vu),e(K,dt),_(Go,dt,null),e(dt,Su),e(dt,ir),e(ir,Du),m(t,Hi,c),m(t,Re,c),e(Re,pt),e(pt,lr),_(Xo,lr,null),e(Re,Qu),e(Re,cr),e(cr,Yu),m(t,Ki,c),m(t,G,c),_(Po,G,null),e(G,Ou),e(G,dr),e(dr,Hu),e(G,Ku),e(G,bs),e(bs,Ms),e(Ms,eh),e(bs,th),e(G,oh),e(G,z),e(z,nh),e(z,ws),e(ws,sh),e(z,ah),e(z,Ls),e(Ls,rh),e(z,ih),e(z,ks),e(ks,lh),e(z,ch),e(z,pr),e(pr,dh),e(z,ph),e(z,mr),e(mr,mh),e(z,uh),e(z,ur),e(ur,hh),e(z,fh),e(z,hr),e(hr,gh),e(z,yh),e(z,fr),e(fr,_h),e(z,vh),e(z,gr),e(gr,bh),e(z,Mh),e(G,wh),e(G,be),_(Vo,be,null),e(be,Lh),e(be,j),e(j,kh),e(j,yr),e(yr,Th),e(j,xh),e(j,So),e(So,_r),e(_r,jh),e(So,Jh),e(j,Uh),e(j,Ts),e(Ts,Eh),e(j,zh),e(j,vr),e(vr,Ih),e(j,Ch),e(j,br),e(br,$h),e(j,Fh),e(j,Do),e(Do,Mr),e(Mr,Zh),e(Do,Wh),e(j,Nh),e(j,wr),e(wr,Rh),e(j,qh),e(j,xs),e(xs,Bh),e(j,Ah),e(j,Lr),e(Lr,Gh),e(j,Xh),e(j,kr),e(kr,Ph),e(j,Vh),e(j,Tr),e(Tr,Sh),e(j,Dh),e(j,xr),e(xr,Qh),e(j,Yh),e(be,Oh),e(be,jr),e(jr,Hh),m(t,el,c),m(t,qe,c),e(qe,mt),e(mt,Jr),_(Qo,Jr,null),e(qe,Kh),e(qe,Ur),e(Ur,ef),m(t,tl,c),m(t,de,c),_(Yo,de,null),e(de,tf),e(de,Oo),e(Oo,of),e(Oo,Ho),e(Ho,nf),e(Oo,sf),e(de,af),e(de,ae),_(Ko,ae,null),e(ae,rf),e(ae,Be),e(Be,lf),e(Be,js),e(js,cf),e(Be,df),e(Be,Er),e(Er,pf),e(Be,mf),e(ae,uf),_(ut,ae,null),e(ae,hf),_(ht,ae,null),m(t,ol,c),m(t,Ae,c),e(Ae,ft),e(ft,zr),_(en,zr,null),e(Ae,ff),e(Ae,Ir),e(Ir,gf),m(t,nl,c),m(t,ee,c),_(tn,ee,null),e(ee,yf),e(ee,on),e(on,_f),e(on,nn),e(nn,vf),e(on,bf),e(ee,Mf),e(ee,sn),e(sn,wf),e(sn,an),e(an,Lf),e(sn,kf),e(ee,Tf),e(ee,re),_(rn,re,null),e(re,xf),e(re,Ge),e(Ge,jf),e(Ge,Js),e(Js,Jf),e(Ge,Uf),e(Ge,Cr),e(Cr,Ef),e(Ge,zf),e(re,If),_(gt,re,null),e(re,Cf),_(yt,re,null),m(t,sl,c),m(t,Xe,c),e(Xe,_t),e(_t,$r),_(ln,$r,null),e(Xe,$f),e(Xe,Fr),e(Fr,Ff),m(t,al,c),m(t,te,c),_(cn,te,null),e(te,Zf),e(te,oe),e(oe,Wf),e(oe,dn),e(dn,Nf),e(oe,Rf),e(oe,pn),e(pn,qf),e(oe,Bf),e(oe,mn),e(mn,Af),e(oe,Gf),e(oe,un),e(un,Xf),e(oe,Pf),e(te,Vf),e(te,hn),e(hn,Sf),e(hn,fn),e(fn,Df),e(hn,Qf),e(te,Yf),e(te,ie),_(gn,ie,null),e(ie,Of),e(ie,Pe),e(Pe,Hf),e(Pe,Us),e(Us,Kf),e(Pe,eg),e(Pe,Zr),e(Zr,tg),e(Pe,og),e(ie,ng),_(vt,ie,null),e(ie,sg),_(bt,ie,null),m(t,rl,c),m(t,Ve,c),e(Ve,Mt),e(Mt,Wr),_(yn,Wr,null),e(Ve,ag),e(Ve,Nr),e(Nr,rg),m(t,il,c),m(t,ne,c),_(_n,ne,null),e(ne,ig),e(ne,pe),e(pe,lg),e(pe,vn),e(vn,cg),e(pe,dg),e(pe,Rr),e(Rr,pg),e(pe,mg),e(pe,qr),e(qr,ug),e(pe,hg),e(ne,fg),e(ne,bn),e(bn,gg),e(bn,Mn),e(Mn,yg),e(bn,_g),e(ne,vg),e(ne,W),_(wn,W,null),e(W,bg),e(W,Se),e(Se,Mg),e(Se,Es),e(Es,wg),e(Se,Lg),e(Se,Br),e(Br,kg),e(Se,Tg),e(W,xg),_(wt,W,null),e(W,jg),e(W,Ar),e(Ar,Jg),e(W,Ug),e(W,Gr),e(Gr,Eg),e(W,zg),_(Lt,W,null),e(W,Ig),_(kt,W,null),ll=!0},p(t,[c]){const Ln={};c&2&&(Ln.$$scope={dirty:c,ctx:t}),ot.$set(Ln);const Xr={};c&2&&(Xr.$$scope={dirty:c,ctx:t}),ut.$set(Xr);const Pr={};c&2&&(Pr.$$scope={dirty:c,ctx:t}),ht.$set(Pr);const Vr={};c&2&&(Vr.$$scope={dirty:c,ctx:t}),gt.$set(Vr);const kn={};c&2&&(kn.$$scope={dirty:c,ctx:t}),yt.$set(kn);const Sr={};c&2&&(Sr.$$scope={dirty:c,ctx:t}),vt.$set(Sr);const Dr={};c&2&&(Dr.$$scope={dirty:c,ctx:t}),bt.$set(Dr);const Qr={};c&2&&(Qr.$$scope={dirty:c,ctx:t}),wt.$set(Qr);const De={};c&2&&(De.$$scope={dirty:c,ctx:t}),Lt.$set(De);const Yr={};c&2&&(Yr.$$scope={dirty:c,ctx:t}),kt.$set(Yr)},i(t){ll||(v(u.$$.fragment,t),v(Ft.$$.fragment,t),v(Pt.$$.fragment,t),v(eo.$$.fragment,t),v(to.$$.fragment,t),v(so.$$.fragment,t),v(ao.$$.fragment,t),v(lo.$$.fragment,t),v(mo.$$.fragment,t),v(yo.$$.fragment,t),v(_o.$$.fragment,t),v(bo.$$.fragment,t),v(Mo.$$.fragment,t),v(wo.$$.fragment,t),v(Lo.$$.fragment,t),v(ko.$$.fragment,t),v(To.$$.fragment,t),v(xo.$$.fragment,t),v(ot.$$.fragment,t),v(Jo.$$.fragment,t),v(Uo.$$.fragment,t),v(Eo.$$.fragment,t),v(zo.$$.fragment,t),v(Io.$$.fragment,t),v(Co.$$.fragment,t),v($o.$$.fragment,t),v(Fo.$$.fragment,t),v(Wo.$$.fragment,t),v(No.$$.fragment,t),v(Ro.$$.fragment,t),v(qo.$$.fragment,t),v(Go.$$.fragment,t),v(Xo.$$.fragment,t),v(Po.$$.fragment,t),v(Vo.$$.fragment,t),v(Qo.$$.fragment,t),v(Yo.$$.fragment,t),v(Ko.$$.fragment,t),v(ut.$$.fragment,t),v(ht.$$.fragment,t),v(en.$$.fragment,t),v(tn.$$.fragment,t),v(rn.$$.fragment,t),v(gt.$$.fragment,t),v(yt.$$.fragment,t),v(ln.$$.fragment,t),v(cn.$$.fragment,t),v(gn.$$.fragment,t),v(vt.$$.fragment,t),v(bt.$$.fragment,t),v(yn.$$.fragment,t),v(_n.$$.fragment,t),v(wn.$$.fragment,t),v(wt.$$.fragment,t),v(Lt.$$.fragment,t),v(kt.$$.fragment,t),ll=!0)},o(t){b(u.$$.fragment,t),b(Ft.$$.fragment,t),b(Pt.$$.fragment,t),b(eo.$$.fragment,t),b(to.$$.fragment,t),b(so.$$.fragment,t),b(ao.$$.fragment,t),b(lo.$$.fragment,t),b(mo.$$.fragment,t),b(yo.$$.fragment,t),b(_o.$$.fragment,t),b(bo.$$.fragment,t),b(Mo.$$.fragment,t),b(wo.$$.fragment,t),b(Lo.$$.fragment,t),b(ko.$$.fragment,t),b(To.$$.fragment,t),b(xo.$$.fragment,t),b(ot.$$.fragment,t),b(Jo.$$.fragment,t),b(Uo.$$.fragment,t),b(Eo.$$.fragment,t),b(zo.$$.fragment,t),b(Io.$$.fragment,t),b(Co.$$.fragment,t),b($o.$$.fragment,t),b(Fo.$$.fragment,t),b(Wo.$$.fragment,t),b(No.$$.fragment,t),b(Ro.$$.fragment,t),b(qo.$$.fragment,t),b(Go.$$.fragment,t),b(Xo.$$.fragment,t),b(Po.$$.fragment,t),b(Vo.$$.fragment,t),b(Qo.$$.fragment,t),b(Yo.$$.fragment,t),b(Ko.$$.fragment,t),b(ut.$$.fragment,t),b(ht.$$.fragment,t),b(en.$$.fragment,t),b(tn.$$.fragment,t),b(rn.$$.fragment,t),b(gt.$$.fragment,t),b(yt.$$.fragment,t),b(ln.$$.fragment,t),b(cn.$$.fragment,t),b(gn.$$.fragment,t),b(vt.$$.fragment,t),b(bt.$$.fragment,t),b(yn.$$.fragment,t),b(_n.$$.fragment,t),b(wn.$$.fragment,t),b(wt.$$.fragment,t),b(Lt.$$.fragment,t),b(kt.$$.fragment,t),ll=!1},d(t){o(h),t&&o(k),t&&o(f),M(u),t&&o(Or),t&&o(je),M(Ft),t&&o(Hr),t&&o(ue),t&&o(Kr),t&&o(he),t&&o(ei),t&&o(xn),t&&o(ti),t&&o(jn),t&&o(oi),t&&o(se),t&&o(ni),M(Pt,t),t&&o(si),t&&o(Jn),t&&o(ai),t&&o(Un),t&&o(ri),t&&o(P),t&&o(ii),M(eo,t),t&&o(li),t&&o(fe),t&&o(ci),M(to,t),t&&o(di),t&&o(Ye),t&&o(pi),t&&o(ge),t&&o(mi),t&&o(Oe),t&&o(ui),t&&o(Ue),M(so),t&&o(hi),t&&o(Wn),t&&o(fi),M(ao,t),t&&o(gi),t&&o(Ke),t&&o(yi),M(lo,t),t&&o(_i),t&&o(ye),t&&o(vi),M(mo,t),t&&o(bi),t&&o(_e),t&&o(Mi),t&&o(Ee),M(yo),t&&o(wi),t&&o(V),t&&o(Li),M(_o,t),t&&o(ki),t&&o(J),t&&o(Ti),t&&o(A),t&&o(xi),t&&o(os),t&&o(ji),t&&o(ns),t&&o(Ji),t&&o(ss),t&&o(Ui),M(bo,t),t&&o(Ei),t&&o(as),t&&o(zi),t&&o(ve),t&&o(Ii),M(Mo,t),t&&o(Ci),t&&o(rs),t&&o($i),t&&o(S),t&&o(Fi),M(wo,t),t&&o(Zi),t&&o(is),t&&o(Wi),t&&o(ls),t&&o(Ni),M(Lo,t),t&&o(Ri),t&&o(cs),t&&o(qi),t&&o(ds),t&&o(Bi),M(ko,t),t&&o(Ai),t&&o(ze),M(To),t&&o(Gi),t&&o(H),M(xo),M(ot),t&&o(Xi),t&&o($e),M(Jo),t&&o(Pi),t&&o(Fe),M(Uo),M(Eo),t&&o(Vi),t&&o(Ze),M(zo),t&&o(Si),t&&o(ce),M(Io),M(Co),t&&o(Di),t&&o(We),M($o),t&&o(Qi),t&&o(R),M(Fo),M(Wo),M(No),t&&o(Yi),t&&o(Ne),M(Ro),t&&o(Oi),t&&o(K),M(qo),M(Go),t&&o(Hi),t&&o(Re),M(Xo),t&&o(Ki),t&&o(G),M(Po),M(Vo),t&&o(el),t&&o(qe),M(Qo),t&&o(tl),t&&o(de),M(Yo),M(Ko),M(ut),M(ht),t&&o(ol),t&&o(Ae),M(en),t&&o(nl),t&&o(ee),M(tn),M(rn),M(gt),M(yt),t&&o(sl),t&&o(Xe),M(ln),t&&o(al),t&&o(te),M(cn),M(gn),M(vt),M(bt),t&&o(rl),t&&o(Ve),M(yn),t&&o(il),t&&o(ne),M(_n),M(wn),M(wt),M(Lt),M(kt)}}}const Wb={local:"layoutlmv2",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"usage-layoutlmv2processor",title:"Usage: LayoutLMv2Processor"},{local:"transformers.LayoutLMv2Config",title:"LayoutLMv2Config"},{local:"transformers.LayoutLMv2FeatureExtractor",title:"LayoutLMv2FeatureExtractor"},{local:"transformers.LayoutLMv2ImageProcessor",title:"LayoutLMv2ImageProcessor"},{local:"transformers.LayoutLMv2Tokenizer",title:"LayoutLMv2Tokenizer"},{local:"transformers.LayoutLMv2TokenizerFast",title:"LayoutLMv2TokenizerFast"},{local:"transformers.LayoutLMv2Processor",title:"LayoutLMv2Processor"},{local:"transformers.LayoutLMv2Model",title:"LayoutLMv2Model"},{local:"transformers.LayoutLMv2ForSequenceClassification",title:"LayoutLMv2ForSequenceClassification"},{local:"transformers.LayoutLMv2ForTokenClassification",title:"LayoutLMv2ForTokenClassification"},{local:"transformers.LayoutLMv2ForQuestionAnswering",title:"LayoutLMv2ForQuestionAnswering"}],title:"LayoutLMV2"};function Nb(I){return Tb(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Vb extends Mb{constructor(h){super();wb(this,h,Nb,Zb,Lb,{})}}export{Vb as default,Wb as metadata};
