import{s as yn,o as vn,n as E}from"../chunks/scheduler.9bc65507.js";import{S as Mn,i as wn,g as l,s as a,r as h,A as Pn,h as m,f as n,c as r,j as k,u as f,x as u,k as $,y as i,a as d,v as g,d as _,t as x,w as b}from"../chunks/index.707bf1b6.js";import{T as Vo}from"../chunks/Tip.c2ecdbf4.js";import{D as z}from"../chunks/Docstring.17db21ae.js";import{C as Le}from"../chunks/CodeBlock.54a9f38d.js";import{E as Ee}from"../chunks/ExampleCodeBlock.4f515aa9.js";import{H as X}from"../chunks/Heading.342b1fa6.js";function kn(M){let o,v="Example:",p,c,T;return c=new Le({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=l("p"),o.textContent=v,p=a(),h(c.$$.fragment)},l(t){o=m(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-11lpom8"&&(o.textContent=v),p=r(t),f(c.$$.fragment,t)},m(t,y){d(t,o,y),d(t,p,y),g(c,t,y),T=!0},p:E,i(t){T||(_(c.$$.fragment,t),T=!0)},o(t){x(c.$$.fragment,t),T=!1},d(t){t&&(n(o),n(p)),b(c,t)}}}function $n(M){let o,v="Example:",p,c,T;return c=new Le({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=l("p"),o.textContent=v,p=a(),h(c.$$.fragment)},l(t){o=m(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-11lpom8"&&(o.textContent=v),p=r(t),f(c.$$.fragment,t)},m(t,y){d(t,o,y),d(t,p,y),g(c,t,y),T=!0},p:E,i(t){T||(_(c.$$.fragment,t),T=!0)},o(t){x(c.$$.fragment,t),T=!1},d(t){t&&(n(o),n(p)),b(c,t)}}}function Sn(M){let o,v="Example:",p,c,T;return c=new Le({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=l("p"),o.textContent=v,p=a(),h(c.$$.fragment)},l(t){o=m(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-11lpom8"&&(o.textContent=v),p=r(t),f(c.$$.fragment,t)},m(t,y){d(t,o,y),d(t,p,y),g(c,t,y),T=!0},p:E,i(t){T||(_(c.$$.fragment,t),T=!0)},o(t){x(c.$$.fragment,t),T=!1},d(t){t&&(n(o),n(p)),b(c,t)}}}function Cn(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=l("p"),o.innerHTML=v},l(p){o=m(p,"P",{"data-svelte-h":!0}),u(o)!=="svelte-fincs2"&&(o.innerHTML=v)},m(p,c){d(p,o,c)},p:E,d(p){p&&n(o)}}}function Jn(M){let o,v="Example:",p,c,T;return c=new Le({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=l("p"),o.textContent=v,p=a(),h(c.$$.fragment)},l(t){o=m(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-11lpom8"&&(o.textContent=v),p=r(t),f(c.$$.fragment,t)},m(t,y){d(t,o,y),d(t,p,y),g(c,t,y),T=!0},p:E,i(t){T||(_(c.$$.fragment,t),T=!0)},o(t){x(c.$$.fragment,t),T=!1},d(t){t&&(n(o),n(p)),b(c,t)}}}function jn(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=l("p"),o.innerHTML=v},l(p){o=m(p,"P",{"data-svelte-h":!0}),u(o)!=="svelte-fincs2"&&(o.innerHTML=v)},m(p,c){d(p,o,c)},p:E,d(p){p&&n(o)}}}function zn(M){let o,v="Example:",p,c,T;return c=new Le({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=l("p"),o.textContent=v,p=a(),h(c.$$.fragment)},l(t){o=m(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-11lpom8"&&(o.textContent=v),p=r(t),f(c.$$.fragment,t)},m(t,y){d(t,o,y),d(t,p,y),g(c,t,y),T=!0},p:E,i(t){T||(_(c.$$.fragment,t),T=!0)},o(t){x(c.$$.fragment,t),T=!1},d(t){t&&(n(o),n(p)),b(c,t)}}}function Un(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=l("p"),o.innerHTML=v},l(p){o=m(p,"P",{"data-svelte-h":!0}),u(o)!=="svelte-fincs2"&&(o.innerHTML=v)},m(p,c){d(p,o,c)},p:E,d(p){p&&n(o)}}}function Wn(M){let o,v="Inference:",p,c,T;return c=new Le({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=l("p"),o.textContent=v,p=a(),h(c.$$.fragment)},l(t){o=m(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-1i9b1jx"&&(o.textContent=v),p=r(t),f(c.$$.fragment,t)},m(t,y){d(t,o,y),d(t,p,y),g(c,t,y),T=!0},p:E,i(t){T||(_(c.$$.fragment,t),T=!0)},o(t){x(c.$$.fragment,t),T=!1},d(t){t&&(n(o),n(p)),b(c,t)}}}function In(M){let o,v="Training:",p,c,T;return c=new Le({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=l("p"),o.textContent=v,p=a(),h(c.$$.fragment)},l(t){o=m(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-1igpel8"&&(o.textContent=v),p=r(t),f(c.$$.fragment,t)},m(t,y){d(t,o,y),d(t,p,y),g(c,t,y),T=!0},p:E,i(t){T||(_(c.$$.fragment,t),T=!0)},o(t){x(c.$$.fragment,t),T=!1},d(t){t&&(n(o),n(p)),b(c,t)}}}function Fn(M){let o,v,p,c,T,t,y,vt,le,Go='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.',Mt,me,Ro="The abstract from the paper is the following:",wt,pe,No="<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>",Pt,ue,Ho="Tips:",kt,he,qo=`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.`,$t,fe,Xo="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>.",St,ge,Eo=`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>.`,Ct,_e,Jt,xe,Lo='<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>',jt,be,zt,C,Te,Qt,Ye,Yo=`<a href="/docs/transformers/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a> is the configuration class to store the configuration of a
<a href="/docs/transformers/v4.37.0/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.`,Dt,Qe,Qo=`Configuration objects inherit from <a href="/docs/transformers/v4.37.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/v4.37.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,At,Y,Ot,Q,ye,Kt,De,Do=`Instantiate a <a href="/docs/transformers/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a> (or a derived class) from pix2struct text model configuration and pix2struct
vision model configuration.`,Ut,ve,Wt,U,Me,eo,Ae,Ao=`This is the configuration class to store the configuration of a <a href="/docs/transformers/v4.37.0/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.`,to,Oe,Oo=`Configuration objects inherit from <a href="/docs/transformers/v4.37.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/v4.37.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,oo,D,It,we,Ft,W,Pe,no,Ke,Ko=`This is the configuration class to store the configuration of a <a href="/docs/transformers/v4.37.0/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.`,so,et,en=`Configuration objects inherit from <a href="/docs/transformers/v4.37.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/v4.37.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,ao,A,Zt,ke,Bt,J,$e,ro,tt,tn=`Constructs a PIX2STRUCT processor which wraps a BERT tokenizer and PIX2STRUCT image processor into a single
processor.`,io,ot,on=`<a href="/docs/transformers/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructProcessor">Pix2StructProcessor</a> offers all the functionalities of <a href="/docs/transformers/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructImageProcessor">Pix2StructImageProcessor</a> and <a href="/docs/transformers/v4.37.0/en/model_doc/mt5#transformers.T5TokenizerFast">T5TokenizerFast</a>. See
the docstring of <code>__call__()</code> and <a href="/docs/transformers/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructProcessor.decode">decode()</a> for more information.`,co,O,Se,lo,nt,nn=`This method forwards all its arguments to Pix2StructTokenizerFast’s <a href="/docs/transformers/v4.37.0/en/model_doc/speech_to_text_2#transformers.Speech2Text2Tokenizer.batch_decode">batch_decode()</a>.
Please refer to the docstring of this method for more information.`,mo,K,Ce,po,st,sn=`This method forwards all its arguments to Pix2StructTokenizerFast’s <a href="/docs/transformers/v4.37.0/en/model_doc/speech_to_text_2#transformers.Speech2Text2Tokenizer.decode">decode()</a>. Please
refer to the docstring of this method for more information.`,Vt,Je,Gt,R,je,uo,at,an="Constructs a Pix2Struct image processor.",ho,ee,ze,fo,rt,rn=`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>).`,Rt,Ue,Nt,w,We,go,it,cn="The standalone text decoder of Pix2Struct",_o,ct,dn=`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.`,xo,dt,ln=`This model inherits from <a href="/docs/transformers/v4.37.0/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.)`,bo,lt,mn=`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.`,To,Z,Ie,yo,mt,pn='The <a href="/docs/transformers/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructTextModel">Pix2StructTextModel</a> forward method, overrides the <code>__call__</code> special method.',vo,te,Mo,oe,Ht,Fe,qt,N,Ze,wo,pt,un=`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.`,Po,B,Be,ko,ut,hn='The <a href="/docs/transformers/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructVisionModel">Pix2StructVisionModel</a> forward method, overrides the <code>__call__</code> special method.',$o,ne,So,se,Xt,Ve,Et,P,Ge,Co,ht,fn="A conditional generation model with a language modeling head. Can be used for sequence generation tasks.",Jo,ft,gn=`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.`,jo,gt,_n=`This model inherits from <a href="/docs/transformers/v4.37.0/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.)`,zo,_t,xn=`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.`,Uo,S,Re,Wo,xt,bn='The <a href="/docs/transformers/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructForConditionalGeneration">Pix2StructForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',Io,ae,Fo,bt,Tn="Example:",Zo,re,Bo,ie,Lt,yt,Yt;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/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructTextConfig">Pix2StructTextConfig</a>.`,name:"text_config"},{anchor:"transformers.Pix2StructConfig.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructVisionConfig">Pix2StructVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.Pix2StructConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Factor to multiply the initialization range with.`,name:"initializer_factor"},{anchor:"transformers.Pix2StructConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Pix2StructConfig.is_vqa",description:`<strong>is_vqa</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the model has been fine-tuned for VQA or not.`,name:"is_vqa"},{anchor:"transformers.Pix2StructConfig.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.37.0/src/transformers/models/pix2struct/configuration_pix2struct.py#L292"}}),Y=new Ee({props:{anchor:"transformers.Pix2StructConfig.example",$$slots:{default:[kn]},$$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/v4.37.0/src/transformers/models/pix2struct/configuration_pix2struct.py#L378",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/v4.37.0/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/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructTextModel">Pix2StructTextModel</a>.`,name:"vocab_size"},{anchor:"transformers.Pix2StructTextConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.Pix2StructTextConfig.d_kv",description:`<strong>d_kv</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Dimensionality of the key, query, value projections in each attention head.`,name:"d_kv"},{anchor:"transformers.Pix2StructTextConfig.d_ff",description:`<strong>d_ff</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"d_ff"},{anchor:"transformers.Pix2StructTextConfig.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_layers"},{anchor:"transformers.Pix2StructTextConfig.num_heads",description:`<strong>num_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_heads"},{anchor:"transformers.Pix2StructTextConfig.relative_attention_num_buckets",description:`<strong>relative_attention_num_buckets</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The number of buckets to use for each attention layer.`,name:"relative_attention_num_buckets"},{anchor:"transformers.Pix2StructTextConfig.relative_attention_max_distance",description:`<strong>relative_attention_max_distance</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The maximum distance of the longer sequences for the bucket separation.`,name:"relative_attention_max_distance"},{anchor:"transformers.Pix2StructTextConfig.dropout_rate",description:`<strong>dropout_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout_rate"},{anchor:"transformers.Pix2StructTextConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_epsilon"},{anchor:"transformers.Pix2StructTextConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.Pix2StructTextConfig.dense_act_fn",description:`<strong>dense_act_fn</strong> (<code>Union[Callable, str]</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
The non-linear activation function (function or string).`,name:"dense_act_fn"},{anchor:"transformers.Pix2StructTextConfig.decoder_start_token_id",description:`<strong>decoder_start_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the <code>decoder_start_token_id</code> token.`,name:"decoder_start_token_id"},{anchor:"transformers.Pix2StructTextConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"},{anchor:"transformers.Pix2StructTextConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the <code>padding</code> token.`,name:"pad_token_id"},{anchor:"transformers.Pix2StructTextConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The id of the <code>end-of-sequence</code> token.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/v4.37.0/src/transformers/models/pix2struct/configuration_pix2struct.py#L33"}}),D=new Ee({props:{anchor:"transformers.Pix2StructTextConfig.example",$$slots:{default:[$n]},$$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 probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout_rate"},{anchor:"transformers.Pix2StructVisionConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Pix2StructVisionConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-10) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Pix2StructVisionConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<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/v4.37.0/src/transformers/models/pix2struct/configuration_pix2struct.py#L173"}}),A=new Ee({props:{anchor:"transformers.Pix2StructVisionConfig.example",$$slots:{default:[Sn]},$$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/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructImageProcessor">Pix2StructImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.Pix2StructProcessor.tokenizer",description:"<strong>tokenizer</strong> (Union[<code>T5TokenizerFast</code>, <code>T5Tokenizer</code>]) &#x2014;\nAn instance of [&#x2018;T5TokenizerFast`] or [&#x2018;T5Tokenizer`]. The tokenizer is a required input.",name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.37.0/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/v4.37.0/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/v4.37.0/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/v4.37.0/src/transformers/models/pix2struct/image_processing_pix2struct.py#L188"}}),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/v4.37.0/src/transformers/models/pix2struct/image_processing_pix2struct.py#L347"}}),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/v4.37.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.37.0/src/transformers/models/pix2struct/modeling_pix2struct.py#L1302"}}),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/v4.37.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.37.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.37.0/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for detail.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
<p>To know more on how to prepare <code>input_ids</code> for pretraining take a look a <a href="./t5#training">Pix2StructText
Training</a>.`,name:"input_ids"},{anchor:"transformers.Pix2StructTextModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.Pix2StructTextModel.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.37.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.37.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.37.0/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>Pix2StructText uses the <code>pad_token_id</code> as the starting token for <code>decoder_input_ids</code> generation. If
<code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>To know more on how to prepare <code>decoder_input_ids</code> for pretraining take a look at <a href="./t5#training">Pix2StructText
Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.Pix2StructTextModel.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.Pix2StructTextModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Pix2StructTextModel.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.Pix2StructTextModel.forward.cross_attn_head_mask",description:`<strong>cross_attn_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the cross-attention modules in the decoder. Mask values selected in
<code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"cross_attn_head_mask"},{anchor:"transformers.Pix2StructTextModel.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <code>optional</code>: <em>hidden_states</em>, <code>optional</code>: <em>attentions</em>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code> is a sequence of hidden states at
the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.Pix2StructTextModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention layers. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Pix2StructTextModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.Pix2StructTextModel.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. If <code>past_key_values</code> is used, optionally only the last <code>decoder_inputs_embeds</code> have to be
input (see <code>past_key_values</code>). This is useful if you want more control over how to convert
<code>decoder_input_ids</code> indices into associated vectors than the model&#x2019;s internal embedding lookup matrix.</p>
<p>If <code>decoder_input_ids</code> and <code>decoder_inputs_embeds</code> are both unset, <code>decoder_inputs_embeds</code> takes the value
of <code>inputs_embeds</code>.`,name:"decoder_inputs_embeds"},{anchor:"transformers.Pix2StructTextModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.Pix2StructTextModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Pix2StructTextModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Pix2StructTextModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.37.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.37.0/src/transformers/models/pix2struct/modeling_pix2struct.py#L1371",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/v4.37.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.37.0/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/v4.37.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),te=new Vo({props:{$$slots:{default:[Cn]},$$scope:{ctx:M}}}),oe=new Ee({props:{anchor:"transformers.Pix2StructTextModel.forward.example",$$slots:{default:[Jn]},$$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/v4.37.0/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.37.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.37.0/src/transformers/models/pix2struct/modeling_pix2struct.py#L537"}}),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/v4.37.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>Pix2StructVisionImageProcessor.__call__</code> for details. Check the <a href="https://arxiv.org/abs/2210.03347" rel="nofollow">original
paper</a> (figure 5) for more details.`,name:"flattened_patches"},{anchor:"transformers.Pix2StructVisionModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:`,name:"attention_mask"},{anchor:"transformers.Pix2StructVisionModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Pix2StructVisionModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Pix2StructVisionModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Pix2StructVisionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.37.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.37.0/src/transformers/models/pix2struct/modeling_pix2struct.py#L570",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/v4.37.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.37.0/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/v4.37.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ne=new Vo({props:{$$slots:{default:[jn]},$$scope:{ctx:M}}}),se=new Ee({props:{anchor:"transformers.Pix2StructVisionModel.forward.example",$$slots:{default:[zn]},$$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/v4.37.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.37.0/src/transformers/models/pix2struct/modeling_pix2struct.py#L1574"}}),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/v4.37.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.37.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.37.0/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>Pix2StructText uses the <code>pad_token_id</code> as the starting token for <code>decoder_input_ids</code> generation. If
<code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>To know more on how to prepare <code>decoder_input_ids</code> for pretraining take a look at <a href="./t5#training">Pix2StructText
Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.cross_attn_head_mask",description:`<strong>cross_attn_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the cross-attention modules in the decoder. Mask values selected in
<code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"cross_attn_head_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <code>optional</code>: <em>hidden_states</em>, <code>optional</code>: <em>attentions</em>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code> is a sequence of hidden states at
the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention layers. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. If <code>past_key_values</code> is used, optionally only the last <code>decoder_inputs_embeds</code> have to be
input (see <code>past_key_values</code>). This is useful if you want more control over how to convert
<code>decoder_input_ids</code> indices into associated vectors than the model&#x2019;s internal embedding lookup matrix.</p>
<p>If <code>decoder_input_ids</code> and <code>decoder_inputs_embeds</code> are both unset, <code>decoder_inputs_embeds</code> takes the value
of <code>inputs_embeds</code>.`,name:"decoder_inputs_embeds"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss for the decoder.`,name:"labels"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.37.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.37.0/src/transformers/models/pix2struct/modeling_pix2struct.py#L1620",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/v4.37.0/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.37.0/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/v4.37.0/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ae=new Vo({props:{$$slots:{default:[Un]},$$scope:{ctx:M}}}),re=new Ee({props:{anchor:"transformers.Pix2StructForConditionalGeneration.forward.example",$$slots:{default:[Wn]},$$scope:{ctx:M}}}),ie=new Ee({props:{anchor:"transformers.Pix2StructForConditionalGeneration.forward.example-2",$$slots:{default:[In]},$$scope:{ctx:M}}}),{c(){o=l("meta"),v=a(),p=l("p"),c=a(),h(T.$$.fragment),t=a(),h(y.$$.fragment),vt=a(),le=l("p"),le.innerHTML=Go,Mt=a(),me=l("p"),me.textContent=Ro,wt=a(),pe=l("blockquote"),pe.innerHTML=No,Pt=a(),ue=l("p"),ue.textContent=Ho,kt=a(),he=l("p"),he.textContent=qo,$t=a(),fe=l("p"),fe.innerHTML=Xo,St=a(),ge=l("p"),ge.innerHTML=Eo,Ct=a(),h(_e.$$.fragment),Jt=a(),xe=l("ul"),xe.innerHTML=Lo,jt=a(),h(be.$$.fragment),zt=a(),C=l("div"),h(Te.$$.fragment),Qt=a(),Ye=l("p"),Ye.innerHTML=Yo,Dt=a(),Qe=l("p"),Qe.innerHTML=Qo,At=a(),h(Y.$$.fragment),Ot=a(),Q=l("div"),h(ye.$$.fragment),Kt=a(),De=l("p"),De.innerHTML=Do,Ut=a(),h(ve.$$.fragment),Wt=a(),U=l("div"),h(Me.$$.fragment),eo=a(),Ae=l("p"),Ae.innerHTML=Ao,to=a(),Oe=l("p"),Oe.innerHTML=Oo,oo=a(),h(D.$$.fragment),It=a(),h(we.$$.fragment),Ft=a(),W=l("div"),h(Pe.$$.fragment),no=a(),Ke=l("p"),Ke.innerHTML=Ko,so=a(),et=l("p"),et.innerHTML=en,ao=a(),h(A.$$.fragment),Zt=a(),h(ke.$$.fragment),Bt=a(),J=l("div"),h($e.$$.fragment),ro=a(),tt=l("p"),tt.textContent=tn,io=a(),ot=l("p"),ot.innerHTML=on,co=a(),O=l("div"),h(Se.$$.fragment),lo=a(),nt=l("p"),nt.innerHTML=nn,mo=a(),K=l("div"),h(Ce.$$.fragment),po=a(),st=l("p"),st.innerHTML=sn,Vt=a(),h(Je.$$.fragment),Gt=a(),R=l("div"),h(je.$$.fragment),uo=a(),at=l("p"),at.textContent=an,ho=a(),ee=l("div"),h(ze.$$.fragment),fo=a(),rt=l("p"),rt.innerHTML=rn,Rt=a(),h(Ue.$$.fragment),Nt=a(),w=l("div"),h(We.$$.fragment),go=a(),it=l("p"),it.textContent=cn,_o=a(),ct=l("p"),ct.innerHTML=dn,xo=a(),dt=l("p"),dt.innerHTML=ln,bo=a(),lt=l("p"),lt.innerHTML=mn,To=a(),Z=l("div"),h(Ie.$$.fragment),yo=a(),mt=l("p"),mt.innerHTML=pn,vo=a(),h(te.$$.fragment),Mo=a(),h(oe.$$.fragment),Ht=a(),h(Fe.$$.fragment),qt=a(),N=l("div"),h(Ze.$$.fragment),wo=a(),pt=l("p"),pt.innerHTML=un,Po=a(),B=l("div"),h(Be.$$.fragment),ko=a(),ut=l("p"),ut.innerHTML=hn,$o=a(),h(ne.$$.fragment),So=a(),h(se.$$.fragment),Xt=a(),h(Ve.$$.fragment),Et=a(),P=l("div"),h(Ge.$$.fragment),Co=a(),ht=l("p"),ht.textContent=fn,Jo=a(),ft=l("p"),ft.innerHTML=gn,jo=a(),gt=l("p"),gt.innerHTML=_n,zo=a(),_t=l("p"),_t.innerHTML=xn,Uo=a(),S=l("div"),h(Re.$$.fragment),Wo=a(),xt=l("p"),xt.innerHTML=bn,Io=a(),h(ae.$$.fragment),Fo=a(),bt=l("p"),bt.textContent=Tn,Zo=a(),h(re.$$.fragment),Bo=a(),h(ie.$$.fragment),Lt=a(),yt=l("p"),this.h()},l(e){const s=Pn("svelte-u9bgzb",document.head);o=m(s,"META",{name:!0,content:!0}),s.forEach(n),v=r(e),p=m(e,"P",{}),k(p).forEach(n),c=r(e),f(T.$$.fragment,e),t=r(e),f(y.$$.fragment,e),vt=r(e),le=m(e,"P",{"data-svelte-h":!0}),u(le)!=="svelte-1a4lmhm"&&(le.innerHTML=Go),Mt=r(e),me=m(e,"P",{"data-svelte-h":!0}),u(me)!=="svelte-vfdo9a"&&(me.textContent=Ro),wt=r(e),pe=m(e,"BLOCKQUOTE",{"data-svelte-h":!0}),u(pe)!=="svelte-bpg26t"&&(pe.innerHTML=No),Pt=r(e),ue=m(e,"P",{"data-svelte-h":!0}),u(ue)!=="svelte-axv494"&&(ue.textContent=Ho),kt=r(e),he=m(e,"P",{"data-svelte-h":!0}),u(he)!=="svelte-19srupf"&&(he.textContent=qo),$t=r(e),fe=m(e,"P",{"data-svelte-h":!0}),u(fe)!=="svelte-u293o0"&&(fe.innerHTML=Xo),St=r(e),ge=m(e,"P",{"data-svelte-h":!0}),u(ge)!=="svelte-ic04x4"&&(ge.innerHTML=Eo),Ct=r(e),f(_e.$$.fragment,e),Jt=r(e),xe=m(e,"UL",{"data-svelte-h":!0}),u(xe)!=="svelte-14w689j"&&(xe.innerHTML=Lo),jt=r(e),f(be.$$.fragment,e),zt=r(e),C=m(e,"DIV",{class:!0});var I=k(C);f(Te.$$.fragment,I),Qt=r(I),Ye=m(I,"P",{"data-svelte-h":!0}),u(Ye)!=="svelte-1ls85c7"&&(Ye.innerHTML=Yo),Dt=r(I),Qe=m(I,"P",{"data-svelte-h":!0}),u(Qe)!=="svelte-1p8c3o7"&&(Qe.innerHTML=Qo),At=r(I),f(Y.$$.fragment,I),Ot=r(I),Q=m(I,"DIV",{class:!0});var Ne=k(Q);f(ye.$$.fragment,Ne),Kt=r(Ne),De=m(Ne,"P",{"data-svelte-h":!0}),u(De)!=="svelte-ky8hxd"&&(De.innerHTML=Do),Ne.forEach(n),I.forEach(n),Ut=r(e),f(ve.$$.fragment,e),Wt=r(e),U=m(e,"DIV",{class:!0});var H=k(U);f(Me.$$.fragment,H),eo=r(H),Ae=m(H,"P",{"data-svelte-h":!0}),u(Ae)!=="svelte-89xlrp"&&(Ae.innerHTML=Ao),to=r(H),Oe=m(H,"P",{"data-svelte-h":!0}),u(Oe)!=="svelte-1p8c3o7"&&(Oe.innerHTML=Oo),oo=r(H),f(D.$$.fragment,H),H.forEach(n),It=r(e),f(we.$$.fragment,e),Ft=r(e),W=m(e,"DIV",{class:!0});var q=k(W);f(Pe.$$.fragment,q),no=r(q),Ke=m(q,"P",{"data-svelte-h":!0}),u(Ke)!=="svelte-1qene57"&&(Ke.innerHTML=Ko),so=r(q),et=m(q,"P",{"data-svelte-h":!0}),u(et)!=="svelte-1p8c3o7"&&(et.innerHTML=en),ao=r(q),f(A.$$.fragment,q),q.forEach(n),Zt=r(e),f(ke.$$.fragment,e),Bt=r(e),J=m(e,"DIV",{class:!0});var F=k(J);f($e.$$.fragment,F),ro=r(F),tt=m(F,"P",{"data-svelte-h":!0}),u(tt)!=="svelte-l6uwr3"&&(tt.textContent=tn),io=r(F),ot=m(F,"P",{"data-svelte-h":!0}),u(ot)!=="svelte-kterak"&&(ot.innerHTML=on),co=r(F),O=m(F,"DIV",{class:!0});var He=k(O);f(Se.$$.fragment,He),lo=r(He),nt=m(He,"P",{"data-svelte-h":!0}),u(nt)!=="svelte-1papsjp"&&(nt.innerHTML=nn),He.forEach(n),mo=r(F),K=m(F,"DIV",{class:!0});var qe=k(K);f(Ce.$$.fragment,qe),po=r(qe),st=m(qe,"P",{"data-svelte-h":!0}),u(st)!=="svelte-1kgqa5f"&&(st.innerHTML=sn),qe.forEach(n),F.forEach(n),Vt=r(e),f(Je.$$.fragment,e),Gt=r(e),R=m(e,"DIV",{class:!0});var L=k(R);f(je.$$.fragment,L),uo=r(L),at=m(L,"P",{"data-svelte-h":!0}),u(at)!=="svelte-1401phk"&&(at.textContent=an),ho=r(L),ee=m(L,"DIV",{class:!0});var Xe=k(ee);f(ze.$$.fragment,Xe),fo=r(Xe),rt=m(Xe,"P",{"data-svelte-h":!0}),u(rt)!=="svelte-14ynafp"&&(rt.innerHTML=rn),Xe.forEach(n),L.forEach(n),Rt=r(e),f(Ue.$$.fragment,e),Nt=r(e),w=m(e,"DIV",{class:!0});var j=k(w);f(We.$$.fragment,j),go=r(j),it=m(j,"P",{"data-svelte-h":!0}),u(it)!=="svelte-125tzuu"&&(it.textContent=cn),_o=r(j),ct=m(j,"P",{"data-svelte-h":!0}),u(ct)!=="svelte-3qnk5t"&&(ct.innerHTML=dn),xo=r(j),dt=m(j,"P",{"data-svelte-h":!0}),u(dt)!=="svelte-mec8jz"&&(dt.innerHTML=ln),bo=r(j),lt=m(j,"P",{"data-svelte-h":!0}),u(lt)!=="svelte-hswkmf"&&(lt.innerHTML=mn),To=r(j),Z=m(j,"DIV",{class:!0});var ce=k(Z);f(Ie.$$.fragment,ce),yo=r(ce),mt=m(ce,"P",{"data-svelte-h":!0}),u(mt)!=="svelte-e3mvec"&&(mt.innerHTML=pn),vo=r(ce),f(te.$$.fragment,ce),Mo=r(ce),f(oe.$$.fragment,ce),ce.forEach(n),j.forEach(n),Ht=r(e),f(Fe.$$.fragment,e),qt=r(e),N=m(e,"DIV",{class:!0});var Tt=k(N);f(Ze.$$.fragment,Tt),wo=r(Tt),pt=m(Tt,"P",{"data-svelte-h":!0}),u(pt)!=="svelte-ghhg35"&&(pt.innerHTML=un),Po=r(Tt),B=m(Tt,"DIV",{class:!0});var de=k(B);f(Be.$$.fragment,de),ko=r(de),ut=m(de,"P",{"data-svelte-h":!0}),u(ut)!=="svelte-i42y10"&&(ut.innerHTML=hn),$o=r(de),f(ne.$$.fragment,de),So=r(de),f(se.$$.fragment,de),de.forEach(n),Tt.forEach(n),Xt=r(e),f(Ve.$$.fragment,e),Et=r(e),P=m(e,"DIV",{class:!0});var V=k(P);f(Ge.$$.fragment,V),Co=r(V),ht=m(V,"P",{"data-svelte-h":!0}),u(ht)!=="svelte-f5gy22"&&(ht.textContent=fn),Jo=r(V),ft=m(V,"P",{"data-svelte-h":!0}),u(ft)!=="svelte-3qnk5t"&&(ft.innerHTML=gn),jo=r(V),gt=m(V,"P",{"data-svelte-h":!0}),u(gt)!=="svelte-mec8jz"&&(gt.innerHTML=_n),zo=r(V),_t=m(V,"P",{"data-svelte-h":!0}),u(_t)!=="svelte-hswkmf"&&(_t.innerHTML=xn),Uo=r(V),S=m(V,"DIV",{class:!0});var G=k(S);f(Re.$$.fragment,G),Wo=r(G),xt=m(G,"P",{"data-svelte-h":!0}),u(xt)!=="svelte-gr0xom"&&(xt.innerHTML=bn),Io=r(G),f(ae.$$.fragment,G),Fo=r(G),bt=m(G,"P",{"data-svelte-h":!0}),u(bt)!=="svelte-11lpom8"&&(bt.textContent=Tn),Zo=r(G),f(re.$$.fragment,G),Bo=r(G),f(ie.$$.fragment,G),G.forEach(n),V.forEach(n),Lt=r(e),yt=m(e,"P",{}),k(yt).forEach(n),this.h()},h(){$(o,"name","hf:doc:metadata"),$(o,"content",Zn),$(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"),$(O,"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,s){i(document.head,o),d(e,v,s),d(e,p,s),d(e,c,s),g(T,e,s),d(e,t,s),g(y,e,s),d(e,vt,s),d(e,le,s),d(e,Mt,s),d(e,me,s),d(e,wt,s),d(e,pe,s),d(e,Pt,s),d(e,ue,s),d(e,kt,s),d(e,he,s),d(e,$t,s),d(e,fe,s),d(e,St,s),d(e,ge,s),d(e,Ct,s),g(_e,e,s),d(e,Jt,s),d(e,xe,s),d(e,jt,s),g(be,e,s),d(e,zt,s),d(e,C,s),g(Te,C,null),i(C,Qt),i(C,Ye),i(C,Dt),i(C,Qe),i(C,At),g(Y,C,null),i(C,Ot),i(C,Q),g(ye,Q,null),i(Q,Kt),i(Q,De),d(e,Ut,s),g(ve,e,s),d(e,Wt,s),d(e,U,s),g(Me,U,null),i(U,eo),i(U,Ae),i(U,to),i(U,Oe),i(U,oo),g(D,U,null),d(e,It,s),g(we,e,s),d(e,Ft,s),d(e,W,s),g(Pe,W,null),i(W,no),i(W,Ke),i(W,so),i(W,et),i(W,ao),g(A,W,null),d(e,Zt,s),g(ke,e,s),d(e,Bt,s),d(e,J,s),g($e,J,null),i(J,ro),i(J,tt),i(J,io),i(J,ot),i(J,co),i(J,O),g(Se,O,null),i(O,lo),i(O,nt),i(J,mo),i(J,K),g(Ce,K,null),i(K,po),i(K,st),d(e,Vt,s),g(Je,e,s),d(e,Gt,s),d(e,R,s),g(je,R,null),i(R,uo),i(R,at),i(R,ho),i(R,ee),g(ze,ee,null),i(ee,fo),i(ee,rt),d(e,Rt,s),g(Ue,e,s),d(e,Nt,s),d(e,w,s),g(We,w,null),i(w,go),i(w,it),i(w,_o),i(w,ct),i(w,xo),i(w,dt),i(w,bo),i(w,lt),i(w,To),i(w,Z),g(Ie,Z,null),i(Z,yo),i(Z,mt),i(Z,vo),g(te,Z,null),i(Z,Mo),g(oe,Z,null),d(e,Ht,s),g(Fe,e,s),d(e,qt,s),d(e,N,s),g(Ze,N,null),i(N,wo),i(N,pt),i(N,Po),i(N,B),g(Be,B,null),i(B,ko),i(B,ut),i(B,$o),g(ne,B,null),i(B,So),g(se,B,null),d(e,Xt,s),g(Ve,e,s),d(e,Et,s),d(e,P,s),g(Ge,P,null),i(P,Co),i(P,ht),i(P,Jo),i(P,ft),i(P,jo),i(P,gt),i(P,zo),i(P,_t),i(P,Uo),i(P,S),g(Re,S,null),i(S,Wo),i(S,xt),i(S,Io),g(ae,S,null),i(S,Fo),i(S,bt),i(S,Zo),g(re,S,null),i(S,Bo),g(ie,S,null),d(e,Lt,s),d(e,yt,s),Yt=!0},p(e,[s]){const I={};s&2&&(I.$$scope={dirty:s,ctx:e}),Y.$set(I);const Ne={};s&2&&(Ne.$$scope={dirty:s,ctx:e}),D.$set(Ne);const H={};s&2&&(H.$$scope={dirty:s,ctx:e}),A.$set(H);const q={};s&2&&(q.$$scope={dirty:s,ctx:e}),te.$set(q);const F={};s&2&&(F.$$scope={dirty:s,ctx:e}),oe.$set(F);const He={};s&2&&(He.$$scope={dirty:s,ctx:e}),ne.$set(He);const qe={};s&2&&(qe.$$scope={dirty:s,ctx:e}),se.$set(qe);const L={};s&2&&(L.$$scope={dirty:s,ctx:e}),ae.$set(L);const Xe={};s&2&&(Xe.$$scope={dirty:s,ctx:e}),re.$set(Xe);const j={};s&2&&(j.$$scope={dirty:s,ctx:e}),ie.$set(j)},i(e){Yt||(_(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),_(A.$$.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),Yt=!0)},o(e){x(T.$$.fragment,e),x(y.$$.fragment,e),x(_e.$$.fragment,e),x(be.$$.fragment,e),x(Te.$$.fragment,e),x(Y.$$.fragment,e),x(ye.$$.fragment,e),x(ve.$$.fragment,e),x(Me.$$.fragment,e),x(D.$$.fragment,e),x(we.$$.fragment,e),x(Pe.$$.fragment,e),x(A.$$.fragment,e),x(ke.$$.fragment,e),x($e.$$.fragment,e),x(Se.$$.fragment,e),x(Ce.$$.fragment,e),x(Je.$$.fragment,e),x(je.$$.fragment,e),x(ze.$$.fragment,e),x(Ue.$$.fragment,e),x(We.$$.fragment,e),x(Ie.$$.fragment,e),x(te.$$.fragment,e),x(oe.$$.fragment,e),x(Fe.$$.fragment,e),x(Ze.$$.fragment,e),x(Be.$$.fragment,e),x(ne.$$.fragment,e),x(se.$$.fragment,e),x(Ve.$$.fragment,e),x(Ge.$$.fragment,e),x(Re.$$.fragment,e),x(ae.$$.fragment,e),x(re.$$.fragment,e),x(ie.$$.fragment,e),Yt=!1},d(e){e&&(n(v),n(p),n(c),n(t),n(vt),n(le),n(Mt),n(me),n(wt),n(pe),n(Pt),n(ue),n(kt),n(he),n($t),n(fe),n(St),n(ge),n(Ct),n(Jt),n(xe),n(jt),n(zt),n(C),n(Ut),n(Wt),n(U),n(It),n(Ft),n(W),n(Zt),n(Bt),n(J),n(Vt),n(Gt),n(R),n(Rt),n(Nt),n(w),n(Ht),n(qt),n(N),n(Xt),n(Et),n(P),n(Lt),n(yt)),n(o),b(T,e),b(y,e),b(_e,e),b(be,e),b(Te),b(Y),b(ye),b(ve,e),b(Me),b(D),b(we,e),b(Pe),b(A),b(ke,e),b($e),b(Se),b(Ce),b(Je,e),b(je),b(ze),b(Ue,e),b(We),b(Ie),b(te),b(oe),b(Fe,e),b(Ze),b(Be),b(ne),b(se),b(Ve,e),b(Ge),b(Re),b(ae),b(re),b(ie)}}}const Zn='{"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 Bn(M){return vn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class En extends Mn{constructor(o){super(),wn(this,o,Bn,Fn,yn,{})}}export{En as component};
