import{s as js,f as Cs,o as qs,n as fe}from"../chunks/scheduler.25b97de1.js";import{S as Fs,i as Js,g as r,s as n,r as h,A as Is,h as d,f as t,c as s,j as w,u,x as c,k as T,y as o,a as l,v as f,d as _,t as g,w as b}from"../chunks/index.d9030fc9.js";import{T as So}from"../chunks/Tip.baa67368.js";import{D as U}from"../chunks/Docstring.e257edda.js";import{C as Xo}from"../chunks/CodeBlock.e6cd0d95.js";import{E as Jn}from"../chunks/ExampleCodeBlock.20db4b6e.js";import{H as ue,E as Ls}from"../chunks/EditOnGithub.91d95064.js";function Bs(j){let i,v="This method is deprecated, <code>__call__</code> should be used instead.";return{c(){i=r("p"),i.innerHTML=v},l(p){i=d(p,"P",{"data-svelte-h":!0}),c(i)!=="svelte-1phrc72"&&(i.innerHTML=v)},m(p,k){l(p,i,k)},p:fe,d(p){p&&t(i)}}}function Ns(j){let i,v="This method is deprecated, <code>__call__</code> should be used instead.";return{c(){i=r("p"),i.innerHTML=v},l(p){i=d(p,"P",{"data-svelte-h":!0}),c(i)!=="svelte-1phrc72"&&(i.innerHTML=v)},m(p,k){l(p,i,k)},p:fe,d(p){p&&t(i)}}}function Gs(j){let i,v=`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(){i=r("p"),i.innerHTML=v},l(p){i=d(p,"P",{"data-svelte-h":!0}),c(i)!=="svelte-fincs2"&&(i.innerHTML=v)},m(p,k){l(p,i,k)},p:fe,d(p){p&&t(i)}}}function Ps(j){let i,v="Example:",p,k,x;return k=new Xo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBBdXRvTW9kZWwlMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQSUyMyUyMGxvYWQlMjBtb2RlbCUyMGFuZCUyMHByb2Nlc3NvciUwQSUyMyUyMGluJTIwdGhpcyUyMGNhc2UlMkMlMjB3ZSUyMGFscmVhZHklMjBoYXZlJTIwcGVyZm9ybWVkJTIwT0NSJTIwb3Vyc2VsdmVzJTBBJTIzJTIwc28lMjB3ZSUyMGluaXRpYWxpemUlMjB0aGUlMjBwcm9jZXNzb3IlMjB3aXRoJTIwJTYwYXBwbHlfb2NyJTNERmFsc2UlNjAlMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZ1ZG9wLWxhcmdlJTIyJTJDJTIwYXBwbHlfb2NyJTNERmFsc2UpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnVkb3AtbGFyZ2UlMjIpJTBBJTBBJTIzJTIwbG9hZCUyMGFuJTIwZXhhbXBsZSUyMGltYWdlJTJDJTIwYWxvbmclMjB3aXRoJTIwdGhlJTIwd29yZHMlMjBhbmQlMjBjb29yZGluYXRlcyUwQSUyMyUyMHdoaWNoJTIwd2VyZSUyMGV4dHJhY3RlZCUyMHVzaW5nJTIwYW4lMjBPQ1IlMjBlbmdpbmUlMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMm5pZWxzciUyRmZ1bnNkLWxheW91dGxtdjMlMjIlMkMlMjBzcGxpdCUzRCUyMnRyYWluJTIyKSUwQWV4YW1wbGUlMjAlM0QlMjBkYXRhc2V0JTVCMCU1RCUwQWltYWdlJTIwJTNEJTIwZXhhbXBsZSU1QiUyMmltYWdlJTIyJTVEJTBBd29yZHMlMjAlM0QlMjBleGFtcGxlJTVCJTIydG9rZW5zJTIyJTVEJTBBYm94ZXMlMjAlM0QlMjBleGFtcGxlJTVCJTIyYmJveGVzJTIyJTVEJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlJTJDJTIwd29yZHMlMkMlMjBib3hlcyUzRGJveGVzJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEFkZWNvZGVyX2lucHV0X2lkcyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIlNUJtb2RlbC5jb25maWcuZGVjb2Rlcl9zdGFydF90b2tlbl9pZCU1RCU1RCklMEElMEElMjMlMjBmb3J3YXJkJTIwcGFzcyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGRlY29kZXJfaW5wdXRfaWRzJTNEZGVjb2Rlcl9pbnB1dF9pZHMpJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQWxpc3QobGFzdF9oaWRkZW5fc3RhdGVzLnNoYXBlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, AutoModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load model and processor</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># in this case, we already have performed OCR ourselves</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># so we initialize the processor with \`apply_ocr=False\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/udop-large&quot;</span>, apply_ocr=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModel.from_pretrained(<span class="hljs-string">&quot;microsoft/udop-large&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load an example image, along with the words and coordinates</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># which were extracted using an OCR engine</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;nielsr/funsd-layoutlmv3&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>example = dataset[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image = example[<span class="hljs-string">&quot;image&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>words = example[<span class="hljs-string">&quot;tokens&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes = example[<span class="hljs-string">&quot;bboxes&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(image, words, boxes=boxes, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = torch.tensor([[model.config.decoder_start_token_id]])

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, decoder_input_ids=decoder_input_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1024</span>]`,wrap:!1}}),{c(){i=r("p"),i.textContent=v,p=n(),h(k.$$.fragment)},l(m){i=d(m,"P",{"data-svelte-h":!0}),c(i)!=="svelte-11lpom8"&&(i.textContent=v),p=s(m),u(k.$$.fragment,m)},m(m,z){l(m,i,z),l(m,p,z),f(k,m,z),x=!0},p:fe,i(m){x||(_(k.$$.fragment,m),x=!0)},o(m){g(k.$$.fragment,m),x=!1},d(m){m&&(t(i),t(p)),b(k,m)}}}function Zs(j){let i,v=`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(){i=r("p"),i.innerHTML=v},l(p){i=d(p,"P",{"data-svelte-h":!0}),c(i)!=="svelte-fincs2"&&(i.innerHTML=v)},m(p,k){l(p,i,k)},p:fe,d(p){p&&t(i)}}}function Ws(j){let i,v="Examples:",p,k,x;return k=new Xo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBVZG9wRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBJTIzJTIwbG9hZCUyMG1vZGVsJTIwYW5kJTIwcHJvY2Vzc29yJTBBJTIzJTIwaW4lMjB0aGlzJTIwY2FzZSUyQyUyMHdlJTIwYWxyZWFkeSUyMGhhdmUlMjBwZXJmb3JtZWQlMjBPQ1IlMjBvdXJzZWx2ZXMlMEElMjMlMjBzbyUyMHdlJTIwaW5pdGlhbGl6ZSUyMHRoZSUyMHByb2Nlc3NvciUyMHdpdGglMjAlNjBhcHBseV9vY3IlM0RGYWxzZSU2MCUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnVkb3AtbGFyZ2UlMjIlMkMlMjBhcHBseV9vY3IlM0RGYWxzZSklMEFtb2RlbCUyMCUzRCUyMFVkb3BGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnVkb3AtbGFyZ2UlMjIpJTBBJTBBJTIzJTIwbG9hZCUyMGFuJTIwZXhhbXBsZSUyMGltYWdlJTJDJTIwYWxvbmclMjB3aXRoJTIwdGhlJTIwd29yZHMlMjBhbmQlMjBjb29yZGluYXRlcyUwQSUyMyUyMHdoaWNoJTIwd2VyZSUyMGV4dHJhY3RlZCUyMHVzaW5nJTIwYW4lMjBPQ1IlMjBlbmdpbmUlMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMm5pZWxzciUyRmZ1bnNkLWxheW91dGxtdjMlMjIlMkMlMjBzcGxpdCUzRCUyMnRyYWluJTIyKSUwQWV4YW1wbGUlMjAlM0QlMjBkYXRhc2V0JTVCMCU1RCUwQWltYWdlJTIwJTNEJTIwZXhhbXBsZSU1QiUyMmltYWdlJTIyJTVEJTBBd29yZHMlMjAlM0QlMjBleGFtcGxlJTVCJTIydG9rZW5zJTIyJTVEJTBBYm94ZXMlMjAlM0QlMjBleGFtcGxlJTVCJTIyYmJveGVzJTIyJTVEJTBBJTBBJTIzJTIwb25lJTIwY2FuJTIwdXNlJTIwdGhlJTIwdmFyaW91cyUyMHRhc2slMjBwcmVmaXhlcyUyMChwcm9tcHRzKSUyMHVzZWQlMjBkdXJpbmclMjBwcmUtdHJhaW5pbmclMEElMjMlMjBlLmcuJTIwdGhlJTIwdGFzayUyMHByZWZpeCUyMGZvciUyMERvY1ZRQSUyMGlzJTIwJTIyUXVlc3Rpb24lMjBhbnN3ZXJpbmcuJTIwJTIyJTBBcXVlc3Rpb24lMjAlM0QlMjAlMjJRdWVzdGlvbiUyMGFuc3dlcmluZy4lMjBXaGF0JTIwaXMlMjB0aGUlMjBkYXRlJTIwb24lMjB0aGUlMjBmb3JtJTNGJTIyJTBBZW5jb2RpbmclMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2UlMkMlMjBxdWVzdGlvbiUyQyUyMHdvcmRzJTJDJTIwYm94ZXMlM0Rib3hlcyUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBJTIzJTIwYXV0b3JlZ3Jlc3NpdmUlMjBnZW5lcmF0aW9uJTBBcHJlZGljdGVkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqZW5jb2RpbmcpJTBBcHJpbnQocHJvY2Vzc29yLmJhdGNoX2RlY29kZShwcmVkaWN0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, UdopForConditionalGeneration
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load model and processor</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># in this case, we already have performed OCR ourselves</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># so we initialize the processor with \`apply_ocr=False\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/udop-large&quot;</span>, apply_ocr=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = UdopForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;microsoft/udop-large&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load an example image, along with the words and coordinates</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># which were extracted using an OCR engine</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;nielsr/funsd-layoutlmv3&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>example = dataset[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image = example[<span class="hljs-string">&quot;image&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>words = example[<span class="hljs-string">&quot;tokens&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes = example[<span class="hljs-string">&quot;bboxes&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># one can use the various task prefixes (prompts) used during pre-training</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># e.g. the task prefix for DocVQA is &quot;Question answering. &quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>question = <span class="hljs-string">&quot;Question answering. What is the date on the form?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = processor(image, question, words, boxes=boxes, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># autoregressive generation</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_ids = model.generate(**encoding)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(processor.batch_decode(predicted_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>])
<span class="hljs-number">9</span>/<span class="hljs-number">30</span>/<span class="hljs-number">92</span>`,wrap:!1}}),{c(){i=r("p"),i.textContent=v,p=n(),h(k.$$.fragment)},l(m){i=d(m,"P",{"data-svelte-h":!0}),c(i)!=="svelte-kvfsh7"&&(i.textContent=v),p=s(m),u(k.$$.fragment,m)},m(m,z){l(m,i,z),l(m,p,z),f(k,m,z),x=!0},p:fe,i(m){x||(_(k.$$.fragment,m),x=!0)},o(m){g(k.$$.fragment,m),x=!1},d(m){m&&(t(i),t(p)),b(k,m)}}}function Rs(j){let i,v=`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(){i=r("p"),i.innerHTML=v},l(p){i=d(p,"P",{"data-svelte-h":!0}),c(i)!=="svelte-fincs2"&&(i.innerHTML=v)},m(p,k){l(p,i,k)},p:fe,d(p){p&&t(i)}}}function Hs(j){let i,v="Example:",p,k,x;return k=new Xo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBVZG9wRW5jb2Rlck1vZGVsJTBBZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGhmX2h1Yl9kb3dubG9hZCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQSUyMyUyMGxvYWQlMjBtb2RlbCUyMGFuZCUyMHByb2Nlc3NvciUwQSUyMyUyMGluJTIwdGhpcyUyMGNhc2UlMkMlMjB3ZSUyMGFscmVhZHklMjBoYXZlJTIwcGVyZm9ybWVkJTIwT0NSJTIwb3Vyc2VsdmVzJTBBJTIzJTIwc28lMjB3ZSUyMGluaXRpYWxpemUlMjB0aGUlMjBwcm9jZXNzb3IlMjB3aXRoJTIwJTYwYXBwbHlfb2NyJTNERmFsc2UlNjAlMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZ1ZG9wLWxhcmdlJTIyJTJDJTIwYXBwbHlfb2NyJTNERmFsc2UpJTBBbW9kZWwlMjAlM0QlMjBVZG9wRW5jb2Rlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZ1ZG9wLWxhcmdlJTIyKSUwQSUwQSUyMyUyMGxvYWQlMjBhbiUyMGV4YW1wbGUlMjBpbWFnZSUyQyUyMGFsb25nJTIwd2l0aCUyMHRoZSUyMHdvcmRzJTIwYW5kJTIwY29vcmRpbmF0ZXMlMEElMjMlMjB3aGljaCUyMHdlcmUlMjBleHRyYWN0ZWQlMjB1c2luZyUyMGFuJTIwT0NSJTIwZW5naW5lJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJuaWVsc3IlMkZmdW5zZC1sYXlvdXRsbXYzJTIyJTJDJTIwc3BsaXQlM0QlMjJ0cmFpbiUyMiklMEFleGFtcGxlJTIwJTNEJTIwZGF0YXNldCU1QjAlNUQlMEFpbWFnZSUyMCUzRCUyMGV4YW1wbGUlNUIlMjJpbWFnZSUyMiU1RCUwQXdvcmRzJTIwJTNEJTIwZXhhbXBsZSU1QiUyMnRva2VucyUyMiU1RCUwQWJveGVzJTIwJTNEJTIwZXhhbXBsZSU1QiUyMmJib3hlcyUyMiU1RCUwQWVuY29kaW5nJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlJTJDJTIwd29yZHMlMkMlMjBib3hlcyUzRGJveGVzJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKiplbmNvZGluZyklMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, UdopEncoderModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> hf_hub_download
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load model and processor</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># in this case, we already have performed OCR ourselves</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># so we initialize the processor with \`apply_ocr=False\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/udop-large&quot;</span>, apply_ocr=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = UdopEncoderModel.from_pretrained(<span class="hljs-string">&quot;microsoft/udop-large&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load an example image, along with the words and coordinates</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># which were extracted using an OCR engine</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;nielsr/funsd-layoutlmv3&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>example = dataset[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image = example[<span class="hljs-string">&quot;image&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>words = example[<span class="hljs-string">&quot;tokens&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes = example[<span class="hljs-string">&quot;bboxes&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = processor(image, words, boxes=boxes, 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`,wrap:!1}}),{c(){i=r("p"),i.textContent=v,p=n(),h(k.$$.fragment)},l(m){i=d(m,"P",{"data-svelte-h":!0}),c(i)!=="svelte-11lpom8"&&(i.textContent=v),p=s(m),u(k.$$.fragment,m)},m(m,z){l(m,i,z),l(m,p,z),f(k,m,z),x=!0},p:fe,i(m){x||(_(k.$$.fragment,m),x=!0)},o(m){g(k.$$.fragment,m),x=!1},d(m){m&&(t(i),t(p)),b(k,m)}}}function Ds(j){let i,v,p,k,x,m,z,Ao,_e,In=`The UDOP model was proposed in <a href="https://arxiv.org/abs/2212.02623" rel="nofollow">Unifying Vision, Text, and Layout for Universal Document Processing</a> by Zineng Tang, Ziyi Yang, Guoxin Wang, Yuwei Fang, Yang Liu, Chenguang Zhu, Michael Zeng, Cha Zhang, Mohit Bansal.
UDOP adopts an encoder-decoder Transformer architecture based on <a href="t5">T5</a> for document AI tasks like document image classification, document parsing and document visual question answering.`,Yo,ge,Ln="The abstract from the paper is the following:",Qo,be,Bn="We propose Universal Document Processing (UDOP), a foundation Document AI model which unifies text, image, and layout modalities together with varied task formats, including document understanding and generation. UDOP leverages the spatial correlation between textual content and document image to model image, text, and layout modalities with one uniform representation. With a novel Vision-Text-Layout Transformer, UDOP unifies pretraining and multi-domain downstream tasks into a prompt-based sequence generation scheme. UDOP is pretrained on both large-scale unlabeled document corpora using innovative self-supervised objectives and diverse labeled data. UDOP also learns to generate document images from text and layout modalities via masked image reconstruction. To the best of our knowledge, this is the first time in the field of document AI that one model simultaneously achieves high-quality neural document editing and content customization. Our method sets the state-of-the-art on 9 Document AI tasks, e.g., document understanding and QA, across diverse data domains like finance reports, academic papers, and websites. UDOP ranks first on the leaderboard of the Document Understanding Benchmark (DUE).*",Ko,X,Nn,et,ke,Gn='UDOP architecture. Taken from the <a href="https://arxiv.org/abs/2212.02623">original paper.</a>',ot,ve,tt,Te,Pn=`<li>In addition to <em>input_ids</em>, <a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopForConditionalGeneration">UdopForConditionalGeneration</a> also expects the input <code>bbox</code>, which are
the bounding boxes (i.e. 2D-positions) of the input tokens. These can be obtained using an external OCR engine such
as Google’s <a href="https://github.com/tesseract-ocr/tesseract" rel="nofollow">Tesseract</a> (there’s a <a href="https://pypi.org/project/pytesseract/" rel="nofollow">Python wrapper</a> available). Each bounding box should be in (x0, y0, x1, y1) format, where (x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1, y1) represents the
position of the lower right corner. Note that one first needs to normalize the bounding boxes to be on a 0-1000
scale. To normalize, you can use the following function:</li>`,nt,ye,st,we,Zn=`Here, <code>width</code> and <code>height</code> correspond to the width and height of the original document in which the token
occurs. Those can be obtained using the Python Image Library (PIL) library for example, as follows:`,at,xe,rt,Me,Wn='One can use <a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopProcessor">UdopProcessor</a> to prepare images and text for the model, which takes care of all of this. By default, this class uses the Tesseract engine to extract a list of words and boxes (coordinates) from a given document. Its functionality is equivalent to that of <a href="/docs/transformers/pr_30929/en/model_doc/layoutlmv3#transformers.LayoutLMv3Processor">LayoutLMv3Processor</a>, hence it supports passing either <code>apply_ocr=False</code> in case you prefer to use your own OCR engine or <code>apply_ocr=True</code> in case you want the default OCR engine to be used. Refer to the <a href="layoutlmv2#usage-layoutlmv2processor">usage guide of LayoutLMv2</a> regarding all possible use cases (the functionality of <code>UdopProcessor</code> is identical).',dt,Ue,Rn='<li>If using an own OCR engine of choice, one recommendation is Azure’s <a href="https://learn.microsoft.com/en-us/azure/ai-services/computer-vision/how-to/call-read-api" rel="nofollow">Read API</a>, which supports so-called line segments. Use of segment position embeddings typically results in better performance.</li> <li>At inference time, it’s recommended to use the <code>generate</code> method to autoregressively generate text given a document image.</li> <li>The model has been pre-trained on both self-supervised and supervised objectives. One can use the various task prefixes (prompts) used during pre-training to test out the out-of-the-box capabilities. For instance, the model can be prompted with “Question answering. What is the date?”, as “Question answering.” is the task prefix used during pre-training for DocVQA. Refer to the <a href="https://arxiv.org/abs/2212.02623" rel="nofollow">paper</a> (table 1) for all task prefixes.</li> <li>One can also fine-tune <a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopEncoderModel">UdopEncoderModel</a>, which is the encoder-only part of UDOP, which can be seen as a LayoutLMv3-like Transformer encoder. For discriminative tasks, one can just add a linear classifier on top of it and fine-tune it on a labeled dataset.</li>',it,ze,Hn=`This model was contributed by <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a>.
The original code can be found <a href="https://github.com/microsoft/UDOP" rel="nofollow">here</a>.`,lt,$e,ct,je,Dn=`A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with UDOP. 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.`,pt,Ce,En=`<li>Demo notebooks regarding UDOP can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials/tree/master/UDOP" rel="nofollow">here</a> that show how
to fine-tune UDOP on a custom dataset as well as inference. 🌎</li> <li><a href="../tasks/document_question_answering">Document question answering task guide</a></li>`,mt,qe,ht,Z,Fe,qt,lo,On=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopForConditionalGeneration">UdopForConditionalGeneration</a>. It is used to
instantiate a UDOP 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 UDOP
<a href="https://huggingface.co/microsoft/udop-large" rel="nofollow">microsoft/udop-large</a> architecture.`,Ft,co,Vn=`Configuration objects inherit from <a href="/docs/transformers/pr_30929/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/pr_30929/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,ut,Je,ft,$,Ie,Jt,po,Sn=`Adapted from <a href="/docs/transformers/pr_30929/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer">LayoutXLMTokenizer</a> and <a href="/docs/transformers/pr_30929/en/model_doc/t5#transformers.T5Tokenizer">T5Tokenizer</a>. Based on
<a href="https://github.com/google/sentencepiece" rel="nofollow">SentencePiece</a>.`,It,mo,Xn=`This tokenizer inherits from <a href="/docs/transformers/pr_30929/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a> which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`,Lt,W,Le,Bt,ho,An=`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A sequence has the following format:`,Nt,uo,Yn="<li>single sequence: <code>X &lt;/s&gt;</code></li> <li>pair of sequences: <code>A &lt;/s&gt; B &lt;/s&gt;</code></li>",Gt,A,Be,Pt,fo,Qn=`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer <code>prepare_for_model</code> method.`,Zt,Y,Ne,Wt,_o,Kn=`Create a mask from the two sequences passed to be used in a sequence-pair classification task. T5 does not make
use of token type ids, therefore a list of zeros is returned.`,Rt,go,Ge,_t,Pe,gt,y,Ze,Ht,bo,es=`Construct a “fast” UDOP tokenizer (backed by HuggingFace’s <em>tokenizers</em> library). Adapted from
<a href="/docs/transformers/pr_30929/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer">LayoutXLMTokenizer</a> and <a href="/docs/transformers/pr_30929/en/model_doc/t5#transformers.T5Tokenizer">T5Tokenizer</a>. Based on
<a href="https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=BPE#models" rel="nofollow">BPE</a>.`,Dt,ko,os=`This tokenizer inherits from <a href="/docs/transformers/pr_30929/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a> which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`,Et,R,We,Ot,vo,ts="Tokenize and prepare for the model a list of sequences or a list of pairs of sequences.",Vt,Q,St,H,Re,Xt,To,ns=`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. An XLM-RoBERTa sequence has the following format:`,At,yo,ss="<li>single sequence: <code>&lt;s&gt; X &lt;/s&gt;</code></li> <li>pair of sequences: <code>&lt;s&gt; A &lt;/s&gt;&lt;/s&gt; B &lt;/s&gt;</code></li>",Yt,K,He,Qt,wo,as=`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.`,Kt,ee,De,en,xo,rs=`Create a mask from the two sequences passed to be used in a sequence-pair classification task. XLM-RoBERTa does
not make use of token type ids, therefore a list of zeros is returned.`,on,Mo,Ee,tn,D,Oe,nn,Uo,ds="Tokenize and prepare for the model a sequence or a pair of sequences.",sn,oe,bt,Ve,kt,C,Se,an,zo,is="Constructs a UDOP processor which combines a LayoutLMv3 image processor and a UDOP tokenizer into a single processor.",rn,$o,ls='<a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopProcessor">UdopProcessor</a> offers all the functionalities you need to prepare data for the model.',dn,jo,cs=`It first uses <a href="/docs/transformers/pr_30929/en/model_doc/layoutlmv3#transformers.LayoutLMv3ImageProcessor">LayoutLMv3ImageProcessor</a> to resize, rescale and normalize document images, and optionally applies OCR
to get words and normalized bounding boxes. These are then provided to <a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopTokenizer">UdopTokenizer</a> or <a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopTokenizerFast">UdopTokenizerFast</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).`,ln,Co,ps=`Additionally, it also supports passing <code>text_target</code> and <code>text_pair_target</code> to the tokenizer, which can be used to
prepare labels for language modeling tasks.`,cn,L,Xe,pn,qo,ms=`This method first forwards the <code>images</code> argument to <code>~UdopImageProcessor.__call__</code>. In case
<code>UdopImageProcessor</code> was initialized with <code>apply_ocr</code> set to <code>True</code>, it passes the obtained words and
bounding boxes along with the additional arguments to <code>__call__()</code> and returns the output,
together with the prepared <code>pixel_values</code>. In case <code>UdopImageProcessor</code> was initialized with <code>apply_ocr</code> set
to <code>False</code>, it passes the words (<code>text</code>/\`<code>text_pair</code>) and <code>boxes</code> specified by the user along with the
additional arguments to <code>__call__()</code> and returns the output, together with the prepared
<code>pixel_values</code>.`,mn,Fo,hs="Alternatively, one can pass <code>text_target</code> and <code>text_pair_target</code> to prepare the targets of UDOP.",hn,Jo,us="Please refer to the docstring of the above two methods for more information.",vt,Ae,fs="## UdopModel[[transformers.UdopModel]]",Tt,J,Ye,un,Io,_s=`The bare UDOP encoder-decoder Transformer outputting raw hidden-states without any specific head on top.
This model inherits from <a href="/docs/transformers/pr_30929/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,fn,Lo,gs=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,_n,B,Qe,gn,Bo,bs='The <a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopModel">UdopModel</a> forward method, overrides the <code>__call__</code> special method.',bn,te,kn,ne,yt,Ke,ks="## UdopForConditionalGeneration[[transformers.UdopForConditionalGeneration]]",wt,F,eo,vn,No,vs=`The UDOP encoder-decoder Transformer with a language modeling head on top, enabling to generate text given document
images and an optional prompt.`,Tn,Go,Ts=`This class is based on <a href="/docs/transformers/pr_30929/en/model_doc/t5#transformers.T5ForConditionalGeneration">T5ForConditionalGeneration</a>, extended to deal with images and layout (2D) data.
This model inherits from <a href="/docs/transformers/pr_30929/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,yn,Po,ys=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,wn,N,oo,xn,Zo,ws='The <a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopForConditionalGeneration">UdopForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',Mn,se,Un,ae,xt,to,xs="## UdopEncoderModel[[transformers.UdopEncoderModel]]",Mt,I,no,zn,Wo,Ms=`The bare UDOP Model transformer outputting encoder’s raw hidden-states without any specific head on top.
This model inherits from <a href="/docs/transformers/pr_30929/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,$n,Ro,Us=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,jn,G,so,Cn,Ho,zs='The <a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopEncoderModel">UdopEncoderModel</a> forward method, overrides the <code>__call__</code> special method.',qn,re,Fn,de,Ut,ao,zt,Oo,$t;return x=new ue({props:{title:"UDOP",local:"udop",headingTag:"h1"}}),z=new ue({props:{title:"Overview",local:"overview",headingTag:"h2"}}),ve=new ue({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),ye=new Xo({props:{code:"ZGVmJTIwbm9ybWFsaXplX2Jib3goYmJveCUyQyUyMHdpZHRoJTJDJTIwaGVpZ2h0KSUzQSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGludCgxMDAwJTIwKiUyMChiYm94JTVCMCU1RCUyMCUyRiUyMHdpZHRoKSklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpbnQoMTAwMCUyMColMjAoYmJveCU1QjElNUQlMjAlMkYlMjBoZWlnaHQpKSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGludCgxMDAwJTIwKiUyMChiYm94JTVCMiU1RCUyMCUyRiUyMHdpZHRoKSklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpbnQoMTAwMCUyMColMjAoYmJveCU1QjMlNUQlMjAlMkYlMjBoZWlnaHQpKSUyQyUwQSUyMCUyMCUyMCUyMCU1RA==",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">normalize_bbox</span>(<span class="hljs-params">bbox, width, height</span>):
    <span class="hljs-keyword">return</span> [
        <span class="hljs-built_in">int</span>(<span class="hljs-number">1000</span> * (bbox[<span class="hljs-number">0</span>] / width)),
        <span class="hljs-built_in">int</span>(<span class="hljs-number">1000</span> * (bbox[<span class="hljs-number">1</span>] / height)),
        <span class="hljs-built_in">int</span>(<span class="hljs-number">1000</span> * (bbox[<span class="hljs-number">2</span>] / width)),
        <span class="hljs-built_in">int</span>(<span class="hljs-number">1000</span> * (bbox[<span class="hljs-number">3</span>] / height)),
    ]`,wrap:!1}}),xe=new Xo({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBJTBBJTIzJTIwRG9jdW1lbnQlMjBjYW4lMjBiZSUyMGElMjBwbmclMkMlMjBqcGclMkMlMjBldGMuJTIwUERGcyUyMG11c3QlMjBiZSUyMGNvbnZlcnRlZCUyMHRvJTIwaW1hZ2VzLiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihuYW1lX29mX3lvdXJfZG9jdW1lbnQpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQSUwQXdpZHRoJTJDJTIwaGVpZ2h0JTIwJTNEJTIwaW1hZ2Uuc2l6ZQ==",highlighted:`<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

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

width, height = image.size`,wrap:!1}}),$e=new ue({props:{title:"Resources",local:"resources",headingTag:"h2"}}),qe=new ue({props:{title:"UdopConfig",local:"transformers.UdopConfig",headingTag:"h2"}}),Fe=new U({props:{name:"class transformers.UdopConfig",anchor:"transformers.UdopConfig",parameters:[{name:"vocab_size",val:" = 33201"},{name:"d_model",val:" = 1024"},{name:"d_kv",val:" = 64"},{name:"d_ff",val:" = 4096"},{name:"num_layers",val:" = 24"},{name:"num_decoder_layers",val:" = None"},{name:"num_heads",val:" = 16"},{name:"relative_attention_num_buckets",val:" = 32"},{name:"relative_attention_max_distance",val:" = 128"},{name:"relative_bias_args",val:" = [{'type': '1d'}, {'type': 'horizontal'}, {'type': 'vertical'}]"},{name:"dropout_rate",val:" = 0.1"},{name:"layer_norm_epsilon",val:" = 1e-06"},{name:"initializer_factor",val:" = 1.0"},{name:"feed_forward_proj",val:" = 'relu'"},{name:"is_encoder_decoder",val:" = True"},{name:"use_cache",val:" = True"},{name:"pad_token_id",val:" = 0"},{name:"eos_token_id",val:" = 1"},{name:"max_2d_position_embeddings",val:" = 1024"},{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 16"},{name:"num_channels",val:" = 3"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.UdopConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 33201) &#x2014;
Vocabulary size of the UDOP model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopForConditionalGeneration">UdopForConditionalGeneration</a>.`,name:"vocab_size"},{anchor:"transformers.UdopConfig.d_model",description:`<strong>d_model</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Size of the encoder layers and the pooler layer.`,name:"d_model"},{anchor:"transformers.UdopConfig.d_kv",description:`<strong>d_kv</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Size of the key, query, value projections per attention head. The <code>inner_dim</code> of the projection layer will
be defined as <code>num_heads * d_kv</code>.`,name:"d_kv"},{anchor:"transformers.UdopConfig.d_ff",description:`<strong>d_ff</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Size of the intermediate feed forward layer in each <code>UdopBlock</code>.`,name:"d_ff"},{anchor:"transformers.UdopConfig.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 24) &#x2014;
Number of hidden layers in the Transformer encoder and decoder.`,name:"num_layers"},{anchor:"transformers.UdopConfig.num_decoder_layers",description:`<strong>num_decoder_layers</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of hidden layers in the Transformer decoder. Will use the same value as <code>num_layers</code> if not set.`,name:"num_decoder_layers"},{anchor:"transformers.UdopConfig.num_heads",description:`<strong>num_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder and decoder.`,name:"num_heads"},{anchor:"transformers.UdopConfig.relative_attention_num_buckets",description:`<strong>relative_attention_num_buckets</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The number of buckets to use for each attention layer.`,name:"relative_attention_num_buckets"},{anchor:"transformers.UdopConfig.relative_attention_max_distance",description:`<strong>relative_attention_max_distance</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The maximum distance of the longer sequences for the bucket separation.`,name:"relative_attention_max_distance"},{anchor:"transformers.UdopConfig.relative_bias_args",description:`<strong>relative_bias_args</strong> (<code>List[dict]</code>, <em>optional</em>, defaults to <code>[{&apos;type&apos; -- &apos;1d&apos;}, {&apos;type&apos;: &apos;horizontal&apos;}, {&apos;type&apos;: &apos;vertical&apos;}]</code>):
A list of dictionaries containing the arguments for the relative bias layers.`,name:"relative_bias_args"},{anchor:"transformers.UdopConfig.dropout_rate",description:`<strong>dropout_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The ratio for all dropout layers.`,name:"dropout_rate"},{anchor:"transformers.UdopConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-06) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_epsilon"},{anchor:"transformers.UdopConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.UdopConfig.feed_forward_proj",description:`<strong>feed_forward_proj</strong> (<code>string</code>, <em>optional</em>, defaults to <code>&quot;relu&quot;</code>) &#x2014;
Type of feed forward layer to be used. Should be one of <code>&quot;relu&quot;</code> or <code>&quot;gated-gelu&quot;</code>. Udopv1.1 uses the
<code>&quot;gated-gelu&quot;</code> feed forward projection. Original Udop uses <code>&quot;relu&quot;</code>.`,name:"feed_forward_proj"},{anchor:"transformers.UdopConfig.is_encoder_decoder",description:`<strong>is_encoder_decoder</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the model should behave as an encoder/decoder or not.`,name:"is_encoder_decoder"},{anchor:"transformers.UdopConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"},{anchor:"transformers.UdopConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the padding token in the vocabulary.`,name:"pad_token_id"},{anchor:"transformers.UdopConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The id of the end-of-sequence token in the vocabulary.`,name:"eos_token_id"},{anchor:"transformers.UdopConfig.max_2d_position_embeddings",description:`<strong>max_2d_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
The maximum absolute position embeddings for relative position encoding.`,name:"max_2d_position_embeddings"},{anchor:"transformers.UdopConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size of the input images.`,name:"image_size"},{anchor:"transformers.UdopConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The patch size used by the vision encoder.`,name:"patch_size"},{anchor:"transformers.UdopConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of channels in the input images.`,name:"num_channels"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/configuration_udop.py#L24"}}),Je=new ue({props:{title:"UdopTokenizer",local:"transformers.UdopTokenizer",headingTag:"h2"}}),Ie=new U({props:{name:"class transformers.UdopTokenizer",anchor:"transformers.UdopTokenizer",parameters:[{name:"vocab_file",val:""},{name:"eos_token",val:" = '</s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"sep_token",val:" = '</s>'"},{name:"pad_token",val:" = '<pad>'"},{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:"additional_special_tokens",val:" = None"},{name:"sp_model_kwargs",val:": Optional = None"},{name:"legacy",val:" = True"},{name:"add_prefix_space",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.UdopTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.UdopTokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the end of sequence.
The token used is the <code>sep_token</code>.</p>

					</div>`,name:"eos_token"},{anchor:"transformers.UdopTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&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.UdopTokenizer.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&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.UdopTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.UdopTokenizer.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.UdopTokenizer.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.UdopTokenizer.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.UdopTokenizer.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.UdopTokenizer.additional_special_tokens",description:`<strong>additional_special_tokens</strong> (<code>List[str]</code>, <em>optional</em>, defaults to <code>[&quot;&lt;s&gt;NOTUSED&quot;, &quot;&lt;/s&gt;NOTUSED&quot;]</code>) &#x2014;
Additional special tokens used by the tokenizer.`,name:"additional_special_tokens"},{anchor:"transformers.UdopTokenizer.sp_model_kwargs",description:`<strong>sp_model_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Will be passed to the <code>SentencePieceProcessor.__init__()</code> method. The <a href="https://github.com/google/sentencepiece/tree/master/python" rel="nofollow">Python wrapper for
SentencePiece</a> can be used, among other things,
to set:</p>
<ul>
<li>
<p><code>enable_sampling</code>: Enable subword regularization.</p>
</li>
<li>
<p><code>nbest_size</code>: Sampling parameters for unigram. Invalid for BPE-Dropout.</p>
<ul>
<li><code>nbest_size = {0,1}</code>: No sampling is performed.</li>
<li><code>nbest_size &gt; 1</code>: samples from the nbest_size results.</li>
<li><code>nbest_size &lt; 0</code>: assuming that nbest_size is infinite and samples from the all hypothesis (lattice)
using forward-filtering-and-backward-sampling algorithm.</li>
</ul>
</li>
<li>
<p><code>alpha</code>: Smoothing parameter for unigram sampling, and dropout probability of merge operations for
BPE-dropout.</p>
</li>
</ul>`,name:"sp_model_kwargs"},{anchor:"transformers.UdopTokenizer.legacy",description:`<strong>legacy</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the <code>legacy</code> behaviour of the tokenizer should be used. Legacy is before the merge of #24622
which includes fixes to properly handle tokens that appear after special tokens. A simple example:</p>
<ul>
<li><code>legacy=True</code>:</li>
</ul>`,name:"legacy"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/tokenization_udop.py#L150"}}),Le=new U({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.UdopTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.UdopTokenizer.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.UdopTokenizer.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/tokenization_udop.py#L382",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),Be=new U({props:{name:"get_special_tokens_mask",anchor:"transformers.UdopTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.UdopTokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.UdopTokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.UdopTokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/tokenization_udop.py#L308",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),Ne=new U({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.UdopTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.UdopTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.UdopTokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/tokenization_udop.py#L359",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of zeros.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),Ge=new U({props:{name:"save_vocabulary",anchor:"transformers.UdopTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": Optional = None"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/tokenization_udop.py#L491"}}),Pe=new ue({props:{title:"UdopTokenizerFast",local:"transformers.UdopTokenizerFast",headingTag:"h2"}}),Ze=new U({props:{name:"class transformers.UdopTokenizerFast",anchor:"transformers.UdopTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"eos_token",val:" = '</s>'"},{name:"sep_token",val:" = '</s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"pad_token",val:" = '<pad>'"},{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:"additional_special_tokens",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.UdopTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.UdopTokenizerFast.tokenizer_file",description:`<strong>tokenizer_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Path to the tokenizer file.`,name:"tokenizer_file"},{anchor:"transformers.UdopTokenizerFast.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the end of sequence.
The token used is the <code>sep_token</code>.</p>

					</div>`,name:"eos_token"},{anchor:"transformers.UdopTokenizerFast.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&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.UdopTokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&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.UdopTokenizerFast.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.UdopTokenizerFast.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.UdopTokenizerFast.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.UdopTokenizerFast.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.UdopTokenizerFast.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.UdopTokenizerFast.additional_special_tokens",description:`<strong>additional_special_tokens</strong> (<code>List[str]</code>, <em>optional</em>, defaults to <code>[&quot;&lt;s&gt;NOTUSED&quot;, &quot;&lt;/s&gt;NOTUSED&quot;]</code>) &#x2014;
Additional special tokens used by the tokenizer.`,name:"additional_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/tokenization_udop_fast.py#L148"}}),We=new U({props:{name:"batch_encode_plus_boxes",anchor:"transformers.UdopTokenizerFast.batch_encode_plus_boxes",parameters:[{name:"batch_text_or_text_pairs",val:": Union"},{name:"is_pair",val:": bool = None"},{name:"boxes",val:": Optional = None"},{name:"word_labels",val:": Optional = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": Union = False"},{name:"truncation",val:": Union = None"},{name:"max_length",val:": Optional = None"},{name:"stride",val:": int = 0"},{name:"is_split_into_words",val:": bool = False"},{name:"pad_to_multiple_of",val:": Optional = None"},{name:"return_tensors",val:": Union = None"},{name:"return_token_type_ids",val:": Optional = None"},{name:"return_attention_mask",val:": Optional = 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.UdopTokenizerFast.batch_encode_plus_boxes.batch_text_or_text_pairs",description:`<strong>batch_text_or_text_pairs</strong> (<code>List[str]</code>, <code>List[Tuple[str, str]]</code>, <code>List[List[str]]</code>, <code>List[Tuple[List[str], List[str]]]</code>, and for not-fast tokenizers, also <code>List[List[int]]</code>, <code>List[Tuple[List[int], List[int]]]</code>) &#x2014;
Batch of sequences or pair of sequences to be encoded. This can be a list of
string/string-sequences/int-sequences or a list of pair of string/string-sequences/int-sequence (see
details in <code>encode_plus</code>).`,name:"batch_text_or_text_pairs"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/tokenization_udop_fast.py#L439"}}),Q=new So({props:{warning:!0,$$slots:{default:[Bs]},$$scope:{ctx:j}}}),Re=new U({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.UdopTokenizerFast.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.UdopTokenizerFast.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.UdopTokenizerFast.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/tokenization_udop_fast.py#L945",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),He=new U({props:{name:"call_boxes",anchor:"transformers.UdopTokenizerFast.call_boxes",parameters:[{name:"text",val:": Union"},{name:"text_pair",val:": Union = None"},{name:"boxes",val:": Union = None"},{name:"word_labels",val:": Union = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": Union = False"},{name:"truncation",val:": Union = None"},{name:"max_length",val:": Optional = None"},{name:"stride",val:": int = 0"},{name:"pad_to_multiple_of",val:": Optional = None"},{name:"return_tensors",val:": Union = None"},{name:"return_token_type_ids",val:": Optional = None"},{name:"return_attention_mask",val:": Optional = 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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.padding",description:`<strong>padding</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/pr_30929/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.UdopTokenizerFast.call_boxes.truncation",description:`<strong>truncation</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/pr_30929/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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/pr_30929/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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.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/pr_30929/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.UdopTokenizerFast.call_boxes.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.UdopTokenizerFast.call_boxes.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/vr_30929/src/transformers/models/udop/tokenization_udop_fast.py#L276",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_30929/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),De=new U({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.UdopTokenizerFast.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.UdopTokenizerFast.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.UdopTokenizerFast.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/tokenization_udop_fast.py#L970",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of zeros.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),Ee=new U({props:{name:"encode_boxes",anchor:"transformers.UdopTokenizerFast.encode_boxes",parameters:[{name:"text",val:": Union"},{name:"text_pair",val:": Union = None"},{name:"boxes",val:": Optional = None"},{name:"word_labels",val:": Optional = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": Union = False"},{name:"truncation",val:": Union = None"},{name:"max_length",val:": Optional = None"},{name:"stride",val:": int = 0"},{name:"return_tensors",val:": Union = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.UdopTokenizerFast.encode_boxes.Converts",description:`<strong>Converts</strong> a string to a sequence of ids (integer), using the tokenizer and vocabulary. Same as doing &#x2014;
<code>self.convert_tokens_to_ids(self.tokenize(text))</code>. &#x2014;
text (<code>str</code>, <code>List[str]</code> or <code>List[int]</code>):
The first sequence to be encoded. This can be a string, a list of strings (tokenized string using the
<code>tokenize</code> method) or a list of integers (tokenized string ids using the <code>convert_tokens_to_ids</code>
method).
text_pair (<code>str</code>, <code>List[str]</code> or <code>List[int]</code>, <em>optional</em>):
Optional second sequence to be encoded. This can be a string, a list of strings (tokenized string using
the <code>tokenize</code> method) or a list of integers (tokenized string ids using the <code>convert_tokens_to_ids</code>
method).`,name:"Converts"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/tokenization_udop_fast.py#L741"}}),Oe=new U({props:{name:"encode_plus_boxes",anchor:"transformers.UdopTokenizerFast.encode_plus_boxes",parameters:[{name:"text",val:": Union"},{name:"text_pair",val:": Optional = None"},{name:"boxes",val:": Optional = None"},{name:"word_labels",val:": Optional = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": Union = False"},{name:"truncation",val:": Union = None"},{name:"max_length",val:": Optional = None"},{name:"stride",val:": int = 0"},{name:"is_split_into_words",val:": bool = False"},{name:"pad_to_multiple_of",val:": Optional = None"},{name:"return_tensors",val:": Union = None"},{name:"return_token_type_ids",val:": Optional = None"},{name:"return_attention_mask",val:": Optional = 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.UdopTokenizerFast.encode_plus_boxes.text",description:`<strong>text</strong> (<code>str</code>, <code>List[str]</code> or <code>List[int]</code> (the latter only for not-fast tokenizers)) &#x2014;
The first sequence to be encoded. This can be a string, a list of strings (tokenized string using the
<code>tokenize</code> method) or a list of integers (tokenized string ids using the <code>convert_tokens_to_ids</code>
method).`,name:"text"},{anchor:"transformers.UdopTokenizerFast.encode_plus_boxes.text_pair",description:`<strong>text_pair</strong> (<code>str</code>, <code>List[str]</code> or <code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second sequence to be encoded. This can be a string, a list of strings (tokenized string using
the <code>tokenize</code> method) or a list of integers (tokenized string ids using the <code>convert_tokens_to_ids</code>
method).`,name:"text_pair"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/tokenization_udop_fast.py#L784"}}),oe=new So({props:{warning:!0,$$slots:{default:[Ns]},$$scope:{ctx:j}}}),Ve=new ue({props:{title:"UdopProcessor",local:"transformers.UdopProcessor",headingTag:"h2"}}),Se=new U({props:{name:"class transformers.UdopProcessor",anchor:"transformers.UdopProcessor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.UdopProcessor.image_processor",description:`<strong>image_processor</strong> (<code>LayoutLMv3ImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/pr_30929/en/model_doc/layoutlmv3#transformers.LayoutLMv3ImageProcessor">LayoutLMv3ImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.UdopProcessor.tokenizer",description:`<strong>tokenizer</strong> (<code>UdopTokenizer</code> or <code>UdopTokenizerFast</code>) &#x2014;
An instance of <a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopTokenizer">UdopTokenizer</a> or <a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopTokenizerFast">UdopTokenizerFast</a>. The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/processing_udop.py#L27"}}),Xe=new U({props:{name:"__call__",anchor:"transformers.UdopProcessor.__call__",parameters:[{name:"images",val:": Union = None"},{name:"text",val:": Union = None"},{name:"text_pair",val:": Union = None"},{name:"boxes",val:": Union = None"},{name:"word_labels",val:": Union = None"},{name:"text_target",val:": Union = None"},{name:"text_pair_target",val:": Union = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": Union = False"},{name:"truncation",val:": Union = False"},{name:"max_length",val:": Optional = None"},{name:"stride",val:": int = 0"},{name:"pad_to_multiple_of",val:": Optional = None"},{name:"return_token_type_ids",val:": Optional = None"},{name:"return_attention_mask",val:": Optional = 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:": Union = None"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/processing_udop.py#L56"}}),Ye=new U({props:{name:"class transformers.UdopModel",anchor:"transformers.UdopModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.UdopModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopConfig">UdopConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30929/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/modeling_udop.py#L1514"}}),Qe=new U({props:{name:"forward",anchor:"transformers.UdopModel.forward",parameters:[{name:"input_ids",val:": Tensor = None"},{name:"attention_mask",val:": Tensor = None"},{name:"bbox",val:": Dict = None"},{name:"pixel_values",val:": Optional = None"},{name:"visual_bbox",val:": Dict = None"},{name:"decoder_input_ids",val:": Optional = None"},{name:"decoder_attention_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"encoder_outputs",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"decoder_inputs_embeds",val:": Optional = None"},{name:"decoder_head_mask",val:": Optional = None"},{name:"cross_attn_head_mask",val:": Optional = None"},{name:"use_cache",val:" = True"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.UdopModel.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. UDOP is a model with relative position embeddings so
you should be able to pad the inputs on both the right and the left. Indices can be obtained using
<a href="/docs/transformers/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for detail.
<a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.UdopModel.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>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.UdopModel.forward.bbox",description:`<strong>bbox</strong> (<code>torch.LongTensor</code> of shape <code>({0}, 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.</p>
<p>Note that <code>sequence_length = token_sequence_length + patch_sequence_length + 1</code> where <code>1</code> is for [CLS]
token. See <code>pixel_values</code> for <code>patch_sequence_length</code>.`,name:"bbox"},{anchor:"transformers.UdopModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Batch of document images. Each image is divided into patches of shape <code>(num_channels, config.patch_size, config.patch_size)</code> and the total number of patches (=<code>patch_sequence_length</code>) equals to <code>((height / config.patch_size) * (width / config.patch_size))</code>.`,name:"pixel_values"},{anchor:"transformers.UdopModel.forward.visual_bbox",description:`<strong>visual_bbox</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, patch_sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding boxes of each patch in the image. If not provided, bounding boxes are created in the model.`,name:"visual_bbox"},{anchor:"transformers.UdopModel.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary. Indices can be obtained using
<a href="/docs/transformers/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.
<a href="../glossary#decoder-input-ids">What are decoder input IDs?</a> T5 uses the <code>pad_token_id</code> as the starting
token for <code>decoder_input_ids</code> generation. If <code>past_key_values</code> is used, optionally only the last
<code>decoder_input_ids</code> have to be input (see <code>past_key_values</code>). To know more on how to prepare
<code>decoder_input_ids</code> for pretraining take a look at <a href="./t5#training">T5 Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.UdopModel.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.UdopModel.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 in the encoder. 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.UdopModel.forward.decoder_head_mask",description:`<strong>decoder_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 in the decoder. 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:"decoder_head_mask"},{anchor:"transformers.UdopModel.forward.cross_attn_head_mask",description:`<strong>cross_attn_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the cross-attention modules in the decoder. 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:"cross_attn_head_mask"},{anchor:"transformers.UdopModel.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <code>optional</code>: <em>hidden_states</em>, <code>optional</code>: <em>attentions</em>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code> is a sequence of hidden states at
the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.UdopModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.
If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.UdopModel.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 <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.UdopModel.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. If <code>past_key_values</code> is used, optionally only the last <code>decoder_inputs_embeds</code> have to be
input (see <code>past_key_values</code>). This is useful if you want more control over how to convert
<code>decoder_input_ids</code> indices into associated vectors than the model&#x2019;s internal embedding lookup matrix. If
<code>decoder_input_ids</code> and <code>decoder_inputs_embeds</code> are both unset, <code>decoder_inputs_embeds</code> takes the value of
<code>inputs_embeds</code>.`,name:"decoder_inputs_embeds"},{anchor:"transformers.UdopModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.UdopModel.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.UdopModel.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.UdopModel.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/pr_30929/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/modeling_udop.py#L1564",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopConfig"
>UdopConfig</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 decoder of the model.</p>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>decoder_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 decoder at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>decoder_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 of the decoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder’s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — Sequence of hidden-states at the output of the last layer of the encoder of the model.</p>
</li>
<li>
<p><strong>encoder_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 encoder at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>encoder_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 of the encoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_30929/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),te=new So({props:{$$slots:{default:[Gs]},$$scope:{ctx:j}}}),ne=new Jn({props:{anchor:"transformers.UdopModel.forward.example",$$slots:{default:[Ps]},$$scope:{ctx:j}}}),eo=new U({props:{name:"class transformers.UdopForConditionalGeneration",anchor:"transformers.UdopForConditionalGeneration",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.UdopForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopConfig">UdopConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30929/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/modeling_udop.py#L1675"}}),oo=new U({props:{name:"forward",anchor:"transformers.UdopForConditionalGeneration.forward",parameters:[{name:"input_ids",val:": Tensor = None"},{name:"attention_mask",val:": Tensor = None"},{name:"bbox",val:": Dict = None"},{name:"pixel_values",val:": Optional = None"},{name:"visual_bbox",val:": Dict = None"},{name:"decoder_input_ids",val:": Optional = None"},{name:"decoder_attention_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"encoder_outputs",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"decoder_inputs_embeds",val:": Optional = None"},{name:"decoder_head_mask",val:": Optional = None"},{name:"cross_attn_head_mask",val:": Optional = None"},{name:"use_cache",val:" = True"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"},{name:"labels",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.UdopForConditionalGeneration.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. UDOP is a model with relative position embeddings so
you should be able to pad the inputs on both the right and the left. Indices can be obtained using
<a href="/docs/transformers/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for detail.
<a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.UdopForConditionalGeneration.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>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.UdopForConditionalGeneration.forward.bbox",description:`<strong>bbox</strong> (<code>torch.LongTensor</code> of shape <code>({0}, 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.</p>
<p>Note that <code>sequence_length = token_sequence_length + patch_sequence_length + 1</code> where <code>1</code> is for [CLS]
token. See <code>pixel_values</code> for <code>patch_sequence_length</code>.`,name:"bbox"},{anchor:"transformers.UdopForConditionalGeneration.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Batch of document images. Each image is divided into patches of shape <code>(num_channels, config.patch_size, config.patch_size)</code> and the total number of patches (=<code>patch_sequence_length</code>) equals to <code>((height / config.patch_size) * (width / config.patch_size))</code>.`,name:"pixel_values"},{anchor:"transformers.UdopForConditionalGeneration.forward.visual_bbox",description:`<strong>visual_bbox</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, patch_sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding boxes of each patch in the image. If not provided, bounding boxes are created in the model.`,name:"visual_bbox"},{anchor:"transformers.UdopForConditionalGeneration.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary. Indices can be obtained using
<a href="/docs/transformers/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.
<a href="../glossary#decoder-input-ids">What are decoder input IDs?</a> T5 uses the <code>pad_token_id</code> as the starting
token for <code>decoder_input_ids</code> generation. If <code>past_key_values</code> is used, optionally only the last
<code>decoder_input_ids</code> have to be input (see <code>past_key_values</code>). To know more on how to prepare
<code>decoder_input_ids</code> for pretraining take a look at <a href="./t5#training">T5 Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.UdopForConditionalGeneration.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.UdopForConditionalGeneration.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 in the encoder. 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.UdopForConditionalGeneration.forward.decoder_head_mask",description:`<strong>decoder_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 in the decoder. 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:"decoder_head_mask"},{anchor:"transformers.UdopForConditionalGeneration.forward.cross_attn_head_mask",description:`<strong>cross_attn_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the cross-attention modules in the decoder. 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:"cross_attn_head_mask"},{anchor:"transformers.UdopForConditionalGeneration.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <code>optional</code>: <em>hidden_states</em>, <code>optional</code>: <em>attentions</em>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code> is a sequence of hidden states at
the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.UdopForConditionalGeneration.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.
If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.UdopForConditionalGeneration.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 <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.UdopForConditionalGeneration.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. If <code>past_key_values</code> is used, optionally only the last <code>decoder_inputs_embeds</code> have to be
input (see <code>past_key_values</code>). This is useful if you want more control over how to convert
<code>decoder_input_ids</code> indices into associated vectors than the model&#x2019;s internal embedding lookup matrix. If
<code>decoder_input_ids</code> and <code>decoder_inputs_embeds</code> are both unset, <code>decoder_inputs_embeds</code> takes the value of
<code>inputs_embeds</code>.`,name:"decoder_inputs_embeds"},{anchor:"transformers.UdopForConditionalGeneration.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.UdopForConditionalGeneration.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.UdopForConditionalGeneration.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.UdopForConditionalGeneration.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/pr_30929/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.UdopForConditionalGeneration.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size - 1]</code>. All labels set to <code>-100</code> are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/modeling_udop.py#L1738",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30929/en/main_classes/output#transformers.modeling_outputs.Seq2SeqLMOutput"
>transformers.modeling_outputs.Seq2SeqLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopConfig"
>UdopConfig</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) — Language modeling loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>decoder_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 decoder at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>decoder_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 of the decoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder’s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — Sequence of hidden-states at the output of the last layer of the encoder of the model.</p>
</li>
<li>
<p><strong>encoder_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 encoder at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>encoder_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 of the encoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_30929/en/main_classes/output#transformers.modeling_outputs.Seq2SeqLMOutput"
>transformers.modeling_outputs.Seq2SeqLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),se=new So({props:{$$slots:{default:[Zs]},$$scope:{ctx:j}}}),ae=new Jn({props:{anchor:"transformers.UdopForConditionalGeneration.forward.example",$$slots:{default:[Ws]},$$scope:{ctx:j}}}),no=new U({props:{name:"class transformers.UdopEncoderModel",anchor:"transformers.UdopEncoderModel",parameters:[{name:"config",val:": UdopConfig"}],parametersDescription:[{anchor:"transformers.UdopEncoderModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopConfig">UdopConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30929/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/modeling_udop.py#L1933"}}),so=new U({props:{name:"forward",anchor:"transformers.UdopEncoderModel.forward",parameters:[{name:"input_ids",val:": Tensor = None"},{name:"bbox",val:": Dict = None"},{name:"attention_mask",val:": Tensor = None"},{name:"pixel_values",val:": Optional = None"},{name:"visual_bbox",val:": Dict = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.UdopEncoderModel.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. T5 is a model with relative position embeddings so you
should be able to pad the inputs on both the right and the left.</p>
<p>Indices can be obtained using <a href="/docs/transformers/pr_30929/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30929/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for detail.</p>
<p>To know more on how to prepare <code>input_ids</code> for pretraining take a look a <a href="./t5#training">T5 Training</a>.`,name:"input_ids"},{anchor:"transformers.UdopEncoderModel.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.UdopEncoderModel.forward.bbox",description:`<strong>bbox</strong> (<code>torch.LongTensor</code> of shape <code>({0}, 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.</p>
<p>Note that <code>sequence_length = token_sequence_length + patch_sequence_length + 1</code> where <code>1</code> is for [CLS]
token. See <code>pixel_values</code> for <code>patch_sequence_length</code>.`,name:"bbox"},{anchor:"transformers.UdopEncoderModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Batch of document images. Each image is divided into patches of shape <code>(num_channels, config.patch_size, config.patch_size)</code> and the total number of patches (=<code>patch_sequence_length</code>) equals to <code>((height / config.patch_size) * (width / config.patch_size))</code>.`,name:"pixel_values"},{anchor:"transformers.UdopEncoderModel.forward.visual_bbox",description:`<strong>visual_bbox</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, patch_sequence_length, 4)</code>, <em>optional</em>) &#x2014;
Bounding boxes of each patch in the image. If not provided, bounding boxes are created in the model.`,name:"visual_bbox"},{anchor:"transformers.UdopEncoderModel.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.UdopEncoderModel.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 <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.UdopEncoderModel.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.UdopEncoderModel.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.UdopEncoderModel.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/pr_30929/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_30929/src/transformers/models/udop/modeling_udop.py#L1979",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.udop.modeling_udop.BaseModelOutputWithAttentionMask</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_30929/en/model_doc/udop#transformers.UdopConfig"
>UdopConfig</a>) and inputs.</p>
<ul>
<li><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. If <code>past_key_values</code> is used only
the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</li>
<li><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or</li>
<li><strong>when</strong> <code>config.use_cache=True</code>) — Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>. Contains pre-computed hidden-states (key and values in the
self-attention blocks and optionally if <code>config.is_encoder_decoder=True</code> in the cross-attention blocks)
that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or</li>
<li><strong>when</strong> <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>. Hidden-states of
the model at the output of each layer plus the optional initial embedding outputs.</li>
<li><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when</li>
<li><strong><code>config.output_attentions=True</code>):</strong>
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.</li>
<li><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> and</li>
<li><strong><code>config.add_cross_attention=True</code></strong> 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>. Attentions weights of the decoder’s cross-attention layer, after the attention softmax,
used to compute the weighted average in the cross-attention heads.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.udop.modeling_udop.BaseModelOutputWithAttentionMask</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),re=new So({props:{$$slots:{default:[Rs]},$$scope:{ctx:j}}}),de=new Jn({props:{anchor:"transformers.UdopEncoderModel.forward.example",$$slots:{default:[Hs]},$$scope:{ctx:j}}}),ao=new Ls({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/udop.md"}}),{c(){i=r("meta"),v=n(),p=r("p"),k=n(),h(x.$$.fragment),m=n(),h(z.$$.fragment),Ao=n(),_e=r("p"),_e.innerHTML=In,Yo=n(),ge=r("p"),ge.textContent=Ln,Qo=n(),be=r("p"),be.textContent=Bn,Ko=n(),X=r("img"),et=n(),ke=r("small"),ke.innerHTML=Gn,ot=n(),h(ve.$$.fragment),tt=n(),Te=r("ul"),Te.innerHTML=Pn,nt=n(),h(ye.$$.fragment),st=n(),we=r("p"),we.innerHTML=Zn,at=n(),h(xe.$$.fragment),rt=n(),Me=r("p"),Me.innerHTML=Wn,dt=n(),Ue=r("ul"),Ue.innerHTML=Rn,it=n(),ze=r("p"),ze.innerHTML=Hn,lt=n(),h($e.$$.fragment),ct=n(),je=r("p"),je.textContent=Dn,pt=n(),Ce=r("ul"),Ce.innerHTML=En,mt=n(),h(qe.$$.fragment),ht=n(),Z=r("div"),h(Fe.$$.fragment),qt=n(),lo=r("p"),lo.innerHTML=On,Ft=n(),co=r("p"),co.innerHTML=Vn,ut=n(),h(Je.$$.fragment),ft=n(),$=r("div"),h(Ie.$$.fragment),Jt=n(),po=r("p"),po.innerHTML=Sn,It=n(),mo=r("p"),mo.innerHTML=Xn,Lt=n(),W=r("div"),h(Le.$$.fragment),Bt=n(),ho=r("p"),ho.textContent=An,Nt=n(),uo=r("ul"),uo.innerHTML=Yn,Gt=n(),A=r("div"),h(Be.$$.fragment),Pt=n(),fo=r("p"),fo.innerHTML=Qn,Zt=n(),Y=r("div"),h(Ne.$$.fragment),Wt=n(),_o=r("p"),_o.textContent=Kn,Rt=n(),go=r("div"),h(Ge.$$.fragment),_t=n(),h(Pe.$$.fragment),gt=n(),y=r("div"),h(Ze.$$.fragment),Ht=n(),bo=r("p"),bo.innerHTML=es,Dt=n(),ko=r("p"),ko.innerHTML=os,Et=n(),R=r("div"),h(We.$$.fragment),Ot=n(),vo=r("p"),vo.textContent=ts,Vt=n(),h(Q.$$.fragment),St=n(),H=r("div"),h(Re.$$.fragment),Xt=n(),To=r("p"),To.textContent=ns,At=n(),yo=r("ul"),yo.innerHTML=ss,Yt=n(),K=r("div"),h(He.$$.fragment),Qt=n(),wo=r("p"),wo.textContent=as,Kt=n(),ee=r("div"),h(De.$$.fragment),en=n(),xo=r("p"),xo.textContent=rs,on=n(),Mo=r("div"),h(Ee.$$.fragment),tn=n(),D=r("div"),h(Oe.$$.fragment),nn=n(),Uo=r("p"),Uo.textContent=ds,sn=n(),h(oe.$$.fragment),bt=n(),h(Ve.$$.fragment),kt=n(),C=r("div"),h(Se.$$.fragment),an=n(),zo=r("p"),zo.textContent=is,rn=n(),$o=r("p"),$o.innerHTML=ls,dn=n(),jo=r("p"),jo.innerHTML=cs,ln=n(),Co=r("p"),Co.innerHTML=ps,cn=n(),L=r("div"),h(Xe.$$.fragment),pn=n(),qo=r("p"),qo.innerHTML=ms,mn=n(),Fo=r("p"),Fo.innerHTML=hs,hn=n(),Jo=r("p"),Jo.textContent=us,vt=n(),Ae=r("p"),Ae.textContent=fs,Tt=n(),J=r("div"),h(Ye.$$.fragment),un=n(),Io=r("p"),Io.innerHTML=_s,fn=n(),Lo=r("p"),Lo.innerHTML=gs,_n=n(),B=r("div"),h(Qe.$$.fragment),gn=n(),Bo=r("p"),Bo.innerHTML=bs,bn=n(),h(te.$$.fragment),kn=n(),h(ne.$$.fragment),yt=n(),Ke=r("p"),Ke.textContent=ks,wt=n(),F=r("div"),h(eo.$$.fragment),vn=n(),No=r("p"),No.textContent=vs,Tn=n(),Go=r("p"),Go.innerHTML=Ts,yn=n(),Po=r("p"),Po.innerHTML=ys,wn=n(),N=r("div"),h(oo.$$.fragment),xn=n(),Zo=r("p"),Zo.innerHTML=ws,Mn=n(),h(se.$$.fragment),Un=n(),h(ae.$$.fragment),xt=n(),to=r("p"),to.textContent=xs,Mt=n(),I=r("div"),h(no.$$.fragment),zn=n(),Wo=r("p"),Wo.innerHTML=Ms,$n=n(),Ro=r("p"),Ro.innerHTML=Us,jn=n(),G=r("div"),h(so.$$.fragment),Cn=n(),Ho=r("p"),Ho.innerHTML=zs,qn=n(),h(re.$$.fragment),Fn=n(),h(de.$$.fragment),Ut=n(),h(ao.$$.fragment),zt=n(),Oo=r("p"),this.h()},l(e){const a=Is("svelte-u9bgzb",document.head);i=d(a,"META",{name:!0,content:!0}),a.forEach(t),v=s(e),p=d(e,"P",{}),w(p).forEach(t),k=s(e),u(x.$$.fragment,e),m=s(e),u(z.$$.fragment,e),Ao=s(e),_e=d(e,"P",{"data-svelte-h":!0}),c(_e)!=="svelte-zcjc2q"&&(_e.innerHTML=In),Yo=s(e),ge=d(e,"P",{"data-svelte-h":!0}),c(ge)!=="svelte-vfdo9a"&&(ge.textContent=Ln),Qo=s(e),be=d(e,"P",{"data-svelte-h":!0}),c(be)!=="svelte-xdaud3"&&(be.textContent=Bn),Ko=s(e),X=d(e,"IMG",{src:!0,alt:!0,width:!0}),et=s(e),ke=d(e,"SMALL",{"data-svelte-h":!0}),c(ke)!=="svelte-gontjk"&&(ke.innerHTML=Gn),ot=s(e),u(ve.$$.fragment,e),tt=s(e),Te=d(e,"UL",{"data-svelte-h":!0}),c(Te)!=="svelte-1u7kadg"&&(Te.innerHTML=Pn),nt=s(e),u(ye.$$.fragment,e),st=s(e),we=d(e,"P",{"data-svelte-h":!0}),c(we)!=="svelte-rq1xjz"&&(we.innerHTML=Zn),at=s(e),u(xe.$$.fragment,e),rt=s(e),Me=d(e,"P",{"data-svelte-h":!0}),c(Me)!=="svelte-18pm708"&&(Me.innerHTML=Wn),dt=s(e),Ue=d(e,"UL",{"data-svelte-h":!0}),c(Ue)!=="svelte-1grvrbk"&&(Ue.innerHTML=Rn),it=s(e),ze=d(e,"P",{"data-svelte-h":!0}),c(ze)!=="svelte-1cfgh3j"&&(ze.innerHTML=Hn),lt=s(e),u($e.$$.fragment,e),ct=s(e),je=d(e,"P",{"data-svelte-h":!0}),c(je)!=="svelte-qaon2f"&&(je.textContent=Dn),pt=s(e),Ce=d(e,"UL",{"data-svelte-h":!0}),c(Ce)!=="svelte-157jvhr"&&(Ce.innerHTML=En),mt=s(e),u(qe.$$.fragment,e),ht=s(e),Z=d(e,"DIV",{class:!0});var O=w(Z);u(Fe.$$.fragment,O),qt=s(O),lo=d(O,"P",{"data-svelte-h":!0}),c(lo)!=="svelte-1iy9c4w"&&(lo.innerHTML=On),Ft=s(O),co=d(O,"P",{"data-svelte-h":!0}),c(co)!=="svelte-o0f5yn"&&(co.innerHTML=Vn),O.forEach(t),ut=s(e),u(Je.$$.fragment,e),ft=s(e),$=d(e,"DIV",{class:!0});var q=w($);u(Ie.$$.fragment,q),Jt=s(q),po=d(q,"P",{"data-svelte-h":!0}),c(po)!=="svelte-ctvq37"&&(po.innerHTML=Sn),It=s(q),mo=d(q,"P",{"data-svelte-h":!0}),c(mo)!=="svelte-ng7ul1"&&(mo.innerHTML=Xn),Lt=s(q),W=d(q,"DIV",{class:!0});var V=w(W);u(Le.$$.fragment,V),Bt=s(V),ho=d(V,"P",{"data-svelte-h":!0}),c(ho)!=="svelte-1wjq39d"&&(ho.textContent=An),Nt=s(V),uo=d(V,"UL",{"data-svelte-h":!0}),c(uo)!=="svelte-8gh3n2"&&(uo.innerHTML=Yn),V.forEach(t),Gt=s(q),A=d(q,"DIV",{class:!0});var ro=w(A);u(Be.$$.fragment,ro),Pt=s(ro),fo=d(ro,"P",{"data-svelte-h":!0}),c(fo)!=="svelte-1f4f5kp"&&(fo.innerHTML=Qn),ro.forEach(t),Zt=s(q),Y=d(q,"DIV",{class:!0});var io=w(Y);u(Ne.$$.fragment,io),Wt=s(io),_o=d(io,"P",{"data-svelte-h":!0}),c(_o)!=="svelte-fl5ab0"&&(_o.textContent=Kn),io.forEach(t),Rt=s(q),go=d(q,"DIV",{class:!0});var Vo=w(go);u(Ge.$$.fragment,Vo),Vo.forEach(t),q.forEach(t),_t=s(e),u(Pe.$$.fragment,e),gt=s(e),y=d(e,"DIV",{class:!0});var M=w(y);u(Ze.$$.fragment,M),Ht=s(M),bo=d(M,"P",{"data-svelte-h":!0}),c(bo)!=="svelte-b40ttn"&&(bo.innerHTML=es),Dt=s(M),ko=d(M,"P",{"data-svelte-h":!0}),c(ko)!=="svelte-1fi81bd"&&(ko.innerHTML=os),Et=s(M),R=d(M,"DIV",{class:!0});var S=w(R);u(We.$$.fragment,S),Ot=s(S),vo=d(S,"P",{"data-svelte-h":!0}),c(vo)!=="svelte-6p21pf"&&(vo.textContent=ts),Vt=s(S),u(Q.$$.fragment,S),S.forEach(t),St=s(M),H=d(M,"DIV",{class:!0});var Do=w(H);u(Re.$$.fragment,Do),Xt=s(Do),To=d(Do,"P",{"data-svelte-h":!0}),c(To)!=="svelte-1ooxl9e"&&(To.textContent=ns),At=s(Do),yo=d(Do,"UL",{"data-svelte-h":!0}),c(yo)!=="svelte-rq8uot"&&(yo.innerHTML=ss),Do.forEach(t),Yt=s(M),K=d(M,"DIV",{class:!0});var jt=w(K);u(He.$$.fragment,jt),Qt=s(jt),wo=d(jt,"P",{"data-svelte-h":!0}),c(wo)!=="svelte-1w6bb17"&&(wo.textContent=as),jt.forEach(t),Kt=s(M),ee=d(M,"DIV",{class:!0});var Ct=w(ee);u(De.$$.fragment,Ct),en=s(Ct),xo=d(Ct,"P",{"data-svelte-h":!0}),c(xo)!=="svelte-bub0ru"&&(xo.textContent=rs),Ct.forEach(t),on=s(M),Mo=d(M,"DIV",{class:!0});var $s=w(Mo);u(Ee.$$.fragment,$s),$s.forEach(t),tn=s(M),D=d(M,"DIV",{class:!0});var Eo=w(D);u(Oe.$$.fragment,Eo),nn=s(Eo),Uo=d(Eo,"P",{"data-svelte-h":!0}),c(Uo)!=="svelte-ma945j"&&(Uo.textContent=ds),sn=s(Eo),u(oe.$$.fragment,Eo),Eo.forEach(t),M.forEach(t),bt=s(e),u(Ve.$$.fragment,e),kt=s(e),C=d(e,"DIV",{class:!0});var P=w(C);u(Se.$$.fragment,P),an=s(P),zo=d(P,"P",{"data-svelte-h":!0}),c(zo)!=="svelte-1ti6n5s"&&(zo.textContent=is),rn=s(P),$o=d(P,"P",{"data-svelte-h":!0}),c($o)!=="svelte-b2alsk"&&($o.innerHTML=ls),dn=s(P),jo=d(P,"P",{"data-svelte-h":!0}),c(jo)!=="svelte-1ebmbll"&&(jo.innerHTML=cs),ln=s(P),Co=d(P,"P",{"data-svelte-h":!0}),c(Co)!=="svelte-mfoszy"&&(Co.innerHTML=ps),cn=s(P),L=d(P,"DIV",{class:!0});var ie=w(L);u(Xe.$$.fragment,ie),pn=s(ie),qo=d(ie,"P",{"data-svelte-h":!0}),c(qo)!=="svelte-23yewj"&&(qo.innerHTML=ms),mn=s(ie),Fo=d(ie,"P",{"data-svelte-h":!0}),c(Fo)!=="svelte-1c5ykyr"&&(Fo.innerHTML=hs),hn=s(ie),Jo=d(ie,"P",{"data-svelte-h":!0}),c(Jo)!=="svelte-ws0hzs"&&(Jo.textContent=us),ie.forEach(t),P.forEach(t),vt=s(e),Ae=d(e,"P",{"data-svelte-h":!0}),c(Ae)!=="svelte-1c99ntw"&&(Ae.textContent=fs),Tt=s(e),J=d(e,"DIV",{class:!0});var le=w(J);u(Ye.$$.fragment,le),un=s(le),Io=d(le,"P",{"data-svelte-h":!0}),c(Io)!=="svelte-r9n0m8"&&(Io.innerHTML=_s),fn=s(le),Lo=d(le,"P",{"data-svelte-h":!0}),c(Lo)!=="svelte-1ydu1el"&&(Lo.innerHTML=gs),_n=s(le),B=d(le,"DIV",{class:!0});var ce=w(B);u(Qe.$$.fragment,ce),gn=s(ce),Bo=d(ce,"P",{"data-svelte-h":!0}),c(Bo)!=="svelte-sp5ygi"&&(Bo.innerHTML=bs),bn=s(ce),u(te.$$.fragment,ce),kn=s(ce),u(ne.$$.fragment,ce),ce.forEach(t),le.forEach(t),yt=s(e),Ke=d(e,"P",{"data-svelte-h":!0}),c(Ke)!=="svelte-1582l32"&&(Ke.textContent=ks),wt=s(e),F=d(e,"DIV",{class:!0});var E=w(F);u(eo.$$.fragment,E),vn=s(E),No=d(E,"P",{"data-svelte-h":!0}),c(No)!=="svelte-170n5ee"&&(No.textContent=vs),Tn=s(E),Go=d(E,"P",{"data-svelte-h":!0}),c(Go)!=="svelte-1g82if4"&&(Go.innerHTML=Ts),yn=s(E),Po=d(E,"P",{"data-svelte-h":!0}),c(Po)!=="svelte-1ydu1el"&&(Po.innerHTML=ys),wn=s(E),N=d(E,"DIV",{class:!0});var pe=w(N);u(oo.$$.fragment,pe),xn=s(pe),Zo=d(pe,"P",{"data-svelte-h":!0}),c(Zo)!=="svelte-e1nbig"&&(Zo.innerHTML=ws),Mn=s(pe),u(se.$$.fragment,pe),Un=s(pe),u(ae.$$.fragment,pe),pe.forEach(t),E.forEach(t),xt=s(e),to=d(e,"P",{"data-svelte-h":!0}),c(to)!=="svelte-1o129rm"&&(to.textContent=xs),Mt=s(e),I=d(e,"DIV",{class:!0});var me=w(I);u(no.$$.fragment,me),zn=s(me),Wo=d(me,"P",{"data-svelte-h":!0}),c(Wo)!=="svelte-uu5cu4"&&(Wo.innerHTML=Ms),$n=s(me),Ro=d(me,"P",{"data-svelte-h":!0}),c(Ro)!=="svelte-1ydu1el"&&(Ro.innerHTML=Us),jn=s(me),G=d(me,"DIV",{class:!0});var he=w(G);u(so.$$.fragment,he),Cn=s(he),Ho=d(he,"P",{"data-svelte-h":!0}),c(Ho)!=="svelte-1tvlyy4"&&(Ho.innerHTML=zs),qn=s(he),u(re.$$.fragment,he),Fn=s(he),u(de.$$.fragment,he),he.forEach(t),me.forEach(t),Ut=s(e),u(ao.$$.fragment,e),zt=s(e),Oo=d(e,"P",{}),w(Oo).forEach(t),this.h()},h(){T(i,"name","hf:doc:metadata"),T(i,"content",Es),Cs(X.src,Nn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/udop_architecture.jpg")||T(X,"src",Nn),T(X,"alt","drawing"),T(X,"width","600"),T(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(go,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(Mo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(I,"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,a){o(document.head,i),l(e,v,a),l(e,p,a),l(e,k,a),f(x,e,a),l(e,m,a),f(z,e,a),l(e,Ao,a),l(e,_e,a),l(e,Yo,a),l(e,ge,a),l(e,Qo,a),l(e,be,a),l(e,Ko,a),l(e,X,a),l(e,et,a),l(e,ke,a),l(e,ot,a),f(ve,e,a),l(e,tt,a),l(e,Te,a),l(e,nt,a),f(ye,e,a),l(e,st,a),l(e,we,a),l(e,at,a),f(xe,e,a),l(e,rt,a),l(e,Me,a),l(e,dt,a),l(e,Ue,a),l(e,it,a),l(e,ze,a),l(e,lt,a),f($e,e,a),l(e,ct,a),l(e,je,a),l(e,pt,a),l(e,Ce,a),l(e,mt,a),f(qe,e,a),l(e,ht,a),l(e,Z,a),f(Fe,Z,null),o(Z,qt),o(Z,lo),o(Z,Ft),o(Z,co),l(e,ut,a),f(Je,e,a),l(e,ft,a),l(e,$,a),f(Ie,$,null),o($,Jt),o($,po),o($,It),o($,mo),o($,Lt),o($,W),f(Le,W,null),o(W,Bt),o(W,ho),o(W,Nt),o(W,uo),o($,Gt),o($,A),f(Be,A,null),o(A,Pt),o(A,fo),o($,Zt),o($,Y),f(Ne,Y,null),o(Y,Wt),o(Y,_o),o($,Rt),o($,go),f(Ge,go,null),l(e,_t,a),f(Pe,e,a),l(e,gt,a),l(e,y,a),f(Ze,y,null),o(y,Ht),o(y,bo),o(y,Dt),o(y,ko),o(y,Et),o(y,R),f(We,R,null),o(R,Ot),o(R,vo),o(R,Vt),f(Q,R,null),o(y,St),o(y,H),f(Re,H,null),o(H,Xt),o(H,To),o(H,At),o(H,yo),o(y,Yt),o(y,K),f(He,K,null),o(K,Qt),o(K,wo),o(y,Kt),o(y,ee),f(De,ee,null),o(ee,en),o(ee,xo),o(y,on),o(y,Mo),f(Ee,Mo,null),o(y,tn),o(y,D),f(Oe,D,null),o(D,nn),o(D,Uo),o(D,sn),f(oe,D,null),l(e,bt,a),f(Ve,e,a),l(e,kt,a),l(e,C,a),f(Se,C,null),o(C,an),o(C,zo),o(C,rn),o(C,$o),o(C,dn),o(C,jo),o(C,ln),o(C,Co),o(C,cn),o(C,L),f(Xe,L,null),o(L,pn),o(L,qo),o(L,mn),o(L,Fo),o(L,hn),o(L,Jo),l(e,vt,a),l(e,Ae,a),l(e,Tt,a),l(e,J,a),f(Ye,J,null),o(J,un),o(J,Io),o(J,fn),o(J,Lo),o(J,_n),o(J,B),f(Qe,B,null),o(B,gn),o(B,Bo),o(B,bn),f(te,B,null),o(B,kn),f(ne,B,null),l(e,yt,a),l(e,Ke,a),l(e,wt,a),l(e,F,a),f(eo,F,null),o(F,vn),o(F,No),o(F,Tn),o(F,Go),o(F,yn),o(F,Po),o(F,wn),o(F,N),f(oo,N,null),o(N,xn),o(N,Zo),o(N,Mn),f(se,N,null),o(N,Un),f(ae,N,null),l(e,xt,a),l(e,to,a),l(e,Mt,a),l(e,I,a),f(no,I,null),o(I,zn),o(I,Wo),o(I,$n),o(I,Ro),o(I,jn),o(I,G),f(so,G,null),o(G,Cn),o(G,Ho),o(G,qn),f(re,G,null),o(G,Fn),f(de,G,null),l(e,Ut,a),f(ao,e,a),l(e,zt,a),l(e,Oo,a),$t=!0},p(e,[a]){const O={};a&2&&(O.$$scope={dirty:a,ctx:e}),Q.$set(O);const q={};a&2&&(q.$$scope={dirty:a,ctx:e}),oe.$set(q);const V={};a&2&&(V.$$scope={dirty:a,ctx:e}),te.$set(V);const ro={};a&2&&(ro.$$scope={dirty:a,ctx:e}),ne.$set(ro);const io={};a&2&&(io.$$scope={dirty:a,ctx:e}),se.$set(io);const Vo={};a&2&&(Vo.$$scope={dirty:a,ctx:e}),ae.$set(Vo);const M={};a&2&&(M.$$scope={dirty:a,ctx:e}),re.$set(M);const S={};a&2&&(S.$$scope={dirty:a,ctx:e}),de.$set(S)},i(e){$t||(_(x.$$.fragment,e),_(z.$$.fragment,e),_(ve.$$.fragment,e),_(ye.$$.fragment,e),_(xe.$$.fragment,e),_($e.$$.fragment,e),_(qe.$$.fragment,e),_(Fe.$$.fragment,e),_(Je.$$.fragment,e),_(Ie.$$.fragment,e),_(Le.$$.fragment,e),_(Be.$$.fragment,e),_(Ne.$$.fragment,e),_(Ge.$$.fragment,e),_(Pe.$$.fragment,e),_(Ze.$$.fragment,e),_(We.$$.fragment,e),_(Q.$$.fragment,e),_(Re.$$.fragment,e),_(He.$$.fragment,e),_(De.$$.fragment,e),_(Ee.$$.fragment,e),_(Oe.$$.fragment,e),_(oe.$$.fragment,e),_(Ve.$$.fragment,e),_(Se.$$.fragment,e),_(Xe.$$.fragment,e),_(Ye.$$.fragment,e),_(Qe.$$.fragment,e),_(te.$$.fragment,e),_(ne.$$.fragment,e),_(eo.$$.fragment,e),_(oo.$$.fragment,e),_(se.$$.fragment,e),_(ae.$$.fragment,e),_(no.$$.fragment,e),_(so.$$.fragment,e),_(re.$$.fragment,e),_(de.$$.fragment,e),_(ao.$$.fragment,e),$t=!0)},o(e){g(x.$$.fragment,e),g(z.$$.fragment,e),g(ve.$$.fragment,e),g(ye.$$.fragment,e),g(xe.$$.fragment,e),g($e.$$.fragment,e),g(qe.$$.fragment,e),g(Fe.$$.fragment,e),g(Je.$$.fragment,e),g(Ie.$$.fragment,e),g(Le.$$.fragment,e),g(Be.$$.fragment,e),g(Ne.$$.fragment,e),g(Ge.$$.fragment,e),g(Pe.$$.fragment,e),g(Ze.$$.fragment,e),g(We.$$.fragment,e),g(Q.$$.fragment,e),g(Re.$$.fragment,e),g(He.$$.fragment,e),g(De.$$.fragment,e),g(Ee.$$.fragment,e),g(Oe.$$.fragment,e),g(oe.$$.fragment,e),g(Ve.$$.fragment,e),g(Se.$$.fragment,e),g(Xe.$$.fragment,e),g(Ye.$$.fragment,e),g(Qe.$$.fragment,e),g(te.$$.fragment,e),g(ne.$$.fragment,e),g(eo.$$.fragment,e),g(oo.$$.fragment,e),g(se.$$.fragment,e),g(ae.$$.fragment,e),g(no.$$.fragment,e),g(so.$$.fragment,e),g(re.$$.fragment,e),g(de.$$.fragment,e),g(ao.$$.fragment,e),$t=!1},d(e){e&&(t(v),t(p),t(k),t(m),t(Ao),t(_e),t(Yo),t(ge),t(Qo),t(be),t(Ko),t(X),t(et),t(ke),t(ot),t(tt),t(Te),t(nt),t(st),t(we),t(at),t(rt),t(Me),t(dt),t(Ue),t(it),t(ze),t(lt),t(ct),t(je),t(pt),t(Ce),t(mt),t(ht),t(Z),t(ut),t(ft),t($),t(_t),t(gt),t(y),t(bt),t(kt),t(C),t(vt),t(Ae),t(Tt),t(J),t(yt),t(Ke),t(wt),t(F),t(xt),t(to),t(Mt),t(I),t(Ut),t(zt),t(Oo)),t(i),b(x,e),b(z,e),b(ve,e),b(ye,e),b(xe,e),b($e,e),b(qe,e),b(Fe),b(Je,e),b(Ie),b(Le),b(Be),b(Ne),b(Ge),b(Pe,e),b(Ze),b(We),b(Q),b(Re),b(He),b(De),b(Ee),b(Oe),b(oe),b(Ve,e),b(Se),b(Xe),b(Ye),b(Qe),b(te),b(ne),b(eo),b(oo),b(se),b(ae),b(no),b(so),b(re),b(de),b(ao,e)}}}const Es='{"title":"UDOP","local":"udop","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"UdopConfig","local":"transformers.UdopConfig","sections":[],"depth":2},{"title":"UdopTokenizer","local":"transformers.UdopTokenizer","sections":[],"depth":2},{"title":"UdopTokenizerFast","local":"transformers.UdopTokenizerFast","sections":[],"depth":2},{"title":"UdopProcessor","local":"transformers.UdopProcessor","sections":[],"depth":2}],"depth":1}';function Os(j){return qs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ea extends Fs{constructor(i){super(),Js(this,i,Os,Ds,js,{})}}export{ea as component};
