import{s as Us,f as zs,o as $s,n as fe}from"../chunks/scheduler.25b97de1.js";import{S as js,i as Cs,g as r,s as t,r as h,A as qs,h as d,f as s,c as n,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.ffac8efa.js";import{C as Xo}from"../chunks/CodeBlock.e6cd0d95.js";import{E as Fn}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as W,E as Js}from"../chunks/EditOnGithub.91d95064.js";function Fs(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&&s(i)}}}function Is(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&&s(i)}}}function Ls(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&&s(i)}}}function Ns(j){let i,v="Example:",p,k,x;return k=new Xo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBBdXRvTW9kZWwlMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQSUyMyUyMGxvYWQlMjBtb2RlbCUyMGFuZCUyMHByb2Nlc3NvciUwQSUyMyUyMGluJTIwdGhpcyUyMGNhc2UlMkMlMjB3ZSUyMGFscmVhZHklMjBoYXZlJTIwcGVyZm9ybWVkJTIwT0NSJTIwb3Vyc2VsdmVzJTBBJTIzJTIwc28lMjB3ZSUyMGluaXRpYWxpemUlMjB0aGUlMjBwcm9jZXNzb3IlMjB3aXRoJTIwJTYwYXBwbHlfb2NyJTNERmFsc2UlNjAlMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZ1ZG9wLWxhcmdlJTIyJTJDJTIwYXBwbHlfb2NyJTNERmFsc2UpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnVkb3AtbGFyZ2UlMjIpJTBBJTBBJTIzJTIwbG9hZCUyMGFuJTIwZXhhbXBsZSUyMGltYWdlJTJDJTIwYWxvbmclMjB3aXRoJTIwdGhlJTIwd29yZHMlMjBhbmQlMjBjb29yZGluYXRlcyUwQSUyMyUyMHdoaWNoJTIwd2VyZSUyMGV4dHJhY3RlZCUyMHVzaW5nJTIwYW4lMjBPQ1IlMjBlbmdpbmUlMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMm5pZWxzciUyRmZ1bnNkLWxheW91dGxtdjMlMjIlMkMlMjBzcGxpdCUzRCUyMnRyYWluJTIyJTJDJTIwdHJ1c3RfcmVtb3RlX2NvZGUlM0RUcnVlKSUwQWV4YW1wbGUlMjAlM0QlMjBkYXRhc2V0JTVCMCU1RCUwQWltYWdlJTIwJTNEJTIwZXhhbXBsZSU1QiUyMmltYWdlJTIyJTVEJTBBd29yZHMlMjAlM0QlMjBleGFtcGxlJTVCJTIydG9rZW5zJTIyJTVEJTBBYm94ZXMlMjAlM0QlMjBleGFtcGxlJTVCJTIyYmJveGVzJTIyJTVEJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlJTJDJTIwd29yZHMlMkMlMjBib3hlcyUzRGJveGVzJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEFkZWNvZGVyX2lucHV0X2lkcyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIlNUJtb2RlbC5jb25maWcuZGVjb2Rlcl9zdGFydF90b2tlbl9pZCU1RCU1RCklMEElMEElMjMlMjBmb3J3YXJkJTIwcGFzcyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGRlY29kZXJfaW5wdXRfaWRzJTNEZGVjb2Rlcl9pbnB1dF9pZHMpJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQWxpc3QobGFzdF9oaWRkZW5fc3RhdGVzLnNoYXBlKQ==",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>, trust_remote_code=<span class="hljs-literal">True</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=t(),h(k.$$.fragment)},l(m){i=d(m,"P",{"data-svelte-h":!0}),c(i)!=="svelte-11lpom8"&&(i.textContent=v),p=n(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&&(s(i),s(p)),b(k,m)}}}function Bs(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&&s(i)}}}function Gs(j){let i,v="Examples:",p,k,x;return k=new Xo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBVZG9wRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBJTIzJTIwbG9hZCUyMG1vZGVsJTIwYW5kJTIwcHJvY2Vzc29yJTBBJTIzJTIwaW4lMjB0aGlzJTIwY2FzZSUyQyUyMHdlJTIwYWxyZWFkeSUyMGhhdmUlMjBwZXJmb3JtZWQlMjBPQ1IlMjBvdXJzZWx2ZXMlMEElMjMlMjBzbyUyMHdlJTIwaW5pdGlhbGl6ZSUyMHRoZSUyMHByb2Nlc3NvciUyMHdpdGglMjAlNjBhcHBseV9vY3IlM0RGYWxzZSU2MCUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnVkb3AtbGFyZ2UlMjIlMkMlMjBhcHBseV9vY3IlM0RGYWxzZSklMEFtb2RlbCUyMCUzRCUyMFVkb3BGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnVkb3AtbGFyZ2UlMjIpJTBBJTBBJTIzJTIwbG9hZCUyMGFuJTIwZXhhbXBsZSUyMGltYWdlJTJDJTIwYWxvbmclMjB3aXRoJTIwdGhlJTIwd29yZHMlMjBhbmQlMjBjb29yZGluYXRlcyUwQSUyMyUyMHdoaWNoJTIwd2VyZSUyMGV4dHJhY3RlZCUyMHVzaW5nJTIwYW4lMjBPQ1IlMjBlbmdpbmUlMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMm5pZWxzciUyRmZ1bnNkLWxheW91dGxtdjMlMjIlMkMlMjBzcGxpdCUzRCUyMnRyYWluJTIyJTJDJTIwdHJ1c3RfcmVtb3RlX2NvZGUlM0RUcnVlKSUwQWV4YW1wbGUlMjAlM0QlMjBkYXRhc2V0JTVCMCU1RCUwQWltYWdlJTIwJTNEJTIwZXhhbXBsZSU1QiUyMmltYWdlJTIyJTVEJTBBd29yZHMlMjAlM0QlMjBleGFtcGxlJTVCJTIydG9rZW5zJTIyJTVEJTBBYm94ZXMlMjAlM0QlMjBleGFtcGxlJTVCJTIyYmJveGVzJTIyJTVEJTBBJTBBJTIzJTIwb25lJTIwY2FuJTIwdXNlJTIwdGhlJTIwdmFyaW91cyUyMHRhc2slMjBwcmVmaXhlcyUyMChwcm9tcHRzKSUyMHVzZWQlMjBkdXJpbmclMjBwcmUtdHJhaW5pbmclMEElMjMlMjBlLmcuJTIwdGhlJTIwdGFzayUyMHByZWZpeCUyMGZvciUyMERvY1ZRQSUyMGlzJTIwJTIyUXVlc3Rpb24lMjBhbnN3ZXJpbmcuJTIwJTIyJTBBcXVlc3Rpb24lMjAlM0QlMjAlMjJRdWVzdGlvbiUyMGFuc3dlcmluZy4lMjBXaGF0JTIwaXMlMjB0aGUlMjBkYXRlJTIwb24lMjB0aGUlMjBmb3JtJTNGJTIyJTBBZW5jb2RpbmclMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2UlMkMlMjBxdWVzdGlvbiUyQyUyMHdvcmRzJTJDJTIwYm94ZXMlM0Rib3hlcyUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBJTIzJTIwYXV0b3JlZ3Jlc3NpdmUlMjBnZW5lcmF0aW9uJTBBcHJlZGljdGVkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqZW5jb2RpbmcpJTBBcHJpbnQocHJvY2Vzc29yLmJhdGNoX2RlY29kZShwcmVkaWN0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RCk=",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>, trust_remote_code=<span class="hljs-literal">True</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=t(),h(k.$$.fragment)},l(m){i=d(m,"P",{"data-svelte-h":!0}),c(i)!=="svelte-kvfsh7"&&(i.textContent=v),p=n(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&&(s(i),s(p)),b(k,m)}}}function Ps(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&&s(i)}}}function Zs(j){let i,v="Example:",p,k,x;return k=new Xo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBVZG9wRW5jb2Rlck1vZGVsJTBBZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGhmX2h1Yl9kb3dubG9hZCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQSUyMyUyMGxvYWQlMjBtb2RlbCUyMGFuZCUyMHByb2Nlc3NvciUwQSUyMyUyMGluJTIwdGhpcyUyMGNhc2UlMkMlMjB3ZSUyMGFscmVhZHklMjBoYXZlJTIwcGVyZm9ybWVkJTIwT0NSJTIwb3Vyc2VsdmVzJTBBJTIzJTIwc28lMjB3ZSUyMGluaXRpYWxpemUlMjB0aGUlMjBwcm9jZXNzb3IlMjB3aXRoJTIwJTYwYXBwbHlfb2NyJTNERmFsc2UlNjAlMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZ1ZG9wLWxhcmdlJTIyJTJDJTIwYXBwbHlfb2NyJTNERmFsc2UpJTBBbW9kZWwlMjAlM0QlMjBVZG9wRW5jb2Rlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZ1ZG9wLWxhcmdlJTIyKSUwQSUwQSUyMyUyMGxvYWQlMjBhbiUyMGV4YW1wbGUlMjBpbWFnZSUyQyUyMGFsb25nJTIwd2l0aCUyMHRoZSUyMHdvcmRzJTIwYW5kJTIwY29vcmRpbmF0ZXMlMEElMjMlMjB3aGljaCUyMHdlcmUlMjBleHRyYWN0ZWQlMjB1c2luZyUyMGFuJTIwT0NSJTIwZW5naW5lJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJuaWVsc3IlMkZmdW5zZC1sYXlvdXRsbXYzJTIyJTJDJTIwc3BsaXQlM0QlMjJ0cmFpbiUyMiUyQyUyMHRydXN0X3JlbW90ZV9jb2RlJTNEVHJ1ZSklMEFleGFtcGxlJTIwJTNEJTIwZGF0YXNldCU1QjAlNUQlMEFpbWFnZSUyMCUzRCUyMGV4YW1wbGUlNUIlMjJpbWFnZSUyMiU1RCUwQXdvcmRzJTIwJTNEJTIwZXhhbXBsZSU1QiUyMnRva2VucyUyMiU1RCUwQWJveGVzJTIwJTNEJTIwZXhhbXBsZSU1QiUyMmJib3hlcyUyMiU1RCUwQWVuY29kaW5nJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlJTJDJTIwd29yZHMlMkMlMjBib3hlcyUzRGJveGVzJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKiplbmNvZGluZyklMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",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>, trust_remote_code=<span class="hljs-literal">True</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=t(),h(k.$$.fragment)},l(m){i=d(m,"P",{"data-svelte-h":!0}),c(i)!=="svelte-11lpom8"&&(i.textContent=v),p=n(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&&(s(i),s(p)),b(k,m)}}}function Ws(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,Nn="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,A,Bn,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_29969/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_29969/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_29969/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_29969/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,Je,qt,lo,On=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_29969/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.`,Jt,co,Vn=`Configuration objects inherit from <a href="/docs/transformers/pr_29969/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_29969/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,ut,Fe,ft,$,Ie,Ft,po,Sn=`Adapted from <a href="/docs/transformers/pr_29969/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer">LayoutXLMTokenizer</a> and <a href="/docs/transformers/pr_29969/en/model_doc/mt5#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_29969/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,R,Le,Nt,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:`,Bt,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,Y,Ne,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,Q,Be,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_29969/en/model_doc/layoutxlm#transformers.LayoutXLMTokenizer">LayoutXLMTokenizer</a> and <a href="/docs/transformers/pr_29969/en/model_doc/mt5#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_29969/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,H,We,Ot,vo,ts="Tokenize and prepare for the model a list of sequences or a list of pairs of sequences.",Vt,K,St,D,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,ee,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,oe,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,E,Oe,nn,Uo,ds="Tokenize and prepare for the model a sequence or a pair of sequences.",sn,te,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_29969/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_29969/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_29969/en/model_doc/udop#transformers.UdopTokenizer">UdopTokenizer</a> or <a href="/docs/transformers/pr_29969/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,Jo,hs="Alternatively, one can pass <code>text_target</code> and <code>text_pair_target</code> to prepare the targets of UDOP.",hn,Fo,us="Please refer to the docstring of the above two methods for more information.",vt,Ae,Tt,F,Ye,un,Io,fs=`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_29969/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,_s=`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,N,Qe,gn,No,gs='The <a href="/docs/transformers/pr_29969/en/model_doc/udop#transformers.UdopModel">UdopModel</a> forward method, overrides the <code>__call__</code> special method.',bn,ne,kn,se,yt,Ke,wt,J,eo,vn,Bo,bs=`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,ks=`This class is based on <a href="/docs/transformers/pr_29969/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_29969/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,vs=`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,B,oo,xn,Zo,Ts='The <a href="/docs/transformers/pr_29969/en/model_doc/udop#transformers.UdopForConditionalGeneration">UdopForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',Mn,ae,Un,re,xt,to,Mt,I,no,zn,Wo,ys=`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_29969/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,ws=`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,xs='The <a href="/docs/transformers/pr_29969/en/model_doc/udop#transformers.UdopEncoderModel">UdopEncoderModel</a> forward method, overrides the <code>__call__</code> special method.',qn,de,Jn,ie,Ut,ao,zt,Oo,$t;return x=new W({props:{title:"UDOP",local:"udop",headingTag:"h1"}}),z=new W({props:{title:"Overview",local:"overview",headingTag:"h2"}}),ve=new W({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 W({props:{title:"Resources",local:"resources",headingTag:"h2"}}),qe=new W({props:{title:"UdopConfig",local:"transformers.UdopConfig",headingTag:"h2"}}),Je=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_29969/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_29969/src/transformers/models/udop/configuration_udop.py#L24"}}),Fe=new W({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_29969/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_29969/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>
`}}),Ne=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_29969/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>
`}}),Be=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_29969/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_29969/src/transformers/models/udop/tokenization_udop.py#L490"}}),Pe=new W({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_29969/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:"padding_side",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_29969/src/transformers/models/udop/tokenization_udop_fast.py#L442"}}),K=new So({props:{warning:!0,$$slots:{default:[Fs]},$$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_29969/src/transformers/models/udop/tokenization_udop_fast.py#L961",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:"padding_side",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_29969/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_29969/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_29969/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_29969/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_29969/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_29969/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_29969/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_29969/src/transformers/models/udop/tokenization_udop_fast.py#L986",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_29969/src/transformers/models/udop/tokenization_udop_fast.py#L750"}}),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:"padding_side",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 (for non-fast tokenizers) <code>List[int]</code>) &#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_29969/src/transformers/models/udop/tokenization_udop_fast.py#L793"}}),te=new So({props:{warning:!0,$$slots:{default:[Is]},$$scope:{ctx:j}}}),Ve=new W({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_29969/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_29969/en/model_doc/udop#transformers.UdopTokenizer">UdopTokenizer</a> or <a href="/docs/transformers/pr_29969/en/model_doc/udop#transformers.UdopTokenizerFast">UdopTokenizerFast</a>. The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/vr_29969/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_29969/src/transformers/models/udop/processing_udop.py#L56"}}),Ae=new W({props:{title:"UdopModel",local:"transformers.UdopModel",headingTag:"h2"}}),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_29969/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_29969/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_29969/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_29969/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_29969/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/pr_29969/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_29969/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_29969/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/pr_29969/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_29969/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_29969/src/transformers/models/udop/modeling_udop.py#L1564",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_29969/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_29969/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_29969/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ne=new So({props:{$$slots:{default:[Ls]},$$scope:{ctx:j}}}),se=new Fn({props:{anchor:"transformers.UdopModel.forward.example",$$slots:{default:[Ns]},$$scope:{ctx:j}}}),Ke=new W({props:{title:"UdopForConditionalGeneration",local:"transformers.UdopForConditionalGeneration",headingTag:"h2"}}),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_29969/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_29969/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_29969/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_29969/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_29969/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/pr_29969/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_29969/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_29969/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/pr_29969/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_29969/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_29969/src/transformers/models/udop/modeling_udop.py#L1738",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_29969/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_29969/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_29969/en/main_classes/output#transformers.modeling_outputs.Seq2SeqLMOutput"
>transformers.modeling_outputs.Seq2SeqLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ae=new So({props:{$$slots:{default:[Bs]},$$scope:{ctx:j}}}),re=new Fn({props:{anchor:"transformers.UdopForConditionalGeneration.forward.example",$$slots:{default:[Gs]},$$scope:{ctx:j}}}),to=new W({props:{title:"UdopEncoderModel",local:"transformers.UdopEncoderModel",headingTag:"h2"}}),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_29969/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_29969/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_29969/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_29969/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_29969/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_29969/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_29969/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_29969/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_29969/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>
`}}),de=new So({props:{$$slots:{default:[Ps]},$$scope:{ctx:j}}}),ie=new Fn({props:{anchor:"transformers.UdopEncoderModel.forward.example",$$slots:{default:[Zs]},$$scope:{ctx:j}}}),ao=new Js({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/udop.md"}}),{c(){i=r("meta"),v=t(),p=r("p"),k=t(),h(x.$$.fragment),m=t(),h(z.$$.fragment),Ao=t(),_e=r("p"),_e.innerHTML=In,Yo=t(),ge=r("p"),ge.textContent=Ln,Qo=t(),be=r("p"),be.textContent=Nn,Ko=t(),A=r("img"),et=t(),ke=r("small"),ke.innerHTML=Gn,ot=t(),h(ve.$$.fragment),tt=t(),Te=r("ul"),Te.innerHTML=Pn,nt=t(),h(ye.$$.fragment),st=t(),we=r("p"),we.innerHTML=Zn,at=t(),h(xe.$$.fragment),rt=t(),Me=r("p"),Me.innerHTML=Wn,dt=t(),Ue=r("ul"),Ue.innerHTML=Rn,it=t(),ze=r("p"),ze.innerHTML=Hn,lt=t(),h($e.$$.fragment),ct=t(),je=r("p"),je.textContent=Dn,pt=t(),Ce=r("ul"),Ce.innerHTML=En,mt=t(),h(qe.$$.fragment),ht=t(),Z=r("div"),h(Je.$$.fragment),qt=t(),lo=r("p"),lo.innerHTML=On,Jt=t(),co=r("p"),co.innerHTML=Vn,ut=t(),h(Fe.$$.fragment),ft=t(),$=r("div"),h(Ie.$$.fragment),Ft=t(),po=r("p"),po.innerHTML=Sn,It=t(),mo=r("p"),mo.innerHTML=Xn,Lt=t(),R=r("div"),h(Le.$$.fragment),Nt=t(),ho=r("p"),ho.textContent=An,Bt=t(),uo=r("ul"),uo.innerHTML=Yn,Gt=t(),Y=r("div"),h(Ne.$$.fragment),Pt=t(),fo=r("p"),fo.innerHTML=Qn,Zt=t(),Q=r("div"),h(Be.$$.fragment),Wt=t(),_o=r("p"),_o.textContent=Kn,Rt=t(),go=r("div"),h(Ge.$$.fragment),_t=t(),h(Pe.$$.fragment),gt=t(),y=r("div"),h(Ze.$$.fragment),Ht=t(),bo=r("p"),bo.innerHTML=es,Dt=t(),ko=r("p"),ko.innerHTML=os,Et=t(),H=r("div"),h(We.$$.fragment),Ot=t(),vo=r("p"),vo.textContent=ts,Vt=t(),h(K.$$.fragment),St=t(),D=r("div"),h(Re.$$.fragment),Xt=t(),To=r("p"),To.textContent=ns,At=t(),yo=r("ul"),yo.innerHTML=ss,Yt=t(),ee=r("div"),h(He.$$.fragment),Qt=t(),wo=r("p"),wo.textContent=as,Kt=t(),oe=r("div"),h(De.$$.fragment),en=t(),xo=r("p"),xo.textContent=rs,on=t(),Mo=r("div"),h(Ee.$$.fragment),tn=t(),E=r("div"),h(Oe.$$.fragment),nn=t(),Uo=r("p"),Uo.textContent=ds,sn=t(),h(te.$$.fragment),bt=t(),h(Ve.$$.fragment),kt=t(),C=r("div"),h(Se.$$.fragment),an=t(),zo=r("p"),zo.textContent=is,rn=t(),$o=r("p"),$o.innerHTML=ls,dn=t(),jo=r("p"),jo.innerHTML=cs,ln=t(),Co=r("p"),Co.innerHTML=ps,cn=t(),L=r("div"),h(Xe.$$.fragment),pn=t(),qo=r("p"),qo.innerHTML=ms,mn=t(),Jo=r("p"),Jo.innerHTML=hs,hn=t(),Fo=r("p"),Fo.textContent=us,vt=t(),h(Ae.$$.fragment),Tt=t(),F=r("div"),h(Ye.$$.fragment),un=t(),Io=r("p"),Io.innerHTML=fs,fn=t(),Lo=r("p"),Lo.innerHTML=_s,_n=t(),N=r("div"),h(Qe.$$.fragment),gn=t(),No=r("p"),No.innerHTML=gs,bn=t(),h(ne.$$.fragment),kn=t(),h(se.$$.fragment),yt=t(),h(Ke.$$.fragment),wt=t(),J=r("div"),h(eo.$$.fragment),vn=t(),Bo=r("p"),Bo.textContent=bs,Tn=t(),Go=r("p"),Go.innerHTML=ks,yn=t(),Po=r("p"),Po.innerHTML=vs,wn=t(),B=r("div"),h(oo.$$.fragment),xn=t(),Zo=r("p"),Zo.innerHTML=Ts,Mn=t(),h(ae.$$.fragment),Un=t(),h(re.$$.fragment),xt=t(),h(to.$$.fragment),Mt=t(),I=r("div"),h(no.$$.fragment),zn=t(),Wo=r("p"),Wo.innerHTML=ys,$n=t(),Ro=r("p"),Ro.innerHTML=ws,jn=t(),G=r("div"),h(so.$$.fragment),Cn=t(),Ho=r("p"),Ho.innerHTML=xs,qn=t(),h(de.$$.fragment),Jn=t(),h(ie.$$.fragment),Ut=t(),h(ao.$$.fragment),zt=t(),Oo=r("p"),this.h()},l(e){const a=qs("svelte-u9bgzb",document.head);i=d(a,"META",{name:!0,content:!0}),a.forEach(s),v=n(e),p=d(e,"P",{}),w(p).forEach(s),k=n(e),u(x.$$.fragment,e),m=n(e),u(z.$$.fragment,e),Ao=n(e),_e=d(e,"P",{"data-svelte-h":!0}),c(_e)!=="svelte-zcjc2q"&&(_e.innerHTML=In),Yo=n(e),ge=d(e,"P",{"data-svelte-h":!0}),c(ge)!=="svelte-vfdo9a"&&(ge.textContent=Ln),Qo=n(e),be=d(e,"P",{"data-svelte-h":!0}),c(be)!=="svelte-xdaud3"&&(be.textContent=Nn),Ko=n(e),A=d(e,"IMG",{src:!0,alt:!0,width:!0}),et=n(e),ke=d(e,"SMALL",{"data-svelte-h":!0}),c(ke)!=="svelte-gontjk"&&(ke.innerHTML=Gn),ot=n(e),u(ve.$$.fragment,e),tt=n(e),Te=d(e,"UL",{"data-svelte-h":!0}),c(Te)!=="svelte-10p0j7i"&&(Te.innerHTML=Pn),nt=n(e),u(ye.$$.fragment,e),st=n(e),we=d(e,"P",{"data-svelte-h":!0}),c(we)!=="svelte-rq1xjz"&&(we.innerHTML=Zn),at=n(e),u(xe.$$.fragment,e),rt=n(e),Me=d(e,"P",{"data-svelte-h":!0}),c(Me)!=="svelte-1iu8ojc"&&(Me.innerHTML=Wn),dt=n(e),Ue=d(e,"UL",{"data-svelte-h":!0}),c(Ue)!=="svelte-5ixb2e"&&(Ue.innerHTML=Rn),it=n(e),ze=d(e,"P",{"data-svelte-h":!0}),c(ze)!=="svelte-1cfgh3j"&&(ze.innerHTML=Hn),lt=n(e),u($e.$$.fragment,e),ct=n(e),je=d(e,"P",{"data-svelte-h":!0}),c(je)!=="svelte-qaon2f"&&(je.textContent=Dn),pt=n(e),Ce=d(e,"UL",{"data-svelte-h":!0}),c(Ce)!=="svelte-157jvhr"&&(Ce.innerHTML=En),mt=n(e),u(qe.$$.fragment,e),ht=n(e),Z=d(e,"DIV",{class:!0});var V=w(Z);u(Je.$$.fragment,V),qt=n(V),lo=d(V,"P",{"data-svelte-h":!0}),c(lo)!=="svelte-17yjql6"&&(lo.innerHTML=On),Jt=n(V),co=d(V,"P",{"data-svelte-h":!0}),c(co)!=="svelte-1xp2kwr"&&(co.innerHTML=Vn),V.forEach(s),ut=n(e),u(Fe.$$.fragment,e),ft=n(e),$=d(e,"DIV",{class:!0});var q=w($);u(Ie.$$.fragment,q),Ft=n(q),po=d(q,"P",{"data-svelte-h":!0}),c(po)!=="svelte-11cp7v2"&&(po.innerHTML=Sn),It=n(q),mo=d(q,"P",{"data-svelte-h":!0}),c(mo)!=="svelte-2iarov"&&(mo.innerHTML=Xn),Lt=n(q),R=d(q,"DIV",{class:!0});var S=w(R);u(Le.$$.fragment,S),Nt=n(S),ho=d(S,"P",{"data-svelte-h":!0}),c(ho)!=="svelte-1wjq39d"&&(ho.textContent=An),Bt=n(S),uo=d(S,"UL",{"data-svelte-h":!0}),c(uo)!=="svelte-8gh3n2"&&(uo.innerHTML=Yn),S.forEach(s),Gt=n(q),Y=d(q,"DIV",{class:!0});var ro=w(Y);u(Ne.$$.fragment,ro),Pt=n(ro),fo=d(ro,"P",{"data-svelte-h":!0}),c(fo)!=="svelte-1f4f5kp"&&(fo.innerHTML=Qn),ro.forEach(s),Zt=n(q),Q=d(q,"DIV",{class:!0});var io=w(Q);u(Be.$$.fragment,io),Wt=n(io),_o=d(io,"P",{"data-svelte-h":!0}),c(_o)!=="svelte-fl5ab0"&&(_o.textContent=Kn),io.forEach(s),Rt=n(q),go=d(q,"DIV",{class:!0});var Vo=w(go);u(Ge.$$.fragment,Vo),Vo.forEach(s),q.forEach(s),_t=n(e),u(Pe.$$.fragment,e),gt=n(e),y=d(e,"DIV",{class:!0});var M=w(y);u(Ze.$$.fragment,M),Ht=n(M),bo=d(M,"P",{"data-svelte-h":!0}),c(bo)!=="svelte-ykztuo"&&(bo.innerHTML=es),Dt=n(M),ko=d(M,"P",{"data-svelte-h":!0}),c(ko)!=="svelte-10s47aj"&&(ko.innerHTML=os),Et=n(M),H=d(M,"DIV",{class:!0});var X=w(H);u(We.$$.fragment,X),Ot=n(X),vo=d(X,"P",{"data-svelte-h":!0}),c(vo)!=="svelte-6p21pf"&&(vo.textContent=ts),Vt=n(X),u(K.$$.fragment,X),X.forEach(s),St=n(M),D=d(M,"DIV",{class:!0});var Do=w(D);u(Re.$$.fragment,Do),Xt=n(Do),To=d(Do,"P",{"data-svelte-h":!0}),c(To)!=="svelte-1ooxl9e"&&(To.textContent=ns),At=n(Do),yo=d(Do,"UL",{"data-svelte-h":!0}),c(yo)!=="svelte-rq8uot"&&(yo.innerHTML=ss),Do.forEach(s),Yt=n(M),ee=d(M,"DIV",{class:!0});var jt=w(ee);u(He.$$.fragment,jt),Qt=n(jt),wo=d(jt,"P",{"data-svelte-h":!0}),c(wo)!=="svelte-1w6bb17"&&(wo.textContent=as),jt.forEach(s),Kt=n(M),oe=d(M,"DIV",{class:!0});var Ct=w(oe);u(De.$$.fragment,Ct),en=n(Ct),xo=d(Ct,"P",{"data-svelte-h":!0}),c(xo)!=="svelte-bub0ru"&&(xo.textContent=rs),Ct.forEach(s),on=n(M),Mo=d(M,"DIV",{class:!0});var Ms=w(Mo);u(Ee.$$.fragment,Ms),Ms.forEach(s),tn=n(M),E=d(M,"DIV",{class:!0});var Eo=w(E);u(Oe.$$.fragment,Eo),nn=n(Eo),Uo=d(Eo,"P",{"data-svelte-h":!0}),c(Uo)!=="svelte-ma945j"&&(Uo.textContent=ds),sn=n(Eo),u(te.$$.fragment,Eo),Eo.forEach(s),M.forEach(s),bt=n(e),u(Ve.$$.fragment,e),kt=n(e),C=d(e,"DIV",{class:!0});var P=w(C);u(Se.$$.fragment,P),an=n(P),zo=d(P,"P",{"data-svelte-h":!0}),c(zo)!=="svelte-1ti6n5s"&&(zo.textContent=is),rn=n(P),$o=d(P,"P",{"data-svelte-h":!0}),c($o)!=="svelte-189m482"&&($o.innerHTML=ls),dn=n(P),jo=d(P,"P",{"data-svelte-h":!0}),c(jo)!=="svelte-15ci0c7"&&(jo.innerHTML=cs),ln=n(P),Co=d(P,"P",{"data-svelte-h":!0}),c(Co)!=="svelte-mfoszy"&&(Co.innerHTML=ps),cn=n(P),L=d(P,"DIV",{class:!0});var le=w(L);u(Xe.$$.fragment,le),pn=n(le),qo=d(le,"P",{"data-svelte-h":!0}),c(qo)!=="svelte-23yewj"&&(qo.innerHTML=ms),mn=n(le),Jo=d(le,"P",{"data-svelte-h":!0}),c(Jo)!=="svelte-1c5ykyr"&&(Jo.innerHTML=hs),hn=n(le),Fo=d(le,"P",{"data-svelte-h":!0}),c(Fo)!=="svelte-ws0hzs"&&(Fo.textContent=us),le.forEach(s),P.forEach(s),vt=n(e),u(Ae.$$.fragment,e),Tt=n(e),F=d(e,"DIV",{class:!0});var ce=w(F);u(Ye.$$.fragment,ce),un=n(ce),Io=d(ce,"P",{"data-svelte-h":!0}),c(Io)!=="svelte-13cqa40"&&(Io.innerHTML=fs),fn=n(ce),Lo=d(ce,"P",{"data-svelte-h":!0}),c(Lo)!=="svelte-hswkmf"&&(Lo.innerHTML=_s),_n=n(ce),N=d(ce,"DIV",{class:!0});var pe=w(N);u(Qe.$$.fragment,pe),gn=n(pe),No=d(pe,"P",{"data-svelte-h":!0}),c(No)!=="svelte-z6docu"&&(No.innerHTML=gs),bn=n(pe),u(ne.$$.fragment,pe),kn=n(pe),u(se.$$.fragment,pe),pe.forEach(s),ce.forEach(s),yt=n(e),u(Ke.$$.fragment,e),wt=n(e),J=d(e,"DIV",{class:!0});var O=w(J);u(eo.$$.fragment,O),vn=n(O),Bo=d(O,"P",{"data-svelte-h":!0}),c(Bo)!=="svelte-170n5ee"&&(Bo.textContent=bs),Tn=n(O),Go=d(O,"P",{"data-svelte-h":!0}),c(Go)!=="svelte-nipvrg"&&(Go.innerHTML=ks),yn=n(O),Po=d(O,"P",{"data-svelte-h":!0}),c(Po)!=="svelte-hswkmf"&&(Po.innerHTML=vs),wn=n(O),B=d(O,"DIV",{class:!0});var me=w(B);u(oo.$$.fragment,me),xn=n(me),Zo=d(me,"P",{"data-svelte-h":!0}),c(Zo)!=="svelte-1o8tvfw"&&(Zo.innerHTML=Ts),Mn=n(me),u(ae.$$.fragment,me),Un=n(me),u(re.$$.fragment,me),me.forEach(s),O.forEach(s),xt=n(e),u(to.$$.fragment,e),Mt=n(e),I=d(e,"DIV",{class:!0});var he=w(I);u(no.$$.fragment,he),zn=n(he),Wo=d(he,"P",{"data-svelte-h":!0}),c(Wo)!=="svelte-gemo8c"&&(Wo.innerHTML=ys),$n=n(he),Ro=d(he,"P",{"data-svelte-h":!0}),c(Ro)!=="svelte-hswkmf"&&(Ro.innerHTML=ws),jn=n(he),G=d(he,"DIV",{class:!0});var ue=w(G);u(so.$$.fragment,ue),Cn=n(ue),Ho=d(ue,"P",{"data-svelte-h":!0}),c(Ho)!=="svelte-1eo2qzs"&&(Ho.innerHTML=xs),qn=n(ue),u(de.$$.fragment,ue),Jn=n(ue),u(ie.$$.fragment,ue),ue.forEach(s),he.forEach(s),Ut=n(e),u(ao.$$.fragment,e),zt=n(e),Oo=d(e,"P",{}),w(Oo).forEach(s),this.h()},h(){T(i,"name","hf:doc:metadata"),T(i,"content",Rs),zs(A.src,Bn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/udop_architecture.jpg")||T(A,"src",Bn),T(A,"alt","drawing"),T(A,"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(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(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(Q,"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(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(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(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(oe,"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(E,"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(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(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(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,A,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(Je,Z,null),o(Z,qt),o(Z,lo),o(Z,Jt),o(Z,co),l(e,ut,a),f(Fe,e,a),l(e,ft,a),l(e,$,a),f(Ie,$,null),o($,Ft),o($,po),o($,It),o($,mo),o($,Lt),o($,R),f(Le,R,null),o(R,Nt),o(R,ho),o(R,Bt),o(R,uo),o($,Gt),o($,Y),f(Ne,Y,null),o(Y,Pt),o(Y,fo),o($,Zt),o($,Q),f(Be,Q,null),o(Q,Wt),o(Q,_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,H),f(We,H,null),o(H,Ot),o(H,vo),o(H,Vt),f(K,H,null),o(y,St),o(y,D),f(Re,D,null),o(D,Xt),o(D,To),o(D,At),o(D,yo),o(y,Yt),o(y,ee),f(He,ee,null),o(ee,Qt),o(ee,wo),o(y,Kt),o(y,oe),f(De,oe,null),o(oe,en),o(oe,xo),o(y,on),o(y,Mo),f(Ee,Mo,null),o(y,tn),o(y,E),f(Oe,E,null),o(E,nn),o(E,Uo),o(E,sn),f(te,E,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,Jo),o(L,hn),o(L,Fo),l(e,vt,a),f(Ae,e,a),l(e,Tt,a),l(e,F,a),f(Ye,F,null),o(F,un),o(F,Io),o(F,fn),o(F,Lo),o(F,_n),o(F,N),f(Qe,N,null),o(N,gn),o(N,No),o(N,bn),f(ne,N,null),o(N,kn),f(se,N,null),l(e,yt,a),f(Ke,e,a),l(e,wt,a),l(e,J,a),f(eo,J,null),o(J,vn),o(J,Bo),o(J,Tn),o(J,Go),o(J,yn),o(J,Po),o(J,wn),o(J,B),f(oo,B,null),o(B,xn),o(B,Zo),o(B,Mn),f(ae,B,null),o(B,Un),f(re,B,null),l(e,xt,a),f(to,e,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(de,G,null),o(G,Jn),f(ie,G,null),l(e,Ut,a),f(ao,e,a),l(e,zt,a),l(e,Oo,a),$t=!0},p(e,[a]){const V={};a&2&&(V.$$scope={dirty:a,ctx:e}),K.$set(V);const q={};a&2&&(q.$$scope={dirty:a,ctx:e}),te.$set(q);const S={};a&2&&(S.$$scope={dirty:a,ctx:e}),ne.$set(S);const ro={};a&2&&(ro.$$scope={dirty:a,ctx:e}),se.$set(ro);const io={};a&2&&(io.$$scope={dirty:a,ctx:e}),ae.$set(io);const Vo={};a&2&&(Vo.$$scope={dirty:a,ctx:e}),re.$set(Vo);const M={};a&2&&(M.$$scope={dirty:a,ctx:e}),de.$set(M);const X={};a&2&&(X.$$scope={dirty:a,ctx:e}),ie.$set(X)},i(e){$t||(_(x.$$.fragment,e),_(z.$$.fragment,e),_(ve.$$.fragment,e),_(ye.$$.fragment,e),_(xe.$$.fragment,e),_($e.$$.fragment,e),_(qe.$$.fragment,e),_(Je.$$.fragment,e),_(Fe.$$.fragment,e),_(Ie.$$.fragment,e),_(Le.$$.fragment,e),_(Ne.$$.fragment,e),_(Be.$$.fragment,e),_(Ge.$$.fragment,e),_(Pe.$$.fragment,e),_(Ze.$$.fragment,e),_(We.$$.fragment,e),_(K.$$.fragment,e),_(Re.$$.fragment,e),_(He.$$.fragment,e),_(De.$$.fragment,e),_(Ee.$$.fragment,e),_(Oe.$$.fragment,e),_(te.$$.fragment,e),_(Ve.$$.fragment,e),_(Se.$$.fragment,e),_(Xe.$$.fragment,e),_(Ae.$$.fragment,e),_(Ye.$$.fragment,e),_(Qe.$$.fragment,e),_(ne.$$.fragment,e),_(se.$$.fragment,e),_(Ke.$$.fragment,e),_(eo.$$.fragment,e),_(oo.$$.fragment,e),_(ae.$$.fragment,e),_(re.$$.fragment,e),_(to.$$.fragment,e),_(no.$$.fragment,e),_(so.$$.fragment,e),_(de.$$.fragment,e),_(ie.$$.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(Je.$$.fragment,e),g(Fe.$$.fragment,e),g(Ie.$$.fragment,e),g(Le.$$.fragment,e),g(Ne.$$.fragment,e),g(Be.$$.fragment,e),g(Ge.$$.fragment,e),g(Pe.$$.fragment,e),g(Ze.$$.fragment,e),g(We.$$.fragment,e),g(K.$$.fragment,e),g(Re.$$.fragment,e),g(He.$$.fragment,e),g(De.$$.fragment,e),g(Ee.$$.fragment,e),g(Oe.$$.fragment,e),g(te.$$.fragment,e),g(Ve.$$.fragment,e),g(Se.$$.fragment,e),g(Xe.$$.fragment,e),g(Ae.$$.fragment,e),g(Ye.$$.fragment,e),g(Qe.$$.fragment,e),g(ne.$$.fragment,e),g(se.$$.fragment,e),g(Ke.$$.fragment,e),g(eo.$$.fragment,e),g(oo.$$.fragment,e),g(ae.$$.fragment,e),g(re.$$.fragment,e),g(to.$$.fragment,e),g(no.$$.fragment,e),g(so.$$.fragment,e),g(de.$$.fragment,e),g(ie.$$.fragment,e),g(ao.$$.fragment,e),$t=!1},d(e){e&&(s(v),s(p),s(k),s(m),s(Ao),s(_e),s(Yo),s(ge),s(Qo),s(be),s(Ko),s(A),s(et),s(ke),s(ot),s(tt),s(Te),s(nt),s(st),s(we),s(at),s(rt),s(Me),s(dt),s(Ue),s(it),s(ze),s(lt),s(ct),s(je),s(pt),s(Ce),s(mt),s(ht),s(Z),s(ut),s(ft),s($),s(_t),s(gt),s(y),s(bt),s(kt),s(C),s(vt),s(Tt),s(F),s(yt),s(wt),s(J),s(xt),s(Mt),s(I),s(Ut),s(zt),s(Oo)),s(i),b(x,e),b(z,e),b(ve,e),b(ye,e),b(xe,e),b($e,e),b(qe,e),b(Je),b(Fe,e),b(Ie),b(Le),b(Ne),b(Be),b(Ge),b(Pe,e),b(Ze),b(We),b(K),b(Re),b(He),b(De),b(Ee),b(Oe),b(te),b(Ve,e),b(Se),b(Xe),b(Ae,e),b(Ye),b(Qe),b(ne),b(se),b(Ke,e),b(eo),b(oo),b(ae),b(re),b(to,e),b(no),b(so),b(de),b(ie),b(ao,e)}}}const Rs='{"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},{"title":"UdopModel","local":"transformers.UdopModel","sections":[],"depth":2},{"title":"UdopForConditionalGeneration","local":"transformers.UdopForConditionalGeneration","sections":[],"depth":2},{"title":"UdopEncoderModel","local":"transformers.UdopEncoderModel","sections":[],"depth":2}],"depth":1}';function Hs(j){return $s(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ys extends js{constructor(i){super(),Cs(this,i,Hs,Ws,Us,{})}}export{Ys as component};
