import{s as ua,o as ma,n as q}from"../chunks/scheduler.9bc65507.js";import{S as ha,i as fa,g as s,s as r,u as _,A as ga,h as a,f as t,c as i,j as f,v as x,y as h,k as u,o,a as d,w as v,d as b,t as y,x as T}from"../chunks/index.78c82d43.js";import{T as ss}from"../chunks/Tip.87d55b76.js";import{D as j}from"../chunks/Docstring.f3d04bd2.js";import{C as ht}from"../chunks/CodeBlock.48618ec2.js";import{I as R}from"../chunks/IconCopyLink.bedaa44d.js";import{E as mt}from"../chunks/ExampleCodeBlock.872b014d.js";function _a(P){let l,w="Example:",m,p,g;return p=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBpeDJTdHJ1Y3RDb25maWclMkMlMjBQaXgyU3RydWN0Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFBpeDJTdHJ1Y3RDb25maWclMjB3aXRoJTIwZ29vZ2xlJTJGcGl4MnN0cnVjdC1iYXNlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMFBpeDJTdHJ1Y3RDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBQaXgyU3RydWN0Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBnb29nbGUlMkZwaXgyc3RydWN0LWJhc2UlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMFBpeDJTdHJ1Y3RGb3JDb25kaXRpb25hbEdlbmVyYXRpb24oY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmlnJTBBJTBBJTIzJTIwV2UlMjBjYW4lMjBhbHNvJTIwaW5pdGlhbGl6ZSUyMGElMjBQaXgyU3RydWN0Q29uZmlnJTIwZnJvbSUyMGElMjBQaXgyU3RydWN0VGV4dENvbmZpZyUyMGFuZCUyMGElMjBQaXgyU3RydWN0VmlzaW9uQ29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFBpeDJTdHJ1Y3QlMjB0ZXh0JTIwYW5kJTIwUGl4MlN0cnVjdCUyMHZpc2lvbiUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWdfdGV4dCUyMCUzRCUyMFBpeDJTdHJ1Y3RUZXh0Q29uZmlnKCklMEFjb25maWdfdmlzaW9uJTIwJTNEJTIwUGl4MlN0cnVjdFZpc2lvbkNvbmZpZygpJTBBJTBBY29uZmlnJTIwJTNEJTIwUGl4MlN0cnVjdENvbmZpZy5mcm9tX3RleHRfdmlzaW9uX2NvbmZpZ3MoY29uZmlnX3RleHQlMkMlMjBjb25maWdfdmlzaW9uKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Pix2StructConfig, Pix2StructForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Pix2StructConfig with google/pix2struct-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Pix2StructConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Pix2StructForConditionalGeneration (with random weights) from the google/pix2struct-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Pix2StructForConditionalGeneration(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># We can also initialize a Pix2StructConfig from a Pix2StructTextConfig and a Pix2StructVisionConfig</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Pix2Struct text and Pix2Struct vision configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config_text = Pix2StructTextConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>config_vision = Pix2StructVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span>config = Pix2StructConfig.from_text_vision_configs(config_text, config_vision)`}}),{c(){l=s("p"),l.textContent=w,m=r(),_(p.$$.fragment)},l(n){l=a(n,"P",{"data-svelte-h":!0}),h(l)!=="svelte-11lpom8"&&(l.textContent=w),m=i(n),x(p.$$.fragment,n)},m(n,M){d(n,l,M),d(n,m,M),v(p,n,M),g=!0},p:q,i(n){g||(b(p.$$.fragment,n),g=!0)},o(n){y(p.$$.fragment,n),g=!1},d(n){n&&(t(l),t(m)),T(p,n)}}}function xa(P){let l,w="Example:",m,p,g;return p=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBpeDJTdHJ1Y3RUZXh0Q29uZmlnJTJDJTIwUGl4MlN0cnVjdFRleHRNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBQaXgyU3RydWN0VGV4dENvbmZpZyUyMHdpdGglMjBnb29nbGUlMkZwaXgyc3RydWN0LWJhc2UlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwUGl4MlN0cnVjdFRleHRDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBQaXgyU3RydWN0VGV4dE1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBnb29nbGUlMkZwaXgyc3RydWN0LWJhc2UlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMFBpeDJTdHJ1Y3RUZXh0TW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Pix2StructTextConfig, Pix2StructTextModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Pix2StructTextConfig with google/pix2struct-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Pix2StructTextConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Pix2StructTextModel (with random weights) from the google/pix2struct-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Pix2StructTextModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){l=s("p"),l.textContent=w,m=r(),_(p.$$.fragment)},l(n){l=a(n,"P",{"data-svelte-h":!0}),h(l)!=="svelte-11lpom8"&&(l.textContent=w),m=i(n),x(p.$$.fragment,n)},m(n,M){d(n,l,M),d(n,m,M),v(p,n,M),g=!0},p:q,i(n){g||(b(p.$$.fragment,n),g=!0)},o(n){y(p.$$.fragment,n),g=!1},d(n){n&&(t(l),t(m)),T(p,n)}}}function va(P){let l,w="Example:",m,p,g;return p=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBpeDJTdHJ1Y3RWaXNpb25Db25maWclMkMlMjBQaXgyU3RydWN0VmlzaW9uTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwUGl4MlN0cnVjdFZpc2lvbkNvbmZpZyUyMHdpdGglMjBnb29nbGUlMkZwaXgyc3RydWN0LWJhc2UlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwUGl4MlN0cnVjdFZpc2lvbkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFBpeDJTdHJ1Y3RWaXNpb25Nb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwZ29vZ2xlJTJGcGl4MnN0cnVjdC1iYXNlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBQaXgyU3RydWN0VmlzaW9uTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Pix2StructVisionConfig, Pix2StructVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Pix2StructVisionConfig with google/pix2struct-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Pix2StructVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Pix2StructVisionModel (with random weights) from the google/pix2struct-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Pix2StructVisionModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){l=s("p"),l.textContent=w,m=r(),_(p.$$.fragment)},l(n){l=a(n,"P",{"data-svelte-h":!0}),h(l)!=="svelte-11lpom8"&&(l.textContent=w),m=i(n),x(p.$$.fragment,n)},m(n,M){d(n,l,M),d(n,m,M),v(p,n,M),g=!0},p:q,i(n){g||(b(p.$$.fragment,n),g=!0)},o(n){y(p.$$.fragment,n),g=!1},d(n){n&&(t(l),t(m)),T(p,n)}}}function ba(P){let l,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){l=s("p"),l.innerHTML=w},l(m){l=a(m,"P",{"data-svelte-h":!0}),h(l)!=="svelte-fincs2"&&(l.innerHTML=w)},m(m,p){d(m,l,p)},p:q,d(m){m&&t(l)}}}function ya(P){let l,w="Example:",m,p,g;return p=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBQaXgyU3RydWN0VGV4dE1vZGVsJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGcGl4MnN0cnVjdC10ZXh0Y2Fwcy1iYXNlJTIyKSUwQW1vZGVsJTIwJTNEJTIwUGl4MlN0cnVjdFRleHRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGcGl4MnN0cnVjdC10ZXh0Y2Fwcy1iYXNlJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3M=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Pix2StructTextModel

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/pix2struct-textcaps-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Pix2StructTextModel.from_pretrained(<span class="hljs-string">&quot;google/pix2struct-textcaps-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss`}}),{c(){l=s("p"),l.textContent=w,m=r(),_(p.$$.fragment)},l(n){l=a(n,"P",{"data-svelte-h":!0}),h(l)!=="svelte-11lpom8"&&(l.textContent=w),m=i(n),x(p.$$.fragment,n)},m(n,M){d(n,l,M),d(n,m,M),v(p,n,M),g=!0},p:q,i(n){g||(b(p.$$.fragment,n),g=!0)},o(n){y(p.$$.fragment,n),g=!1},d(n){n&&(t(l),t(m)),T(p,n)}}}function Ta(P){let l,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){l=s("p"),l.innerHTML=w},l(m){l=a(m,"P",{"data-svelte-h":!0}),h(l)!=="svelte-fincs2"&&(l.innerHTML=w)},m(m,p){d(m,l,p)},p:q,d(m){m&&t(l)}}}function wa(P){let l,w="Example:",m,p,g;return p=new ht({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFBpeDJTdHJ1Y3RWaXNpb25Nb2RlbCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnBpeDJzdHJ1Y3QtdGV4dGNhcHMtYmFzZSUyMiklMEFtb2RlbCUyMCUzRCUyMFBpeDJTdHJ1Y3RWaXNpb25Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGcGl4MnN0cnVjdC10ZXh0Y2Fwcy1iYXNlJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGd3d3LmlsYW5rZWxtYW4ub3JnJTJGc3RvcHNpZ25zJTJGYXVzdHJhbGlhLmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBbGlzdChsYXN0X2hpZGRlbl9zdGF0ZXMuc2hhcGUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Pix2StructVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/pix2struct-textcaps-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Pix2StructVisionModel.from_pretrained(<span class="hljs-string">&quot;google/pix2struct-textcaps-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://www.ilankelman.org/stopsigns/australia.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<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">2048</span>, <span class="hljs-number">768</span>]`}}),{c(){l=s("p"),l.textContent=w,m=r(),_(p.$$.fragment)},l(n){l=a(n,"P",{"data-svelte-h":!0}),h(l)!=="svelte-11lpom8"&&(l.textContent=w),m=i(n),x(p.$$.fragment,n)},m(n,M){d(n,l,M),d(n,m,M),v(p,n,M),g=!0},p:q,i(n){g||(b(p.$$.fragment,n),g=!0)},o(n){y(p.$$.fragment,n),g=!1},d(n){n&&(t(l),t(m)),T(p,n)}}}function Ma(P){let l,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){l=s("p"),l.innerHTML=w},l(m){l=a(m,"P",{"data-svelte-h":!0}),h(l)!=="svelte-fincs2"&&(l.innerHTML=w)},m(m,p){d(m,l,p)},p:q,d(m){m&&t(l)}}}function Pa(P){let l,w="Inference:",m,p,g;return p=new ht({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFBpeDJTdHJ1Y3RGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZwaXgyc3RydWN0LXRleHRjYXBzLWJhc2UlMjIpJTBBbW9kZWwlMjAlM0QlMjBQaXgyU3RydWN0Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZwaXgyc3RydWN0LXRleHRjYXBzLWJhc2UlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZ3d3cuaWxhbmtlbG1hbi5vcmclMkZzdG9wc2lnbnMlMkZhdXN0cmFsaWEuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEElMjMlMjBhdXRvcmVncmVzc2l2ZSUyMGdlbmVyYXRpb24lMEFnZW5lcmF0ZWRfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDUwKSUwQWdlbmVyYXRlZF90ZXh0JTIwJTNEJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RCUwQXByaW50KGdlbmVyYXRlZF90ZXh0KSUwQSUwQSUyMyUyMGNvbmRpdGlvbmFsJTIwZ2VuZXJhdGlvbiUwQXRleHQlMjAlM0QlMjAlMjJBJTIwcGljdHVyZSUyMG9mJTIyJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKHRleHQlM0R0ZXh0JTJDJTIwaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTJDJTIwYWRkX3NwZWNpYWxfdG9rZW5zJTNERmFsc2UpJTBBJTBBZ2VuZXJhdGVkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0Q1MCklMEFnZW5lcmF0ZWRfdGV4dCUyMCUzRCUyMHByb2Nlc3Nvci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVkX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSU1QjAlNUQlMEFwcmludChnZW5lcmF0ZWRfdGV4dCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Pix2StructForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/pix2struct-textcaps-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Pix2StructForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;google/pix2struct-textcaps-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://www.ilankelman.org/stopsigns/australia.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, 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>generated_ids = model.generate(**inputs, max_new_tokens=<span class="hljs-number">50</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_text = processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(generated_text)
A stop sign <span class="hljs-keyword">is</span> on a street corner.

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># conditional generation</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;A picture of&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=text, images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, add_special_tokens=<span class="hljs-literal">False</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(**inputs, max_new_tokens=<span class="hljs-number">50</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_text = processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(generated_text)
A picture of a stop sign <span class="hljs-keyword">with</span> a red stop sign`}}),{c(){l=s("p"),l.textContent=w,m=r(),_(p.$$.fragment)},l(n){l=a(n,"P",{"data-svelte-h":!0}),h(l)!=="svelte-1i9b1jx"&&(l.textContent=w),m=i(n),x(p.$$.fragment,n)},m(n,M){d(n,l,M),d(n,m,M),v(p,n,M),g=!0},p:q,i(n){g||(b(p.$$.fragment,n),g=!0)},o(n){y(p.$$.fragment,n),g=!1},d(n){n&&(t(l),t(m)),T(p,n)}}}function ka(P){let l,w="Training:",m,p,g;return p=new ht({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFBpeDJTdHJ1Y3RGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZwaXgyc3RydWN0LWJhc2UlMjIpJTBBbW9kZWwlMjAlM0QlMjBQaXgyU3RydWN0Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZwaXgyc3RydWN0LWJhc2UlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZ3d3cuaWxhbmtlbG1hbi5vcmclMkZzdG9wc2lnbnMlMkZhdXN0cmFsaWEuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBdGV4dCUyMCUzRCUyMCUyMkElMjBzdG9wJTIwc2lnbiUyMGlzJTIwb24lMjB0aGUlMjBzdHJlZXQlMjBjb3JuZXIuJTIyJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFsYWJlbHMlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUzRHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5pbnB1dF9pZHMlMEElMEElMjMlMjBmb3J3YXJkJTIwcGFzcyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscyklMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBcHJpbnQoZiUyMiU3Qmxvc3MuaXRlbSgpJTNBLjVmJTdEJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Pix2StructForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/pix2struct-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Pix2StructForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;google/pix2struct-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://www.ilankelman.org/stopsigns/australia.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;A stop sign is on the street corner.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = processor(text=text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids

<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, labels=labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;<span class="hljs-subst">{loss.item():<span class="hljs-number">.5</span>f}</span>&quot;</span>)
<span class="hljs-number">5.94282</span>`}}),{c(){l=s("p"),l.textContent=w,m=r(),_(p.$$.fragment)},l(n){l=a(n,"P",{"data-svelte-h":!0}),h(l)!=="svelte-1igpel8"&&(l.textContent=w),m=i(n),x(p.$$.fragment,n)},m(n,M){d(n,l,M),d(n,m,M),v(p,n,M),g=!0},p:q,i(n){g||(b(p.$$.fragment,n),g=!0)},o(n){y(p.$$.fragment,n),g=!1},d(n){n&&(t(l),t(m)),T(p,n)}}}function $a(P){let l,w,m,p,g,n,M,Se,nn,ft,as="Pix2Struct",xo,E,te,eo,Je,sn,gt,rs="Overview",vo,je,is='The Pix2Struct model was proposed in <a href="https://arxiv.org/abs/2210.03347" rel="nofollow">Pix2Struct: Screenshot Parsing as Pretraining for Visual Language Understanding</a> by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu, Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, Kristina Toutanova.',bo,ze,ls="The abstract from the paper is the following:",yo,Ue,cs="<p>Visually-situated language is ubiquitous — sources range from textbooks with diagrams to web pages with images and tables, to mobile apps with buttons and forms. Perhaps due to this diversity, previous work has typically relied on domain-specific recipes with limited sharing of the underlying data, model architectures, and objectives. We present Pix2Struct, a pretrained image-to-text model for purely visual language understanding, which can be finetuned on tasks containing visually-situated language. Pix2Struct is pretrained by learning to parse masked screenshots of web pages into simplified HTML. The web, with its richness of visual elements cleanly reflected in the HTML structure, provides a large source of pretraining data well suited to the diversity of downstream tasks. Intuitively, this objective subsumes common pretraining signals such as OCR, language modeling, image captioning. In addition to the novel pretraining strategy, we introduce a variable-resolution input representation and a more flexible integration of language and vision inputs, where language prompts such as questions are rendered directly on top of the input image. For the first time, we show that a single pretrained model can achieve state-of-the-art results in six out of nine tasks across four domains: documents, illustrations, user interfaces, and natural images.</p>",To,Ie,ds="Tips:",wo,We,ps=`Pix2Struct has been fine tuned on a variety of tasks and datasets, ranging from image captioning, visual question answering (VQA) over different inputs (books, charts, science diagrams), captioning UI components etc. The full list can be found in Table 1 of the paper.
We therefore advise you to use these models for the tasks they have been fine tuned on. For instance, if you want to use Pix2Struct for UI captioning, you should use the model fine tuned on the UI dataset. If you want to use Pix2Struct for image captioning, you should use the model fine tuned on the natural images captioning dataset and so on.`,Mo,Fe,us="If you want to use the model to perform conditional text captioning, make sure to use the processor with <code>add_special_tokens=False</code>.",Po,Ne,ms=`This model was contributed by <a href="https://huggingface.co/ybelkada" rel="nofollow">ybelkada</a>.
The original code can be found <a href="https://github.com/google-research/pix2struct" rel="nofollow">here</a>.`,ko,X,oe,to,Ze,an,_t,hs="Resources",$o,Be,fs='<li><a href="https://github.com/huggingface/notebooks/blob/main/examples/image_captioning_pix2struct.ipynb" rel="nofollow">Fine-tuning Notebook</a></li> <li><a href="https://huggingface.co/models?search=pix2struct" rel="nofollow">All models</a></li>',Co,L,ne,oo,Ve,rn,xt,gs="Pix2StructConfig",So,S,Re,ln,vt,_s=`<a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a> is the configuration class to store the configuration of a
<a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructForConditionalGeneration">Pix2StructForConditionalGeneration</a>. It is used to instantiate a Pix2Struct model according to the specified
arguments, defining the text model and vision model configs. Instantiating a configuration with the defaults will
yield a similar configuration to that of the Pix2Struct-base
<a href="https://huggingface.co/google/pix2struct-base" rel="nofollow">google/pix2struct-base</a> architecture.`,cn,bt,xs=`Configuration objects inherit from <a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,dn,se,pn,ae,Ge,un,yt,vs=`Instantiate a <a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a> (or a derived class) from pix2struct text model configuration and pix2struct
vision model configuration.`,Jo,Y,re,no,He,mn,Tt,bs="Pix2StructTextConfig",jo,z,qe,hn,wt,ys=`This is the configuration class to store the configuration of a <a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructTextModel">Pix2StructTextModel</a>. It is used to instantiate
a Pix2Struct text 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 Pix2Struct text decoder used by
the <a href="https://huggingface.co/google/pix2struct-base" rel="nofollow">google/pix2struct-base</a> architecture.`,fn,Mt,Ts=`Configuration objects inherit from <a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,gn,ie,zo,A,le,so,Ee,_n,Pt,ws="Pix2StructVisionConfig",Uo,U,Xe,xn,kt,Ms=`This is the configuration class to store the configuration of a <a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructVisionModel">Pix2StructVisionModel</a>. It is used to
instantiate a Pix2Struct vision model according to the specified arguments, defining the model architecture.
Instantiating a configuration defaults will yield a similar configuration to that of the Pix2Struct-base
<a href="https://huggingface.co/google/pix2struct-base" rel="nofollow">google/pix2struct-base</a> architecture.`,vn,$t,Ps=`Configuration objects inherit from <a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,bn,ce,Io,D,de,ao,Le,yn,Ct,ks="Pix2StructProcessor",Wo,J,Ye,Tn,St,$s=`Constructs a PIX2STRUCT processor which wraps a BERT tokenizer and PIX2STRUCT image processor into a single
processor.`,wn,Jt,Cs=`<a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructProcessor">Pix2StructProcessor</a> offers all the functionalities of <a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructImageProcessor">Pix2StructImageProcessor</a> and <a href="/docs/transformers/v4.33.3/en/model_doc/t5#transformers.T5TokenizerFast">T5TokenizerFast</a>. See
the docstring of <code>__call__()</code> and <a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructProcessor.decode">decode()</a> for more information.`,Mn,pe,Ae,Pn,jt,Ss=`This method forwards all its arguments to Pix2StructTokenizerFast’s <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.batch_decode">batch_decode()</a>.
Please refer to the docstring of this method for more information.`,kn,ue,De,$n,zt,Js=`This method forwards all its arguments to Pix2StructTokenizerFast’s <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.decode">decode()</a>. Please
refer to the docstring of this method for more information.`,Fo,Q,me,ro,Qe,Cn,Ut,js="Pix2StructImageProcessor",No,B,Oe,Sn,It,zs="Constructs a Pix2Struct image processor.",Jn,he,Ke,jn,Wt,Us=`Preprocess an image or batch of images. The processor first computes the maximum possible number of
aspect-ratio preserving patches of size <code>patch_size</code> that can be extracted from the image. It then pads the
image with zeros to make the image respect the constraint of <code>max_patches</code>. Before extracting the patches the
images are standardized following the tensorflow implementation of <code>per_image_standardization</code>
(<a href="https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization" rel="nofollow">https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization</a>).`,Zo,O,fe,io,et,zn,Ft,Is="Pix2StructTextModel",Bo,k,tt,Un,Nt,Ws="The standalone text decoder of Pix2Struct",In,Zt,Fs=`The Pix2Struct model was proposed in <a href="https://arxiv.org/abs/2210.03347" rel="nofollow">Pix2Struct: Screenshot Parsing as Pretraining for Visual Language
Understanding</a> by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu,
Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, Kristina Toutanova. It’s an encoder decoder
transformer pre-trained in a image-to-text setting.`,Wn,Bt,Ns=`This model inherits from <a href="/docs/transformers/v4.33.3/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,Vt,Zs=`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.`,Nn,I,ot,Zn,Rt,Bs='The <a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructTextModel">Pix2StructTextModel</a> forward method, overrides the <code>__call__</code> special method.',Bn,ge,Vn,_e,Vo,K,xe,lo,nt,Rn,Gt,Vs="Pix2StructVisionModel",Ro,V,st,Gn,Ht,Rs=`The bare Pix2StructVision Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Hn,W,at,qn,qt,Gs='The <a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructVisionModel">Pix2StructVisionModel</a> forward method, overrides the <code>__call__</code> special method.',En,ve,Xn,be,Go,ee,ye,co,rt,Ln,Et,Hs="Pix2StructForConditionalGeneration",Ho,$,it,Yn,Xt,qs="A conditional generation model with a language modeling head. Can be used for sequence generation tasks.",An,Lt,Es=`The Pix2Struct model was proposed in <a href="https://arxiv.org/abs/2210.03347" rel="nofollow">Pix2Struct: Screenshot Parsing as Pretraining for Visual Language
Understanding</a> by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu,
Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, Kristina Toutanova. It’s an encoder decoder
transformer pre-trained in a image-to-text setting.`,Dn,Yt,Xs=`This model inherits from <a href="/docs/transformers/v4.33.3/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.)`,Qn,At,Ls=`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.`,On,C,lt,Kn,Dt,Ys='The <a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructForConditionalGeneration">Pix2StructForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',es,Te,ts,Qt,As="Example:",os,we,ns,Me,qo,po,Eo;return Se=new R({}),Je=new R({}),Ze=new R({}),Ve=new R({}),Re=new j({props:{name:"class transformers.Pix2StructConfig",anchor:"transformers.Pix2StructConfig",parameters:[{name:"text_config",val:" = None"},{name:"vision_config",val:" = None"},{name:"initializer_factor",val:" = 1.0"},{name:"initializer_range",val:" = 0.02"},{name:"is_vqa",val:" = False"},{name:"tie_word_embeddings",val:" = False"},{name:"is_encoder_decoder",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructConfig.text_config",description:`<strong>text_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructTextConfig">Pix2StructTextConfig</a>.`,name:"text_config"},{anchor:"transformers.Pix2StructConfig.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructVisionConfig">Pix2StructVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.Pix2StructConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Factor to multiply the initialization range with.`,name:"initializer_factor"},{anchor:"transformers.Pix2StructConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Pix2StructConfig.is_vqa",description:`<strong>is_vqa</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the model has been fine-tuned for VQA or not.`,name:"is_vqa"},{anchor:"transformers.Pix2StructConfig.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/configuration_pix2struct.py#L291"}}),se=new mt({props:{anchor:"transformers.Pix2StructConfig.example",$$slots:{default:[_a]},$$scope:{ctx:P}}}),Ge=new j({props:{name:"from_text_vision_configs",anchor:"transformers.Pix2StructConfig.from_text_vision_configs",parameters:[{name:"text_config",val:": Pix2StructTextConfig"},{name:"vision_config",val:": Pix2StructVisionConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/configuration_pix2struct.py#L377",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</a></p>
`}}),He=new R({}),qe=new j({props:{name:"class transformers.Pix2StructTextConfig",anchor:"transformers.Pix2StructTextConfig",parameters:[{name:"vocab_size",val:" = 50244"},{name:"hidden_size",val:" = 768"},{name:"d_kv",val:" = 64"},{name:"d_ff",val:" = 2048"},{name:"num_layers",val:" = 12"},{name:"num_heads",val:" = 12"},{name:"relative_attention_num_buckets",val:" = 32"},{name:"relative_attention_max_distance",val:" = 128"},{name:"dropout_rate",val:" = 0.1"},{name:"layer_norm_epsilon",val:" = 1e-06"},{name:"initializer_factor",val:" = 1.0"},{name:"dense_act_fn",val:" = 'gelu_new'"},{name:"decoder_start_token_id",val:" = 0"},{name:"use_cache",val:" = False"},{name:"pad_token_id",val:" = 0"},{name:"eos_token_id",val:" = 1"},{name:"tie_word_embeddings",val:" = False"},{name:"is_decoder",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructTextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50244) &#x2014;
Vocabulary size of the <code>Pix2Struct</code> text model. Defines the number of different tokens that can be
represented by the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructTextModel">Pix2StructTextModel</a>.`,name:"vocab_size"},{anchor:"transformers.Pix2StructTextConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.Pix2StructTextConfig.d_kv",description:`<strong>d_kv</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Dimensionality of the key, query, value projections in each attention head.`,name:"d_kv"},{anchor:"transformers.Pix2StructTextConfig.d_ff",description:`<strong>d_ff</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"d_ff"},{anchor:"transformers.Pix2StructTextConfig.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_layers"},{anchor:"transformers.Pix2StructTextConfig.num_heads",description:`<strong>num_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_heads"},{anchor:"transformers.Pix2StructTextConfig.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.Pix2StructTextConfig.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.Pix2StructTextConfig.dropout_rate",description:`<strong>dropout_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout_rate"},{anchor:"transformers.Pix2StructTextConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_epsilon"},{anchor:"transformers.Pix2StructTextConfig.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.Pix2StructTextConfig.dense_act_fn",description:`<strong>dense_act_fn</strong> (<code>Union[Callable, str]</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
The non-linear activation function (function or string).`,name:"dense_act_fn"},{anchor:"transformers.Pix2StructTextConfig.decoder_start_token_id",description:`<strong>decoder_start_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the <code>decoder_start_token_id</code> token.`,name:"decoder_start_token_id"},{anchor:"transformers.Pix2StructTextConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"},{anchor:"transformers.Pix2StructTextConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the <code>padding</code> token.`,name:"pad_token_id"},{anchor:"transformers.Pix2StructTextConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The id of the <code>end-of-sequence</code> token.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/configuration_pix2struct.py#L33"}}),ie=new mt({props:{anchor:"transformers.Pix2StructTextConfig.example",$$slots:{default:[xa]},$$scope:{ctx:P}}}),Ee=new R({}),Xe=new j({props:{name:"class transformers.Pix2StructVisionConfig",anchor:"transformers.Pix2StructVisionConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"patch_embed_hidden_size",val:" = 768"},{name:"d_ff",val:" = 2048"},{name:"d_kv",val:" = 64"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"dense_act_fn",val:" = 'gelu_new'"},{name:"layer_norm_eps",val:" = 1e-06"},{name:"dropout_rate",val:" = 0.0"},{name:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 1e-10"},{name:"initializer_factor",val:" = 1.0"},{name:"seq_len",val:" = 4096"},{name:"relative_attention_num_buckets",val:" = 32"},{name:"relative_attention_max_distance",val:" = 128"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructVisionConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.Pix2StructVisionConfig.patch_embed_hidden_size",description:`<strong>patch_embed_hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the input patch_embedding layer in the Transformer encoder.`,name:"patch_embed_hidden_size"},{anchor:"transformers.Pix2StructVisionConfig.d_ff",description:`<strong>d_ff</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"d_ff"},{anchor:"transformers.Pix2StructVisionConfig.d_kv",description:`<strong>d_kv</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Dimensionality of the key, query, value projections per attention head.`,name:"d_kv"},{anchor:"transformers.Pix2StructVisionConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.Pix2StructVisionConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.Pix2StructVisionConfig.dense_act_fn",description:`<strong>dense_act_fn</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> \`<code>&quot;gelu&quot;</code> are supported.`,name:"dense_act_fn"},{anchor:"transformers.Pix2StructVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.Pix2StructVisionConfig.dropout_rate",description:`<strong>dropout_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout_rate"},{anchor:"transformers.Pix2StructVisionConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Pix2StructVisionConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-10) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Pix2StructVisionConfig.initializer_factor",description:`<strong>initializer_factor</strong> (\`float&#x201C;, <em>optional</em>, defaults to 1) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.Pix2StructVisionConfig.seq_len",description:`<strong>seq_len</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Maximum sequence length (here number of patches) supported by the model.`,name:"seq_len"},{anchor:"transformers.Pix2StructVisionConfig.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.Pix2StructVisionConfig.relative_attention_max_distance",description:`<strong>relative_attention_max_distance</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The maximum distance (in tokens) to use for each attention layer.`,name:"relative_attention_max_distance"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/configuration_pix2struct.py#L172"}}),ce=new mt({props:{anchor:"transformers.Pix2StructVisionConfig.example",$$slots:{default:[va]},$$scope:{ctx:P}}}),Le=new R({}),Ye=new j({props:{name:"class transformers.Pix2StructProcessor",anchor:"transformers.Pix2StructProcessor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructProcessor.image_processor",description:`<strong>image_processor</strong> (<code>Pix2StructImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructImageProcessor">Pix2StructImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.Pix2StructProcessor.tokenizer",description:"<strong>tokenizer</strong> (Union[<code>T5TokenizerFast</code>, <code>T5Tokenizer</code>]) &#x2014;\nAn instance of [&#x2018;T5TokenizerFast`] or [&#x2018;T5Tokenizer`]. The tokenizer is a required input.",name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/processing_pix2struct.py#L26"}}),Ae=new j({props:{name:"batch_decode",anchor:"transformers.Pix2StructProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/processing_pix2struct.py#L144"}}),De=new j({props:{name:"decode",anchor:"transformers.Pix2StructProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/processing_pix2struct.py#L151"}}),Qe=new R({}),Oe=new j({props:{name:"class transformers.Pix2StructImageProcessor",anchor:"transformers.Pix2StructImageProcessor",parameters:[{name:"do_convert_rgb",val:": bool = True"},{name:"do_normalize",val:": bool = True"},{name:"patch_size",val:": typing.Dict[str, int] = None"},{name:"max_patches",val:": int = 2048"},{name:"is_vqa",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.Pix2StructImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method. According to Pix2Struct paper and code, the image is normalized with its own mean and standard
deviation.`,name:"do_normalize"},{anchor:"transformers.Pix2StructImageProcessor.patch_size",description:`<strong>patch_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 16, &quot;width&quot;: 16}</code>):
The patch size to use for the image. According to Pix2Struct paper and code, the patch size is 16x16.`,name:"patch_size"},{anchor:"transformers.Pix2StructImageProcessor.max_patches",description:`<strong>max_patches</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The maximum number of patches to extract from the image as per the <a href="https://arxiv.org/pdf/2210.03347.pdf" rel="nofollow">Pix2Struct
paper</a>.`,name:"max_patches"},{anchor:"transformers.Pix2StructImageProcessor.is_vqa",description:`<strong>is_vqa</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the image processor is for the VQA task. If <code>True</code> and <code>header_text</code> is passed in, text is
rendered onto the input images.`,name:"is_vqa"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/image_processing_pix2struct.py#L202"}}),Ke=new j({props:{name:"preprocess",anchor:"transformers.Pix2StructImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"header_text",val:": typing.Optional[str] = None"},{name:"do_convert_rgb",val:": bool = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"max_patches",val:": typing.Optional[int] = None"},{name:"patch_size",val:": typing.Union[typing.Dict[str, int], NoneType] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images.`,name:"images"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.header_text",description:`<strong>header_text</strong> (<code>Union[List[str], str]</code>, <em>optional</em>) &#x2014;
Text to render as a header. Only has an effect if <code>image_processor.is_vqa</code> is <code>True</code>.`,name:"header_text"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.max_patches",description:`<strong>max_patches</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.max_patches</code>) &#x2014;
Maximum number of patches to extract.`,name:"max_patches"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.patch_size",description:`<strong>patch_size</strong> (<code>dict</code>, <em>optional</em>, defaults to <code>self.patch_size</code>) &#x2014;
Dictionary containing the patch height and width.`,name:"patch_size"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: Use the channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/image_processing_pix2struct.py#L362"}}),et=new R({}),tt=new j({props:{name:"class transformers.Pix2StructTextModel",anchor:"transformers.Pix2StructTextModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructTextModel.config",description:`<strong>config</strong> (Union[<code>Pix2StructConfig</code>, <code>Pix2StructTextConfig</code>]) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/modeling_pix2struct.py#L1317"}}),ot=new j({props:{name:"forward",anchor:"transformers.Pix2StructTextModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"cross_attn_head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructTextModel.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. Pix2StructText 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/v4.33.3/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for detail.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
<p>To know more on how to prepare <code>input_ids</code> for pretraining take a look a <a href="./t5#training">Pix2StructText
Training</a>.`,name:"input_ids"},{anchor:"transformers.Pix2StructTextModel.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.Pix2StructTextModel.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.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>Pix2StructText 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>).</p>
<p>To know more on how to prepare <code>decoder_input_ids</code> for pretraining take a look at <a href="./t5#training">Pix2StructText
Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.Pix2StructTextModel.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.Pix2StructTextModel.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.Pix2StructTextModel.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.Pix2StructTextModel.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.Pix2StructTextModel.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.Pix2StructTextModel.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 layers. Can be used to speed up decoding.</p>
<p>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.Pix2StructTextModel.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.Pix2StructTextModel.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.</p>
<p>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.Pix2StructTextModel.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.Pix2StructTextModel.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.Pix2StructTextModel.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.Pix2StructTextModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/modeling_pix2struct.py#L1386",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</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 (for next-token prediction).</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>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<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>Cross attentions weights after the attention softmax, used to compute the weighted average in the
cross-attention heads.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>torch.FloatTensor</code> tuples of length <code>config.n_layers</code>, with each tuple containing the cached key,
value states of the self-attention and the cross-attention layers if model is used in encoder-decoder
setting. Only relevant if <code>config.is_decoder = True</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ge=new ss({props:{$$slots:{default:[ba]},$$scope:{ctx:P}}}),_e=new mt({props:{anchor:"transformers.Pix2StructTextModel.forward.example",$$slots:{default:[ya]},$$scope:{ctx:P}}}),nt=new R({}),st=new j({props:{name:"class transformers.Pix2StructVisionModel",anchor:"transformers.Pix2StructVisionModel",parameters:[{name:"config",val:": Pix2StructConfig"}],parametersDescription:[{anchor:"transformers.Pix2StructVisionModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/modeling_pix2struct.py#L548"}}),at=new j({props:{name:"forward",anchor:"transformers.Pix2StructVisionModel.forward",parameters:[{name:"flattened_patches",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Pix2StructVisionModel.forward.flattened_patches",description:`<strong>flattened_patches</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, num_channels x patch_height x patch_width)</code>) &#x2014;
Flattened and padded pixel values. These values can be obtained using <a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>Pix2StructVisionImageProcessor.__call__</code> for details. Check the <a href="https://arxiv.org/abs/2210.03347" rel="nofollow">original
paper</a> (figure 5) for more details.`,name:"flattened_patches"},{anchor:"transformers.Pix2StructVisionModel.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 pixel values. Mask values selected in <code>[0, 1]</code>:`,name:"attention_mask"},{anchor:"transformers.Pix2StructVisionModel.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.Pix2StructVisionModel.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.Pix2StructVisionModel.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.Pix2StructVisionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/modeling_pix2struct.py#L581",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ve=new ss({props:{$$slots:{default:[Ta]},$$scope:{ctx:P}}}),be=new mt({props:{anchor:"transformers.Pix2StructVisionModel.forward.example",$$slots:{default:[wa]},$$scope:{ctx:P}}}),rt=new R({}),it=new j({props:{name:"class transformers.Pix2StructForConditionalGeneration",anchor:"transformers.Pix2StructForConditionalGeneration",parameters:[{name:"config",val:": Pix2StructConfig"}],parametersDescription:[{anchor:"transformers.Pix2StructForConditionalGeneration.config",description:`<strong>config</strong> (Union[<code>Pix2StructConfig</code>, <code>Pix2StructTextConfig</code>]) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/modeling_pix2struct.py#L1598"}}),lt=new j({props:{name:"forward",anchor:"transformers.Pix2StructForConditionalGeneration.forward",parameters:[{name:"flattened_patches",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_attention_mask",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"cross_attn_head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_outputs",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Pix2StructForConditionalGeneration.forward.flattened_patches",description:`<strong>flattened_patches</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_length, hidden_size)</code>) &#x2014;
Flattened pixel patches. the <code>hidden_size</code> is obtained by the following formula: <code>hidden_size</code> =
<code>num_channels</code> <em> <code>patch_size</code> </em> <code>patch_size</code></p>
<p>The process of flattening the pixel patches is done by <code>Pix2StructProcessor</code>.`,name:"flattened_patches"},{anchor:"transformers.Pix2StructForConditionalGeneration.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.Pix2StructForConditionalGeneration.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.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>Pix2StructText 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>).</p>
<p>To know more on how to prepare <code>decoder_input_ids</code> for pretraining take a look at <a href="./t5#training">Pix2StructText
Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.Pix2StructForConditionalGeneration.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.Pix2StructForConditionalGeneration.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.Pix2StructForConditionalGeneration.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.Pix2StructForConditionalGeneration.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.Pix2StructForConditionalGeneration.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.Pix2StructForConditionalGeneration.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 layers. Can be used to speed up decoding.</p>
<p>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.Pix2StructForConditionalGeneration.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.</p>
<p>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.Pix2StructForConditionalGeneration.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss for the decoder.`,name:"labels"},{anchor:"transformers.Pix2StructForConditionalGeneration.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.Pix2StructForConditionalGeneration.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.Pix2StructForConditionalGeneration.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.Pix2StructForConditionalGeneration.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/pix2struct/modeling_pix2struct.py#L1640",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.3/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/v4.33.3/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</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:`
<p><a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Te=new ss({props:{$$slots:{default:[Ma]},$$scope:{ctx:P}}}),we=new mt({props:{anchor:"transformers.Pix2StructForConditionalGeneration.forward.example",$$slots:{default:[Pa]},$$scope:{ctx:P}}}),Me=new mt({props:{anchor:"transformers.Pix2StructForConditionalGeneration.forward.example-2",$$slots:{default:[ka]},$$scope:{ctx:P}}}),{c(){l=s("meta"),w=r(),m=s("p"),p=r(),g=s("h1"),n=s("a"),M=s("span"),_(Se.$$.fragment),nn=r(),ft=s("span"),ft.textContent=as,xo=r(),E=s("h2"),te=s("a"),eo=s("span"),_(Je.$$.fragment),sn=r(),gt=s("span"),gt.textContent=rs,vo=r(),je=s("p"),je.innerHTML=is,bo=r(),ze=s("p"),ze.textContent=ls,yo=r(),Ue=s("blockquote"),Ue.innerHTML=cs,To=r(),Ie=s("p"),Ie.textContent=ds,wo=r(),We=s("p"),We.textContent=ps,Mo=r(),Fe=s("p"),Fe.innerHTML=us,Po=r(),Ne=s("p"),Ne.innerHTML=ms,ko=r(),X=s("h2"),oe=s("a"),to=s("span"),_(Ze.$$.fragment),an=r(),_t=s("span"),_t.textContent=hs,$o=r(),Be=s("ul"),Be.innerHTML=fs,Co=r(),L=s("h2"),ne=s("a"),oo=s("span"),_(Ve.$$.fragment),rn=r(),xt=s("span"),xt.textContent=gs,So=r(),S=s("div"),_(Re.$$.fragment),ln=r(),vt=s("p"),vt.innerHTML=_s,cn=r(),bt=s("p"),bt.innerHTML=xs,dn=r(),_(se.$$.fragment),pn=r(),ae=s("div"),_(Ge.$$.fragment),un=r(),yt=s("p"),yt.innerHTML=vs,Jo=r(),Y=s("h2"),re=s("a"),no=s("span"),_(He.$$.fragment),mn=r(),Tt=s("span"),Tt.textContent=bs,jo=r(),z=s("div"),_(qe.$$.fragment),hn=r(),wt=s("p"),wt.innerHTML=ys,fn=r(),Mt=s("p"),Mt.innerHTML=Ts,gn=r(),_(ie.$$.fragment),zo=r(),A=s("h2"),le=s("a"),so=s("span"),_(Ee.$$.fragment),_n=r(),Pt=s("span"),Pt.textContent=ws,Uo=r(),U=s("div"),_(Xe.$$.fragment),xn=r(),kt=s("p"),kt.innerHTML=Ms,vn=r(),$t=s("p"),$t.innerHTML=Ps,bn=r(),_(ce.$$.fragment),Io=r(),D=s("h2"),de=s("a"),ao=s("span"),_(Le.$$.fragment),yn=r(),Ct=s("span"),Ct.textContent=ks,Wo=r(),J=s("div"),_(Ye.$$.fragment),Tn=r(),St=s("p"),St.textContent=$s,wn=r(),Jt=s("p"),Jt.innerHTML=Cs,Mn=r(),pe=s("div"),_(Ae.$$.fragment),Pn=r(),jt=s("p"),jt.innerHTML=Ss,kn=r(),ue=s("div"),_(De.$$.fragment),$n=r(),zt=s("p"),zt.innerHTML=Js,Fo=r(),Q=s("h2"),me=s("a"),ro=s("span"),_(Qe.$$.fragment),Cn=r(),Ut=s("span"),Ut.textContent=js,No=r(),B=s("div"),_(Oe.$$.fragment),Sn=r(),It=s("p"),It.textContent=zs,Jn=r(),he=s("div"),_(Ke.$$.fragment),jn=r(),Wt=s("p"),Wt.innerHTML=Us,Zo=r(),O=s("h2"),fe=s("a"),io=s("span"),_(et.$$.fragment),zn=r(),Ft=s("span"),Ft.textContent=Is,Bo=r(),k=s("div"),_(tt.$$.fragment),Un=r(),Nt=s("p"),Nt.textContent=Ws,In=r(),Zt=s("p"),Zt.innerHTML=Fs,Wn=r(),Bt=s("p"),Bt.innerHTML=Ns,Fn=r(),Vt=s("p"),Vt.innerHTML=Zs,Nn=r(),I=s("div"),_(ot.$$.fragment),Zn=r(),Rt=s("p"),Rt.innerHTML=Bs,Bn=r(),_(ge.$$.fragment),Vn=r(),_(_e.$$.fragment),Vo=r(),K=s("h2"),xe=s("a"),lo=s("span"),_(nt.$$.fragment),Rn=r(),Gt=s("span"),Gt.textContent=Vs,Ro=r(),V=s("div"),_(st.$$.fragment),Gn=r(),Ht=s("p"),Ht.innerHTML=Rs,Hn=r(),W=s("div"),_(at.$$.fragment),qn=r(),qt=s("p"),qt.innerHTML=Gs,En=r(),_(ve.$$.fragment),Xn=r(),_(be.$$.fragment),Go=r(),ee=s("h2"),ye=s("a"),co=s("span"),_(rt.$$.fragment),Ln=r(),Et=s("span"),Et.textContent=Hs,Ho=r(),$=s("div"),_(it.$$.fragment),Yn=r(),Xt=s("p"),Xt.textContent=qs,An=r(),Lt=s("p"),Lt.innerHTML=Es,Dn=r(),Yt=s("p"),Yt.innerHTML=Xs,Qn=r(),At=s("p"),At.innerHTML=Ls,On=r(),C=s("div"),_(lt.$$.fragment),Kn=r(),Dt=s("p"),Dt.innerHTML=Ys,es=r(),_(Te.$$.fragment),ts=r(),Qt=s("p"),Qt.textContent=As,os=r(),_(we.$$.fragment),ns=r(),_(Me.$$.fragment),qo=r(),po=s("p"),this.h()},l(e){const c=ga("svelte-1phssyn",document.head);l=a(c,"META",{name:!0,content:!0}),c.forEach(t),w=i(e),m=a(e,"P",{}),f(m).forEach(t),p=i(e),g=a(e,"H1",{class:!0});var ct=f(g);n=a(ct,"A",{id:!0,class:!0,href:!0});var uo=f(n);M=a(uo,"SPAN",{});var mo=f(M);x(Se.$$.fragment,mo),mo.forEach(t),uo.forEach(t),nn=i(ct),ft=a(ct,"SPAN",{"data-svelte-h":!0}),h(ft)!=="svelte-tq4021"&&(ft.textContent=as),ct.forEach(t),xo=i(e),E=a(e,"H2",{class:!0});var dt=f(E);te=a(dt,"A",{id:!0,class:!0,href:!0});var ho=f(te);eo=a(ho,"SPAN",{});var fo=f(eo);x(Je.$$.fragment,fo),fo.forEach(t),ho.forEach(t),sn=i(dt),gt=a(dt,"SPAN",{"data-svelte-h":!0}),h(gt)!=="svelte-1jsw1pg"&&(gt.textContent=rs),dt.forEach(t),vo=i(e),je=a(e,"P",{"data-svelte-h":!0}),h(je)!=="svelte-1a4lmhm"&&(je.innerHTML=is),bo=i(e),ze=a(e,"P",{"data-svelte-h":!0}),h(ze)!=="svelte-vfdo9a"&&(ze.textContent=ls),yo=i(e),Ue=a(e,"BLOCKQUOTE",{"data-svelte-h":!0}),h(Ue)!=="svelte-bpg26t"&&(Ue.innerHTML=cs),To=i(e),Ie=a(e,"P",{"data-svelte-h":!0}),h(Ie)!=="svelte-axv494"&&(Ie.textContent=ds),wo=i(e),We=a(e,"P",{"data-svelte-h":!0}),h(We)!=="svelte-19srupf"&&(We.textContent=ps),Mo=i(e),Fe=a(e,"P",{"data-svelte-h":!0}),h(Fe)!=="svelte-u293o0"&&(Fe.innerHTML=us),Po=i(e),Ne=a(e,"P",{"data-svelte-h":!0}),h(Ne)!=="svelte-ic04x4"&&(Ne.innerHTML=ms),ko=i(e),X=a(e,"H2",{class:!0});var pt=f(X);oe=a(pt,"A",{id:!0,class:!0,href:!0});var go=f(oe);to=a(go,"SPAN",{});var _o=f(to);x(Ze.$$.fragment,_o),_o.forEach(t),go.forEach(t),an=i(pt),_t=a(pt,"SPAN",{"data-svelte-h":!0}),h(_t)!=="svelte-w4zzv6"&&(_t.textContent=hs),pt.forEach(t),$o=i(e),Be=a(e,"UL",{"data-svelte-h":!0}),h(Be)!=="svelte-14w689j"&&(Be.innerHTML=fs),Co=i(e),L=a(e,"H2",{class:!0});var ut=f(L);ne=a(ut,"A",{id:!0,class:!0,href:!0});var Ds=f(ne);oo=a(Ds,"SPAN",{});var Qs=f(oo);x(Ve.$$.fragment,Qs),Qs.forEach(t),Ds.forEach(t),rn=i(ut),xt=a(ut,"SPAN",{"data-svelte-h":!0}),h(xt)!=="svelte-htyenb"&&(xt.textContent=gs),ut.forEach(t),So=i(e),S=a(e,"DIV",{class:!0});var G=f(S);x(Re.$$.fragment,G),ln=i(G),vt=a(G,"P",{"data-svelte-h":!0}),h(vt)!=="svelte-xm0hv3"&&(vt.innerHTML=_s),cn=i(G),bt=a(G,"P",{"data-svelte-h":!0}),h(bt)!=="svelte-cfh5wl"&&(bt.innerHTML=xs),dn=i(G),x(se.$$.fragment,G),pn=i(G),ae=a(G,"DIV",{class:!0});var Xo=f(ae);x(Ge.$$.fragment,Xo),un=i(Xo),yt=a(Xo,"P",{"data-svelte-h":!0}),h(yt)!=="svelte-1x58o4w"&&(yt.innerHTML=vs),Xo.forEach(t),G.forEach(t),Jo=i(e),Y=a(e,"H2",{class:!0});var Lo=f(Y);re=a(Lo,"A",{id:!0,class:!0,href:!0});var Os=f(re);no=a(Os,"SPAN",{});var Ks=f(no);x(He.$$.fragment,Ks),Ks.forEach(t),Os.forEach(t),mn=i(Lo),Tt=a(Lo,"SPAN",{"data-svelte-h":!0}),h(Tt)!=="svelte-koh1ey"&&(Tt.textContent=bs),Lo.forEach(t),jo=i(e),z=a(e,"DIV",{class:!0});var Pe=f(z);x(qe.$$.fragment,Pe),hn=i(Pe),wt=a(Pe,"P",{"data-svelte-h":!0}),h(wt)!=="svelte-15a8uf8"&&(wt.innerHTML=ys),fn=i(Pe),Mt=a(Pe,"P",{"data-svelte-h":!0}),h(Mt)!=="svelte-cfh5wl"&&(Mt.innerHTML=Ts),gn=i(Pe),x(ie.$$.fragment,Pe),Pe.forEach(t),zo=i(e),A=a(e,"H2",{class:!0});var Yo=f(A);le=a(Yo,"A",{id:!0,class:!0,href:!0});var ea=f(le);so=a(ea,"SPAN",{});var ta=f(so);x(Ee.$$.fragment,ta),ta.forEach(t),ea.forEach(t),_n=i(Yo),Pt=a(Yo,"SPAN",{"data-svelte-h":!0}),h(Pt)!=="svelte-m3j5gj"&&(Pt.textContent=ws),Yo.forEach(t),Uo=i(e),U=a(e,"DIV",{class:!0});var ke=f(U);x(Xe.$$.fragment,ke),xn=i(ke),kt=a(ke,"P",{"data-svelte-h":!0}),h(kt)!=="svelte-16xkzo6"&&(kt.innerHTML=Ms),vn=i(ke),$t=a(ke,"P",{"data-svelte-h":!0}),h($t)!=="svelte-cfh5wl"&&($t.innerHTML=Ps),bn=i(ke),x(ce.$$.fragment,ke),ke.forEach(t),Io=i(e),D=a(e,"H2",{class:!0});var Ao=f(D);de=a(Ao,"A",{id:!0,class:!0,href:!0});var oa=f(de);ao=a(oa,"SPAN",{});var na=f(ao);x(Le.$$.fragment,na),na.forEach(t),oa.forEach(t),yn=i(Ao),Ct=a(Ao,"SPAN",{"data-svelte-h":!0}),h(Ct)!=="svelte-1e2vewz"&&(Ct.textContent=ks),Ao.forEach(t),Wo=i(e),J=a(e,"DIV",{class:!0});var H=f(J);x(Ye.$$.fragment,H),Tn=i(H),St=a(H,"P",{"data-svelte-h":!0}),h(St)!=="svelte-l6uwr3"&&(St.textContent=$s),wn=i(H),Jt=a(H,"P",{"data-svelte-h":!0}),h(Jt)!=="svelte-r4gve9"&&(Jt.innerHTML=Cs),Mn=i(H),pe=a(H,"DIV",{class:!0});var Do=f(pe);x(Ae.$$.fragment,Do),Pn=i(Do),jt=a(Do,"P",{"data-svelte-h":!0}),h(jt)!=="svelte-3ra7zh"&&(jt.innerHTML=Ss),Do.forEach(t),kn=i(H),ue=a(H,"DIV",{class:!0});var Qo=f(ue);x(De.$$.fragment,Qo),$n=i(Qo),zt=a(Qo,"P",{"data-svelte-h":!0}),h(zt)!=="svelte-12qnuir"&&(zt.innerHTML=Js),Qo.forEach(t),H.forEach(t),Fo=i(e),Q=a(e,"H2",{class:!0});var Oo=f(Q);me=a(Oo,"A",{id:!0,class:!0,href:!0});var sa=f(me);ro=a(sa,"SPAN",{});var aa=f(ro);x(Qe.$$.fragment,aa),aa.forEach(t),sa.forEach(t),Cn=i(Oo),Ut=a(Oo,"SPAN",{"data-svelte-h":!0}),h(Ut)!=="svelte-1tvr1h8"&&(Ut.textContent=js),Oo.forEach(t),No=i(e),B=a(e,"DIV",{class:!0});var Ot=f(B);x(Oe.$$.fragment,Ot),Sn=i(Ot),It=a(Ot,"P",{"data-svelte-h":!0}),h(It)!=="svelte-1401phk"&&(It.textContent=zs),Jn=i(Ot),he=a(Ot,"DIV",{class:!0});var Ko=f(he);x(Ke.$$.fragment,Ko),jn=i(Ko),Wt=a(Ko,"P",{"data-svelte-h":!0}),h(Wt)!=="svelte-14ynafp"&&(Wt.innerHTML=Us),Ko.forEach(t),Ot.forEach(t),Zo=i(e),O=a(e,"H2",{class:!0});var en=f(O);fe=a(en,"A",{id:!0,class:!0,href:!0});var ra=f(fe);io=a(ra,"SPAN",{});var ia=f(io);x(et.$$.fragment,ia),ia.forEach(t),ra.forEach(t),zn=i(en),Ft=a(en,"SPAN",{"data-svelte-h":!0}),h(Ft)!=="svelte-71tvif"&&(Ft.textContent=Is),en.forEach(t),Bo=i(e),k=a(e,"DIV",{class:!0});var F=f(k);x(tt.$$.fragment,F),Un=i(F),Nt=a(F,"P",{"data-svelte-h":!0}),h(Nt)!=="svelte-125tzuu"&&(Nt.textContent=Ws),In=i(F),Zt=a(F,"P",{"data-svelte-h":!0}),h(Zt)!=="svelte-3qnk5t"&&(Zt.innerHTML=Fs),Wn=i(F),Bt=a(F,"P",{"data-svelte-h":!0}),h(Bt)!=="svelte-ev63c"&&(Bt.innerHTML=Ns),Fn=i(F),Vt=a(F,"P",{"data-svelte-h":!0}),h(Vt)!=="svelte-hswkmf"&&(Vt.innerHTML=Zs),Nn=i(F),I=a(F,"DIV",{class:!0});var $e=f(I);x(ot.$$.fragment,$e),Zn=i($e),Rt=a($e,"P",{"data-svelte-h":!0}),h(Rt)!=="svelte-1b082th"&&(Rt.innerHTML=Bs),Bn=i($e),x(ge.$$.fragment,$e),Vn=i($e),x(_e.$$.fragment,$e),$e.forEach(t),F.forEach(t),Vo=i(e),K=a(e,"H2",{class:!0});var tn=f(K);xe=a(tn,"A",{id:!0,class:!0,href:!0});var la=f(xe);lo=a(la,"SPAN",{});var ca=f(lo);x(nt.$$.fragment,ca),ca.forEach(t),la.forEach(t),Rn=i(tn),Gt=a(tn,"SPAN",{"data-svelte-h":!0}),h(Gt)!=="svelte-1qelgoa"&&(Gt.textContent=Vs),tn.forEach(t),Ro=i(e),V=a(e,"DIV",{class:!0});var Kt=f(V);x(st.$$.fragment,Kt),Gn=i(Kt),Ht=a(Kt,"P",{"data-svelte-h":!0}),h(Ht)!=="svelte-ghhg35"&&(Ht.innerHTML=Rs),Hn=i(Kt),W=a(Kt,"DIV",{class:!0});var Ce=f(W);x(at.$$.fragment,Ce),qn=i(Ce),qt=a(Ce,"P",{"data-svelte-h":!0}),h(qt)!=="svelte-dd4ro5"&&(qt.innerHTML=Gs),En=i(Ce),x(ve.$$.fragment,Ce),Xn=i(Ce),x(be.$$.fragment,Ce),Ce.forEach(t),Kt.forEach(t),Go=i(e),ee=a(e,"H2",{class:!0});var on=f(ee);ye=a(on,"A",{id:!0,class:!0,href:!0});var da=f(ye);co=a(da,"SPAN",{});var pa=f(co);x(rt.$$.fragment,pa),pa.forEach(t),da.forEach(t),Ln=i(on),Et=a(on,"SPAN",{"data-svelte-h":!0}),h(Et)!=="svelte-1is77pw"&&(Et.textContent=Hs),on.forEach(t),Ho=i(e),$=a(e,"DIV",{class:!0});var N=f($);x(it.$$.fragment,N),Yn=i(N),Xt=a(N,"P",{"data-svelte-h":!0}),h(Xt)!=="svelte-f5gy22"&&(Xt.textContent=qs),An=i(N),Lt=a(N,"P",{"data-svelte-h":!0}),h(Lt)!=="svelte-3qnk5t"&&(Lt.innerHTML=Es),Dn=i(N),Yt=a(N,"P",{"data-svelte-h":!0}),h(Yt)!=="svelte-ev63c"&&(Yt.innerHTML=Xs),Qn=i(N),At=a(N,"P",{"data-svelte-h":!0}),h(At)!=="svelte-hswkmf"&&(At.innerHTML=Ls),On=i(N),C=a(N,"DIV",{class:!0});var Z=f(C);x(lt.$$.fragment,Z),Kn=i(Z),Dt=a(Z,"P",{"data-svelte-h":!0}),h(Dt)!=="svelte-ls16tf"&&(Dt.innerHTML=Ys),es=i(Z),x(Te.$$.fragment,Z),ts=i(Z),Qt=a(Z,"P",{"data-svelte-h":!0}),h(Qt)!=="svelte-11lpom8"&&(Qt.textContent=As),os=i(Z),x(we.$$.fragment,Z),ns=i(Z),x(Me.$$.fragment,Z),Z.forEach(t),N.forEach(t),qo=i(e),po=a(e,"P",{}),f(po).forEach(t),this.h()},h(){u(l,"name","hf:doc:metadata"),u(l,"content",JSON.stringify(Ca)),u(n,"id","pix2struct"),u(n,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(n,"href","#pix2struct"),u(g,"class","relative group"),u(te,"id","overview"),u(te,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(te,"href","#overview"),u(E,"class","relative group"),u(oe,"id","resources"),u(oe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(oe,"href","#resources"),u(X,"class","relative group"),u(ne,"id","transformers.Pix2StructConfig"),u(ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ne,"href","#transformers.Pix2StructConfig"),u(L,"class","relative group"),u(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(re,"id","transformers.Pix2StructTextConfig"),u(re,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(re,"href","#transformers.Pix2StructTextConfig"),u(Y,"class","relative group"),u(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(le,"id","transformers.Pix2StructVisionConfig"),u(le,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(le,"href","#transformers.Pix2StructVisionConfig"),u(A,"class","relative group"),u(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(de,"id","transformers.Pix2StructProcessor"),u(de,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(de,"href","#transformers.Pix2StructProcessor"),u(D,"class","relative group"),u(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(me,"id","transformers.Pix2StructImageProcessor"),u(me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(me,"href","#transformers.Pix2StructImageProcessor"),u(Q,"class","relative group"),u(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(fe,"id","transformers.Pix2StructTextModel"),u(fe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(fe,"href","#transformers.Pix2StructTextModel"),u(O,"class","relative group"),u(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(xe,"id","transformers.Pix2StructVisionModel"),u(xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(xe,"href","#transformers.Pix2StructVisionModel"),u(K,"class","relative group"),u(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ye,"id","transformers.Pix2StructForConditionalGeneration"),u(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ye,"href","#transformers.Pix2StructForConditionalGeneration"),u(ee,"class","relative group"),u(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u($,"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,c){o(document.head,l),d(e,w,c),d(e,m,c),d(e,p,c),d(e,g,c),o(g,n),o(n,M),v(Se,M,null),o(g,nn),o(g,ft),d(e,xo,c),d(e,E,c),o(E,te),o(te,eo),v(Je,eo,null),o(E,sn),o(E,gt),d(e,vo,c),d(e,je,c),d(e,bo,c),d(e,ze,c),d(e,yo,c),d(e,Ue,c),d(e,To,c),d(e,Ie,c),d(e,wo,c),d(e,We,c),d(e,Mo,c),d(e,Fe,c),d(e,Po,c),d(e,Ne,c),d(e,ko,c),d(e,X,c),o(X,oe),o(oe,to),v(Ze,to,null),o(X,an),o(X,_t),d(e,$o,c),d(e,Be,c),d(e,Co,c),d(e,L,c),o(L,ne),o(ne,oo),v(Ve,oo,null),o(L,rn),o(L,xt),d(e,So,c),d(e,S,c),v(Re,S,null),o(S,ln),o(S,vt),o(S,cn),o(S,bt),o(S,dn),v(se,S,null),o(S,pn),o(S,ae),v(Ge,ae,null),o(ae,un),o(ae,yt),d(e,Jo,c),d(e,Y,c),o(Y,re),o(re,no),v(He,no,null),o(Y,mn),o(Y,Tt),d(e,jo,c),d(e,z,c),v(qe,z,null),o(z,hn),o(z,wt),o(z,fn),o(z,Mt),o(z,gn),v(ie,z,null),d(e,zo,c),d(e,A,c),o(A,le),o(le,so),v(Ee,so,null),o(A,_n),o(A,Pt),d(e,Uo,c),d(e,U,c),v(Xe,U,null),o(U,xn),o(U,kt),o(U,vn),o(U,$t),o(U,bn),v(ce,U,null),d(e,Io,c),d(e,D,c),o(D,de),o(de,ao),v(Le,ao,null),o(D,yn),o(D,Ct),d(e,Wo,c),d(e,J,c),v(Ye,J,null),o(J,Tn),o(J,St),o(J,wn),o(J,Jt),o(J,Mn),o(J,pe),v(Ae,pe,null),o(pe,Pn),o(pe,jt),o(J,kn),o(J,ue),v(De,ue,null),o(ue,$n),o(ue,zt),d(e,Fo,c),d(e,Q,c),o(Q,me),o(me,ro),v(Qe,ro,null),o(Q,Cn),o(Q,Ut),d(e,No,c),d(e,B,c),v(Oe,B,null),o(B,Sn),o(B,It),o(B,Jn),o(B,he),v(Ke,he,null),o(he,jn),o(he,Wt),d(e,Zo,c),d(e,O,c),o(O,fe),o(fe,io),v(et,io,null),o(O,zn),o(O,Ft),d(e,Bo,c),d(e,k,c),v(tt,k,null),o(k,Un),o(k,Nt),o(k,In),o(k,Zt),o(k,Wn),o(k,Bt),o(k,Fn),o(k,Vt),o(k,Nn),o(k,I),v(ot,I,null),o(I,Zn),o(I,Rt),o(I,Bn),v(ge,I,null),o(I,Vn),v(_e,I,null),d(e,Vo,c),d(e,K,c),o(K,xe),o(xe,lo),v(nt,lo,null),o(K,Rn),o(K,Gt),d(e,Ro,c),d(e,V,c),v(st,V,null),o(V,Gn),o(V,Ht),o(V,Hn),o(V,W),v(at,W,null),o(W,qn),o(W,qt),o(W,En),v(ve,W,null),o(W,Xn),v(be,W,null),d(e,Go,c),d(e,ee,c),o(ee,ye),o(ye,co),v(rt,co,null),o(ee,Ln),o(ee,Et),d(e,Ho,c),d(e,$,c),v(it,$,null),o($,Yn),o($,Xt),o($,An),o($,Lt),o($,Dn),o($,Yt),o($,Qn),o($,At),o($,On),o($,C),v(lt,C,null),o(C,Kn),o(C,Dt),o(C,es),v(Te,C,null),o(C,ts),o(C,Qt),o(C,os),v(we,C,null),o(C,ns),v(Me,C,null),d(e,qo,c),d(e,po,c),Eo=!0},p(e,[c]){const ct={};c&2&&(ct.$$scope={dirty:c,ctx:e}),se.$set(ct);const uo={};c&2&&(uo.$$scope={dirty:c,ctx:e}),ie.$set(uo);const mo={};c&2&&(mo.$$scope={dirty:c,ctx:e}),ce.$set(mo);const dt={};c&2&&(dt.$$scope={dirty:c,ctx:e}),ge.$set(dt);const ho={};c&2&&(ho.$$scope={dirty:c,ctx:e}),_e.$set(ho);const fo={};c&2&&(fo.$$scope={dirty:c,ctx:e}),ve.$set(fo);const pt={};c&2&&(pt.$$scope={dirty:c,ctx:e}),be.$set(pt);const go={};c&2&&(go.$$scope={dirty:c,ctx:e}),Te.$set(go);const _o={};c&2&&(_o.$$scope={dirty:c,ctx:e}),we.$set(_o);const ut={};c&2&&(ut.$$scope={dirty:c,ctx:e}),Me.$set(ut)},i(e){Eo||(b(Se.$$.fragment,e),b(Je.$$.fragment,e),b(Ze.$$.fragment,e),b(Ve.$$.fragment,e),b(Re.$$.fragment,e),b(se.$$.fragment,e),b(Ge.$$.fragment,e),b(He.$$.fragment,e),b(qe.$$.fragment,e),b(ie.$$.fragment,e),b(Ee.$$.fragment,e),b(Xe.$$.fragment,e),b(ce.$$.fragment,e),b(Le.$$.fragment,e),b(Ye.$$.fragment,e),b(Ae.$$.fragment,e),b(De.$$.fragment,e),b(Qe.$$.fragment,e),b(Oe.$$.fragment,e),b(Ke.$$.fragment,e),b(et.$$.fragment,e),b(tt.$$.fragment,e),b(ot.$$.fragment,e),b(ge.$$.fragment,e),b(_e.$$.fragment,e),b(nt.$$.fragment,e),b(st.$$.fragment,e),b(at.$$.fragment,e),b(ve.$$.fragment,e),b(be.$$.fragment,e),b(rt.$$.fragment,e),b(it.$$.fragment,e),b(lt.$$.fragment,e),b(Te.$$.fragment,e),b(we.$$.fragment,e),b(Me.$$.fragment,e),Eo=!0)},o(e){y(Se.$$.fragment,e),y(Je.$$.fragment,e),y(Ze.$$.fragment,e),y(Ve.$$.fragment,e),y(Re.$$.fragment,e),y(se.$$.fragment,e),y(Ge.$$.fragment,e),y(He.$$.fragment,e),y(qe.$$.fragment,e),y(ie.$$.fragment,e),y(Ee.$$.fragment,e),y(Xe.$$.fragment,e),y(ce.$$.fragment,e),y(Le.$$.fragment,e),y(Ye.$$.fragment,e),y(Ae.$$.fragment,e),y(De.$$.fragment,e),y(Qe.$$.fragment,e),y(Oe.$$.fragment,e),y(Ke.$$.fragment,e),y(et.$$.fragment,e),y(tt.$$.fragment,e),y(ot.$$.fragment,e),y(ge.$$.fragment,e),y(_e.$$.fragment,e),y(nt.$$.fragment,e),y(st.$$.fragment,e),y(at.$$.fragment,e),y(ve.$$.fragment,e),y(be.$$.fragment,e),y(rt.$$.fragment,e),y(it.$$.fragment,e),y(lt.$$.fragment,e),y(Te.$$.fragment,e),y(we.$$.fragment,e),y(Me.$$.fragment,e),Eo=!1},d(e){e&&(t(w),t(m),t(p),t(g),t(xo),t(E),t(vo),t(je),t(bo),t(ze),t(yo),t(Ue),t(To),t(Ie),t(wo),t(We),t(Mo),t(Fe),t(Po),t(Ne),t(ko),t(X),t($o),t(Be),t(Co),t(L),t(So),t(S),t(Jo),t(Y),t(jo),t(z),t(zo),t(A),t(Uo),t(U),t(Io),t(D),t(Wo),t(J),t(Fo),t(Q),t(No),t(B),t(Zo),t(O),t(Bo),t(k),t(Vo),t(K),t(Ro),t(V),t(Go),t(ee),t(Ho),t($),t(qo),t(po)),t(l),T(Se),T(Je),T(Ze),T(Ve),T(Re),T(se),T(Ge),T(He),T(qe),T(ie),T(Ee),T(Xe),T(ce),T(Le),T(Ye),T(Ae),T(De),T(Qe),T(Oe),T(Ke),T(et),T(tt),T(ot),T(ge),T(_e),T(nt),T(st),T(at),T(ve),T(be),T(rt),T(it),T(lt),T(Te),T(we),T(Me)}}}const Ca={local:"pix2struct",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.Pix2StructConfig",title:"Pix2StructConfig"},{local:"transformers.Pix2StructTextConfig",title:"Pix2StructTextConfig"},{local:"transformers.Pix2StructVisionConfig",title:"Pix2StructVisionConfig"},{local:"transformers.Pix2StructProcessor",title:"Pix2StructProcessor"},{local:"transformers.Pix2StructImageProcessor",title:"Pix2StructImageProcessor"},{local:"transformers.Pix2StructTextModel",title:"Pix2StructTextModel"},{local:"transformers.Pix2StructVisionModel",title:"Pix2StructVisionModel"},{local:"transformers.Pix2StructForConditionalGeneration",title:"Pix2StructForConditionalGeneration"}],title:"Pix2Struct"};function Sa(P){return ma(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Na extends ha{constructor(l){super(),fa(this,l,Sa,$a,ua,{})}}export{Na as component};
