import{S as kc,i as $c,s as Gc,e as a,k as l,w as b,t as r,M as xc,c as s,d as t,m as d,a as n,x as I,h as i,b as m,N as zc,G as e,g,y,q as P,o as w,B as k,v as Cc,L as bs}from"../../chunks/vendor-hf-doc-builder.js";import{T as wl}from"../../chunks/Tip-hf-doc-builder.js";import{D as ae}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Is}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as We}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ts}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Ec($){let p,T,_,u,v;return u=new Is({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(){p=a("p"),T=r("Example:"),_=l(),b(u.$$.fragment)},l(c){p=s(c,"P",{});var f=n(p);T=i(f,"Example:"),f.forEach(t),_=d(c),I(u.$$.fragment,c)},m(c,f){g(c,p,f),e(p,T),g(c,_,f),y(u,c,f),v=!0},p:bs,i(c){v||(P(u.$$.fragment,c),v=!0)},o(c){w(u.$$.fragment,c),v=!1},d(c){c&&t(p),c&&t(_),k(u,c)}}}function qc($){let p,T,_,u,v;return{c(){p=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){p=s(c,"P",{});var f=n(p);T=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var O=n(_);u=i(O,"Module"),O.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){g(c,p,f),e(p,T),e(p,_),e(_,u),e(p,v)},d(c){c&&t(p)}}}function Mc($){let p,T,_,u,v;return u=new Is({props:{code:`from transformers import ImageGPTImageProcessor, 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 = ImageGPTImageProcessor.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> ImageGPTImageProcessor, 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 = ImageGPTImageProcessor.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(){p=a("p"),T=r("Examples:"),_=l(),b(u.$$.fragment)},l(c){p=s(c,"P",{});var f=n(p);T=i(f,"Examples:"),f.forEach(t),_=d(c),I(u.$$.fragment,c)},m(c,f){g(c,p,f),e(p,T),g(c,_,f),y(u,c,f),v=!0},p:bs,i(c){v||(P(u.$$.fragment,c),v=!0)},o(c){w(u.$$.fragment,c),v=!1},d(c){c&&t(p),c&&t(_),k(u,c)}}}function Fc($){let p,T,_,u,v;return{c(){p=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){p=s(c,"P",{});var f=n(p);T=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var O=n(_);u=i(O,"Module"),O.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){g(c,p,f),e(p,T),e(p,_),e(_,u),e(p,v)},d(c){c&&t(p)}}}function jc($){let p,T,_,u,v;return u=new Is({props:{code:`from transformers import ImageGPTImageProcessor, ImageGPTForCausalImageModeling
import torch
import matplotlib.pyplot as plt
import numpy as np

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