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 w,o as P,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||(w(u.$$.fragment,c),v=!0)},o(c){P(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||(w(u.$$.fragment,c),v=!0)},o(c){P(u.$$.fragment,c),v=!1},d(c){c&&t(g),c&&t(_),k(u,c)}}}function wm($){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 Pm($){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||(w(u.$$.fragment,c),v=!0)},o(c){P(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||(w(u.$$.fragment,c),v=!0)},o(c){P(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,Vs,fo,Bs,Ha,we,Us,Xe,Js,Xs,Va,St,Ys,Ba,Lt,_o,Qs,Ua,Pe,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,Vt,hn,gn,un,tt,fn,vo,_n,vn,Tn,ot,bn,Bt,yn,In,wn,To,Pn,Ka,ke,bo,G,yo,Io,kn,$n,wo,Po,Gn,En,ko,$o,xn,Cn,Go,Eo,Mn,zn,xo,Co,qn,Fn,Mo,zo,An,jn,E,x,qo,Dn,Nn,Fo,On,Sn,Ao,Ln,Rn,jo,Wn,Hn,Do,Vn,Bn,No,Un,Jn,C,Oo,Xn,Yn,So,Qn,Kn,Lo,Zn,er,Ro,tr,or,Wo,ar,sr,Ho,nr,rr,M,Vo,ir,lr,Bo,dr,cr,Uo,mr,pr,Jo,hr,gr,Xo,ur,fr,Yo,_r,vr,z,Qo,Tr,br,Ko,yr,Ir,Zo,wr,Pr,ea,kr,$r,ta,Gr,Er,oa,xr,Cr,q,aa,Mr,zr,sa,qr,Fr,na,Ar,jr,ra,Dr,Nr,ia,Or,Sr,la,Lr,Rr,F,da,Wr,Hr,ca,Vr,Br,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,wi,Pi,mt,ki,$i,Gi,me,Ei,Zt,xi,Ci,eo,Mi,zi,qi,Ee,rs,pe,xe,ba,pt,Fi,ya,Ai,is,he,ht,ji,Ce,gt,Di,Ia,Ni,ls,ge,Me,wa,ut,Oi,Pa,Si,ds,ee,ft,Li,ka,Ri,Wi,ze,_t,Hi,$a,Vi,cs,ue,qe,Ga,vt,Bi,Ea,Ui,ms,A,Tt,Ji,xa,Xi,Yi,bt,Qi,to,Ki,Zi,el,yt,tl,It,ol,al,sl,R,wt,nl,fe,rl,oo,il,ll,Ca,dl,cl,ml,Fe,pl,Ae,ps,_e,je,Ma,Pt,hl,za,gl,hs,j,kt,ul,qa,fl,_l,$t,vl,ao,Tl,bl,yl,Gt,Il,Et,wl,Pl,kl,W,xt,$l,ve,Gl,so,El,xl,Fa,Cl,Ml,zl,De,ql,Ne,gs,Te,Oe,Aa,Ct,Fl,ja,Al,us,D,Mt,jl,zt,Dl,no,Nl,Ol,Sl,qt,Ll,ro,Rl,Wl,Hl,Ft,Vl,At,Bl,Ul,Jl,H,jt,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.27.1/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.27.1/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.27.1/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.27.1/src/transformers/image_processing_utils.py#L456"}}),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.27.1/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[str, transformers.utils.generic.TensorType, 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.27.1/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.27.1/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.27.1/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.27.1/src/transformers/models/imagegpt/modeling_imagegpt.py#L615"}}),wt=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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/imagegpt/modeling_imagegpt.py#L650",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/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.27.1/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.27.1/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:$}}}),Ae=new Ls({props:{anchor:"transformers.ImageGPTModel.forward.example",$$slots:{default:[Im]},$$scope:{ctx:$}}}),Pt=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.27.1/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.27.1/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.27.1/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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/imagegpt/modeling_imagegpt.py#L943",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/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.27.1/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.27.1/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:[wm]},$$scope:{ctx:$}}}),Ne=new Ls({props:{anchor:"transformers.ImageGPTForCausalImageModeling.forward.example",$$slots:{default:[Pm]},$$scope:{ctx:$}}}),Ct=new ye({}),Mt=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.27.1/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.27.1/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.27.1/src/transformers/models/imagegpt/modeling_imagegpt.py#L1086"}}),jt=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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/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.27.1/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),Vs=l(),fo=a("span"),Bs=r("Overview"),Ha=l(),we=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.`),Va=l(),St=a("p"),Ys=r("The abstract from the paper is the following:"),Ba=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(),Pe=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 `),Vt=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 `),Bt=a("a"),yn=r("ImageGPTForImageClassification"),In=r("."),wn=l(),To=a("li"),Pn=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(),wo=a("th"),Po=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"),Mn=r("Decoder hidden size"),zn=l(),xo=a("th"),Co=a("strong"),qn=r("Params (M)"),Fn=l(),Mo=a("th"),zo=a("strong"),An=r("ImageNet-1k Top 1"),jn=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(),Ao=a("td"),Ln=r("[32, 64, 160, 256]"),Rn=l(),jo=a("td"),Wn=r("256"),Hn=l(),Do=a("td"),Vn=r("3.7"),Bn=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(),M=a("tr"),Vo=a("td"),ir=r("MiT-b2"),lr=l(),Bo=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(),z=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"),wr=r("[64, 128, 320, 512]"),Pr=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"),Mr=r("MiT-b4"),zr=l(),sa=a("td"),qr=r("[3, 8, 27, 3]"),Fr=l(),na=a("td"),Ar=r("[64, 128, 320, 512]"),jr=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"),Vr=r("[3, 6, 40, 3]"),Br=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"),wi=r("TFImageGPTModel"),Pi=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"),Mi=r("PretrainedConfig"),zi=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"),Ai=r("ImageGPTFeatureExtractor"),is=l(),he=a("div"),b(ht.$$.fragment),ji=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"),Me=a("a"),wa=a("span"),b(ut.$$.fragment),Oi=l(),Pa=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(),ze=a("div"),b(_t.$$.fragment),Hi=l(),$a=a("p"),Vi=r("Preprocess an image or batch of images."),cs=l(),ue=a("h2"),qe=a("a"),Ga=a("span"),b(vt.$$.fragment),Bi=l(),Ea=a("span"),Ui=r("ImageGPTModel"),ms=l(),A=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(wt.$$.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(Ae.$$.fragment),ps=l(),_e=a("h2"),je=a("a"),Ma=a("span"),b(Pt.$$.fragment),hl=l(),za=a("span"),gl=r("ImageGPTForCausalImageModeling"),hs=l(),j=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"),wl=r("torch.nn.Module"),Pl=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__"),Ml=r(" special method."),zl=l(),b(De.$$.fragment),ql=l(),b(Ne.$$.fragment),gs=l(),Te=a("h2"),Oe=a("a"),Aa=a("span"),b(Ct.$$.fragment),Fl=l(),ja=a("span"),Al=r("ImageGPTForImageClassification"),us=l(),D=a("div"),b(Mt.$$.fragment),jl=l(),zt=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"),Vl=r("This model is also a PyTorch "),At=a("a"),Bl=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(jt.$$.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),Vs=d(Nt),fo=s(Nt,"SPAN",{});var rd=n(fo);Bs=i(rd,"Overview"),rd.forEach(t),Nt.forEach(t),Ha=d(o),we=s(o,"P",{});var _s=n(we);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),Va=d(o),St=s(o,"P",{});var ld=n(St);Ys=i(ld,"The abstract from the paper is the following:"),ld.forEach(t),Ba=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),Pe=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 `),Vt=s(Ts,"A",{href:!0});var _d=n(Vt);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 `),Bt=s(ys,"A",{href:!0});var Td=n(Bt);yn=i(Td,"ImageGPTForImageClassification"),Td.forEach(t),In=i(ys,"."),ys.forEach(t),wn=d(se),To=s(se,"LI",{});var bd=n(To);Pn=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 V=n(G);yo=s(V,"TH",{});var Id=n(yo);Io=s(Id,"STRONG",{});var wd=n(Io);kn=i(wd,"Model variant"),wd.forEach(t),Id.forEach(t),$n=d(V),wo=s(V,"TH",{});var Pd=n(wo);Po=s(Pd,"STRONG",{});var kd=n(Po);Gn=i(kd,"Depths"),kd.forEach(t),Pd.forEach(t),En=d(V),ko=s(V,"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(V),Go=s(V,"TH",{});var Ed=n(Go);Eo=s(Ed,"STRONG",{});var xd=n(Eo);Mn=i(xd,"Decoder hidden size"),xd.forEach(t),Ed.forEach(t),zn=d(V),xo=s(V,"TH",{});var Cd=n(xo);Co=s(Cd,"STRONG",{});var Md=n(Co);qn=i(Md,"Params (M)"),Md.forEach(t),Cd.forEach(t),Fn=d(V),Mo=s(V,"TH",{});var zd=n(Mo);zo=s(zd,"STRONG",{});var qd=n(zo);An=i(qd,"ImageNet-1k Top 1"),qd.forEach(t),zd.forEach(t),V.forEach(t),yd.forEach(t),jn=d(Is),E=s(Is,"TBODY",{});var B=n(E);x=s(B,"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 Ad=n(Fo);On=i(Ad,"[2, 2, 2, 2]"),Ad.forEach(t),Sn=d(U),Ao=s(U,"TD",{});var jd=n(Ao);Ln=i(jd,"[32, 64, 160, 256]"),jd.forEach(t),Rn=d(U),jo=s(U,"TD",{});var Dd=n(jo);Wn=i(Dd,"256"),Dd.forEach(t),Hn=d(U),Do=s(U,"TD",{});var Nd=n(Do);Vn=i(Nd,"3.7"),Nd.forEach(t),Bn=d(U),No=s(U,"TD",{});var Od=n(No);Un=i(Od,"70.5"),Od.forEach(t),U.forEach(t),Jn=d(B),C=s(B,"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 Vd=n(Ho);nr=i(Vd,"78.7"),Vd.forEach(t),J.forEach(t),rr=d(B),M=s(B,"TR",{});var X=n(M);Vo=s(X,"TD",{});var Bd=n(Vo);ir=i(Bd,"MiT-b2"),Bd.forEach(t),lr=d(X),Bo=s(X,"TD",{});var Ud=n(Bo);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(B),z=s(B,"TR",{});var Y=n(z);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);wr=i(ec,"[64, 128, 320, 512]"),ec.forEach(t),Pr=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(B),q=s(B,"TR",{});var Q=n(q);aa=s(Q,"TD",{});var sc=n(aa);Mr=i(sc,"MiT-b4"),sc.forEach(t),zr=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);Ar=i(rc,"[64, 128, 320, 512]"),rc.forEach(t),jr=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(B),F=s(B,"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);Vr=i(mc,"[3, 6, 40, 3]"),mc.forEach(t),Br=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),B.forEach(t),Is.forEach(t),Za=d(o),de=s(o,"H2",{class:!0});var ws=n(de);$e=s(ws,"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(ws),fa=s(ws,"SPAN",{});var vc=n(fa);ti=i(vc,"Resources"),vc.forEach(t),ws.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 Ps=n(nt);ai=i(Ps,"Demo notebooks for ImageGPT can be found "),rt=s(Ps,"A",{href:!0,rel:!0});var bc=n(rt);si=i(bc,"here"),bc.forEach(t),ni=i(Ps,"."),Ps.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 wc=n(lt);mi=i(wc,"notebook"),wc.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 Pc=n(Yt);ui=i(Pc,"Image classification task guide"),Pc.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);wi=i(Cc,"TFImageGPTModel"),Cc.forEach(t),Pi=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 Mc=n(mt);ki=i(Mc,"openai/imagegpt-small"),Mc.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 zc=n(Zt);xi=i(zc,"PretrainedConfig"),zc.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);Mi=i(qc,"PretrainedConfig"),qc.forEach(t),zi=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 Ac=n(ba);y(pt.$$.fragment,Ac),Ac.forEach(t),Fc.forEach(t),Fi=d($s),ya=s($s,"SPAN",{});var jc=n(ya);Ai=i(jc,"ImageGPTFeatureExtractor"),jc.forEach(t),$s.forEach(t),is=d(o),he=s(o,"DIV",{class:!0});var Gs=n(he);y(ht.$$.fragment,Gs),ji=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);Me=s(xs,"A",{id:!0,class:!0,href:!0});var Nc=n(Me);wa=s(Nc,"SPAN",{});var Oc=n(wa);y(ut.$$.fragment,Oc),Oc.forEach(t),Nc.forEach(t),Oi=d(xs),Pa=s(xs,"SPAN",{});var Sc=n(Pa);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),ze=s(mo,"DIV",{class:!0});var Cs=n(ze);y(_t.$$.fragment,Cs),Hi=d(Cs),$a=s(Cs,"P",{});var Rc=n($a);Vi=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 Ms=n(ue);qe=s(Ms,"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),Bi=d(Ms),Ea=s(Ms,"SPAN",{});var Vc=n(Ea);Ui=i(Vc,"ImageGPTModel"),Vc.forEach(t),Ms.forEach(t),ms=d(o),A=s(o,"DIV",{class:!0});var ne=n(A);y(Tt.$$.fragment,ne),Ji=d(ne),xa=s(ne,"P",{});var Bc=n(xa);Xi=i(Bc,"The bare ImageGPT Model transformer outputting raw hidden-states without any specific head on top."),Bc.forEach(t),Yi=d(ne),bt=s(ne,"P",{});var zs=n(bt);Qi=i(zs,"This model inherits from "),to=s(zs,"A",{href:!0});var Uc=n(to);Ki=i(Uc,"PreTrainedModel"),Uc.forEach(t),Zi=i(zs,`. 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.)`),zs.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 Ve=n(R);y(wt.$$.fragment,Ve),nl=d(Ve),fe=s(Ve,"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(Ve),y(Fe.$$.fragment,Ve),pl=d(Ve),y(Ae.$$.fragment,Ve),Ve.forEach(t),ne.forEach(t),ps=d(o),_e=s(o,"H2",{class:!0});var Fs=n(_e);je=s(Fs,"A",{id:!0,class:!0,href:!0});var Qc=n(je);Ma=s(Qc,"SPAN",{});var Kc=n(Ma);y(Pt.$$.fragment,Kc),Kc.forEach(t),Qc.forEach(t),hl=d(Fs),za=s(Fs,"SPAN",{});var Zc=n(za);gl=i(Zc,"ImageGPTForCausalImageModeling"),Zc.forEach(t),Fs.forEach(t),hs=d(o),j=s(o,"DIV",{class:!0});var re=n(j);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 As=n($t);vl=i(As,"This model inherits from "),ao=s(As,"A",{href:!0});var tm=n(ao);Tl=i(tm,"PreTrainedModel"),tm.forEach(t),bl=i(As,`. 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.)`),As.forEach(t),yl=d(re),Gt=s(re,"P",{});var js=n(Gt);Il=i(js,"This model is also a PyTorch "),Et=s(js,"A",{href:!0,rel:!0});var om=n(Et);wl=i(om,"torch.nn.Module"),om.forEach(t),Pl=i(js,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),js.forEach(t),kl=d(re),W=s(re,"DIV",{class:!0});var Be=n(W);y(xt.$$.fragment,Be),$l=d(Be),ve=s(Be,"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),Ml=i(ho," special method."),ho.forEach(t),zl=d(Be),y(De.$$.fragment,Be),ql=d(Be),y(Ne.$$.fragment,Be),Be.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);Aa=s(nm,"SPAN",{});var rm=n(Aa);y(Ct.$$.fragment,rm),rm.forEach(t),nm.forEach(t),Fl=d(Ds),ja=s(Ds,"SPAN",{});var im=n(ja);Al=i(im,"ImageGPTForImageClassification"),im.forEach(t),Ds.forEach(t),us=d(o),D=s(o,"DIV",{class:!0});var ie=n(D);y(Mt.$$.fragment,ie),jl=d(ie),zt=s(ie,"P",{});var Ns=n(zt);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);Vl=i(Ss,"This model is also a PyTorch "),At=s(Ss,"A",{href:!0,rel:!0});var cm=n(At);Bl=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(jt.$$.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(Pe.src,nd="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/imagegpt_architecture.png")||m(Pe,"src",nd),m(Pe,"alt","drawing"),m(Pe,"width","600"),m(Ye,"href","https://huggingface.co/nielsr"),m(Ye,"rel","nofollow"),m(Qe,"href","https://github.com/openai/image-gpt/issues/7"),m(Qe,"rel","nofollow"),m(Ke,"href","https://github.com/openai/image-gpt"),m(Ke,"rel","nofollow"),m(Ht,"href","gpt2"),m(Vt,"href","/docs/transformers/v4.27.1/en/model_doc/imagegpt#transformers.ImageGPTImageProcessor"),m(Bt,"href","/docs/transformers/v4.27.1/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.27.1/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.27.1/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.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),m(eo,"href","/docs/transformers/v4.27.1/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(Me,"id","transformers.ImageGPTImageProcessor"),m(Me,"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(Me,"href","#transformers.ImageGPTImageProcessor"),m(ge,"class","relative group"),m(ze,"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.27.1/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.27.1/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(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(je,"id","transformers.ImageGPTForCausalImageModeling"),m(je,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(je,"href","#transformers.ImageGPTForCausalImageModeling"),m(_e,"class","relative group"),m(ao,"href","/docs/transformers/v4.27.1/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.27.1/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(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(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.27.1/en/model_doc/imagegpt#transformers.ImageGPTForImageClassification"),m(ro,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),m(At,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(At,"rel","nofollow"),m(io,"href","/docs/transformers/v4.27.1/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,Vs),e(le,fo),e(fo,Bs),h(o,Ha,p),h(o,we,p),e(we,Us),e(we,Xe),e(Xe,Js),e(we,Xs),h(o,Va,p),h(o,St,p),e(St,Ys),h(o,Ba,p),h(o,Lt,p),e(Lt,_o),e(_o,Qs),h(o,Ua,p),h(o,Pe,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,Vt),e(Vt,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,Bt),e(Bt,yn),e(ot,In),e(O,wn),e(O,To),e(To,Pn),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,wo),e(wo,Po),e(Po,Gn),e(G,En),e(G,ko),e(ko,$o),e($o,xn),e(G,Cn),e(G,Go),e(Go,Eo),e(Eo,Mn),e(G,zn),e(G,xo),e(xo,Co),e(Co,qn),e(G,Fn),e(G,Mo),e(Mo,zo),e(zo,An),e(ke,jn),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,Ao),e(Ao,Ln),e(x,Rn),e(x,jo),e(jo,Wn),e(x,Hn),e(x,Do),e(Do,Vn),e(x,Bn),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,M),e(M,Vo),e(Vo,ir),e(M,lr),e(M,Bo),e(Bo,dr),e(M,cr),e(M,Uo),e(Uo,mr),e(M,pr),e(M,Jo),e(Jo,hr),e(M,gr),e(M,Xo),e(Xo,ur),e(M,fr),e(M,Yo),e(Yo,_r),e(E,vr),e(E,z),e(z,Qo),e(Qo,Tr),e(z,br),e(z,Ko),e(Ko,yr),e(z,Ir),e(z,Zo),e(Zo,wr),e(z,Pr),e(z,ea),e(ea,kr),e(z,$r),e(z,ta),e(ta,Gr),e(z,Er),e(z,oa),e(oa,xr),e(E,Cr),e(E,q),e(q,aa),e(aa,Mr),e(q,zr),e(q,sa),e(sa,qr),e(q,Fr),e(q,na),e(na,Ar),e(q,jr),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,Vr),e(F,Br),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,wi),e(Z,Pi),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,Mi),e(me,zi),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,Ai),h(o,is,p),h(o,he,p),I(ht,he,null),e(he,ji),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,Me),e(Me,wa),I(ut,wa,null),e(ge,Oi),e(ge,Pa),e(Pa,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,ze),I(_t,ze,null),e(ze,Hi),e(ze,$a),e($a,Vi),h(o,cs,p),h(o,ue,p),e(ue,qe),e(qe,Ga),I(vt,Ga,null),e(ue,Bi),e(ue,Ea),e(Ea,Ui),h(o,ms,p),h(o,A,p),I(Tt,A,null),e(A,Ji),e(A,xa),e(xa,Xi),e(A,Yi),e(A,bt),e(bt,Qi),e(bt,to),e(to,Ki),e(bt,Zi),e(A,el),e(A,yt),e(yt,tl),e(yt,It),e(It,ol),e(yt,al),e(A,sl),e(A,R),I(wt,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(Ae,R,null),h(o,ps,p),h(o,_e,p),e(_e,je),e(je,Ma),I(Pt,Ma,null),e(_e,hl),e(_e,za),e(za,gl),h(o,hs,p),h(o,j,p),I(kt,j,null),e(j,ul),e(j,qa),e(qa,fl),e(j,_l),e(j,$t),e($t,vl),e($t,ao),e(ao,Tl),e($t,bl),e(j,yl),e(j,Gt),e(Gt,Il),e(Gt,Et),e(Et,wl),e(Gt,Pl),e(j,kl),e(j,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,Ml),e(W,zl),I(De,W,null),e(W,ql),I(Ne,W,null),h(o,gs,p),h(o,Te,p),e(Te,Oe),e(Oe,Aa),I(Ct,Aa,null),e(Te,Fl),e(Te,ja),e(ja,Al),h(o,us,p),h(o,D,p),I(Mt,D,null),e(D,jl),e(D,zt),e(zt,Dl),e(zt,no),e(no,Nl),e(zt,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,Vl),e(Ft,At),e(At,Bl),e(Ft,Ul),e(D,Jl),e(D,H),I(jt,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}),Ae.$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||(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(wt.$$.fragment,o),w(Fe.$$.fragment,o),w(Ae.$$.fragment,o),w(Pt.$$.fragment,o),w(kt.$$.fragment,o),w(xt.$$.fragment,o),w(De.$$.fragment,o),w(Ne.$$.fragment,o),w(Ct.$$.fragment,o),w(Mt.$$.fragment,o),w(jt.$$.fragment,o),w(Se.$$.fragment,o),w(Le.$$.fragment,o),fs=!0)},o(o){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(wt.$$.fragment,o),P(Fe.$$.fragment,o),P(Ae.$$.fragment,o),P(Pt.$$.fragment,o),P(kt.$$.fragment,o),P(xt.$$.fragment,o),P(De.$$.fragment,o),P(Ne.$$.fragment,o),P(Ct.$$.fragment,o),P(Mt.$$.fragment,o),P(jt.$$.fragment,o),P(Se.$$.fragment,o),P(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(we),o&&t(Va),o&&t(St),o&&t(Ba),o&&t(Lt),o&&t(Ua),o&&t(Pe),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(A),k(Tt),k(wt),k(Fe),k(Ae),o&&t(ps),o&&t(_e),k(Pt),o&&t(hs),o&&t(j),k(kt),k(xt),k(De),k(Ne),o&&t(gs),o&&t(Te),k(Ct),o&&t(us),o&&t(D),k(Mt),k(jt),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};
