import{s as Mn,o as wn,n as E}from"../chunks/scheduler.25b97de1.js";import{S as Pn,i as kn,g as c,s as a,r as u,A as $n,h as p,f as s,c as r,j as k,u as h,x as b,k as $,y as i,a as d,v as f,d as g,t as _,w as x}from"../chunks/index.d9030fc9.js";import{T as Ro}from"../chunks/Tip.baa67368.js";import{D as z}from"../chunks/Docstring.e257edda.js";import{C as Ye}from"../chunks/CodeBlock.e6cd0d95.js";import{E as Le}from"../chunks/ExampleCodeBlock.20db4b6e.js";import{H as X,E as Sn}from"../chunks/EditOnGithub.91d95064.js";function Cn(M){let o,v="Example:",m,l,T;return l=new Ye({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)`,wrap:!1}}),{c(){o=c("p"),o.textContent=v,m=a(),u(l.$$.fragment)},l(t){o=p(t,"P",{"data-svelte-h":!0}),b(o)!=="svelte-11lpom8"&&(o.textContent=v),m=r(t),h(l.$$.fragment,t)},m(t,y){d(t,o,y),d(t,m,y),f(l,t,y),T=!0},p:E,i(t){T||(g(l.$$.fragment,t),T=!0)},o(t){_(l.$$.fragment,t),T=!1},d(t){t&&(s(o),s(m)),x(l,t)}}}function Jn(M){let o,v="Example:",m,l,T;return l=new Ye({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`,wrap:!1}}),{c(){o=c("p"),o.textContent=v,m=a(),u(l.$$.fragment)},l(t){o=p(t,"P",{"data-svelte-h":!0}),b(o)!=="svelte-11lpom8"&&(o.textContent=v),m=r(t),h(l.$$.fragment,t)},m(t,y){d(t,o,y),d(t,m,y),f(l,t,y),T=!0},p:E,i(t){T||(g(l.$$.fragment,t),T=!0)},o(t){_(l.$$.fragment,t),T=!1},d(t){t&&(s(o),s(m)),x(l,t)}}}function jn(M){let o,v="Example:",m,l,T;return l=new Ye({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`,wrap:!1}}),{c(){o=c("p"),o.textContent=v,m=a(),u(l.$$.fragment)},l(t){o=p(t,"P",{"data-svelte-h":!0}),b(o)!=="svelte-11lpom8"&&(o.textContent=v),m=r(t),h(l.$$.fragment,t)},m(t,y){d(t,o,y),d(t,m,y),f(l,t,y),T=!0},p:E,i(t){T||(g(l.$$.fragment,t),T=!0)},o(t){_(l.$$.fragment,t),T=!1},d(t){t&&(s(o),s(m)),x(l,t)}}}function zn(M){let o,v=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){o=c("p"),o.innerHTML=v},l(m){o=p(m,"P",{"data-svelte-h":!0}),b(o)!=="svelte-fincs2"&&(o.innerHTML=v)},m(m,l){d(m,o,l)},p:E,d(m){m&&s(o)}}}function Un(M){let o,v="Example:",m,l,T;return l=new Ye({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`,wrap:!1}}),{c(){o=c("p"),o.textContent=v,m=a(),u(l.$$.fragment)},l(t){o=p(t,"P",{"data-svelte-h":!0}),b(o)!=="svelte-11lpom8"&&(o.textContent=v),m=r(t),h(l.$$.fragment,t)},m(t,y){d(t,o,y),d(t,m,y),f(l,t,y),T=!0},p:E,i(t){T||(g(l.$$.fragment,t),T=!0)},o(t){_(l.$$.fragment,t),T=!1},d(t){t&&(s(o),s(m)),x(l,t)}}}function Wn(M){let o,v=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){o=c("p"),o.innerHTML=v},l(m){o=p(m,"P",{"data-svelte-h":!0}),b(o)!=="svelte-fincs2"&&(o.innerHTML=v)},m(m,l){d(m,o,l)},p:E,d(m){m&&s(o)}}}function In(M){let o,v="Example:",m,l,T;return l=new Ye({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>]`,wrap:!1}}),{c(){o=c("p"),o.textContent=v,m=a(),u(l.$$.fragment)},l(t){o=p(t,"P",{"data-svelte-h":!0}),b(o)!=="svelte-11lpom8"&&(o.textContent=v),m=r(t),h(l.$$.fragment,t)},m(t,y){d(t,o,y),d(t,m,y),f(l,t,y),T=!0},p:E,i(t){T||(g(l.$$.fragment,t),T=!0)},o(t){_(l.$$.fragment,t),T=!1},d(t){t&&(s(o),s(m)),x(l,t)}}}function Fn(M){let o,v=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){o=c("p"),o.innerHTML=v},l(m){o=p(m,"P",{"data-svelte-h":!0}),b(o)!=="svelte-fincs2"&&(o.innerHTML=v)},m(m,l){d(m,o,l)},p:E,d(m){m&&s(o)}}}function Zn(M){let o,v="Inference:",m,l,T;return l=new Ye({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`,wrap:!1}}),{c(){o=c("p"),o.textContent=v,m=a(),u(l.$$.fragment)},l(t){o=p(t,"P",{"data-svelte-h":!0}),b(o)!=="svelte-1i9b1jx"&&(o.textContent=v),m=r(t),h(l.$$.fragment,t)},m(t,y){d(t,o,y),d(t,m,y),f(l,t,y),T=!0},p:E,i(t){T||(g(l.$$.fragment,t),T=!0)},o(t){_(l.$$.fragment,t),T=!1},d(t){t&&(s(o),s(m)),x(l,t)}}}function Bn(M){let o,v="Training:",m,l,T;return l=new Ye({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>`,wrap:!1}}),{c(){o=c("p"),o.textContent=v,m=a(),u(l.$$.fragment)},l(t){o=p(t,"P",{"data-svelte-h":!0}),b(o)!=="svelte-1igpel8"&&(o.textContent=v),m=r(t),h(l.$$.fragment,t)},m(t,y){d(t,o,y),d(t,m,y),f(l,t,y),T=!0},p:E,i(t){T||(g(l.$$.fragment,t),T=!0)},o(t){_(l.$$.fragment,t),T=!1},d(t){t&&(s(o),s(m)),x(l,t)}}}function Vn(M){let o,v,m,l,T,t,y,Mt,ce,No='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.',wt,pe,Ho="The abstract from the paper is the following:",Pt,me,qo="<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>",kt,ue,Xo="Tips:",$t,he,Eo=`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.`,St,fe,Lo="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>.",Ct,ge,Yo=`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>.`,Jt,_e,jt,xe,Qo='<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>',zt,be,Ut,C,Te,Ot,Qe,Do=`<a href="/docs/transformers/pr_30962/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a> is the configuration class to store the configuration of a
<a href="/docs/transformers/pr_30962/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.`,At,De,Oo=`Configuration objects inherit from <a href="/docs/transformers/pr_30962/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_30962/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Kt,Y,eo,Q,ye,to,Oe,Ao=`Instantiate a <a href="/docs/transformers/pr_30962/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a> (or a derived class) from pix2struct text model configuration and pix2struct
vision model configuration.`,Wt,ve,It,U,Me,oo,Ae,Ko=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_30962/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.`,no,Ke,en=`Configuration objects inherit from <a href="/docs/transformers/pr_30962/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_30962/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,so,D,Ft,we,Zt,W,Pe,ao,et,tn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_30962/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.`,ro,tt,on=`Configuration objects inherit from <a href="/docs/transformers/pr_30962/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_30962/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,io,O,Bt,ke,Vt,J,$e,lo,ot,nn=`Constructs a PIX2STRUCT processor which wraps a BERT tokenizer and PIX2STRUCT image processor into a single
processor.`,co,nt,sn=`<a href="/docs/transformers/pr_30962/en/model_doc/pix2struct#transformers.Pix2StructProcessor">Pix2StructProcessor</a> offers all the functionalities of <a href="/docs/transformers/pr_30962/en/model_doc/pix2struct#transformers.Pix2StructImageProcessor">Pix2StructImageProcessor</a> and <a href="/docs/transformers/pr_30962/en/model_doc/mt5#transformers.T5TokenizerFast">T5TokenizerFast</a>. See
the docstring of <code>__call__()</code> and <a href="/docs/transformers/pr_30962/en/model_doc/pix2struct#transformers.Pix2StructProcessor.decode">decode()</a> for more information.`,po,A,Se,mo,st,an=`This method forwards all its arguments to Pix2StructTokenizerFast’s <a href="/docs/transformers/pr_30962/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode">batch_decode()</a>.
Please refer to the docstring of this method for more information.`,uo,K,Ce,ho,at,rn=`This method forwards all its arguments to Pix2StructTokenizerFast’s <a href="/docs/transformers/pr_30962/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode">decode()</a>. Please
refer to the docstring of this method for more information.`,Gt,Je,Rt,R,je,fo,rt,ln="Constructs a Pix2Struct image processor.",go,ee,ze,_o,it,dn=`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>).`,Nt,Ue,Ht,w,We,xo,lt,cn="The standalone text decoder of Pix2Struct",bo,dt,pn=`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.`,To,ct,mn=`This model inherits from <a href="/docs/transformers/pr_30962/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.)`,yo,pt,un=`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.`,vo,Z,Ie,Mo,mt,hn='The <a href="/docs/transformers/pr_30962/en/model_doc/pix2struct#transformers.Pix2StructTextModel">Pix2StructTextModel</a> forward method, overrides the <code>__call__</code> special method.',wo,te,Po,oe,qt,Fe,Xt,N,Ze,ko,ut,fn=`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.`,$o,B,Be,So,ht,gn='The <a href="/docs/transformers/pr_30962/en/model_doc/pix2struct#transformers.Pix2StructVisionModel">Pix2StructVisionModel</a> forward method, overrides the <code>__call__</code> special method.',Co,ne,Jo,se,Et,Ve,Lt,P,Ge,jo,ft,_n="A conditional generation model with a language modeling head. Can be used for sequence generation tasks.",zo,gt,xn=`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.`,Uo,_t,bn=`This model inherits from <a href="/docs/transformers/pr_30962/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.)`,Wo,xt,Tn=`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.`,Io,S,Re,Fo,bt,yn='The <a href="/docs/transformers/pr_30962/en/model_doc/pix2struct#transformers.Pix2StructForConditionalGeneration">Pix2StructForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',Zo,ae,Bo,Tt,vn="Example:",Vo,re,Go,ie,Yt,Ne,Qt,vt,Dt;return T=new X({props:{title:"Pix2Struct",local:"pix2struct",headingTag:"h1"}}),y=new X({props:{title:"Overview",local:"overview",headingTag:"h2"}}),_e=new X({props:{title:"Resources",local:"resources",headingTag:"h2"}}),be=new X({props:{title:"Pix2StructConfig",local:"transformers.Pix2StructConfig",headingTag:"h2"}}),Te=new z({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/pr_30962/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/pr_30962/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/vr_30962/src/transformers/models/pix2struct/configuration_pix2struct.py#L286"}}),Y=new Le({props:{anchor:"transformers.Pix2StructConfig.example",$$slots:{default:[Cn]},$$scope:{ctx:M}}}),ye=new z({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/vr_30962/src/transformers/models/pix2struct/configuration_pix2struct.py#L372",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>An instance of a configuration object</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_30962/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</a></p>
`}}),ve=new X({props:{title:"Pix2StructTextConfig",local:"transformers.Pix2StructTextConfig",headingTag:"h2"}}),Me=new z({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/pr_30962/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 probability 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/vr_30962/src/transformers/models/pix2struct/configuration_pix2struct.py#L27"}}),D=new Le({props:{anchor:"transformers.Pix2StructTextConfig.example",$$slots:{default:[Jn]},$$scope:{ctx:M}}}),we=new X({props:{title:"Pix2StructVisionConfig",local:"transformers.Pix2StructVisionConfig",headingTag:"h2"}}),Pe=new z({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-06) &#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 probability 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> (<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.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/vr_30962/src/transformers/models/pix2struct/configuration_pix2struct.py#L167"}}),O=new Le({props:{anchor:"transformers.Pix2StructVisionConfig.example",$$slots:{default:[jn]},$$scope:{ctx:M}}}),ke=new X({props:{title:"Pix2StructProcessor",local:"transformers.Pix2StructProcessor",headingTag:"h2"}}),$e=new z({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/pr_30962/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/vr_30962/src/transformers/models/pix2struct/processing_pix2struct.py#L26"}}),Se=new z({props:{name:"batch_decode",anchor:"transformers.Pix2StructProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_30962/src/transformers/models/pix2struct/processing_pix2struct.py#L145"}}),Ce=new z({props:{name:"decode",anchor:"transformers.Pix2StructProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_30962/src/transformers/models/pix2struct/processing_pix2struct.py#L152"}}),Je=new X({props:{title:"Pix2StructImageProcessor",local:"transformers.Pix2StructImageProcessor",headingTag:"h2"}}),je=new z({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:": Dict = 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/vr_30962/src/transformers/models/pix2struct/image_processing_pix2struct.py#L189"}}),ze=new z({props:{name:"preprocess",anchor:"transformers.Pix2StructImageProcessor.preprocess",parameters:[{name:"images",val:": Union"},{name:"header_text",val:": Optional = None"},{name:"do_convert_rgb",val:": bool = None"},{name:"do_normalize",val:": Optional = None"},{name:"max_patches",val:": Optional = None"},{name:"patch_size",val:": Optional = None"},{name:"return_tensors",val:": Union = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": Union = 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/vr_30962/src/transformers/models/pix2struct/image_processing_pix2struct.py#L348"}}),Ue=new X({props:{title:"Pix2StructTextModel",local:"transformers.Pix2StructTextModel",headingTag:"h2"}}),We=new z({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/pr_30962/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30962/src/transformers/models/pix2struct/modeling_pix2struct.py#L1280"}}),Ie=new z({props:{name:"forward",anchor:"transformers.Pix2StructTextModel.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"encoder_hidden_states",val:": Optional = None"},{name:"encoder_attention_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"cross_attn_head_mask",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"return_dict",val:": Optional = 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/pr_30962/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30962/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30962/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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/pr_30962/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30962/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30962/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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/pr_30962/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_30962/src/transformers/models/pix2struct/modeling_pix2struct.py#L1349",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


<p><a
  href="/docs/transformers/pr_30962/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),te=new Ro({props:{$$slots:{default:[zn]},$$scope:{ctx:M}}}),oe=new Le({props:{anchor:"transformers.Pix2StructTextModel.forward.example",$$slots:{default:[Un]},$$scope:{ctx:M}}}),Fe=new X({props:{title:"Pix2StructVisionModel",local:"transformers.Pix2StructVisionModel",headingTag:"h2"}}),Ze=new z({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/pr_30962/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/pr_30962/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30962/src/transformers/models/pix2struct/modeling_pix2struct.py#L515"}}),Be=new z({props:{name:"forward",anchor:"transformers.Pix2StructVisionModel.forward",parameters:[{name:"flattened_patches",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.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/pr_30962/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/pr_30962/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_30962/src/transformers/models/pix2struct/modeling_pix2struct.py#L548",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


<p><a
  href="/docs/transformers/pr_30962/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ne=new Ro({props:{$$slots:{default:[Wn]},$$scope:{ctx:M}}}),se=new Le({props:{anchor:"transformers.Pix2StructVisionModel.forward.example",$$slots:{default:[In]},$$scope:{ctx:M}}}),Ve=new X({props:{title:"Pix2StructForConditionalGeneration",local:"transformers.Pix2StructForConditionalGeneration",headingTag:"h2"}}),Ge=new z({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/pr_30962/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30962/src/transformers/models/pix2struct/modeling_pix2struct.py#L1552"}}),Re=new z({props:{name:"forward",anchor:"transformers.Pix2StructForConditionalGeneration.forward",parameters:[{name:"flattened_patches",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"decoder_input_ids",val:": Optional = None"},{name:"decoder_attention_mask",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"decoder_head_mask",val:": Optional = None"},{name:"cross_attn_head_mask",val:": Optional = None"},{name:"encoder_outputs",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"decoder_inputs_embeds",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.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/pr_30962/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30962/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30962/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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/pr_30962/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_30962/src/transformers/models/pix2struct/modeling_pix2struct.py#L1598",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30962/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_30962/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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_30962/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ae=new Ro({props:{$$slots:{default:[Fn]},$$scope:{ctx:M}}}),re=new Le({props:{anchor:"transformers.Pix2StructForConditionalGeneration.forward.example",$$slots:{default:[Zn]},$$scope:{ctx:M}}}),ie=new Le({props:{anchor:"transformers.Pix2StructForConditionalGeneration.forward.example-2",$$slots:{default:[Bn]},$$scope:{ctx:M}}}),Ne=new Sn({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/pix2struct.md"}}),{c(){o=c("meta"),v=a(),m=c("p"),l=a(),u(T.$$.fragment),t=a(),u(y.$$.fragment),Mt=a(),ce=c("p"),ce.innerHTML=No,wt=a(),pe=c("p"),pe.textContent=Ho,Pt=a(),me=c("blockquote"),me.innerHTML=qo,kt=a(),ue=c("p"),ue.textContent=Xo,$t=a(),he=c("p"),he.textContent=Eo,St=a(),fe=c("p"),fe.innerHTML=Lo,Ct=a(),ge=c("p"),ge.innerHTML=Yo,Jt=a(),u(_e.$$.fragment),jt=a(),xe=c("ul"),xe.innerHTML=Qo,zt=a(),u(be.$$.fragment),Ut=a(),C=c("div"),u(Te.$$.fragment),Ot=a(),Qe=c("p"),Qe.innerHTML=Do,At=a(),De=c("p"),De.innerHTML=Oo,Kt=a(),u(Y.$$.fragment),eo=a(),Q=c("div"),u(ye.$$.fragment),to=a(),Oe=c("p"),Oe.innerHTML=Ao,Wt=a(),u(ve.$$.fragment),It=a(),U=c("div"),u(Me.$$.fragment),oo=a(),Ae=c("p"),Ae.innerHTML=Ko,no=a(),Ke=c("p"),Ke.innerHTML=en,so=a(),u(D.$$.fragment),Ft=a(),u(we.$$.fragment),Zt=a(),W=c("div"),u(Pe.$$.fragment),ao=a(),et=c("p"),et.innerHTML=tn,ro=a(),tt=c("p"),tt.innerHTML=on,io=a(),u(O.$$.fragment),Bt=a(),u(ke.$$.fragment),Vt=a(),J=c("div"),u($e.$$.fragment),lo=a(),ot=c("p"),ot.textContent=nn,co=a(),nt=c("p"),nt.innerHTML=sn,po=a(),A=c("div"),u(Se.$$.fragment),mo=a(),st=c("p"),st.innerHTML=an,uo=a(),K=c("div"),u(Ce.$$.fragment),ho=a(),at=c("p"),at.innerHTML=rn,Gt=a(),u(Je.$$.fragment),Rt=a(),R=c("div"),u(je.$$.fragment),fo=a(),rt=c("p"),rt.textContent=ln,go=a(),ee=c("div"),u(ze.$$.fragment),_o=a(),it=c("p"),it.innerHTML=dn,Nt=a(),u(Ue.$$.fragment),Ht=a(),w=c("div"),u(We.$$.fragment),xo=a(),lt=c("p"),lt.textContent=cn,bo=a(),dt=c("p"),dt.innerHTML=pn,To=a(),ct=c("p"),ct.innerHTML=mn,yo=a(),pt=c("p"),pt.innerHTML=un,vo=a(),Z=c("div"),u(Ie.$$.fragment),Mo=a(),mt=c("p"),mt.innerHTML=hn,wo=a(),u(te.$$.fragment),Po=a(),u(oe.$$.fragment),qt=a(),u(Fe.$$.fragment),Xt=a(),N=c("div"),u(Ze.$$.fragment),ko=a(),ut=c("p"),ut.innerHTML=fn,$o=a(),B=c("div"),u(Be.$$.fragment),So=a(),ht=c("p"),ht.innerHTML=gn,Co=a(),u(ne.$$.fragment),Jo=a(),u(se.$$.fragment),Et=a(),u(Ve.$$.fragment),Lt=a(),P=c("div"),u(Ge.$$.fragment),jo=a(),ft=c("p"),ft.textContent=_n,zo=a(),gt=c("p"),gt.innerHTML=xn,Uo=a(),_t=c("p"),_t.innerHTML=bn,Wo=a(),xt=c("p"),xt.innerHTML=Tn,Io=a(),S=c("div"),u(Re.$$.fragment),Fo=a(),bt=c("p"),bt.innerHTML=yn,Zo=a(),u(ae.$$.fragment),Bo=a(),Tt=c("p"),Tt.textContent=vn,Vo=a(),u(re.$$.fragment),Go=a(),u(ie.$$.fragment),Yt=a(),u(Ne.$$.fragment),Qt=a(),vt=c("p"),this.h()},l(e){const n=$n("svelte-u9bgzb",document.head);o=p(n,"META",{name:!0,content:!0}),n.forEach(s),v=r(e),m=p(e,"P",{}),k(m).forEach(s),l=r(e),h(T.$$.fragment,e),t=r(e),h(y.$$.fragment,e),Mt=r(e),ce=p(e,"P",{"data-svelte-h":!0}),b(ce)!=="svelte-1a4lmhm"&&(ce.innerHTML=No),wt=r(e),pe=p(e,"P",{"data-svelte-h":!0}),b(pe)!=="svelte-vfdo9a"&&(pe.textContent=Ho),Pt=r(e),me=p(e,"BLOCKQUOTE",{"data-svelte-h":!0}),b(me)!=="svelte-bpg26t"&&(me.innerHTML=qo),kt=r(e),ue=p(e,"P",{"data-svelte-h":!0}),b(ue)!=="svelte-axv494"&&(ue.textContent=Xo),$t=r(e),he=p(e,"P",{"data-svelte-h":!0}),b(he)!=="svelte-19srupf"&&(he.textContent=Eo),St=r(e),fe=p(e,"P",{"data-svelte-h":!0}),b(fe)!=="svelte-u293o0"&&(fe.innerHTML=Lo),Ct=r(e),ge=p(e,"P",{"data-svelte-h":!0}),b(ge)!=="svelte-ic04x4"&&(ge.innerHTML=Yo),Jt=r(e),h(_e.$$.fragment,e),jt=r(e),xe=p(e,"UL",{"data-svelte-h":!0}),b(xe)!=="svelte-14w689j"&&(xe.innerHTML=Qo),zt=r(e),h(be.$$.fragment,e),Ut=r(e),C=p(e,"DIV",{class:!0});var I=k(C);h(Te.$$.fragment,I),Ot=r(I),Qe=p(I,"P",{"data-svelte-h":!0}),b(Qe)!=="svelte-fjbl7t"&&(Qe.innerHTML=Do),At=r(I),De=p(I,"P",{"data-svelte-h":!0}),b(De)!=="svelte-lbfgjz"&&(De.innerHTML=Oo),Kt=r(I),h(Y.$$.fragment,I),eo=r(I),Q=p(I,"DIV",{class:!0});var He=k(Q);h(ye.$$.fragment,He),to=r(He),Oe=p(He,"P",{"data-svelte-h":!0}),b(Oe)!=="svelte-1g6q7se"&&(Oe.innerHTML=Ao),He.forEach(s),I.forEach(s),Wt=r(e),h(ve.$$.fragment,e),It=r(e),U=p(e,"DIV",{class:!0});var H=k(U);h(Me.$$.fragment,H),oo=r(H),Ae=p(H,"P",{"data-svelte-h":!0}),b(Ae)!=="svelte-byur0c"&&(Ae.innerHTML=Ko),no=r(H),Ke=p(H,"P",{"data-svelte-h":!0}),b(Ke)!=="svelte-lbfgjz"&&(Ke.innerHTML=en),so=r(H),h(D.$$.fragment,H),H.forEach(s),Ft=r(e),h(we.$$.fragment,e),Zt=r(e),W=p(e,"DIV",{class:!0});var q=k(W);h(Pe.$$.fragment,q),ao=r(q),et=p(q,"P",{"data-svelte-h":!0}),b(et)!=="svelte-ltot2e"&&(et.innerHTML=tn),ro=r(q),tt=p(q,"P",{"data-svelte-h":!0}),b(tt)!=="svelte-lbfgjz"&&(tt.innerHTML=on),io=r(q),h(O.$$.fragment,q),q.forEach(s),Bt=r(e),h(ke.$$.fragment,e),Vt=r(e),J=p(e,"DIV",{class:!0});var F=k(J);h($e.$$.fragment,F),lo=r(F),ot=p(F,"P",{"data-svelte-h":!0}),b(ot)!=="svelte-l6uwr3"&&(ot.textContent=nn),co=r(F),nt=p(F,"P",{"data-svelte-h":!0}),b(nt)!=="svelte-jsmriu"&&(nt.innerHTML=sn),po=r(F),A=p(F,"DIV",{class:!0});var qe=k(A);h(Se.$$.fragment,qe),mo=r(qe),st=p(qe,"P",{"data-svelte-h":!0}),b(st)!=="svelte-19xsyp5"&&(st.innerHTML=an),qe.forEach(s),uo=r(F),K=p(F,"DIV",{class:!0});var Xe=k(K);h(Ce.$$.fragment,Xe),ho=r(Xe),at=p(Xe,"P",{"data-svelte-h":!0}),b(at)!=="svelte-n2x7df"&&(at.innerHTML=rn),Xe.forEach(s),F.forEach(s),Gt=r(e),h(Je.$$.fragment,e),Rt=r(e),R=p(e,"DIV",{class:!0});var L=k(R);h(je.$$.fragment,L),fo=r(L),rt=p(L,"P",{"data-svelte-h":!0}),b(rt)!=="svelte-1401phk"&&(rt.textContent=ln),go=r(L),ee=p(L,"DIV",{class:!0});var Ee=k(ee);h(ze.$$.fragment,Ee),_o=r(Ee),it=p(Ee,"P",{"data-svelte-h":!0}),b(it)!=="svelte-14ynafp"&&(it.innerHTML=dn),Ee.forEach(s),L.forEach(s),Nt=r(e),h(Ue.$$.fragment,e),Ht=r(e),w=p(e,"DIV",{class:!0});var j=k(w);h(We.$$.fragment,j),xo=r(j),lt=p(j,"P",{"data-svelte-h":!0}),b(lt)!=="svelte-125tzuu"&&(lt.textContent=cn),bo=r(j),dt=p(j,"P",{"data-svelte-h":!0}),b(dt)!=="svelte-3qnk5t"&&(dt.innerHTML=pn),To=r(j),ct=p(j,"P",{"data-svelte-h":!0}),b(ct)!=="svelte-tz21u6"&&(ct.innerHTML=mn),yo=r(j),pt=p(j,"P",{"data-svelte-h":!0}),b(pt)!=="svelte-hswkmf"&&(pt.innerHTML=un),vo=r(j),Z=p(j,"DIV",{class:!0});var le=k(Z);h(Ie.$$.fragment,le),Mo=r(le),mt=p(le,"P",{"data-svelte-h":!0}),b(mt)!=="svelte-iino0l"&&(mt.innerHTML=hn),wo=r(le),h(te.$$.fragment,le),Po=r(le),h(oe.$$.fragment,le),le.forEach(s),j.forEach(s),qt=r(e),h(Fe.$$.fragment,e),Xt=r(e),N=p(e,"DIV",{class:!0});var yt=k(N);h(Ze.$$.fragment,yt),ko=r(yt),ut=p(yt,"P",{"data-svelte-h":!0}),b(ut)!=="svelte-ghhg35"&&(ut.innerHTML=fn),$o=r(yt),B=p(yt,"DIV",{class:!0});var de=k(B);h(Be.$$.fragment,de),So=r(de),ht=p(de,"P",{"data-svelte-h":!0}),b(ht)!=="svelte-ulds85"&&(ht.innerHTML=gn),Co=r(de),h(ne.$$.fragment,de),Jo=r(de),h(se.$$.fragment,de),de.forEach(s),yt.forEach(s),Et=r(e),h(Ve.$$.fragment,e),Lt=r(e),P=p(e,"DIV",{class:!0});var V=k(P);h(Ge.$$.fragment,V),jo=r(V),ft=p(V,"P",{"data-svelte-h":!0}),b(ft)!=="svelte-f5gy22"&&(ft.textContent=_n),zo=r(V),gt=p(V,"P",{"data-svelte-h":!0}),b(gt)!=="svelte-3qnk5t"&&(gt.innerHTML=xn),Uo=r(V),_t=p(V,"P",{"data-svelte-h":!0}),b(_t)!=="svelte-tz21u6"&&(_t.innerHTML=bn),Wo=r(V),xt=p(V,"P",{"data-svelte-h":!0}),b(xt)!=="svelte-hswkmf"&&(xt.innerHTML=Tn),Io=r(V),S=p(V,"DIV",{class:!0});var G=k(S);h(Re.$$.fragment,G),Fo=r(G),bt=p(G,"P",{"data-svelte-h":!0}),b(bt)!=="svelte-171zer"&&(bt.innerHTML=yn),Zo=r(G),h(ae.$$.fragment,G),Bo=r(G),Tt=p(G,"P",{"data-svelte-h":!0}),b(Tt)!=="svelte-11lpom8"&&(Tt.textContent=vn),Vo=r(G),h(re.$$.fragment,G),Go=r(G),h(ie.$$.fragment,G),G.forEach(s),V.forEach(s),Yt=r(e),h(Ne.$$.fragment,e),Qt=r(e),vt=p(e,"P",{}),k(vt).forEach(s),this.h()},h(){$(o,"name","hf:doc:metadata"),$(o,"content",Gn),$(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(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"),$(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(P,"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,n){i(document.head,o),d(e,v,n),d(e,m,n),d(e,l,n),f(T,e,n),d(e,t,n),f(y,e,n),d(e,Mt,n),d(e,ce,n),d(e,wt,n),d(e,pe,n),d(e,Pt,n),d(e,me,n),d(e,kt,n),d(e,ue,n),d(e,$t,n),d(e,he,n),d(e,St,n),d(e,fe,n),d(e,Ct,n),d(e,ge,n),d(e,Jt,n),f(_e,e,n),d(e,jt,n),d(e,xe,n),d(e,zt,n),f(be,e,n),d(e,Ut,n),d(e,C,n),f(Te,C,null),i(C,Ot),i(C,Qe),i(C,At),i(C,De),i(C,Kt),f(Y,C,null),i(C,eo),i(C,Q),f(ye,Q,null),i(Q,to),i(Q,Oe),d(e,Wt,n),f(ve,e,n),d(e,It,n),d(e,U,n),f(Me,U,null),i(U,oo),i(U,Ae),i(U,no),i(U,Ke),i(U,so),f(D,U,null),d(e,Ft,n),f(we,e,n),d(e,Zt,n),d(e,W,n),f(Pe,W,null),i(W,ao),i(W,et),i(W,ro),i(W,tt),i(W,io),f(O,W,null),d(e,Bt,n),f(ke,e,n),d(e,Vt,n),d(e,J,n),f($e,J,null),i(J,lo),i(J,ot),i(J,co),i(J,nt),i(J,po),i(J,A),f(Se,A,null),i(A,mo),i(A,st),i(J,uo),i(J,K),f(Ce,K,null),i(K,ho),i(K,at),d(e,Gt,n),f(Je,e,n),d(e,Rt,n),d(e,R,n),f(je,R,null),i(R,fo),i(R,rt),i(R,go),i(R,ee),f(ze,ee,null),i(ee,_o),i(ee,it),d(e,Nt,n),f(Ue,e,n),d(e,Ht,n),d(e,w,n),f(We,w,null),i(w,xo),i(w,lt),i(w,bo),i(w,dt),i(w,To),i(w,ct),i(w,yo),i(w,pt),i(w,vo),i(w,Z),f(Ie,Z,null),i(Z,Mo),i(Z,mt),i(Z,wo),f(te,Z,null),i(Z,Po),f(oe,Z,null),d(e,qt,n),f(Fe,e,n),d(e,Xt,n),d(e,N,n),f(Ze,N,null),i(N,ko),i(N,ut),i(N,$o),i(N,B),f(Be,B,null),i(B,So),i(B,ht),i(B,Co),f(ne,B,null),i(B,Jo),f(se,B,null),d(e,Et,n),f(Ve,e,n),d(e,Lt,n),d(e,P,n),f(Ge,P,null),i(P,jo),i(P,ft),i(P,zo),i(P,gt),i(P,Uo),i(P,_t),i(P,Wo),i(P,xt),i(P,Io),i(P,S),f(Re,S,null),i(S,Fo),i(S,bt),i(S,Zo),f(ae,S,null),i(S,Bo),i(S,Tt),i(S,Vo),f(re,S,null),i(S,Go),f(ie,S,null),d(e,Yt,n),f(Ne,e,n),d(e,Qt,n),d(e,vt,n),Dt=!0},p(e,[n]){const I={};n&2&&(I.$$scope={dirty:n,ctx:e}),Y.$set(I);const He={};n&2&&(He.$$scope={dirty:n,ctx:e}),D.$set(He);const H={};n&2&&(H.$$scope={dirty:n,ctx:e}),O.$set(H);const q={};n&2&&(q.$$scope={dirty:n,ctx:e}),te.$set(q);const F={};n&2&&(F.$$scope={dirty:n,ctx:e}),oe.$set(F);const qe={};n&2&&(qe.$$scope={dirty:n,ctx:e}),ne.$set(qe);const Xe={};n&2&&(Xe.$$scope={dirty:n,ctx:e}),se.$set(Xe);const L={};n&2&&(L.$$scope={dirty:n,ctx:e}),ae.$set(L);const Ee={};n&2&&(Ee.$$scope={dirty:n,ctx:e}),re.$set(Ee);const j={};n&2&&(j.$$scope={dirty:n,ctx:e}),ie.$set(j)},i(e){Dt||(g(T.$$.fragment,e),g(y.$$.fragment,e),g(_e.$$.fragment,e),g(be.$$.fragment,e),g(Te.$$.fragment,e),g(Y.$$.fragment,e),g(ye.$$.fragment,e),g(ve.$$.fragment,e),g(Me.$$.fragment,e),g(D.$$.fragment,e),g(we.$$.fragment,e),g(Pe.$$.fragment,e),g(O.$$.fragment,e),g(ke.$$.fragment,e),g($e.$$.fragment,e),g(Se.$$.fragment,e),g(Ce.$$.fragment,e),g(Je.$$.fragment,e),g(je.$$.fragment,e),g(ze.$$.fragment,e),g(Ue.$$.fragment,e),g(We.$$.fragment,e),g(Ie.$$.fragment,e),g(te.$$.fragment,e),g(oe.$$.fragment,e),g(Fe.$$.fragment,e),g(Ze.$$.fragment,e),g(Be.$$.fragment,e),g(ne.$$.fragment,e),g(se.$$.fragment,e),g(Ve.$$.fragment,e),g(Ge.$$.fragment,e),g(Re.$$.fragment,e),g(ae.$$.fragment,e),g(re.$$.fragment,e),g(ie.$$.fragment,e),g(Ne.$$.fragment,e),Dt=!0)},o(e){_(T.$$.fragment,e),_(y.$$.fragment,e),_(_e.$$.fragment,e),_(be.$$.fragment,e),_(Te.$$.fragment,e),_(Y.$$.fragment,e),_(ye.$$.fragment,e),_(ve.$$.fragment,e),_(Me.$$.fragment,e),_(D.$$.fragment,e),_(we.$$.fragment,e),_(Pe.$$.fragment,e),_(O.$$.fragment,e),_(ke.$$.fragment,e),_($e.$$.fragment,e),_(Se.$$.fragment,e),_(Ce.$$.fragment,e),_(Je.$$.fragment,e),_(je.$$.fragment,e),_(ze.$$.fragment,e),_(Ue.$$.fragment,e),_(We.$$.fragment,e),_(Ie.$$.fragment,e),_(te.$$.fragment,e),_(oe.$$.fragment,e),_(Fe.$$.fragment,e),_(Ze.$$.fragment,e),_(Be.$$.fragment,e),_(ne.$$.fragment,e),_(se.$$.fragment,e),_(Ve.$$.fragment,e),_(Ge.$$.fragment,e),_(Re.$$.fragment,e),_(ae.$$.fragment,e),_(re.$$.fragment,e),_(ie.$$.fragment,e),_(Ne.$$.fragment,e),Dt=!1},d(e){e&&(s(v),s(m),s(l),s(t),s(Mt),s(ce),s(wt),s(pe),s(Pt),s(me),s(kt),s(ue),s($t),s(he),s(St),s(fe),s(Ct),s(ge),s(Jt),s(jt),s(xe),s(zt),s(Ut),s(C),s(Wt),s(It),s(U),s(Ft),s(Zt),s(W),s(Bt),s(Vt),s(J),s(Gt),s(Rt),s(R),s(Nt),s(Ht),s(w),s(qt),s(Xt),s(N),s(Et),s(Lt),s(P),s(Yt),s(Qt),s(vt)),s(o),x(T,e),x(y,e),x(_e,e),x(be,e),x(Te),x(Y),x(ye),x(ve,e),x(Me),x(D),x(we,e),x(Pe),x(O),x(ke,e),x($e),x(Se),x(Ce),x(Je,e),x(je),x(ze),x(Ue,e),x(We),x(Ie),x(te),x(oe),x(Fe,e),x(Ze),x(Be),x(ne),x(se),x(Ve,e),x(Ge),x(Re),x(ae),x(re),x(ie),x(Ne,e)}}}const Gn='{"title":"Pix2Struct","local":"pix2struct","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"Pix2StructConfig","local":"transformers.Pix2StructConfig","sections":[],"depth":2},{"title":"Pix2StructTextConfig","local":"transformers.Pix2StructTextConfig","sections":[],"depth":2},{"title":"Pix2StructVisionConfig","local":"transformers.Pix2StructVisionConfig","sections":[],"depth":2},{"title":"Pix2StructProcessor","local":"transformers.Pix2StructProcessor","sections":[],"depth":2},{"title":"Pix2StructImageProcessor","local":"transformers.Pix2StructImageProcessor","sections":[],"depth":2},{"title":"Pix2StructTextModel","local":"transformers.Pix2StructTextModel","sections":[],"depth":2},{"title":"Pix2StructVisionModel","local":"transformers.Pix2StructVisionModel","sections":[],"depth":2},{"title":"Pix2StructForConditionalGeneration","local":"transformers.Pix2StructForConditionalGeneration","sections":[],"depth":2}],"depth":1}';function Rn(M){return wn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qn extends Pn{constructor(o){super(),kn(this,o,Rn,Vn,Mn,{})}}export{Qn as component};
