import{S as cd,i as dd,s as ld,e as n,k as l,w as P,t as a,M as ud,c as r,d as o,m as u,a as s,x as b,h as i,b as d,G as e,g,y as w,q as y,o as T,B as S,v as pd,L as Rt}from"../../chunks/vendor-hf-doc-builder.js";import{T as Fi}from"../../chunks/Tip-hf-doc-builder.js";import{D as j}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Kt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as R}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ht}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function hd($){let p,v,_,h,x;return h=new Kt({props:{code:`from transformers import Pix2StructConfig, Pix2StructForConditionalGeneration

# Initializing a Pix2StructConfig with google/pix2struct-base style configuration
configuration = Pix2StructConfig()

# Initializing a Pix2StructForConditionalGeneration (with random weights) from the google/pix2struct-base style configuration
model = Pix2StructForConditionalGeneration(configuration)

# Accessing the model configuration
configuration = model.config

# We can also initialize a Pix2StructConfig from a Pix2StructTextConfig and a Pix2StructVisionConfig

# Initializing a Pix2Struct text and Pix2Struct vision configuration
config_text = Pix2StructTextConfig()
config_vision = Pix2StructVisionConfig()

config = Pix2StructConfig.from_text_vision_configs(config_text, config_vision)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Pix2StructConfig, Pix2StructForConditionalGeneration

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>config = Pix2StructConfig.from_text_vision_configs(config_text, config_vision)`}}),{c(){p=n("p"),v=a("Example:"),_=l(),P(h.$$.fragment)},l(c){p=r(c,"P",{});var f=s(p);v=i(f,"Example:"),f.forEach(o),_=u(c),b(h.$$.fragment,c)},m(c,f){g(c,p,f),e(p,v),g(c,_,f),w(h,c,f),x=!0},p:Rt,i(c){x||(y(h.$$.fragment,c),x=!0)},o(c){T(h.$$.fragment,c),x=!1},d(c){c&&o(p),c&&o(_),S(h,c)}}}function md($){let p,v,_,h,x;return h=new Kt({props:{code:`from transformers import Pix2StructTextConfig, Pix2StructTextModel

# Initializing a Pix2StructTextConfig with google/pix2struct-base style configuration
configuration = Pix2StructTextConfig()

# Initializing a Pix2StructTextModel (with random weights) from the google/pix2struct-base style configuration
model = Pix2StructTextModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Pix2StructTextConfig, Pix2StructTextModel

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){p=n("p"),v=a("Example:"),_=l(),P(h.$$.fragment)},l(c){p=r(c,"P",{});var f=s(p);v=i(f,"Example:"),f.forEach(o),_=u(c),b(h.$$.fragment,c)},m(c,f){g(c,p,f),e(p,v),g(c,_,f),w(h,c,f),x=!0},p:Rt,i(c){x||(y(h.$$.fragment,c),x=!0)},o(c){T(h.$$.fragment,c),x=!1},d(c){c&&o(p),c&&o(_),S(h,c)}}}function fd($){let p,v,_,h,x;return h=new Kt({props:{code:`from transformers import Pix2StructVisionConfig, Pix2StructVisionModel

# Initializing a Pix2StructVisionConfig with google/pix2struct-base style configuration
configuration = Pix2StructVisionConfig()

# Initializing a Pix2StructVisionModel (with random weights) from the google/pix2struct-base style configuration
model = Pix2StructVisionModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Pix2StructVisionConfig, Pix2StructVisionModel

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){p=n("p"),v=a("Example:"),_=l(),P(h.$$.fragment)},l(c){p=r(c,"P",{});var f=s(p);v=i(f,"Example:"),f.forEach(o),_=u(c),b(h.$$.fragment,c)},m(c,f){g(c,p,f),e(p,v),g(c,_,f),w(h,c,f),x=!0},p:Rt,i(c){x||(y(h.$$.fragment,c),x=!0)},o(c){T(h.$$.fragment,c),x=!1},d(c){c&&o(p),c&&o(_),S(h,c)}}}function gd($){let p,v,_,h,x;return{c(){p=n("p"),v=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),h=a("Module"),x=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){p=r(c,"P",{});var f=s(p);v=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(f,"CODE",{});var q=s(_);h=i(q,"Module"),q.forEach(o),x=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(c,f){g(c,p,f),e(p,v),e(p,_),e(_,h),e(p,x)},d(c){c&&o(p)}}}function _d($){let p,v,_,h,x;return h=new Kt({props:{code:`from transformers import AutoProcessor, Pix2StructTextModel

processor = AutoProcessor.from_pretrained("google/pix2struct-textcaps-base")
model = Pix2StructTextModel.from_pretrained("google/pix2struct-textcaps-base")

inputs = processor(text="Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)
loss = outputs.loss`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Pix2StructTextModel

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

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

image_processor = AutoProcessor.from_pretrained("google/pix2struct-textcaps-base")
model = Pix2StructVisionModel.from_pretrained("google/pix2struct-textcaps-base")

url = "https://www.ilankelman.org/stopsigns/australia.jpg"
image = Image.open(requests.get(url, stream=True).raw)

inputs = image_processor(images=image, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Pix2StructVisionModel

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">2048</span>, <span class="hljs-number">768</span>]`}}),{c(){p=n("p"),v=a("Example:"),_=l(),P(h.$$.fragment)},l(c){p=r(c,"P",{});var f=s(p);v=i(f,"Example:"),f.forEach(o),_=u(c),b(h.$$.fragment,c)},m(c,f){g(c,p,f),e(p,v),g(c,_,f),w(h,c,f),x=!0},p:Rt,i(c){x||(y(h.$$.fragment,c),x=!0)},o(c){T(h.$$.fragment,c),x=!1},d(c){c&&o(p),c&&o(_),S(h,c)}}}function Pd($){let p,v,_,h,x;return{c(){p=n("p"),v=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),h=a("Module"),x=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){p=r(c,"P",{});var f=s(p);v=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(f,"CODE",{});var q=s(_);h=i(q,"Module"),q.forEach(o),x=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(c,f){g(c,p,f),e(p,v),e(p,_),e(_,h),e(p,x)},d(c){c&&o(p)}}}function bd($){let p,v,_,h,x;return h=new Kt({props:{code:`from PIL import Image
import requests
from transformers import AutoProcessor, Pix2StructForConditionalGeneration

processor = AutoProcessor.from_pretrained("google/pix2struct-textcaps-base")
model = Pix2StructForConditionalGeneration.from_pretrained("google/pix2struct-textcaps-base")

url = "https://www.ilankelman.org/stopsigns/australia.jpg"
image = Image.open(requests.get(url, stream=True).raw)

inputs = processor(images=image, return_tensors="pt")

# autoregressive generation
generated_ids = model.generate(**inputs, max_new_tokens=50)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(generated_text)`,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.`}}),{c(){p=n("p"),v=a("Inference:"),_=l(),P(h.$$.fragment)},l(c){p=r(c,"P",{});var f=s(p);v=i(f,"Inference:"),f.forEach(o),_=u(c),b(h.$$.fragment,c)},m(c,f){g(c,p,f),e(p,v),g(c,_,f),w(h,c,f),x=!0},p:Rt,i(c){x||(y(h.$$.fragment,c),x=!0)},o(c){T(h.$$.fragment,c),x=!1},d(c){c&&o(p),c&&o(_),S(h,c)}}}function wd($){let p,v,_,h,x;return h=new Kt({props:{code:`from PIL import Image
import requests
from transformers import AutoProcessor, Pix2StructForConditionalGeneration

processor = AutoProcessor.from_pretrained("google/pix2struct-base")
model = Pix2StructForConditionalGeneration.from_pretrained("google/pix2struct-base")

url = "https://www.ilankelman.org/stopsigns/australia.jpg"
image = Image.open(requests.get(url, stream=True).raw)
text = "A stop sign is on the street corner."

inputs = processor(images=image, return_tensors="pt")
labels = processor(text=text, return_tensors="pt").input_ids

# forward pass
outputs = model(**inputs, labels=labels)
loss = outputs.loss
print(f"{loss.item():.5f}")`,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.95566</span>`}}),{c(){p=n("p"),v=a("Training:"),_=l(),P(h.$$.fragment)},l(c){p=r(c,"P",{});var f=s(p);v=i(f,"Training:"),f.forEach(o),_=u(c),b(h.$$.fragment,c)},m(c,f){g(c,p,f),e(p,v),g(c,_,f),w(h,c,f),x=!0},p:Rt,i(c){x||(y(h.$$.fragment,c),x=!0)},o(c){T(h.$$.fragment,c),x=!1},d(c){c&&o(p),c&&o(_),S(h,c)}}}function yd($){let p,v,_,h,x,c,f,q,_r,bn,Y,ge,jo,Re,xr,qo,vr,wn,_e,Pr,Ke,br,wr,yn,Bt,yr,Tn,Jt,Fo,Tr,Sn,Qt,Sr,$n,Xt,$r,kn,K,kr,Be,Cr,zr,Je,Er,Mr,Cn,Z,xe,Io,Qe,jr,Ao,qr,zn,ve,Vo,Xe,Fr,Ir,No,Ye,Ar,En,ee,Pe,Lo,Ze,Vr,Do,Nr,Mn,E,et,Lr,B,Yt,Dr,Or,Zt,Gr,Ur,tt,Wr,Hr,Rr,te,Kr,eo,Br,Jr,to,Qr,Xr,Yr,be,Zr,we,ot,es,nt,ts,oo,os,ns,jn,oe,ye,Oo,rt,rs,Go,ss,qn,I,st,as,ne,is,no,cs,ds,at,ls,us,ps,re,hs,ro,ms,fs,so,gs,_s,xs,Te,Fn,se,Se,Uo,it,vs,Wo,Ps,In,A,ct,bs,ae,ws,ao,ys,Ts,dt,Ss,$s,ks,ie,Cs,io,zs,Es,co,Ms,js,qs,$e,An,ce,ke,Ho,lt,Fs,Ro,Is,Vn,M,ut,As,Ko,Vs,Ns,F,lo,Ls,Ds,uo,Os,Gs,po,Us,Ws,Bo,Hs,Rs,ho,Ks,Bs,Js,Ce,pt,Qs,ht,Xs,mo,Ys,Zs,ea,ze,mt,ta,ft,oa,fo,na,ra,Nn,de,Ee,Jo,gt,sa,Qo,aa,Ln,U,_t,ia,Xo,ca,da,Me,xt,la,V,ua,Yo,pa,ha,Zo,ma,fa,en,ga,_a,vt,xa,va,Dn,le,je,tn,Pt,Pa,on,ba,On,k,bt,wa,nn,ya,Ta,wt,Sa,yt,$a,ka,Ca,Tt,za,go,Ea,Ma,ja,St,qa,$t,Fa,Ia,Aa,N,kt,Va,ue,Na,_o,La,Da,rn,Oa,Ga,Ua,qe,Wa,Fe,Gn,pe,Ie,sn,Ct,Ha,an,Ra,Un,W,zt,Ka,Et,Ba,Mt,Ja,Qa,Xa,L,jt,Ya,he,Za,xo,ei,ti,cn,oi,ni,ri,Ae,si,Ve,Wn,me,Ne,dn,qt,ai,ln,ii,Hn,C,Ft,ci,un,di,li,It,ui,At,pi,hi,mi,Vt,fi,vo,gi,_i,xi,Nt,vi,Lt,Pi,bi,wi,z,Dt,yi,fe,Ti,Po,Si,$i,pn,ki,Ci,zi,Le,Ei,hn,Mi,ji,De,qi,Oe,Rn;return c=new R({}),Re=new R({}),Qe=new R({}),Ze=new R({}),et=new j({props:{name:"class transformers.Pix2StructConfig",anchor:"transformers.Pix2StructConfig",parameters:[{name:"text_config",val:" = None"},{name:"vision_config",val:" = None"},{name:"initializer_factor",val:" = 1.0"},{name:"initializer_range",val:" = 0.02"},{name:"is_vqa",val:" = False"},{name:"tie_word_embeddings",val:" = False"},{name:"is_encoder_decoder",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructConfig.text_config",description:`<strong>text_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructTextConfig">Pix2StructTextConfig</a>.`,name:"text_config"},{anchor:"transformers.Pix2StructConfig.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructVisionConfig">Pix2StructVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.Pix2StructConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Factor to multiply the initialization range with.`,name:"initializer_factor"},{anchor:"transformers.Pix2StructConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Pix2StructConfig.is_vqa",description:`<strong>is_vqa</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the model has been fine-tuned for VQA or not.`,name:"is_vqa"},{anchor:"transformers.Pix2StructConfig.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/configuration_pix2struct.py#L304"}}),be=new Ht({props:{anchor:"transformers.Pix2StructConfig.example",$$slots:{default:[hd]},$$scope:{ctx:$}}}),ot=new j({props:{name:"from_text_vision_configs",anchor:"transformers.Pix2StructConfig.from_text_vision_configs",parameters:[{name:"text_config",val:": Pix2StructTextConfig"},{name:"vision_config",val:": Pix2StructVisionConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/configuration_pix2struct.py#L391",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</a></p>
`}}),rt=new R({}),st=new j({props:{name:"class transformers.Pix2StructTextConfig",anchor:"transformers.Pix2StructTextConfig",parameters:[{name:"vocab_size",val:" = 50244"},{name:"hidden_size",val:" = 768"},{name:"d_kv",val:" = 64"},{name:"d_ff",val:" = 2048"},{name:"num_layers",val:" = 12"},{name:"num_heads",val:" = 12"},{name:"relative_attention_num_buckets",val:" = 32"},{name:"relative_attention_max_distance",val:" = 128"},{name:"dropout_rate",val:" = 0.1"},{name:"layer_norm_epsilon",val:" = 1e-06"},{name:"initializer_factor",val:" = 1.0"},{name:"dense_act_fn",val:" = 'gelu_new'"},{name:"decoder_start_token_id",val:" = 0"},{name:"use_cache",val:" = False"},{name:"pad_token_id",val:" = 0"},{name:"eos_token_id",val:" = 1"},{name:"tie_word_embeddings",val:" = False"},{name:"is_decoder",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructTextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50244) &#x2014;
Vocabulary size of the <code>Pix2Struct</code> text model. Defines the number of different tokens that can be
represented by the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructTextModel">Pix2StructTextModel</a>.`,name:"vocab_size"},{anchor:"transformers.Pix2StructTextConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.Pix2StructTextConfig.d_kv",description:`<strong>d_kv</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Dimensionality of the key, query, value projections in each attention head.`,name:"d_kv"},{anchor:"transformers.Pix2StructTextConfig.d_ff",description:`<strong>d_ff</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"d_ff"},{anchor:"transformers.Pix2StructTextConfig.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_layers"},{anchor:"transformers.Pix2StructTextConfig.num_heads",description:`<strong>num_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_heads"},{anchor:"transformers.Pix2StructTextConfig.relative_attention_num_buckets",description:`<strong>relative_attention_num_buckets</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The number of buckets to use for each attention layer.`,name:"relative_attention_num_buckets"},{anchor:"transformers.Pix2StructTextConfig.relative_attention_max_distance",description:`<strong>relative_attention_max_distance</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The maximum distance of the longer sequences for the bucket separation.`,name:"relative_attention_max_distance"},{anchor:"transformers.Pix2StructTextConfig.dropout_rate",description:`<strong>dropout_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout_rate"},{anchor:"transformers.Pix2StructTextConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_epsilon"},{anchor:"transformers.Pix2StructTextConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.Pix2StructTextConfig.dense_act_fn",description:`<strong>dense_act_fn</strong> (<code>Union[Callable, str]</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
The non-linear activation function (function or string).`,name:"dense_act_fn"},{anchor:"transformers.Pix2StructTextConfig.decoder_start_token_id",description:`<strong>decoder_start_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the <code>decoder_start_token_id</code> token.`,name:"decoder_start_token_id"},{anchor:"transformers.Pix2StructTextConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"},{anchor:"transformers.Pix2StructTextConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the <code>padding</code> token.`,name:"pad_token_id"},{anchor:"transformers.Pix2StructTextConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The id of the <code>end-of-sequence</code> token.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/configuration_pix2struct.py#L34"}}),Te=new Ht({props:{anchor:"transformers.Pix2StructTextConfig.example",$$slots:{default:[md]},$$scope:{ctx:$}}}),it=new R({}),ct=new j({props:{name:"class transformers.Pix2StructVisionConfig",anchor:"transformers.Pix2StructVisionConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"patch_embed_hidden_size",val:" = 768"},{name:"d_ff",val:" = 2048"},{name:"d_kv",val:" = 64"},{name:"projection_dim",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"num_channels",val:" = 3"},{name:"patch_size",val:" = 16"},{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:"layer_norm_bias",val:" = False"},{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.projection_dim",description:`<strong>projection_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the projection layer in the Transformer encoder.`,name:"projection_dim"},{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.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
Number of channels of the input images.`,name:"num_channels"},{anchor:"transformers.Pix2StructVisionConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.Pix2StructVisionConfig.dense_act_fn",description:`<strong>dense_act_fn</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> \`<code>&quot;gelu&quot;</code> are supported.`,name:"dense_act_fn"},{anchor:"transformers.Pix2StructVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.Pix2StructVisionConfig.dropout_rate",description:`<strong>dropout_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout_rate"},{anchor:"transformers.Pix2StructVisionConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Pix2StructVisionConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-10) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Pix2StructVisionConfig.initializer_factor",description:`<strong>initializer_factor</strong> (\`float&#x201C;, <em>optional</em>, defaults to 1) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.Pix2StructVisionConfig.seq_len",description:`<strong>seq_len</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Maximum sequence length (here number of patches) supported by the model.`,name:"seq_len"},{anchor:"transformers.Pix2StructVisionConfig.layer_norm_bias",description:`<strong>layer_norm_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add a bias to the layer normalization layers.`,name:"layer_norm_bias"},{anchor:"transformers.Pix2StructVisionConfig.relative_attention_num_buckets",description:`<strong>relative_attention_num_buckets</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The number of buckets to use for each attention layer.`,name:"relative_attention_num_buckets"},{anchor:"transformers.Pix2StructVisionConfig.relative_attention_max_distance",description:`<strong>relative_attention_max_distance</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The maximum distance (in tokens) to use for each attention layer.`,name:"relative_attention_max_distance"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/configuration_pix2struct.py#L171"}}),$e=new Ht({props:{anchor:"transformers.Pix2StructVisionConfig.example",$$slots:{default:[fd]},$$scope:{ctx:$}}}),lt=new R({}),ut=new j({props:{name:"class transformers.Pix2StructProcessor",anchor:"transformers.Pix2StructProcessor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructProcessor.image_processor",description:`<strong>image_processor</strong> (<code>Pix2StructImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructImageProcessor">Pix2StructImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.Pix2StructProcessor.tokenizer",description:"<strong>tokenizer</strong> (Union[<code>T5TokenizerFast</code>, <code>T5Tokenizer</code>]) &#x2014;\nAn instance of [&#x2018;T5TokenizerFast`] or [&#x2018;T5Tokenizer`]. The tokenizer is a required input.",name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/processing_pix2struct.py#L26"}}),pt=new j({props:{name:"batch_decode",anchor:"transformers.Pix2StructProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/processing_pix2struct.py#L144"}}),mt=new j({props:{name:"decode",anchor:"transformers.Pix2StructProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/processing_pix2struct.py#L151"}}),gt=new R({}),_t=new j({props:{name:"class transformers.Pix2StructImageProcessor",anchor:"transformers.Pix2StructImageProcessor",parameters:[{name:"do_convert_rgb",val:": bool = True"},{name:"do_normalize",val:": bool = True"},{name:"patch_size",val:": typing.Dict[str, int] = None"},{name:"max_patches",val:": int = 2048"},{name:"is_vqa",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.Pix2StructImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method. According to Pix2Struct paper and code, the image is normalized with its own mean and standard
deviation.`,name:"do_normalize"},{anchor:"transformers.Pix2StructImageProcessor.patch_size",description:`<strong>patch_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 16, &quot;width&quot;: 16}</code>):
The patch size to use for the image. According to Pix2Struct paper and code, the patch size is 16x16.`,name:"patch_size"},{anchor:"transformers.Pix2StructImageProcessor.max_patches",description:`<strong>max_patches</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The maximum number of patches to extract from the image as per the <a href="https://arxiv.org/pdf/2210.03347.pdf" rel="nofollow">Pix2Struct
paper</a>.`,name:"max_patches"},{anchor:"transformers.Pix2StructImageProcessor.is_vqa",description:`<strong>is_vqa</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the image processor is for the VQA task. If <code>True</code> and <code>header_text</code> is passed in, text is
rendered onto the input images.`,name:"is_vqa"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/image_processing_pix2struct.py#L187"}}),xt=new j({props:{name:"preprocess",anchor:"transformers.Pix2StructImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"header_text",val:": typing.Optional[str] = None"},{name:"do_convert_rgb",val:": bool = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"max_patches",val:": typing.Optional[int] = None"},{name:"patch_size",val:": typing.Union[typing.Dict[str, int], NoneType] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,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"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/image_processing_pix2struct.py#L323"}}),Pt=new R({}),bt=new j({props:{name:"class transformers.Pix2StructTextModel",anchor:"transformers.Pix2StructTextModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructTextModel.config",description:`<strong>config</strong> (Union[<code>Pix2StructConfig</code>, <code>Pix2StructTextConfig</code>]) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/modeling_pix2struct.py#L1315"}}),kt=new j({props:{name:"forward",anchor:"transformers.Pix2StructTextModel.forward",parameters:[{name:"input_ids",val:" = None"},{name:"attention_mask",val:" = None"},{name:"encoder_hidden_states",val:" = None"},{name:"encoder_attention_mask",val:" = None"},{name:"inputs_embeds",val:" = None"},{name:"head_mask",val:" = None"},{name:"cross_attn_head_mask",val:" = None"},{name:"past_key_values",val:" = None"},{name:"use_cache",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"labels",val:" = None"},{name:"return_dict",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Pix2StructTextModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Pix2StructText is a model with relative position
embeddings so you should be able to pad the inputs on both the right and the left.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for detail.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
<p>To know more on how to prepare <code>input_ids</code> for pretraining take a look a <a href="./t5#training">Pix2StructText
Training</a>.`,name:"input_ids"},{anchor:"transformers.Pix2StructTextModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.Pix2StructTextModel.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>Pix2StructText uses the <code>pad_token_id</code> as the starting token for <code>decoder_input_ids</code> generation. If
<code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>To know more on how to prepare <code>decoder_input_ids</code> for pretraining take a look at <a href="./t5#training">Pix2StructText
Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.Pix2StructTextModel.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.Pix2StructTextModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Pix2StructTextModel.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.Pix2StructTextModel.forward.cross_attn_head_mask",description:`<strong>cross_attn_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the cross-attention modules in the decoder. Mask values selected in
<code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"cross_attn_head_mask"},{anchor:"transformers.Pix2StructTextModel.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <code>optional</code>: <em>hidden_states</em>, <code>optional</code>: <em>attentions</em>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code> is a sequence of hidden states at
the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.Pix2StructTextModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention layers. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Pix2StructTextModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.Pix2StructTextModel.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. If <code>past_key_values</code> is used, optionally only the last <code>decoder_inputs_embeds</code> have to be
input (see <code>past_key_values</code>). This is useful if you want more control over how to convert
<code>decoder_input_ids</code> indices into associated vectors than the model&#x2019;s internal embedding lookup matrix.</p>
<p>If <code>decoder_input_ids</code> and <code>decoder_inputs_embeds</code> are both unset, <code>decoder_inputs_embeds</code> takes the value
of <code>inputs_embeds</code>.`,name:"decoder_inputs_embeds"},{anchor:"transformers.Pix2StructTextModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.Pix2StructTextModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Pix2StructTextModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Pix2StructTextModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/modeling_pix2struct.py#L1377",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 Tuple of <code>torch.FloatTensor</code> tuples of length <code>config.n_layers</code>, with each tuple containing the cached key,
value states of the self-attention and the cross-attention layers if model is used in encoder-decoder
setting. Only relevant if <code>config.is_decoder = True</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),qe=new Fi({props:{$$slots:{default:[gd]},$$scope:{ctx:$}}}),Fe=new Ht({props:{anchor:"transformers.Pix2StructTextModel.forward.example",$$slots:{default:[_d]},$$scope:{ctx:$}}}),Ct=new R({}),zt=new j({props:{name:"class transformers.Pix2StructVisionModel",anchor:"transformers.Pix2StructVisionModel",parameters:[{name:"config",val:": Pix2StructConfig"}],parametersDescription:[{anchor:"transformers.Pix2StructVisionModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructConfig">Pix2StructConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/modeling_pix2struct.py#L546"}}),jt=new j({props:{name:"forward",anchor:"transformers.Pix2StructVisionModel.forward",parameters:[{name:"flattened_patches",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Pix2StructVisionModel.forward.flattened_patches",description:`<strong>flattened_patches</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, num_channels x patch_height x patch_width)</code>) &#x2014;
Flattened and padded pixel values. These values can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>Pix2StructVisionImageProcessor.__call__</code> for details. Check the <a href="https://arxiv.org/abs/2210.03347" rel="nofollow">original
paper</a> (figure 5) for more details.`,name:"flattened_patches"},{anchor:"transformers.Pix2StructVisionModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:`,name:"attention_mask"},{anchor:"transformers.Pix2StructVisionModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Pix2StructVisionModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Pix2StructVisionModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Pix2StructVisionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/modeling_pix2struct.py#L579",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ae=new Fi({props:{$$slots:{default:[xd]},$$scope:{ctx:$}}}),Ve=new Ht({props:{anchor:"transformers.Pix2StructVisionModel.forward.example",$$slots:{default:[vd]},$$scope:{ctx:$}}}),qt=new R({}),Ft=new j({props:{name:"class transformers.Pix2StructForConditionalGeneration",anchor:"transformers.Pix2StructForConditionalGeneration",parameters:[{name:"config",val:": Pix2StructConfig"}],parametersDescription:[{anchor:"transformers.Pix2StructForConditionalGeneration.config",description:`<strong>config</strong> (Union[<code>Pix2StructConfig</code>, <code>Pix2StructTextConfig</code>]) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/modeling_pix2struct.py#L1588"}}),Dt=new j({props:{name:"forward",anchor:"transformers.Pix2StructForConditionalGeneration.forward",parameters:[{name:"flattened_patches",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_attention_mask",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"cross_attn_head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_outputs",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Pix2StructForConditionalGeneration.forward.flattened_patches",description:`<strong>flattened_patches</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_length, hidden_size)</code>) &#x2014;
Flattened pixel patches. the <code>hidden_size</code> is obtained by the following formula: <code>hidden_size</code> =
<code>num_channels</code> <em> <code>patch_size</code> </em> <code>patch_size</code></p>
<p>The process of flattening the pixel patches is done by <code>Pix2StructProcessor</code>.`,name:"flattened_patches"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>Pix2StructText uses the <code>pad_token_id</code> as the starting token for <code>decoder_input_ids</code> generation. If
<code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>To know more on how to prepare <code>decoder_input_ids</code> for pretraining take a look at <a href="./t5#training">Pix2StructText
Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.cross_attn_head_mask",description:`<strong>cross_attn_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the cross-attention modules in the decoder. Mask values selected in
<code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"cross_attn_head_mask"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <code>optional</code>: <em>hidden_states</em>, <code>optional</code>: <em>attentions</em>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code> is a sequence of hidden states at
the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention layers. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. If <code>past_key_values</code> is used, optionally only the last <code>decoder_inputs_embeds</code> have to be
input (see <code>past_key_values</code>). This is useful if you want more control over how to convert
<code>decoder_input_ids</code> indices into associated vectors than the model&#x2019;s internal embedding lookup matrix.</p>
<p>If <code>decoder_input_ids</code> and <code>decoder_inputs_embeds</code> are both unset, <code>decoder_inputs_embeds</code> takes the value
of <code>inputs_embeds</code>.`,name:"decoder_inputs_embeds"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss for the decoder.`,name:"labels"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Pix2StructForConditionalGeneration.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/pix2struct/modeling_pix2struct.py#L1637",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructConfig"
>Pix2StructConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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\u2019s 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>) \u2014 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>) \u2014 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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Le=new Fi({props:{$$slots:{default:[Pd]},$$scope:{ctx:$}}}),De=new Ht({props:{anchor:"transformers.Pix2StructForConditionalGeneration.forward.example",$$slots:{default:[bd]},$$scope:{ctx:$}}}),Oe=new Ht({props:{anchor:"transformers.Pix2StructForConditionalGeneration.forward.example-2",$$slots:{default:[wd]},$$scope:{ctx:$}}}),{c(){p=n("meta"),v=l(),_=n("h1"),h=n("a"),x=n("span"),P(c.$$.fragment),f=l(),q=n("span"),_r=a("Pix2Struct"),bn=l(),Y=n("h2"),ge=n("a"),jo=n("span"),P(Re.$$.fragment),xr=l(),qo=n("span"),vr=a("Overview"),wn=l(),_e=n("p"),Pr=a("The Pix2Struct model was proposed in "),Ke=n("a"),br=a("Pix2Struct: Screenshot Parsing as Pretraining for Visual Language Understanding"),wr=a(" by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu, Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, Kristina Toutanova."),yn=l(),Bt=n("p"),yr=a("The abstract from the paper is the following:"),Tn=l(),Jt=n("blockquote"),Fo=n("p"),Tr=a("Visually-situated language is ubiquitous \u2014 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."),Sn=l(),Qt=n("p"),Sr=a("Tips:"),$n=l(),Xt=n("p"),$r=a(`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.`),kn=l(),K=n("p"),kr=a("This model was contributed by "),Be=n("a"),Cr=a("ybelkada"),zr=a(`.
The original code can be found `),Je=n("a"),Er=a("here"),Mr=a("."),Cn=l(),Z=n("h2"),xe=n("a"),Io=n("span"),P(Qe.$$.fragment),jr=l(),Ao=n("span"),qr=a("Resources"),zn=l(),ve=n("ul"),Vo=n("li"),Xe=n("a"),Fr=a("Fine-tuning Notebook"),Ir=l(),No=n("li"),Ye=n("a"),Ar=a("All models"),En=l(),ee=n("h2"),Pe=n("a"),Lo=n("span"),P(Ze.$$.fragment),Vr=l(),Do=n("span"),Nr=a("Pix2StructConfig"),Mn=l(),E=n("div"),P(et.$$.fragment),Lr=l(),B=n("p"),Yt=n("a"),Dr=a("Pix2StructConfig"),Or=a(` is the configuration class to store the configuration of a
`),Zt=n("a"),Gr=a("Pix2StructForConditionalGeneration"),Ur=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
`),tt=n("a"),Wr=a("google/pix2struct-base"),Hr=a(" architecture."),Rr=l(),te=n("p"),Kr=a("Configuration objects inherit from "),eo=n("a"),Br=a("PretrainedConfig"),Jr=a(` and can be used to control the model outputs. Read the
documentation from `),to=n("a"),Qr=a("PretrainedConfig"),Xr=a(" for more information."),Yr=l(),P(be.$$.fragment),Zr=l(),we=n("div"),P(ot.$$.fragment),es=l(),nt=n("p"),ts=a("Instantiate a "),oo=n("a"),os=a("Pix2StructConfig"),ns=a(` (or a derived class) from pix2struct text model configuration and pix2struct
vision model configuration.`),jn=l(),oe=n("h2"),ye=n("a"),Oo=n("span"),P(rt.$$.fragment),rs=l(),Go=n("span"),ss=a("Pix2StructTextConfig"),qn=l(),I=n("div"),P(st.$$.fragment),as=l(),ne=n("p"),is=a("This is the configuration class to store the configuration of a "),no=n("a"),cs=a("Pix2StructTextModel"),ds=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 `),at=n("a"),ls=a("google/pix2struct-base"),us=a(" architecture."),ps=l(),re=n("p"),hs=a("Configuration objects inherit from "),ro=n("a"),ms=a("PretrainedConfig"),fs=a(` and can be used to control the model outputs. Read the
documentation from `),so=n("a"),gs=a("PretrainedConfig"),_s=a(" for more information."),xs=l(),P(Te.$$.fragment),Fn=l(),se=n("h2"),Se=n("a"),Uo=n("span"),P(it.$$.fragment),vs=l(),Wo=n("span"),Ps=a("Pix2StructVisionConfig"),In=l(),A=n("div"),P(ct.$$.fragment),bs=l(),ae=n("p"),ws=a("This is the configuration class to store the configuration of a "),ao=n("a"),ys=a("Pix2StructVisionModel"),Ts=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
`),dt=n("a"),Ss=a("google/pix2struct-base"),$s=a(" architecture."),ks=l(),ie=n("p"),Cs=a("Configuration objects inherit from "),io=n("a"),zs=a("PretrainedConfig"),Es=a(` and can be used to control the model outputs. Read the
documentation from `),co=n("a"),Ms=a("PretrainedConfig"),js=a(" for more information."),qs=l(),P($e.$$.fragment),An=l(),ce=n("h2"),ke=n("a"),Ho=n("span"),P(lt.$$.fragment),Fs=l(),Ro=n("span"),Is=a("Pix2StructProcessor"),Vn=l(),M=n("div"),P(ut.$$.fragment),As=l(),Ko=n("p"),Vs=a(`Constructs a PIX2STRUCT processor which wraps a BERT tokenizer and PIX2STRUCT image processor into a single
processor.`),Ns=l(),F=n("p"),lo=n("a"),Ls=a("Pix2StructProcessor"),Ds=a(" offers all the functionalities of "),uo=n("a"),Os=a("Pix2StructImageProcessor"),Gs=a(" and "),po=n("a"),Us=a("T5TokenizerFast"),Ws=a(`. See
the docstring of `),Bo=n("code"),Hs=a("__call__()"),Rs=a(" and "),ho=n("a"),Ks=a("decode()"),Bs=a(" for more information."),Js=l(),Ce=n("div"),P(pt.$$.fragment),Qs=l(),ht=n("p"),Xs=a("This method forwards all its arguments to Pix2StructTokenizerFast\u2019s "),mo=n("a"),Ys=a("batch_decode()"),Zs=a(`.
Please refer to the docstring of this method for more information.`),ea=l(),ze=n("div"),P(mt.$$.fragment),ta=l(),ft=n("p"),oa=a("This method forwards all its arguments to Pix2StructTokenizerFast\u2019s "),fo=n("a"),na=a("decode()"),ra=a(`. Please
refer to the docstring of this method for more information.`),Nn=l(),de=n("h2"),Ee=n("a"),Jo=n("span"),P(gt.$$.fragment),sa=l(),Qo=n("span"),aa=a("Pix2StructImageProcessor"),Ln=l(),U=n("div"),P(_t.$$.fragment),ia=l(),Xo=n("p"),ca=a("Constructs a Pix2Struct image processor."),da=l(),Me=n("div"),P(xt.$$.fragment),la=l(),V=n("p"),ua=a(`Preprocess an image or batch of images. The processor first computes the maximum possible number of
aspect-ratio preserving patches of size `),Yo=n("code"),pa=a("patch_size"),ha=a(` that can be extracted from the image. It then pads the
image with zeros to make the image respect the constraint of `),Zo=n("code"),ma=a("max_patches"),fa=a(`. Before extracting the patches the
images are standardized following the tensorflow implementation of `),en=n("code"),ga=a("per_image_standardization"),_a=a(`
(`),vt=n("a"),xa=a("https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization"),va=a(")."),Dn=l(),le=n("h2"),je=n("a"),tn=n("span"),P(Pt.$$.fragment),Pa=l(),on=n("span"),ba=a("Pix2StructTextModel"),On=l(),k=n("div"),P(bt.$$.fragment),wa=l(),nn=n("p"),ya=a("The standalone text decoder of Pix2Struct"),Ta=l(),wt=n("p"),Sa=a("The Pix2Struct model was proposed in "),yt=n("a"),$a=a(`Pix2Struct: Screenshot Parsing as Pretraining for Visual Language
Understanding`),ka=a(` by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu,
Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, Kristina Toutanova. It\u2019s an encoder decoder
transformer pre-trained in a image-to-text setting.`),Ca=l(),Tt=n("p"),za=a("This model inherits from "),go=n("a"),Ea=a("PreTrainedModel"),Ma=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.)`),ja=l(),St=n("p"),qa=a("This model is also a PyTorch "),$t=n("a"),Fa=a("torch.nn.Module"),Ia=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Aa=l(),N=n("div"),P(kt.$$.fragment),Va=l(),ue=n("p"),Na=a("The "),_o=n("a"),La=a("Pix2StructTextModel"),Da=a(" forward method, overrides the "),rn=n("code"),Oa=a("__call__"),Ga=a(" special method."),Ua=l(),P(qe.$$.fragment),Wa=l(),P(Fe.$$.fragment),Gn=l(),pe=n("h2"),Ie=n("a"),sn=n("span"),P(Ct.$$.fragment),Ha=l(),an=n("span"),Ra=a("Pix2StructVisionModel"),Un=l(),W=n("div"),P(zt.$$.fragment),Ka=l(),Et=n("p"),Ba=a(`The bare Pix2StructVision Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Mt=n("a"),Ja=a("torch.nn.Module"),Qa=a(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Xa=l(),L=n("div"),P(jt.$$.fragment),Ya=l(),he=n("p"),Za=a("The "),xo=n("a"),ei=a("Pix2StructVisionModel"),ti=a(" forward method, overrides the "),cn=n("code"),oi=a("__call__"),ni=a(" special method."),ri=l(),P(Ae.$$.fragment),si=l(),P(Ve.$$.fragment),Wn=l(),me=n("h2"),Ne=n("a"),dn=n("span"),P(qt.$$.fragment),ai=l(),ln=n("span"),ii=a("Pix2StructForConditionalGeneration"),Hn=l(),C=n("div"),P(Ft.$$.fragment),ci=l(),un=n("p"),di=a("A conditional generation model with a language modeling head. Can be used for sequence generation tasks."),li=l(),It=n("p"),ui=a("The Pix2Struct model was proposed in "),At=n("a"),pi=a(`Pix2Struct: Screenshot Parsing as Pretraining for Visual Language
Understanding`),hi=a(` by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu,
Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, Kristina Toutanova. It\u2019s an encoder decoder
transformer pre-trained in a image-to-text setting.`),mi=l(),Vt=n("p"),fi=a("This model inherits from "),vo=n("a"),gi=a("PreTrainedModel"),_i=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.)`),xi=l(),Nt=n("p"),vi=a("This model is also a PyTorch "),Lt=n("a"),Pi=a("torch.nn.Module"),bi=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),wi=l(),z=n("div"),P(Dt.$$.fragment),yi=l(),fe=n("p"),Ti=a("The "),Po=n("a"),Si=a("Pix2StructForConditionalGeneration"),$i=a(" forward method, overrides the "),pn=n("code"),ki=a("__call__"),Ci=a(" special method."),zi=l(),P(Le.$$.fragment),Ei=l(),hn=n("p"),Mi=a("Example:"),ji=l(),P(De.$$.fragment),qi=l(),P(Oe.$$.fragment),this.h()},l(t){const m=ud('[data-svelte="svelte-1phssyn"]',document.head);p=r(m,"META",{name:!0,content:!0}),m.forEach(o),v=u(t),_=r(t,"H1",{class:!0});var Ot=s(_);h=r(Ot,"A",{id:!0,class:!0,href:!0});var mn=s(h);x=r(mn,"SPAN",{});var fn=s(x);b(c.$$.fragment,fn),fn.forEach(o),mn.forEach(o),f=u(Ot),q=r(Ot,"SPAN",{});var gn=s(q);_r=i(gn,"Pix2Struct"),gn.forEach(o),Ot.forEach(o),bn=u(t),Y=r(t,"H2",{class:!0});var Gt=s(Y);ge=r(Gt,"A",{id:!0,class:!0,href:!0});var _n=s(ge);jo=r(_n,"SPAN",{});var xn=s(jo);b(Re.$$.fragment,xn),xn.forEach(o),_n.forEach(o),xr=u(Gt),qo=r(Gt,"SPAN",{});var vn=s(qo);vr=i(vn,"Overview"),vn.forEach(o),Gt.forEach(o),wn=u(t),_e=r(t,"P",{});var Ut=s(_e);Pr=i(Ut,"The Pix2Struct model was proposed in "),Ke=r(Ut,"A",{href:!0,rel:!0});var Pn=s(Ke);br=i(Pn,"Pix2Struct: Screenshot Parsing as Pretraining for Visual Language Understanding"),Pn.forEach(o),wr=i(Ut," by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu, Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, Kristina Toutanova."),Ut.forEach(o),yn=u(t),Bt=r(t,"P",{});var Ii=s(Bt);yr=i(Ii,"The abstract from the paper is the following:"),Ii.forEach(o),Tn=u(t),Jt=r(t,"BLOCKQUOTE",{});var Ai=s(Jt);Fo=r(Ai,"P",{});var Vi=s(Fo);Tr=i(Vi,"Visually-situated language is ubiquitous \u2014 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."),Vi.forEach(o),Ai.forEach(o),Sn=u(t),Qt=r(t,"P",{});var Ni=s(Qt);Sr=i(Ni,"Tips:"),Ni.forEach(o),$n=u(t),Xt=r(t,"P",{});var Li=s(Xt);$r=i(Li,`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.`),Li.forEach(o),kn=u(t),K=r(t,"P",{});var bo=s(K);kr=i(bo,"This model was contributed by "),Be=r(bo,"A",{href:!0,rel:!0});var Di=s(Be);Cr=i(Di,"ybelkada"),Di.forEach(o),zr=i(bo,`.
The original code can be found `),Je=r(bo,"A",{href:!0,rel:!0});var Oi=s(Je);Er=i(Oi,"here"),Oi.forEach(o),Mr=i(bo,"."),bo.forEach(o),Cn=u(t),Z=r(t,"H2",{class:!0});var Kn=s(Z);xe=r(Kn,"A",{id:!0,class:!0,href:!0});var Gi=s(xe);Io=r(Gi,"SPAN",{});var Ui=s(Io);b(Qe.$$.fragment,Ui),Ui.forEach(o),Gi.forEach(o),jr=u(Kn),Ao=r(Kn,"SPAN",{});var Wi=s(Ao);qr=i(Wi,"Resources"),Wi.forEach(o),Kn.forEach(o),zn=u(t),ve=r(t,"UL",{});var Bn=s(ve);Vo=r(Bn,"LI",{});var Hi=s(Vo);Xe=r(Hi,"A",{href:!0,rel:!0});var Ri=s(Xe);Fr=i(Ri,"Fine-tuning Notebook"),Ri.forEach(o),Hi.forEach(o),Ir=u(Bn),No=r(Bn,"LI",{});var Ki=s(No);Ye=r(Ki,"A",{href:!0,rel:!0});var Bi=s(Ye);Ar=i(Bi,"All models"),Bi.forEach(o),Ki.forEach(o),Bn.forEach(o),En=u(t),ee=r(t,"H2",{class:!0});var Jn=s(ee);Pe=r(Jn,"A",{id:!0,class:!0,href:!0});var Ji=s(Pe);Lo=r(Ji,"SPAN",{});var Qi=s(Lo);b(Ze.$$.fragment,Qi),Qi.forEach(o),Ji.forEach(o),Vr=u(Jn),Do=r(Jn,"SPAN",{});var Xi=s(Do);Nr=i(Xi,"Pix2StructConfig"),Xi.forEach(o),Jn.forEach(o),Mn=u(t),E=r(t,"DIV",{class:!0});var J=s(E);b(et.$$.fragment,J),Lr=u(J),B=r(J,"P",{});var Wt=s(B);Yt=r(Wt,"A",{href:!0});var Yi=s(Yt);Dr=i(Yi,"Pix2StructConfig"),Yi.forEach(o),Or=i(Wt,` is the configuration class to store the configuration of a
`),Zt=r(Wt,"A",{href:!0});var Zi=s(Zt);Gr=i(Zi,"Pix2StructForConditionalGeneration"),Zi.forEach(o),Ur=i(Wt,`. 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
`),tt=r(Wt,"A",{href:!0,rel:!0});var ec=s(tt);Wr=i(ec,"google/pix2struct-base"),ec.forEach(o),Hr=i(Wt," architecture."),Wt.forEach(o),Rr=u(J),te=r(J,"P",{});var wo=s(te);Kr=i(wo,"Configuration objects inherit from "),eo=r(wo,"A",{href:!0});var tc=s(eo);Br=i(tc,"PretrainedConfig"),tc.forEach(o),Jr=i(wo,` and can be used to control the model outputs. Read the
documentation from `),to=r(wo,"A",{href:!0});var oc=s(to);Qr=i(oc,"PretrainedConfig"),oc.forEach(o),Xr=i(wo," for more information."),wo.forEach(o),Yr=u(J),b(be.$$.fragment,J),Zr=u(J),we=r(J,"DIV",{class:!0});var Qn=s(we);b(ot.$$.fragment,Qn),es=u(Qn),nt=r(Qn,"P",{});var Xn=s(nt);ts=i(Xn,"Instantiate a "),oo=r(Xn,"A",{href:!0});var nc=s(oo);os=i(nc,"Pix2StructConfig"),nc.forEach(o),ns=i(Xn,` (or a derived class) from pix2struct text model configuration and pix2struct
vision model configuration.`),Xn.forEach(o),Qn.forEach(o),J.forEach(o),jn=u(t),oe=r(t,"H2",{class:!0});var Yn=s(oe);ye=r(Yn,"A",{id:!0,class:!0,href:!0});var rc=s(ye);Oo=r(rc,"SPAN",{});var sc=s(Oo);b(rt.$$.fragment,sc),sc.forEach(o),rc.forEach(o),rs=u(Yn),Go=r(Yn,"SPAN",{});var ac=s(Go);ss=i(ac,"Pix2StructTextConfig"),ac.forEach(o),Yn.forEach(o),qn=u(t),I=r(t,"DIV",{class:!0});var Ge=s(I);b(st.$$.fragment,Ge),as=u(Ge),ne=r(Ge,"P",{});var yo=s(ne);is=i(yo,"This is the configuration class to store the configuration of a "),no=r(yo,"A",{href:!0});var ic=s(no);cs=i(ic,"Pix2StructTextModel"),ic.forEach(o),ds=i(yo,`. 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 `),at=r(yo,"A",{href:!0,rel:!0});var cc=s(at);ls=i(cc,"google/pix2struct-base"),cc.forEach(o),us=i(yo," architecture."),yo.forEach(o),ps=u(Ge),re=r(Ge,"P",{});var To=s(re);hs=i(To,"Configuration objects inherit from "),ro=r(To,"A",{href:!0});var dc=s(ro);ms=i(dc,"PretrainedConfig"),dc.forEach(o),fs=i(To,` and can be used to control the model outputs. Read the
documentation from `),so=r(To,"A",{href:!0});var lc=s(so);gs=i(lc,"PretrainedConfig"),lc.forEach(o),_s=i(To," for more information."),To.forEach(o),xs=u(Ge),b(Te.$$.fragment,Ge),Ge.forEach(o),Fn=u(t),se=r(t,"H2",{class:!0});var Zn=s(se);Se=r(Zn,"A",{id:!0,class:!0,href:!0});var uc=s(Se);Uo=r(uc,"SPAN",{});var pc=s(Uo);b(it.$$.fragment,pc),pc.forEach(o),uc.forEach(o),vs=u(Zn),Wo=r(Zn,"SPAN",{});var hc=s(Wo);Ps=i(hc,"Pix2StructVisionConfig"),hc.forEach(o),Zn.forEach(o),In=u(t),A=r(t,"DIV",{class:!0});var Ue=s(A);b(ct.$$.fragment,Ue),bs=u(Ue),ae=r(Ue,"P",{});var So=s(ae);ws=i(So,"This is the configuration class to store the configuration of a "),ao=r(So,"A",{href:!0});var mc=s(ao);ys=i(mc,"Pix2StructVisionModel"),mc.forEach(o),Ts=i(So,`. 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
`),dt=r(So,"A",{href:!0,rel:!0});var fc=s(dt);Ss=i(fc,"google/pix2struct-base"),fc.forEach(o),$s=i(So," architecture."),So.forEach(o),ks=u(Ue),ie=r(Ue,"P",{});var $o=s(ie);Cs=i($o,"Configuration objects inherit from "),io=r($o,"A",{href:!0});var gc=s(io);zs=i(gc,"PretrainedConfig"),gc.forEach(o),Es=i($o,` and can be used to control the model outputs. Read the
documentation from `),co=r($o,"A",{href:!0});var _c=s(co);Ms=i(_c,"PretrainedConfig"),_c.forEach(o),js=i($o," for more information."),$o.forEach(o),qs=u(Ue),b($e.$$.fragment,Ue),Ue.forEach(o),An=u(t),ce=r(t,"H2",{class:!0});var er=s(ce);ke=r(er,"A",{id:!0,class:!0,href:!0});var xc=s(ke);Ho=r(xc,"SPAN",{});var vc=s(Ho);b(lt.$$.fragment,vc),vc.forEach(o),xc.forEach(o),Fs=u(er),Ro=r(er,"SPAN",{});var Pc=s(Ro);Is=i(Pc,"Pix2StructProcessor"),Pc.forEach(o),er.forEach(o),Vn=u(t),M=r(t,"DIV",{class:!0});var Q=s(M);b(ut.$$.fragment,Q),As=u(Q),Ko=r(Q,"P",{});var bc=s(Ko);Vs=i(bc,`Constructs a PIX2STRUCT processor which wraps a BERT tokenizer and PIX2STRUCT image processor into a single
processor.`),bc.forEach(o),Ns=u(Q),F=r(Q,"P",{});var H=s(F);lo=r(H,"A",{href:!0});var wc=s(lo);Ls=i(wc,"Pix2StructProcessor"),wc.forEach(o),Ds=i(H," offers all the functionalities of "),uo=r(H,"A",{href:!0});var yc=s(uo);Os=i(yc,"Pix2StructImageProcessor"),yc.forEach(o),Gs=i(H," and "),po=r(H,"A",{href:!0});var Tc=s(po);Us=i(Tc,"T5TokenizerFast"),Tc.forEach(o),Ws=i(H,`. See
the docstring of `),Bo=r(H,"CODE",{});var Sc=s(Bo);Hs=i(Sc,"__call__()"),Sc.forEach(o),Rs=i(H," and "),ho=r(H,"A",{href:!0});var $c=s(ho);Ks=i($c,"decode()"),$c.forEach(o),Bs=i(H," for more information."),H.forEach(o),Js=u(Q),Ce=r(Q,"DIV",{class:!0});var tr=s(Ce);b(pt.$$.fragment,tr),Qs=u(tr),ht=r(tr,"P",{});var or=s(ht);Xs=i(or,"This method forwards all its arguments to Pix2StructTokenizerFast\u2019s "),mo=r(or,"A",{href:!0});var kc=s(mo);Ys=i(kc,"batch_decode()"),kc.forEach(o),Zs=i(or,`.
Please refer to the docstring of this method for more information.`),or.forEach(o),tr.forEach(o),ea=u(Q),ze=r(Q,"DIV",{class:!0});var nr=s(ze);b(mt.$$.fragment,nr),ta=u(nr),ft=r(nr,"P",{});var rr=s(ft);oa=i(rr,"This method forwards all its arguments to Pix2StructTokenizerFast\u2019s "),fo=r(rr,"A",{href:!0});var Cc=s(fo);na=i(Cc,"decode()"),Cc.forEach(o),ra=i(rr,`. Please
refer to the docstring of this method for more information.`),rr.forEach(o),nr.forEach(o),Q.forEach(o),Nn=u(t),de=r(t,"H2",{class:!0});var sr=s(de);Ee=r(sr,"A",{id:!0,class:!0,href:!0});var zc=s(Ee);Jo=r(zc,"SPAN",{});var Ec=s(Jo);b(gt.$$.fragment,Ec),Ec.forEach(o),zc.forEach(o),sa=u(sr),Qo=r(sr,"SPAN",{});var Mc=s(Qo);aa=i(Mc,"Pix2StructImageProcessor"),Mc.forEach(o),sr.forEach(o),Ln=u(t),U=r(t,"DIV",{class:!0});var ko=s(U);b(_t.$$.fragment,ko),ia=u(ko),Xo=r(ko,"P",{});var jc=s(Xo);ca=i(jc,"Constructs a Pix2Struct image processor."),jc.forEach(o),da=u(ko),Me=r(ko,"DIV",{class:!0});var ar=s(Me);b(xt.$$.fragment,ar),la=u(ar),V=r(ar,"P",{});var X=s(V);ua=i(X,`Preprocess an image or batch of images. The processor first computes the maximum possible number of
aspect-ratio preserving patches of size `),Yo=r(X,"CODE",{});var qc=s(Yo);pa=i(qc,"patch_size"),qc.forEach(o),ha=i(X,` that can be extracted from the image. It then pads the
image with zeros to make the image respect the constraint of `),Zo=r(X,"CODE",{});var Fc=s(Zo);ma=i(Fc,"max_patches"),Fc.forEach(o),fa=i(X,`. Before extracting the patches the
images are standardized following the tensorflow implementation of `),en=r(X,"CODE",{});var Ic=s(en);ga=i(Ic,"per_image_standardization"),Ic.forEach(o),_a=i(X,`
(`),vt=r(X,"A",{href:!0,rel:!0});var Ac=s(vt);xa=i(Ac,"https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization"),Ac.forEach(o),va=i(X,")."),X.forEach(o),ar.forEach(o),ko.forEach(o),Dn=u(t),le=r(t,"H2",{class:!0});var ir=s(le);je=r(ir,"A",{id:!0,class:!0,href:!0});var Vc=s(je);tn=r(Vc,"SPAN",{});var Nc=s(tn);b(Pt.$$.fragment,Nc),Nc.forEach(o),Vc.forEach(o),Pa=u(ir),on=r(ir,"SPAN",{});var Lc=s(on);ba=i(Lc,"Pix2StructTextModel"),Lc.forEach(o),ir.forEach(o),On=u(t),k=r(t,"DIV",{class:!0});var D=s(k);b(bt.$$.fragment,D),wa=u(D),nn=r(D,"P",{});var Dc=s(nn);ya=i(Dc,"The standalone text decoder of Pix2Struct"),Dc.forEach(o),Ta=u(D),wt=r(D,"P",{});var cr=s(wt);Sa=i(cr,"The Pix2Struct model was proposed in "),yt=r(cr,"A",{href:!0,rel:!0});var Oc=s(yt);$a=i(Oc,`Pix2Struct: Screenshot Parsing as Pretraining for Visual Language
Understanding`),Oc.forEach(o),ka=i(cr,` by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu,
Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, Kristina Toutanova. It\u2019s an encoder decoder
transformer pre-trained in a image-to-text setting.`),cr.forEach(o),Ca=u(D),Tt=r(D,"P",{});var dr=s(Tt);za=i(dr,"This model inherits from "),go=r(dr,"A",{href:!0});var Gc=s(go);Ea=i(Gc,"PreTrainedModel"),Gc.forEach(o),Ma=i(dr,`. 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.)`),dr.forEach(o),ja=u(D),St=r(D,"P",{});var lr=s(St);qa=i(lr,"This model is also a PyTorch "),$t=r(lr,"A",{href:!0,rel:!0});var Uc=s($t);Fa=i(Uc,"torch.nn.Module"),Uc.forEach(o),Ia=i(lr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),lr.forEach(o),Aa=u(D),N=r(D,"DIV",{class:!0});var We=s(N);b(kt.$$.fragment,We),Va=u(We),ue=r(We,"P",{});var Co=s(ue);Na=i(Co,"The "),_o=r(Co,"A",{href:!0});var Wc=s(_o);La=i(Wc,"Pix2StructTextModel"),Wc.forEach(o),Da=i(Co," forward method, overrides the "),rn=r(Co,"CODE",{});var Hc=s(rn);Oa=i(Hc,"__call__"),Hc.forEach(o),Ga=i(Co," special method."),Co.forEach(o),Ua=u(We),b(qe.$$.fragment,We),Wa=u(We),b(Fe.$$.fragment,We),We.forEach(o),D.forEach(o),Gn=u(t),pe=r(t,"H2",{class:!0});var ur=s(pe);Ie=r(ur,"A",{id:!0,class:!0,href:!0});var Rc=s(Ie);sn=r(Rc,"SPAN",{});var Kc=s(sn);b(Ct.$$.fragment,Kc),Kc.forEach(o),Rc.forEach(o),Ha=u(ur),an=r(ur,"SPAN",{});var Bc=s(an);Ra=i(Bc,"Pix2StructVisionModel"),Bc.forEach(o),ur.forEach(o),Un=u(t),W=r(t,"DIV",{class:!0});var zo=s(W);b(zt.$$.fragment,zo),Ka=u(zo),Et=r(zo,"P",{});var pr=s(Et);Ba=i(pr,`The bare Pix2StructVision Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Mt=r(pr,"A",{href:!0,rel:!0});var Jc=s(Mt);Ja=i(Jc,"torch.nn.Module"),Jc.forEach(o),Qa=i(pr,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),pr.forEach(o),Xa=u(zo),L=r(zo,"DIV",{class:!0});var He=s(L);b(jt.$$.fragment,He),Ya=u(He),he=r(He,"P",{});var Eo=s(he);Za=i(Eo,"The "),xo=r(Eo,"A",{href:!0});var Qc=s(xo);ei=i(Qc,"Pix2StructVisionModel"),Qc.forEach(o),ti=i(Eo," forward method, overrides the "),cn=r(Eo,"CODE",{});var Xc=s(cn);oi=i(Xc,"__call__"),Xc.forEach(o),ni=i(Eo," special method."),Eo.forEach(o),ri=u(He),b(Ae.$$.fragment,He),si=u(He),b(Ve.$$.fragment,He),He.forEach(o),zo.forEach(o),Wn=u(t),me=r(t,"H2",{class:!0});var hr=s(me);Ne=r(hr,"A",{id:!0,class:!0,href:!0});var Yc=s(Ne);dn=r(Yc,"SPAN",{});var Zc=s(dn);b(qt.$$.fragment,Zc),Zc.forEach(o),Yc.forEach(o),ai=u(hr),ln=r(hr,"SPAN",{});var ed=s(ln);ii=i(ed,"Pix2StructForConditionalGeneration"),ed.forEach(o),hr.forEach(o),Hn=u(t),C=r(t,"DIV",{class:!0});var O=s(C);b(Ft.$$.fragment,O),ci=u(O),un=r(O,"P",{});var td=s(un);di=i(td,"A conditional generation model with a language modeling head. Can be used for sequence generation tasks."),td.forEach(o),li=u(O),It=r(O,"P",{});var mr=s(It);ui=i(mr,"The Pix2Struct model was proposed in "),At=r(mr,"A",{href:!0,rel:!0});var od=s(At);pi=i(od,`Pix2Struct: Screenshot Parsing as Pretraining for Visual Language
Understanding`),od.forEach(o),hi=i(mr,` by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu,
Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, Kristina Toutanova. It\u2019s an encoder decoder
transformer pre-trained in a image-to-text setting.`),mr.forEach(o),mi=u(O),Vt=r(O,"P",{});var fr=s(Vt);fi=i(fr,"This model inherits from "),vo=r(fr,"A",{href:!0});var nd=s(vo);gi=i(nd,"PreTrainedModel"),nd.forEach(o),_i=i(fr,`. 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.)`),fr.forEach(o),xi=u(O),Nt=r(O,"P",{});var gr=s(Nt);vi=i(gr,"This model is also a PyTorch "),Lt=r(gr,"A",{href:!0,rel:!0});var rd=s(Lt);Pi=i(rd,"torch.nn.Module"),rd.forEach(o),bi=i(gr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),gr.forEach(o),wi=u(O),z=r(O,"DIV",{class:!0});var G=s(z);b(Dt.$$.fragment,G),yi=u(G),fe=r(G,"P",{});var Mo=s(fe);Ti=i(Mo,"The "),Po=r(Mo,"A",{href:!0});var sd=s(Po);Si=i(sd,"Pix2StructForConditionalGeneration"),sd.forEach(o),$i=i(Mo," forward method, overrides the "),pn=r(Mo,"CODE",{});var ad=s(pn);ki=i(ad,"__call__"),ad.forEach(o),Ci=i(Mo," special method."),Mo.forEach(o),zi=u(G),b(Le.$$.fragment,G),Ei=u(G),hn=r(G,"P",{});var id=s(hn);Mi=i(id,"Example:"),id.forEach(o),ji=u(G),b(De.$$.fragment,G),qi=u(G),b(Oe.$$.fragment,G),G.forEach(o),O.forEach(o),this.h()},h(){d(p,"name","hf:doc:metadata"),d(p,"content",JSON.stringify(Td)),d(h,"id","pix2struct"),d(h,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(h,"href","#pix2struct"),d(_,"class","relative group"),d(ge,"id","overview"),d(ge,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ge,"href","#overview"),d(Y,"class","relative group"),d(Ke,"href","https://arxiv.org/abs/2210.03347"),d(Ke,"rel","nofollow"),d(Be,"href","https://huggingface.co/ybelkada"),d(Be,"rel","nofollow"),d(Je,"href","https://github.com/google-research/pix2struct"),d(Je,"rel","nofollow"),d(xe,"id","resources"),d(xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(xe,"href","#resources"),d(Z,"class","relative group"),d(Xe,"href","https://github.com/huggingface/notebooks/blob/main/examples/image_captioning_pix2struct.ipynb"),d(Xe,"rel","nofollow"),d(Ye,"href","https://huggingface.co/models?search=pix2struct"),d(Ye,"rel","nofollow"),d(Pe,"id","transformers.Pix2StructConfig"),d(Pe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Pe,"href","#transformers.Pix2StructConfig"),d(ee,"class","relative group"),d(Yt,"href","/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructConfig"),d(Zt,"href","/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructForConditionalGeneration"),d(tt,"href","https://huggingface.co/google/pix2struct-base"),d(tt,"rel","nofollow"),d(eo,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(to,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(oo,"href","/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructConfig"),d(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ye,"id","transformers.Pix2StructTextConfig"),d(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ye,"href","#transformers.Pix2StructTextConfig"),d(oe,"class","relative group"),d(no,"href","/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructTextModel"),d(at,"href","https://huggingface.co/google/pix2struct-base"),d(at,"rel","nofollow"),d(ro,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(so,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Se,"id","transformers.Pix2StructVisionConfig"),d(Se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Se,"href","#transformers.Pix2StructVisionConfig"),d(se,"class","relative group"),d(ao,"href","/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructVisionModel"),d(dt,"href","https://huggingface.co/google/pix2struct-base"),d(dt,"rel","nofollow"),d(io,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(co,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ke,"id","transformers.Pix2StructProcessor"),d(ke,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ke,"href","#transformers.Pix2StructProcessor"),d(ce,"class","relative group"),d(lo,"href","/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructProcessor"),d(uo,"href","/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructImageProcessor"),d(po,"href","/docs/transformers/v4.29.0/en/model_doc/t5#transformers.T5TokenizerFast"),d(ho,"href","/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructProcessor.decode"),d(mo,"href","/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.batch_decode"),d(Ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(fo,"href","/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.decode"),d(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ee,"id","transformers.Pix2StructImageProcessor"),d(Ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ee,"href","#transformers.Pix2StructImageProcessor"),d(de,"class","relative group"),d(vt,"href","https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization"),d(vt,"rel","nofollow"),d(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(je,"id","transformers.Pix2StructTextModel"),d(je,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(je,"href","#transformers.Pix2StructTextModel"),d(le,"class","relative group"),d(yt,"href","https://arxiv.org/abs/2210.03347"),d(yt,"rel","nofollow"),d(go,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),d($t,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d($t,"rel","nofollow"),d(_o,"href","/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructTextModel"),d(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ie,"id","transformers.Pix2StructVisionModel"),d(Ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ie,"href","#transformers.Pix2StructVisionModel"),d(pe,"class","relative group"),d(Mt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Mt,"rel","nofollow"),d(xo,"href","/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructVisionModel"),d(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ne,"id","transformers.Pix2StructForConditionalGeneration"),d(Ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ne,"href","#transformers.Pix2StructForConditionalGeneration"),d(me,"class","relative group"),d(At,"href","https://arxiv.org/abs/2210.03347"),d(At,"rel","nofollow"),d(vo,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),d(Lt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Lt,"rel","nofollow"),d(Po,"href","/docs/transformers/v4.29.0/en/model_doc/pix2struct#transformers.Pix2StructForConditionalGeneration"),d(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,m){e(document.head,p),g(t,v,m),g(t,_,m),e(_,h),e(h,x),w(c,x,null),e(_,f),e(_,q),e(q,_r),g(t,bn,m),g(t,Y,m),e(Y,ge),e(ge,jo),w(Re,jo,null),e(Y,xr),e(Y,qo),e(qo,vr),g(t,wn,m),g(t,_e,m),e(_e,Pr),e(_e,Ke),e(Ke,br),e(_e,wr),g(t,yn,m),g(t,Bt,m),e(Bt,yr),g(t,Tn,m),g(t,Jt,m),e(Jt,Fo),e(Fo,Tr),g(t,Sn,m),g(t,Qt,m),e(Qt,Sr),g(t,$n,m),g(t,Xt,m),e(Xt,$r),g(t,kn,m),g(t,K,m),e(K,kr),e(K,Be),e(Be,Cr),e(K,zr),e(K,Je),e(Je,Er),e(K,Mr),g(t,Cn,m),g(t,Z,m),e(Z,xe),e(xe,Io),w(Qe,Io,null),e(Z,jr),e(Z,Ao),e(Ao,qr),g(t,zn,m),g(t,ve,m),e(ve,Vo),e(Vo,Xe),e(Xe,Fr),e(ve,Ir),e(ve,No),e(No,Ye),e(Ye,Ar),g(t,En,m),g(t,ee,m),e(ee,Pe),e(Pe,Lo),w(Ze,Lo,null),e(ee,Vr),e(ee,Do),e(Do,Nr),g(t,Mn,m),g(t,E,m),w(et,E,null),e(E,Lr),e(E,B),e(B,Yt),e(Yt,Dr),e(B,Or),e(B,Zt),e(Zt,Gr),e(B,Ur),e(B,tt),e(tt,Wr),e(B,Hr),e(E,Rr),e(E,te),e(te,Kr),e(te,eo),e(eo,Br),e(te,Jr),e(te,to),e(to,Qr),e(te,Xr),e(E,Yr),w(be,E,null),e(E,Zr),e(E,we),w(ot,we,null),e(we,es),e(we,nt),e(nt,ts),e(nt,oo),e(oo,os),e(nt,ns),g(t,jn,m),g(t,oe,m),e(oe,ye),e(ye,Oo),w(rt,Oo,null),e(oe,rs),e(oe,Go),e(Go,ss),g(t,qn,m),g(t,I,m),w(st,I,null),e(I,as),e(I,ne),e(ne,is),e(ne,no),e(no,cs),e(ne,ds),e(ne,at),e(at,ls),e(ne,us),e(I,ps),e(I,re),e(re,hs),e(re,ro),e(ro,ms),e(re,fs),e(re,so),e(so,gs),e(re,_s),e(I,xs),w(Te,I,null),g(t,Fn,m),g(t,se,m),e(se,Se),e(Se,Uo),w(it,Uo,null),e(se,vs),e(se,Wo),e(Wo,Ps),g(t,In,m),g(t,A,m),w(ct,A,null),e(A,bs),e(A,ae),e(ae,ws),e(ae,ao),e(ao,ys),e(ae,Ts),e(ae,dt),e(dt,Ss),e(ae,$s),e(A,ks),e(A,ie),e(ie,Cs),e(ie,io),e(io,zs),e(ie,Es),e(ie,co),e(co,Ms),e(ie,js),e(A,qs),w($e,A,null),g(t,An,m),g(t,ce,m),e(ce,ke),e(ke,Ho),w(lt,Ho,null),e(ce,Fs),e(ce,Ro),e(Ro,Is),g(t,Vn,m),g(t,M,m),w(ut,M,null),e(M,As),e(M,Ko),e(Ko,Vs),e(M,Ns),e(M,F),e(F,lo),e(lo,Ls),e(F,Ds),e(F,uo),e(uo,Os),e(F,Gs),e(F,po),e(po,Us),e(F,Ws),e(F,Bo),e(Bo,Hs),e(F,Rs),e(F,ho),e(ho,Ks),e(F,Bs),e(M,Js),e(M,Ce),w(pt,Ce,null),e(Ce,Qs),e(Ce,ht),e(ht,Xs),e(ht,mo),e(mo,Ys),e(ht,Zs),e(M,ea),e(M,ze),w(mt,ze,null),e(ze,ta),e(ze,ft),e(ft,oa),e(ft,fo),e(fo,na),e(ft,ra),g(t,Nn,m),g(t,de,m),e(de,Ee),e(Ee,Jo),w(gt,Jo,null),e(de,sa),e(de,Qo),e(Qo,aa),g(t,Ln,m),g(t,U,m),w(_t,U,null),e(U,ia),e(U,Xo),e(Xo,ca),e(U,da),e(U,Me),w(xt,Me,null),e(Me,la),e(Me,V),e(V,ua),e(V,Yo),e(Yo,pa),e(V,ha),e(V,Zo),e(Zo,ma),e(V,fa),e(V,en),e(en,ga),e(V,_a),e(V,vt),e(vt,xa),e(V,va),g(t,Dn,m),g(t,le,m),e(le,je),e(je,tn),w(Pt,tn,null),e(le,Pa),e(le,on),e(on,ba),g(t,On,m),g(t,k,m),w(bt,k,null),e(k,wa),e(k,nn),e(nn,ya),e(k,Ta),e(k,wt),e(wt,Sa),e(wt,yt),e(yt,$a),e(wt,ka),e(k,Ca),e(k,Tt),e(Tt,za),e(Tt,go),e(go,Ea),e(Tt,Ma),e(k,ja),e(k,St),e(St,qa),e(St,$t),e($t,Fa),e(St,Ia),e(k,Aa),e(k,N),w(kt,N,null),e(N,Va),e(N,ue),e(ue,Na),e(ue,_o),e(_o,La),e(ue,Da),e(ue,rn),e(rn,Oa),e(ue,Ga),e(N,Ua),w(qe,N,null),e(N,Wa),w(Fe,N,null),g(t,Gn,m),g(t,pe,m),e(pe,Ie),e(Ie,sn),w(Ct,sn,null),e(pe,Ha),e(pe,an),e(an,Ra),g(t,Un,m),g(t,W,m),w(zt,W,null),e(W,Ka),e(W,Et),e(Et,Ba),e(Et,Mt),e(Mt,Ja),e(Et,Qa),e(W,Xa),e(W,L),w(jt,L,null),e(L,Ya),e(L,he),e(he,Za),e(he,xo),e(xo,ei),e(he,ti),e(he,cn),e(cn,oi),e(he,ni),e(L,ri),w(Ae,L,null),e(L,si),w(Ve,L,null),g(t,Wn,m),g(t,me,m),e(me,Ne),e(Ne,dn),w(qt,dn,null),e(me,ai),e(me,ln),e(ln,ii),g(t,Hn,m),g(t,C,m),w(Ft,C,null),e(C,ci),e(C,un),e(un,di),e(C,li),e(C,It),e(It,ui),e(It,At),e(At,pi),e(It,hi),e(C,mi),e(C,Vt),e(Vt,fi),e(Vt,vo),e(vo,gi),e(Vt,_i),e(C,xi),e(C,Nt),e(Nt,vi),e(Nt,Lt),e(Lt,Pi),e(Nt,bi),e(C,wi),e(C,z),w(Dt,z,null),e(z,yi),e(z,fe),e(fe,Ti),e(fe,Po),e(Po,Si),e(fe,$i),e(fe,pn),e(pn,ki),e(fe,Ci),e(z,zi),w(Le,z,null),e(z,Ei),e(z,hn),e(hn,Mi),e(z,ji),w(De,z,null),e(z,qi),w(Oe,z,null),Rn=!0},p(t,[m]){const Ot={};m&2&&(Ot.$$scope={dirty:m,ctx:t}),be.$set(Ot);const mn={};m&2&&(mn.$$scope={dirty:m,ctx:t}),Te.$set(mn);const fn={};m&2&&(fn.$$scope={dirty:m,ctx:t}),$e.$set(fn);const gn={};m&2&&(gn.$$scope={dirty:m,ctx:t}),qe.$set(gn);const Gt={};m&2&&(Gt.$$scope={dirty:m,ctx:t}),Fe.$set(Gt);const _n={};m&2&&(_n.$$scope={dirty:m,ctx:t}),Ae.$set(_n);const xn={};m&2&&(xn.$$scope={dirty:m,ctx:t}),Ve.$set(xn);const vn={};m&2&&(vn.$$scope={dirty:m,ctx:t}),Le.$set(vn);const Ut={};m&2&&(Ut.$$scope={dirty:m,ctx:t}),De.$set(Ut);const Pn={};m&2&&(Pn.$$scope={dirty:m,ctx:t}),Oe.$set(Pn)},i(t){Rn||(y(c.$$.fragment,t),y(Re.$$.fragment,t),y(Qe.$$.fragment,t),y(Ze.$$.fragment,t),y(et.$$.fragment,t),y(be.$$.fragment,t),y(ot.$$.fragment,t),y(rt.$$.fragment,t),y(st.$$.fragment,t),y(Te.$$.fragment,t),y(it.$$.fragment,t),y(ct.$$.fragment,t),y($e.$$.fragment,t),y(lt.$$.fragment,t),y(ut.$$.fragment,t),y(pt.$$.fragment,t),y(mt.$$.fragment,t),y(gt.$$.fragment,t),y(_t.$$.fragment,t),y(xt.$$.fragment,t),y(Pt.$$.fragment,t),y(bt.$$.fragment,t),y(kt.$$.fragment,t),y(qe.$$.fragment,t),y(Fe.$$.fragment,t),y(Ct.$$.fragment,t),y(zt.$$.fragment,t),y(jt.$$.fragment,t),y(Ae.$$.fragment,t),y(Ve.$$.fragment,t),y(qt.$$.fragment,t),y(Ft.$$.fragment,t),y(Dt.$$.fragment,t),y(Le.$$.fragment,t),y(De.$$.fragment,t),y(Oe.$$.fragment,t),Rn=!0)},o(t){T(c.$$.fragment,t),T(Re.$$.fragment,t),T(Qe.$$.fragment,t),T(Ze.$$.fragment,t),T(et.$$.fragment,t),T(be.$$.fragment,t),T(ot.$$.fragment,t),T(rt.$$.fragment,t),T(st.$$.fragment,t),T(Te.$$.fragment,t),T(it.$$.fragment,t),T(ct.$$.fragment,t),T($e.$$.fragment,t),T(lt.$$.fragment,t),T(ut.$$.fragment,t),T(pt.$$.fragment,t),T(mt.$$.fragment,t),T(gt.$$.fragment,t),T(_t.$$.fragment,t),T(xt.$$.fragment,t),T(Pt.$$.fragment,t),T(bt.$$.fragment,t),T(kt.$$.fragment,t),T(qe.$$.fragment,t),T(Fe.$$.fragment,t),T(Ct.$$.fragment,t),T(zt.$$.fragment,t),T(jt.$$.fragment,t),T(Ae.$$.fragment,t),T(Ve.$$.fragment,t),T(qt.$$.fragment,t),T(Ft.$$.fragment,t),T(Dt.$$.fragment,t),T(Le.$$.fragment,t),T(De.$$.fragment,t),T(Oe.$$.fragment,t),Rn=!1},d(t){o(p),t&&o(v),t&&o(_),S(c),t&&o(bn),t&&o(Y),S(Re),t&&o(wn),t&&o(_e),t&&o(yn),t&&o(Bt),t&&o(Tn),t&&o(Jt),t&&o(Sn),t&&o(Qt),t&&o($n),t&&o(Xt),t&&o(kn),t&&o(K),t&&o(Cn),t&&o(Z),S(Qe),t&&o(zn),t&&o(ve),t&&o(En),t&&o(ee),S(Ze),t&&o(Mn),t&&o(E),S(et),S(be),S(ot),t&&o(jn),t&&o(oe),S(rt),t&&o(qn),t&&o(I),S(st),S(Te),t&&o(Fn),t&&o(se),S(it),t&&o(In),t&&o(A),S(ct),S($e),t&&o(An),t&&o(ce),S(lt),t&&o(Vn),t&&o(M),S(ut),S(pt),S(mt),t&&o(Nn),t&&o(de),S(gt),t&&o(Ln),t&&o(U),S(_t),S(xt),t&&o(Dn),t&&o(le),S(Pt),t&&o(On),t&&o(k),S(bt),S(kt),S(qe),S(Fe),t&&o(Gn),t&&o(pe),S(Ct),t&&o(Un),t&&o(W),S(zt),S(jt),S(Ae),S(Ve),t&&o(Wn),t&&o(me),S(qt),t&&o(Hn),t&&o(C),S(Ft),S(Dt),S(Le),S(De),S(Oe)}}}const Td={local:"pix2struct",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.Pix2StructConfig",title:"Pix2StructConfig"},{local:"transformers.Pix2StructTextConfig",title:"Pix2StructTextConfig"},{local:"transformers.Pix2StructVisionConfig",title:"Pix2StructVisionConfig"},{local:"transformers.Pix2StructProcessor",title:"Pix2StructProcessor"},{local:"transformers.Pix2StructImageProcessor",title:"Pix2StructImageProcessor"},{local:"transformers.Pix2StructTextModel",title:"Pix2StructTextModel"},{local:"transformers.Pix2StructVisionModel",title:"Pix2StructVisionModel"},{local:"transformers.Pix2StructForConditionalGeneration",title:"Pix2StructForConditionalGeneration"}],title:"Pix2Struct"};function Sd($){return pd(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class jd extends cd{constructor(p){super();dd(this,p,Sd,yd,ld,{})}}export{jd as default,Td as metadata};
