import{s as Cn,o as Sn,n as X}from"../chunks/scheduler.25b97de1.js";import{S as Jn,i as jn,g as d,s as a,r as f,A as zn,h as c,f as n,c as r,j as k,u as g,x as u,k as $,y as i,a as l,v as _,d as x,t as b,w as T}from"../chunks/index.d9030fc9.js";import{T as Ro}from"../chunks/Tip.baa67368.js";import{D as z}from"../chunks/Docstring.e257edda.js";import{C as Le}from"../chunks/CodeBlock.e6cd0d95.js";import{E as Ee}from"../chunks/ExampleCodeBlock.20db4b6e.js";import{H as yt,E as Un}from"../chunks/EditOnGithub.91d95064.js";function Wn(M){let o,v="Example:",m,p,h;return p=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=d("p"),o.textContent=v,m=a(),f(p.$$.fragment)},l(t){o=c(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-11lpom8"&&(o.textContent=v),m=r(t),g(p.$$.fragment,t)},m(t,y){l(t,o,y),l(t,m,y),_(p,t,y),h=!0},p:X,i(t){h||(x(p.$$.fragment,t),h=!0)},o(t){b(p.$$.fragment,t),h=!1},d(t){t&&(n(o),n(m)),T(p,t)}}}function In(M){let o,v="Example:",m,p,h;return p=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=d("p"),o.textContent=v,m=a(),f(p.$$.fragment)},l(t){o=c(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-11lpom8"&&(o.textContent=v),m=r(t),g(p.$$.fragment,t)},m(t,y){l(t,o,y),l(t,m,y),_(p,t,y),h=!0},p:X,i(t){h||(x(p.$$.fragment,t),h=!0)},o(t){b(p.$$.fragment,t),h=!1},d(t){t&&(n(o),n(m)),T(p,t)}}}function Fn(M){let o,v="Example:",m,p,h;return p=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=d("p"),o.textContent=v,m=a(),f(p.$$.fragment)},l(t){o=c(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-11lpom8"&&(o.textContent=v),m=r(t),g(p.$$.fragment,t)},m(t,y){l(t,o,y),l(t,m,y),_(p,t,y),h=!0},p:X,i(t){h||(x(p.$$.fragment,t),h=!0)},o(t){b(p.$$.fragment,t),h=!1},d(t){t&&(n(o),n(m)),T(p,t)}}}function Zn(M){let o,v=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){o=d("p"),o.innerHTML=v},l(m){o=c(m,"P",{"data-svelte-h":!0}),u(o)!=="svelte-fincs2"&&(o.innerHTML=v)},m(m,p){l(m,o,p)},p:X,d(m){m&&n(o)}}}function Bn(M){let o,v="Example:",m,p,h;return p=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=d("p"),o.textContent=v,m=a(),f(p.$$.fragment)},l(t){o=c(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-11lpom8"&&(o.textContent=v),m=r(t),g(p.$$.fragment,t)},m(t,y){l(t,o,y),l(t,m,y),_(p,t,y),h=!0},p:X,i(t){h||(x(p.$$.fragment,t),h=!0)},o(t){b(p.$$.fragment,t),h=!1},d(t){t&&(n(o),n(m)),T(p,t)}}}function Vn(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=d("p"),o.innerHTML=v},l(m){o=c(m,"P",{"data-svelte-h":!0}),u(o)!=="svelte-fincs2"&&(o.innerHTML=v)},m(m,p){l(m,o,p)},p:X,d(m){m&&n(o)}}}function Gn(M){let o,v="Example:",m,p,h;return p=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=d("p"),o.textContent=v,m=a(),f(p.$$.fragment)},l(t){o=c(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-11lpom8"&&(o.textContent=v),m=r(t),g(p.$$.fragment,t)},m(t,y){l(t,o,y),l(t,m,y),_(p,t,y),h=!0},p:X,i(t){h||(x(p.$$.fragment,t),h=!0)},o(t){b(p.$$.fragment,t),h=!1},d(t){t&&(n(o),n(m)),T(p,t)}}}function Rn(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=d("p"),o.innerHTML=v},l(m){o=c(m,"P",{"data-svelte-h":!0}),u(o)!=="svelte-fincs2"&&(o.innerHTML=v)},m(m,p){l(m,o,p)},p:X,d(m){m&&n(o)}}}function Nn(M){let o,v="Inference:",m,p,h;return p=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=d("p"),o.textContent=v,m=a(),f(p.$$.fragment)},l(t){o=c(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-1i9b1jx"&&(o.textContent=v),m=r(t),g(p.$$.fragment,t)},m(t,y){l(t,o,y),l(t,m,y),_(p,t,y),h=!0},p:X,i(t){h||(x(p.$$.fragment,t),h=!0)},o(t){b(p.$$.fragment,t),h=!1},d(t){t&&(n(o),n(m)),T(p,t)}}}function Hn(M){let o,v="Training:",m,p,h;return p=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=d("p"),o.textContent=v,m=a(),f(p.$$.fragment)},l(t){o=c(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-1igpel8"&&(o.textContent=v),m=r(t),g(p.$$.fragment,t)},m(t,y){l(t,o,y),l(t,m,y),_(p,t,y),h=!0},p:X,i(t){h||(x(p.$$.fragment,t),h=!0)},o(t){b(p.$$.fragment,t),h=!1},d(t){t&&(n(o),n(m)),T(p,t)}}}function qn(M){let o,v,m,p,h,t,y,Mt,de,No='The Pix2Struct model was proposed in <a href="https://arxiv.org/abs/2210.03347" rel="nofollow">Pix2Struct: Screenshot Parsing as Pretraining for Visual Language Understanding</a> by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu, Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, Kristina Toutanova.',wt,ce,Ho="The abstract from the paper is the following:",Pt,pe,qo="<p>Visually-situated language is ubiquitous — sources range from textbooks with diagrams to web pages with images and tables, to mobile apps with buttons and forms. Perhaps due to this diversity, previous work has typically relied on domain-specific recipes with limited sharing of the underlying data, model architectures, and objectives. We present Pix2Struct, a pretrained image-to-text model for purely visual language understanding, which can be finetuned on tasks containing visually-situated language. Pix2Struct is pretrained by learning to parse masked screenshots of web pages into simplified HTML. The web, with its richness of visual elements cleanly reflected in the HTML structure, provides a large source of pretraining data well suited to the diversity of downstream tasks. Intuitively, this objective subsumes common pretraining signals such as OCR, language modeling, image captioning. In addition to the novel pretraining strategy, we introduce a variable-resolution input representation and a more flexible integration of language and vision inputs, where language prompts such as questions are rendered directly on top of the input image. For the first time, we show that a single pretrained model can achieve state-of-the-art results in six out of nine tasks across four domains: documents, illustrations, user interfaces, and natural images.</p>",kt,me,Xo="Tips:",$t,ue,Eo=`Pix2Struct has been fine tuned on a variety of tasks and datasets, ranging from image captioning, visual question answering (VQA) over different inputs (books, charts, science diagrams), captioning UI components etc. The full list can be found in Table 1 of the paper.
We therefore advise you to use these models for the tasks they have been fine tuned on. For instance, if you want to use Pix2Struct for UI captioning, you should use the model fine tuned on the UI dataset. If you want to use Pix2Struct for image captioning, you should use the model fine tuned on the natural images captioning dataset and so on.`,Ct,he,Lo="If you want to use the model to perform conditional text captioning, make sure to use the processor with <code>add_special_tokens=False</code>.",St,fe,Yo=`This model was contributed by <a href="https://huggingface.co/ybelkada" rel="nofollow">ybelkada</a>.
The original code can be found <a href="https://github.com/google-research/pix2struct" rel="nofollow">here</a>.`,Jt,ge,jt,_e,Qo='<li><a href="https://github.com/huggingface/notebooks/blob/main/examples/image_captioning_pix2struct.ipynb" rel="nofollow">Fine-tuning Notebook</a></li> <li><a href="https://huggingface.co/models?search=pix2struct" rel="nofollow">All models</a></li>',zt,xe,Ut,S,be,Ot,Ye,Do=`<a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a> is the configuration class to store the configuration of a
<a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructForConditionalGeneration">Pix2StructForConditionalGeneration</a>. It is used to instantiate a Pix2Struct model according to the specified
arguments, defining the text model and vision model configs. Instantiating a configuration with the defaults will
yield a similar configuration to that of the Pix2Struct-base
<a href="https://huggingface.co/google/pix2struct-base" rel="nofollow">google/pix2struct-base</a> architecture.`,At,Qe,Oo=`Configuration objects inherit from <a href="/docs/transformers/pr_31208/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_31208/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Kt,L,eo,Y,Te,to,De,Ao=`Instantiate a <a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a> (or a derived class) from pix2struct text model configuration and pix2struct
vision model configuration.`,Wt,ye,It,U,ve,oo,Oe,Ko=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructTextModel">Pix2StructTextModel</a>. It is used to instantiate
a Pix2Struct text model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the Pix2Struct text decoder used by
the <a href="https://huggingface.co/google/pix2struct-base" rel="nofollow">google/pix2struct-base</a> architecture.`,no,Ae,en=`Configuration objects inherit from <a href="/docs/transformers/pr_31208/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_31208/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,so,Q,Ft,Me,Zt,W,we,ao,Ke,tn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructVisionModel">Pix2StructVisionModel</a>. It is used to
instantiate a Pix2Struct vision model according to the specified arguments, defining the model architecture.
Instantiating a configuration defaults will yield a similar configuration to that of the Pix2Struct-base
<a href="https://huggingface.co/google/pix2struct-base" rel="nofollow">google/pix2struct-base</a> architecture.`,ro,et,on=`Configuration objects inherit from <a href="/docs/transformers/pr_31208/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_31208/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,io,D,Bt,Pe,nn="## Pix2StructProcessor[[transformers.Pix2StructProcessor]]",Vt,J,ke,lo,tt,sn=`Constructs a PIX2STRUCT processor which wraps a BERT tokenizer and PIX2STRUCT image processor into a single
processor.`,co,ot,an=`<a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructProcessor">Pix2StructProcessor</a> offers all the functionalities of <a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructImageProcessor">Pix2StructImageProcessor</a> and <a href="/docs/transformers/pr_31208/en/model_doc/t5#transformers.T5TokenizerFast">T5TokenizerFast</a>. See
the docstring of <code>__call__()</code> and <a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructProcessor.decode">decode()</a> for more information.`,po,O,$e,mo,nt,rn=`This method forwards all its arguments to Pix2StructTokenizerFast’s <a href="/docs/transformers/pr_31208/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode">batch_decode()</a>.
Please refer to the docstring of this method for more information.`,uo,A,Ce,ho,st,ln=`This method forwards all its arguments to Pix2StructTokenizerFast’s <a href="/docs/transformers/pr_31208/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode">decode()</a>. Please
refer to the docstring of this method for more information.`,Gt,Se,dn="## Pix2StructImageProcessor[[transformers.Pix2StructImageProcessor]]",Rt,R,Je,fo,at,cn="Constructs a Pix2Struct image processor.",go,K,je,_o,rt,pn=`Preprocess an image or batch of images. The processor first computes the maximum possible number of
aspect-ratio preserving patches of size <code>patch_size</code> that can be extracted from the image. It then pads the
image with zeros to make the image respect the constraint of <code>max_patches</code>. Before extracting the patches the
images are standardized following the tensorflow implementation of <code>per_image_standardization</code>
(<a href="https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization" rel="nofollow">https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization</a>).`,Nt,ze,mn="## Pix2StructTextModel[[transformers.Pix2StructTextModel]]",Ht,w,Ue,xo,it,un="The standalone text decoder of Pix2Struct",bo,lt,hn=`The Pix2Struct model was proposed in <a href="https://arxiv.org/abs/2210.03347" rel="nofollow">Pix2Struct: Screenshot Parsing as Pretraining for Visual Language
Understanding</a> by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu,
Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, Kristina Toutanova. It’s an encoder decoder
transformer pre-trained in a image-to-text setting.`,To,dt,fn=`This model inherits from <a href="/docs/transformers/pr_31208/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,yo,ct,gn=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,vo,Z,We,Mo,pt,_n='The <a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructTextModel">Pix2StructTextModel</a> forward method, overrides the <code>__call__</code> special method.',wo,ee,Po,te,qt,Ie,xn="## Pix2StructVisionModel[[transformers.Pix2StructVisionModel]]",Xt,N,Fe,ko,mt,bn=`The bare Pix2StructVision Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,$o,B,Ze,Co,ut,Tn='The <a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructVisionModel">Pix2StructVisionModel</a> forward method, overrides the <code>__call__</code> special method.',So,oe,Jo,ne,Et,Be,yn="## Pix2StructForConditionalGeneration[[transformers.Pix2StructForConditionalGeneration]]",Lt,P,Ve,jo,ht,vn="A conditional generation model with a language modeling head. Can be used for sequence generation tasks.",zo,ft,Mn=`The Pix2Struct model was proposed in <a href="https://arxiv.org/abs/2210.03347" rel="nofollow">Pix2Struct: Screenshot Parsing as Pretraining for Visual Language
Understanding</a> by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu,
Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, Kristina Toutanova. It’s an encoder decoder
transformer pre-trained in a image-to-text setting.`,Uo,gt,wn=`This model inherits from <a href="/docs/transformers/pr_31208/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Wo,_t,Pn=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Io,C,Ge,Fo,xt,kn='The <a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructForConditionalGeneration">Pix2StructForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',Zo,se,Bo,bt,$n="Example:",Vo,ae,Go,re,Yt,Re,Qt,vt,Dt;return h=new yt({props:{title:"Pix2Struct",local:"pix2struct",headingTag:"h1"}}),y=new yt({props:{title:"Overview",local:"overview",headingTag:"h2"}}),ge=new yt({props:{title:"Resources",local:"resources",headingTag:"h2"}}),xe=new yt({props:{title:"Pix2StructConfig",local:"transformers.Pix2StructConfig",headingTag:"h2"}}),be=new z({props:{name:"class transformers.Pix2StructConfig",anchor:"transformers.Pix2StructConfig",parameters:[{name:"text_config",val:" = None"},{name:"vision_config",val:" = None"},{name:"initializer_factor",val:" = 1.0"},{name:"initializer_range",val:" = 0.02"},{name:"is_vqa",val:" = False"},{name:"tie_word_embeddings",val:" = False"},{name:"is_encoder_decoder",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructConfig.text_config",description:`<strong>text_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructTextConfig">Pix2StructTextConfig</a>.`,name:"text_config"},{anchor:"transformers.Pix2StructConfig.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructVisionConfig">Pix2StructVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.Pix2StructConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Factor to multiply the initialization range with.`,name:"initializer_factor"},{anchor:"transformers.Pix2StructConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Pix2StructConfig.is_vqa",description:`<strong>is_vqa</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the model has been fine-tuned for VQA or not.`,name:"is_vqa"},{anchor:"transformers.Pix2StructConfig.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/configuration_pix2struct.py#L286"}}),L=new Ee({props:{anchor:"transformers.Pix2StructConfig.example",$$slots:{default:[Wn]},$$scope:{ctx:M}}}),Te=new z({props:{name:"from_text_vision_configs",anchor:"transformers.Pix2StructConfig.from_text_vision_configs",parameters:[{name:"text_config",val:": Pix2StructTextConfig"},{name:"vision_config",val:": Pix2StructVisionConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/configuration_pix2struct.py#L372",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


<p><a
  href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</a></p>
`}}),ye=new yt({props:{title:"Pix2StructTextConfig",local:"transformers.Pix2StructTextConfig",headingTag:"h2"}}),ve=new z({props:{name:"class transformers.Pix2StructTextConfig",anchor:"transformers.Pix2StructTextConfig",parameters:[{name:"vocab_size",val:" = 50244"},{name:"hidden_size",val:" = 768"},{name:"d_kv",val:" = 64"},{name:"d_ff",val:" = 2048"},{name:"num_layers",val:" = 12"},{name:"num_heads",val:" = 12"},{name:"relative_attention_num_buckets",val:" = 32"},{name:"relative_attention_max_distance",val:" = 128"},{name:"dropout_rate",val:" = 0.1"},{name:"layer_norm_epsilon",val:" = 1e-06"},{name:"initializer_factor",val:" = 1.0"},{name:"dense_act_fn",val:" = 'gelu_new'"},{name:"decoder_start_token_id",val:" = 0"},{name:"use_cache",val:" = False"},{name:"pad_token_id",val:" = 0"},{name:"eos_token_id",val:" = 1"},{name:"tie_word_embeddings",val:" = False"},{name:"is_decoder",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructTextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50244) &#x2014;
Vocabulary size of the <code>Pix2Struct</code> text model. Defines the number of different tokens that can be
represented by the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructTextModel">Pix2StructTextModel</a>.`,name:"vocab_size"},{anchor:"transformers.Pix2StructTextConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.Pix2StructTextConfig.d_kv",description:`<strong>d_kv</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Dimensionality of the key, query, value projections in each attention head.`,name:"d_kv"},{anchor:"transformers.Pix2StructTextConfig.d_ff",description:`<strong>d_ff</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"d_ff"},{anchor:"transformers.Pix2StructTextConfig.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_layers"},{anchor:"transformers.Pix2StructTextConfig.num_heads",description:`<strong>num_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_heads"},{anchor:"transformers.Pix2StructTextConfig.relative_attention_num_buckets",description:`<strong>relative_attention_num_buckets</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The number of buckets to use for each attention layer.`,name:"relative_attention_num_buckets"},{anchor:"transformers.Pix2StructTextConfig.relative_attention_max_distance",description:`<strong>relative_attention_max_distance</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The maximum distance of the longer sequences for the bucket separation.`,name:"relative_attention_max_distance"},{anchor:"transformers.Pix2StructTextConfig.dropout_rate",description:`<strong>dropout_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout_rate"},{anchor:"transformers.Pix2StructTextConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_epsilon"},{anchor:"transformers.Pix2StructTextConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.Pix2StructTextConfig.dense_act_fn",description:`<strong>dense_act_fn</strong> (<code>Union[Callable, str]</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
The non-linear activation function (function or string).`,name:"dense_act_fn"},{anchor:"transformers.Pix2StructTextConfig.decoder_start_token_id",description:`<strong>decoder_start_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the <code>decoder_start_token_id</code> token.`,name:"decoder_start_token_id"},{anchor:"transformers.Pix2StructTextConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"},{anchor:"transformers.Pix2StructTextConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the <code>padding</code> token.`,name:"pad_token_id"},{anchor:"transformers.Pix2StructTextConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The id of the <code>end-of-sequence</code> token.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/configuration_pix2struct.py#L27"}}),Q=new Ee({props:{anchor:"transformers.Pix2StructTextConfig.example",$$slots:{default:[In]},$$scope:{ctx:M}}}),Me=new yt({props:{title:"Pix2StructVisionConfig",local:"transformers.Pix2StructVisionConfig",headingTag:"h2"}}),we=new z({props:{name:"class transformers.Pix2StructVisionConfig",anchor:"transformers.Pix2StructVisionConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"patch_embed_hidden_size",val:" = 768"},{name:"d_ff",val:" = 2048"},{name:"d_kv",val:" = 64"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"dense_act_fn",val:" = 'gelu_new'"},{name:"layer_norm_eps",val:" = 1e-06"},{name:"dropout_rate",val:" = 0.0"},{name:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 1e-10"},{name:"initializer_factor",val:" = 1.0"},{name:"seq_len",val:" = 4096"},{name:"relative_attention_num_buckets",val:" = 32"},{name:"relative_attention_max_distance",val:" = 128"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructVisionConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.Pix2StructVisionConfig.patch_embed_hidden_size",description:`<strong>patch_embed_hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the input patch_embedding layer in the Transformer encoder.`,name:"patch_embed_hidden_size"},{anchor:"transformers.Pix2StructVisionConfig.d_ff",description:`<strong>d_ff</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"d_ff"},{anchor:"transformers.Pix2StructVisionConfig.d_kv",description:`<strong>d_kv</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Dimensionality of the key, query, value projections per attention head.`,name:"d_kv"},{anchor:"transformers.Pix2StructVisionConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.Pix2StructVisionConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.Pix2StructVisionConfig.dense_act_fn",description:`<strong>dense_act_fn</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> \`<code>&quot;gelu&quot;</code> are supported.`,name:"dense_act_fn"},{anchor:"transformers.Pix2StructVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-06) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.Pix2StructVisionConfig.dropout_rate",description:`<strong>dropout_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout_rate"},{anchor:"transformers.Pix2StructVisionConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Pix2StructVisionConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-10) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Pix2StructVisionConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.Pix2StructVisionConfig.seq_len",description:`<strong>seq_len</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Maximum sequence length (here number of patches) supported by the model.`,name:"seq_len"},{anchor:"transformers.Pix2StructVisionConfig.relative_attention_num_buckets",description:`<strong>relative_attention_num_buckets</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The number of buckets to use for each attention layer.`,name:"relative_attention_num_buckets"},{anchor:"transformers.Pix2StructVisionConfig.relative_attention_max_distance",description:`<strong>relative_attention_max_distance</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The maximum distance (in tokens) to use for each attention layer.`,name:"relative_attention_max_distance"}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/configuration_pix2struct.py#L167"}}),D=new Ee({props:{anchor:"transformers.Pix2StructVisionConfig.example",$$slots:{default:[Fn]},$$scope:{ctx:M}}}),ke=new z({props:{name:"class transformers.Pix2StructProcessor",anchor:"transformers.Pix2StructProcessor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructProcessor.image_processor",description:`<strong>image_processor</strong> (<code>Pix2StructImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructImageProcessor">Pix2StructImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.Pix2StructProcessor.tokenizer",description:"<strong>tokenizer</strong> (Union[<code>T5TokenizerFast</code>, <code>T5Tokenizer</code>]) &#x2014;\nAn instance of [&#x2018;T5TokenizerFast`] or [&#x2018;T5Tokenizer`]. The tokenizer is a required input.",name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/processing_pix2struct.py#L26"}}),$e=new z({props:{name:"batch_decode",anchor:"transformers.Pix2StructProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/processing_pix2struct.py#L145"}}),Ce=new z({props:{name:"decode",anchor:"transformers.Pix2StructProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/processing_pix2struct.py#L152"}}),Je=new z({props:{name:"class transformers.Pix2StructImageProcessor",anchor:"transformers.Pix2StructImageProcessor",parameters:[{name:"do_convert_rgb",val:": bool = True"},{name:"do_normalize",val:": bool = True"},{name:"patch_size",val:": Dict = None"},{name:"max_patches",val:": int = 2048"},{name:"is_vqa",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.Pix2StructImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method. According to Pix2Struct paper and code, the image is normalized with its own mean and standard
deviation.`,name:"do_normalize"},{anchor:"transformers.Pix2StructImageProcessor.patch_size",description:`<strong>patch_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 16, &quot;width&quot;: 16}</code>):
The patch size to use for the image. According to Pix2Struct paper and code, the patch size is 16x16.`,name:"patch_size"},{anchor:"transformers.Pix2StructImageProcessor.max_patches",description:`<strong>max_patches</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The maximum number of patches to extract from the image as per the <a href="https://arxiv.org/pdf/2210.03347.pdf" rel="nofollow">Pix2Struct
paper</a>.`,name:"max_patches"},{anchor:"transformers.Pix2StructImageProcessor.is_vqa",description:`<strong>is_vqa</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the image processor is for the VQA task. If <code>True</code> and <code>header_text</code> is passed in, text is
rendered onto the input images.`,name:"is_vqa"}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/image_processing_pix2struct.py#L189"}}),je=new z({props:{name:"preprocess",anchor:"transformers.Pix2StructImageProcessor.preprocess",parameters:[{name:"images",val:": Union"},{name:"header_text",val:": Optional = None"},{name:"do_convert_rgb",val:": bool = None"},{name:"do_normalize",val:": Optional = None"},{name:"max_patches",val:": Optional = None"},{name:"patch_size",val:": Optional = None"},{name:"return_tensors",val:": Union = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": Union = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images.`,name:"images"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.header_text",description:`<strong>header_text</strong> (<code>Union[List[str], str]</code>, <em>optional</em>) &#x2014;
Text to render as a header. Only has an effect if <code>image_processor.is_vqa</code> is <code>True</code>.`,name:"header_text"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.max_patches",description:`<strong>max_patches</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.max_patches</code>) &#x2014;
Maximum number of patches to extract.`,name:"max_patches"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.patch_size",description:`<strong>patch_size</strong> (<code>dict</code>, <em>optional</em>, defaults to <code>self.patch_size</code>) &#x2014;
Dictionary containing the patch height and width.`,name:"patch_size"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: Use the channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/image_processing_pix2struct.py#L348"}}),Ue=new z({props:{name:"class transformers.Pix2StructTextModel",anchor:"transformers.Pix2StructTextModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructTextModel.config",description:`<strong>config</strong> (Union[<code>Pix2StructConfig</code>, <code>Pix2StructTextConfig</code>]) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/pr_31208/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/modeling_pix2struct.py#L1280"}}),We=new z({props:{name:"forward",anchor:"transformers.Pix2StructTextModel.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"encoder_hidden_states",val:": Optional = None"},{name:"encoder_attention_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"cross_attn_head_mask",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"return_dict",val:": Optional = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructTextModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Pix2StructText is a model with relative position
embeddings so you should be able to pad the inputs on both the right and the left.</p>
<p>Indices can be obtained using <a href="/docs/transformers/pr_31208/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_31208/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_31208/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for detail.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
<p>To know more on how to prepare <code>input_ids</code> for pretraining take a look a <a href="./t5#training">Pix2StructText
Training</a>.`,name:"input_ids"},{anchor:"transformers.Pix2StructTextModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.Pix2StructTextModel.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/pr_31208/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_31208/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_31208/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>Pix2StructText uses the <code>pad_token_id</code> as the starting token for <code>decoder_input_ids</code> generation. If
<code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>To know more on how to prepare <code>decoder_input_ids</code> for pretraining take a look at <a href="./t5#training">Pix2StructText
Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.Pix2StructTextModel.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.Pix2StructTextModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Pix2StructTextModel.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.Pix2StructTextModel.forward.cross_attn_head_mask",description:`<strong>cross_attn_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the cross-attention modules in the decoder. Mask values selected in
<code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"cross_attn_head_mask"},{anchor:"transformers.Pix2StructTextModel.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <code>optional</code>: <em>hidden_states</em>, <code>optional</code>: <em>attentions</em>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code> is a sequence of hidden states at
the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.Pix2StructTextModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention layers. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Pix2StructTextModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.Pix2StructTextModel.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. If <code>past_key_values</code> is used, optionally only the last <code>decoder_inputs_embeds</code> have to be
input (see <code>past_key_values</code>). This is useful if you want more control over how to convert
<code>decoder_input_ids</code> indices into associated vectors than the model&#x2019;s internal embedding lookup matrix.</p>
<p>If <code>decoder_input_ids</code> and <code>decoder_inputs_embeds</code> are both unset, <code>decoder_inputs_embeds</code> takes the value
of <code>inputs_embeds</code>.`,name:"decoder_inputs_embeds"},{anchor:"transformers.Pix2StructTextModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.Pix2StructTextModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Pix2StructTextModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Pix2StructTextModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_31208/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/modeling_pix2struct.py#L1349",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_31208/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Cross attentions weights after the attention softmax, used to compute the weighted average in the
cross-attention heads.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>torch.FloatTensor</code> tuples of length <code>config.n_layers</code>, with each tuple containing the cached key,
value states of the self-attention and the cross-attention layers if model is used in encoder-decoder
setting. Only relevant if <code>config.is_decoder = True</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_31208/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ee=new Ro({props:{$$slots:{default:[Zn]},$$scope:{ctx:M}}}),te=new Ee({props:{anchor:"transformers.Pix2StructTextModel.forward.example",$$slots:{default:[Bn]},$$scope:{ctx:M}}}),Fe=new z({props:{name:"class transformers.Pix2StructVisionModel",anchor:"transformers.Pix2StructVisionModel",parameters:[{name:"config",val:": Pix2StructConfig"}],parametersDescription:[{anchor:"transformers.Pix2StructVisionModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_31208/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/modeling_pix2struct.py#L515"}}),Ze=new z({props:{name:"forward",anchor:"transformers.Pix2StructVisionModel.forward",parameters:[{name:"flattened_patches",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.Pix2StructVisionModel.forward.flattened_patches",description:`<strong>flattened_patches</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, num_channels x patch_height x patch_width)</code>) &#x2014;
Flattened and padded pixel values. These values can be obtained using <a href="/docs/transformers/pr_31208/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>Pix2StructVisionImageProcessor.__call__</code> for details. Check the <a href="https://arxiv.org/abs/2210.03347" rel="nofollow">original
paper</a> (figure 5) for more details.`,name:"flattened_patches"},{anchor:"transformers.Pix2StructVisionModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:`,name:"attention_mask"},{anchor:"transformers.Pix2StructVisionModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Pix2StructVisionModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Pix2StructVisionModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Pix2StructVisionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_31208/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/modeling_pix2struct.py#L548",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_31208/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_31208/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_31208/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),oe=new Ro({props:{$$slots:{default:[Vn]},$$scope:{ctx:M}}}),ne=new Ee({props:{anchor:"transformers.Pix2StructVisionModel.forward.example",$$slots:{default:[Gn]},$$scope:{ctx:M}}}),Ve=new z({props:{name:"class transformers.Pix2StructForConditionalGeneration",anchor:"transformers.Pix2StructForConditionalGeneration",parameters:[{name:"config",val:": Pix2StructConfig"}],parametersDescription:[{anchor:"transformers.Pix2StructForConditionalGeneration.config",description:`<strong>config</strong> (Union[<code>Pix2StructConfig</code>, <code>Pix2StructTextConfig</code>]) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/pr_31208/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/modeling_pix2struct.py#L1552"}}),Ge=new z({props:{name:"forward",anchor:"transformers.Pix2StructForConditionalGeneration.forward",parameters:[{name:"flattened_patches",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"decoder_input_ids",val:": Optional = None"},{name:"decoder_attention_mask",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"decoder_head_mask",val:": Optional = None"},{name:"cross_attn_head_mask",val:": Optional = None"},{name:"encoder_outputs",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"decoder_inputs_embeds",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.Pix2StructForConditionalGeneration.forward.flattened_patches",description:`<strong>flattened_patches</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_length, hidden_size)</code>) &#x2014;
Flattened pixel patches. the <code>hidden_size</code> is obtained by the following formula: <code>hidden_size</code> =
<code>num_channels</code> <em> <code>patch_size</code> </em> <code>patch_size</code></p>
<p>The process of flattening the pixel patches is done by <code>Pix2StructProcessor</code>.`,name:"flattened_patches"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/pr_31208/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_31208/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_31208/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>Pix2StructText uses the <code>pad_token_id</code> as the starting token for <code>decoder_input_ids</code> generation. If
<code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>To know more on how to prepare <code>decoder_input_ids</code> for pretraining take a look at <a href="./t5#training">Pix2StructText
Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.cross_attn_head_mask",description:`<strong>cross_attn_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the cross-attention modules in the decoder. Mask values selected in
<code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"cross_attn_head_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <code>optional</code>: <em>hidden_states</em>, <code>optional</code>: <em>attentions</em>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code> is a sequence of hidden states at
the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention layers. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. If <code>past_key_values</code> is used, optionally only the last <code>decoder_inputs_embeds</code> have to be
input (see <code>past_key_values</code>). This is useful if you want more control over how to convert
<code>decoder_input_ids</code> indices into associated vectors than the model&#x2019;s internal embedding lookup matrix.</p>
<p>If <code>decoder_input_ids</code> and <code>decoder_inputs_embeds</code> are both unset, <code>decoder_inputs_embeds</code> takes the value
of <code>inputs_embeds</code>.`,name:"decoder_inputs_embeds"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss for the decoder.`,name:"labels"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_31208/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_31208/src/transformers/models/pix2struct/modeling_pix2struct.py#L1598",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


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