import{s as Mo,o as wo,n as E}from"../chunks/scheduler.25b97de1.js";import{S as Po,i as ko,g as d,s as a,r as u,A as $o,h as m,f as s,c as r,j as k,u as h,x as b,k as $,y as i,a as c,v as g,d as f,t as _,w as x}from"../chunks/index.d9030fc9.js";import{T as Gn}from"../chunks/Tip.baa67368.js";import{D as z}from"../chunks/Docstring.ffac8efa.js";import{C as Ye}from"../chunks/CodeBlock.e6cd0d95.js";import{E as Le}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as X,E as So}from"../chunks/EditOnGithub.91d95064.js";function Co(M){let n,v="Example:",p,l,y;return l=new Ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBpeDJTdHJ1Y3RDb25maWclMkMlMjBQaXgyU3RydWN0Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFBpeDJTdHJ1Y3RDb25maWclMjB3aXRoJTIwZ29vZ2xlJTJGcGl4MnN0cnVjdC1iYXNlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMFBpeDJTdHJ1Y3RDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBQaXgyU3RydWN0Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBnb29nbGUlMkZwaXgyc3RydWN0LWJhc2UlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMFBpeDJTdHJ1Y3RGb3JDb25kaXRpb25hbEdlbmVyYXRpb24oY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmlnJTBBJTBBJTIzJTIwV2UlMjBjYW4lMjBhbHNvJTIwaW5pdGlhbGl6ZSUyMGElMjBQaXgyU3RydWN0Q29uZmlnJTIwZnJvbSUyMGElMjBQaXgyU3RydWN0VGV4dENvbmZpZyUyMGFuZCUyMGElMjBQaXgyU3RydWN0VmlzaW9uQ29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFBpeDJTdHJ1Y3QlMjB0ZXh0JTIwYW5kJTIwUGl4MlN0cnVjdCUyMHZpc2lvbiUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWdfdGV4dCUyMCUzRCUyMFBpeDJTdHJ1Y3RUZXh0Q29uZmlnKCklMEFjb25maWdfdmlzaW9uJTIwJTNEJTIwUGl4MlN0cnVjdFZpc2lvbkNvbmZpZygpJTBBJTBBY29uZmlnJTIwJTNEJTIwUGl4MlN0cnVjdENvbmZpZy5mcm9tX3RleHRfdmlzaW9uX2NvbmZpZ3MoY29uZmlnX3RleHQlMkMlMjBjb25maWdfdmlzaW9uKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Pix2StructConfig, Pix2StructForConditionalGeneration

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

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

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

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

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

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

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){n=d("p"),n.textContent=v,p=a(),u(l.$$.fragment)},l(t){n=m(t,"P",{"data-svelte-h":!0}),b(n)!=="svelte-11lpom8"&&(n.textContent=v),p=r(t),h(l.$$.fragment,t)},m(t,T){c(t,n,T),c(t,p,T),g(l,t,T),y=!0},p:E,i(t){y||(f(l.$$.fragment,t),y=!0)},o(t){_(l.$$.fragment,t),y=!1},d(t){t&&(s(n),s(p)),x(l,t)}}}function zo(M){let n,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(){n=d("p"),n.innerHTML=v},l(p){n=m(p,"P",{"data-svelte-h":!0}),b(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(p,l){c(p,n,l)},p:E,d(p){p&&s(n)}}}function Uo(M){let n,v="Example:",p,l,y;return l=new Ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBQaXgyU3RydWN0VGV4dE1vZGVsJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGcGl4MnN0cnVjdC10ZXh0Y2Fwcy1iYXNlJTIyKSUwQW1vZGVsJTIwJTNEJTIwUGl4MlN0cnVjdFRleHRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGcGl4MnN0cnVjdC10ZXh0Y2Fwcy1iYXNlJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3M=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Pix2StructTextModel

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss`,wrap:!1}}),{c(){n=d("p"),n.textContent=v,p=a(),u(l.$$.fragment)},l(t){n=m(t,"P",{"data-svelte-h":!0}),b(n)!=="svelte-11lpom8"&&(n.textContent=v),p=r(t),h(l.$$.fragment,t)},m(t,T){c(t,n,T),c(t,p,T),g(l,t,T),y=!0},p:E,i(t){y||(f(l.$$.fragment,t),y=!0)},o(t){_(l.$$.fragment,t),y=!1},d(t){t&&(s(n),s(p)),x(l,t)}}}function Io(M){let n,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(){n=d("p"),n.innerHTML=v},l(p){n=m(p,"P",{"data-svelte-h":!0}),b(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(p,l){c(p,n,l)},p:E,d(p){p&&s(n)}}}function Wo(M){let n,v="Example:",p,l,y;return l=new Ye({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFBpeDJTdHJ1Y3RWaXNpb25Nb2RlbCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnBpeDJzdHJ1Y3QtdGV4dGNhcHMtYmFzZSUyMiklMEFtb2RlbCUyMCUzRCUyMFBpeDJTdHJ1Y3RWaXNpb25Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGcGl4MnN0cnVjdC10ZXh0Y2Fwcy1iYXNlJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGd3d3LmlsYW5rZWxtYW4ub3JnJTJGc3RvcHNpZ25zJTJGYXVzdHJhbGlhLmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBbGlzdChsYXN0X2hpZGRlbl9zdGF0ZXMuc2hhcGUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Pix2StructVisionModel

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">2048</span>, <span class="hljs-number">768</span>]`,wrap:!1}}),{c(){n=d("p"),n.textContent=v,p=a(),u(l.$$.fragment)},l(t){n=m(t,"P",{"data-svelte-h":!0}),b(n)!=="svelte-11lpom8"&&(n.textContent=v),p=r(t),h(l.$$.fragment,t)},m(t,T){c(t,n,T),c(t,p,T),g(l,t,T),y=!0},p:E,i(t){y||(f(l.$$.fragment,t),y=!0)},o(t){_(l.$$.fragment,t),y=!1},d(t){t&&(s(n),s(p)),x(l,t)}}}function Fo(M){let n,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(){n=d("p"),n.innerHTML=v},l(p){n=m(p,"P",{"data-svelte-h":!0}),b(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(p,l){c(p,n,l)},p:E,d(p){p&&s(n)}}}function Zo(M){let n,v="Inference:",p,l,y;return l=new Ye({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFBpeDJTdHJ1Y3RGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZwaXgyc3RydWN0LXRleHRjYXBzLWJhc2UlMjIpJTBBbW9kZWwlMjAlM0QlMjBQaXgyU3RydWN0Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZwaXgyc3RydWN0LXRleHRjYXBzLWJhc2UlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZ3d3cuaWxhbmtlbG1hbi5vcmclMkZzdG9wc2lnbnMlMkZhdXN0cmFsaWEuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEElMjMlMjBhdXRvcmVncmVzc2l2ZSUyMGdlbmVyYXRpb24lMEFnZW5lcmF0ZWRfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDUwKSUwQWdlbmVyYXRlZF90ZXh0JTIwJTNEJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RCUwQXByaW50KGdlbmVyYXRlZF90ZXh0KSUwQSUwQSUyMyUyMGNvbmRpdGlvbmFsJTIwZ2VuZXJhdGlvbiUwQXRleHQlMjAlM0QlMjAlMjJBJTIwcGljdHVyZSUyMG9mJTIyJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKHRleHQlM0R0ZXh0JTJDJTIwaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTJDJTIwYWRkX3NwZWNpYWxfdG9rZW5zJTNERmFsc2UpJTBBJTBBZ2VuZXJhdGVkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0Q1MCklMEFnZW5lcmF0ZWRfdGV4dCUyMCUzRCUyMHByb2Nlc3Nvci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVkX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSU1QjAlNUQlMEFwcmludChnZW5lcmF0ZWRfdGV4dCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Pix2StructForConditionalGeneration

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

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

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

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

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;<span class="hljs-subst">{loss.item():<span class="hljs-number">.5</span>f}</span>&quot;</span>)
<span class="hljs-number">5.94282</span>`,wrap:!1}}),{c(){n=d("p"),n.textContent=v,p=a(),u(l.$$.fragment)},l(t){n=m(t,"P",{"data-svelte-h":!0}),b(n)!=="svelte-1igpel8"&&(n.textContent=v),p=r(t),h(l.$$.fragment,t)},m(t,T){c(t,n,T),c(t,p,T),g(l,t,T),y=!0},p:E,i(t){y||(f(l.$$.fragment,t),y=!0)},o(t){_(l.$$.fragment,t),y=!1},d(t){t&&(s(n),s(p)),x(l,t)}}}function Vo(M){let n,v,p,l,y,t,T,Mt,de,Nn='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,me,Hn="The abstract from the paper is the following:",Pt,pe,qn="<p>Visually-situated language is ubiquitous — sources range from textbooks with diagrams to web pages with images and tables, to mobile apps with buttons and forms. Perhaps due to this diversity, previous work has typically relied on domain-specific recipes with limited sharing of the underlying data, model architectures, and objectives. We present Pix2Struct, a pretrained image-to-text model for purely visual language understanding, which can be finetuned on tasks containing visually-situated language. Pix2Struct is pretrained by learning to parse masked screenshots of web pages into simplified HTML. The web, with its richness of visual elements cleanly reflected in the HTML structure, provides a large source of pretraining data well suited to the diversity of downstream tasks. Intuitively, this objective subsumes common pretraining signals such as OCR, language modeling, image captioning. In addition to the novel pretraining strategy, we introduce a variable-resolution input representation and a more flexible integration of language and vision inputs, where language prompts such as questions are rendered directly on top of the input image. For the first time, we show that a single pretrained model can achieve state-of-the-art results in six out of nine tasks across four domains: documents, illustrations, user interfaces, and natural images.</p>",kt,ue,Xn="Tips:",$t,he,En=`Pix2Struct has been fine tuned on a variety of tasks and datasets, ranging from image captioning, visual question answering (VQA) over different inputs (books, charts, science diagrams), captioning UI components etc. The full list can be found in Table 1 of the paper.
We therefore advise you to use these models for the tasks they have been fine tuned on. For instance, if you want to use Pix2Struct for UI captioning, you should use the model fine tuned on the UI dataset. If you want to use Pix2Struct for image captioning, you should use the model fine tuned on the natural images captioning dataset and so on.`,St,ge,Ln="If you want to use the model to perform conditional text captioning, make sure to use the processor with <code>add_special_tokens=False</code>.",Ct,fe,Yn=`This model was contributed by <a href="https://huggingface.co/ybelkada" rel="nofollow">ybelkada</a>.
The original code can be found <a href="https://github.com/google-research/pix2struct" rel="nofollow">here</a>.`,Jt,_e,jt,xe,Dn='<li><a href="https://github.com/huggingface/notebooks/blob/main/examples/image_captioning_pix2struct.ipynb" rel="nofollow">Fine-tuning Notebook</a></li> <li><a href="https://huggingface.co/models?search=pix2struct" rel="nofollow">All models</a></li>',zt,be,Ut,C,ye,Ot,De,Qn=`<a href="/docs/transformers/main/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a> is the configuration class to store the configuration of a
<a href="/docs/transformers/main/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,On=`Configuration objects inherit from <a href="/docs/transformers/main/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/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Kt,Y,en,D,Te,tn,Oe,An=`Instantiate a <a href="/docs/transformers/main/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a> (or a derived class) from pix2struct text model configuration and pix2struct
vision model configuration.`,It,ve,Wt,U,Me,nn,Ae,Kn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/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.`,on,Ke,eo=`Configuration objects inherit from <a href="/docs/transformers/main/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/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,sn,Q,Ft,we,Zt,I,Pe,an,et,to=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/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.`,rn,tt,no=`Configuration objects inherit from <a href="/docs/transformers/main/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/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,ln,O,Bt,ke,Vt,J,$e,cn,nt,oo=`Constructs a PIX2STRUCT processor which wraps a BERT tokenizer and PIX2STRUCT image processor into a single
processor.`,dn,ot,so=`<a href="/docs/transformers/main/en/model_doc/pix2struct#transformers.Pix2StructProcessor">Pix2StructProcessor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/pix2struct#transformers.Pix2StructImageProcessor">Pix2StructImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/t5#transformers.T5TokenizerFast">T5TokenizerFast</a>. See
the docstring of <code>__call__()</code> and <a href="/docs/transformers/main/en/model_doc/pix2struct#transformers.Pix2StructProcessor.decode">decode()</a> for more information.`,mn,A,Se,pn,st,ao=`This method forwards all its arguments to Pix2StructTokenizerFast’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode">batch_decode()</a>.
Please refer to the docstring of this method for more information.`,un,K,Ce,hn,at,ro=`This method forwards all its arguments to Pix2StructTokenizerFast’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode">decode()</a>. Please
refer to the docstring of this method for more information.`,Rt,Je,Gt,G,je,gn,rt,io="Constructs a Pix2Struct image processor.",fn,ee,ze,_n,it,lo=`Preprocess an image or batch of images. The processor first computes the maximum possible number of
aspect-ratio preserving patches of size <code>patch_size</code> that can be extracted from the image. It then pads the
image with zeros to make the image respect the constraint of <code>max_patches</code>. Before extracting the patches the
images are standardized following the tensorflow implementation of <code>per_image_standardization</code>
(<a href="https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization" rel="nofollow">https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization</a>).`,Nt,Ue,Ht,w,Ie,xn,lt,co="The standalone text decoder of Pix2Struct",bn,ct,mo=`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.`,yn,dt,po=`This model inherits from <a href="/docs/transformers/main/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.)`,Tn,mt,uo=`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.`,vn,Z,We,Mn,pt,ho='The <a href="/docs/transformers/main/en/model_doc/pix2struct#transformers.Pix2StructTextModel">Pix2StructTextModel</a> forward method, overrides the <code>__call__</code> special method.',wn,te,Pn,ne,qt,Fe,Xt,N,Ze,kn,ut,go=`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.`,$n,B,Be,Sn,ht,fo='The <a href="/docs/transformers/main/en/model_doc/pix2struct#transformers.Pix2StructVisionModel">Pix2StructVisionModel</a> forward method, overrides the <code>__call__</code> special method.',Cn,oe,Jn,se,Et,Ve,Lt,P,Re,jn,gt,_o="A conditional generation model with a language modeling head. Can be used for sequence generation tasks.",zn,ft,xo=`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.`,Un,_t,bo=`This model inherits from <a href="/docs/transformers/main/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.)`,In,xt,yo=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Wn,S,Ge,Fn,bt,To='The <a href="/docs/transformers/main/en/model_doc/pix2struct#transformers.Pix2StructForConditionalGeneration">Pix2StructForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',Zn,ae,Bn,yt,vo="Example:",Vn,re,Rn,ie,Yt,Ne,Dt,vt,Qt;return y=new X({props:{title:"Pix2Struct",local:"pix2struct",headingTag:"h1"}}),T=new X({props:{title:"Overview",local:"overview",headingTag:"h2"}}),_e=new X({props:{title:"Resources",local:"resources",headingTag:"h2"}}),be=new X({props:{title:"Pix2StructConfig",local:"transformers.Pix2StructConfig",headingTag:"h2"}}),ye=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/main/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/main/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/main/src/transformers/models/pix2struct/configuration_pix2struct.py#L247"}}),Y=new Le({props:{anchor:"transformers.Pix2StructConfig.example",$$slots:{default:[Co]},$$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/main/src/transformers/models/pix2struct/configuration_pix2struct.py#L335",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/main/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</a></p>
`}}),ve=new X({props:{title:"Pix2StructTextConfig",local:"transformers.Pix2StructTextConfig",headingTag:"h2"}}),Me=new z({props:{name:"class transformers.Pix2StructTextConfig",anchor:"transformers.Pix2StructTextConfig",parameters:[{name:"vocab_size",val:" = 50244"},{name:"hidden_size",val:" = 768"},{name:"d_kv",val:" = 64"},{name:"d_ff",val:" = 2048"},{name:"num_layers",val:" = 12"},{name:"num_heads",val:" = 12"},{name:"relative_attention_num_buckets",val:" = 32"},{name:"relative_attention_max_distance",val:" = 128"},{name:"dropout_rate",val:" = 0.1"},{name:"layer_norm_epsilon",val:" = 1e-06"},{name:"initializer_factor",val:" = 1.0"},{name:"dense_act_fn",val:" = 'gelu_new'"},{name:"decoder_start_token_id",val:" = 0"},{name:"use_cache",val:" = False"},{name:"pad_token_id",val:" = 0"},{name:"eos_token_id",val:" = 1"},{name:"tie_word_embeddings",val:" = False"},{name:"is_decoder",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructTextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50244) &#x2014;
Vocabulary size of the <code>Pix2Struct</code> text model. Defines the number of different tokens that can be
represented by the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/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/main/src/transformers/models/pix2struct/configuration_pix2struct.py#L24"}}),Q=new Le({props:{anchor:"transformers.Pix2StructTextConfig.example",$$slots:{default:[Jo]},$$scope:{ctx:M}}}),we=new X({props:{title:"Pix2StructVisionConfig",local:"transformers.Pix2StructVisionConfig",headingTag:"h2"}}),Pe=new z({props:{name:"class transformers.Pix2StructVisionConfig",anchor:"transformers.Pix2StructVisionConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"patch_embed_hidden_size",val:" = 768"},{name:"d_ff",val:" = 2048"},{name:"d_kv",val:" = 64"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"dense_act_fn",val:" = 'gelu_new'"},{name:"layer_norm_eps",val:" = 1e-06"},{name:"dropout_rate",val:" = 0.0"},{name:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 1e-10"},{name:"initializer_factor",val:" = 1.0"},{name:"seq_len",val:" = 4096"},{name:"relative_attention_num_buckets",val:" = 32"},{name:"relative_attention_max_distance",val:" = 128"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructVisionConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.Pix2StructVisionConfig.patch_embed_hidden_size",description:`<strong>patch_embed_hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the input patch_embedding layer in the Transformer encoder.`,name:"patch_embed_hidden_size"},{anchor:"transformers.Pix2StructVisionConfig.d_ff",description:`<strong>d_ff</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"d_ff"},{anchor:"transformers.Pix2StructVisionConfig.d_kv",description:`<strong>d_kv</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Dimensionality of the key, query, value projections per attention head.`,name:"d_kv"},{anchor:"transformers.Pix2StructVisionConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.Pix2StructVisionConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.Pix2StructVisionConfig.dense_act_fn",description:`<strong>dense_act_fn</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> <code>&quot;gelu&quot;</code> are supported.`,name:"dense_act_fn"},{anchor:"transformers.Pix2StructVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-06) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.Pix2StructVisionConfig.dropout_rate",description:`<strong>dropout_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout_rate"},{anchor:"transformers.Pix2StructVisionConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Pix2StructVisionConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-10) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Pix2StructVisionConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.Pix2StructVisionConfig.seq_len",description:`<strong>seq_len</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Maximum sequence length (here number of patches) supported by the model.`,name:"seq_len"},{anchor:"transformers.Pix2StructVisionConfig.relative_attention_num_buckets",description:`<strong>relative_attention_num_buckets</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The number of buckets to use for each attention layer.`,name:"relative_attention_num_buckets"},{anchor:"transformers.Pix2StructVisionConfig.relative_attention_max_distance",description:`<strong>relative_attention_max_distance</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The maximum distance (in tokens) to use for each attention layer.`,name:"relative_attention_max_distance"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pix2struct/configuration_pix2struct.py#L148"}}),O=new Le({props:{anchor:"transformers.Pix2StructVisionConfig.example",$$slots:{default:[jo]},$$scope:{ctx:M}}}),ke=new X({props:{title:"Pix2StructProcessor",local:"transformers.Pix2StructProcessor",headingTag:"h2"}}),$e=new z({props:{name:"class transformers.Pix2StructProcessor",anchor:"transformers.Pix2StructProcessor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructProcessor.image_processor",description:`<strong>image_processor</strong> (<code>Pix2StructImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/main/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/main/src/transformers/models/pix2struct/processing_pix2struct.py#L55"}}),Se=new z({props:{name:"batch_decode",anchor:"transformers.Pix2StructProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/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/main/src/transformers/models/pix2struct/processing_pix2struct.py#L152"}}),Je=new X({props:{title:"Pix2StructImageProcessor",local:"transformers.Pix2StructImageProcessor",headingTag:"h2"}}),je=new z({props:{name:"class transformers.Pix2StructImageProcessor",anchor:"transformers.Pix2StructImageProcessor",parameters:[{name:"do_convert_rgb",val:": bool = True"},{name:"do_normalize",val:": bool = True"},{name:"patch_size",val:": typing.Dict[str, int] = None"},{name:"max_patches",val:": int = 2048"},{name:"is_vqa",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.Pix2StructImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method. According to Pix2Struct paper and code, the image is normalized with its own mean and standard
deviation.`,name:"do_normalize"},{anchor:"transformers.Pix2StructImageProcessor.patch_size",description:`<strong>patch_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 16, &quot;width&quot;: 16}</code>):
The patch size to use for the image. According to Pix2Struct paper and code, the patch size is 16x16.`,name:"patch_size"},{anchor:"transformers.Pix2StructImageProcessor.max_patches",description:`<strong>max_patches</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The maximum number of patches to extract from the image as per the <a href="https://arxiv.org/pdf/2210.03347.pdf" rel="nofollow">Pix2Struct
paper</a>.`,name:"max_patches"},{anchor:"transformers.Pix2StructImageProcessor.is_vqa",description:`<strong>is_vqa</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the image processor is for the VQA task. If <code>True</code> and <code>header_text</code> is passed in, text is
rendered onto the input images.`,name:"is_vqa"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pix2struct/image_processing_pix2struct.py#L189"}}),ze=new z({props:{name:"preprocess",anchor:"transformers.Pix2StructImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"header_text",val:": typing.Optional[str] = None"},{name:"do_convert_rgb",val:": bool = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"max_patches",val:": typing.Optional[int] = None"},{name:"patch_size",val:": typing.Optional[typing.Dict[str, int]] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images.`,name:"images"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.header_text",description:`<strong>header_text</strong> (<code>Union[List[str], str]</code>, <em>optional</em>) &#x2014;
Text to render as a header. Only has an effect if <code>image_processor.is_vqa</code> is <code>True</code>.`,name:"header_text"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.max_patches",description:`<strong>max_patches</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.max_patches</code>) &#x2014;
Maximum number of patches to extract.`,name:"max_patches"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.patch_size",description:`<strong>patch_size</strong> (<code>dict</code>, <em>optional</em>, defaults to <code>self.patch_size</code>) &#x2014;
Dictionary containing the patch height and width.`,name:"patch_size"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: Use the channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.Pix2StructImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pix2struct/image_processing_pix2struct.py#L348"}}),Ue=new X({props:{title:"Pix2StructTextModel",local:"transformers.Pix2StructTextModel",headingTag:"h2"}}),Ie=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/main/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/main/src/transformers/models/pix2struct/modeling_pix2struct.py#L1271"}}),We=new z({props:{name:"forward",anchor:"transformers.Pix2StructTextModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"cross_attn_head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = 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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Pix2StructTextModel.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. It is used to update the
cache in the correct position and to infer the complete sequence length.`,name:"cache_position"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pix2struct/modeling_pix2struct.py#L1343",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),te=new Gn({props:{$$slots:{default:[zo]},$$scope:{ctx:M}}}),ne=new Le({props:{anchor:"transformers.Pix2StructTextModel.forward.example",$$slots:{default:[Uo]},$$scope:{ctx:M}}}),Fe=new X({props:{title:"Pix2StructVisionModel",local:"transformers.Pix2StructVisionModel",headingTag:"h2"}}),Ze=new z({props:{name:"class transformers.Pix2StructVisionModel",anchor:"transformers.Pix2StructVisionModel",parameters:[{name:"config",val:": Pix2StructConfig"}],parametersDescription:[{anchor:"transformers.Pix2StructVisionModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/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/main/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/main/src/transformers/models/pix2struct/modeling_pix2struct.py#L524"}}),Be=new z({props:{name:"forward",anchor:"transformers.Pix2StructVisionModel.forward",parameters:[{name:"flattened_patches",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Pix2StructVisionModel.forward.flattened_patches",description:`<strong>flattened_patches</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, num_channels x patch_height x patch_width)</code>) &#x2014;
Flattened and padded pixel values. These values can be obtained using <a href="/docs/transformers/main/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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pix2struct/modeling_pix2struct.py#L557",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),oe=new Gn({props:{$$slots:{default:[Io]},$$scope:{ctx:M}}}),se=new Le({props:{anchor:"transformers.Pix2StructVisionModel.forward.example",$$slots:{default:[Wo]},$$scope:{ctx:M}}}),Ve=new X({props:{title:"Pix2StructForConditionalGeneration",local:"transformers.Pix2StructForConditionalGeneration",headingTag:"h2"}}),Re=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/main/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/main/src/transformers/models/pix2struct/modeling_pix2struct.py#L1704"}}),Ge=new z({props:{name:"forward",anchor:"transformers.Pix2StructForConditionalGeneration.forward",parameters:[{name:"flattened_patches",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_attention_mask",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"cross_attn_head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_outputs",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = 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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pix2struct/modeling_pix2struct.py#L1742",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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