import{s as rl,o as il,n as P}from"../chunks/scheduler.9bc65507.js";import{S as ll,i as cl,g as s,s as r,u as f,A as dl,h as a,f as t,c as i,j as h,v as g,y as d,k as p,o as n,a as l,w as y,d as _,t as v,x as b}from"../chunks/index.78c82d43.js";import{T as aa}from"../chunks/Tip.87d55b76.js";import{D as x}from"../chunks/Docstring.f3d04bd2.js";import{C}from"../chunks/CodeBlock.48618ec2.js";import{I as $}from"../chunks/IconCopyLink.bedaa44d.js";import{E as dn}from"../chunks/ExampleCodeBlock.872b014d.js";import{P as gr}from"../chunks/PipelineTag.75b0f707.js";function pl(T){let c,w="Example:",m,M,L;return M=new C({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(){c=s("p"),c.textContent=w,m=r(),f(M.$$.fragment)},l(u){c=a(u,"P",{"data-svelte-h":!0}),d(c)!=="svelte-11lpom8"&&(c.textContent=w),m=i(u),g(M.$$.fragment,u)},m(u,k){l(u,c,k),l(u,m,k),y(M,u,k),L=!0},p:P,i(u){L||(_(M.$$.fragment,u),L=!0)},o(u){v(M.$$.fragment,u),L=!1},d(u){u&&(t(c),t(m)),b(M,u)}}}function ml(T){let c,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){c=s("p"),c.innerHTML=w},l(m){c=a(m,"P",{"data-svelte-h":!0}),d(c)!=="svelte-fincs2"&&(c.innerHTML=w)},m(m,M){l(m,c,M)},p:P,d(m){m&&t(c)}}}function ul(T){let c,w="Examples:",m,M,L;return M=new C({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(){c=s("p"),c.textContent=w,m=r(),f(M.$$.fragment)},l(u){c=a(u,"P",{"data-svelte-h":!0}),d(c)!=="svelte-kvfsh7"&&(c.textContent=w),m=i(u),g(M.$$.fragment,u)},m(u,k){l(u,c,k),l(u,m,k),y(M,u,k),L=!0},p:P,i(u){L||(_(M.$$.fragment,u),L=!0)},o(u){v(M.$$.fragment,u),L=!1},d(u){u&&(t(c),t(m)),b(M,u)}}}function hl(T){let c,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){c=s("p"),c.innerHTML=w},l(m){c=a(m,"P",{"data-svelte-h":!0}),d(c)!=="svelte-fincs2"&&(c.innerHTML=w)},m(m,M){l(m,c,M)},p:P,d(m){m&&t(c)}}}function fl(T){let c,w="Example:",m,M,L;return M=new C({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(){c=s("p"),c.textContent=w,m=r(),f(M.$$.fragment)},l(u){c=a(u,"P",{"data-svelte-h":!0}),d(c)!=="svelte-11lpom8"&&(c.textContent=w),m=i(u),g(M.$$.fragment,u)},m(u,k){l(u,c,k),l(u,m,k),y(M,u,k),L=!0},p:P,i(u){L||(_(M.$$.fragment,u),L=!0)},o(u){v(M.$$.fragment,u),L=!1},d(u){u&&(t(c),t(m)),b(M,u)}}}function gl(T){let c,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){c=s("p"),c.innerHTML=w},l(m){c=a(m,"P",{"data-svelte-h":!0}),d(c)!=="svelte-fincs2"&&(c.innerHTML=w)},m(m,M){l(m,c,M)},p:P,d(m){m&&t(c)}}}function yl(T){let c,w="Example:",m,M,L;return M=new C({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(){c=s("p"),c.textContent=w,m=r(),f(M.$$.fragment)},l(u){c=a(u,"P",{"data-svelte-h":!0}),d(c)!=="svelte-11lpom8"&&(c.textContent=w),m=i(u),g(M.$$.fragment,u)},m(u,k){l(u,c,k),l(u,m,k),y(M,u,k),L=!0},p:P,i(u){L||(_(M.$$.fragment,u),L=!0)},o(u){v(M.$$.fragment,u),L=!1},d(u){u&&(t(c),t(m)),b(M,u)}}}function _l(T){let c,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){c=s("p"),c.innerHTML=w},l(m){c=a(m,"P",{"data-svelte-h":!0}),d(c)!=="svelte-fincs2"&&(c.innerHTML=w)},m(m,M){l(m,c,M)},p:P,d(m){m&&t(c)}}}function vl(T){let c,w;return c=new C({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(){f(c.$$.fragment)},l(m){g(c.$$.fragment,m)},m(m,M){y(c,m,M),w=!0},p:P,i(m){w||(_(c.$$.fragment,m),w=!0)},o(m){v(c.$$.fragment,m),w=!1},d(m){b(c,m)}}}function bl(T){let c,w;return c=new C({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(){f(c.$$.fragment)},l(m){g(c.$$.fragment,m)},m(m,M){y(c,m,M),w=!0},p:P,i(m){w||(_(c.$$.fragment,m),w=!0)},o(m){v(c.$$.fragment,m),w=!1},d(m){b(c,m)}}}function Ml(T){let c,w,m,M,L,u,k,Ge,ra,fo,yr="LayoutLMV2",zn,Q,ie,pn,Ee,ia,go,_r="Overview",$n,Ve,vr=`The LayoutLMV2 model was proposed in <a href="https://arxiv.org/abs/2012.14740" rel="nofollow">LayoutLMv2: Multi-modal Pre-training for Visually-Rich Document Understanding</a> 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 <a href="layoutlm">LayoutLM</a> to obtain
state-of-the-art results across several document image understanding benchmarks:`,In,Se,br=`<li>information extraction from scanned documents: the <a href="https://guillaumejaume.github.io/FUNSD/" rel="nofollow">FUNSD</a> dataset (a
collection of 199 annotated forms comprising more than 30,000 words), the <a href="https://github.com/clovaai/cord" rel="nofollow">CORD</a>
dataset (a collection of 800 receipts for training, 100 for validation and 100 for testing), the <a href="https://rrc.cvc.uab.es/?ch=13" rel="nofollow">SROIE</a> dataset (a collection of 626 receipts for training and 347 receipts for testing)
and the <a href="https://github.com/applicaai/kleister-nda" rel="nofollow">Kleister-NDA</a> 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).</li> <li>document image classification: the <a href="https://www.cs.cmu.edu/~aharley/rvl-cdip/" rel="nofollow">RVL-CDIP</a> dataset (a collection of
400,000 images belonging to one of 16 classes).</li> <li>document visual question answering: the <a href="https://arxiv.org/abs/2007.00398" rel="nofollow">DocVQA</a> dataset (a collection of 50,000
questions defined on 12,000+ document images).</li>`,Fn,Pe,Mr="The abstract from the paper is the following:",Zn,Qe,wr=`<em>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 -&gt; 0.8420), CORD (0.9493 -&gt; 0.9601), SROIE (0.9524 -&gt; 0.9781), Kleister-NDA (0.834 -&gt; 0.852),
RVL-CDIP (0.9443 -&gt; 0.9564), and DocVQA (0.7295 -&gt; 0.8672). The pre-trained LayoutLMv2 model is publicly available at
this https URL.</em>`,Wn,He,Lr=`LayoutLMv2 depends on <code>detectron2</code>, <code>torchvision</code> and <code>tesseract</code>. Run the
following to install them:`,Nn,Ye,Rn,Ae,Tr="(If you are developing for LayoutLMv2, note that passing the doctests also requires the installation of these packages.)",qn,De,kr="Tips:",Bn,Oe,xr=`<li>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).</li> <li>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 <a href="https://arxiv.org/abs/2012.14740" rel="nofollow">paper</a>.</li> <li>Demo notebooks on how to use the LayoutLMv2 model on RVL-CDIP, FUNSD, DocVQA, CORD can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials" rel="nofollow">here</a>.</li> <li>LayoutLMv2 uses Facebook AI’s <a href="https://github.com/facebookresearch/detectron2/" rel="nofollow">Detectron2</a> package for its visual
backbone. See <a href="https://detectron2.readthedocs.io/en/latest/tutorials/install.html" rel="nofollow">this link</a> for installation
instructions.</li> <li>In addition to <code>input_ids</code>, <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Model.forward">forward()</a> expects 2 additional inputs, namely
<code>image</code> and <code>bbox</code>. The <code>image</code> 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, <code>image</code> should be a tensor of shape (batch_size, 3, 224, 224). This can be either a
<code>torch.Tensor</code> or a <code>Detectron2.structures.ImageList</code>. You don’t 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 <code>bbox</code> input are the bounding boxes (i.e. 2D-positions)
of the input text tokens. This is identical to <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlm#transformers.LayoutLMModel">LayoutLMModel</a>. These can be obtained using an
external OCR engine such as Google’s <a href="https://github.com/tesseract-ocr/tesseract" rel="nofollow">Tesseract</a> (there’s a <a href="https://pypi.org/project/pytesseract/" rel="nofollow">Python
wrapper</a> available). Each bounding box should be in (x0, y0, x1, y1)
format, where (x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1, y1)
represents the position of the lower right corner. Note that one first needs to normalize the bounding boxes to be on
a 0-1000 scale. To normalize, you can use the following function:</li>`,Xn,Ke,Gn,et,jr=`Here, <code>width</code> and <code>height</code> 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:`,En,tt,Vn,ot,Jr=`However, this model includes a brand new <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Processor">LayoutLMv2Processor</a> which can be used to directly
prepare data for the model (including applying OCR under the hood). More information can be found in the “Usage”
section below.`,Sn,nt,Ur=`<li>Internally, <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Model">LayoutLMv2Model</a> will send the <code>image</code> input through its visual backbone to
obtain a lower-resolution feature map, whose shape is equal to the <code>image_feature_pool_shape</code> attribute of
<a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Config">LayoutLMv2Config</a>. 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 <code>seq_length</code> + <code>image_feature_pool_shape[0]</code> *
<code>config.image_feature_pool_shape[1]</code>.</li> <li>When calling <a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a>, 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.</li> <li>If you want to train the model in a distributed environment, make sure to call <code>synchronize_batch_norm</code> on the
model in order to properly synchronize the batch normalization layers of the visual backbone.</li>`,Pn,st,Cr=`In addition, there’s LayoutXLM, which is a multilingual version of LayoutLMv2. More information can be found on
<a href="layoutxlm">LayoutXLM’s documentation page</a>.`,Qn,H,le,mn,at,la,yo,zr="Resources",Hn,rt,$r="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with LayoutLMv2. If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",Yn,it,An,lt,Ir='<li>A notebook on how to <a href="https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLMv2/RVL-CDIP/Fine_tuning_LayoutLMv2ForSequenceClassification_on_RVL_CDIP.ipynb" rel="nofollow">finetune LayoutLMv2 for text-classification on RVL-CDIP dataset</a>.</li> <li>See also: <a href="../tasks/sequence_classification">Text classification task guide</a></li>',Dn,ct,On,dt,Fr='<li>A notebook on how to <a href="https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLMv2/DocVQA/Fine_tuning_LayoutLMv2ForQuestionAnswering_on_DocVQA.ipynb" rel="nofollow">finetune LayoutLMv2 for question-answering on DocVQA dataset</a>.</li> <li>See also: <a href="../tasks/question_answering">Question answering task guide</a></li> <li>See also: <a href="../tasks/document_question_answering">Document question answering task guide</a></li>',Kn,pt,es,mt,Zr='<li>A notebook on how to <a href="https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLMv2/CORD/Fine_tuning_LayoutLMv2ForTokenClassification_on_CORD.ipynb" rel="nofollow">finetune LayoutLMv2 for token-classification on CORD dataset</a>.</li> <li>A notebook on how to <a href="https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLMv2/FUNSD/Fine_tuning_LayoutLMv2ForTokenClassification_on_FUNSD_using_HuggingFace_Trainer.ipynb" rel="nofollow">finetune LayoutLMv2 for token-classification on FUNSD dataset</a>.</li> <li>See also: <a href="../tasks/token_classification">Token classification task guide</a></li>',ts,Y,ce,un,ut,ca,_o,Wr="Usage: LayoutLMv2Processor",os,ht,Nr=`The easiest way to prepare data for the model is to use <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Processor">LayoutLMv2Processor</a>, which internally
combines a image processor (<a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor">LayoutLMv2ImageProcessor</a>) and a tokenizer
(<a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer">LayoutLMv2Tokenizer</a> or <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2TokenizerFast">LayoutLMv2TokenizerFast</a>). 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.`,ns,ft,ss,gt,Rr=`In short, one can provide a document image (and possibly additional data) to <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Processor">LayoutLMv2Processor</a>,
and it will create the inputs expected by the model. Internally, the processor first uses
<a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor">LayoutLMv2ImageProcessor</a> 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 <code>image</code> input. The words and
normalized bounding boxes are then provided to <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer">LayoutLMv2Tokenizer</a> or
<a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2TokenizerFast">LayoutLMv2TokenizerFast</a>, which converts them to token-level <code>input_ids</code>,
<code>attention_mask</code>, <code>token_type_ids</code>, <code>bbox</code>. Optionally, one can provide word labels to the processor,
which are turned into token-level <code>labels</code>.`,as,yt,qr=`<a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Processor">LayoutLMv2Processor</a> uses <a href="https://pypi.org/project/pytesseract/" rel="nofollow">PyTesseract</a>, a Python
wrapper around Google’s 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
<a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor">LayoutLMv2ImageProcessor</a> with <code>apply_ocr</code> set to <code>False</code>.`,rs,_t,Br=`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).`,is,vt,Xr=`<strong>Use case 1: document image classification (training, inference) + token classification (inference), apply_ocr =
True</strong>`,ls,bt,Gr=`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.`,cs,Mt,ds,wt,Er="<strong>Use case 2: document image classification (training, inference) + token classification (inference), apply_ocr=False</strong>",ps,Lt,Vr=`In case one wants to do OCR themselves, one can initialize the image processor with <code>apply_ocr</code> set to
<code>False</code>. In that case, one should provide the words and corresponding (normalized) bounding boxes themselves to
the processor.`,ms,Tt,us,kt,Sr="<strong>Use case 3: token classification (training), apply_ocr=False</strong>",hs,xt,Pr=`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 <code>labels</code>. By default, it
will only label the first wordpiece of a word, and label the remaining wordpieces with -100, which is the
<code>ignore_index</code> of PyTorch’s CrossEntropyLoss. In case you want all wordpieces of a word to be labeled, you can
initialize the tokenizer with <code>only_label_first_subword</code> set to <code>False</code>.`,fs,jt,gs,Jt,Qr="<strong>Use case 4: visual question answering (inference), apply_ocr=True</strong>",ys,Ut,Hr=`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].`,_s,Ct,vs,zt,Yr="<strong>Use case 5: visual question answering (inference), apply_ocr=False</strong>",bs,$t,Ar=`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.`,Ms,It,ws,A,de,hn,Ft,da,vo,Dr="LayoutLMv2Config",Ls,I,Zt,pa,bo,Or=`This is the configuration class to store the configuration of a <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Model">LayoutLMv2Model</a>. 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
<a href="https://huggingface.co/microsoft/layoutlmv2-base-uncased" rel="nofollow">microsoft/layoutlmv2-base-uncased</a> architecture.`,ma,Mo,Kr=`Configuration objects inherit from <a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,ua,pe,Ts,D,me,fn,Wt,ha,wo,ei="LayoutLMv2FeatureExtractor",ks,O,Nt,fa,ue,Rt,ga,Lo,ti="Preprocess an image or a batch of images.",xs,K,he,gn,qt,ya,To,oi="LayoutLMv2ImageProcessor",js,G,Bt,_a,ko,ni="Constructs a LayoutLMv2 image processor.",va,fe,Xt,ba,xo,si="Preprocess an image or batch of images.",Js,ee,ge,yn,Gt,Ma,jo,ai="LayoutLMv2Tokenizer",Us,J,Et,wa,Jo,ri=`Construct a LayoutLMv2 tokenizer. Based on WordPiece. <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer">LayoutLMv2Tokenizer</a> can be used to turn words, word-level
bounding boxes and optional word labels to token-level <code>input_ids</code>, <code>attention_mask</code>, <code>token_type_ids</code>, <code>bbox</code>, and
optional <code>labels</code> (for token classification).`,La,Uo,ii=`This tokenizer inherits from <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a> which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`,Ta,Co,li=`<a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer">LayoutLMv2Tokenizer</a> runs end-to-end tokenization: punctuation splitting and wordpiece. It also turns the
word-level bounding boxes into token-level bounding boxes.`,ka,ye,Vt,xa,zo,ci=`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.`,ja,$o,St,Cs,te,_e,_n,Pt,Ja,Io,di="LayoutLMv2TokenizerFast",zs,F,Qt,Ua,Fo,pi="Construct a “fast” LayoutLMv2 tokenizer (backed by HuggingFace’s <em>tokenizers</em> library). Based on WordPiece.",Ca,Zo,mi=`This tokenizer inherits from <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a> which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`,za,ve,Ht,$a,Wo,ui=`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.`,$s,oe,be,vn,Yt,Ia,No,hi="LayoutLMv2Processor",Is,U,At,Fa,Ro,fi=`Constructs a LayoutLMv2 processor which combines a LayoutLMv2 image processor and a LayoutLMv2 tokenizer into a
single processor.`,Za,qo,gi='<a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Processor">LayoutLMv2Processor</a> offers all the functionalities you need to prepare data for the model.',Wa,Bo,yi=`It first uses <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor">LayoutLMv2ImageProcessor</a> to resize document images to a fixed size, and optionally applies OCR to
get words and normalized bounding boxes. These are then provided to <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer">LayoutLMv2Tokenizer</a> or
<a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2TokenizerFast">LayoutLMv2TokenizerFast</a>, which turns the words and bounding boxes into token-level <code>input_ids</code>,
<code>attention_mask</code>, <code>token_type_ids</code>, <code>bbox</code>. Optionally, one can provide integer <code>word_labels</code>, which are turned
into token-level <code>labels</code> for token classification tasks (such as FUNSD, CORD).`,Na,V,Dt,Ra,Xo,_i='This method first forwards the <code>images</code> argument to <a href="/docs/transformers/v4.33.3/en/model_doc/mobilevit#transformers.MobileViTFeatureExtractor.__call__"><strong>call</strong>()</a>. In case\n<a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor">LayoutLMv2ImageProcessor</a> was initialized with <code>apply_ocr</code> set to <code>True</code>, it passes the obtained words and\nbounding boxes along with the additional arguments to <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer.__call__"><strong>call</strong>()</a> and returns the output,\ntogether with resized <code>images</code>. In case <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2ImageProcessor">LayoutLMv2ImageProcessor</a> was initialized with <code>apply_ocr</code> set to\n<code>False</code>, it passes the words (<code>text</code>/<code>text_pair`) and `boxes` specified by the user along with the additional arguments to [__call__()](/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer.__call__) and returns the output, together with resized `images</code>.',qa,Go,vi="Please refer to the docstring of the above two methods for more information.",Fs,ne,Me,bn,Ot,Ba,Eo,bi="LayoutLMv2Model",Zs,E,Kt,Xa,Vo,Mi=`The bare LayoutLMv2 Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Ga,R,eo,Ea,So,wi='The <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Model">LayoutLMv2Model</a> forward method, overrides the <code>__call__</code> special method.',Va,we,Sa,Le,Ws,se,Te,Mn,to,Pa,Po,Li="LayoutLMv2ForSequenceClassification",Ns,Z,oo,Qa,Qo,Ti=`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
<a href="https://www.cs.cmu.edu/~aharley/rvl-cdip/" rel="nofollow">RVL-CDIP</a> dataset.`,Ha,Ho,ki=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Ya,q,no,Aa,Yo,xi='The <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2ForSequenceClassification">LayoutLMv2ForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',Da,ke,Oa,xe,Rs,ae,je,wn,so,Ka,Ao,ji="LayoutLMv2ForTokenClassification",qs,W,ao,er,Do,Ji=`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
<a href="https://guillaumejaume.github.io/FUNSD/" rel="nofollow">FUNSD</a>, <a href="https://rrc.cvc.uab.es/?ch=13" rel="nofollow">SROIE</a>,
<a href="https://github.com/clovaai/cord" rel="nofollow">CORD</a> and <a href="https://github.com/applicaai/kleister-nda" rel="nofollow">Kleister-NDA</a>.`,tr,Oo,Ui=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,or,B,ro,nr,Ko,Ci='The <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2ForTokenClassification">LayoutLMv2ForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',sr,Je,ar,Ue,Bs,re,Ce,Ln,io,rr,en,zi="LayoutLMv2ForQuestionAnswering",Xs,N,lo,ir,tn,$i=`LayoutLMv2 Model with a span classification head on top for extractive question-answering tasks such as
<a href="https://rrc.cvc.uab.es/?ch=17" rel="nofollow">DocVQA</a> (a linear layer on top of the text part of the hidden-states output to
compute <code>span start logits</code> and <code>span end logits</code>).`,lr,on,Ii=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,cr,j,co,dr,nn,Fi='The <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2ForQuestionAnswering">LayoutLMv2ForQuestionAnswering</a> forward method, overrides the <code>__call__</code> special method.',pr,ze,mr,sn,Zi="Example:",ur,an,Wi=`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).`,hr,$e,fr,Ie,Gs,Tn,Es;return Ge=new $({}),Ee=new $({}),Ye=new C({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`}}),Ke=new C({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)),
    ]`}}),tt=new C({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`}}),at=new $({}),it=new gr({props:{pipeline:"text-classification"}}),ct=new gr({props:{pipeline:"question-answering"}}),pt=new gr({props:{pipeline:"token-classification"}}),ut=new $({}),ft=new C({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)`}}),Mt=new C({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>`}}),Tt=new C({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>`}}),jt=new C({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>`}}),Ct=new C({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>`}}),It=new C({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>`}}),Ft=new $({}),Zt=new x({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/v4.33.3/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/v4.33.3/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/v4.33.3/src/transformers/models/layoutlmv2/configuration_layoutlmv2.py#L34"}}),pe=new dn({props:{anchor:"transformers.LayoutLMv2Config.example",$$slots:{default:[pl]},$$scope:{ctx:T}}}),Wt=new $({}),Nt=new x({props:{name:"class transformers.LayoutLMv2FeatureExtractor",anchor:"transformers.LayoutLMv2FeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/layoutlmv2/feature_extraction_layoutlmv2.py#L28"}}),Rt=new x({props:{name:"__call__",anchor:"transformers.LayoutLMv2FeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/image_processing_utils.py#L544"}}),qt=new $({}),Bt=new x({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/v4.33.3/src/transformers/models/layoutlmv2/image_processing_layoutlmv2.py#L93"}}),Xt=new x({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:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{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/v4.33.3/src/transformers/models/layoutlmv2/image_processing_layoutlmv2.py#L189"}}),Gt=new $({}),Et=new x({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/v4.33.3/src/transformers/models/layoutlmv2/tokenization_layoutlmv2.py#L206"}}),Vt=new x({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/v4.33.3/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/v4.33.3/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/v4.33.3/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/v4.33.3/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/v4.33.3/src/transformers/models/layoutlmv2/tokenization_layoutlmv2.py#L425",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a> with the following fields:</p>
<ul>
<li>
<p><strong>input_ids</strong> — 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> — List of bounding boxes to be fed to a model.</p>
</li>
<li>
<p><strong>token_type_ids</strong> — List of token type ids to be fed to a model (when <code>return_token_type_ids=True</code> or
if <em>“token_type_ids”</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> — List of indices specifying which tokens should be attended to by the model (when
<code>return_attention_mask=True</code> or if <em>“attention_mask”</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> — List of labels to be fed to a model. (when <code>word_labels</code> is specified).</p>
</li>
<li>
<p><strong>overflowing_tokens</strong> — 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> — 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> — 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> — The length of the inputs (when <code>return_length=True</code>).</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),St=new x({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/v4.33.3/src/transformers/models/layoutlmv2/tokenization_layoutlmv2.py#L405"}}),Pt=new $({}),Qt=new x({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/v4.33.3/src/transformers/models/layoutlmv2/tokenization_layoutlmv2_fast.py#L70"}}),Ht=new x({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/v4.33.3/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/v4.33.3/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/v4.33.3/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/v4.33.3/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/v4.33.3/src/transformers/models/layoutlmv2/tokenization_layoutlmv2_fast.py#L179",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a> with the following fields:</p>
<ul>
<li>
<p><strong>input_ids</strong> — 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> — List of bounding boxes to be fed to a model.</p>
</li>
<li>
<p><strong>token_type_ids</strong> — List of token type ids to be fed to a model (when <code>return_token_type_ids=True</code> or
if <em>“token_type_ids”</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> — List of indices specifying which tokens should be attended to by the model (when
<code>return_attention_mask=True</code> or if <em>“attention_mask”</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> — List of labels to be fed to a model. (when <code>word_labels</code> is specified).</p>
</li>
<li>
<p><strong>overflowing_tokens</strong> — 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> — 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> — 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> — The length of the inputs (when <code>return_length=True</code>).</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),Yt=new $({}),At=new x({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/v4.33.3/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/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2Tokenizer">LayoutLMv2Tokenizer</a> or <a href="/docs/transformers/v4.33.3/en/model_doc/layoutlmv2#transformers.LayoutLMv2TokenizerFast">LayoutLMv2TokenizerFast</a>. The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/layoutlmv2/processing_layoutlmv2.py#L27"}}),Dt=new x({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/v4.33.3/src/transformers/models/layoutlmv2/processing_layoutlmv2.py#L68"}}),Ot=new $({}),Kt=new x({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/v4.33.3/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/v4.33.3/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L713"}}),eo=new x({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/v4.33.3/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.33.3/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L823",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.3/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/v4.33.3/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>) — 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>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),we=new aa({props:{$$slots:{default:[ml]},$$scope:{ctx:T}}}),Le=new dn({props:{anchor:"transformers.LayoutLMv2Model.forward.example",$$slots:{default:[ul]},$$scope:{ctx:T}}}),to=new $({}),oo=new x({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/v4.33.3/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/v4.33.3/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L974"}}),no=new x({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/v4.33.3/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.33.3/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/v4.33.3/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L988",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.3/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) — Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ke=new aa({props:{$$slots:{default:[hl]},$$scope:{ctx:T}}}),xe=new dn({props:{anchor:"transformers.LayoutLMv2ForSequenceClassification.forward.example",$$slots:{default:[fl]},$$scope:{ctx:T}}}),so=new $({}),ao=new x({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/v4.33.3/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/v4.33.3/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L1156"}}),ro=new x({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/v4.33.3/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.33.3/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/v4.33.3/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L1170",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.3/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)  — Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) — Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Je=new aa({props:{$$slots:{default:[gl]},$$scope:{ctx:T}}}),Ue=new dn({props:{anchor:"transformers.LayoutLMv2ForTokenClassification.forward.example",$$slots:{default:[yl]},$$scope:{ctx:T}}}),io=new $({}),lo=new x({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/v4.33.3/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/v4.33.3/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L1287"}}),co=new x({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/v4.33.3/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.33.3/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/v4.33.3/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py#L1301",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.3/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) — Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) — Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) — Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ze=new aa({props:{$$slots:{default:[_l]},$$scope:{ctx:T}}}),$e=new dn({props:{anchor:"transformers.LayoutLMv2ForQuestionAnswering.forward.example",$$slots:{default:[vl]},$$scope:{ctx:T}}}),Ie=new dn({props:{anchor:"transformers.LayoutLMv2ForQuestionAnswering.forward.example-2",$$slots:{default:[bl]},$$scope:{ctx:T}}}),{c(){c=s("meta"),w=r(),m=s("p"),M=r(),L=s("h1"),u=s("a"),k=s("span"),f(Ge.$$.fragment),ra=r(),fo=s("span"),fo.textContent=yr,zn=r(),Q=s("h2"),ie=s("a"),pn=s("span"),f(Ee.$$.fragment),ia=r(),go=s("span"),go.textContent=_r,$n=r(),Ve=s("p"),Ve.innerHTML=vr,In=r(),Se=s("ul"),Se.innerHTML=br,Fn=r(),Pe=s("p"),Pe.textContent=Mr,Zn=r(),Qe=s("p"),Qe.innerHTML=wr,Wn=r(),He=s("p"),He.innerHTML=Lr,Nn=r(),f(Ye.$$.fragment),Rn=r(),Ae=s("p"),Ae.textContent=Tr,qn=r(),De=s("p"),De.textContent=kr,Bn=r(),Oe=s("ul"),Oe.innerHTML=xr,Xn=r(),f(Ke.$$.fragment),Gn=r(),et=s("p"),et.innerHTML=jr,En=r(),f(tt.$$.fragment),Vn=r(),ot=s("p"),ot.innerHTML=Jr,Sn=r(),nt=s("ul"),nt.innerHTML=Ur,Pn=r(),st=s("p"),st.innerHTML=Cr,Qn=r(),H=s("h2"),le=s("a"),mn=s("span"),f(at.$$.fragment),la=r(),yo=s("span"),yo.textContent=zr,Hn=r(),rt=s("p"),rt.textContent=$r,Yn=r(),f(it.$$.fragment),An=r(),lt=s("ul"),lt.innerHTML=Ir,Dn=r(),f(ct.$$.fragment),On=r(),dt=s("ul"),dt.innerHTML=Fr,Kn=r(),f(pt.$$.fragment),es=r(),mt=s("ul"),mt.innerHTML=Zr,ts=r(),Y=s("h2"),ce=s("a"),un=s("span"),f(ut.$$.fragment),ca=r(),_o=s("span"),_o.textContent=Wr,os=r(),ht=s("p"),ht.innerHTML=Nr,ns=r(),f(ft.$$.fragment),ss=r(),gt=s("p"),gt.innerHTML=Rr,as=r(),yt=s("p"),yt.innerHTML=qr,rs=r(),_t=s("p"),_t.textContent=Br,is=r(),vt=s("p"),vt.innerHTML=Xr,ls=r(),bt=s("p"),bt.textContent=Gr,cs=r(),f(Mt.$$.fragment),ds=r(),wt=s("p"),wt.innerHTML=Er,ps=r(),Lt=s("p"),Lt.innerHTML=Vr,ms=r(),f(Tt.$$.fragment),us=r(),kt=s("p"),kt.innerHTML=Sr,hs=r(),xt=s("p"),xt.innerHTML=Pr,fs=r(),f(jt.$$.fragment),gs=r(),Jt=s("p"),Jt.innerHTML=Qr,ys=r(),Ut=s("p"),Ut.textContent=Hr,_s=r(),f(Ct.$$.fragment),vs=r(),zt=s("p"),zt.innerHTML=Yr,bs=r(),$t=s("p"),$t.textContent=Ar,Ms=r(),f(It.$$.fragment),ws=r(),A=s("h2"),de=s("a"),hn=s("span"),f(Ft.$$.fragment),da=r(),vo=s("span"),vo.textContent=Dr,Ls=r(),I=s("div"),f(Zt.$$.fragment),pa=r(),bo=s("p"),bo.innerHTML=Or,ma=r(),Mo=s("p"),Mo.innerHTML=Kr,ua=r(),f(pe.$$.fragment),Ts=r(),D=s("h2"),me=s("a"),fn=s("span"),f(Wt.$$.fragment),ha=r(),wo=s("span"),wo.textContent=ei,ks=r(),O=s("div"),f(Nt.$$.fragment),fa=r(),ue=s("div"),f(Rt.$$.fragment),ga=r(),Lo=s("p"),Lo.textContent=ti,xs=r(),K=s("h2"),he=s("a"),gn=s("span"),f(qt.$$.fragment),ya=r(),To=s("span"),To.textContent=oi,js=r(),G=s("div"),f(Bt.$$.fragment),_a=r(),ko=s("p"),ko.textContent=ni,va=r(),fe=s("div"),f(Xt.$$.fragment),ba=r(),xo=s("p"),xo.textContent=si,Js=r(),ee=s("h2"),ge=s("a"),yn=s("span"),f(Gt.$$.fragment),Ma=r(),jo=s("span"),jo.textContent=ai,Us=r(),J=s("div"),f(Et.$$.fragment),wa=r(),Jo=s("p"),Jo.innerHTML=ri,La=r(),Uo=s("p"),Uo.innerHTML=ii,Ta=r(),Co=s("p"),Co.innerHTML=li,ka=r(),ye=s("div"),f(Vt.$$.fragment),xa=r(),zo=s("p"),zo.textContent=ci,ja=r(),$o=s("div"),f(St.$$.fragment),Cs=r(),te=s("h2"),_e=s("a"),_n=s("span"),f(Pt.$$.fragment),Ja=r(),Io=s("span"),Io.textContent=di,zs=r(),F=s("div"),f(Qt.$$.fragment),Ua=r(),Fo=s("p"),Fo.innerHTML=pi,Ca=r(),Zo=s("p"),Zo.innerHTML=mi,za=r(),ve=s("div"),f(Ht.$$.fragment),$a=r(),Wo=s("p"),Wo.textContent=ui,$s=r(),oe=s("h2"),be=s("a"),vn=s("span"),f(Yt.$$.fragment),Ia=r(),No=s("span"),No.textContent=hi,Is=r(),U=s("div"),f(At.$$.fragment),Fa=r(),Ro=s("p"),Ro.textContent=fi,Za=r(),qo=s("p"),qo.innerHTML=gi,Wa=r(),Bo=s("p"),Bo.innerHTML=yi,Na=r(),V=s("div"),f(Dt.$$.fragment),Ra=r(),Xo=s("p"),Xo.innerHTML=_i,qa=r(),Go=s("p"),Go.textContent=vi,Fs=r(),ne=s("h2"),Me=s("a"),bn=s("span"),f(Ot.$$.fragment),Ba=r(),Eo=s("span"),Eo.textContent=bi,Zs=r(),E=s("div"),f(Kt.$$.fragment),Xa=r(),Vo=s("p"),Vo.innerHTML=Mi,Ga=r(),R=s("div"),f(eo.$$.fragment),Ea=r(),So=s("p"),So.innerHTML=wi,Va=r(),f(we.$$.fragment),Sa=r(),f(Le.$$.fragment),Ws=r(),se=s("h2"),Te=s("a"),Mn=s("span"),f(to.$$.fragment),Pa=r(),Po=s("span"),Po.textContent=Li,Ns=r(),Z=s("div"),f(oo.$$.fragment),Qa=r(),Qo=s("p"),Qo.innerHTML=Ti,Ha=r(),Ho=s("p"),Ho.innerHTML=ki,Ya=r(),q=s("div"),f(no.$$.fragment),Aa=r(),Yo=s("p"),Yo.innerHTML=xi,Da=r(),f(ke.$$.fragment),Oa=r(),f(xe.$$.fragment),Rs=r(),ae=s("h2"),je=s("a"),wn=s("span"),f(so.$$.fragment),Ka=r(),Ao=s("span"),Ao.textContent=ji,qs=r(),W=s("div"),f(ao.$$.fragment),er=r(),Do=s("p"),Do.innerHTML=Ji,tr=r(),Oo=s("p"),Oo.innerHTML=Ui,or=r(),B=s("div"),f(ro.$$.fragment),nr=r(),Ko=s("p"),Ko.innerHTML=Ci,sr=r(),f(Je.$$.fragment),ar=r(),f(Ue.$$.fragment),Bs=r(),re=s("h2"),Ce=s("a"),Ln=s("span"),f(io.$$.fragment),rr=r(),en=s("span"),en.textContent=zi,Xs=r(),N=s("div"),f(lo.$$.fragment),ir=r(),tn=s("p"),tn.innerHTML=$i,lr=r(),on=s("p"),on.innerHTML=Ii,cr=r(),j=s("div"),f(co.$$.fragment),dr=r(),nn=s("p"),nn.innerHTML=Fi,pr=r(),f(ze.$$.fragment),mr=r(),sn=s("p"),sn.textContent=Zi,ur=r(),an=s("p"),an.textContent=Wi,hr=r(),f($e.$$.fragment),fr=r(),f(Ie.$$.fragment),Gs=r(),Tn=s("p"),this.h()},l(e){const o=dl("svelte-1phssyn",document.head);c=a(o,"META",{name:!0,content:!0}),o.forEach(t),w=i(e),m=a(e,"P",{}),h(m).forEach(t),M=i(e),L=a(e,"H1",{class:!0});var po=h(L);u=a(po,"A",{id:!0,class:!0,href:!0});var kn=h(u);k=a(kn,"SPAN",{});var xn=h(k);g(Ge.$$.fragment,xn),xn.forEach(t),kn.forEach(t),ra=i(po),fo=a(po,"SPAN",{"data-svelte-h":!0}),d(fo)!=="svelte-12ks5ae"&&(fo.textContent=yr),po.forEach(t),zn=i(e),Q=a(e,"H2",{class:!0});var mo=h(Q);ie=a(mo,"A",{id:!0,class:!0,href:!0});var jn=h(ie);pn=a(jn,"SPAN",{});var Jn=h(pn);g(Ee.$$.fragment,Jn),Jn.forEach(t),jn.forEach(t),ia=i(mo),go=a(mo,"SPAN",{"data-svelte-h":!0}),d(go)!=="svelte-1jsw1pg"&&(go.textContent=_r),mo.forEach(t),$n=i(e),Ve=a(e,"P",{"data-svelte-h":!0}),d(Ve)!=="svelte-1izquq2"&&(Ve.innerHTML=vr),In=i(e),Se=a(e,"UL",{"data-svelte-h":!0}),d(Se)!=="svelte-yo1x23"&&(Se.innerHTML=br),Fn=i(e),Pe=a(e,"P",{"data-svelte-h":!0}),d(Pe)!=="svelte-vfdo9a"&&(Pe.textContent=Mr),Zn=i(e),Qe=a(e,"P",{"data-svelte-h":!0}),d(Qe)!=="svelte-186xar0"&&(Qe.innerHTML=wr),Wn=i(e),He=a(e,"P",{"data-svelte-h":!0}),d(He)!=="svelte-11fpk1m"&&(He.innerHTML=Lr),Nn=i(e),g(Ye.$$.fragment,e),Rn=i(e),Ae=a(e,"P",{"data-svelte-h":!0}),d(Ae)!=="svelte-esmvdn"&&(Ae.textContent=Tr),qn=i(e),De=a(e,"P",{"data-svelte-h":!0}),d(De)!=="svelte-axv494"&&(De.textContent=kr),Bn=i(e),Oe=a(e,"UL",{"data-svelte-h":!0}),d(Oe)!=="svelte-488513"&&(Oe.innerHTML=xr),Xn=i(e),g(Ke.$$.fragment,e),Gn=i(e),et=a(e,"P",{"data-svelte-h":!0}),d(et)!=="svelte-12t0qrc"&&(et.innerHTML=jr),En=i(e),g(tt.$$.fragment,e),Vn=i(e),ot=a(e,"P",{"data-svelte-h":!0}),d(ot)!=="svelte-8m5ksj"&&(ot.innerHTML=Jr),Sn=i(e),nt=a(e,"UL",{"data-svelte-h":!0}),d(nt)!=="svelte-hyxcaw"&&(nt.innerHTML=Ur),Pn=i(e),st=a(e,"P",{"data-svelte-h":!0}),d(st)!=="svelte-2ft1em"&&(st.innerHTML=Cr),Qn=i(e),H=a(e,"H2",{class:!0});var uo=h(H);le=a(uo,"A",{id:!0,class:!0,href:!0});var Un=h(le);mn=a(Un,"SPAN",{});var Cn=h(mn);g(at.$$.fragment,Cn),Cn.forEach(t),Un.forEach(t),la=i(uo),yo=a(uo,"SPAN",{"data-svelte-h":!0}),d(yo)!=="svelte-w4zzv6"&&(yo.textContent=zr),uo.forEach(t),Hn=i(e),rt=a(e,"P",{"data-svelte-h":!0}),d(rt)!=="svelte-3wsmvo"&&(rt.textContent=$r),Yn=i(e),g(it.$$.fragment,e),An=i(e),lt=a(e,"UL",{"data-svelte-h":!0}),d(lt)!=="svelte-1ltr886"&&(lt.innerHTML=Ir),Dn=i(e),g(ct.$$.fragment,e),On=i(e),dt=a(e,"UL",{"data-svelte-h":!0}),d(dt)!=="svelte-1ilbw0"&&(dt.innerHTML=Fr),Kn=i(e),g(pt.$$.fragment,e),es=i(e),mt=a(e,"UL",{"data-svelte-h":!0}),d(mt)!=="svelte-kes906"&&(mt.innerHTML=Zr),ts=i(e),Y=a(e,"H2",{class:!0});var ho=h(Y);ce=a(ho,"A",{id:!0,class:!0,href:!0});var Ni=h(ce);un=a(Ni,"SPAN",{});var Ri=h(un);g(ut.$$.fragment,Ri),Ri.forEach(t),Ni.forEach(t),ca=i(ho),_o=a(ho,"SPAN",{"data-svelte-h":!0}),d(_o)!=="svelte-9b8hf1"&&(_o.textContent=Wr),ho.forEach(t),os=i(e),ht=a(e,"P",{"data-svelte-h":!0}),d(ht)!=="svelte-zhs4rj"&&(ht.innerHTML=Nr),ns=i(e),g(ft.$$.fragment,e),ss=i(e),gt=a(e,"P",{"data-svelte-h":!0}),d(gt)!=="svelte-1r6j3s0"&&(gt.innerHTML=Rr),as=i(e),yt=a(e,"P",{"data-svelte-h":!0}),d(yt)!=="svelte-1mvkbov"&&(yt.innerHTML=qr),rs=i(e),_t=a(e,"P",{"data-svelte-h":!0}),d(_t)!=="svelte-jv0had"&&(_t.textContent=Br),is=i(e),vt=a(e,"P",{"data-svelte-h":!0}),d(vt)!=="svelte-xm6lld"&&(vt.innerHTML=Xr),ls=i(e),bt=a(e,"P",{"data-svelte-h":!0}),d(bt)!=="svelte-89ax5f"&&(bt.textContent=Gr),cs=i(e),g(Mt.$$.fragment,e),ds=i(e),wt=a(e,"P",{"data-svelte-h":!0}),d(wt)!=="svelte-2qgjup"&&(wt.innerHTML=Er),ps=i(e),Lt=a(e,"P",{"data-svelte-h":!0}),d(Lt)!=="svelte-1somw74"&&(Lt.innerHTML=Vr),ms=i(e),g(Tt.$$.fragment,e),us=i(e),kt=a(e,"P",{"data-svelte-h":!0}),d(kt)!=="svelte-fyy19w"&&(kt.innerHTML=Sr),hs=i(e),xt=a(e,"P",{"data-svelte-h":!0}),d(xt)!=="svelte-lrirhw"&&(xt.innerHTML=Pr),fs=i(e),g(jt.$$.fragment,e),gs=i(e),Jt=a(e,"P",{"data-svelte-h":!0}),d(Jt)!=="svelte-v8fxei"&&(Jt.innerHTML=Qr),ys=i(e),Ut=a(e,"P",{"data-svelte-h":!0}),d(Ut)!=="svelte-ctx9i7"&&(Ut.textContent=Hr),_s=i(e),g(Ct.$$.fragment,e),vs=i(e),zt=a(e,"P",{"data-svelte-h":!0}),d(zt)!=="svelte-14vwjoy"&&(zt.innerHTML=Yr),bs=i(e),$t=a(e,"P",{"data-svelte-h":!0}),d($t)!=="svelte-17mqtdd"&&($t.textContent=Ar),Ms=i(e),g(It.$$.fragment,e),ws=i(e),A=a(e,"H2",{class:!0});var Vs=h(A);de=a(Vs,"A",{id:!0,class:!0,href:!0});var qi=h(de);hn=a(qi,"SPAN",{});var Bi=h(hn);g(Ft.$$.fragment,Bi),Bi.forEach(t),qi.forEach(t),da=i(Vs),vo=a(Vs,"SPAN",{"data-svelte-h":!0}),d(vo)!=="svelte-15o1y3s"&&(vo.textContent=Dr),Vs.forEach(t),Ls=i(e),I=a(e,"DIV",{class:!0});var Fe=h(I);g(Zt.$$.fragment,Fe),pa=i(Fe),bo=a(Fe,"P",{"data-svelte-h":!0}),d(bo)!=="svelte-1jt2hom"&&(bo.innerHTML=Or),ma=i(Fe),Mo=a(Fe,"P",{"data-svelte-h":!0}),d(Mo)!=="svelte-cfh5wl"&&(Mo.innerHTML=Kr),ua=i(Fe),g(pe.$$.fragment,Fe),Fe.forEach(t),Ts=i(e),D=a(e,"H2",{class:!0});var Ss=h(D);me=a(Ss,"A",{id:!0,class:!0,href:!0});var Xi=h(me);fn=a(Xi,"SPAN",{});var Gi=h(fn);g(Wt.$$.fragment,Gi),Gi.forEach(t),Xi.forEach(t),ha=i(Ss),wo=a(Ss,"SPAN",{"data-svelte-h":!0}),d(wo)!=="svelte-vxqcss"&&(wo.textContent=ei),Ss.forEach(t),ks=i(e),O=a(e,"DIV",{class:!0});var Ps=h(O);g(Nt.$$.fragment,Ps),fa=i(Ps),ue=a(Ps,"DIV",{class:!0});var Qs=h(ue);g(Rt.$$.fragment,Qs),ga=i(Qs),Lo=a(Qs,"P",{"data-svelte-h":!0}),d(Lo)!=="svelte-khengj"&&(Lo.textContent=ti),Qs.forEach(t),Ps.forEach(t),xs=i(e),K=a(e,"H2",{class:!0});var Hs=h(K);he=a(Hs,"A",{id:!0,class:!0,href:!0});var Ei=h(he);gn=a(Ei,"SPAN",{});var Vi=h(gn);g(qt.$$.fragment,Vi),Vi.forEach(t),Ei.forEach(t),ya=i(Hs),To=a(Hs,"SPAN",{"data-svelte-h":!0}),d(To)!=="svelte-s9las3"&&(To.textContent=oi),Hs.forEach(t),js=i(e),G=a(e,"DIV",{class:!0});var rn=h(G);g(Bt.$$.fragment,rn),_a=i(rn),ko=a(rn,"P",{"data-svelte-h":!0}),d(ko)!=="svelte-1agvf8h"&&(ko.textContent=ni),va=i(rn),fe=a(rn,"DIV",{class:!0});var Ys=h(fe);g(Xt.$$.fragment,Ys),ba=i(Ys),xo=a(Ys,"P",{"data-svelte-h":!0}),d(xo)!=="svelte-1x3yxsa"&&(xo.textContent=si),Ys.forEach(t),rn.forEach(t),Js=i(e),ee=a(e,"H2",{class:!0});var As=h(ee);ge=a(As,"A",{id:!0,class:!0,href:!0});var Si=h(ge);yn=a(Si,"SPAN",{});var Pi=h(yn);g(Gt.$$.fragment,Pi),Pi.forEach(t),Si.forEach(t),Ma=i(As),jo=a(As,"SPAN",{"data-svelte-h":!0}),d(jo)!=="svelte-1hgxhnh"&&(jo.textContent=ai),As.forEach(t),Us=i(e),J=a(e,"DIV",{class:!0});var X=h(J);g(Et.$$.fragment,X),wa=i(X),Jo=a(X,"P",{"data-svelte-h":!0}),d(Jo)!=="svelte-er7g8"&&(Jo.innerHTML=ri),La=i(X),Uo=a(X,"P",{"data-svelte-h":!0}),d(Uo)!=="svelte-14xlfoy"&&(Uo.innerHTML=ii),Ta=i(X),Co=a(X,"P",{"data-svelte-h":!0}),d(Co)!=="svelte-zbes3z"&&(Co.innerHTML=li),ka=i(X),ye=a(X,"DIV",{class:!0});var Ds=h(ye);g(Vt.$$.fragment,Ds),xa=i(Ds),zo=a(Ds,"P",{"data-svelte-h":!0}),d(zo)!=="svelte-1w6bb17"&&(zo.textContent=ci),Ds.forEach(t),ja=i(X),$o=a(X,"DIV",{class:!0});var Qi=h($o);g(St.$$.fragment,Qi),Qi.forEach(t),X.forEach(t),Cs=i(e),te=a(e,"H2",{class:!0});var Os=h(te);_e=a(Os,"A",{id:!0,class:!0,href:!0});var Hi=h(_e);_n=a(Hi,"SPAN",{});var Yi=h(_n);g(Pt.$$.fragment,Yi),Yi.forEach(t),Hi.forEach(t),Ja=i(Os),Io=a(Os,"SPAN",{"data-svelte-h":!0}),d(Io)!=="svelte-139wr5b"&&(Io.textContent=di),Os.forEach(t),zs=i(e),F=a(e,"DIV",{class:!0});var Ze=h(F);g(Qt.$$.fragment,Ze),Ua=i(Ze),Fo=a(Ze,"P",{"data-svelte-h":!0}),d(Fo)!=="svelte-dt8ib9"&&(Fo.innerHTML=pi),Ca=i(Ze),Zo=a(Ze,"P",{"data-svelte-h":!0}),d(Zo)!=="svelte-10uwgx2"&&(Zo.innerHTML=mi),za=i(Ze),ve=a(Ze,"DIV",{class:!0});var Ks=h(ve);g(Ht.$$.fragment,Ks),$a=i(Ks),Wo=a(Ks,"P",{"data-svelte-h":!0}),d(Wo)!=="svelte-1w6bb17"&&(Wo.textContent=ui),Ks.forEach(t),Ze.forEach(t),$s=i(e),oe=a(e,"H2",{class:!0});var ea=h(oe);be=a(ea,"A",{id:!0,class:!0,href:!0});var Ai=h(be);vn=a(Ai,"SPAN",{});var Di=h(vn);g(Yt.$$.fragment,Di),Di.forEach(t),Ai.forEach(t),Ia=i(ea),No=a(ea,"SPAN",{"data-svelte-h":!0}),d(No)!=="svelte-11b9dgk"&&(No.textContent=hi),ea.forEach(t),Is=i(e),U=a(e,"DIV",{class:!0});var S=h(U);g(At.$$.fragment,S),Fa=i(S),Ro=a(S,"P",{"data-svelte-h":!0}),d(Ro)!=="svelte-1shjypf"&&(Ro.textContent=fi),Za=i(S),qo=a(S,"P",{"data-svelte-h":!0}),d(qo)!=="svelte-hbnb0e"&&(qo.innerHTML=gi),Wa=i(S),Bo=a(S,"P",{"data-svelte-h":!0}),d(Bo)!=="svelte-1elqeaf"&&(Bo.innerHTML=yi),Na=i(S),V=a(S,"DIV",{class:!0});var ln=h(V);g(Dt.$$.fragment,ln),Ra=i(ln),Xo=a(ln,"P",{"data-svelte-h":!0}),d(Xo)!=="svelte-1xci1v9"&&(Xo.innerHTML=_i),qa=i(ln),Go=a(ln,"P",{"data-svelte-h":!0}),d(Go)!=="svelte-ws0hzs"&&(Go.textContent=vi),ln.forEach(t),S.forEach(t),Fs=i(e),ne=a(e,"H2",{class:!0});var ta=h(ne);Me=a(ta,"A",{id:!0,class:!0,href:!0});var Oi=h(Me);bn=a(Oi,"SPAN",{});var Ki=h(bn);g(Ot.$$.fragment,Ki),Ki.forEach(t),Oi.forEach(t),Ba=i(ta),Eo=a(ta,"SPAN",{"data-svelte-h":!0}),d(Eo)!=="svelte-8kgm9p"&&(Eo.textContent=bi),ta.forEach(t),Zs=i(e),E=a(e,"DIV",{class:!0});var cn=h(E);g(Kt.$$.fragment,cn),Xa=i(cn),Vo=a(cn,"P",{"data-svelte-h":!0}),d(Vo)!=="svelte-1ch3tid"&&(Vo.innerHTML=Mi),Ga=i(cn),R=a(cn,"DIV",{class:!0});var We=h(R);g(eo.$$.fragment,We),Ea=i(We),So=a(We,"P",{"data-svelte-h":!0}),d(So)!=="svelte-94s8y4"&&(So.innerHTML=wi),Va=i(We),g(we.$$.fragment,We),Sa=i(We),g(Le.$$.fragment,We),We.forEach(t),cn.forEach(t),Ws=i(e),se=a(e,"H2",{class:!0});var oa=h(se);Te=a(oa,"A",{id:!0,class:!0,href:!0});var el=h(Te);Mn=a(el,"SPAN",{});var tl=h(Mn);g(to.$$.fragment,tl),tl.forEach(t),el.forEach(t),Pa=i(oa),Po=a(oa,"SPAN",{"data-svelte-h":!0}),d(Po)!=="svelte-65uf8e"&&(Po.textContent=Li),oa.forEach(t),Ns=i(e),Z=a(e,"DIV",{class:!0});var Ne=h(Z);g(oo.$$.fragment,Ne),Qa=i(Ne),Qo=a(Ne,"P",{"data-svelte-h":!0}),d(Qo)!=="svelte-1fnrdzy"&&(Qo.innerHTML=Ti),Ha=i(Ne),Ho=a(Ne,"P",{"data-svelte-h":!0}),d(Ho)!=="svelte-68lg8f"&&(Ho.innerHTML=ki),Ya=i(Ne),q=a(Ne,"DIV",{class:!0});var Re=h(q);g(no.$$.fragment,Re),Aa=i(Re),Yo=a(Re,"P",{"data-svelte-h":!0}),d(Yo)!=="svelte-d194nc"&&(Yo.innerHTML=xi),Da=i(Re),g(ke.$$.fragment,Re),Oa=i(Re),g(xe.$$.fragment,Re),Re.forEach(t),Ne.forEach(t),Rs=i(e),ae=a(e,"H2",{class:!0});var na=h(ae);je=a(na,"A",{id:!0,class:!0,href:!0});var ol=h(je);wn=a(ol,"SPAN",{});var nl=h(wn);g(so.$$.fragment,nl),nl.forEach(t),ol.forEach(t),Ka=i(na),Ao=a(na,"SPAN",{"data-svelte-h":!0}),d(Ao)!=="svelte-ofmphq"&&(Ao.textContent=ji),na.forEach(t),qs=i(e),W=a(e,"DIV",{class:!0});var qe=h(W);g(ao.$$.fragment,qe),er=i(qe),Do=a(qe,"P",{"data-svelte-h":!0}),d(Do)!=="svelte-14haz6"&&(Do.innerHTML=Ji),tr=i(qe),Oo=a(qe,"P",{"data-svelte-h":!0}),d(Oo)!=="svelte-68lg8f"&&(Oo.innerHTML=Ui),or=i(qe),B=a(qe,"DIV",{class:!0});var Be=h(B);g(ro.$$.fragment,Be),nr=i(Be),Ko=a(Be,"P",{"data-svelte-h":!0}),d(Ko)!=="svelte-dtk9kq"&&(Ko.innerHTML=Ci),sr=i(Be),g(Je.$$.fragment,Be),ar=i(Be),g(Ue.$$.fragment,Be),Be.forEach(t),qe.forEach(t),Bs=i(e),re=a(e,"H2",{class:!0});var sa=h(re);Ce=a(sa,"A",{id:!0,class:!0,href:!0});var sl=h(Ce);Ln=a(sl,"SPAN",{});var al=h(Ln);g(io.$$.fragment,al),al.forEach(t),sl.forEach(t),rr=i(sa),en=a(sa,"SPAN",{"data-svelte-h":!0}),d(en)!=="svelte-1rup0a7"&&(en.textContent=zi),sa.forEach(t),Xs=i(e),N=a(e,"DIV",{class:!0});var Xe=h(N);g(lo.$$.fragment,Xe),ir=i(Xe),tn=a(Xe,"P",{"data-svelte-h":!0}),d(tn)!=="svelte-5fetmu"&&(tn.innerHTML=$i),lr=i(Xe),on=a(Xe,"P",{"data-svelte-h":!0}),d(on)!=="svelte-68lg8f"&&(on.innerHTML=Ii),cr=i(Xe),j=a(Xe,"DIV",{class:!0});var z=h(j);g(co.$$.fragment,z),dr=i(z),nn=a(z,"P",{"data-svelte-h":!0}),d(nn)!=="svelte-1n800x0"&&(nn.innerHTML=Fi),pr=i(z),g(ze.$$.fragment,z),mr=i(z),sn=a(z,"P",{"data-svelte-h":!0}),d(sn)!=="svelte-11lpom8"&&(sn.textContent=Zi),ur=i(z),an=a(z,"P",{"data-svelte-h":!0}),d(an)!=="svelte-aqq2wx"&&(an.textContent=Wi),hr=i(z),g($e.$$.fragment,z),fr=i(z),g(Ie.$$.fragment,z),z.forEach(t),Xe.forEach(t),Gs=i(e),Tn=a(e,"P",{}),h(Tn).forEach(t),this.h()},h(){p(c,"name","hf:doc:metadata"),p(c,"content",JSON.stringify(wl)),p(u,"id","layoutlmv2"),p(u,"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"),p(u,"href","#layoutlmv2"),p(L,"class","relative group"),p(ie,"id","overview"),p(ie,"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"),p(ie,"href","#overview"),p(Q,"class","relative group"),p(le,"id","resources"),p(le,"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"),p(le,"href","#resources"),p(H,"class","relative group"),p(ce,"id","usage-layoutlmv2processor"),p(ce,"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"),p(ce,"href","#usage-layoutlmv2processor"),p(Y,"class","relative group"),p(de,"id","transformers.LayoutLMv2Config"),p(de,"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"),p(de,"href","#transformers.LayoutLMv2Config"),p(A,"class","relative group"),p(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(me,"id","transformers.LayoutLMv2FeatureExtractor"),p(me,"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"),p(me,"href","#transformers.LayoutLMv2FeatureExtractor"),p(D,"class","relative group"),p(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(he,"id","transformers.LayoutLMv2ImageProcessor"),p(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"),p(he,"href","#transformers.LayoutLMv2ImageProcessor"),p(K,"class","relative group"),p(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ge,"id","transformers.LayoutLMv2Tokenizer"),p(ge,"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"),p(ge,"href","#transformers.LayoutLMv2Tokenizer"),p(ee,"class","relative group"),p(ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p($o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(_e,"id","transformers.LayoutLMv2TokenizerFast"),p(_e,"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"),p(_e,"href","#transformers.LayoutLMv2TokenizerFast"),p(te,"class","relative group"),p(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(be,"id","transformers.LayoutLMv2Processor"),p(be,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(be,"href","#transformers.LayoutLMv2Processor"),p(oe,"class","relative group"),p(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Me,"id","transformers.LayoutLMv2Model"),p(Me,"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"),p(Me,"href","#transformers.LayoutLMv2Model"),p(ne,"class","relative group"),p(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Te,"id","transformers.LayoutLMv2ForSequenceClassification"),p(Te,"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"),p(Te,"href","#transformers.LayoutLMv2ForSequenceClassification"),p(se,"class","relative group"),p(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(je,"id","transformers.LayoutLMv2ForTokenClassification"),p(je,"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"),p(je,"href","#transformers.LayoutLMv2ForTokenClassification"),p(ae,"class","relative group"),p(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ce,"id","transformers.LayoutLMv2ForQuestionAnswering"),p(Ce,"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"),p(Ce,"href","#transformers.LayoutLMv2ForQuestionAnswering"),p(re,"class","relative group"),p(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,o){n(document.head,c),l(e,w,o),l(e,m,o),l(e,M,o),l(e,L,o),n(L,u),n(u,k),y(Ge,k,null),n(L,ra),n(L,fo),l(e,zn,o),l(e,Q,o),n(Q,ie),n(ie,pn),y(Ee,pn,null),n(Q,ia),n(Q,go),l(e,$n,o),l(e,Ve,o),l(e,In,o),l(e,Se,o),l(e,Fn,o),l(e,Pe,o),l(e,Zn,o),l(e,Qe,o),l(e,Wn,o),l(e,He,o),l(e,Nn,o),y(Ye,e,o),l(e,Rn,o),l(e,Ae,o),l(e,qn,o),l(e,De,o),l(e,Bn,o),l(e,Oe,o),l(e,Xn,o),y(Ke,e,o),l(e,Gn,o),l(e,et,o),l(e,En,o),y(tt,e,o),l(e,Vn,o),l(e,ot,o),l(e,Sn,o),l(e,nt,o),l(e,Pn,o),l(e,st,o),l(e,Qn,o),l(e,H,o),n(H,le),n(le,mn),y(at,mn,null),n(H,la),n(H,yo),l(e,Hn,o),l(e,rt,o),l(e,Yn,o),y(it,e,o),l(e,An,o),l(e,lt,o),l(e,Dn,o),y(ct,e,o),l(e,On,o),l(e,dt,o),l(e,Kn,o),y(pt,e,o),l(e,es,o),l(e,mt,o),l(e,ts,o),l(e,Y,o),n(Y,ce),n(ce,un),y(ut,un,null),n(Y,ca),n(Y,_o),l(e,os,o),l(e,ht,o),l(e,ns,o),y(ft,e,o),l(e,ss,o),l(e,gt,o),l(e,as,o),l(e,yt,o),l(e,rs,o),l(e,_t,o),l(e,is,o),l(e,vt,o),l(e,ls,o),l(e,bt,o),l(e,cs,o),y(Mt,e,o),l(e,ds,o),l(e,wt,o),l(e,ps,o),l(e,Lt,o),l(e,ms,o),y(Tt,e,o),l(e,us,o),l(e,kt,o),l(e,hs,o),l(e,xt,o),l(e,fs,o),y(jt,e,o),l(e,gs,o),l(e,Jt,o),l(e,ys,o),l(e,Ut,o),l(e,_s,o),y(Ct,e,o),l(e,vs,o),l(e,zt,o),l(e,bs,o),l(e,$t,o),l(e,Ms,o),y(It,e,o),l(e,ws,o),l(e,A,o),n(A,de),n(de,hn),y(Ft,hn,null),n(A,da),n(A,vo),l(e,Ls,o),l(e,I,o),y(Zt,I,null),n(I,pa),n(I,bo),n(I,ma),n(I,Mo),n(I,ua),y(pe,I,null),l(e,Ts,o),l(e,D,o),n(D,me),n(me,fn),y(Wt,fn,null),n(D,ha),n(D,wo),l(e,ks,o),l(e,O,o),y(Nt,O,null),n(O,fa),n(O,ue),y(Rt,ue,null),n(ue,ga),n(ue,Lo),l(e,xs,o),l(e,K,o),n(K,he),n(he,gn),y(qt,gn,null),n(K,ya),n(K,To),l(e,js,o),l(e,G,o),y(Bt,G,null),n(G,_a),n(G,ko),n(G,va),n(G,fe),y(Xt,fe,null),n(fe,ba),n(fe,xo),l(e,Js,o),l(e,ee,o),n(ee,ge),n(ge,yn),y(Gt,yn,null),n(ee,Ma),n(ee,jo),l(e,Us,o),l(e,J,o),y(Et,J,null),n(J,wa),n(J,Jo),n(J,La),n(J,Uo),n(J,Ta),n(J,Co),n(J,ka),n(J,ye),y(Vt,ye,null),n(ye,xa),n(ye,zo),n(J,ja),n(J,$o),y(St,$o,null),l(e,Cs,o),l(e,te,o),n(te,_e),n(_e,_n),y(Pt,_n,null),n(te,Ja),n(te,Io),l(e,zs,o),l(e,F,o),y(Qt,F,null),n(F,Ua),n(F,Fo),n(F,Ca),n(F,Zo),n(F,za),n(F,ve),y(Ht,ve,null),n(ve,$a),n(ve,Wo),l(e,$s,o),l(e,oe,o),n(oe,be),n(be,vn),y(Yt,vn,null),n(oe,Ia),n(oe,No),l(e,Is,o),l(e,U,o),y(At,U,null),n(U,Fa),n(U,Ro),n(U,Za),n(U,qo),n(U,Wa),n(U,Bo),n(U,Na),n(U,V),y(Dt,V,null),n(V,Ra),n(V,Xo),n(V,qa),n(V,Go),l(e,Fs,o),l(e,ne,o),n(ne,Me),n(Me,bn),y(Ot,bn,null),n(ne,Ba),n(ne,Eo),l(e,Zs,o),l(e,E,o),y(Kt,E,null),n(E,Xa),n(E,Vo),n(E,Ga),n(E,R),y(eo,R,null),n(R,Ea),n(R,So),n(R,Va),y(we,R,null),n(R,Sa),y(Le,R,null),l(e,Ws,o),l(e,se,o),n(se,Te),n(Te,Mn),y(to,Mn,null),n(se,Pa),n(se,Po),l(e,Ns,o),l(e,Z,o),y(oo,Z,null),n(Z,Qa),n(Z,Qo),n(Z,Ha),n(Z,Ho),n(Z,Ya),n(Z,q),y(no,q,null),n(q,Aa),n(q,Yo),n(q,Da),y(ke,q,null),n(q,Oa),y(xe,q,null),l(e,Rs,o),l(e,ae,o),n(ae,je),n(je,wn),y(so,wn,null),n(ae,Ka),n(ae,Ao),l(e,qs,o),l(e,W,o),y(ao,W,null),n(W,er),n(W,Do),n(W,tr),n(W,Oo),n(W,or),n(W,B),y(ro,B,null),n(B,nr),n(B,Ko),n(B,sr),y(Je,B,null),n(B,ar),y(Ue,B,null),l(e,Bs,o),l(e,re,o),n(re,Ce),n(Ce,Ln),y(io,Ln,null),n(re,rr),n(re,en),l(e,Xs,o),l(e,N,o),y(lo,N,null),n(N,ir),n(N,tn),n(N,lr),n(N,on),n(N,cr),n(N,j),y(co,j,null),n(j,dr),n(j,nn),n(j,pr),y(ze,j,null),n(j,mr),n(j,sn),n(j,ur),n(j,an),n(j,hr),y($e,j,null),n(j,fr),y(Ie,j,null),l(e,Gs,o),l(e,Tn,o),Es=!0},p(e,[o]){const po={};o&2&&(po.$$scope={dirty:o,ctx:e}),pe.$set(po);const kn={};o&2&&(kn.$$scope={dirty:o,ctx:e}),we.$set(kn);const xn={};o&2&&(xn.$$scope={dirty:o,ctx:e}),Le.$set(xn);const mo={};o&2&&(mo.$$scope={dirty:o,ctx:e}),ke.$set(mo);const jn={};o&2&&(jn.$$scope={dirty:o,ctx:e}),xe.$set(jn);const Jn={};o&2&&(Jn.$$scope={dirty:o,ctx:e}),Je.$set(Jn);const uo={};o&2&&(uo.$$scope={dirty:o,ctx:e}),Ue.$set(uo);const Un={};o&2&&(Un.$$scope={dirty:o,ctx:e}),ze.$set(Un);const Cn={};o&2&&(Cn.$$scope={dirty:o,ctx:e}),$e.$set(Cn);const ho={};o&2&&(ho.$$scope={dirty:o,ctx:e}),Ie.$set(ho)},i(e){Es||(_(Ge.$$.fragment,e),_(Ee.$$.fragment,e),_(Ye.$$.fragment,e),_(Ke.$$.fragment,e),_(tt.$$.fragment,e),_(at.$$.fragment,e),_(it.$$.fragment,e),_(ct.$$.fragment,e),_(pt.$$.fragment,e),_(ut.$$.fragment,e),_(ft.$$.fragment,e),_(Mt.$$.fragment,e),_(Tt.$$.fragment,e),_(jt.$$.fragment,e),_(Ct.$$.fragment,e),_(It.$$.fragment,e),_(Ft.$$.fragment,e),_(Zt.$$.fragment,e),_(pe.$$.fragment,e),_(Wt.$$.fragment,e),_(Nt.$$.fragment,e),_(Rt.$$.fragment,e),_(qt.$$.fragment,e),_(Bt.$$.fragment,e),_(Xt.$$.fragment,e),_(Gt.$$.fragment,e),_(Et.$$.fragment,e),_(Vt.$$.fragment,e),_(St.$$.fragment,e),_(Pt.$$.fragment,e),_(Qt.$$.fragment,e),_(Ht.$$.fragment,e),_(Yt.$$.fragment,e),_(At.$$.fragment,e),_(Dt.$$.fragment,e),_(Ot.$$.fragment,e),_(Kt.$$.fragment,e),_(eo.$$.fragment,e),_(we.$$.fragment,e),_(Le.$$.fragment,e),_(to.$$.fragment,e),_(oo.$$.fragment,e),_(no.$$.fragment,e),_(ke.$$.fragment,e),_(xe.$$.fragment,e),_(so.$$.fragment,e),_(ao.$$.fragment,e),_(ro.$$.fragment,e),_(Je.$$.fragment,e),_(Ue.$$.fragment,e),_(io.$$.fragment,e),_(lo.$$.fragment,e),_(co.$$.fragment,e),_(ze.$$.fragment,e),_($e.$$.fragment,e),_(Ie.$$.fragment,e),Es=!0)},o(e){v(Ge.$$.fragment,e),v(Ee.$$.fragment,e),v(Ye.$$.fragment,e),v(Ke.$$.fragment,e),v(tt.$$.fragment,e),v(at.$$.fragment,e),v(it.$$.fragment,e),v(ct.$$.fragment,e),v(pt.$$.fragment,e),v(ut.$$.fragment,e),v(ft.$$.fragment,e),v(Mt.$$.fragment,e),v(Tt.$$.fragment,e),v(jt.$$.fragment,e),v(Ct.$$.fragment,e),v(It.$$.fragment,e),v(Ft.$$.fragment,e),v(Zt.$$.fragment,e),v(pe.$$.fragment,e),v(Wt.$$.fragment,e),v(Nt.$$.fragment,e),v(Rt.$$.fragment,e),v(qt.$$.fragment,e),v(Bt.$$.fragment,e),v(Xt.$$.fragment,e),v(Gt.$$.fragment,e),v(Et.$$.fragment,e),v(Vt.$$.fragment,e),v(St.$$.fragment,e),v(Pt.$$.fragment,e),v(Qt.$$.fragment,e),v(Ht.$$.fragment,e),v(Yt.$$.fragment,e),v(At.$$.fragment,e),v(Dt.$$.fragment,e),v(Ot.$$.fragment,e),v(Kt.$$.fragment,e),v(eo.$$.fragment,e),v(we.$$.fragment,e),v(Le.$$.fragment,e),v(to.$$.fragment,e),v(oo.$$.fragment,e),v(no.$$.fragment,e),v(ke.$$.fragment,e),v(xe.$$.fragment,e),v(so.$$.fragment,e),v(ao.$$.fragment,e),v(ro.$$.fragment,e),v(Je.$$.fragment,e),v(Ue.$$.fragment,e),v(io.$$.fragment,e),v(lo.$$.fragment,e),v(co.$$.fragment,e),v(ze.$$.fragment,e),v($e.$$.fragment,e),v(Ie.$$.fragment,e),Es=!1},d(e){e&&(t(w),t(m),t(M),t(L),t(zn),t(Q),t($n),t(Ve),t(In),t(Se),t(Fn),t(Pe),t(Zn),t(Qe),t(Wn),t(He),t(Nn),t(Rn),t(Ae),t(qn),t(De),t(Bn),t(Oe),t(Xn),t(Gn),t(et),t(En),t(Vn),t(ot),t(Sn),t(nt),t(Pn),t(st),t(Qn),t(H),t(Hn),t(rt),t(Yn),t(An),t(lt),t(Dn),t(On),t(dt),t(Kn),t(es),t(mt),t(ts),t(Y),t(os),t(ht),t(ns),t(ss),t(gt),t(as),t(yt),t(rs),t(_t),t(is),t(vt),t(ls),t(bt),t(cs),t(ds),t(wt),t(ps),t(Lt),t(ms),t(us),t(kt),t(hs),t(xt),t(fs),t(gs),t(Jt),t(ys),t(Ut),t(_s),t(vs),t(zt),t(bs),t($t),t(Ms),t(ws),t(A),t(Ls),t(I),t(Ts),t(D),t(ks),t(O),t(xs),t(K),t(js),t(G),t(Js),t(ee),t(Us),t(J),t(Cs),t(te),t(zs),t(F),t($s),t(oe),t(Is),t(U),t(Fs),t(ne),t(Zs),t(E),t(Ws),t(se),t(Ns),t(Z),t(Rs),t(ae),t(qs),t(W),t(Bs),t(re),t(Xs),t(N),t(Gs),t(Tn)),t(c),b(Ge),b(Ee),b(Ye,e),b(Ke,e),b(tt,e),b(at),b(it,e),b(ct,e),b(pt,e),b(ut),b(ft,e),b(Mt,e),b(Tt,e),b(jt,e),b(Ct,e),b(It,e),b(Ft),b(Zt),b(pe),b(Wt),b(Nt),b(Rt),b(qt),b(Bt),b(Xt),b(Gt),b(Et),b(Vt),b(St),b(Pt),b(Qt),b(Ht),b(Yt),b(At),b(Dt),b(Ot),b(Kt),b(eo),b(we),b(Le),b(to),b(oo),b(no),b(ke),b(xe),b(so),b(ao),b(ro),b(Je),b(Ue),b(io),b(lo),b(co),b(ze),b($e),b(Ie)}}}const wl={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 Ll(T){return il(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $l extends ll{constructor(c){super(),cl(this,c,Ll,Ml,rl,{})}}export{$l as component};
