import{S as hm,i as gm,s as um,e as a,k as l,w as b,t as r,M as fm,c as s,d as t,m as d,a as n,x as y,h as i,b as m,N as _m,G as e,g as h,y as I,q as P,o as w,B as k,v as vm,L as Rs}from"../../chunks/vendor-hf-doc-builder.js";import{T as sd}from"../../chunks/Tip-hf-doc-builder.js";import{D as te}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ws}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as ye}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ls}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Tm}from"../../chunks/PipelineTag-hf-doc-builder.js";function bm($){let g,T,_,u,v;return u=new Ws({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"),T=r("Example:"),_=l(),b(u.$$.fragment)},l(c){g=s(c,"P",{});var f=n(g);T=i(f,"Example:"),f.forEach(t),_=d(c),y(u.$$.fragment,c)},m(c,f){h(c,g,f),e(g,T),h(c,_,f),I(u,c,f),v=!0},p:Rs,i(c){v||(P(u.$$.fragment,c),v=!0)},o(c){w(u.$$.fragment,c),v=!1},d(c){c&&t(g),c&&t(_),k(u,c)}}}function ym($){let g,T,_,u,v;return{c(){g=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),u=r("Module"),v=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=s(c,"P",{});var f=n(g);T=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var N=n(_);u=i(N,"Module"),N.forEach(t),v=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,T),e(g,_),e(_,u),e(g,v)},d(c){c&&t(g)}}}function Im($){let g,T,_,u,v;return u=new Ws({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"),T=r("Examples:"),_=l(),b(u.$$.fragment)},l(c){g=s(c,"P",{});var f=n(g);T=i(f,"Examples:"),f.forEach(t),_=d(c),y(u.$$.fragment,c)},m(c,f){h(c,g,f),e(g,T),h(c,_,f),I(u,c,f),v=!0},p:Rs,i(c){v||(P(u.$$.fragment,c),v=!0)},o(c){w(u.$$.fragment,c),v=!1},d(c){c&&t(g),c&&t(_),k(u,c)}}}function Pm($){let g,T,_,u,v;return{c(){g=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),u=r("Module"),v=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=s(c,"P",{});var f=n(g);T=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var N=n(_);u=i(N,"Module"),N.forEach(t),v=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,T),e(g,_),e(_,u),e(g,v)},d(c){c&&t(g)}}}function wm($){let g,T,_,u,v;return u=new Ws({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"),T=r("Examples:"),_=l(),b(u.$$.fragment)},l(c){g=s(c,"P",{});var f=n(g);T=i(f,"Examples:"),f.forEach(t),_=d(c),y(u.$$.fragment,c)},m(c,f){h(c,g,f),e(g,T),h(c,_,f),I(u,c,f),v=!0},p:Rs,i(c){v||(P(u.$$.fragment,c),v=!0)},o(c){w(u.$$.fragment,c),v=!1},d(c){c&&t(g),c&&t(_),k(u,c)}}}function km($){let g,T,_,u,v;return{c(){g=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),u=r("Module"),v=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=s(c,"P",{});var f=n(g);T=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var N=n(_);u=i(N,"Module"),N.forEach(t),v=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,T),e(g,_),e(_,u),e(g,v)},d(c){c&&t(g)}}}function $m($){let g,T,_,u,v;return u=new Ws({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"),T=r("Examples:"),_=l(),b(u.$$.fragment)},l(c){g=s(c,"P",{});var f=n(g);T=i(f,"Examples:"),f.forEach(t),_=d(c),y(u.$$.fragment,c)},m(c,f){h(c,g,f),e(g,T),h(c,_,f),I(u,c,f),v=!0},p:Rs,i(c){v||(P(u.$$.fragment,c),v=!0)},o(c){w(u.$$.fragment,c),v=!1},d(c){c&&t(g),c&&t(_),k(u,c)}}}function Gm($){let g,T,_,u,v,c,f,N,Hs,Wa,le,Ie,uo,Je,Bs,fo,Vs,Ha,Pe,Us,Xe,Js,Xs,Ba,St,Ys,Va,Lt,_o,Qs,Ua,we,nd,Ja,Rt,Ks,Xa,L,Zs,Ye,en,tn,Qe,on,an,Ke,sn,nn,Ya,Wt,rn,Qa,O,Ze,ln,Ht,dn,cn,mn,et,pn,Bt,hn,gn,un,tt,fn,vo,_n,vn,Tn,ot,bn,Vt,yn,In,Pn,To,wn,Ka,ke,bo,G,yo,Io,kn,$n,Po,wo,Gn,En,ko,$o,xn,Cn,Go,Eo,zn,Mn,xo,Co,qn,Fn,zo,Mo,jn,An,E,x,qo,Dn,Nn,Fo,On,Sn,jo,Ln,Rn,Ao,Wn,Hn,Do,Bn,Vn,No,Un,Jn,C,Oo,Xn,Yn,So,Qn,Kn,Lo,Zn,er,Ro,tr,or,Wo,ar,sr,Ho,nr,rr,z,Bo,ir,lr,Vo,dr,cr,Uo,mr,pr,Jo,hr,gr,Xo,ur,fr,Yo,_r,vr,M,Qo,Tr,br,Ko,yr,Ir,Zo,Pr,wr,ea,kr,$r,ta,Gr,Er,oa,xr,Cr,q,aa,zr,Mr,sa,qr,Fr,na,jr,Ar,ra,Dr,Nr,ia,Or,Sr,la,Lr,Rr,F,da,Wr,Hr,ca,Br,Vr,ma,Ur,Jr,pa,Xr,Yr,ha,Qr,Kr,ga,Zr,Za,de,$e,ua,at,ei,fa,ti,es,Ut,oi,ts,st,os,oe,nt,ai,rt,si,ni,ri,ae,Jt,ii,li,it,di,ci,lt,mi,pi,hi,Xt,gi,Yt,ui,as,Qt,fi,ss,ce,Ge,_a,dt,_i,va,vi,ns,S,ct,Ti,Z,bi,Kt,yi,Ii,Ta,Pi,wi,mt,ki,$i,Gi,me,Ei,Zt,xi,Ci,eo,zi,Mi,qi,Ee,rs,pe,xe,ba,pt,Fi,ya,ji,is,he,ht,Ai,Ce,gt,Di,Ia,Ni,ls,ge,ze,Pa,ut,Oi,wa,Si,ds,ee,ft,Li,ka,Ri,Wi,Me,_t,Hi,$a,Bi,cs,ue,qe,Ga,vt,Vi,Ea,Ui,ms,j,Tt,Ji,xa,Xi,Yi,bt,Qi,to,Ki,Zi,el,yt,tl,It,ol,al,sl,R,Pt,nl,fe,rl,oo,il,ll,Ca,dl,cl,ml,Fe,pl,je,ps,_e,Ae,za,wt,hl,Ma,gl,hs,A,kt,ul,qa,fl,_l,$t,vl,ao,Tl,bl,yl,Gt,Il,Et,Pl,wl,kl,W,xt,$l,ve,Gl,so,El,xl,Fa,Cl,zl,Ml,De,ql,Ne,gs,Te,Oe,ja,Ct,Fl,Aa,jl,us,D,zt,Al,Mt,Dl,no,Nl,Ol,Sl,qt,Ll,ro,Rl,Wl,Hl,Ft,Bl,jt,Vl,Ul,Jl,H,At,Xl,be,Yl,io,Ql,Kl,Da,Zl,ed,td,Se,od,Le,fs;return c=new ye({}),Je=new ye({}),at=new ye({}),st=new Tm({props:{pipeline:"image-classification"}}),dt=new ye({}),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/v4.29.0/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/v4.29.0/src/transformers/models/imagegpt/configuration_imagegpt.py#L37"}}),Ee=new Ls({props:{anchor:"transformers.ImageGPTConfig.example",$$slots:{default:[bm]},$$scope:{ctx:$}}}),pt=new ye({}),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/v4.29.0/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/v4.29.0/src/transformers/image_processing_utils.py#L462"}}),ut=new ye({}),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/v4.29.0/src/transformers/models/imagegpt/image_processing_imagegpt.py#L56"}}),_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[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, 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/v4.29.0/src/transformers/models/imagegpt/image_processing_imagegpt.py#L149"}}),vt=new ye({}),Tt=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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/v4.29.0/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/v4.29.0/src/transformers/models/imagegpt/modeling_imagegpt.py#L650",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Fe=new sd({props:{$$slots:{default:[ym]},$$scope:{ctx:$}}}),je=new Ls({props:{anchor:"transformers.ImageGPTModel.forward.example",$$slots:{default:[Im]},$$scope:{ctx:$}}}),wt=new ye({}),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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/imagegpt/modeling_imagegpt.py#L895"}}),xt=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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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/v4.29.0/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/v4.29.0/src/transformers/models/imagegpt/modeling_imagegpt.py#L943",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/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/v4.29.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),De=new sd({props:{$$slots:{default:[Pm]},$$scope:{ctx:$}}}),Ne=new Ls({props:{anchor:"transformers.ImageGPTForCausalImageModeling.forward.example",$$slots:{default:[wm]},$$scope:{ctx:$}}}),Ct=new ye({}),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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/imagegpt/modeling_imagegpt.py#L1086"}}),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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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/v4.29.0/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/v4.29.0/src/transformers/models/imagegpt/modeling_imagegpt.py#L1098",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/v4.29.0/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 sd({props:{$$slots:{default:[km]},$$scope:{ctx:$}}}),Le=new Ls({props:{anchor:"transformers.ImageGPTForImageClassification.forward.example",$$slots:{default:[$m]},$$scope:{ctx:$}}}),{c(){g=a("meta"),T=l(),_=a("h1"),u=a("a"),v=a("span"),b(c.$$.fragment),f=l(),N=a("span"),Hs=r("ImageGPT"),Wa=l(),le=a("h2"),Ie=a("a"),uo=a("span"),b(Je.$$.fragment),Bs=l(),fo=a("span"),Vs=r("Overview"),Ha=l(),Pe=a("p"),Us=r("The ImageGPT model was proposed in "),Xe=a("a"),Js=r("Generative Pretraining from Pixels"),Xs=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.`),Ba=l(),St=a("p"),Ys=r("The abstract from the paper is the following:"),Va=l(),Lt=a("p"),_o=a("em"),Qs=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.`),Ua=l(),we=a("img"),Ja=l(),Rt=a("small"),Ks=r("Summary of the approach. Taken from the [original paper](https://cdn.openai.com/papers/Generative_Pretraining_from_Pixels_V2.pdf)."),Xa=l(),L=a("p"),Zs=r("This model was contributed by "),Ye=a("a"),en=r("nielsr"),tn=r(", based on "),Qe=a("a"),on=r("this issue"),an=r(`. The original code can be found
`),Ke=a("a"),sn=r("here"),nn=r("."),Ya=l(),Wt=a("p"),rn=r("Tips:"),Qa=l(),O=a("ul"),Ze=a("li"),ln=r("ImageGPT is almost exactly the same as "),Ht=a("a"),dn=r("GPT-2"),cn=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.`),mn=l(),et=a("li"),pn=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"),hn=r("ImageGPTImageProcessor"),gn=r(` to prepare
images for the model.`),un=l(),tt=a("li"),fn=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 `),vo=a("code"),_n=r("output_hidden_states=True"),vn=r(`, and
then average-pool the hidden states at whatever layer you like.`),Tn=l(),ot=a("li"),bn=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"),yn=r("ImageGPTForImageClassification"),In=r("."),Pn=l(),To=a("li"),wn=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:`),Ka=l(),ke=a("table"),bo=a("thead"),G=a("tr"),yo=a("th"),Io=a("strong"),kn=r("Model variant"),$n=l(),Po=a("th"),wo=a("strong"),Gn=r("Depths"),En=l(),ko=a("th"),$o=a("strong"),xn=r("Hidden sizes"),Cn=l(),Go=a("th"),Eo=a("strong"),zn=r("Decoder hidden size"),Mn=l(),xo=a("th"),Co=a("strong"),qn=r("Params (M)"),Fn=l(),zo=a("th"),Mo=a("strong"),jn=r("ImageNet-1k Top 1"),An=l(),E=a("tbody"),x=a("tr"),qo=a("td"),Dn=r("MiT-b0"),Nn=l(),Fo=a("td"),On=r("[2, 2, 2, 2]"),Sn=l(),jo=a("td"),Ln=r("[32, 64, 160, 256]"),Rn=l(),Ao=a("td"),Wn=r("256"),Hn=l(),Do=a("td"),Bn=r("3.7"),Vn=l(),No=a("td"),Un=r("70.5"),Jn=l(),C=a("tr"),Oo=a("td"),Xn=r("MiT-b1"),Yn=l(),So=a("td"),Qn=r("[2, 2, 2, 2]"),Kn=l(),Lo=a("td"),Zn=r("[64, 128, 320, 512]"),er=l(),Ro=a("td"),tr=r("256"),or=l(),Wo=a("td"),ar=r("14.0"),sr=l(),Ho=a("td"),nr=r("78.7"),rr=l(),z=a("tr"),Bo=a("td"),ir=r("MiT-b2"),lr=l(),Vo=a("td"),dr=r("[3, 4, 6, 3]"),cr=l(),Uo=a("td"),mr=r("[64, 128, 320, 512]"),pr=l(),Jo=a("td"),hr=r("768"),gr=l(),Xo=a("td"),ur=r("25.4"),fr=l(),Yo=a("td"),_r=r("81.6"),vr=l(),M=a("tr"),Qo=a("td"),Tr=r("MiT-b3"),br=l(),Ko=a("td"),yr=r("[3, 4, 18, 3]"),Ir=l(),Zo=a("td"),Pr=r("[64, 128, 320, 512]"),wr=l(),ea=a("td"),kr=r("768"),$r=l(),ta=a("td"),Gr=r("45.2"),Er=l(),oa=a("td"),xr=r("83.1"),Cr=l(),q=a("tr"),aa=a("td"),zr=r("MiT-b4"),Mr=l(),sa=a("td"),qr=r("[3, 8, 27, 3]"),Fr=l(),na=a("td"),jr=r("[64, 128, 320, 512]"),Ar=l(),ra=a("td"),Dr=r("768"),Nr=l(),ia=a("td"),Or=r("62.6"),Sr=l(),la=a("td"),Lr=r("83.6"),Rr=l(),F=a("tr"),da=a("td"),Wr=r("MiT-b5"),Hr=l(),ca=a("td"),Br=r("[3, 6, 40, 3]"),Vr=l(),ma=a("td"),Ur=r("[64, 128, 320, 512]"),Jr=l(),pa=a("td"),Xr=r("768"),Yr=l(),ha=a("td"),Qr=r("82.0"),Kr=l(),ga=a("td"),Zr=r("83.8"),Za=l(),de=a("h2"),$e=a("a"),ua=a("span"),b(at.$$.fragment),ei=l(),fa=a("span"),ti=r("Resources"),es=l(),Ut=a("p"),oi=r("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with ImageGPT."),ts=l(),b(st.$$.fragment),os=l(),oe=a("ul"),nt=a("li"),ai=r("Demo notebooks for ImageGPT can be found "),rt=a("a"),si=r("here"),ni=r("."),ri=l(),ae=a("li"),Jt=a("a"),ii=r("ImageGPTForImageClassification"),li=r(" is supported by this "),it=a("a"),di=r("example script"),ci=r(" and "),lt=a("a"),mi=r("notebook"),pi=r("."),hi=l(),Xt=a("li"),gi=r("See also: "),Yt=a("a"),ui=r("Image classification task guide"),as=l(),Qt=a("p"),fi=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."),ss=l(),ce=a("h2"),Ge=a("a"),_a=a("span"),b(dt.$$.fragment),_i=l(),va=a("span"),vi=r("ImageGPTConfig"),ns=l(),S=a("div"),b(ct.$$.fragment),Ti=l(),Z=a("p"),bi=r("This is the configuration class to store the configuration of a "),Kt=a("a"),yi=r("ImageGPTModel"),Ii=r(" or a "),Ta=a("code"),Pi=r("TFImageGPTModel"),wi=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"),ki=r("openai/imagegpt-small"),$i=r(" architecture."),Gi=l(),me=a("p"),Ei=r("Configuration objects inherit from "),Zt=a("a"),xi=r("PretrainedConfig"),Ci=r(` and can be used to control the model outputs. Read the
documentation from `),eo=a("a"),zi=r("PretrainedConfig"),Mi=r(" for more information."),qi=l(),b(Ee.$$.fragment),rs=l(),pe=a("h2"),xe=a("a"),ba=a("span"),b(pt.$$.fragment),Fi=l(),ya=a("span"),ji=r("ImageGPTFeatureExtractor"),is=l(),he=a("div"),b(ht.$$.fragment),Ai=l(),Ce=a("div"),b(gt.$$.fragment),Di=l(),Ia=a("p"),Ni=r("Preprocess an image or a batch of images."),ls=l(),ge=a("h2"),ze=a("a"),Pa=a("span"),b(ut.$$.fragment),Oi=l(),wa=a("span"),Si=r("ImageGPTImageProcessor"),ds=l(),ee=a("div"),b(ft.$$.fragment),Li=l(),ka=a("p"),Ri=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).`),Wi=l(),Me=a("div"),b(_t.$$.fragment),Hi=l(),$a=a("p"),Bi=r("Preprocess an image or batch of images."),cs=l(),ue=a("h2"),qe=a("a"),Ga=a("span"),b(vt.$$.fragment),Vi=l(),Ea=a("span"),Ui=r("ImageGPTModel"),ms=l(),j=a("div"),b(Tt.$$.fragment),Ji=l(),xa=a("p"),Xi=r("The bare ImageGPT Model transformer outputting raw hidden-states without any specific head on top."),Yi=l(),bt=a("p"),Qi=r("This model inherits from "),to=a("a"),Ki=r("PreTrainedModel"),Zi=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.)`),el=l(),yt=a("p"),tl=r("This model is also a PyTorch "),It=a("a"),ol=r("torch.nn.Module"),al=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),sl=l(),R=a("div"),b(Pt.$$.fragment),nl=l(),fe=a("p"),rl=r("The "),oo=a("a"),il=r("ImageGPTModel"),ll=r(" forward method, overrides the "),Ca=a("code"),dl=r("__call__"),cl=r(" special method."),ml=l(),b(Fe.$$.fragment),pl=l(),b(je.$$.fragment),ps=l(),_e=a("h2"),Ae=a("a"),za=a("span"),b(wt.$$.fragment),hl=l(),Ma=a("span"),gl=r("ImageGPTForCausalImageModeling"),hs=l(),A=a("div"),b(kt.$$.fragment),ul=l(),qa=a("p"),fl=r(`The ImageGPT Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),_l=l(),$t=a("p"),vl=r("This model inherits from "),ao=a("a"),Tl=r("PreTrainedModel"),bl=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.)`),yl=l(),Gt=a("p"),Il=r("This model is also a PyTorch "),Et=a("a"),Pl=r("torch.nn.Module"),wl=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),kl=l(),W=a("div"),b(xt.$$.fragment),$l=l(),ve=a("p"),Gl=r("The "),so=a("a"),El=r("ImageGPTForCausalImageModeling"),xl=r(" forward method, overrides the "),Fa=a("code"),Cl=r("__call__"),zl=r(" special method."),Ml=l(),b(De.$$.fragment),ql=l(),b(Ne.$$.fragment),gs=l(),Te=a("h2"),Oe=a("a"),ja=a("span"),b(Ct.$$.fragment),Fl=l(),Aa=a("span"),jl=r("ImageGPTForImageClassification"),us=l(),D=a("div"),b(zt.$$.fragment),Al=l(),Mt=a("p"),Dl=r(`The ImageGPT Model transformer with an image classification head on top (linear layer).
`),no=a("a"),Nl=r("ImageGPTForImageClassification"),Ol=r(" average-pools the hidden states in order to do the classification."),Sl=l(),qt=a("p"),Ll=r("This model inherits from "),ro=a("a"),Rl=r("PreTrainedModel"),Wl=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.)`),Hl=l(),Ft=a("p"),Bl=r("This model is also a PyTorch "),jt=a("a"),Vl=r("torch.nn.Module"),Ul=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Jl=l(),H=a("div"),b(At.$$.fragment),Xl=l(),be=a("p"),Yl=r("The "),io=a("a"),Ql=r("ImageGPTForImageClassification"),Kl=r(" forward method, overrides the "),Da=a("code"),Zl=r("__call__"),ed=r(" special method."),td=l(),b(Se.$$.fragment),od=l(),b(Le.$$.fragment),this.h()},l(o){const p=fm('[data-svelte="svelte-1phssyn"]',document.head);g=s(p,"META",{name:!0,content:!0}),p.forEach(t),T=d(o),_=s(o,"H1",{class:!0});var Dt=n(_);u=s(Dt,"A",{id:!0,class:!0,href:!0});var Na=n(u);v=s(Na,"SPAN",{});var Oa=n(v);y(c.$$.fragment,Oa),Oa.forEach(t),Na.forEach(t),f=d(Dt),N=s(Dt,"SPAN",{});var Sa=n(N);Hs=i(Sa,"ImageGPT"),Sa.forEach(t),Dt.forEach(t),Wa=d(o),le=s(o,"H2",{class:!0});var Nt=n(le);Ie=s(Nt,"A",{id:!0,class:!0,href:!0});var La=n(Ie);uo=s(La,"SPAN",{});var Ra=n(uo);y(Je.$$.fragment,Ra),Ra.forEach(t),La.forEach(t),Bs=d(Nt),fo=s(Nt,"SPAN",{});var rd=n(fo);Vs=i(rd,"Overview"),rd.forEach(t),Nt.forEach(t),Ha=d(o),Pe=s(o,"P",{});var _s=n(Pe);Us=i(_s,"The ImageGPT model was proposed in "),Xe=s(_s,"A",{href:!0,rel:!0});var id=n(Xe);Js=i(id,"Generative Pretraining from Pixels"),id.forEach(t),Xs=i(_s,` 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.`),_s.forEach(t),Ba=d(o),St=s(o,"P",{});var ld=n(St);Ys=i(ld,"The abstract from the paper is the following:"),ld.forEach(t),Va=d(o),Lt=s(o,"P",{});var dd=n(Lt);_o=s(dd,"EM",{});var cd=n(_o);Qs=i(cd,`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.`),cd.forEach(t),dd.forEach(t),Ua=d(o),we=s(o,"IMG",{src:!0,alt:!0,width:!0}),Ja=d(o),Rt=s(o,"SMALL",{});var md=n(Rt);Ks=i(md,"Summary of the approach. Taken from the [original paper](https://cdn.openai.com/papers/Generative_Pretraining_from_Pixels_V2.pdf)."),md.forEach(t),Xa=d(o),L=s(o,"P",{});var Re=n(L);Zs=i(Re,"This model was contributed by "),Ye=s(Re,"A",{href:!0,rel:!0});var pd=n(Ye);en=i(pd,"nielsr"),pd.forEach(t),tn=i(Re,", based on "),Qe=s(Re,"A",{href:!0,rel:!0});var hd=n(Qe);on=i(hd,"this issue"),hd.forEach(t),an=i(Re,`. The original code can be found
`),Ke=s(Re,"A",{href:!0,rel:!0});var gd=n(Ke);sn=i(gd,"here"),gd.forEach(t),nn=i(Re,"."),Re.forEach(t),Ya=d(o),Wt=s(o,"P",{});var ud=n(Wt);rn=i(ud,"Tips:"),ud.forEach(t),Qa=d(o),O=s(o,"UL",{});var se=n(O);Ze=s(se,"LI",{});var vs=n(Ze);ln=i(vs,"ImageGPT is almost exactly the same as "),Ht=s(vs,"A",{href:!0});var fd=n(Ht);dn=i(fd,"GPT-2"),fd.forEach(t),cn=i(vs,`, 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.`),vs.forEach(t),mn=d(se),et=s(se,"LI",{});var Ts=n(et);pn=i(Ts,`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=s(Ts,"A",{href:!0});var _d=n(Bt);hn=i(_d,"ImageGPTImageProcessor"),_d.forEach(t),gn=i(Ts,` to prepare
images for the model.`),Ts.forEach(t),un=d(se),tt=s(se,"LI",{});var bs=n(tt);fn=i(bs,`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 `),vo=s(bs,"CODE",{});var vd=n(vo);_n=i(vd,"output_hidden_states=True"),vd.forEach(t),vn=i(bs,`, and
then average-pool the hidden states at whatever layer you like.`),bs.forEach(t),Tn=d(se),ot=s(se,"LI",{});var ys=n(ot);bn=i(ys,`Alternatively, one can further fine-tune the entire model on a downstream dataset, similar to BERT. For this, you can
use `),Vt=s(ys,"A",{href:!0});var Td=n(Vt);yn=i(Td,"ImageGPTForImageClassification"),Td.forEach(t),In=i(ys,"."),ys.forEach(t),Pn=d(se),To=s(se,"LI",{});var bd=n(To);wn=i(bd,`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:`),bd.forEach(t),se.forEach(t),Ka=d(o),ke=s(o,"TABLE",{});var Is=n(ke);bo=s(Is,"THEAD",{});var yd=n(bo);G=s(yd,"TR",{});var B=n(G);yo=s(B,"TH",{});var Id=n(yo);Io=s(Id,"STRONG",{});var Pd=n(Io);kn=i(Pd,"Model variant"),Pd.forEach(t),Id.forEach(t),$n=d(B),Po=s(B,"TH",{});var wd=n(Po);wo=s(wd,"STRONG",{});var kd=n(wo);Gn=i(kd,"Depths"),kd.forEach(t),wd.forEach(t),En=d(B),ko=s(B,"TH",{});var $d=n(ko);$o=s($d,"STRONG",{});var Gd=n($o);xn=i(Gd,"Hidden sizes"),Gd.forEach(t),$d.forEach(t),Cn=d(B),Go=s(B,"TH",{});var Ed=n(Go);Eo=s(Ed,"STRONG",{});var xd=n(Eo);zn=i(xd,"Decoder hidden size"),xd.forEach(t),Ed.forEach(t),Mn=d(B),xo=s(B,"TH",{});var Cd=n(xo);Co=s(Cd,"STRONG",{});var zd=n(Co);qn=i(zd,"Params (M)"),zd.forEach(t),Cd.forEach(t),Fn=d(B),zo=s(B,"TH",{});var Md=n(zo);Mo=s(Md,"STRONG",{});var qd=n(Mo);jn=i(qd,"ImageNet-1k Top 1"),qd.forEach(t),Md.forEach(t),B.forEach(t),yd.forEach(t),An=d(Is),E=s(Is,"TBODY",{});var V=n(E);x=s(V,"TR",{});var U=n(x);qo=s(U,"TD",{});var Fd=n(qo);Dn=i(Fd,"MiT-b0"),Fd.forEach(t),Nn=d(U),Fo=s(U,"TD",{});var jd=n(Fo);On=i(jd,"[2, 2, 2, 2]"),jd.forEach(t),Sn=d(U),jo=s(U,"TD",{});var Ad=n(jo);Ln=i(Ad,"[32, 64, 160, 256]"),Ad.forEach(t),Rn=d(U),Ao=s(U,"TD",{});var Dd=n(Ao);Wn=i(Dd,"256"),Dd.forEach(t),Hn=d(U),Do=s(U,"TD",{});var Nd=n(Do);Bn=i(Nd,"3.7"),Nd.forEach(t),Vn=d(U),No=s(U,"TD",{});var Od=n(No);Un=i(Od,"70.5"),Od.forEach(t),U.forEach(t),Jn=d(V),C=s(V,"TR",{});var J=n(C);Oo=s(J,"TD",{});var Sd=n(Oo);Xn=i(Sd,"MiT-b1"),Sd.forEach(t),Yn=d(J),So=s(J,"TD",{});var Ld=n(So);Qn=i(Ld,"[2, 2, 2, 2]"),Ld.forEach(t),Kn=d(J),Lo=s(J,"TD",{});var Rd=n(Lo);Zn=i(Rd,"[64, 128, 320, 512]"),Rd.forEach(t),er=d(J),Ro=s(J,"TD",{});var Wd=n(Ro);tr=i(Wd,"256"),Wd.forEach(t),or=d(J),Wo=s(J,"TD",{});var Hd=n(Wo);ar=i(Hd,"14.0"),Hd.forEach(t),sr=d(J),Ho=s(J,"TD",{});var Bd=n(Ho);nr=i(Bd,"78.7"),Bd.forEach(t),J.forEach(t),rr=d(V),z=s(V,"TR",{});var X=n(z);Bo=s(X,"TD",{});var Vd=n(Bo);ir=i(Vd,"MiT-b2"),Vd.forEach(t),lr=d(X),Vo=s(X,"TD",{});var Ud=n(Vo);dr=i(Ud,"[3, 4, 6, 3]"),Ud.forEach(t),cr=d(X),Uo=s(X,"TD",{});var Jd=n(Uo);mr=i(Jd,"[64, 128, 320, 512]"),Jd.forEach(t),pr=d(X),Jo=s(X,"TD",{});var Xd=n(Jo);hr=i(Xd,"768"),Xd.forEach(t),gr=d(X),Xo=s(X,"TD",{});var Yd=n(Xo);ur=i(Yd,"25.4"),Yd.forEach(t),fr=d(X),Yo=s(X,"TD",{});var Qd=n(Yo);_r=i(Qd,"81.6"),Qd.forEach(t),X.forEach(t),vr=d(V),M=s(V,"TR",{});var Y=n(M);Qo=s(Y,"TD",{});var Kd=n(Qo);Tr=i(Kd,"MiT-b3"),Kd.forEach(t),br=d(Y),Ko=s(Y,"TD",{});var Zd=n(Ko);yr=i(Zd,"[3, 4, 18, 3]"),Zd.forEach(t),Ir=d(Y),Zo=s(Y,"TD",{});var ec=n(Zo);Pr=i(ec,"[64, 128, 320, 512]"),ec.forEach(t),wr=d(Y),ea=s(Y,"TD",{});var tc=n(ea);kr=i(tc,"768"),tc.forEach(t),$r=d(Y),ta=s(Y,"TD",{});var oc=n(ta);Gr=i(oc,"45.2"),oc.forEach(t),Er=d(Y),oa=s(Y,"TD",{});var ac=n(oa);xr=i(ac,"83.1"),ac.forEach(t),Y.forEach(t),Cr=d(V),q=s(V,"TR",{});var Q=n(q);aa=s(Q,"TD",{});var sc=n(aa);zr=i(sc,"MiT-b4"),sc.forEach(t),Mr=d(Q),sa=s(Q,"TD",{});var nc=n(sa);qr=i(nc,"[3, 8, 27, 3]"),nc.forEach(t),Fr=d(Q),na=s(Q,"TD",{});var rc=n(na);jr=i(rc,"[64, 128, 320, 512]"),rc.forEach(t),Ar=d(Q),ra=s(Q,"TD",{});var ic=n(ra);Dr=i(ic,"768"),ic.forEach(t),Nr=d(Q),ia=s(Q,"TD",{});var lc=n(ia);Or=i(lc,"62.6"),lc.forEach(t),Sr=d(Q),la=s(Q,"TD",{});var dc=n(la);Lr=i(dc,"83.6"),dc.forEach(t),Q.forEach(t),Rr=d(V),F=s(V,"TR",{});var K=n(F);da=s(K,"TD",{});var cc=n(da);Wr=i(cc,"MiT-b5"),cc.forEach(t),Hr=d(K),ca=s(K,"TD",{});var mc=n(ca);Br=i(mc,"[3, 6, 40, 3]"),mc.forEach(t),Vr=d(K),ma=s(K,"TD",{});var pc=n(ma);Ur=i(pc,"[64, 128, 320, 512]"),pc.forEach(t),Jr=d(K),pa=s(K,"TD",{});var hc=n(pa);Xr=i(hc,"768"),hc.forEach(t),Yr=d(K),ha=s(K,"TD",{});var gc=n(ha);Qr=i(gc,"82.0"),gc.forEach(t),Kr=d(K),ga=s(K,"TD",{});var uc=n(ga);Zr=i(uc,"83.8"),uc.forEach(t),K.forEach(t),V.forEach(t),Is.forEach(t),Za=d(o),de=s(o,"H2",{class:!0});var Ps=n(de);$e=s(Ps,"A",{id:!0,class:!0,href:!0});var fc=n($e);ua=s(fc,"SPAN",{});var _c=n(ua);y(at.$$.fragment,_c),_c.forEach(t),fc.forEach(t),ei=d(Ps),fa=s(Ps,"SPAN",{});var vc=n(fa);ti=i(vc,"Resources"),vc.forEach(t),Ps.forEach(t),es=d(o),Ut=s(o,"P",{});var Tc=n(Ut);oi=i(Tc,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with ImageGPT."),Tc.forEach(t),ts=d(o),y(st.$$.fragment,o),os=d(o),oe=s(o,"UL",{});var lo=n(oe);nt=s(lo,"LI",{});var ws=n(nt);ai=i(ws,"Demo notebooks for ImageGPT can be found "),rt=s(ws,"A",{href:!0,rel:!0});var bc=n(rt);si=i(bc,"here"),bc.forEach(t),ni=i(ws,"."),ws.forEach(t),ri=d(lo),ae=s(lo,"LI",{});var Ot=n(ae);Jt=s(Ot,"A",{href:!0});var yc=n(Jt);ii=i(yc,"ImageGPTForImageClassification"),yc.forEach(t),li=i(Ot," is supported by this "),it=s(Ot,"A",{href:!0,rel:!0});var Ic=n(it);di=i(Ic,"example script"),Ic.forEach(t),ci=i(Ot," and "),lt=s(Ot,"A",{href:!0,rel:!0});var Pc=n(lt);mi=i(Pc,"notebook"),Pc.forEach(t),pi=i(Ot,"."),Ot.forEach(t),hi=d(lo),Xt=s(lo,"LI",{});var ad=n(Xt);gi=i(ad,"See also: "),Yt=s(ad,"A",{href:!0});var wc=n(Yt);ui=i(wc,"Image classification task guide"),wc.forEach(t),ad.forEach(t),lo.forEach(t),as=d(o),Qt=s(o,"P",{});var kc=n(Qt);fi=i(kc,"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."),kc.forEach(t),ss=d(o),ce=s(o,"H2",{class:!0});var ks=n(ce);Ge=s(ks,"A",{id:!0,class:!0,href:!0});var $c=n(Ge);_a=s($c,"SPAN",{});var Gc=n(_a);y(dt.$$.fragment,Gc),Gc.forEach(t),$c.forEach(t),_i=d(ks),va=s(ks,"SPAN",{});var Ec=n(va);vi=i(Ec,"ImageGPTConfig"),Ec.forEach(t),ks.forEach(t),ns=d(o),S=s(o,"DIV",{class:!0});var We=n(S);y(ct.$$.fragment,We),Ti=d(We),Z=s(We,"P",{});var He=n(Z);bi=i(He,"This is the configuration class to store the configuration of a "),Kt=s(He,"A",{href:!0});var xc=n(Kt);yi=i(xc,"ImageGPTModel"),xc.forEach(t),Ii=i(He," or a "),Ta=s(He,"CODE",{});var Cc=n(Ta);Pi=i(Cc,"TFImageGPTModel"),Cc.forEach(t),wi=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=s(He,"A",{href:!0,rel:!0});var zc=n(mt);ki=i(zc,"openai/imagegpt-small"),zc.forEach(t),$i=i(He," architecture."),He.forEach(t),Gi=d(We),me=s(We,"P",{});var co=n(me);Ei=i(co,"Configuration objects inherit from "),Zt=s(co,"A",{href:!0});var Mc=n(Zt);xi=i(Mc,"PretrainedConfig"),Mc.forEach(t),Ci=i(co,` and can be used to control the model outputs. Read the
documentation from `),eo=s(co,"A",{href:!0});var qc=n(eo);zi=i(qc,"PretrainedConfig"),qc.forEach(t),Mi=i(co," for more information."),co.forEach(t),qi=d(We),y(Ee.$$.fragment,We),We.forEach(t),rs=d(o),pe=s(o,"H2",{class:!0});var $s=n(pe);xe=s($s,"A",{id:!0,class:!0,href:!0});var Fc=n(xe);ba=s(Fc,"SPAN",{});var jc=n(ba);y(pt.$$.fragment,jc),jc.forEach(t),Fc.forEach(t),Fi=d($s),ya=s($s,"SPAN",{});var Ac=n(ya);ji=i(Ac,"ImageGPTFeatureExtractor"),Ac.forEach(t),$s.forEach(t),is=d(o),he=s(o,"DIV",{class:!0});var Gs=n(he);y(ht.$$.fragment,Gs),Ai=d(Gs),Ce=s(Gs,"DIV",{class:!0});var Es=n(Ce);y(gt.$$.fragment,Es),Di=d(Es),Ia=s(Es,"P",{});var Dc=n(Ia);Ni=i(Dc,"Preprocess an image or a batch of images."),Dc.forEach(t),Es.forEach(t),Gs.forEach(t),ls=d(o),ge=s(o,"H2",{class:!0});var xs=n(ge);ze=s(xs,"A",{id:!0,class:!0,href:!0});var Nc=n(ze);Pa=s(Nc,"SPAN",{});var Oc=n(Pa);y(ut.$$.fragment,Oc),Oc.forEach(t),Nc.forEach(t),Oi=d(xs),wa=s(xs,"SPAN",{});var Sc=n(wa);Si=i(Sc,"ImageGPTImageProcessor"),Sc.forEach(t),xs.forEach(t),ds=d(o),ee=s(o,"DIV",{class:!0});var mo=n(ee);y(ft.$$.fragment,mo),Li=d(mo),ka=s(mo,"P",{});var Lc=n(ka);Ri=i(Lc,`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).`),Lc.forEach(t),Wi=d(mo),Me=s(mo,"DIV",{class:!0});var Cs=n(Me);y(_t.$$.fragment,Cs),Hi=d(Cs),$a=s(Cs,"P",{});var Rc=n($a);Bi=i(Rc,"Preprocess an image or batch of images."),Rc.forEach(t),Cs.forEach(t),mo.forEach(t),cs=d(o),ue=s(o,"H2",{class:!0});var zs=n(ue);qe=s(zs,"A",{id:!0,class:!0,href:!0});var Wc=n(qe);Ga=s(Wc,"SPAN",{});var Hc=n(Ga);y(vt.$$.fragment,Hc),Hc.forEach(t),Wc.forEach(t),Vi=d(zs),Ea=s(zs,"SPAN",{});var Bc=n(Ea);Ui=i(Bc,"ImageGPTModel"),Bc.forEach(t),zs.forEach(t),ms=d(o),j=s(o,"DIV",{class:!0});var ne=n(j);y(Tt.$$.fragment,ne),Ji=d(ne),xa=s(ne,"P",{});var Vc=n(xa);Xi=i(Vc,"The bare ImageGPT Model transformer outputting raw hidden-states without any specific head on top."),Vc.forEach(t),Yi=d(ne),bt=s(ne,"P",{});var Ms=n(bt);Qi=i(Ms,"This model inherits from "),to=s(Ms,"A",{href:!0});var Uc=n(to);Ki=i(Uc,"PreTrainedModel"),Uc.forEach(t),Zi=i(Ms,`. 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.)`),Ms.forEach(t),el=d(ne),yt=s(ne,"P",{});var qs=n(yt);tl=i(qs,"This model is also a PyTorch "),It=s(qs,"A",{href:!0,rel:!0});var Jc=n(It);ol=i(Jc,"torch.nn.Module"),Jc.forEach(t),al=i(qs,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),qs.forEach(t),sl=d(ne),R=s(ne,"DIV",{class:!0});var Be=n(R);y(Pt.$$.fragment,Be),nl=d(Be),fe=s(Be,"P",{});var po=n(fe);rl=i(po,"The "),oo=s(po,"A",{href:!0});var Xc=n(oo);il=i(Xc,"ImageGPTModel"),Xc.forEach(t),ll=i(po," forward method, overrides the "),Ca=s(po,"CODE",{});var Yc=n(Ca);dl=i(Yc,"__call__"),Yc.forEach(t),cl=i(po," special method."),po.forEach(t),ml=d(Be),y(Fe.$$.fragment,Be),pl=d(Be),y(je.$$.fragment,Be),Be.forEach(t),ne.forEach(t),ps=d(o),_e=s(o,"H2",{class:!0});var Fs=n(_e);Ae=s(Fs,"A",{id:!0,class:!0,href:!0});var Qc=n(Ae);za=s(Qc,"SPAN",{});var Kc=n(za);y(wt.$$.fragment,Kc),Kc.forEach(t),Qc.forEach(t),hl=d(Fs),Ma=s(Fs,"SPAN",{});var Zc=n(Ma);gl=i(Zc,"ImageGPTForCausalImageModeling"),Zc.forEach(t),Fs.forEach(t),hs=d(o),A=s(o,"DIV",{class:!0});var re=n(A);y(kt.$$.fragment,re),ul=d(re),qa=s(re,"P",{});var em=n(qa);fl=i(em,`The ImageGPT Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),em.forEach(t),_l=d(re),$t=s(re,"P",{});var js=n($t);vl=i(js,"This model inherits from "),ao=s(js,"A",{href:!0});var tm=n(ao);Tl=i(tm,"PreTrainedModel"),tm.forEach(t),bl=i(js,`. 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.)`),js.forEach(t),yl=d(re),Gt=s(re,"P",{});var As=n(Gt);Il=i(As,"This model is also a PyTorch "),Et=s(As,"A",{href:!0,rel:!0});var om=n(Et);Pl=i(om,"torch.nn.Module"),om.forEach(t),wl=i(As,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),As.forEach(t),kl=d(re),W=s(re,"DIV",{class:!0});var Ve=n(W);y(xt.$$.fragment,Ve),$l=d(Ve),ve=s(Ve,"P",{});var ho=n(ve);Gl=i(ho,"The "),so=s(ho,"A",{href:!0});var am=n(so);El=i(am,"ImageGPTForCausalImageModeling"),am.forEach(t),xl=i(ho," forward method, overrides the "),Fa=s(ho,"CODE",{});var sm=n(Fa);Cl=i(sm,"__call__"),sm.forEach(t),zl=i(ho," special method."),ho.forEach(t),Ml=d(Ve),y(De.$$.fragment,Ve),ql=d(Ve),y(Ne.$$.fragment,Ve),Ve.forEach(t),re.forEach(t),gs=d(o),Te=s(o,"H2",{class:!0});var Ds=n(Te);Oe=s(Ds,"A",{id:!0,class:!0,href:!0});var nm=n(Oe);ja=s(nm,"SPAN",{});var rm=n(ja);y(Ct.$$.fragment,rm),rm.forEach(t),nm.forEach(t),Fl=d(Ds),Aa=s(Ds,"SPAN",{});var im=n(Aa);jl=i(im,"ImageGPTForImageClassification"),im.forEach(t),Ds.forEach(t),us=d(o),D=s(o,"DIV",{class:!0});var ie=n(D);y(zt.$$.fragment,ie),Al=d(ie),Mt=s(ie,"P",{});var Ns=n(Mt);Dl=i(Ns,`The ImageGPT Model transformer with an image classification head on top (linear layer).
`),no=s(Ns,"A",{href:!0});var lm=n(no);Nl=i(lm,"ImageGPTForImageClassification"),lm.forEach(t),Ol=i(Ns," average-pools the hidden states in order to do the classification."),Ns.forEach(t),Sl=d(ie),qt=s(ie,"P",{});var Os=n(qt);Ll=i(Os,"This model inherits from "),ro=s(Os,"A",{href:!0});var dm=n(ro);Rl=i(dm,"PreTrainedModel"),dm.forEach(t),Wl=i(Os,`. 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.)`),Os.forEach(t),Hl=d(ie),Ft=s(ie,"P",{});var Ss=n(Ft);Bl=i(Ss,"This model is also a PyTorch "),jt=s(Ss,"A",{href:!0,rel:!0});var cm=n(jt);Vl=i(cm,"torch.nn.Module"),cm.forEach(t),Ul=i(Ss,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ss.forEach(t),Jl=d(ie),H=s(ie,"DIV",{class:!0});var Ue=n(H);y(At.$$.fragment,Ue),Xl=d(Ue),be=s(Ue,"P",{});var go=n(be);Yl=i(go,"The "),io=s(go,"A",{href:!0});var mm=n(io);Ql=i(mm,"ImageGPTForImageClassification"),mm.forEach(t),Kl=i(go," forward method, overrides the "),Da=s(go,"CODE",{});var pm=n(Da);Zl=i(pm,"__call__"),pm.forEach(t),ed=i(go," special method."),go.forEach(t),td=d(Ue),y(Se.$$.fragment,Ue),od=d(Ue),y(Le.$$.fragment,Ue),Ue.forEach(t),ie.forEach(t),this.h()},h(){m(g,"name","hf:doc:metadata"),m(g,"content",JSON.stringify(Em)),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(Ie,"id","overview"),m(Ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Ie,"href","#overview"),m(le,"class","relative group"),m(Xe,"href","https://openai.com/blog/image-gpt"),m(Xe,"rel","nofollow"),_m(we.src,nd="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/imagegpt_architecture.png")||m(we,"src",nd),m(we,"alt","drawing"),m(we,"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/v4.29.0/en/model_doc/imagegpt#transformers.ImageGPTImageProcessor"),m(Vt,"href","/docs/transformers/v4.29.0/en/model_doc/imagegpt#transformers.ImageGPTForImageClassification"),m($e,"id","resources"),m($e,"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($e,"href","#resources"),m(de,"class","relative group"),m(rt,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/ImageGPT"),m(rt,"rel","nofollow"),m(Jt,"href","/docs/transformers/v4.29.0/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(Yt,"href","../tasks/image_classification"),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(ce,"class","relative group"),m(Kt,"href","/docs/transformers/v4.29.0/en/model_doc/imagegpt#transformers.ImageGPTModel"),m(mt,"href","https://huggingface.co/openai/imagegpt-small"),m(mt,"rel","nofollow"),m(Zt,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),m(eo,"href","/docs/transformers/v4.29.0/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(xe,"id","transformers.ImageGPTFeatureExtractor"),m(xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(xe,"href","#transformers.ImageGPTFeatureExtractor"),m(pe,"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(he,"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(ge,"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(qe,"id","transformers.ImageGPTModel"),m(qe,"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(qe,"href","#transformers.ImageGPTModel"),m(ue,"class","relative group"),m(to,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),m(It,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(It,"rel","nofollow"),m(oo,"href","/docs/transformers/v4.29.0/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(_e,"class","relative group"),m(ao,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),m(Et,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(Et,"rel","nofollow"),m(so,"href","/docs/transformers/v4.29.0/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(no,"href","/docs/transformers/v4.29.0/en/model_doc/imagegpt#transformers.ImageGPTForImageClassification"),m(ro,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),m(jt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(jt,"rel","nofollow"),m(io,"href","/docs/transformers/v4.29.0/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,T,p),h(o,_,p),e(_,u),e(u,v),I(c,v,null),e(_,f),e(_,N),e(N,Hs),h(o,Wa,p),h(o,le,p),e(le,Ie),e(Ie,uo),I(Je,uo,null),e(le,Bs),e(le,fo),e(fo,Vs),h(o,Ha,p),h(o,Pe,p),e(Pe,Us),e(Pe,Xe),e(Xe,Js),e(Pe,Xs),h(o,Ba,p),h(o,St,p),e(St,Ys),h(o,Va,p),h(o,Lt,p),e(Lt,_o),e(_o,Qs),h(o,Ua,p),h(o,we,p),h(o,Ja,p),h(o,Rt,p),e(Rt,Ks),h(o,Xa,p),h(o,L,p),e(L,Zs),e(L,Ye),e(Ye,en),e(L,tn),e(L,Qe),e(Qe,on),e(L,an),e(L,Ke),e(Ke,sn),e(L,nn),h(o,Ya,p),h(o,Wt,p),e(Wt,rn),h(o,Qa,p),h(o,O,p),e(O,Ze),e(Ze,ln),e(Ze,Ht),e(Ht,dn),e(Ze,cn),e(O,mn),e(O,et),e(et,pn),e(et,Bt),e(Bt,hn),e(et,gn),e(O,un),e(O,tt),e(tt,fn),e(tt,vo),e(vo,_n),e(tt,vn),e(O,Tn),e(O,ot),e(ot,bn),e(ot,Vt),e(Vt,yn),e(ot,In),e(O,Pn),e(O,To),e(To,wn),h(o,Ka,p),h(o,ke,p),e(ke,bo),e(bo,G),e(G,yo),e(yo,Io),e(Io,kn),e(G,$n),e(G,Po),e(Po,wo),e(wo,Gn),e(G,En),e(G,ko),e(ko,$o),e($o,xn),e(G,Cn),e(G,Go),e(Go,Eo),e(Eo,zn),e(G,Mn),e(G,xo),e(xo,Co),e(Co,qn),e(G,Fn),e(G,zo),e(zo,Mo),e(Mo,jn),e(ke,An),e(ke,E),e(E,x),e(x,qo),e(qo,Dn),e(x,Nn),e(x,Fo),e(Fo,On),e(x,Sn),e(x,jo),e(jo,Ln),e(x,Rn),e(x,Ao),e(Ao,Wn),e(x,Hn),e(x,Do),e(Do,Bn),e(x,Vn),e(x,No),e(No,Un),e(E,Jn),e(E,C),e(C,Oo),e(Oo,Xn),e(C,Yn),e(C,So),e(So,Qn),e(C,Kn),e(C,Lo),e(Lo,Zn),e(C,er),e(C,Ro),e(Ro,tr),e(C,or),e(C,Wo),e(Wo,ar),e(C,sr),e(C,Ho),e(Ho,nr),e(E,rr),e(E,z),e(z,Bo),e(Bo,ir),e(z,lr),e(z,Vo),e(Vo,dr),e(z,cr),e(z,Uo),e(Uo,mr),e(z,pr),e(z,Jo),e(Jo,hr),e(z,gr),e(z,Xo),e(Xo,ur),e(z,fr),e(z,Yo),e(Yo,_r),e(E,vr),e(E,M),e(M,Qo),e(Qo,Tr),e(M,br),e(M,Ko),e(Ko,yr),e(M,Ir),e(M,Zo),e(Zo,Pr),e(M,wr),e(M,ea),e(ea,kr),e(M,$r),e(M,ta),e(ta,Gr),e(M,Er),e(M,oa),e(oa,xr),e(E,Cr),e(E,q),e(q,aa),e(aa,zr),e(q,Mr),e(q,sa),e(sa,qr),e(q,Fr),e(q,na),e(na,jr),e(q,Ar),e(q,ra),e(ra,Dr),e(q,Nr),e(q,ia),e(ia,Or),e(q,Sr),e(q,la),e(la,Lr),e(E,Rr),e(E,F),e(F,da),e(da,Wr),e(F,Hr),e(F,ca),e(ca,Br),e(F,Vr),e(F,ma),e(ma,Ur),e(F,Jr),e(F,pa),e(pa,Xr),e(F,Yr),e(F,ha),e(ha,Qr),e(F,Kr),e(F,ga),e(ga,Zr),h(o,Za,p),h(o,de,p),e(de,$e),e($e,ua),I(at,ua,null),e(de,ei),e(de,fa),e(fa,ti),h(o,es,p),h(o,Ut,p),e(Ut,oi),h(o,ts,p),I(st,o,p),h(o,os,p),h(o,oe,p),e(oe,nt),e(nt,ai),e(nt,rt),e(rt,si),e(nt,ni),e(oe,ri),e(oe,ae),e(ae,Jt),e(Jt,ii),e(ae,li),e(ae,it),e(it,di),e(ae,ci),e(ae,lt),e(lt,mi),e(ae,pi),e(oe,hi),e(oe,Xt),e(Xt,gi),e(Xt,Yt),e(Yt,ui),h(o,as,p),h(o,Qt,p),e(Qt,fi),h(o,ss,p),h(o,ce,p),e(ce,Ge),e(Ge,_a),I(dt,_a,null),e(ce,_i),e(ce,va),e(va,vi),h(o,ns,p),h(o,S,p),I(ct,S,null),e(S,Ti),e(S,Z),e(Z,bi),e(Z,Kt),e(Kt,yi),e(Z,Ii),e(Z,Ta),e(Ta,Pi),e(Z,wi),e(Z,mt),e(mt,ki),e(Z,$i),e(S,Gi),e(S,me),e(me,Ei),e(me,Zt),e(Zt,xi),e(me,Ci),e(me,eo),e(eo,zi),e(me,Mi),e(S,qi),I(Ee,S,null),h(o,rs,p),h(o,pe,p),e(pe,xe),e(xe,ba),I(pt,ba,null),e(pe,Fi),e(pe,ya),e(ya,ji),h(o,is,p),h(o,he,p),I(ht,he,null),e(he,Ai),e(he,Ce),I(gt,Ce,null),e(Ce,Di),e(Ce,Ia),e(Ia,Ni),h(o,ls,p),h(o,ge,p),e(ge,ze),e(ze,Pa),I(ut,Pa,null),e(ge,Oi),e(ge,wa),e(wa,Si),h(o,ds,p),h(o,ee,p),I(ft,ee,null),e(ee,Li),e(ee,ka),e(ka,Ri),e(ee,Wi),e(ee,Me),I(_t,Me,null),e(Me,Hi),e(Me,$a),e($a,Bi),h(o,cs,p),h(o,ue,p),e(ue,qe),e(qe,Ga),I(vt,Ga,null),e(ue,Vi),e(ue,Ea),e(Ea,Ui),h(o,ms,p),h(o,j,p),I(Tt,j,null),e(j,Ji),e(j,xa),e(xa,Xi),e(j,Yi),e(j,bt),e(bt,Qi),e(bt,to),e(to,Ki),e(bt,Zi),e(j,el),e(j,yt),e(yt,tl),e(yt,It),e(It,ol),e(yt,al),e(j,sl),e(j,R),I(Pt,R,null),e(R,nl),e(R,fe),e(fe,rl),e(fe,oo),e(oo,il),e(fe,ll),e(fe,Ca),e(Ca,dl),e(fe,cl),e(R,ml),I(Fe,R,null),e(R,pl),I(je,R,null),h(o,ps,p),h(o,_e,p),e(_e,Ae),e(Ae,za),I(wt,za,null),e(_e,hl),e(_e,Ma),e(Ma,gl),h(o,hs,p),h(o,A,p),I(kt,A,null),e(A,ul),e(A,qa),e(qa,fl),e(A,_l),e(A,$t),e($t,vl),e($t,ao),e(ao,Tl),e($t,bl),e(A,yl),e(A,Gt),e(Gt,Il),e(Gt,Et),e(Et,Pl),e(Gt,wl),e(A,kl),e(A,W),I(xt,W,null),e(W,$l),e(W,ve),e(ve,Gl),e(ve,so),e(so,El),e(ve,xl),e(ve,Fa),e(Fa,Cl),e(ve,zl),e(W,Ml),I(De,W,null),e(W,ql),I(Ne,W,null),h(o,gs,p),h(o,Te,p),e(Te,Oe),e(Oe,ja),I(Ct,ja,null),e(Te,Fl),e(Te,Aa),e(Aa,jl),h(o,us,p),h(o,D,p),I(zt,D,null),e(D,Al),e(D,Mt),e(Mt,Dl),e(Mt,no),e(no,Nl),e(Mt,Ol),e(D,Sl),e(D,qt),e(qt,Ll),e(qt,ro),e(ro,Rl),e(qt,Wl),e(D,Hl),e(D,Ft),e(Ft,Bl),e(Ft,jt),e(jt,Vl),e(Ft,Ul),e(D,Jl),e(D,H),I(At,H,null),e(H,Xl),e(H,be),e(be,Yl),e(be,io),e(io,Ql),e(be,Kl),e(be,Da),e(Da,Zl),e(be,ed),e(H,td),I(Se,H,null),e(H,od),I(Le,H,null),fs=!0},p(o,[p]){const Dt={};p&2&&(Dt.$$scope={dirty:p,ctx:o}),Ee.$set(Dt);const Na={};p&2&&(Na.$$scope={dirty:p,ctx:o}),Fe.$set(Na);const Oa={};p&2&&(Oa.$$scope={dirty:p,ctx:o}),je.$set(Oa);const Sa={};p&2&&(Sa.$$scope={dirty:p,ctx:o}),De.$set(Sa);const Nt={};p&2&&(Nt.$$scope={dirty:p,ctx:o}),Ne.$set(Nt);const La={};p&2&&(La.$$scope={dirty:p,ctx:o}),Se.$set(La);const Ra={};p&2&&(Ra.$$scope={dirty:p,ctx:o}),Le.$set(Ra)},i(o){fs||(P(c.$$.fragment,o),P(Je.$$.fragment,o),P(at.$$.fragment,o),P(st.$$.fragment,o),P(dt.$$.fragment,o),P(ct.$$.fragment,o),P(Ee.$$.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(vt.$$.fragment,o),P(Tt.$$.fragment,o),P(Pt.$$.fragment,o),P(Fe.$$.fragment,o),P(je.$$.fragment,o),P(wt.$$.fragment,o),P(kt.$$.fragment,o),P(xt.$$.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),fs=!0)},o(o){w(c.$$.fragment,o),w(Je.$$.fragment,o),w(at.$$.fragment,o),w(st.$$.fragment,o),w(dt.$$.fragment,o),w(ct.$$.fragment,o),w(Ee.$$.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(vt.$$.fragment,o),w(Tt.$$.fragment,o),w(Pt.$$.fragment,o),w(Fe.$$.fragment,o),w(je.$$.fragment,o),w(wt.$$.fragment,o),w(kt.$$.fragment,o),w(xt.$$.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),fs=!1},d(o){t(g),o&&t(T),o&&t(_),k(c),o&&t(Wa),o&&t(le),k(Je),o&&t(Ha),o&&t(Pe),o&&t(Ba),o&&t(St),o&&t(Va),o&&t(Lt),o&&t(Ua),o&&t(we),o&&t(Ja),o&&t(Rt),o&&t(Xa),o&&t(L),o&&t(Ya),o&&t(Wt),o&&t(Qa),o&&t(O),o&&t(Ka),o&&t(ke),o&&t(Za),o&&t(de),k(at),o&&t(es),o&&t(Ut),o&&t(ts),k(st,o),o&&t(os),o&&t(oe),o&&t(as),o&&t(Qt),o&&t(ss),o&&t(ce),k(dt),o&&t(ns),o&&t(S),k(ct),k(Ee),o&&t(rs),o&&t(pe),k(pt),o&&t(is),o&&t(he),k(ht),k(gt),o&&t(ls),o&&t(ge),k(ut),o&&t(ds),o&&t(ee),k(ft),k(_t),o&&t(cs),o&&t(ue),k(vt),o&&t(ms),o&&t(j),k(Tt),k(Pt),k(Fe),k(je),o&&t(ps),o&&t(_e),k(wt),o&&t(hs),o&&t(A),k(kt),k(xt),k(De),k(Ne),o&&t(gs),o&&t(Te),k(Ct),o&&t(us),o&&t(D),k(zt),k(At),k(Se),k(Le)}}}const Em={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 xm($){return vm(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Dm extends hm{constructor(g){super();gm(this,g,xm,Gm,um,{})}}export{Dm as default,Em as metadata};
