import{S as rm,i as im,s as lm,e as a,k as l,w as b,t as r,M as dm,c as n,d as t,m as d,a as s,x as y,h as i,b as m,N as cm,G as e,g as h,y as I,q as P,o as w,B as k,v as mm,L as Ln}from"../../chunks/vendor-hf-doc-builder.js";import{T as Kl}from"../../chunks/Tip-hf-doc-builder.js";import{D as te}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Rn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as be}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Sn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as pm}from"../../chunks/PipelineTag-hf-doc-builder.js";function hm($){let g,v,_,u,T;return u=new Rn({props:{code:`from transformers import ImageGPTConfig, ImageGPTModel

# Initializing a ImageGPT configuration
configuration = ImageGPTConfig()

# Initializing a model (with random weights) from the configuration
model = ImageGPTModel(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> ImageGPTConfig, ImageGPTModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ImageGPT configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = ImageGPTConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ImageGPTModel(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(){g=a("p"),v=r("Example:"),_=l(),b(u.$$.fragment)},l(c){g=n(c,"P",{});var f=s(g);v=i(f,"Example:"),f.forEach(t),_=d(c),y(u.$$.fragment,c)},m(c,f){h(c,g,f),e(g,v),h(c,_,f),I(u,c,f),T=!0},p:Ln,i(c){T||(P(u.$$.fragment,c),T=!0)},o(c){w(u.$$.fragment,c),T=!1},d(c){c&&t(g),c&&t(_),k(u,c)}}}function gm($){let g,v,_,u,T;return{c(){g=a("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),u=r("Module"),T=r(`
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){g=n(c,"P",{});var f=s(g);v=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(f,"CODE",{});var N=s(_);u=i(N,"Module"),N.forEach(t),T=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(t)},m(c,f){h(c,g,f),e(g,v),e(g,_),e(_,u),e(g,T)},d(c){c&&t(g)}}}function um($){let g,v,_,u,T;return u=new Rn({props:{code:`from transformers import AutoImageProcessor, ImageGPTModel
from PIL import Image
import requests

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

image_processor = AutoImageProcessor.from_pretrained("openai/imagegpt-small")
model = ImageGPTModel.from_pretrained("openai/imagegpt-small")

inputs = image_processor(images=image, return_tensors="pt")
outputs = model(**inputs)
last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ImageGPTModel
<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>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.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>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;openai/imagegpt-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ImageGPTModel.from_pretrained(<span class="hljs-string">&quot;openai/imagegpt-small&quot;</span>)

<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>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){g=a("p"),v=r("Examples:"),_=l(),b(u.$$.fragment)},l(c){g=n(c,"P",{});var f=s(g);v=i(f,"Examples:"),f.forEach(t),_=d(c),y(u.$$.fragment,c)},m(c,f){h(c,g,f),e(g,v),h(c,_,f),I(u,c,f),T=!0},p:Ln,i(c){T||(P(u.$$.fragment,c),T=!0)},o(c){w(u.$$.fragment,c),T=!1},d(c){c&&t(g),c&&t(_),k(u,c)}}}function fm($){let g,v,_,u,T;return{c(){g=a("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),u=r("Module"),T=r(`
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){g=n(c,"P",{});var f=s(g);v=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(f,"CODE",{});var N=s(_);u=i(N,"Module"),N.forEach(t),T=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(t)},m(c,f){h(c,g,f),e(g,v),e(g,_),e(_,u),e(g,T)},d(c){c&&t(g)}}}function _m($){let g,v,_,u,T;return u=new Rn({props:{code:`from transformers import AutoImageProcessor, ImageGPTForCausalImageModeling
import torch
import matplotlib.pyplot as plt
import numpy as np

image_processor = AutoImageProcessor.from_pretrained("openai/imagegpt-small")
model = ImageGPTForCausalImageModeling.from_pretrained("openai/imagegpt-small")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)

# unconditional generation of 8 images
batch_size = 8
context = torch.full((batch_size, 1), model.config.vocab_size - 1)  # initialize with SOS token
context = torch.tensor(context).to(device)
output = model.generate(
    input_ids=context, max_length=model.config.n_positions + 1, temperature=1.0, do_sample=True, top_k=40
)

clusters = image_processor.clusters
height = image_processor.size["height"]
width = image_processor.size["width"]

samples = output[:, 1:].cpu().detach().numpy()
samples_img = [
    np.reshape(np.rint(127.5 * (clusters[s] + 1.0)), [height, width, 3]).astype(np.uint8) for s in samples
]  # convert color cluster tokens back to pixels
f, axes = plt.subplots(1, batch_size, dpi=300)

for img, ax in zip(samples_img, axes):
    ax.axis("off")
    ax.imshow(img)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ImageGPTForCausalImageModeling
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> matplotlib.pyplot <span class="hljs-keyword">as</span> plt
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;openai/imagegpt-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ImageGPTForCausalImageModeling.from_pretrained(<span class="hljs-string">&quot;openai/imagegpt-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>device = torch.device(<span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.to(device)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># unconditional generation of 8 images</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>batch_size = <span class="hljs-number">8</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>context = torch.full((batch_size, <span class="hljs-number">1</span>), model.config.vocab_size - <span class="hljs-number">1</span>)  <span class="hljs-comment"># initialize with SOS token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>context = torch.tensor(context).to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span>output = model.generate(
<span class="hljs-meta">... </span>    input_ids=context, max_length=model.config.n_positions + <span class="hljs-number">1</span>, temperature=<span class="hljs-number">1.0</span>, do_sample=<span class="hljs-literal">True</span>, top_k=<span class="hljs-number">40</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>clusters = image_processor.clusters
<span class="hljs-meta">&gt;&gt;&gt; </span>height = image_processor.size[<span class="hljs-string">&quot;height&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>width = image_processor.size[<span class="hljs-string">&quot;width&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>samples = output[:, <span class="hljs-number">1</span>:].cpu().detach().numpy()
<span class="hljs-meta">&gt;&gt;&gt; </span>samples_img = [
<span class="hljs-meta">... </span>    np.reshape(np.rint(<span class="hljs-number">127.5</span> * (clusters[s] + <span class="hljs-number">1.0</span>)), [height, width, <span class="hljs-number">3</span>]).astype(np.uint8) <span class="hljs-keyword">for</span> s <span class="hljs-keyword">in</span> samples
<span class="hljs-meta">... </span>]  <span class="hljs-comment"># convert color cluster tokens back to pixels</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>f, axes = plt.subplots(<span class="hljs-number">1</span>, batch_size, dpi=<span class="hljs-number">300</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> img, ax <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(samples_img, axes):
<span class="hljs-meta">... </span>    ax.axis(<span class="hljs-string">&quot;off&quot;</span>)
<span class="hljs-meta">... </span>    ax.imshow(img)`}}),{c(){g=a("p"),v=r("Examples:"),_=l(),b(u.$$.fragment)},l(c){g=n(c,"P",{});var f=s(g);v=i(f,"Examples:"),f.forEach(t),_=d(c),y(u.$$.fragment,c)},m(c,f){h(c,g,f),e(g,v),h(c,_,f),I(u,c,f),T=!0},p:Ln,i(c){T||(P(u.$$.fragment,c),T=!0)},o(c){w(u.$$.fragment,c),T=!1},d(c){c&&t(g),c&&t(_),k(u,c)}}}function Tm($){let g,v,_,u,T;return{c(){g=a("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),u=r("Module"),T=r(`
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){g=n(c,"P",{});var f=s(g);v=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(f,"CODE",{});var N=s(_);u=i(N,"Module"),N.forEach(t),T=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(t)},m(c,f){h(c,g,f),e(g,v),e(g,_),e(_,u),e(g,T)},d(c){c&&t(g)}}}function vm($){let g,v,_,u,T;return u=new Rn({props:{code:`from transformers import AutoImageProcessor, ImageGPTForImageClassification
from PIL import Image
import requests

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

image_processor = AutoImageProcessor.from_pretrained("openai/imagegpt-small")
model = ImageGPTForImageClassification.from_pretrained("openai/imagegpt-small")

inputs = image_processor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ImageGPTForImageClassification
<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>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.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>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;openai/imagegpt-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ImageGPTForImageClassification.from_pretrained(<span class="hljs-string">&quot;openai/imagegpt-small&quot;</span>)

<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>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){g=a("p"),v=r("Examples:"),_=l(),b(u.$$.fragment)},l(c){g=n(c,"P",{});var f=s(g);v=i(f,"Examples:"),f.forEach(t),_=d(c),y(u.$$.fragment,c)},m(c,f){h(c,g,f),e(g,v),h(c,_,f),I(u,c,f),T=!0},p:Ln,i(c){T||(P(u.$$.fragment,c),T=!0)},o(c){w(u.$$.fragment,c),T=!1},d(c){c&&t(g),c&&t(_),k(u,c)}}}function bm($){let g,v,_,u,T,c,f,N,Wn,Sa,ie,ye,po,Je,Hn,ho,Bn,La,Ie,Vn,Xe,Un,Jn,Ra,St,Xn,Wa,Lt,go,Yn,Ha,Pe,Zl,Ba,Rt,Qn,Va,L,Kn,Ye,Zn,es,Qe,ts,os,Ke,as,ns,Ua,Wt,ss,Ja,O,Ze,rs,Ht,is,ls,ds,et,cs,Bt,ms,ps,hs,tt,gs,uo,us,fs,_s,ot,Ts,Vt,vs,bs,ys,fo,Is,Xa,we,_o,G,To,vo,Ps,ws,bo,yo,ks,$s,Io,Po,Gs,xs,wo,ko,Es,Cs,$o,Go,zs,Ms,xo,Eo,Fs,qs,x,E,Co,js,As,zo,Ds,Ns,Mo,Os,Ss,Fo,Ls,Rs,qo,Ws,Hs,jo,Bs,Vs,C,Ao,Us,Js,Do,Xs,Ys,No,Qs,Ks,Oo,Zs,er,So,tr,or,Lo,ar,nr,z,Ro,sr,rr,Wo,ir,lr,Ho,dr,cr,Bo,mr,pr,Vo,hr,gr,Uo,ur,fr,M,Jo,_r,Tr,Xo,vr,br,Yo,yr,Ir,Qo,Pr,wr,Ko,kr,$r,Zo,Gr,xr,F,ea,Er,Cr,ta,zr,Mr,oa,Fr,qr,aa,jr,Ar,na,Dr,Nr,sa,Or,Sr,q,ra,Lr,Rr,ia,Wr,Hr,la,Br,Vr,da,Ur,Jr,ca,Xr,Yr,ma,Qr,Ya,le,ke,pa,at,Kr,ha,Zr,Qa,Ut,ei,Ka,nt,Za,$e,st,ti,rt,oi,ai,ni,oe,Jt,si,ri,it,ii,li,lt,di,ci,en,Xt,mi,tn,de,Ge,ga,dt,pi,ua,hi,on,S,ct,gi,Z,ui,Yt,fi,_i,fa,Ti,vi,mt,bi,yi,Ii,ce,Pi,Qt,wi,ki,Kt,$i,Gi,xi,xe,an,me,Ee,_a,pt,Ei,Ta,Ci,nn,pe,ht,zi,Ce,gt,Mi,va,Fi,sn,he,ze,ba,ut,qi,ya,ji,rn,ee,ft,Ai,Ia,Di,Ni,Me,_t,Oi,Pa,Si,ln,ge,Fe,wa,Tt,Li,ka,Ri,dn,j,vt,Wi,$a,Hi,Bi,bt,Vi,Zt,Ui,Ji,Xi,yt,Yi,It,Qi,Ki,Zi,R,Pt,el,ue,tl,eo,ol,al,Ga,nl,sl,rl,qe,il,je,cn,fe,Ae,xa,wt,ll,Ea,dl,mn,A,kt,cl,Ca,ml,pl,$t,hl,to,gl,ul,fl,Gt,_l,xt,Tl,vl,bl,W,Et,yl,_e,Il,oo,Pl,wl,za,kl,$l,Gl,De,xl,Ne,pn,Te,Oe,Ma,Ct,El,Fa,Cl,hn,D,zt,zl,Mt,Ml,ao,Fl,ql,jl,Ft,Al,no,Dl,Nl,Ol,qt,Sl,jt,Ll,Rl,Wl,H,At,Hl,ve,Bl,so,Vl,Ul,qa,Jl,Xl,Yl,Se,Ql,Le,gn;return c=new be({}),Je=new be({}),at=new be({}),nt=new pm({props:{pipeline:"image-classification"}}),dt=new be({}),ct=new te({props:{name:"class transformers.ImageGPTConfig",anchor:"transformers.ImageGPTConfig",parameters:[{name:"vocab_size",val:" = 513"},{name:"n_positions",val:" = 1024"},{name:"n_embd",val:" = 512"},{name:"n_layer",val:" = 24"},{name:"n_head",val:" = 8"},{name:"n_inner",val:" = None"},{name:"activation_function",val:" = 'quick_gelu'"},{name:"resid_pdrop",val:" = 0.1"},{name:"embd_pdrop",val:" = 0.1"},{name:"attn_pdrop",val:" = 0.1"},{name:"layer_norm_epsilon",val:" = 1e-05"},{name:"initializer_range",val:" = 0.02"},{name:"scale_attn_weights",val:" = True"},{name:"use_cache",val:" = True"},{name:"tie_word_embeddings",val:" = False"},{name:"scale_attn_by_inverse_layer_idx",val:" = False"},{name:"reorder_and_upcast_attn",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ImageGPTConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Vocabulary size of the GPT-2 model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTModel">ImageGPTModel</a> or <code>TFImageGPTModel</code>.`,name:"vocab_size"},{anchor:"transformers.ImageGPTConfig.n_positions",description:`<strong>n_positions</strong> (<code>int</code>, <em>optional</em>, defaults to 32*32) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"n_positions"},{anchor:"transformers.ImageGPTConfig.n_embd",description:`<strong>n_embd</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of the embeddings and hidden states.`,name:"n_embd"},{anchor:"transformers.ImageGPTConfig.n_layer",description:`<strong>n_layer</strong> (<code>int</code>, <em>optional</em>, defaults to 24) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"n_layer"},{anchor:"transformers.ImageGPTConfig.n_head",description:`<strong>n_head</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"n_head"},{anchor:"transformers.ImageGPTConfig.n_inner",description:`<strong>n_inner</strong> (<code>int</code>, <em>optional</em>, defaults to None) &#x2014;
Dimensionality of the inner feed-forward layers. <code>None</code> will set it to 4 times n_embd`,name:"n_inner"},{anchor:"transformers.ImageGPTConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;quick_gelu&quot;</code>) &#x2014;
Activation function (can be one of the activation functions defined in src/transformers/activations.py).
Defaults to &#x201C;quick_gelu&#x201D;.`,name:"activation_function"},{anchor:"transformers.ImageGPTConfig.resid_pdrop",description:`<strong>resid_pdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"resid_pdrop"},{anchor:"transformers.ImageGPTConfig.embd_pdrop",description:`<strong>embd_pdrop</strong> (<code>int</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the embeddings.`,name:"embd_pdrop"},{anchor:"transformers.ImageGPTConfig.attn_pdrop",description:`<strong>attn_pdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention.`,name:"attn_pdrop"},{anchor:"transformers.ImageGPTConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon to use in the layer normalization layers.`,name:"layer_norm_epsilon"},{anchor:"transformers.ImageGPTConfig.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.ImageGPTConfig.scale_attn_weights",description:`<strong>scale_attn_weights</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Scale attention weights by dividing by sqrt(hidden_size)..`,name:"scale_attn_weights"},{anchor:"transformers.ImageGPTConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"},{anchor:"transformers.ImageGPTConfig.scale_attn_by_inverse_layer_idx",description:`<strong>scale_attn_by_inverse_layer_idx</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to additionally scale attention weights by <code>1 / layer_idx + 1</code>.`,name:"scale_attn_by_inverse_layer_idx"},{anchor:"transformers.ImageGPTConfig.reorder_and_upcast_attn",description:`<strong>reorder_and_upcast_attn</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to scale keys (K) prior to computing attention (dot-product) and upcast attention
dot-product/softmax to float() when training with mixed precision.`,name:"reorder_and_upcast_attn"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/imagegpt/configuration_imagegpt.py#L37"}}),xe=new Sn({props:{anchor:"transformers.ImageGPTConfig.example",$$slots:{default:[hm]},$$scope:{ctx:$}}}),pt=new be({}),ht=new te({props:{name:"class transformers.ImageGPTFeatureExtractor",anchor:"transformers.ImageGPTFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/imagegpt/feature_extraction_imagegpt.py#L26"}}),gt=new te({props:{name:"__call__",anchor:"transformers.ImageGPTFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_processing_utils.py#L448"}}),ut=new be({}),ft=new te({props:{name:"class transformers.ImageGPTImageProcessor",anchor:"transformers.ImageGPTImageProcessor",parameters:[{name:"clusters",val:": typing.Optional[numpy.ndarray] = None"},{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_normalize",val:": bool = True"},{name:"do_color_quantize",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ImageGPTImageProcessor.clusters",description:`<strong>clusters</strong> (<code>np.ndarray</code>, <em>optional</em>) &#x2014;
The color clusters to use, as a <code>np.ndarray</code> of shape <code>(n_clusters, 3)</code> when color quantizing. Can be
overriden by <code>clusters</code> in <code>preprocess</code>.`,name:"clusters"},{anchor:"transformers.ImageGPTImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s dimensions to <code>(size[&quot;height&quot;], size[&quot;width&quot;])</code>. Can be overridden by
<code>do_resize</code> in <code>preprocess</code>.`,name:"do_resize"},{anchor:"transformers.ImageGPTImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;height&quot; -- 256, &quot;width&quot;: 256}</code>):
Size of the image after resizing. Can be overridden by <code>size</code> in <code>preprocess</code>.`,name:"size"},{anchor:"transformers.ImageGPTImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BICUBIC</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by <code>resample</code> in <code>preprocess</code>.`,name:"resample"},{anchor:"transformers.ImageGPTImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image pixel value to between [-1, 1]. Can be overridden by <code>do_normalize</code> in
<code>preprocess</code>.`,name:"do_normalize"},{anchor:"transformers.ImageGPTImageProcessor.do_color_quantize",description:`<strong>do_color_quantize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to color quantize the image. Can be overridden by <code>do_color_quantize</code> in <code>preprocess</code>.`,name:"do_color_quantize"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/imagegpt/image_processing_imagegpt.py#L59"}}),_t=new te({props:{name:"preprocess",anchor:"transformers.ImageGPTImageProcessor.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:"do_resize",val:": bool = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = None"},{name:"do_normalize",val:": bool = None"},{name:"do_color_quantize",val:": typing.Optional[bool] = None"},{name:"clusters",val:": typing.Union[int, typing.List[int], NoneType] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Union[transformers.image_utils.ChannelDimension, str, NoneType] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ImageGPTImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.ImageGPTImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.ImageGPTImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after resizing.`,name:"size"},{anchor:"transformers.ImageGPTImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>, Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.ImageGPTImageProcessor.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.ImageGPTImageProcessor.preprocess.do_color_quantize",description:`<strong>do_color_quantize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_color_quantize</code>) &#x2014;
Whether to color quantize the image.`,name:"do_color_quantize"},{anchor:"transformers.ImageGPTImageProcessor.preprocess.clusters",description:`<strong>clusters</strong> (<code>np.ndarray</code>, <em>optional</em>, defaults to <code>self.clusters</code>) &#x2014;
Clusters used to quantize the image of shape <code>(n_clusters, 3)</code>. Only has an effect if
<code>do_color_quantize</code> is set to <code>True</code>.`,name:"clusters"},{anchor:"transformers.ImageGPTImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.ImageGPTImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.
Only has an effect if <code>do_color_quantize</code> is set to <code>False</code>.</li>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/imagegpt/image_processing_imagegpt.py#L152"}}),Tt=new be({}),vt=new te({props:{name:"class transformers.ImageGPTModel",anchor:"transformers.ImageGPTModel",parameters:[{name:"config",val:": ImageGPTConfig"}],parametersDescription:[{anchor:"transformers.ImageGPTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTConfig">ImageGPTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/imagegpt/modeling_imagegpt.py#L615"}}),Pt=new te({props:{name:"forward",anchor:"transformers.ImageGPTModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:": typing.Any"}],parametersDescription:[{anchor:"transformers.ImageGPTModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else
<code>past_key_values[0][0].shape[-2]</code> (<code>sequence_length</code> of input past key value states). Indices of input
sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerFeatureExtractor.__call__">ImageGPTImageProcessor.<strong>call</strong>()</a> for details.`,name:"input_ids"},{anchor:"transformers.ImageGPTModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.n_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.ImageGPTModel.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.ImageGPTModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.ImageGPTModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ImageGPTModel.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.ImageGPTModel.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.ImageGPTModel.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.ImageGPTModel.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.ImageGPTModel.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.ImageGPTModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ImageGPTModel.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for language modeling. Note that the labels <strong>are shifted</strong> inside the model, i.e. you can set
<code>labels = input_ids</code> Indices are selected in <code>[-100, 0, ..., config.vocab_size]</code> All labels set to <code>-100</code>
are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/imagegpt/modeling_imagegpt.py#L650",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTConfig"
>ImageGPTConfig</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>
<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 optionally if
<code>config.is_encoder_decoder=True</code> 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 optionally if
<code>config.is_encoder_decoder=True</code> 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>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> and <code>config.add_cross_attention=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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),qe=new Kl({props:{$$slots:{default:[gm]},$$scope:{ctx:$}}}),je=new Sn({props:{anchor:"transformers.ImageGPTModel.forward.example",$$slots:{default:[um]},$$scope:{ctx:$}}}),wt=new be({}),kt=new te({props:{name:"class transformers.ImageGPTForCausalImageModeling",anchor:"transformers.ImageGPTForCausalImageModeling",parameters:[{name:"config",val:": ImageGPTConfig"}],parametersDescription:[{anchor:"transformers.ImageGPTForCausalImageModeling.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTConfig">ImageGPTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/imagegpt/modeling_imagegpt.py#L895"}}),Et=new te({props:{name:"forward",anchor:"transformers.ImageGPTForCausalImageModeling.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:": typing.Any"}],parametersDescription:[{anchor:"transformers.ImageGPTForCausalImageModeling.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else
<code>past_key_values[0][0].shape[-2]</code> (<code>sequence_length</code> of input past key value states). Indices of input
sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerFeatureExtractor.__call__">ImageGPTImageProcessor.<strong>call</strong>()</a> for details.`,name:"input_ids"},{anchor:"transformers.ImageGPTForCausalImageModeling.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.n_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.ImageGPTForCausalImageModeling.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.ImageGPTForCausalImageModeling.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.ImageGPTForCausalImageModeling.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ImageGPTForCausalImageModeling.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.ImageGPTForCausalImageModeling.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.ImageGPTForCausalImageModeling.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.ImageGPTForCausalImageModeling.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.ImageGPTForCausalImageModeling.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.ImageGPTForCausalImageModeling.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ImageGPTForCausalImageModeling.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for language modeling. Note that the labels <strong>are shifted</strong> inside the model, i.e. you can set
<code>labels = input_ids</code> Indices are selected in <code>[-100, 0, ..., config.vocab_size]</code> All labels set to <code>-100</code>
are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/imagegpt/modeling_imagegpt.py#L943",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTConfig"
>ImageGPTConfig</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/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),De=new Kl({props:{$$slots:{default:[fm]},$$scope:{ctx:$}}}),Ne=new Sn({props:{anchor:"transformers.ImageGPTForCausalImageModeling.forward.example",$$slots:{default:[_m]},$$scope:{ctx:$}}}),Ct=new be({}),zt=new te({props:{name:"class transformers.ImageGPTForImageClassification",anchor:"transformers.ImageGPTForImageClassification",parameters:[{name:"config",val:": ImageGPTConfig"}],parametersDescription:[{anchor:"transformers.ImageGPTForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTConfig">ImageGPTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/imagegpt/modeling_imagegpt.py#L1084"}}),At=new te({props:{name:"forward",anchor:"transformers.ImageGPTForImageClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:": typing.Any"}],parametersDescription:[{anchor:"transformers.ImageGPTForImageClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else
<code>past_key_values[0][0].shape[-2]</code> (<code>sequence_length</code> of input past key value states). Indices of input
sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerFeatureExtractor.__call__">ImageGPTImageProcessor.<strong>call</strong>()</a> for details.`,name:"input_ids"},{anchor:"transformers.ImageGPTForImageClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.n_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.ImageGPTForImageClassification.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.ImageGPTForImageClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.ImageGPTForImageClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ImageGPTForImageClassification.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.ImageGPTForImageClassification.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.ImageGPTForImageClassification.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.ImageGPTForImageClassification.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.ImageGPTForImageClassification.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.ImageGPTForImageClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ImageGPTForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/imagegpt/modeling_imagegpt.py#L1096",returnDescription:`
<p>A <code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTConfig"
>ImageGPTConfig</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 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</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>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</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><code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Se=new Kl({props:{$$slots:{default:[Tm]},$$scope:{ctx:$}}}),Le=new Sn({props:{anchor:"transformers.ImageGPTForImageClassification.forward.example",$$slots:{default:[vm]},$$scope:{ctx:$}}}),{c(){g=a("meta"),v=l(),_=a("h1"),u=a("a"),T=a("span"),b(c.$$.fragment),f=l(),N=a("span"),Wn=r("ImageGPT"),Sa=l(),ie=a("h2"),ye=a("a"),po=a("span"),b(Je.$$.fragment),Hn=l(),ho=a("span"),Bn=r("Overview"),La=l(),Ie=a("p"),Vn=r("The ImageGPT model was proposed in "),Xe=a("a"),Un=r("Generative Pretraining from Pixels"),Jn=r(` by Mark
Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, Ilya Sutskever. ImageGPT (iGPT) is a GPT-2-like
model trained to predict the next pixel value, allowing for both unconditional and conditional image generation.`),Ra=l(),St=a("p"),Xn=r("The abstract from the paper is the following:"),Wa=l(),Lt=a("p"),go=a("em"),Yn=r(`Inspired by progress in unsupervised representation learning for natural language, we examine whether similar models
can learn useful representations for images. We train a sequence Transformer to auto-regressively predict pixels,
without incorporating knowledge of the 2D input structure. Despite training on low-resolution ImageNet without labels,
we find that a GPT-2 scale model learns strong image representations as measured by linear probing, fine-tuning, and
low-data classification. On CIFAR-10, we achieve 96.3% accuracy with a linear probe, outperforming a supervised Wide
ResNet, and 99.0% accuracy with full fine-tuning, matching the top supervised pre-trained models. We are also
competitive with self-supervised benchmarks on ImageNet when substituting pixels for a VQVAE encoding, achieving 69.0%
top-1 accuracy on a linear probe of our features.`),Ha=l(),Pe=a("img"),Ba=l(),Rt=a("small"),Qn=r("Summary of the approach. Taken from the [original paper](https://cdn.openai.com/papers/Generative_Pretraining_from_Pixels_V2.pdf)."),Va=l(),L=a("p"),Kn=r("This model was contributed by "),Ye=a("a"),Zn=r("nielsr"),es=r(", based on "),Qe=a("a"),ts=r("this issue"),os=r(`. The original code can be found
`),Ke=a("a"),as=r("here"),ns=r("."),Ua=l(),Wt=a("p"),ss=r("Tips:"),Ja=l(),O=a("ul"),Ze=a("li"),rs=r("ImageGPT is almost exactly the same as "),Ht=a("a"),is=r("GPT-2"),ls=r(`, with the exception that a different activation
function is used (namely \u201Cquick gelu\u201D), and the layer normalization layers don\u2019t mean center the inputs. ImageGPT
also doesn\u2019t have tied input- and output embeddings.`),ds=l(),et=a("li"),cs=r(`As the time- and memory requirements of the attention mechanism of Transformers scales quadratically in the sequence
length, the authors pre-trained ImageGPT on smaller input resolutions, such as 32x32 and 64x64. However, feeding a
sequence of 32x32x3=3072 tokens from 0..255 into a Transformer is still prohibitively large. Therefore, the authors
applied k-means clustering to the (R,G,B) pixel values with k=512. This way, we only have a 32*32 = 1024-long
sequence, but now of integers in the range 0..511. So we are shrinking the sequence length at the cost of a bigger
embedding matrix. In other words, the vocabulary size of ImageGPT is 512, + 1 for a special \u201Cstart of sentence\u201D (SOS)
token, used at the beginning of every sequence. One can use `),Bt=a("a"),ms=r("ImageGPTImageProcessor"),ps=r(` to prepare
images for the model.`),hs=l(),tt=a("li"),gs=r(`Despite being pre-trained entirely unsupervised (i.e. without the use of any labels), ImageGPT produces fairly
performant image features useful for downstream tasks, such as image classification. The authors showed that the
features in the middle of the network are the most performant, and can be used as-is to train a linear model (such as
a sklearn logistic regression model for example). This is also referred to as \u201Clinear probing\u201D. Features can be
easily obtained by first forwarding the image through the model, then specifying `),uo=a("code"),us=r("output_hidden_states=True"),fs=r(`, and
then average-pool the hidden states at whatever layer you like.`),_s=l(),ot=a("li"),Ts=r(`Alternatively, one can further fine-tune the entire model on a downstream dataset, similar to BERT. For this, you can
use `),Vt=a("a"),vs=r("ImageGPTForImageClassification"),bs=r("."),ys=l(),fo=a("li"),Is=r(`ImageGPT comes in different sizes: there\u2019s ImageGPT-small, ImageGPT-medium and ImageGPT-large. The authors did also
train an XL variant, which they didn\u2019t release. The differences in size are summarized in the following table:`),Xa=l(),we=a("table"),_o=a("thead"),G=a("tr"),To=a("th"),vo=a("strong"),Ps=r("Model variant"),ws=l(),bo=a("th"),yo=a("strong"),ks=r("Depths"),$s=l(),Io=a("th"),Po=a("strong"),Gs=r("Hidden sizes"),xs=l(),wo=a("th"),ko=a("strong"),Es=r("Decoder hidden size"),Cs=l(),$o=a("th"),Go=a("strong"),zs=r("Params (M)"),Ms=l(),xo=a("th"),Eo=a("strong"),Fs=r("ImageNet-1k Top 1"),qs=l(),x=a("tbody"),E=a("tr"),Co=a("td"),js=r("MiT-b0"),As=l(),zo=a("td"),Ds=r("[2, 2, 2, 2]"),Ns=l(),Mo=a("td"),Os=r("[32, 64, 160, 256]"),Ss=l(),Fo=a("td"),Ls=r("256"),Rs=l(),qo=a("td"),Ws=r("3.7"),Hs=l(),jo=a("td"),Bs=r("70.5"),Vs=l(),C=a("tr"),Ao=a("td"),Us=r("MiT-b1"),Js=l(),Do=a("td"),Xs=r("[2, 2, 2, 2]"),Ys=l(),No=a("td"),Qs=r("[64, 128, 320, 512]"),Ks=l(),Oo=a("td"),Zs=r("256"),er=l(),So=a("td"),tr=r("14.0"),or=l(),Lo=a("td"),ar=r("78.7"),nr=l(),z=a("tr"),Ro=a("td"),sr=r("MiT-b2"),rr=l(),Wo=a("td"),ir=r("[3, 4, 6, 3]"),lr=l(),Ho=a("td"),dr=r("[64, 128, 320, 512]"),cr=l(),Bo=a("td"),mr=r("768"),pr=l(),Vo=a("td"),hr=r("25.4"),gr=l(),Uo=a("td"),ur=r("81.6"),fr=l(),M=a("tr"),Jo=a("td"),_r=r("MiT-b3"),Tr=l(),Xo=a("td"),vr=r("[3, 4, 18, 3]"),br=l(),Yo=a("td"),yr=r("[64, 128, 320, 512]"),Ir=l(),Qo=a("td"),Pr=r("768"),wr=l(),Ko=a("td"),kr=r("45.2"),$r=l(),Zo=a("td"),Gr=r("83.1"),xr=l(),F=a("tr"),ea=a("td"),Er=r("MiT-b4"),Cr=l(),ta=a("td"),zr=r("[3, 8, 27, 3]"),Mr=l(),oa=a("td"),Fr=r("[64, 128, 320, 512]"),qr=l(),aa=a("td"),jr=r("768"),Ar=l(),na=a("td"),Dr=r("62.6"),Nr=l(),sa=a("td"),Or=r("83.6"),Sr=l(),q=a("tr"),ra=a("td"),Lr=r("MiT-b5"),Rr=l(),ia=a("td"),Wr=r("[3, 6, 40, 3]"),Hr=l(),la=a("td"),Br=r("[64, 128, 320, 512]"),Vr=l(),da=a("td"),Ur=r("768"),Jr=l(),ca=a("td"),Xr=r("82.0"),Yr=l(),ma=a("td"),Qr=r("83.8"),Ya=l(),le=a("h2"),ke=a("a"),pa=a("span"),b(at.$$.fragment),Kr=l(),ha=a("span"),Zr=r("Resources"),Qa=l(),Ut=a("p"),ei=r("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with ImageGPT."),Ka=l(),b(nt.$$.fragment),Za=l(),$e=a("ul"),st=a("li"),ti=r("Demo notebooks for ImageGPT can be found "),rt=a("a"),oi=r("here"),ai=r("."),ni=l(),oe=a("li"),Jt=a("a"),si=r("ImageGPTForImageClassification"),ri=r(" is supported by this "),it=a("a"),ii=r("example script"),li=r(" and "),lt=a("a"),di=r("notebook"),ci=r("."),en=l(),Xt=a("p"),mi=r("If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),tn=l(),de=a("h2"),Ge=a("a"),ga=a("span"),b(dt.$$.fragment),pi=l(),ua=a("span"),hi=r("ImageGPTConfig"),on=l(),S=a("div"),b(ct.$$.fragment),gi=l(),Z=a("p"),ui=r("This is the configuration class to store the configuration of a "),Yt=a("a"),fi=r("ImageGPTModel"),_i=r(" or a "),fa=a("code"),Ti=r("TFImageGPTModel"),vi=r(`. It is
used to instantiate a GPT-2 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 ImageGPT
`),mt=a("a"),bi=r("openai/imagegpt-small"),yi=r(" architecture."),Ii=l(),ce=a("p"),Pi=r("Configuration objects inherit from "),Qt=a("a"),wi=r("PretrainedConfig"),ki=r(` and can be used to control the model outputs. Read the
documentation from `),Kt=a("a"),$i=r("PretrainedConfig"),Gi=r(" for more information."),xi=l(),b(xe.$$.fragment),an=l(),me=a("h2"),Ee=a("a"),_a=a("span"),b(pt.$$.fragment),Ei=l(),Ta=a("span"),Ci=r("ImageGPTFeatureExtractor"),nn=l(),pe=a("div"),b(ht.$$.fragment),zi=l(),Ce=a("div"),b(gt.$$.fragment),Mi=l(),va=a("p"),Fi=r("Preprocess an image or a batch of images."),sn=l(),he=a("h2"),ze=a("a"),ba=a("span"),b(ut.$$.fragment),qi=l(),ya=a("span"),ji=r("ImageGPTImageProcessor"),rn=l(),ee=a("div"),b(ft.$$.fragment),Ai=l(),Ia=a("p"),Di=r(`Constructs a ImageGPT image processor. This image processor can be used to resize images to a smaller resolution
(such as 32x32 or 64x64), normalize them and finally color quantize them to obtain sequences of \u201Cpixel values\u201D
(color clusters).`),Ni=l(),Me=a("div"),b(_t.$$.fragment),Oi=l(),Pa=a("p"),Si=r("Preprocess an image or batch of images."),ln=l(),ge=a("h2"),Fe=a("a"),wa=a("span"),b(Tt.$$.fragment),Li=l(),ka=a("span"),Ri=r("ImageGPTModel"),dn=l(),j=a("div"),b(vt.$$.fragment),Wi=l(),$a=a("p"),Hi=r("The bare ImageGPT Model transformer outputting raw hidden-states without any specific head on top."),Bi=l(),bt=a("p"),Vi=r("This model inherits from "),Zt=a("a"),Ui=r("PreTrainedModel"),Ji=r(`. 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(),yt=a("p"),Yi=r("This model is also a PyTorch "),It=a("a"),Qi=r("torch.nn.Module"),Ki=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Zi=l(),R=a("div"),b(Pt.$$.fragment),el=l(),ue=a("p"),tl=r("The "),eo=a("a"),ol=r("ImageGPTModel"),al=r(" forward method, overrides the "),Ga=a("code"),nl=r("__call__"),sl=r(" special method."),rl=l(),b(qe.$$.fragment),il=l(),b(je.$$.fragment),cn=l(),fe=a("h2"),Ae=a("a"),xa=a("span"),b(wt.$$.fragment),ll=l(),Ea=a("span"),dl=r("ImageGPTForCausalImageModeling"),mn=l(),A=a("div"),b(kt.$$.fragment),cl=l(),Ca=a("p"),ml=r(`The ImageGPT Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),pl=l(),$t=a("p"),hl=r("This model inherits from "),to=a("a"),gl=r("PreTrainedModel"),ul=r(`. 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.)`),fl=l(),Gt=a("p"),_l=r("This model is also a PyTorch "),xt=a("a"),Tl=r("torch.nn.Module"),vl=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),bl=l(),W=a("div"),b(Et.$$.fragment),yl=l(),_e=a("p"),Il=r("The "),oo=a("a"),Pl=r("ImageGPTForCausalImageModeling"),wl=r(" forward method, overrides the "),za=a("code"),kl=r("__call__"),$l=r(" special method."),Gl=l(),b(De.$$.fragment),xl=l(),b(Ne.$$.fragment),pn=l(),Te=a("h2"),Oe=a("a"),Ma=a("span"),b(Ct.$$.fragment),El=l(),Fa=a("span"),Cl=r("ImageGPTForImageClassification"),hn=l(),D=a("div"),b(zt.$$.fragment),zl=l(),Mt=a("p"),Ml=r(`The ImageGPT Model transformer with an image classification head on top (linear layer).
`),ao=a("a"),Fl=r("ImageGPTForImageClassification"),ql=r(" average-pools the hidden states in order to do the classification."),jl=l(),Ft=a("p"),Al=r("This model inherits from "),no=a("a"),Dl=r("PreTrainedModel"),Nl=r(`. 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.)`),Ol=l(),qt=a("p"),Sl=r("This model is also a PyTorch "),jt=a("a"),Ll=r("torch.nn.Module"),Rl=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Wl=l(),H=a("div"),b(At.$$.fragment),Hl=l(),ve=a("p"),Bl=r("The "),so=a("a"),Vl=r("ImageGPTForImageClassification"),Ul=r(" forward method, overrides the "),qa=a("code"),Jl=r("__call__"),Xl=r(" special method."),Yl=l(),b(Se.$$.fragment),Ql=l(),b(Le.$$.fragment),this.h()},l(o){const p=dm('[data-svelte="svelte-1phssyn"]',document.head);g=n(p,"META",{name:!0,content:!0}),p.forEach(t),v=d(o),_=n(o,"H1",{class:!0});var Dt=s(_);u=n(Dt,"A",{id:!0,class:!0,href:!0});var ja=s(u);T=n(ja,"SPAN",{});var Aa=s(T);y(c.$$.fragment,Aa),Aa.forEach(t),ja.forEach(t),f=d(Dt),N=n(Dt,"SPAN",{});var Da=s(N);Wn=i(Da,"ImageGPT"),Da.forEach(t),Dt.forEach(t),Sa=d(o),ie=n(o,"H2",{class:!0});var Nt=s(ie);ye=n(Nt,"A",{id:!0,class:!0,href:!0});var Na=s(ye);po=n(Na,"SPAN",{});var Oa=s(po);y(Je.$$.fragment,Oa),Oa.forEach(t),Na.forEach(t),Hn=d(Nt),ho=n(Nt,"SPAN",{});var ed=s(ho);Bn=i(ed,"Overview"),ed.forEach(t),Nt.forEach(t),La=d(o),Ie=n(o,"P",{});var un=s(Ie);Vn=i(un,"The ImageGPT model was proposed in "),Xe=n(un,"A",{href:!0,rel:!0});var td=s(Xe);Un=i(td,"Generative Pretraining from Pixels"),td.forEach(t),Jn=i(un,` by Mark
Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, Ilya Sutskever. ImageGPT (iGPT) is a GPT-2-like
model trained to predict the next pixel value, allowing for both unconditional and conditional image generation.`),un.forEach(t),Ra=d(o),St=n(o,"P",{});var od=s(St);Xn=i(od,"The abstract from the paper is the following:"),od.forEach(t),Wa=d(o),Lt=n(o,"P",{});var ad=s(Lt);go=n(ad,"EM",{});var nd=s(go);Yn=i(nd,`Inspired by progress in unsupervised representation learning for natural language, we examine whether similar models
can learn useful representations for images. We train a sequence Transformer to auto-regressively predict pixels,
without incorporating knowledge of the 2D input structure. Despite training on low-resolution ImageNet without labels,
we find that a GPT-2 scale model learns strong image representations as measured by linear probing, fine-tuning, and
low-data classification. On CIFAR-10, we achieve 96.3% accuracy with a linear probe, outperforming a supervised Wide
ResNet, and 99.0% accuracy with full fine-tuning, matching the top supervised pre-trained models. We are also
competitive with self-supervised benchmarks on ImageNet when substituting pixels for a VQVAE encoding, achieving 69.0%
top-1 accuracy on a linear probe of our features.`),nd.forEach(t),ad.forEach(t),Ha=d(o),Pe=n(o,"IMG",{src:!0,alt:!0,width:!0}),Ba=d(o),Rt=n(o,"SMALL",{});var sd=s(Rt);Qn=i(sd,"Summary of the approach. Taken from the [original paper](https://cdn.openai.com/papers/Generative_Pretraining_from_Pixels_V2.pdf)."),sd.forEach(t),Va=d(o),L=n(o,"P",{});var Re=s(L);Kn=i(Re,"This model was contributed by "),Ye=n(Re,"A",{href:!0,rel:!0});var rd=s(Ye);Zn=i(rd,"nielsr"),rd.forEach(t),es=i(Re,", based on "),Qe=n(Re,"A",{href:!0,rel:!0});var id=s(Qe);ts=i(id,"this issue"),id.forEach(t),os=i(Re,`. The original code can be found
`),Ke=n(Re,"A",{href:!0,rel:!0});var ld=s(Ke);as=i(ld,"here"),ld.forEach(t),ns=i(Re,"."),Re.forEach(t),Ua=d(o),Wt=n(o,"P",{});var dd=s(Wt);ss=i(dd,"Tips:"),dd.forEach(t),Ja=d(o),O=n(o,"UL",{});var ae=s(O);Ze=n(ae,"LI",{});var fn=s(Ze);rs=i(fn,"ImageGPT is almost exactly the same as "),Ht=n(fn,"A",{href:!0});var cd=s(Ht);is=i(cd,"GPT-2"),cd.forEach(t),ls=i(fn,`, with the exception that a different activation
function is used (namely \u201Cquick gelu\u201D), and the layer normalization layers don\u2019t mean center the inputs. ImageGPT
also doesn\u2019t have tied input- and output embeddings.`),fn.forEach(t),ds=d(ae),et=n(ae,"LI",{});var _n=s(et);cs=i(_n,`As the time- and memory requirements of the attention mechanism of Transformers scales quadratically in the sequence
length, the authors pre-trained ImageGPT on smaller input resolutions, such as 32x32 and 64x64. However, feeding a
sequence of 32x32x3=3072 tokens from 0..255 into a Transformer is still prohibitively large. Therefore, the authors
applied k-means clustering to the (R,G,B) pixel values with k=512. This way, we only have a 32*32 = 1024-long
sequence, but now of integers in the range 0..511. So we are shrinking the sequence length at the cost of a bigger
embedding matrix. In other words, the vocabulary size of ImageGPT is 512, + 1 for a special \u201Cstart of sentence\u201D (SOS)
token, used at the beginning of every sequence. One can use `),Bt=n(_n,"A",{href:!0});var md=s(Bt);ms=i(md,"ImageGPTImageProcessor"),md.forEach(t),ps=i(_n,` to prepare
images for the model.`),_n.forEach(t),hs=d(ae),tt=n(ae,"LI",{});var Tn=s(tt);gs=i(Tn,`Despite being pre-trained entirely unsupervised (i.e. without the use of any labels), ImageGPT produces fairly
performant image features useful for downstream tasks, such as image classification. The authors showed that the
features in the middle of the network are the most performant, and can be used as-is to train a linear model (such as
a sklearn logistic regression model for example). This is also referred to as \u201Clinear probing\u201D. Features can be
easily obtained by first forwarding the image through the model, then specifying `),uo=n(Tn,"CODE",{});var pd=s(uo);us=i(pd,"output_hidden_states=True"),pd.forEach(t),fs=i(Tn,`, and
then average-pool the hidden states at whatever layer you like.`),Tn.forEach(t),_s=d(ae),ot=n(ae,"LI",{});var vn=s(ot);Ts=i(vn,`Alternatively, one can further fine-tune the entire model on a downstream dataset, similar to BERT. For this, you can
use `),Vt=n(vn,"A",{href:!0});var hd=s(Vt);vs=i(hd,"ImageGPTForImageClassification"),hd.forEach(t),bs=i(vn,"."),vn.forEach(t),ys=d(ae),fo=n(ae,"LI",{});var gd=s(fo);Is=i(gd,`ImageGPT comes in different sizes: there\u2019s ImageGPT-small, ImageGPT-medium and ImageGPT-large. The authors did also
train an XL variant, which they didn\u2019t release. The differences in size are summarized in the following table:`),gd.forEach(t),ae.forEach(t),Xa=d(o),we=n(o,"TABLE",{});var bn=s(we);_o=n(bn,"THEAD",{});var ud=s(_o);G=n(ud,"TR",{});var B=s(G);To=n(B,"TH",{});var fd=s(To);vo=n(fd,"STRONG",{});var _d=s(vo);Ps=i(_d,"Model variant"),_d.forEach(t),fd.forEach(t),ws=d(B),bo=n(B,"TH",{});var Td=s(bo);yo=n(Td,"STRONG",{});var vd=s(yo);ks=i(vd,"Depths"),vd.forEach(t),Td.forEach(t),$s=d(B),Io=n(B,"TH",{});var bd=s(Io);Po=n(bd,"STRONG",{});var yd=s(Po);Gs=i(yd,"Hidden sizes"),yd.forEach(t),bd.forEach(t),xs=d(B),wo=n(B,"TH",{});var Id=s(wo);ko=n(Id,"STRONG",{});var Pd=s(ko);Es=i(Pd,"Decoder hidden size"),Pd.forEach(t),Id.forEach(t),Cs=d(B),$o=n(B,"TH",{});var wd=s($o);Go=n(wd,"STRONG",{});var kd=s(Go);zs=i(kd,"Params (M)"),kd.forEach(t),wd.forEach(t),Ms=d(B),xo=n(B,"TH",{});var $d=s(xo);Eo=n($d,"STRONG",{});var Gd=s(Eo);Fs=i(Gd,"ImageNet-1k Top 1"),Gd.forEach(t),$d.forEach(t),B.forEach(t),ud.forEach(t),qs=d(bn),x=n(bn,"TBODY",{});var V=s(x);E=n(V,"TR",{});var U=s(E);Co=n(U,"TD",{});var xd=s(Co);js=i(xd,"MiT-b0"),xd.forEach(t),As=d(U),zo=n(U,"TD",{});var Ed=s(zo);Ds=i(Ed,"[2, 2, 2, 2]"),Ed.forEach(t),Ns=d(U),Mo=n(U,"TD",{});var Cd=s(Mo);Os=i(Cd,"[32, 64, 160, 256]"),Cd.forEach(t),Ss=d(U),Fo=n(U,"TD",{});var zd=s(Fo);Ls=i(zd,"256"),zd.forEach(t),Rs=d(U),qo=n(U,"TD",{});var Md=s(qo);Ws=i(Md,"3.7"),Md.forEach(t),Hs=d(U),jo=n(U,"TD",{});var Fd=s(jo);Bs=i(Fd,"70.5"),Fd.forEach(t),U.forEach(t),Vs=d(V),C=n(V,"TR",{});var J=s(C);Ao=n(J,"TD",{});var qd=s(Ao);Us=i(qd,"MiT-b1"),qd.forEach(t),Js=d(J),Do=n(J,"TD",{});var jd=s(Do);Xs=i(jd,"[2, 2, 2, 2]"),jd.forEach(t),Ys=d(J),No=n(J,"TD",{});var Ad=s(No);Qs=i(Ad,"[64, 128, 320, 512]"),Ad.forEach(t),Ks=d(J),Oo=n(J,"TD",{});var Dd=s(Oo);Zs=i(Dd,"256"),Dd.forEach(t),er=d(J),So=n(J,"TD",{});var Nd=s(So);tr=i(Nd,"14.0"),Nd.forEach(t),or=d(J),Lo=n(J,"TD",{});var Od=s(Lo);ar=i(Od,"78.7"),Od.forEach(t),J.forEach(t),nr=d(V),z=n(V,"TR",{});var X=s(z);Ro=n(X,"TD",{});var Sd=s(Ro);sr=i(Sd,"MiT-b2"),Sd.forEach(t),rr=d(X),Wo=n(X,"TD",{});var Ld=s(Wo);ir=i(Ld,"[3, 4, 6, 3]"),Ld.forEach(t),lr=d(X),Ho=n(X,"TD",{});var Rd=s(Ho);dr=i(Rd,"[64, 128, 320, 512]"),Rd.forEach(t),cr=d(X),Bo=n(X,"TD",{});var Wd=s(Bo);mr=i(Wd,"768"),Wd.forEach(t),pr=d(X),Vo=n(X,"TD",{});var Hd=s(Vo);hr=i(Hd,"25.4"),Hd.forEach(t),gr=d(X),Uo=n(X,"TD",{});var Bd=s(Uo);ur=i(Bd,"81.6"),Bd.forEach(t),X.forEach(t),fr=d(V),M=n(V,"TR",{});var Y=s(M);Jo=n(Y,"TD",{});var Vd=s(Jo);_r=i(Vd,"MiT-b3"),Vd.forEach(t),Tr=d(Y),Xo=n(Y,"TD",{});var Ud=s(Xo);vr=i(Ud,"[3, 4, 18, 3]"),Ud.forEach(t),br=d(Y),Yo=n(Y,"TD",{});var Jd=s(Yo);yr=i(Jd,"[64, 128, 320, 512]"),Jd.forEach(t),Ir=d(Y),Qo=n(Y,"TD",{});var Xd=s(Qo);Pr=i(Xd,"768"),Xd.forEach(t),wr=d(Y),Ko=n(Y,"TD",{});var Yd=s(Ko);kr=i(Yd,"45.2"),Yd.forEach(t),$r=d(Y),Zo=n(Y,"TD",{});var Qd=s(Zo);Gr=i(Qd,"83.1"),Qd.forEach(t),Y.forEach(t),xr=d(V),F=n(V,"TR",{});var Q=s(F);ea=n(Q,"TD",{});var Kd=s(ea);Er=i(Kd,"MiT-b4"),Kd.forEach(t),Cr=d(Q),ta=n(Q,"TD",{});var Zd=s(ta);zr=i(Zd,"[3, 8, 27, 3]"),Zd.forEach(t),Mr=d(Q),oa=n(Q,"TD",{});var ec=s(oa);Fr=i(ec,"[64, 128, 320, 512]"),ec.forEach(t),qr=d(Q),aa=n(Q,"TD",{});var tc=s(aa);jr=i(tc,"768"),tc.forEach(t),Ar=d(Q),na=n(Q,"TD",{});var oc=s(na);Dr=i(oc,"62.6"),oc.forEach(t),Nr=d(Q),sa=n(Q,"TD",{});var ac=s(sa);Or=i(ac,"83.6"),ac.forEach(t),Q.forEach(t),Sr=d(V),q=n(V,"TR",{});var K=s(q);ra=n(K,"TD",{});var nc=s(ra);Lr=i(nc,"MiT-b5"),nc.forEach(t),Rr=d(K),ia=n(K,"TD",{});var sc=s(ia);Wr=i(sc,"[3, 6, 40, 3]"),sc.forEach(t),Hr=d(K),la=n(K,"TD",{});var rc=s(la);Br=i(rc,"[64, 128, 320, 512]"),rc.forEach(t),Vr=d(K),da=n(K,"TD",{});var ic=s(da);Ur=i(ic,"768"),ic.forEach(t),Jr=d(K),ca=n(K,"TD",{});var lc=s(ca);Xr=i(lc,"82.0"),lc.forEach(t),Yr=d(K),ma=n(K,"TD",{});var dc=s(ma);Qr=i(dc,"83.8"),dc.forEach(t),K.forEach(t),V.forEach(t),bn.forEach(t),Ya=d(o),le=n(o,"H2",{class:!0});var yn=s(le);ke=n(yn,"A",{id:!0,class:!0,href:!0});var cc=s(ke);pa=n(cc,"SPAN",{});var mc=s(pa);y(at.$$.fragment,mc),mc.forEach(t),cc.forEach(t),Kr=d(yn),ha=n(yn,"SPAN",{});var pc=s(ha);Zr=i(pc,"Resources"),pc.forEach(t),yn.forEach(t),Qa=d(o),Ut=n(o,"P",{});var hc=s(Ut);ei=i(hc,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with ImageGPT."),hc.forEach(t),Ka=d(o),y(nt.$$.fragment,o),Za=d(o),$e=n(o,"UL",{});var In=s($e);st=n(In,"LI",{});var Pn=s(st);ti=i(Pn,"Demo notebooks for ImageGPT can be found "),rt=n(Pn,"A",{href:!0,rel:!0});var gc=s(rt);oi=i(gc,"here"),gc.forEach(t),ai=i(Pn,"."),Pn.forEach(t),ni=d(In),oe=n(In,"LI",{});var Ot=s(oe);Jt=n(Ot,"A",{href:!0});var uc=s(Jt);si=i(uc,"ImageGPTForImageClassification"),uc.forEach(t),ri=i(Ot," is supported by this "),it=n(Ot,"A",{href:!0,rel:!0});var fc=s(it);ii=i(fc,"example script"),fc.forEach(t),li=i(Ot," and "),lt=n(Ot,"A",{href:!0,rel:!0});var _c=s(lt);di=i(_c,"notebook"),_c.forEach(t),ci=i(Ot,"."),Ot.forEach(t),In.forEach(t),en=d(o),Xt=n(o,"P",{});var Tc=s(Xt);mi=i(Tc,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Tc.forEach(t),tn=d(o),de=n(o,"H2",{class:!0});var wn=s(de);Ge=n(wn,"A",{id:!0,class:!0,href:!0});var vc=s(Ge);ga=n(vc,"SPAN",{});var bc=s(ga);y(dt.$$.fragment,bc),bc.forEach(t),vc.forEach(t),pi=d(wn),ua=n(wn,"SPAN",{});var yc=s(ua);hi=i(yc,"ImageGPTConfig"),yc.forEach(t),wn.forEach(t),on=d(o),S=n(o,"DIV",{class:!0});var We=s(S);y(ct.$$.fragment,We),gi=d(We),Z=n(We,"P",{});var He=s(Z);ui=i(He,"This is the configuration class to store the configuration of a "),Yt=n(He,"A",{href:!0});var Ic=s(Yt);fi=i(Ic,"ImageGPTModel"),Ic.forEach(t),_i=i(He," or a "),fa=n(He,"CODE",{});var Pc=s(fa);Ti=i(Pc,"TFImageGPTModel"),Pc.forEach(t),vi=i(He,`. It is
used to instantiate a GPT-2 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 ImageGPT
`),mt=n(He,"A",{href:!0,rel:!0});var wc=s(mt);bi=i(wc,"openai/imagegpt-small"),wc.forEach(t),yi=i(He," architecture."),He.forEach(t),Ii=d(We),ce=n(We,"P",{});var ro=s(ce);Pi=i(ro,"Configuration objects inherit from "),Qt=n(ro,"A",{href:!0});var kc=s(Qt);wi=i(kc,"PretrainedConfig"),kc.forEach(t),ki=i(ro,` and can be used to control the model outputs. Read the
documentation from `),Kt=n(ro,"A",{href:!0});var $c=s(Kt);$i=i($c,"PretrainedConfig"),$c.forEach(t),Gi=i(ro," for more information."),ro.forEach(t),xi=d(We),y(xe.$$.fragment,We),We.forEach(t),an=d(o),me=n(o,"H2",{class:!0});var kn=s(me);Ee=n(kn,"A",{id:!0,class:!0,href:!0});var Gc=s(Ee);_a=n(Gc,"SPAN",{});var xc=s(_a);y(pt.$$.fragment,xc),xc.forEach(t),Gc.forEach(t),Ei=d(kn),Ta=n(kn,"SPAN",{});var Ec=s(Ta);Ci=i(Ec,"ImageGPTFeatureExtractor"),Ec.forEach(t),kn.forEach(t),nn=d(o),pe=n(o,"DIV",{class:!0});var $n=s(pe);y(ht.$$.fragment,$n),zi=d($n),Ce=n($n,"DIV",{class:!0});var Gn=s(Ce);y(gt.$$.fragment,Gn),Mi=d(Gn),va=n(Gn,"P",{});var Cc=s(va);Fi=i(Cc,"Preprocess an image or a batch of images."),Cc.forEach(t),Gn.forEach(t),$n.forEach(t),sn=d(o),he=n(o,"H2",{class:!0});var xn=s(he);ze=n(xn,"A",{id:!0,class:!0,href:!0});var zc=s(ze);ba=n(zc,"SPAN",{});var Mc=s(ba);y(ut.$$.fragment,Mc),Mc.forEach(t),zc.forEach(t),qi=d(xn),ya=n(xn,"SPAN",{});var Fc=s(ya);ji=i(Fc,"ImageGPTImageProcessor"),Fc.forEach(t),xn.forEach(t),rn=d(o),ee=n(o,"DIV",{class:!0});var io=s(ee);y(ft.$$.fragment,io),Ai=d(io),Ia=n(io,"P",{});var qc=s(Ia);Di=i(qc,`Constructs a ImageGPT image processor. This image processor can be used to resize images to a smaller resolution
(such as 32x32 or 64x64), normalize them and finally color quantize them to obtain sequences of \u201Cpixel values\u201D
(color clusters).`),qc.forEach(t),Ni=d(io),Me=n(io,"DIV",{class:!0});var En=s(Me);y(_t.$$.fragment,En),Oi=d(En),Pa=n(En,"P",{});var jc=s(Pa);Si=i(jc,"Preprocess an image or batch of images."),jc.forEach(t),En.forEach(t),io.forEach(t),ln=d(o),ge=n(o,"H2",{class:!0});var Cn=s(ge);Fe=n(Cn,"A",{id:!0,class:!0,href:!0});var Ac=s(Fe);wa=n(Ac,"SPAN",{});var Dc=s(wa);y(Tt.$$.fragment,Dc),Dc.forEach(t),Ac.forEach(t),Li=d(Cn),ka=n(Cn,"SPAN",{});var Nc=s(ka);Ri=i(Nc,"ImageGPTModel"),Nc.forEach(t),Cn.forEach(t),dn=d(o),j=n(o,"DIV",{class:!0});var ne=s(j);y(vt.$$.fragment,ne),Wi=d(ne),$a=n(ne,"P",{});var Oc=s($a);Hi=i(Oc,"The bare ImageGPT Model transformer outputting raw hidden-states without any specific head on top."),Oc.forEach(t),Bi=d(ne),bt=n(ne,"P",{});var zn=s(bt);Vi=i(zn,"This model inherits from "),Zt=n(zn,"A",{href:!0});var Sc=s(Zt);Ui=i(Sc,"PreTrainedModel"),Sc.forEach(t),Ji=i(zn,`. 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.)`),zn.forEach(t),Xi=d(ne),yt=n(ne,"P",{});var Mn=s(yt);Yi=i(Mn,"This model is also a PyTorch "),It=n(Mn,"A",{href:!0,rel:!0});var Lc=s(It);Qi=i(Lc,"torch.nn.Module"),Lc.forEach(t),Ki=i(Mn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Mn.forEach(t),Zi=d(ne),R=n(ne,"DIV",{class:!0});var Be=s(R);y(Pt.$$.fragment,Be),el=d(Be),ue=n(Be,"P",{});var lo=s(ue);tl=i(lo,"The "),eo=n(lo,"A",{href:!0});var Rc=s(eo);ol=i(Rc,"ImageGPTModel"),Rc.forEach(t),al=i(lo," forward method, overrides the "),Ga=n(lo,"CODE",{});var Wc=s(Ga);nl=i(Wc,"__call__"),Wc.forEach(t),sl=i(lo," special method."),lo.forEach(t),rl=d(Be),y(qe.$$.fragment,Be),il=d(Be),y(je.$$.fragment,Be),Be.forEach(t),ne.forEach(t),cn=d(o),fe=n(o,"H2",{class:!0});var Fn=s(fe);Ae=n(Fn,"A",{id:!0,class:!0,href:!0});var Hc=s(Ae);xa=n(Hc,"SPAN",{});var Bc=s(xa);y(wt.$$.fragment,Bc),Bc.forEach(t),Hc.forEach(t),ll=d(Fn),Ea=n(Fn,"SPAN",{});var Vc=s(Ea);dl=i(Vc,"ImageGPTForCausalImageModeling"),Vc.forEach(t),Fn.forEach(t),mn=d(o),A=n(o,"DIV",{class:!0});var se=s(A);y(kt.$$.fragment,se),cl=d(se),Ca=n(se,"P",{});var Uc=s(Ca);ml=i(Uc,`The ImageGPT Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),Uc.forEach(t),pl=d(se),$t=n(se,"P",{});var qn=s($t);hl=i(qn,"This model inherits from "),to=n(qn,"A",{href:!0});var Jc=s(to);gl=i(Jc,"PreTrainedModel"),Jc.forEach(t),ul=i(qn,`. 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.)`),qn.forEach(t),fl=d(se),Gt=n(se,"P",{});var jn=s(Gt);_l=i(jn,"This model is also a PyTorch "),xt=n(jn,"A",{href:!0,rel:!0});var Xc=s(xt);Tl=i(Xc,"torch.nn.Module"),Xc.forEach(t),vl=i(jn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),jn.forEach(t),bl=d(se),W=n(se,"DIV",{class:!0});var Ve=s(W);y(Et.$$.fragment,Ve),yl=d(Ve),_e=n(Ve,"P",{});var co=s(_e);Il=i(co,"The "),oo=n(co,"A",{href:!0});var Yc=s(oo);Pl=i(Yc,"ImageGPTForCausalImageModeling"),Yc.forEach(t),wl=i(co," forward method, overrides the "),za=n(co,"CODE",{});var Qc=s(za);kl=i(Qc,"__call__"),Qc.forEach(t),$l=i(co," special method."),co.forEach(t),Gl=d(Ve),y(De.$$.fragment,Ve),xl=d(Ve),y(Ne.$$.fragment,Ve),Ve.forEach(t),se.forEach(t),pn=d(o),Te=n(o,"H2",{class:!0});var An=s(Te);Oe=n(An,"A",{id:!0,class:!0,href:!0});var Kc=s(Oe);Ma=n(Kc,"SPAN",{});var Zc=s(Ma);y(Ct.$$.fragment,Zc),Zc.forEach(t),Kc.forEach(t),El=d(An),Fa=n(An,"SPAN",{});var em=s(Fa);Cl=i(em,"ImageGPTForImageClassification"),em.forEach(t),An.forEach(t),hn=d(o),D=n(o,"DIV",{class:!0});var re=s(D);y(zt.$$.fragment,re),zl=d(re),Mt=n(re,"P",{});var Dn=s(Mt);Ml=i(Dn,`The ImageGPT Model transformer with an image classification head on top (linear layer).
`),ao=n(Dn,"A",{href:!0});var tm=s(ao);Fl=i(tm,"ImageGPTForImageClassification"),tm.forEach(t),ql=i(Dn," average-pools the hidden states in order to do the classification."),Dn.forEach(t),jl=d(re),Ft=n(re,"P",{});var Nn=s(Ft);Al=i(Nn,"This model inherits from "),no=n(Nn,"A",{href:!0});var om=s(no);Dl=i(om,"PreTrainedModel"),om.forEach(t),Nl=i(Nn,`. 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.)`),Nn.forEach(t),Ol=d(re),qt=n(re,"P",{});var On=s(qt);Sl=i(On,"This model is also a PyTorch "),jt=n(On,"A",{href:!0,rel:!0});var am=s(jt);Ll=i(am,"torch.nn.Module"),am.forEach(t),Rl=i(On,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),On.forEach(t),Wl=d(re),H=n(re,"DIV",{class:!0});var Ue=s(H);y(At.$$.fragment,Ue),Hl=d(Ue),ve=n(Ue,"P",{});var mo=s(ve);Bl=i(mo,"The "),so=n(mo,"A",{href:!0});var nm=s(so);Vl=i(nm,"ImageGPTForImageClassification"),nm.forEach(t),Ul=i(mo," forward method, overrides the "),qa=n(mo,"CODE",{});var sm=s(qa);Jl=i(sm,"__call__"),sm.forEach(t),Xl=i(mo," special method."),mo.forEach(t),Yl=d(Ue),y(Se.$$.fragment,Ue),Ql=d(Ue),y(Le.$$.fragment,Ue),Ue.forEach(t),re.forEach(t),this.h()},h(){m(g,"name","hf:doc:metadata"),m(g,"content",JSON.stringify(ym)),m(u,"id","imagegpt"),m(u,"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"),m(u,"href","#imagegpt"),m(_,"class","relative group"),m(ye,"id","overview"),m(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"),m(ye,"href","#overview"),m(ie,"class","relative group"),m(Xe,"href","https://openai.com/blog/image-gpt"),m(Xe,"rel","nofollow"),cm(Pe.src,Zl="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/imagegpt_architecture.png")||m(Pe,"src",Zl),m(Pe,"alt","drawing"),m(Pe,"width","600"),m(Ye,"href","https://huggingface.co/nielsr"),m(Ye,"rel","nofollow"),m(Qe,"href","https://github.com/openai/image-gpt/issues/7"),m(Qe,"rel","nofollow"),m(Ke,"href","https://github.com/openai/image-gpt"),m(Ke,"rel","nofollow"),m(Ht,"href","gpt2"),m(Bt,"href","/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTImageProcessor"),m(Vt,"href","/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTForImageClassification"),m(ke,"id","resources"),m(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"),m(ke,"href","#resources"),m(le,"class","relative group"),m(rt,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/ImageGPT"),m(rt,"rel","nofollow"),m(Jt,"href","/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTForImageClassification"),m(it,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),m(it,"rel","nofollow"),m(lt,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),m(lt,"rel","nofollow"),m(Ge,"id","transformers.ImageGPTConfig"),m(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"),m(Ge,"href","#transformers.ImageGPTConfig"),m(de,"class","relative group"),m(Yt,"href","/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTModel"),m(mt,"href","https://huggingface.co/openai/imagegpt-small"),m(mt,"rel","nofollow"),m(Qt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),m(Kt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),m(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ee,"id","transformers.ImageGPTFeatureExtractor"),m(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"),m(Ee,"href","#transformers.ImageGPTFeatureExtractor"),m(me,"class","relative group"),m(Ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ze,"id","transformers.ImageGPTImageProcessor"),m(ze,"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"),m(ze,"href","#transformers.ImageGPTImageProcessor"),m(he,"class","relative group"),m(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Fe,"id","transformers.ImageGPTModel"),m(Fe,"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"),m(Fe,"href","#transformers.ImageGPTModel"),m(ge,"class","relative group"),m(Zt,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),m(It,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(It,"rel","nofollow"),m(eo,"href","/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTModel"),m(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ae,"id","transformers.ImageGPTForCausalImageModeling"),m(Ae,"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"),m(Ae,"href","#transformers.ImageGPTForCausalImageModeling"),m(fe,"class","relative group"),m(to,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),m(xt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(xt,"rel","nofollow"),m(oo,"href","/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTForCausalImageModeling"),m(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Oe,"id","transformers.ImageGPTForImageClassification"),m(Oe,"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"),m(Oe,"href","#transformers.ImageGPTForImageClassification"),m(Te,"class","relative group"),m(ao,"href","/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTForImageClassification"),m(no,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),m(jt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(jt,"rel","nofollow"),m(so,"href","/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTForImageClassification"),m(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,p){e(document.head,g),h(o,v,p),h(o,_,p),e(_,u),e(u,T),I(c,T,null),e(_,f),e(_,N),e(N,Wn),h(o,Sa,p),h(o,ie,p),e(ie,ye),e(ye,po),I(Je,po,null),e(ie,Hn),e(ie,ho),e(ho,Bn),h(o,La,p),h(o,Ie,p),e(Ie,Vn),e(Ie,Xe),e(Xe,Un),e(Ie,Jn),h(o,Ra,p),h(o,St,p),e(St,Xn),h(o,Wa,p),h(o,Lt,p),e(Lt,go),e(go,Yn),h(o,Ha,p),h(o,Pe,p),h(o,Ba,p),h(o,Rt,p),e(Rt,Qn),h(o,Va,p),h(o,L,p),e(L,Kn),e(L,Ye),e(Ye,Zn),e(L,es),e(L,Qe),e(Qe,ts),e(L,os),e(L,Ke),e(Ke,as),e(L,ns),h(o,Ua,p),h(o,Wt,p),e(Wt,ss),h(o,Ja,p),h(o,O,p),e(O,Ze),e(Ze,rs),e(Ze,Ht),e(Ht,is),e(Ze,ls),e(O,ds),e(O,et),e(et,cs),e(et,Bt),e(Bt,ms),e(et,ps),e(O,hs),e(O,tt),e(tt,gs),e(tt,uo),e(uo,us),e(tt,fs),e(O,_s),e(O,ot),e(ot,Ts),e(ot,Vt),e(Vt,vs),e(ot,bs),e(O,ys),e(O,fo),e(fo,Is),h(o,Xa,p),h(o,we,p),e(we,_o),e(_o,G),e(G,To),e(To,vo),e(vo,Ps),e(G,ws),e(G,bo),e(bo,yo),e(yo,ks),e(G,$s),e(G,Io),e(Io,Po),e(Po,Gs),e(G,xs),e(G,wo),e(wo,ko),e(ko,Es),e(G,Cs),e(G,$o),e($o,Go),e(Go,zs),e(G,Ms),e(G,xo),e(xo,Eo),e(Eo,Fs),e(we,qs),e(we,x),e(x,E),e(E,Co),e(Co,js),e(E,As),e(E,zo),e(zo,Ds),e(E,Ns),e(E,Mo),e(Mo,Os),e(E,Ss),e(E,Fo),e(Fo,Ls),e(E,Rs),e(E,qo),e(qo,Ws),e(E,Hs),e(E,jo),e(jo,Bs),e(x,Vs),e(x,C),e(C,Ao),e(Ao,Us),e(C,Js),e(C,Do),e(Do,Xs),e(C,Ys),e(C,No),e(No,Qs),e(C,Ks),e(C,Oo),e(Oo,Zs),e(C,er),e(C,So),e(So,tr),e(C,or),e(C,Lo),e(Lo,ar),e(x,nr),e(x,z),e(z,Ro),e(Ro,sr),e(z,rr),e(z,Wo),e(Wo,ir),e(z,lr),e(z,Ho),e(Ho,dr),e(z,cr),e(z,Bo),e(Bo,mr),e(z,pr),e(z,Vo),e(Vo,hr),e(z,gr),e(z,Uo),e(Uo,ur),e(x,fr),e(x,M),e(M,Jo),e(Jo,_r),e(M,Tr),e(M,Xo),e(Xo,vr),e(M,br),e(M,Yo),e(Yo,yr),e(M,Ir),e(M,Qo),e(Qo,Pr),e(M,wr),e(M,Ko),e(Ko,kr),e(M,$r),e(M,Zo),e(Zo,Gr),e(x,xr),e(x,F),e(F,ea),e(ea,Er),e(F,Cr),e(F,ta),e(ta,zr),e(F,Mr),e(F,oa),e(oa,Fr),e(F,qr),e(F,aa),e(aa,jr),e(F,Ar),e(F,na),e(na,Dr),e(F,Nr),e(F,sa),e(sa,Or),e(x,Sr),e(x,q),e(q,ra),e(ra,Lr),e(q,Rr),e(q,ia),e(ia,Wr),e(q,Hr),e(q,la),e(la,Br),e(q,Vr),e(q,da),e(da,Ur),e(q,Jr),e(q,ca),e(ca,Xr),e(q,Yr),e(q,ma),e(ma,Qr),h(o,Ya,p),h(o,le,p),e(le,ke),e(ke,pa),I(at,pa,null),e(le,Kr),e(le,ha),e(ha,Zr),h(o,Qa,p),h(o,Ut,p),e(Ut,ei),h(o,Ka,p),I(nt,o,p),h(o,Za,p),h(o,$e,p),e($e,st),e(st,ti),e(st,rt),e(rt,oi),e(st,ai),e($e,ni),e($e,oe),e(oe,Jt),e(Jt,si),e(oe,ri),e(oe,it),e(it,ii),e(oe,li),e(oe,lt),e(lt,di),e(oe,ci),h(o,en,p),h(o,Xt,p),e(Xt,mi),h(o,tn,p),h(o,de,p),e(de,Ge),e(Ge,ga),I(dt,ga,null),e(de,pi),e(de,ua),e(ua,hi),h(o,on,p),h(o,S,p),I(ct,S,null),e(S,gi),e(S,Z),e(Z,ui),e(Z,Yt),e(Yt,fi),e(Z,_i),e(Z,fa),e(fa,Ti),e(Z,vi),e(Z,mt),e(mt,bi),e(Z,yi),e(S,Ii),e(S,ce),e(ce,Pi),e(ce,Qt),e(Qt,wi),e(ce,ki),e(ce,Kt),e(Kt,$i),e(ce,Gi),e(S,xi),I(xe,S,null),h(o,an,p),h(o,me,p),e(me,Ee),e(Ee,_a),I(pt,_a,null),e(me,Ei),e(me,Ta),e(Ta,Ci),h(o,nn,p),h(o,pe,p),I(ht,pe,null),e(pe,zi),e(pe,Ce),I(gt,Ce,null),e(Ce,Mi),e(Ce,va),e(va,Fi),h(o,sn,p),h(o,he,p),e(he,ze),e(ze,ba),I(ut,ba,null),e(he,qi),e(he,ya),e(ya,ji),h(o,rn,p),h(o,ee,p),I(ft,ee,null),e(ee,Ai),e(ee,Ia),e(Ia,Di),e(ee,Ni),e(ee,Me),I(_t,Me,null),e(Me,Oi),e(Me,Pa),e(Pa,Si),h(o,ln,p),h(o,ge,p),e(ge,Fe),e(Fe,wa),I(Tt,wa,null),e(ge,Li),e(ge,ka),e(ka,Ri),h(o,dn,p),h(o,j,p),I(vt,j,null),e(j,Wi),e(j,$a),e($a,Hi),e(j,Bi),e(j,bt),e(bt,Vi),e(bt,Zt),e(Zt,Ui),e(bt,Ji),e(j,Xi),e(j,yt),e(yt,Yi),e(yt,It),e(It,Qi),e(yt,Ki),e(j,Zi),e(j,R),I(Pt,R,null),e(R,el),e(R,ue),e(ue,tl),e(ue,eo),e(eo,ol),e(ue,al),e(ue,Ga),e(Ga,nl),e(ue,sl),e(R,rl),I(qe,R,null),e(R,il),I(je,R,null),h(o,cn,p),h(o,fe,p),e(fe,Ae),e(Ae,xa),I(wt,xa,null),e(fe,ll),e(fe,Ea),e(Ea,dl),h(o,mn,p),h(o,A,p),I(kt,A,null),e(A,cl),e(A,Ca),e(Ca,ml),e(A,pl),e(A,$t),e($t,hl),e($t,to),e(to,gl),e($t,ul),e(A,fl),e(A,Gt),e(Gt,_l),e(Gt,xt),e(xt,Tl),e(Gt,vl),e(A,bl),e(A,W),I(Et,W,null),e(W,yl),e(W,_e),e(_e,Il),e(_e,oo),e(oo,Pl),e(_e,wl),e(_e,za),e(za,kl),e(_e,$l),e(W,Gl),I(De,W,null),e(W,xl),I(Ne,W,null),h(o,pn,p),h(o,Te,p),e(Te,Oe),e(Oe,Ma),I(Ct,Ma,null),e(Te,El),e(Te,Fa),e(Fa,Cl),h(o,hn,p),h(o,D,p),I(zt,D,null),e(D,zl),e(D,Mt),e(Mt,Ml),e(Mt,ao),e(ao,Fl),e(Mt,ql),e(D,jl),e(D,Ft),e(Ft,Al),e(Ft,no),e(no,Dl),e(Ft,Nl),e(D,Ol),e(D,qt),e(qt,Sl),e(qt,jt),e(jt,Ll),e(qt,Rl),e(D,Wl),e(D,H),I(At,H,null),e(H,Hl),e(H,ve),e(ve,Bl),e(ve,so),e(so,Vl),e(ve,Ul),e(ve,qa),e(qa,Jl),e(ve,Xl),e(H,Yl),I(Se,H,null),e(H,Ql),I(Le,H,null),gn=!0},p(o,[p]){const Dt={};p&2&&(Dt.$$scope={dirty:p,ctx:o}),xe.$set(Dt);const ja={};p&2&&(ja.$$scope={dirty:p,ctx:o}),qe.$set(ja);const Aa={};p&2&&(Aa.$$scope={dirty:p,ctx:o}),je.$set(Aa);const Da={};p&2&&(Da.$$scope={dirty:p,ctx:o}),De.$set(Da);const Nt={};p&2&&(Nt.$$scope={dirty:p,ctx:o}),Ne.$set(Nt);const Na={};p&2&&(Na.$$scope={dirty:p,ctx:o}),Se.$set(Na);const Oa={};p&2&&(Oa.$$scope={dirty:p,ctx:o}),Le.$set(Oa)},i(o){gn||(P(c.$$.fragment,o),P(Je.$$.fragment,o),P(at.$$.fragment,o),P(nt.$$.fragment,o),P(dt.$$.fragment,o),P(ct.$$.fragment,o),P(xe.$$.fragment,o),P(pt.$$.fragment,o),P(ht.$$.fragment,o),P(gt.$$.fragment,o),P(ut.$$.fragment,o),P(ft.$$.fragment,o),P(_t.$$.fragment,o),P(Tt.$$.fragment,o),P(vt.$$.fragment,o),P(Pt.$$.fragment,o),P(qe.$$.fragment,o),P(je.$$.fragment,o),P(wt.$$.fragment,o),P(kt.$$.fragment,o),P(Et.$$.fragment,o),P(De.$$.fragment,o),P(Ne.$$.fragment,o),P(Ct.$$.fragment,o),P(zt.$$.fragment,o),P(At.$$.fragment,o),P(Se.$$.fragment,o),P(Le.$$.fragment,o),gn=!0)},o(o){w(c.$$.fragment,o),w(Je.$$.fragment,o),w(at.$$.fragment,o),w(nt.$$.fragment,o),w(dt.$$.fragment,o),w(ct.$$.fragment,o),w(xe.$$.fragment,o),w(pt.$$.fragment,o),w(ht.$$.fragment,o),w(gt.$$.fragment,o),w(ut.$$.fragment,o),w(ft.$$.fragment,o),w(_t.$$.fragment,o),w(Tt.$$.fragment,o),w(vt.$$.fragment,o),w(Pt.$$.fragment,o),w(qe.$$.fragment,o),w(je.$$.fragment,o),w(wt.$$.fragment,o),w(kt.$$.fragment,o),w(Et.$$.fragment,o),w(De.$$.fragment,o),w(Ne.$$.fragment,o),w(Ct.$$.fragment,o),w(zt.$$.fragment,o),w(At.$$.fragment,o),w(Se.$$.fragment,o),w(Le.$$.fragment,o),gn=!1},d(o){t(g),o&&t(v),o&&t(_),k(c),o&&t(Sa),o&&t(ie),k(Je),o&&t(La),o&&t(Ie),o&&t(Ra),o&&t(St),o&&t(Wa),o&&t(Lt),o&&t(Ha),o&&t(Pe),o&&t(Ba),o&&t(Rt),o&&t(Va),o&&t(L),o&&t(Ua),o&&t(Wt),o&&t(Ja),o&&t(O),o&&t(Xa),o&&t(we),o&&t(Ya),o&&t(le),k(at),o&&t(Qa),o&&t(Ut),o&&t(Ka),k(nt,o),o&&t(Za),o&&t($e),o&&t(en),o&&t(Xt),o&&t(tn),o&&t(de),k(dt),o&&t(on),o&&t(S),k(ct),k(xe),o&&t(an),o&&t(me),k(pt),o&&t(nn),o&&t(pe),k(ht),k(gt),o&&t(sn),o&&t(he),k(ut),o&&t(rn),o&&t(ee),k(ft),k(_t),o&&t(ln),o&&t(ge),k(Tt),o&&t(dn),o&&t(j),k(vt),k(Pt),k(qe),k(je),o&&t(cn),o&&t(fe),k(wt),o&&t(mn),o&&t(A),k(kt),k(Et),k(De),k(Ne),o&&t(pn),o&&t(Te),k(Ct),o&&t(hn),o&&t(D),k(zt),k(At),k(Se),k(Le)}}}const ym={local:"imagegpt",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.ImageGPTConfig",title:"ImageGPTConfig"},{local:"transformers.ImageGPTFeatureExtractor",title:"ImageGPTFeatureExtractor"},{local:"transformers.ImageGPTImageProcessor",title:"ImageGPTImageProcessor"},{local:"transformers.ImageGPTModel",title:"ImageGPTModel"},{local:"transformers.ImageGPTForCausalImageModeling",title:"ImageGPTForCausalImageModeling"},{local:"transformers.ImageGPTForImageClassification",title:"ImageGPTForImageClassification"}],title:"ImageGPT"};function Im($){return mm(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Cm extends rm{constructor(g){super();im(this,g,Im,bm,lm,{})}}export{Cm as default,ym as metadata};
