import{S as hm,i as gm,s as um,e as a,k as l,w as b,t as r,M as fm,c as n,d as t,m as d,a as s,x as v,h as i,b as m,N as _m,G as e,g as h,y as w,q as I,o as P,B as M,v as Tm,L as Sn}from"../../chunks/vendor-hf-doc-builder.js";import{T as nd}from"../../chunks/Tip-hf-doc-builder.js";import{D as te}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Bn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as ve}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Zn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as ym}from"../../chunks/PipelineTag-hf-doc-builder.js";function bm(k){let g,y,_,u,T;return u=new Bn({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEltYWdlR1BUQ29uZmlnJTJDJTIwSW1hZ2VHUFRNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBJbWFnZUdQVCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwSW1hZ2VHUFRDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwSW1hZ2VHUFRNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ImageGPTConfig, ImageGPTModel

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;openai/imagegpt-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ImageGPTModel.from_pretrained(<span class="hljs-string">&quot;openai/imagegpt-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){g=a("p"),y=r("Examples:"),_=l(),b(u.$$.fragment)},l(c){g=n(c,"P",{});var f=s(g);y=i(f,"Examples:"),f.forEach(t),_=d(c),v(u.$$.fragment,c)},m(c,f){h(c,g,f),e(g,y),h(c,_,f),w(u,c,f),T=!0},p:Sn,i(c){T||(I(u.$$.fragment,c),T=!0)},o(c){P(u.$$.fragment,c),T=!1},d(c){c&&t(g),c&&t(_),M(u,c)}}}function Im(k){let g,y,_,u,T;return{c(){g=a("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),u=r("Module"),T=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){g=n(c,"P",{});var f=s(g);y=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(f,"CODE",{});var N=s(_);u=i(N,"Module"),N.forEach(t),T=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(t)},m(c,f){h(c,g,f),e(g,y),e(g,_),e(_,u),e(g,T)},d(c){c&&t(g)}}}function Pm(k){let g,y,_,u,T;return u=new Bn({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMEltYWdlR1BURm9yQ2F1c2FsSW1hZ2VNb2RlbGluZyUwQWltcG9ydCUyMHRvcmNoJTBBaW1wb3J0JTIwbWF0cGxvdGxpYi5weXBsb3QlMjBhcyUyMHBsdCUwQWltcG9ydCUyMG51bXB5JTIwYXMlMjBucCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGaW1hZ2VncHQtc21hbGwlMjIpJTBBbW9kZWwlMjAlM0QlMjBJbWFnZUdQVEZvckNhdXNhbEltYWdlTW9kZWxpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmltYWdlZ3B0LXNtYWxsJTIyKSUwQWRldmljZSUyMCUzRCUyMHRvcmNoLmRldmljZSglMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiklMEFtb2RlbC50byhkZXZpY2UpJTBBJTIzJTIwdW5jb25kaXRpb25hbCUyMGdlbmVyYXRpb24lMjBvZiUyMDglMjBpbWFnZXMlMEFiYXRjaF9zaXplJTIwJTNEJTIwNCUwQWNvbnRleHQlMjAlM0QlMjB0b3JjaC5mdWxsKChiYXRjaF9zaXplJTJDJTIwMSklMkMlMjBtb2RlbC5jb25maWcudm9jYWJfc2l6ZSUyMC0lMjAxKSUyMCUyMCUyMyUyMGluaXRpYWxpemUlMjB3aXRoJTIwU09TJTIwdG9rZW4lMEFjb250ZXh0JTIwJTNEJTIwY29udGV4dC50byhkZXZpY2UpJTBBb3V0cHV0JTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoJTBBJTIwJTIwJTIwJTIwaW5wdXRfaWRzJTNEY29udGV4dCUyQyUyMG1heF9sZW5ndGglM0Rtb2RlbC5jb25maWcubl9wb3NpdGlvbnMlMjAlMkIlMjAxJTJDJTIwdGVtcGVyYXR1cmUlM0QxLjAlMkMlMjBkb19zYW1wbGUlM0RUcnVlJTJDJTIwdG9wX2slM0Q0MCUwQSklMEElMEFjbHVzdGVycyUyMCUzRCUyMGltYWdlX3Byb2Nlc3Nvci5jbHVzdGVycyUwQWhlaWdodCUyMCUzRCUyMGltYWdlX3Byb2Nlc3Nvci5zaXplJTVCJTIyaGVpZ2h0JTIyJTVEJTBBd2lkdGglMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3Iuc2l6ZSU1QiUyMndpZHRoJTIyJTVEJTBBJTBBc2FtcGxlcyUyMCUzRCUyMG91dHB1dCU1QiUzQSUyQyUyMDElM0ElNUQuY3B1KCkuZGV0YWNoKCkubnVtcHkoKSUwQXNhbXBsZXNfaW1nJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwbnAucmVzaGFwZShucC5yaW50KDEyNy41JTIwKiUyMChjbHVzdGVycyU1QnMlNUQlMjAlMkIlMjAxLjApKSUyQyUyMCU1QmhlaWdodCUyQyUyMHdpZHRoJTJDJTIwMyU1RCkuYXN0eXBlKG5wLnVpbnQ4KSUyMGZvciUyMHMlMjBpbiUyMHNhbXBsZXMlMEElNUQlMjAlMjAlMjMlMjBjb252ZXJ0JTIwY29sb3IlMjBjbHVzdGVyJTIwdG9rZW5zJTIwYmFjayUyMHRvJTIwcGl4ZWxzJTBBZiUyQyUyMGF4ZXMlMjAlM0QlMjBwbHQuc3VicGxvdHMoMSUyQyUyMGJhdGNoX3NpemUlMkMlMjBkcGklM0QzMDApJTBBJTBBZm9yJTIwaW1nJTJDJTIwYXglMjBpbiUyMHppcChzYW1wbGVzX2ltZyUyQyUyMGF4ZXMpJTNBJTBBJTIwJTIwJTIwJTIwYXguYXhpcyglMjJvZmYlMjIpJTBBJTIwJTIwJTIwJTIwYXguaW1zaG93KGltZyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ImageGPTForCausalImageModeling
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> matplotlib.pyplot <span class="hljs-keyword">as</span> plt
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;openai/imagegpt-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ImageGPTForCausalImageModeling.from_pretrained(<span class="hljs-string">&quot;openai/imagegpt-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>device = torch.device(<span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># unconditional generation of 8 images</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>batch_size = <span class="hljs-number">4</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 = context.to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span>output = model.generate(
<span class="hljs-meta">... </span>    input_ids=context, max_length=model.config.n_positions + <span class="hljs-number">1</span>, temperature=<span class="hljs-number">1.0</span>, do_sample=<span class="hljs-literal">True</span>, top_k=<span class="hljs-number">40</span>
<span class="hljs-meta">... </span>)

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> img, ax <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(samples_img, axes):
<span class="hljs-meta">... </span>    ax.axis(<span class="hljs-string">&quot;off&quot;</span>)
<span class="hljs-meta">... </span>    ax.imshow(img)`}}),{c(){g=a("p"),y=r("Examples:"),_=l(),b(u.$$.fragment)},l(c){g=n(c,"P",{});var f=s(g);y=i(f,"Examples:"),f.forEach(t),_=d(c),v(u.$$.fragment,c)},m(c,f){h(c,g,f),e(g,y),h(c,_,f),w(u,c,f),T=!0},p:Sn,i(c){T||(I(u.$$.fragment,c),T=!0)},o(c){P(u.$$.fragment,c),T=!1},d(c){c&&t(g),c&&t(_),M(u,c)}}}function Mm(k){let g,y,_,u,T;return{c(){g=a("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),u=r("Module"),T=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){g=n(c,"P",{});var f=s(g);y=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(f,"CODE",{});var N=s(_);u=i(N,"Module"),N.forEach(t),T=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(t)},m(c,f){h(c,g,f),e(g,y),e(g,_),e(_,u),e(g,T)},d(c){c&&t(g)}}}function km(k){let g,y,_,u,T;return u=new Bn({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMEltYWdlR1BURm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGaW1hZ2VncHQtc21hbGwlMjIpJTBBbW9kZWwlMjAlM0QlMjBJbWFnZUdQVEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmltYWdlZ3B0LXNtYWxsJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, ImageGPTForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;openai/imagegpt-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ImageGPTForImageClassification.from_pretrained(<span class="hljs-string">&quot;openai/imagegpt-small&quot;</span>)

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