import{S as Mc,i as Fc,s as zc,e as n,k as d,w as _,t as r,M as Ec,c as s,d as o,m as c,a,x as T,h as i,b as l,F as e,g as u,y as v,q as P,o as k,B as w}from"../../chunks/vendor-4833417e.js";import{T as zo}from"../../chunks/Tip-fffd6df1.js";import{D as Q}from"../../chunks/Docstring-4f315ed9.js";import{C as Y}from"../../chunks/CodeBlock-6a3d1b46.js";import{I as le}from"../../chunks/IconCopyLink-4b81c553.js";import"../../chunks/CopyButton-dacfbfaf.js";function qc(F){let h,y,m,b,j;return{c(){h=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),m=n("code"),b=r("Module"),j=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(g){h=s(g,"P",{});var f=a(h);y=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),m=s(f,"CODE",{});var $=a(m);b=i($,"Module"),$.forEach(o),j=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(o)},m(g,f){u(g,h,f),e(h,y),e(h,m),e(m,b),e(h,j)},d(g){g&&o(h)}}}function Ac(F){let h,y,m,b,j;return{c(){h=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),m=n("code"),b=r("Module"),j=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(g){h=s(g,"P",{});var f=a(h);y=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),m=s(f,"CODE",{});var $=a(m);b=i($,"Module"),$.forEach(o),j=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(o)},m(g,f){u(g,h,f),e(h,y),e(h,m),e(m,b),e(h,j)},d(g){g&&o(h)}}}function Cc(F){let h,y,m,b,j;return{c(){h=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),m=n("code"),b=r("Module"),j=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(g){h=s(g,"P",{});var f=a(h);y=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),m=s(f,"CODE",{});var $=a(m);b=i($,"Module"),$.forEach(o),j=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(o)},m(g,f){u(g,h,f),e(h,y),e(h,m),e(m,b),e(h,j)},d(g){g&&o(h)}}}function Ic(F){let h,y,m,b,j;return{c(){h=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),m=n("code"),b=r("Module"),j=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(g){h=s(g,"P",{});var f=a(h);y=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),m=s(f,"CODE",{});var $=a(m);b=i($,"Module"),$.forEach(o),j=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(o)},m(g,f){u(g,h,f),e(h,y),e(h,m),e(m,b),e(h,j)},d(g){g&&o(h)}}}function Lc(F){let h,y,m,b,j;return{c(){h=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),m=n("code"),b=r("Module"),j=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(g){h=s(g,"P",{});var f=a(h);y=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),m=s(f,"CODE",{});var $=a(m);b=i($,"Module"),$.forEach(o),j=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(o)},m(g,f){u(g,h,f),e(h,y),e(h,m),e(m,b),e(h,j)},d(g){g&&o(h)}}}function Sc(F){let h,y,m,b,j;return{c(){h=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),m=n("code"),b=r("Module"),j=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(g){h=s(g,"P",{});var f=a(h);y=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),m=s(f,"CODE",{});var $=a(m);b=i($,"Module"),$.forEach(o),j=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(o)},m(g,f){u(g,h,f),e(h,y),e(h,m),e(m,b),e(h,j)},d(g){g&&o(h)}}}function Nc(F){let h,y,m,b,j,g,f,$,Cs,Wn,de,je,Eo,Ve,Is,qo,Ls,Un,Z,Ss,Ke,Ns,Ds,Xe,Bs,Os,Qn,$e,Ws,Ye,Us,Qs,Hn,ro,Hs,Rn,io,N,Rs,Ze,Vs,Ks,Ao,Xs,Ys,Co,Zs,ea,et,ta,oa,Vn,tt,Kn,Ge,Io,lo,na,ot,sa,aa,Lo,R,ra,nt,ia,la,So,da,ca,No,pa,ha,Xn,ce,xe,Do,st,ua,Bo,ma,Yn,Je,fa,co,ga,_a,Zn,at,es,po,Ta,ts,rt,os,pe,Me,Oo,it,va,Wo,Pa,ns,D,lt,ka,B,wa,ho,ba,ya,dt,ja,$a,uo,Ga,xa,mo,Ja,Ma,Fa,Uo,za,Ea,ct,ss,he,Fe,Qo,pt,qa,Ho,Aa,as,V,ht,Ca,ut,Ia,mt,La,Sa,Na,z,ft,Da,ue,Ba,fo,Oa,Wa,Ro,Ua,Qa,Ha,ze,Ra,Vo,Va,Ka,gt,rs,me,Ee,Ko,_t,Xa,Xo,Ya,is,O,Tt,Za,Yo,er,tr,vt,or,Pt,nr,sr,ar,E,kt,rr,fe,ir,go,lr,dr,Zo,cr,pr,hr,qe,ur,en,mr,fr,wt,ls,ge,Ae,tn,bt,gr,on,_r,ds,M,yt,Tr,nn,vr,Pr,_o,To,kr,wr,br,W,yr,sn,jr,$r,an,Gr,xr,rn,Jr,Mr,ln,Fr,zr,Er,jt,qr,$t,Ar,Cr,Ir,J,Gt,Lr,_e,Sr,vo,Nr,Dr,dn,Br,Or,Wr,Ce,Ur,cn,Qr,Hr,xt,Rr,pn,Vr,Kr,Jt,cs,Te,Ie,hn,Mt,Xr,un,Yr,ps,U,Ft,Zr,ve,ei,mn,ti,oi,fn,ni,si,ai,zt,ri,Et,ii,li,di,q,qt,ci,Pe,pi,Po,hi,ui,gn,mi,fi,gi,Le,_i,_n,Ti,vi,At,hs,ke,Se,Tn,Ct,Pi,vn,ki,us,G,It,wi,Pn,bi,yi,Lt,ji,ko,$i,Gi,xi,St,Ji,Nt,Mi,Fi,zi,kn,Ei,qi,K,wn,Dt,Ai,Ci,bn,Bt,Ii,Li,yn,Ot,Si,Ni,jn,Wt,Di,Bi,A,Ut,Oi,we,Wi,$n,Ui,Qi,Gn,Hi,Ri,Vi,Ne,Ki,xn,Xi,Yi,Qt,ms,be,De,Jn,Ht,Zi,Mn,el,fs,x,Rt,tl,Fn,ol,nl,Vt,sl,wo,al,rl,il,Kt,ll,Xt,dl,cl,pl,zn,hl,ul,X,En,Yt,ml,fl,qn,Zt,gl,_l,An,eo,Tl,vl,Cn,to,Pl,kl,C,oo,wl,ye,bl,In,yl,jl,Ln,$l,Gl,xl,Be,Jl,Sn,Ml,Fl,no,gs;return g=new le({}),Ve=new le({}),tt=new Y({props:{code:`from transformers import GPTJForCausalLM
import torch

model = GPTJForCausalLM.from_pretrained(
    "EleutherAI/gpt-j-6B", revision="float16", torch_dtype=torch.float16, low_cpu_mem_usage=True
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTJForCausalLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForCausalLM.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>, revision=<span class="hljs-string">&quot;float16&quot;</span>, torch_dtype=torch.float16, low_cpu_mem_usage=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)`}}),st=new le({}),at=new Y({props:{code:`from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-j-6B")
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")

prompt = (
    "In a shocking finding, scientists discovered a herd of unicorns living in a remote, "
    "previously unexplored valley, in the Andes Mountains. Even more surprising to the "
    "researchers was the fact that the unicorns spoke perfect English."
)

input_ids = tokenizer(prompt, return_tensors="pt").input_ids

gen_tokens = model.generate(
    input_ids,
    do_sample=True,
    temperature=0.9,
    max_length=100,
)
gen_text = tokenizer.batch_decode(gen_tokens)[0]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = (
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;In a shocking finding, scientists discovered a herd of unicorns living in a remote, &quot;</span>
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;previously unexplored valley, in the Andes Mountains. Even more surprising to the &quot;</span>
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;researchers was the fact that the unicorns spoke perfect English.&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>gen_tokens = model.generate(
<span class="hljs-meta">... </span>    input_ids,
<span class="hljs-meta">... </span>    do_sample=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    temperature=<span class="hljs-number">0.9</span>,
<span class="hljs-meta">... </span>    max_length=<span class="hljs-number">100</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>gen_text = tokenizer.batch_decode(gen_tokens)[<span class="hljs-number">0</span>]`}}),rt=new Y({props:{code:`from transformers import GPTJForCausalLM, AutoTokenizer
import torch

model = GPTJForCausalLM.from_pretrained("EleutherAI/gpt-j-6B", torch_dtype=torch.float16)
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")

prompt = (
    "In a shocking finding, scientists discovered a herd of unicorns living in a remote, "
    "previously unexplored valley, in the Andes Mountains. Even more surprising to the "
    "researchers was the fact that the unicorns spoke perfect English."
)

input_ids = tokenizer(prompt, return_tensors="pt").input_ids

gen_tokens = model.generate(
    input_ids,
    do_sample=True,
    temperature=0.9,
    max_length=100,
)
gen_text = tokenizer.batch_decode(gen_tokens)[0]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTJForCausalLM, AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForCausalLM.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = (
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;In a shocking finding, scientists discovered a herd of unicorns living in a remote, &quot;</span>
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;previously unexplored valley, in the Andes Mountains. Even more surprising to the &quot;</span>
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;researchers was the fact that the unicorns spoke perfect English.&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>gen_tokens = model.generate(
<span class="hljs-meta">... </span>    input_ids,
<span class="hljs-meta">... </span>    do_sample=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    temperature=<span class="hljs-number">0.9</span>,
<span class="hljs-meta">... </span>    max_length=<span class="hljs-number">100</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>gen_text = tokenizer.batch_decode(gen_tokens)[<span class="hljs-number">0</span>]`}}),it=new le({}),lt=new Q({props:{name:"class transformers.GPTJConfig",anchor:"transformers.GPTJConfig",parameters:[{name:"vocab_size",val:" = 50400"},{name:"n_positions",val:" = 2048"},{name:"n_embd",val:" = 4096"},{name:"n_layer",val:" = 28"},{name:"n_head",val:" = 16"},{name:"rotary_dim",val:" = 64"},{name:"n_inner",val:" = None"},{name:"activation_function",val:" = 'gelu_new'"},{name:"resid_pdrop",val:" = 0.0"},{name:"embd_pdrop",val:" = 0.0"},{name:"attn_pdrop",val:" = 0.0"},{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:"bos_token_id",val:" = 50256"},{name:"eos_token_id",val:" = 50256"},{name:"tie_word_embeddings",val:" = False"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/configuration_gptj.py#L29",parametersDescription:[{anchor:"transformers.GPTJConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50400) &#x2014;
Vocabulary size of the GPT-J model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJModel">GPTJModel</a>.`,name:"vocab_size"},{anchor:"transformers.GPTJConfig.n_positions",description:`<strong>n_positions</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#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.GPTJConfig.n_embd",description:`<strong>n_embd</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimensionality of the embeddings and hidden states.`,name:"n_embd"},{anchor:"transformers.GPTJConfig.n_layer",description:`<strong>n_layer</strong> (<code>int</code>, <em>optional</em>, defaults to 28) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"n_layer"},{anchor:"transformers.GPTJConfig.n_head",description:`<strong>n_head</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"n_head"},{anchor:"transformers.GPTJConfig.rotary_dim",description:`<strong>rotary_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Number of dimensions in the embedding that Rotary Position Embedding is applied to.`,name:"rotary_dim"},{anchor:"transformers.GPTJConfig.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.GPTJConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
Activation function, to be selected in the list <code>[&quot;relu&quot;, &quot;silu&quot;, &quot;gelu&quot;, &quot;tanh&quot;, &quot;gelu_new&quot;]</code>.`,name:"activation_function"},{anchor:"transformers.GPTJConfig.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.GPTJConfig.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.GPTJConfig.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.GPTJConfig.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.GPTJConfig.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.GPTJConfig.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.GPTJConfig.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"}]}}),ct=new Y({props:{code:`from transformers import GPTJModel, GPTJConfig

# Initializing a GPT-J 6B configuration
configuration = GPTJConfig()

# Initializing a model from the configuration
model = GPTJModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTJModel, GPTJConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a GPT-J 6B configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = GPTJConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJModel(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`}}),pt=new le({}),ht=new Q({props:{name:"class transformers.GPTJModel",anchor:"transformers.GPTJModel",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/modeling_gptj.py#L450",parametersDescription:[{anchor:"transformers.GPTJModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</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/pr_15839/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]}}),ft=new Q({props:{name:"forward",anchor:"transformers.GPTJModel.forward",parameters:[{name:"input_ids",val:" = None"},{name:"past_key_values",val:" = None"},{name:"attention_mask",val:" = None"},{name:"token_type_ids",val:" = None"},{name:"position_ids",val:" = None"},{name:"head_mask",val:" = None"},{name:"inputs_embeds",val:" = None"},{name:"use_cache",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/modeling_gptj.py#L506",parametersDescription:[{anchor:"transformers.GPTJModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>GPTJTokenizer</code>. See <a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPTJModel.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.GPTJModel.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.GPTJModel.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.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTJModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_attention_heads,)</code> or <code>(n_layer, num_attention_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.GPTJModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_dim)</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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTJModel.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.GPTJModel.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.GPTJModel.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/pr_15839/en/main_classes/output#transformers.file_utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`
<p>A <a
  href="/docs/transformers/pr_15839/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</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/pr_15839/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</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 + 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 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><a
  href="/docs/transformers/pr_15839/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ze=new zo({props:{$$slots:{default:[qc]},$$scope:{ctx:F}}}),gt=new Y({props:{code:`from transformers import GPT2Tokenizer, GPTJModel
import torch

tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-j-6B")
model = GPTJModel.from_pretrained("EleutherAI/gpt-j-6B")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPT2Tokenizer, GPTJModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = GPT2Tokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJModel.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, 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`}}),_t=new le({}),Tt=new Q({props:{name:"class transformers.GPTJForCausalLM",anchor:"transformers.GPTJForCausalLM",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/modeling_gptj.py#L690",parametersDescription:[{anchor:"transformers.GPTJForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</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/pr_15839/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]}}),kt=new Q({props:{name:"forward",anchor:"transformers.GPTJForCausalLM.forward",parameters:[{name:"input_ids",val:" = None"},{name:"past_key_values",val:" = None"},{name:"attention_mask",val:" = None"},{name:"token_type_ids",val:" = None"},{name:"position_ids",val:" = None"},{name:"head_mask",val:" = None"},{name:"inputs_embeds",val:" = None"},{name:"labels",val:" = None"},{name:"use_cache",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/modeling_gptj.py#L759",parametersDescription:[{anchor:"transformers.GPTJForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>GPTJTokenizer</code>. See <a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPTJForCausalLM.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.GPTJForCausalLM.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.GPTJForCausalLM.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.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTJForCausalLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_attention_heads,)</code> or <code>(n_layer, num_attention_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.GPTJForCausalLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_dim)</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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTJForCausalLM.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.GPTJForCausalLM.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.GPTJForCausalLM.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/pr_15839/en/main_classes/output#transformers.file_utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTJForCausalLM.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"}],returnDescription:`
<p>A <a
  href="/docs/transformers/pr_15839/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</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/pr_15839/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</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>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 + 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 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><a
  href="/docs/transformers/pr_15839/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),qe=new zo({props:{$$slots:{default:[Ac]},$$scope:{ctx:F}}}),wt=new Y({props:{code:`import torch
from transformers import GPT2Tokenizer, GPTJForCausalLM

tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-j-6B")
model = GPTJForCausalLM.from_pretrained("EleutherAI/gpt-j-6B")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs, labels=inputs["input_ids"])
loss = outputs.loss
logits = outputs.logits`,highlighted:`<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">from</span> transformers <span class="hljs-keyword">import</span> GPT2Tokenizer, GPTJForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = GPT2Tokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForCausalLM.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),bt=new le({}),yt=new Q({props:{name:"class transformers.GPTJForSequenceClassification",anchor:"transformers.GPTJForSequenceClassification",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/modeling_gptj.py#L865",parametersDescription:[{anchor:"transformers.GPTJForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</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/pr_15839/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]}}),Gt=new Q({props:{name:"forward",anchor:"transformers.GPTJForSequenceClassification.forward",parameters:[{name:"input_ids",val:" = None"},{name:"past_key_values",val:" = None"},{name:"attention_mask",val:" = None"},{name:"token_type_ids",val:" = None"},{name:"position_ids",val:" = None"},{name:"head_mask",val:" = None"},{name:"inputs_embeds",val:" = None"},{name:"labels",val:" = None"},{name:"use_cache",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/modeling_gptj.py#L881",parametersDescription:[{anchor:"transformers.GPTJForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>GPTJTokenizer</code>. See <a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPTJForSequenceClassification.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.GPTJForSequenceClassification.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.GPTJForSequenceClassification.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.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTJForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_attention_heads,)</code> or <code>(n_layer, num_attention_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.GPTJForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_dim)</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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTJForSequenceClassification.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.GPTJForSequenceClassification.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.GPTJForSequenceClassification.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/pr_15839/en/main_classes/output#transformers.file_utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTJForSequenceClassification.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"}],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/pr_15839/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</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 + 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 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>
`}}),Ce=new zo({props:{$$slots:{default:[Cc]},$$scope:{ctx:F}}}),xt=new Y({props:{code:`import torch
from transformers import GPT2Tokenizer, GPTJForSequenceClassification

torch.manual_seed(0)
tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-j-6B")
model = GPTJForSequenceClassification.from_pretrained("EleutherAI/gpt-j-6B", num_labels=2)

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
labels = torch.tensor([1]).unsqueeze(0)  # Batch size 1
outputs = model(**inputs, labels=labels)
loss = outputs.loss
logits = outputs.logits
list(logits.shape)
`,highlighted:`<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">from</span> transformers <span class="hljs-keyword">import</span> GPT2Tokenizer, GPTJForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>torch.manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = GPT2Tokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>, num_labels=<span class="hljs-number">2</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor([<span class="hljs-number">1</span>]).unsqueeze(<span class="hljs-number">0</span>)  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(logits.shape)
`}}),Jt=new Y({props:{code:`import torch
from transformers import GPT2Tokenizer, GPTJForSequenceClassification

torch.manual_seed(0)
tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-j-6B")
model = GPTJForSequenceClassification.from_pretrained("EleutherAI/gpt-j-6B", problem_type="multi_label_classification", num_labels=2)

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
labels = torch.tensor([[1, 1]], dtype=torch.float)  # need dtype=float for BCEWithLogitsLoss
outputs = model(**inputs, labels=labels)
loss = outputs.loss
list(logits.shape)
`,highlighted:`<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">from</span> transformers <span class="hljs-keyword">import</span> GPT2Tokenizer, GPTJForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>torch.manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = GPT2Tokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>, num_labels=<span class="hljs-number">2</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor([[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>]], dtype=torch.<span class="hljs-built_in">float</span>)  <span class="hljs-comment"># need dtype=float for BCEWithLogitsLoss</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(logits.shape)
`}}),Mt=new le({}),Ft=new Q({props:{name:"class transformers.GPTJForQuestionAnswering",anchor:"transformers.GPTJForQuestionAnswering",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/modeling_gptj.py#L991",parametersDescription:[{anchor:"transformers.GPTJForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</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/pr_15839/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]}}),qt=new Q({props:{name:"forward",anchor:"transformers.GPTJForQuestionAnswering.forward",parameters:[{name:"input_ids",val:" = None"},{name:"attention_mask",val:" = None"},{name:"token_type_ids",val:" = None"},{name:"position_ids",val:" = None"},{name:"head_mask",val:" = None"},{name:"inputs_embeds",val:" = None"},{name:"start_positions",val:" = None"},{name:"end_positions",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/modeling_gptj.py#L1007",parametersDescription:[{anchor:"transformers.GPTJForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>GPTJTokenizer</code>. See <a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPTJForQuestionAnswering.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.GPTJForQuestionAnswering.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.GPTJForQuestionAnswering.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.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTJForQuestionAnswering.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_attention_heads,)</code> or <code>(n_layer, num_attention_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.GPTJForQuestionAnswering.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_dim)</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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTJForQuestionAnswering.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.GPTJForQuestionAnswering.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.GPTJForQuestionAnswering.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/pr_15839/en/main_classes/output#transformers.file_utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTJForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.GPTJForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],returnDescription:`
<p>A <a
  href="/docs/transformers/pr_15839/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</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/pr_15839/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</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 Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-end scores (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 + 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 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><a
  href="/docs/transformers/pr_15839/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Le=new zo({props:{$$slots:{default:[Ic]},$$scope:{ctx:F}}}),At=new Y({props:{code:`from transformers import GPT2Tokenizer, GPTJForQuestionAnswering
import torch

torch.manual_seed(0)
tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-j-6B")
model = GPTJForQuestionAnswering.from_pretrained("EleutherAI/gpt-j-6B")

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"
inputs = tokenizer(question, text, return_tensors="pt")
start_positions = torch.tensor([1])
end_positions = torch.tensor([3])

outputs = model(**inputs, start_positions=start_positions, end_positions=end_positions)
loss = outputs.loss
round(loss.item(), 2)


start_scores = outputs.start_logits
list(start_scores.shape)


end_scores = outputs.end_logits
list(end_scores.shape)
`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPT2Tokenizer, GPTJForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>torch.manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = GPT2Tokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>question, text = <span class="hljs-string">&quot;Who was Jim Henson?&quot;</span>, <span class="hljs-string">&quot;Jim Henson was a nice puppet&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>start_positions = torch.tensor([<span class="hljs-number">1</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>end_positions = torch.tensor([<span class="hljs-number">3</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, start_positions=start_positions, end_positions=end_positions)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span>start_scores = outputs.start_logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(start_scores.shape)


<span class="hljs-meta">&gt;&gt;&gt; </span>end_scores = outputs.end_logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(end_scores.shape)
`}}),Ct=new le({}),It=new Q({props:{name:"class transformers.FlaxGPTJModel",anchor:"transformers.FlaxGPTJModel",parameters:[{name:"config",val:": GPTJConfig"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax._src.numpy.lax_numpy.float32'>"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/modeling_flax_gptj.py#L608",parametersDescription:[{anchor:"transformers.FlaxGPTJModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</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/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxGPTJModel.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}]}}),Ut=new Q({props:{name:"__call__",anchor:"transformers.FlaxGPTJPreTrainedModel.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"position_ids",val:" = None"},{name:"params",val:": dict = None"},{name:"past_key_values",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{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"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/modeling_flax_gptj.py#L426",parametersDescription:[{anchor:"transformers.FlaxGPTJPreTrainedModel.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code>. Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>GPTJTokenizer</code>. See <a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaxGPTJPreTrainedModel.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</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.FlaxGPTJPreTrainedModel.__call__.position_ids",description:`<strong>position_ids</strong> (<code>numpy.ndarray</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>.`,name:"position_ids"},{anchor:"transformers.FlaxGPTJPreTrainedModel.__call__.past_key_values",description:`<strong>past_key_values</strong> (<code>Dict[str, np.ndarray]</code>, <em>optional</em>, returned by <code>init_cache</code> or when passing previous <code>past_key_values</code>) &#x2014;
Dictionary of pre-computed hidden-states (key and values in the attention blocks) that can be used for fast
auto-regressive decoding. Pre-computed key and value hidden-states are of shape <em>[batch_size, max_length]</em>.`,name:"past_key_values"},{anchor:"transformers.FlaxGPTJPreTrainedModel.__call__.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.FlaxGPTJPreTrainedModel.__call__.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.FlaxGPTJPreTrainedModel.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_15839/en/main_classes/output#transformers.file_utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`
<p>A <a
  href="/docs/transformers/pr_15839/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput"
>transformers.modeling_flax_outputs.FlaxMaskedLMOutput</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/pr_15839/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>logits</strong> (<code>jnp.ndarray</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(jnp.ndarray)</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>jnp.ndarray</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</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>jnp.ndarray</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><a
  href="/docs/transformers/pr_15839/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput"
>transformers.modeling_flax_outputs.FlaxMaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ne=new zo({props:{$$slots:{default:[Lc]},$$scope:{ctx:F}}}),Qt=new Y({props:{code:`from transformers import GPTJTokenizer, FlaxGPTJModel

tokenizer = GPTJTokenizer.from_pretrained("gptj")
model = FlaxGPTJModel.from_pretrained("gptj")

inputs = tokenizer("Hello, my dog is cute", return_tensors="jax")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTJTokenizer, FlaxGPTJModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = GPTJTokenizer.from_pretrained(<span class="hljs-string">&quot;gptj&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxGPTJModel.from_pretrained(<span class="hljs-string">&quot;gptj&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;jax&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`}}),Ht=new le({}),Rt=new Q({props:{name:"class transformers.FlaxGPTJForCausalLM",anchor:"transformers.FlaxGPTJForCausalLM",parameters:[{name:"config",val:": GPTJConfig"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax._src.numpy.lax_numpy.float32'>"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/modeling_flax_gptj.py#L675",parametersDescription:[{anchor:"transformers.FlaxGPTJForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</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/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxGPTJForCausalLM.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}]}}),oo=new Q({props:{name:"__call__",anchor:"transformers.FlaxGPTJPreTrainedModel.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"position_ids",val:" = None"},{name:"params",val:": dict = None"},{name:"past_key_values",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{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"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/gptj/modeling_flax_gptj.py#L426",parametersDescription:[{anchor:"transformers.FlaxGPTJPreTrainedModel.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code>. Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>GPTJTokenizer</code>. See <a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaxGPTJPreTrainedModel.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</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.FlaxGPTJPreTrainedModel.__call__.position_ids",description:`<strong>position_ids</strong> (<code>numpy.ndarray</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>.`,name:"position_ids"},{anchor:"transformers.FlaxGPTJPreTrainedModel.__call__.past_key_values",description:`<strong>past_key_values</strong> (<code>Dict[str, np.ndarray]</code>, <em>optional</em>, returned by <code>init_cache</code> or when passing previous <code>past_key_values</code>) &#x2014;
Dictionary of pre-computed hidden-states (key and values in the attention blocks) that can be used for fast
auto-regressive decoding. Pre-computed key and value hidden-states are of shape <em>[batch_size, max_length]</em>.`,name:"past_key_values"},{anchor:"transformers.FlaxGPTJPreTrainedModel.__call__.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.FlaxGPTJPreTrainedModel.__call__.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.FlaxGPTJPreTrainedModel.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_15839/en/main_classes/output#transformers.file_utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`
<p>A <a
  href="/docs/transformers/pr_15839/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput"
>transformers.modeling_flax_outputs.FlaxMaskedLMOutput</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/pr_15839/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>logits</strong> (<code>jnp.ndarray</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(jnp.ndarray)</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>jnp.ndarray</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</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>jnp.ndarray</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><a
  href="/docs/transformers/pr_15839/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput"
>transformers.modeling_flax_outputs.FlaxMaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Be=new zo({props:{$$slots:{default:[Sc]},$$scope:{ctx:F}}}),no=new Y({props:{code:`from transformers import GPTJTokenizer, FlaxGPTJForCausalLM

tokenizer = GPTJTokenizer.from_pretrained("gptj")
model = FlaxGPTJForCausalLM.from_pretrained("gptj")

inputs = tokenizer("Hello, my dog is cute", return_tensors="np")
outputs = model(**inputs)

# retrieve logts for next token
next_token_logits = outputs.logits[:, -1]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTJTokenizer, FlaxGPTJForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = GPTJTokenizer.from_pretrained(<span class="hljs-string">&quot;gptj&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxGPTJForCausalLM.from_pretrained(<span class="hljs-string">&quot;gptj&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># retrieve logts for next token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>next_token_logits = outputs.logits[:, -<span class="hljs-number">1</span>]`}}),{c(){h=n("meta"),y=d(),m=n("h1"),b=n("a"),j=n("span"),_(g.$$.fragment),f=d(),$=n("span"),Cs=r("GPT-J"),Wn=d(),de=n("h2"),je=n("a"),Eo=n("span"),_(Ve.$$.fragment),Is=d(),qo=n("span"),Ls=r("Overview"),Un=d(),Z=n("p"),Ss=r("The GPT-J model was released in the "),Ke=n("a"),Ns=r("kingoflolz/mesh-transformer-jax"),Ds=r(` repository by Ben Wang and Aran Komatsuzaki. It is a GPT-2-like
causal language model trained on `),Xe=n("a"),Bs=r("the Pile"),Os=r(" dataset."),Qn=d(),$e=n("p"),Ws=r("This model was contributed by "),Ye=n("a"),Us=r("Stella Biderman"),Qs=r("."),Hn=d(),ro=n("p"),Hs=r("Tips:"),Rn=d(),io=n("ul"),N=n("li"),Rs=r("To load "),Ze=n("a"),Vs=r("GPT-J"),Ks=r(` in float32 one would need at least 2x model size CPU
RAM: 1x for initial weights and another 1x to load the checkpoint. So for GPT-J it would take at least 48GB of CPU
RAM to just load the model. To reduce the CPU RAM usage there are a few options. The `),Ao=n("code"),Xs=r("torch_dtype"),Ys=r(` argument can be
used to initialize the model in half-precision. And the `),Co=n("code"),Zs=r("low_cpu_mem_usage"),ea=r(` argument can be used to keep the RAM
usage to 1x. There is also a `),et=n("a"),ta=r("fp16 branch"),oa=r(` which stores
the fp16 weights, which could be used to further minimize the RAM usage. Combining all this it should take roughly
12.1GB of CPU RAM to load the model.`),Vn=d(),_(tt.$$.fragment),Kn=d(),Ge=n("ul"),Io=n("li"),lo=n("p"),na=r(`The model should fit on 16GB GPU for inference. For training/fine-tuning it would take much more GPU RAM. Adam
optimizer for example makes four copies of the model: model, gradients, average and squared average of the gradients.
So it would need at least 4x model size GPU memory, even with mixed precision as gradient updates are in fp32. This
is not including the activations and data batches, which would again require some more GPU RAM. So one should explore
solutions such as DeepSpeed, to train/fine-tune the model. Another option is to use the original codebase to
train/fine-tune the model on TPU and then convert the model to Transformers format for inference. Instructions for
that could be found `),ot=n("a"),sa=r("here"),aa=d(),Lo=n("li"),R=n("p"),ra=r(`Although the embedding matrix has a size of 50400, only 50257 entries are used by the GPT-2 tokenizer. These extra
tokens are added for the sake of efficiency on TPUs. To avoid the mis-match between embedding matrix size and vocab
size, the tokenizer for `),nt=n("a"),ia=r("GPT-J"),la=r(` contains 143 extra tokens
`),So=n("code"),da=r("<|extratoken_1|>... <|extratoken_143|>"),ca=r(", so the "),No=n("code"),pa=r("vocab_size"),ha=r(" of tokenizer also becomes 50400."),Xn=d(),ce=n("h3"),xe=n("a"),Do=n("span"),_(st.$$.fragment),ua=d(),Bo=n("span"),ma=r("Generation"),Yn=d(),Je=n("p"),fa=r("The "),co=n("a"),ga=r("generate()"),_a=r(` method can be used to generate text using GPT-J
model.`),Zn=d(),_(at.$$.fragment),es=d(),po=n("p"),Ta=r("\u2026or in float16 precision:"),ts=d(),_(rt.$$.fragment),os=d(),pe=n("h2"),Me=n("a"),Oo=n("span"),_(it.$$.fragment),va=d(),Wo=n("span"),Pa=r("GPTJConfig"),ns=d(),D=n("div"),_(lt.$$.fragment),ka=d(),B=n("p"),wa=r("This is the configuration class to store the configuration of a "),ho=n("a"),ba=r("GPTJModel"),ya=r(`. It is used to instantiate a GPT-J
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 GPT-J
`),dt=n("a"),ja=r("gpt-j-6B"),$a=r(` architecture. Configuration objects inherit from
`),uo=n("a"),Ga=r("PretrainedConfig"),xa=r(" and can be used to control the model outputs. Read the documentation from "),mo=n("a"),Ja=r("PretrainedConfig"),Ma=r(`
for more information.`),Fa=d(),Uo=n("p"),za=r("Example:"),Ea=d(),_(ct.$$.fragment),ss=d(),he=n("h2"),Fe=n("a"),Qo=n("span"),_(pt.$$.fragment),qa=d(),Ho=n("span"),Aa=r("GPTJModel"),as=d(),V=n("div"),_(ht.$$.fragment),Ca=d(),ut=n("p"),Ia=r(`The bare GPT-J Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),mt=n("a"),La=r("torch.nn.Module"),Sa=r(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Na=d(),z=n("div"),_(ft.$$.fragment),Da=d(),ue=n("p"),Ba=r("The "),fo=n("a"),Oa=r("GPTJModel"),Wa=r(" forward method, overrides the "),Ro=n("code"),Ua=r("__call__"),Qa=r(" special method."),Ha=d(),_(ze.$$.fragment),Ra=d(),Vo=n("p"),Va=r("Example:"),Ka=d(),_(gt.$$.fragment),rs=d(),me=n("h2"),Ee=n("a"),Ko=n("span"),_(_t.$$.fragment),Xa=d(),Xo=n("span"),Ya=r("GPTJForCausalLM"),is=d(),O=n("div"),_(Tt.$$.fragment),Za=d(),Yo=n("p"),er=r("The GPT-J Model transformer with a language modeling head on top."),tr=d(),vt=n("p"),or=r("This model is a PyTorch "),Pt=n("a"),nr=r("torch.nn.Module"),sr=r(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ar=d(),E=n("div"),_(kt.$$.fragment),rr=d(),fe=n("p"),ir=r("The "),go=n("a"),lr=r("GPTJForCausalLM"),dr=r(" forward method, overrides the "),Zo=n("code"),cr=r("__call__"),pr=r(" special method."),hr=d(),_(qe.$$.fragment),ur=d(),en=n("p"),mr=r("Example:"),fr=d(),_(wt.$$.fragment),ls=d(),ge=n("h2"),Ae=n("a"),tn=n("span"),_(bt.$$.fragment),gr=d(),on=n("span"),_r=r("GPTJForSequenceClassification"),ds=d(),M=n("div"),_(yt.$$.fragment),Tr=d(),nn=n("p"),vr=r("The GPT-J Model transformer with a sequence classification head on top (linear layer)."),Pr=d(),_o=n("p"),To=n("a"),kr=r("GPTJForSequenceClassification"),wr=r(` uses the last token in order to do the classification, as other causal models
(e.g. GPT, GPT-2, GPT-Neo) do.`),br=d(),W=n("p"),yr=r(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),sn=n("code"),jr=r("pad_token_id"),$r=r(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),an=n("code"),Gr=r("pad_token_id"),xr=r(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),rn=n("code"),Jr=r("inputs_embeds"),Mr=r(" are passed instead of "),ln=n("code"),Fr=r("input_ids"),zr=r(`, it does the same (take the last value in
each row of the batch).`),Er=d(),jt=n("p"),qr=r("This model is a PyTorch "),$t=n("a"),Ar=r("torch.nn.Module"),Cr=r(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ir=d(),J=n("div"),_(Gt.$$.fragment),Lr=d(),_e=n("p"),Sr=r("The "),vo=n("a"),Nr=r("GPTJForSequenceClassification"),Dr=r(" forward method, overrides the "),dn=n("code"),Br=r("__call__"),Or=r(" special method."),Wr=d(),_(Ce.$$.fragment),Ur=d(),cn=n("p"),Qr=r("Example of single-label classification:"),Hr=d(),_(xt.$$.fragment),Rr=d(),pn=n("p"),Vr=r("Example of multi-label classification:"),Kr=d(),_(Jt.$$.fragment),cs=d(),Te=n("h2"),Ie=n("a"),hn=n("span"),_(Mt.$$.fragment),Xr=d(),un=n("span"),Yr=r("GPTJForQuestionAnswering"),ps=d(),U=n("div"),_(Ft.$$.fragment),Zr=d(),ve=n("p"),ei=r(`The GPT-J Model transformer with a span classification head on top for extractive question-answering tasks like
SQuAD (a linear layers on top of the hidden-states output to compute `),mn=n("code"),ti=r("span start logits"),oi=r(" and "),fn=n("code"),ni=r("span end logits"),si=r(")."),ai=d(),zt=n("p"),ri=r("This model is a PyTorch "),Et=n("a"),ii=r("torch.nn.Module"),li=r(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),di=d(),q=n("div"),_(qt.$$.fragment),ci=d(),Pe=n("p"),pi=r("The "),Po=n("a"),hi=r("GPTJForQuestionAnswering"),ui=r(" forward method, overrides the "),gn=n("code"),mi=r("__call__"),fi=r(" special method."),gi=d(),_(Le.$$.fragment),_i=d(),_n=n("p"),Ti=r("Example:"),vi=d(),_(At.$$.fragment),hs=d(),ke=n("h2"),Se=n("a"),Tn=n("span"),_(Ct.$$.fragment),Pi=d(),vn=n("span"),ki=r("FlaxGPTJModel"),us=d(),G=n("div"),_(It.$$.fragment),wi=d(),Pn=n("p"),bi=r("The bare GPTJ Model transformer outputting raw hidden-states without any specific head on top."),yi=d(),Lt=n("p"),ji=r("This model inherits from "),ko=n("a"),$i=r("FlaxPreTrainedModel"),Gi=r(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),xi=d(),St=n("p"),Ji=r(`This model is also a Flax Linen
`),Nt=n("a"),Mi=r("flax.nn.Module"),Fi=r(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),zi=d(),kn=n("p"),Ei=r("Finally, this model supports inherent JAX features such as:"),qi=d(),K=n("ul"),wn=n("li"),Dt=n("a"),Ai=r("Just-In-Time (JIT) compilation"),Ci=d(),bn=n("li"),Bt=n("a"),Ii=r("Automatic Differentiation"),Li=d(),yn=n("li"),Ot=n("a"),Si=r("Vectorization"),Ni=d(),jn=n("li"),Wt=n("a"),Di=r("Parallelization"),Bi=d(),A=n("div"),_(Ut.$$.fragment),Oi=d(),we=n("p"),Wi=r("The "),$n=n("code"),Ui=r("FlaxGPTJPreTrainedModel"),Qi=r("forward method, overrides the "),Gn=n("code"),Hi=r("__call__"),Ri=r(" special method."),Vi=d(),_(Ne.$$.fragment),Ki=d(),xn=n("p"),Xi=r("Example:"),Yi=d(),_(Qt.$$.fragment),ms=d(),be=n("h2"),De=n("a"),Jn=n("span"),_(Ht.$$.fragment),Zi=d(),Mn=n("span"),el=r("FlaxGPTJForCausalLM"),fs=d(),x=n("div"),_(Rt.$$.fragment),tl=d(),Fn=n("p"),ol=r("The GPTJ Model transformer with a language modeling head on top."),nl=d(),Vt=n("p"),sl=r("This model inherits from "),wo=n("a"),al=r("FlaxPreTrainedModel"),rl=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.)`),il=d(),Kt=n("p"),ll=r(`This model is also a Flax Linen
`),Xt=n("a"),dl=r("flax.nn.Module"),cl=r(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),pl=d(),zn=n("p"),hl=r("Finally, this model supports inherent JAX features such as:"),ul=d(),X=n("ul"),En=n("li"),Yt=n("a"),ml=r("Just-In-Time (JIT) compilation"),fl=d(),qn=n("li"),Zt=n("a"),gl=r("Automatic Differentiation"),_l=d(),An=n("li"),eo=n("a"),Tl=r("Vectorization"),vl=d(),Cn=n("li"),to=n("a"),Pl=r("Parallelization"),kl=d(),C=n("div"),_(oo.$$.fragment),wl=d(),ye=n("p"),bl=r("The "),In=n("code"),yl=r("FlaxGPTJPreTrainedModel"),jl=r("forward method, overrides the "),Ln=n("code"),$l=r("__call__"),Gl=r(" special method."),xl=d(),_(Be.$$.fragment),Jl=d(),Sn=n("p"),Ml=r("Example:"),Fl=d(),_(no.$$.fragment),this.h()},l(t){const p=Ec('[data-svelte="svelte-1phssyn"]',document.head);h=s(p,"META",{name:!0,content:!0}),p.forEach(o),y=c(t),m=s(t,"H1",{class:!0});var so=a(m);b=s(so,"A",{id:!0,class:!0,href:!0});var Nn=a(b);j=s(Nn,"SPAN",{});var Dn=a(j);T(g.$$.fragment,Dn),Dn.forEach(o),Nn.forEach(o),f=c(so),$=s(so,"SPAN",{});var Bn=a($);Cs=i(Bn,"GPT-J"),Bn.forEach(o),so.forEach(o),Wn=c(t),de=s(t,"H2",{class:!0});var ao=a(de);je=s(ao,"A",{id:!0,class:!0,href:!0});var On=a(je);Eo=s(On,"SPAN",{});var ql=a(Eo);T(Ve.$$.fragment,ql),ql.forEach(o),On.forEach(o),Is=c(ao),qo=s(ao,"SPAN",{});var Al=a(qo);Ls=i(Al,"Overview"),Al.forEach(o),ao.forEach(o),Un=c(t),Z=s(t,"P",{});var bo=a(Z);Ss=i(bo,"The GPT-J model was released in the "),Ke=s(bo,"A",{href:!0,rel:!0});var Cl=a(Ke);Ns=i(Cl,"kingoflolz/mesh-transformer-jax"),Cl.forEach(o),Ds=i(bo,` repository by Ben Wang and Aran Komatsuzaki. It is a GPT-2-like
causal language model trained on `),Xe=s(bo,"A",{href:!0,rel:!0});var Il=a(Xe);Bs=i(Il,"the Pile"),Il.forEach(o),Os=i(bo," dataset."),bo.forEach(o),Qn=c(t),$e=s(t,"P",{});var _s=a($e);Ws=i(_s,"This model was contributed by "),Ye=s(_s,"A",{href:!0,rel:!0});var Ll=a(Ye);Us=i(Ll,"Stella Biderman"),Ll.forEach(o),Qs=i(_s,"."),_s.forEach(o),Hn=c(t),ro=s(t,"P",{});var Sl=a(ro);Hs=i(Sl,"Tips:"),Sl.forEach(o),Rn=c(t),io=s(t,"UL",{});var Nl=a(io);N=s(Nl,"LI",{});var ee=a(N);Rs=i(ee,"To load "),Ze=s(ee,"A",{href:!0,rel:!0});var Dl=a(Ze);Vs=i(Dl,"GPT-J"),Dl.forEach(o),Ks=i(ee,` in float32 one would need at least 2x model size CPU
RAM: 1x for initial weights and another 1x to load the checkpoint. So for GPT-J it would take at least 48GB of CPU
RAM to just load the model. To reduce the CPU RAM usage there are a few options. The `),Ao=s(ee,"CODE",{});var Bl=a(Ao);Xs=i(Bl,"torch_dtype"),Bl.forEach(o),Ys=i(ee,` argument can be
used to initialize the model in half-precision. And the `),Co=s(ee,"CODE",{});var Ol=a(Co);Zs=i(Ol,"low_cpu_mem_usage"),Ol.forEach(o),ea=i(ee,` argument can be used to keep the RAM
usage to 1x. There is also a `),et=s(ee,"A",{href:!0,rel:!0});var Wl=a(et);ta=i(Wl,"fp16 branch"),Wl.forEach(o),oa=i(ee,` which stores
the fp16 weights, which could be used to further minimize the RAM usage. Combining all this it should take roughly
12.1GB of CPU RAM to load the model.`),ee.forEach(o),Nl.forEach(o),Vn=c(t),T(tt.$$.fragment,t),Kn=c(t),Ge=s(t,"UL",{});var Ts=a(Ge);Io=s(Ts,"LI",{});var Ul=a(Io);lo=s(Ul,"P",{});var zl=a(lo);na=i(zl,`The model should fit on 16GB GPU for inference. For training/fine-tuning it would take much more GPU RAM. Adam
optimizer for example makes four copies of the model: model, gradients, average and squared average of the gradients.
So it would need at least 4x model size GPU memory, even with mixed precision as gradient updates are in fp32. This
is not including the activations and data batches, which would again require some more GPU RAM. So one should explore
solutions such as DeepSpeed, to train/fine-tune the model. Another option is to use the original codebase to
train/fine-tune the model on TPU and then convert the model to Transformers format for inference. Instructions for
that could be found `),ot=s(zl,"A",{href:!0,rel:!0});var Ql=a(ot);sa=i(Ql,"here"),Ql.forEach(o),zl.forEach(o),Ul.forEach(o),aa=c(Ts),Lo=s(Ts,"LI",{});var Hl=a(Lo);R=s(Hl,"P",{});var Oe=a(R);ra=i(Oe,`Although the embedding matrix has a size of 50400, only 50257 entries are used by the GPT-2 tokenizer. These extra
tokens are added for the sake of efficiency on TPUs. To avoid the mis-match between embedding matrix size and vocab
size, the tokenizer for `),nt=s(Oe,"A",{href:!0,rel:!0});var Rl=a(nt);ia=i(Rl,"GPT-J"),Rl.forEach(o),la=i(Oe,` contains 143 extra tokens
`),So=s(Oe,"CODE",{});var Vl=a(So);da=i(Vl,"<|extratoken_1|>... <|extratoken_143|>"),Vl.forEach(o),ca=i(Oe,", so the "),No=s(Oe,"CODE",{});var Kl=a(No);pa=i(Kl,"vocab_size"),Kl.forEach(o),ha=i(Oe," of tokenizer also becomes 50400."),Oe.forEach(o),Hl.forEach(o),Ts.forEach(o),Xn=c(t),ce=s(t,"H3",{class:!0});var vs=a(ce);xe=s(vs,"A",{id:!0,class:!0,href:!0});var Xl=a(xe);Do=s(Xl,"SPAN",{});var Yl=a(Do);T(st.$$.fragment,Yl),Yl.forEach(o),Xl.forEach(o),ua=c(vs),Bo=s(vs,"SPAN",{});var Zl=a(Bo);ma=i(Zl,"Generation"),Zl.forEach(o),vs.forEach(o),Yn=c(t),Je=s(t,"P",{});var Ps=a(Je);fa=i(Ps,"The "),co=s(Ps,"A",{href:!0});var ed=a(co);ga=i(ed,"generate()"),ed.forEach(o),_a=i(Ps,` method can be used to generate text using GPT-J
model.`),Ps.forEach(o),Zn=c(t),T(at.$$.fragment,t),es=c(t),po=s(t,"P",{});var td=a(po);Ta=i(td,"\u2026or in float16 precision:"),td.forEach(o),ts=c(t),T(rt.$$.fragment,t),os=c(t),pe=s(t,"H2",{class:!0});var ks=a(pe);Me=s(ks,"A",{id:!0,class:!0,href:!0});var od=a(Me);Oo=s(od,"SPAN",{});var nd=a(Oo);T(it.$$.fragment,nd),nd.forEach(o),od.forEach(o),va=c(ks),Wo=s(ks,"SPAN",{});var sd=a(Wo);Pa=i(sd,"GPTJConfig"),sd.forEach(o),ks.forEach(o),ns=c(t),D=s(t,"DIV",{class:!0});var We=a(D);T(lt.$$.fragment,We),ka=c(We),B=s(We,"P",{});var te=a(B);wa=i(te,"This is the configuration class to store the configuration of a "),ho=s(te,"A",{href:!0});var ad=a(ho);ba=i(ad,"GPTJModel"),ad.forEach(o),ya=i(te,`. It is used to instantiate a GPT-J
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 GPT-J
`),dt=s(te,"A",{href:!0,rel:!0});var rd=a(dt);ja=i(rd,"gpt-j-6B"),rd.forEach(o),$a=i(te,` architecture. Configuration objects inherit from
`),uo=s(te,"A",{href:!0});var id=a(uo);Ga=i(id,"PretrainedConfig"),id.forEach(o),xa=i(te," and can be used to control the model outputs. Read the documentation from "),mo=s(te,"A",{href:!0});var ld=a(mo);Ja=i(ld,"PretrainedConfig"),ld.forEach(o),Ma=i(te,`
for more information.`),te.forEach(o),Fa=c(We),Uo=s(We,"P",{});var dd=a(Uo);za=i(dd,"Example:"),dd.forEach(o),Ea=c(We),T(ct.$$.fragment,We),We.forEach(o),ss=c(t),he=s(t,"H2",{class:!0});var ws=a(he);Fe=s(ws,"A",{id:!0,class:!0,href:!0});var cd=a(Fe);Qo=s(cd,"SPAN",{});var pd=a(Qo);T(pt.$$.fragment,pd),pd.forEach(o),cd.forEach(o),qa=c(ws),Ho=s(ws,"SPAN",{});var hd=a(Ho);Aa=i(hd,"GPTJModel"),hd.forEach(o),ws.forEach(o),as=c(t),V=s(t,"DIV",{class:!0});var yo=a(V);T(ht.$$.fragment,yo),Ca=c(yo),ut=s(yo,"P",{});var bs=a(ut);Ia=i(bs,`The bare GPT-J Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),mt=s(bs,"A",{href:!0,rel:!0});var ud=a(mt);La=i(ud,"torch.nn.Module"),ud.forEach(o),Sa=i(bs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),bs.forEach(o),Na=c(yo),z=s(yo,"DIV",{class:!0});var oe=a(z);T(ft.$$.fragment,oe),Da=c(oe),ue=s(oe,"P",{});var jo=a(ue);Ba=i(jo,"The "),fo=s(jo,"A",{href:!0});var md=a(fo);Oa=i(md,"GPTJModel"),md.forEach(o),Wa=i(jo," forward method, overrides the "),Ro=s(jo,"CODE",{});var fd=a(Ro);Ua=i(fd,"__call__"),fd.forEach(o),Qa=i(jo," special method."),jo.forEach(o),Ha=c(oe),T(ze.$$.fragment,oe),Ra=c(oe),Vo=s(oe,"P",{});var gd=a(Vo);Va=i(gd,"Example:"),gd.forEach(o),Ka=c(oe),T(gt.$$.fragment,oe),oe.forEach(o),yo.forEach(o),rs=c(t),me=s(t,"H2",{class:!0});var ys=a(me);Ee=s(ys,"A",{id:!0,class:!0,href:!0});var _d=a(Ee);Ko=s(_d,"SPAN",{});var Td=a(Ko);T(_t.$$.fragment,Td),Td.forEach(o),_d.forEach(o),Xa=c(ys),Xo=s(ys,"SPAN",{});var vd=a(Xo);Ya=i(vd,"GPTJForCausalLM"),vd.forEach(o),ys.forEach(o),is=c(t),O=s(t,"DIV",{class:!0});var Ue=a(O);T(Tt.$$.fragment,Ue),Za=c(Ue),Yo=s(Ue,"P",{});var Pd=a(Yo);er=i(Pd,"The GPT-J Model transformer with a language modeling head on top."),Pd.forEach(o),tr=c(Ue),vt=s(Ue,"P",{});var js=a(vt);or=i(js,"This model is a PyTorch "),Pt=s(js,"A",{href:!0,rel:!0});var kd=a(Pt);nr=i(kd,"torch.nn.Module"),kd.forEach(o),sr=i(js,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),js.forEach(o),ar=c(Ue),E=s(Ue,"DIV",{class:!0});var ne=a(E);T(kt.$$.fragment,ne),rr=c(ne),fe=s(ne,"P",{});var $o=a(fe);ir=i($o,"The "),go=s($o,"A",{href:!0});var wd=a(go);lr=i(wd,"GPTJForCausalLM"),wd.forEach(o),dr=i($o," forward method, overrides the "),Zo=s($o,"CODE",{});var bd=a(Zo);cr=i(bd,"__call__"),bd.forEach(o),pr=i($o," special method."),$o.forEach(o),hr=c(ne),T(qe.$$.fragment,ne),ur=c(ne),en=s(ne,"P",{});var yd=a(en);mr=i(yd,"Example:"),yd.forEach(o),fr=c(ne),T(wt.$$.fragment,ne),ne.forEach(o),Ue.forEach(o),ls=c(t),ge=s(t,"H2",{class:!0});var $s=a(ge);Ae=s($s,"A",{id:!0,class:!0,href:!0});var jd=a(Ae);tn=s(jd,"SPAN",{});var $d=a(tn);T(bt.$$.fragment,$d),$d.forEach(o),jd.forEach(o),gr=c($s),on=s($s,"SPAN",{});var Gd=a(on);_r=i(Gd,"GPTJForSequenceClassification"),Gd.forEach(o),$s.forEach(o),ds=c(t),M=s(t,"DIV",{class:!0});var H=a(M);T(yt.$$.fragment,H),Tr=c(H),nn=s(H,"P",{});var xd=a(nn);vr=i(xd,"The GPT-J Model transformer with a sequence classification head on top (linear layer)."),xd.forEach(o),Pr=c(H),_o=s(H,"P",{});var El=a(_o);To=s(El,"A",{href:!0});var Jd=a(To);kr=i(Jd,"GPTJForSequenceClassification"),Jd.forEach(o),wr=i(El,` uses the last token in order to do the classification, as other causal models
(e.g. GPT, GPT-2, GPT-Neo) do.`),El.forEach(o),br=c(H),W=s(H,"P",{});var se=a(W);yr=i(se,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),sn=s(se,"CODE",{});var Md=a(sn);jr=i(Md,"pad_token_id"),Md.forEach(o),$r=i(se,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),an=s(se,"CODE",{});var Fd=a(an);Gr=i(Fd,"pad_token_id"),Fd.forEach(o),xr=i(se,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),rn=s(se,"CODE",{});var zd=a(rn);Jr=i(zd,"inputs_embeds"),zd.forEach(o),Mr=i(se," are passed instead of "),ln=s(se,"CODE",{});var Ed=a(ln);Fr=i(Ed,"input_ids"),Ed.forEach(o),zr=i(se,`, it does the same (take the last value in
each row of the batch).`),se.forEach(o),Er=c(H),jt=s(H,"P",{});var Gs=a(jt);qr=i(Gs,"This model is a PyTorch "),$t=s(Gs,"A",{href:!0,rel:!0});var qd=a($t);Ar=i(qd,"torch.nn.Module"),qd.forEach(o),Cr=i(Gs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Gs.forEach(o),Ir=c(H),J=s(H,"DIV",{class:!0});var I=a(J);T(Gt.$$.fragment,I),Lr=c(I),_e=s(I,"P",{});var Go=a(_e);Sr=i(Go,"The "),vo=s(Go,"A",{href:!0});var Ad=a(vo);Nr=i(Ad,"GPTJForSequenceClassification"),Ad.forEach(o),Dr=i(Go," forward method, overrides the "),dn=s(Go,"CODE",{});var Cd=a(dn);Br=i(Cd,"__call__"),Cd.forEach(o),Or=i(Go," special method."),Go.forEach(o),Wr=c(I),T(Ce.$$.fragment,I),Ur=c(I),cn=s(I,"P",{});var Id=a(cn);Qr=i(Id,"Example of single-label classification:"),Id.forEach(o),Hr=c(I),T(xt.$$.fragment,I),Rr=c(I),pn=s(I,"P",{});var Ld=a(pn);Vr=i(Ld,"Example of multi-label classification:"),Ld.forEach(o),Kr=c(I),T(Jt.$$.fragment,I),I.forEach(o),H.forEach(o),cs=c(t),Te=s(t,"H2",{class:!0});var xs=a(Te);Ie=s(xs,"A",{id:!0,class:!0,href:!0});var Sd=a(Ie);hn=s(Sd,"SPAN",{});var Nd=a(hn);T(Mt.$$.fragment,Nd),Nd.forEach(o),Sd.forEach(o),Xr=c(xs),un=s(xs,"SPAN",{});var Dd=a(un);Yr=i(Dd,"GPTJForQuestionAnswering"),Dd.forEach(o),xs.forEach(o),ps=c(t),U=s(t,"DIV",{class:!0});var Qe=a(U);T(Ft.$$.fragment,Qe),Zr=c(Qe),ve=s(Qe,"P",{});var xo=a(ve);ei=i(xo,`The GPT-J Model transformer with a span classification head on top for extractive question-answering tasks like
SQuAD (a linear layers on top of the hidden-states output to compute `),mn=s(xo,"CODE",{});var Bd=a(mn);ti=i(Bd,"span start logits"),Bd.forEach(o),oi=i(xo," and "),fn=s(xo,"CODE",{});var Od=a(fn);ni=i(Od,"span end logits"),Od.forEach(o),si=i(xo,")."),xo.forEach(o),ai=c(Qe),zt=s(Qe,"P",{});var Js=a(zt);ri=i(Js,"This model is a PyTorch "),Et=s(Js,"A",{href:!0,rel:!0});var Wd=a(Et);ii=i(Wd,"torch.nn.Module"),Wd.forEach(o),li=i(Js,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Js.forEach(o),di=c(Qe),q=s(Qe,"DIV",{class:!0});var ae=a(q);T(qt.$$.fragment,ae),ci=c(ae),Pe=s(ae,"P",{});var Jo=a(Pe);pi=i(Jo,"The "),Po=s(Jo,"A",{href:!0});var Ud=a(Po);hi=i(Ud,"GPTJForQuestionAnswering"),Ud.forEach(o),ui=i(Jo," forward method, overrides the "),gn=s(Jo,"CODE",{});var Qd=a(gn);mi=i(Qd,"__call__"),Qd.forEach(o),fi=i(Jo," special method."),Jo.forEach(o),gi=c(ae),T(Le.$$.fragment,ae),_i=c(ae),_n=s(ae,"P",{});var Hd=a(_n);Ti=i(Hd,"Example:"),Hd.forEach(o),vi=c(ae),T(At.$$.fragment,ae),ae.forEach(o),Qe.forEach(o),hs=c(t),ke=s(t,"H2",{class:!0});var Ms=a(ke);Se=s(Ms,"A",{id:!0,class:!0,href:!0});var Rd=a(Se);Tn=s(Rd,"SPAN",{});var Vd=a(Tn);T(Ct.$$.fragment,Vd),Vd.forEach(o),Rd.forEach(o),Pi=c(Ms),vn=s(Ms,"SPAN",{});var Kd=a(vn);ki=i(Kd,"FlaxGPTJModel"),Kd.forEach(o),Ms.forEach(o),us=c(t),G=s(t,"DIV",{class:!0});var L=a(G);T(It.$$.fragment,L),wi=c(L),Pn=s(L,"P",{});var Xd=a(Pn);bi=i(Xd,"The bare GPTJ Model transformer outputting raw hidden-states without any specific head on top."),Xd.forEach(o),yi=c(L),Lt=s(L,"P",{});var Fs=a(Lt);ji=i(Fs,"This model inherits from "),ko=s(Fs,"A",{href:!0});var Yd=a(ko);$i=i(Yd,"FlaxPreTrainedModel"),Yd.forEach(o),Gi=i(Fs,`. 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.)`),Fs.forEach(o),xi=c(L),St=s(L,"P",{});var zs=a(St);Ji=i(zs,`This model is also a Flax Linen
`),Nt=s(zs,"A",{href:!0,rel:!0});var Zd=a(Nt);Mi=i(Zd,"flax.nn.Module"),Zd.forEach(o),Fi=i(zs,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),zs.forEach(o),zi=c(L),kn=s(L,"P",{});var ec=a(kn);Ei=i(ec,"Finally, this model supports inherent JAX features such as:"),ec.forEach(o),qi=c(L),K=s(L,"UL",{});var He=a(K);wn=s(He,"LI",{});var tc=a(wn);Dt=s(tc,"A",{href:!0,rel:!0});var oc=a(Dt);Ai=i(oc,"Just-In-Time (JIT) compilation"),oc.forEach(o),tc.forEach(o),Ci=c(He),bn=s(He,"LI",{});var nc=a(bn);Bt=s(nc,"A",{href:!0,rel:!0});var sc=a(Bt);Ii=i(sc,"Automatic Differentiation"),sc.forEach(o),nc.forEach(o),Li=c(He),yn=s(He,"LI",{});var ac=a(yn);Ot=s(ac,"A",{href:!0,rel:!0});var rc=a(Ot);Si=i(rc,"Vectorization"),rc.forEach(o),ac.forEach(o),Ni=c(He),jn=s(He,"LI",{});var ic=a(jn);Wt=s(ic,"A",{href:!0,rel:!0});var lc=a(Wt);Di=i(lc,"Parallelization"),lc.forEach(o),ic.forEach(o),He.forEach(o),Bi=c(L),A=s(L,"DIV",{class:!0});var re=a(A);T(Ut.$$.fragment,re),Oi=c(re),we=s(re,"P",{});var Mo=a(we);Wi=i(Mo,"The "),$n=s(Mo,"CODE",{});var dc=a($n);Ui=i(dc,"FlaxGPTJPreTrainedModel"),dc.forEach(o),Qi=i(Mo,"forward method, overrides the "),Gn=s(Mo,"CODE",{});var cc=a(Gn);Hi=i(cc,"__call__"),cc.forEach(o),Ri=i(Mo," special method."),Mo.forEach(o),Vi=c(re),T(Ne.$$.fragment,re),Ki=c(re),xn=s(re,"P",{});var pc=a(xn);Xi=i(pc,"Example:"),pc.forEach(o),Yi=c(re),T(Qt.$$.fragment,re),re.forEach(o),L.forEach(o),ms=c(t),be=s(t,"H2",{class:!0});var Es=a(be);De=s(Es,"A",{id:!0,class:!0,href:!0});var hc=a(De);Jn=s(hc,"SPAN",{});var uc=a(Jn);T(Ht.$$.fragment,uc),uc.forEach(o),hc.forEach(o),Zi=c(Es),Mn=s(Es,"SPAN",{});var mc=a(Mn);el=i(mc,"FlaxGPTJForCausalLM"),mc.forEach(o),Es.forEach(o),fs=c(t),x=s(t,"DIV",{class:!0});var S=a(x);T(Rt.$$.fragment,S),tl=c(S),Fn=s(S,"P",{});var fc=a(Fn);ol=i(fc,"The GPTJ Model transformer with a language modeling head on top."),fc.forEach(o),nl=c(S),Vt=s(S,"P",{});var qs=a(Vt);sl=i(qs,"This model inherits from "),wo=s(qs,"A",{href:!0});var gc=a(wo);al=i(gc,"FlaxPreTrainedModel"),gc.forEach(o),rl=i(qs,`. 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.)`),qs.forEach(o),il=c(S),Kt=s(S,"P",{});var As=a(Kt);ll=i(As,`This model is also a Flax Linen
`),Xt=s(As,"A",{href:!0,rel:!0});var _c=a(Xt);dl=i(_c,"flax.nn.Module"),_c.forEach(o),cl=i(As,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),As.forEach(o),pl=c(S),zn=s(S,"P",{});var Tc=a(zn);hl=i(Tc,"Finally, this model supports inherent JAX features such as:"),Tc.forEach(o),ul=c(S),X=s(S,"UL",{});var Re=a(X);En=s(Re,"LI",{});var vc=a(En);Yt=s(vc,"A",{href:!0,rel:!0});var Pc=a(Yt);ml=i(Pc,"Just-In-Time (JIT) compilation"),Pc.forEach(o),vc.forEach(o),fl=c(Re),qn=s(Re,"LI",{});var kc=a(qn);Zt=s(kc,"A",{href:!0,rel:!0});var wc=a(Zt);gl=i(wc,"Automatic Differentiation"),wc.forEach(o),kc.forEach(o),_l=c(Re),An=s(Re,"LI",{});var bc=a(An);eo=s(bc,"A",{href:!0,rel:!0});var yc=a(eo);Tl=i(yc,"Vectorization"),yc.forEach(o),bc.forEach(o),vl=c(Re),Cn=s(Re,"LI",{});var jc=a(Cn);to=s(jc,"A",{href:!0,rel:!0});var $c=a(to);Pl=i($c,"Parallelization"),$c.forEach(o),jc.forEach(o),Re.forEach(o),kl=c(S),C=s(S,"DIV",{class:!0});var ie=a(C);T(oo.$$.fragment,ie),wl=c(ie),ye=s(ie,"P",{});var Fo=a(ye);bl=i(Fo,"The "),In=s(Fo,"CODE",{});var Gc=a(In);yl=i(Gc,"FlaxGPTJPreTrainedModel"),Gc.forEach(o),jl=i(Fo,"forward method, overrides the "),Ln=s(Fo,"CODE",{});var xc=a(Ln);$l=i(xc,"__call__"),xc.forEach(o),Gl=i(Fo," special method."),Fo.forEach(o),xl=c(ie),T(Be.$$.fragment,ie),Jl=c(ie),Sn=s(ie,"P",{});var Jc=a(Sn);Ml=i(Jc,"Example:"),Jc.forEach(o),Fl=c(ie),T(no.$$.fragment,ie),ie.forEach(o),S.forEach(o),this.h()},h(){l(h,"name","hf:doc:metadata"),l(h,"content",JSON.stringify(Dc)),l(b,"id","gptj"),l(b,"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"),l(b,"href","#gptj"),l(m,"class","relative group"),l(je,"id","overview"),l(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"),l(je,"href","#overview"),l(de,"class","relative group"),l(Ke,"href","https://github.com/kingoflolz/mesh-transformer-jax"),l(Ke,"rel","nofollow"),l(Xe,"href","https://pile.eleuther.ai/"),l(Xe,"rel","nofollow"),l(Ye,"href","https://huggingface.co/stellaathena"),l(Ye,"rel","nofollow"),l(Ze,"href","https://huggingface.co/EleutherAI/gpt-j-6B"),l(Ze,"rel","nofollow"),l(et,"href","https://huggingface.co/EleutherAI/gpt-j-6B/tree/float16"),l(et,"rel","nofollow"),l(ot,"href","https://github.com/kingoflolz/mesh-transformer-jax/blob/master/howto_finetune.md"),l(ot,"rel","nofollow"),l(nt,"href","https://huggingface.co/EleutherAI/gpt-j-6B"),l(nt,"rel","nofollow"),l(xe,"id","generation"),l(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"),l(xe,"href","#generation"),l(ce,"class","relative group"),l(co,"href","/docs/transformers/pr_15839/en/main_classes/text_generation#transformers.generation_utils.GenerationMixin.generate"),l(Me,"id","transformers.GPTJConfig"),l(Me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Me,"href","#transformers.GPTJConfig"),l(pe,"class","relative group"),l(ho,"href","/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJModel"),l(dt,"href","https://huggingface.co/EleutherAI/gpt-j-6B"),l(dt,"rel","nofollow"),l(uo,"href","/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig"),l(mo,"href","/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig"),l(D,"class","docstring"),l(Fe,"id","transformers.GPTJModel"),l(Fe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Fe,"href","#transformers.GPTJModel"),l(he,"class","relative group"),l(mt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(mt,"rel","nofollow"),l(fo,"href","/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJModel"),l(z,"class","docstring"),l(V,"class","docstring"),l(Ee,"id","transformers.GPTJForCausalLM"),l(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"),l(Ee,"href","#transformers.GPTJForCausalLM"),l(me,"class","relative group"),l(Pt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Pt,"rel","nofollow"),l(go,"href","/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJForCausalLM"),l(E,"class","docstring"),l(O,"class","docstring"),l(Ae,"id","transformers.GPTJForSequenceClassification"),l(Ae,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Ae,"href","#transformers.GPTJForSequenceClassification"),l(ge,"class","relative group"),l(To,"href","/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJForSequenceClassification"),l($t,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l($t,"rel","nofollow"),l(vo,"href","/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJForSequenceClassification"),l(J,"class","docstring"),l(M,"class","docstring"),l(Ie,"id","transformers.GPTJForQuestionAnswering"),l(Ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Ie,"href","#transformers.GPTJForQuestionAnswering"),l(Te,"class","relative group"),l(Et,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Et,"rel","nofollow"),l(Po,"href","/docs/transformers/pr_15839/en/model_doc/gptj#transformers.GPTJForQuestionAnswering"),l(q,"class","docstring"),l(U,"class","docstring"),l(Se,"id","transformers.FlaxGPTJModel"),l(Se,"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"),l(Se,"href","#transformers.FlaxGPTJModel"),l(ke,"class","relative group"),l(ko,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel"),l(Nt,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),l(Nt,"rel","nofollow"),l(Dt,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),l(Dt,"rel","nofollow"),l(Bt,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),l(Bt,"rel","nofollow"),l(Ot,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),l(Ot,"rel","nofollow"),l(Wt,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),l(Wt,"rel","nofollow"),l(A,"class","docstring"),l(G,"class","docstring"),l(De,"id","transformers.FlaxGPTJForCausalLM"),l(De,"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"),l(De,"href","#transformers.FlaxGPTJForCausalLM"),l(be,"class","relative group"),l(wo,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.FlaxPreTrainedModel"),l(Xt,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),l(Xt,"rel","nofollow"),l(Yt,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),l(Yt,"rel","nofollow"),l(Zt,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),l(Zt,"rel","nofollow"),l(eo,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),l(eo,"rel","nofollow"),l(to,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),l(to,"rel","nofollow"),l(C,"class","docstring"),l(x,"class","docstring")},m(t,p){e(document.head,h),u(t,y,p),u(t,m,p),e(m,b),e(b,j),v(g,j,null),e(m,f),e(m,$),e($,Cs),u(t,Wn,p),u(t,de,p),e(de,je),e(je,Eo),v(Ve,Eo,null),e(de,Is),e(de,qo),e(qo,Ls),u(t,Un,p),u(t,Z,p),e(Z,Ss),e(Z,Ke),e(Ke,Ns),e(Z,Ds),e(Z,Xe),e(Xe,Bs),e(Z,Os),u(t,Qn,p),u(t,$e,p),e($e,Ws),e($e,Ye),e(Ye,Us),e($e,Qs),u(t,Hn,p),u(t,ro,p),e(ro,Hs),u(t,Rn,p),u(t,io,p),e(io,N),e(N,Rs),e(N,Ze),e(Ze,Vs),e(N,Ks),e(N,Ao),e(Ao,Xs),e(N,Ys),e(N,Co),e(Co,Zs),e(N,ea),e(N,et),e(et,ta),e(N,oa),u(t,Vn,p),v(tt,t,p),u(t,Kn,p),u(t,Ge,p),e(Ge,Io),e(Io,lo),e(lo,na),e(lo,ot),e(ot,sa),e(Ge,aa),e(Ge,Lo),e(Lo,R),e(R,ra),e(R,nt),e(nt,ia),e(R,la),e(R,So),e(So,da),e(R,ca),e(R,No),e(No,pa),e(R,ha),u(t,Xn,p),u(t,ce,p),e(ce,xe),e(xe,Do),v(st,Do,null),e(ce,ua),e(ce,Bo),e(Bo,ma),u(t,Yn,p),u(t,Je,p),e(Je,fa),e(Je,co),e(co,ga),e(Je,_a),u(t,Zn,p),v(at,t,p),u(t,es,p),u(t,po,p),e(po,Ta),u(t,ts,p),v(rt,t,p),u(t,os,p),u(t,pe,p),e(pe,Me),e(Me,Oo),v(it,Oo,null),e(pe,va),e(pe,Wo),e(Wo,Pa),u(t,ns,p),u(t,D,p),v(lt,D,null),e(D,ka),e(D,B),e(B,wa),e(B,ho),e(ho,ba),e(B,ya),e(B,dt),e(dt,ja),e(B,$a),e(B,uo),e(uo,Ga),e(B,xa),e(B,mo),e(mo,Ja),e(B,Ma),e(D,Fa),e(D,Uo),e(Uo,za),e(D,Ea),v(ct,D,null),u(t,ss,p),u(t,he,p),e(he,Fe),e(Fe,Qo),v(pt,Qo,null),e(he,qa),e(he,Ho),e(Ho,Aa),u(t,as,p),u(t,V,p),v(ht,V,null),e(V,Ca),e(V,ut),e(ut,Ia),e(ut,mt),e(mt,La),e(ut,Sa),e(V,Na),e(V,z),v(ft,z,null),e(z,Da),e(z,ue),e(ue,Ba),e(ue,fo),e(fo,Oa),e(ue,Wa),e(ue,Ro),e(Ro,Ua),e(ue,Qa),e(z,Ha),v(ze,z,null),e(z,Ra),e(z,Vo),e(Vo,Va),e(z,Ka),v(gt,z,null),u(t,rs,p),u(t,me,p),e(me,Ee),e(Ee,Ko),v(_t,Ko,null),e(me,Xa),e(me,Xo),e(Xo,Ya),u(t,is,p),u(t,O,p),v(Tt,O,null),e(O,Za),e(O,Yo),e(Yo,er),e(O,tr),e(O,vt),e(vt,or),e(vt,Pt),e(Pt,nr),e(vt,sr),e(O,ar),e(O,E),v(kt,E,null),e(E,rr),e(E,fe),e(fe,ir),e(fe,go),e(go,lr),e(fe,dr),e(fe,Zo),e(Zo,cr),e(fe,pr),e(E,hr),v(qe,E,null),e(E,ur),e(E,en),e(en,mr),e(E,fr),v(wt,E,null),u(t,ls,p),u(t,ge,p),e(ge,Ae),e(Ae,tn),v(bt,tn,null),e(ge,gr),e(ge,on),e(on,_r),u(t,ds,p),u(t,M,p),v(yt,M,null),e(M,Tr),e(M,nn),e(nn,vr),e(M,Pr),e(M,_o),e(_o,To),e(To,kr),e(_o,wr),e(M,br),e(M,W),e(W,yr),e(W,sn),e(sn,jr),e(W,$r),e(W,an),e(an,Gr),e(W,xr),e(W,rn),e(rn,Jr),e(W,Mr),e(W,ln),e(ln,Fr),e(W,zr),e(M,Er),e(M,jt),e(jt,qr),e(jt,$t),e($t,Ar),e(jt,Cr),e(M,Ir),e(M,J),v(Gt,J,null),e(J,Lr),e(J,_e),e(_e,Sr),e(_e,vo),e(vo,Nr),e(_e,Dr),e(_e,dn),e(dn,Br),e(_e,Or),e(J,Wr),v(Ce,J,null),e(J,Ur),e(J,cn),e(cn,Qr),e(J,Hr),v(xt,J,null),e(J,Rr),e(J,pn),e(pn,Vr),e(J,Kr),v(Jt,J,null),u(t,cs,p),u(t,Te,p),e(Te,Ie),e(Ie,hn),v(Mt,hn,null),e(Te,Xr),e(Te,un),e(un,Yr),u(t,ps,p),u(t,U,p),v(Ft,U,null),e(U,Zr),e(U,ve),e(ve,ei),e(ve,mn),e(mn,ti),e(ve,oi),e(ve,fn),e(fn,ni),e(ve,si),e(U,ai),e(U,zt),e(zt,ri),e(zt,Et),e(Et,ii),e(zt,li),e(U,di),e(U,q),v(qt,q,null),e(q,ci),e(q,Pe),e(Pe,pi),e(Pe,Po),e(Po,hi),e(Pe,ui),e(Pe,gn),e(gn,mi),e(Pe,fi),e(q,gi),v(Le,q,null),e(q,_i),e(q,_n),e(_n,Ti),e(q,vi),v(At,q,null),u(t,hs,p),u(t,ke,p),e(ke,Se),e(Se,Tn),v(Ct,Tn,null),e(ke,Pi),e(ke,vn),e(vn,ki),u(t,us,p),u(t,G,p),v(It,G,null),e(G,wi),e(G,Pn),e(Pn,bi),e(G,yi),e(G,Lt),e(Lt,ji),e(Lt,ko),e(ko,$i),e(Lt,Gi),e(G,xi),e(G,St),e(St,Ji),e(St,Nt),e(Nt,Mi),e(St,Fi),e(G,zi),e(G,kn),e(kn,Ei),e(G,qi),e(G,K),e(K,wn),e(wn,Dt),e(Dt,Ai),e(K,Ci),e(K,bn),e(bn,Bt),e(Bt,Ii),e(K,Li),e(K,yn),e(yn,Ot),e(Ot,Si),e(K,Ni),e(K,jn),e(jn,Wt),e(Wt,Di),e(G,Bi),e(G,A),v(Ut,A,null),e(A,Oi),e(A,we),e(we,Wi),e(we,$n),e($n,Ui),e(we,Qi),e(we,Gn),e(Gn,Hi),e(we,Ri),e(A,Vi),v(Ne,A,null),e(A,Ki),e(A,xn),e(xn,Xi),e(A,Yi),v(Qt,A,null),u(t,ms,p),u(t,be,p),e(be,De),e(De,Jn),v(Ht,Jn,null),e(be,Zi),e(be,Mn),e(Mn,el),u(t,fs,p),u(t,x,p),v(Rt,x,null),e(x,tl),e(x,Fn),e(Fn,ol),e(x,nl),e(x,Vt),e(Vt,sl),e(Vt,wo),e(wo,al),e(Vt,rl),e(x,il),e(x,Kt),e(Kt,ll),e(Kt,Xt),e(Xt,dl),e(Kt,cl),e(x,pl),e(x,zn),e(zn,hl),e(x,ul),e(x,X),e(X,En),e(En,Yt),e(Yt,ml),e(X,fl),e(X,qn),e(qn,Zt),e(Zt,gl),e(X,_l),e(X,An),e(An,eo),e(eo,Tl),e(X,vl),e(X,Cn),e(Cn,to),e(to,Pl),e(x,kl),e(x,C),v(oo,C,null),e(C,wl),e(C,ye),e(ye,bl),e(ye,In),e(In,yl),e(ye,jl),e(ye,Ln),e(Ln,$l),e(ye,Gl),e(C,xl),v(Be,C,null),e(C,Jl),e(C,Sn),e(Sn,Ml),e(C,Fl),v(no,C,null),gs=!0},p(t,[p]){const so={};p&2&&(so.$$scope={dirty:p,ctx:t}),ze.$set(so);const Nn={};p&2&&(Nn.$$scope={dirty:p,ctx:t}),qe.$set(Nn);const Dn={};p&2&&(Dn.$$scope={dirty:p,ctx:t}),Ce.$set(Dn);const Bn={};p&2&&(Bn.$$scope={dirty:p,ctx:t}),Le.$set(Bn);const ao={};p&2&&(ao.$$scope={dirty:p,ctx:t}),Ne.$set(ao);const On={};p&2&&(On.$$scope={dirty:p,ctx:t}),Be.$set(On)},i(t){gs||(P(g.$$.fragment,t),P(Ve.$$.fragment,t),P(tt.$$.fragment,t),P(st.$$.fragment,t),P(at.$$.fragment,t),P(rt.$$.fragment,t),P(it.$$.fragment,t),P(lt.$$.fragment,t),P(ct.$$.fragment,t),P(pt.$$.fragment,t),P(ht.$$.fragment,t),P(ft.$$.fragment,t),P(ze.$$.fragment,t),P(gt.$$.fragment,t),P(_t.$$.fragment,t),P(Tt.$$.fragment,t),P(kt.$$.fragment,t),P(qe.$$.fragment,t),P(wt.$$.fragment,t),P(bt.$$.fragment,t),P(yt.$$.fragment,t),P(Gt.$$.fragment,t),P(Ce.$$.fragment,t),P(xt.$$.fragment,t),P(Jt.$$.fragment,t),P(Mt.$$.fragment,t),P(Ft.$$.fragment,t),P(qt.$$.fragment,t),P(Le.$$.fragment,t),P(At.$$.fragment,t),P(Ct.$$.fragment,t),P(It.$$.fragment,t),P(Ut.$$.fragment,t),P(Ne.$$.fragment,t),P(Qt.$$.fragment,t),P(Ht.$$.fragment,t),P(Rt.$$.fragment,t),P(oo.$$.fragment,t),P(Be.$$.fragment,t),P(no.$$.fragment,t),gs=!0)},o(t){k(g.$$.fragment,t),k(Ve.$$.fragment,t),k(tt.$$.fragment,t),k(st.$$.fragment,t),k(at.$$.fragment,t),k(rt.$$.fragment,t),k(it.$$.fragment,t),k(lt.$$.fragment,t),k(ct.$$.fragment,t),k(pt.$$.fragment,t),k(ht.$$.fragment,t),k(ft.$$.fragment,t),k(ze.$$.fragment,t),k(gt.$$.fragment,t),k(_t.$$.fragment,t),k(Tt.$$.fragment,t),k(kt.$$.fragment,t),k(qe.$$.fragment,t),k(wt.$$.fragment,t),k(bt.$$.fragment,t),k(yt.$$.fragment,t),k(Gt.$$.fragment,t),k(Ce.$$.fragment,t),k(xt.$$.fragment,t),k(Jt.$$.fragment,t),k(Mt.$$.fragment,t),k(Ft.$$.fragment,t),k(qt.$$.fragment,t),k(Le.$$.fragment,t),k(At.$$.fragment,t),k(Ct.$$.fragment,t),k(It.$$.fragment,t),k(Ut.$$.fragment,t),k(Ne.$$.fragment,t),k(Qt.$$.fragment,t),k(Ht.$$.fragment,t),k(Rt.$$.fragment,t),k(oo.$$.fragment,t),k(Be.$$.fragment,t),k(no.$$.fragment,t),gs=!1},d(t){o(h),t&&o(y),t&&o(m),w(g),t&&o(Wn),t&&o(de),w(Ve),t&&o(Un),t&&o(Z),t&&o(Qn),t&&o($e),t&&o(Hn),t&&o(ro),t&&o(Rn),t&&o(io),t&&o(Vn),w(tt,t),t&&o(Kn),t&&o(Ge),t&&o(Xn),t&&o(ce),w(st),t&&o(Yn),t&&o(Je),t&&o(Zn),w(at,t),t&&o(es),t&&o(po),t&&o(ts),w(rt,t),t&&o(os),t&&o(pe),w(it),t&&o(ns),t&&o(D),w(lt),w(ct),t&&o(ss),t&&o(he),w(pt),t&&o(as),t&&o(V),w(ht),w(ft),w(ze),w(gt),t&&o(rs),t&&o(me),w(_t),t&&o(is),t&&o(O),w(Tt),w(kt),w(qe),w(wt),t&&o(ls),t&&o(ge),w(bt),t&&o(ds),t&&o(M),w(yt),w(Gt),w(Ce),w(xt),w(Jt),t&&o(cs),t&&o(Te),w(Mt),t&&o(ps),t&&o(U),w(Ft),w(qt),w(Le),w(At),t&&o(hs),t&&o(ke),w(Ct),t&&o(us),t&&o(G),w(It),w(Ut),w(Ne),w(Qt),t&&o(ms),t&&o(be),w(Ht),t&&o(fs),t&&o(x),w(Rt),w(oo),w(Be),w(no)}}}const Dc={local:"gptj",sections:[{local:"overview",sections:[{local:"generation",title:"Generation"}],title:"Overview"},{local:"transformers.GPTJConfig",title:"GPTJConfig"},{local:"transformers.GPTJModel",title:"GPTJModel"},{local:"transformers.GPTJForCausalLM",title:"GPTJForCausalLM"},{local:"transformers.GPTJForSequenceClassification",title:"GPTJForSequenceClassification"},{local:"transformers.GPTJForQuestionAnswering",title:"GPTJForQuestionAnswering"},{local:"transformers.FlaxGPTJModel",title:"FlaxGPTJModel"},{local:"transformers.FlaxGPTJForCausalLM",title:"FlaxGPTJForCausalLM"}],title:"GPT-J"};function Bc(F,h,y){let{fw:m}=h;return F.$$set=b=>{"fw"in b&&y(0,m=b.fw)},[m]}class Vc extends Mc{constructor(h){super();Fc(this,h,Bc,Nc,zc,{fw:0})}}export{Vc as default,Dc as metadata};
