import{S as Ql,i as Yl,s as Zl,e as n,k as p,w as b,t as i,M as ed,c as s,d as t,m as h,a,x as y,h as l,b as c,G as e,g as _,y as k,q as P,o as w,B as $,v as td,L as Ht}from"../../chunks/vendor-hf-doc-builder.js";import{T as vn}from"../../chunks/Tip-hf-doc-builder.js";import{D as U}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ve}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Q}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Wt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function od(N){let d,T,f,m,v;return m=new Ve({props:{code:`from transformers import GPTNeoConfig, GPTNeoModel

# Initializing a GPTNeo EleutherAI/gpt-neo-1.3B style configuration
configuration = GPTNeoConfig()

# Initializing a model (with random weights) from the EleutherAI/gpt-neo-1.3B style configuration
model = GPTNeoModel(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> GPTNeoConfig, GPTNeoModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a GPTNeo EleutherAI/gpt-neo-1.3B style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = GPTNeoConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the EleutherAI/gpt-neo-1.3B style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){d=n("p"),T=i("Example:"),f=p(),b(m.$$.fragment)},l(r){d=s(r,"P",{});var u=a(d);T=l(u,"Example:"),u.forEach(t),f=h(r),y(m.$$.fragment,r)},m(r,u){_(r,d,u),e(d,T),_(r,f,u),k(m,r,u),v=!0},p:Ht,i(r){v||(P(m.$$.fragment,r),v=!0)},o(r){w(m.$$.fragment,r),v=!1},d(r){r&&t(d),r&&t(f),$(m,r)}}}function nd(N){let d,T,f,m,v;return{c(){d=n("p"),T=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=i("Module"),v=i(`
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(r){d=s(r,"P",{});var u=a(d);T=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(u,"CODE",{});var x=a(f);m=l(x,"Module"),x.forEach(t),v=l(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(r,u){_(r,d,u),e(d,T),e(d,f),e(f,m),e(d,v)},d(r){r&&t(d)}}}function sd(N){let d,T,f,m,v;return m=new Ve({props:{code:`from transformers import AutoTokenizer, GPTNeoModel
import torch

tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")
model = GPTNeoModel.from_pretrained("EleutherAI/gpt-neo-1.3B")

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> AutoTokenizer, GPTNeoModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoModel.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&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`}}),{c(){d=n("p"),T=i("Example:"),f=p(),b(m.$$.fragment)},l(r){d=s(r,"P",{});var u=a(d);T=l(u,"Example:"),u.forEach(t),f=h(r),y(m.$$.fragment,r)},m(r,u){_(r,d,u),e(d,T),_(r,f,u),k(m,r,u),v=!0},p:Ht,i(r){v||(P(m.$$.fragment,r),v=!0)},o(r){w(m.$$.fragment,r),v=!1},d(r){r&&t(d),r&&t(f),$(m,r)}}}function ad(N){let d,T,f,m,v;return{c(){d=n("p"),T=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=i("Module"),v=i(`
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(r){d=s(r,"P",{});var u=a(d);T=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(u,"CODE",{});var x=a(f);m=l(x,"Module"),x.forEach(t),v=l(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(r,u){_(r,d,u),e(d,T),e(d,f),e(f,m),e(d,v)},d(r){r&&t(d)}}}function rd(N){let d,T,f,m,v;return m=new Ve({props:{code:`import torch
from transformers import AutoTokenizer, GPTNeoForCausalLM

tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")
model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-1.3B")

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> AutoTokenizer, GPTNeoForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoForCausalLM.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&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`}}),{c(){d=n("p"),T=i("Example:"),f=p(),b(m.$$.fragment)},l(r){d=s(r,"P",{});var u=a(d);T=l(u,"Example:"),u.forEach(t),f=h(r),y(m.$$.fragment,r)},m(r,u){_(r,d,u),e(d,T),_(r,f,u),k(m,r,u),v=!0},p:Ht,i(r){v||(P(m.$$.fragment,r),v=!0)},o(r){w(m.$$.fragment,r),v=!1},d(r){r&&t(d),r&&t(f),$(m,r)}}}function id(N){let d,T,f,m,v;return{c(){d=n("p"),T=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=i("Module"),v=i(`
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(r){d=s(r,"P",{});var u=a(d);T=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(u,"CODE",{});var x=a(f);m=l(x,"Module"),x.forEach(t),v=l(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(r,u){_(r,d,u),e(d,T),e(d,f),e(f,m),e(d,v)},d(r){r&&t(d)}}}function ld(N){let d,T,f,m,v;return m=new Ve({props:{code:`import torch
from transformers import AutoTokenizer, GPTNeoForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")
model = GPTNeoForSequenceClassification.from_pretrained("EleutherAI/gpt-neo-1.3B")

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

with torch.no_grad():
    logits = model(**inputs).logits

predicted_class_id = logits.argmax().item()

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = GPTNeoForSequenceClassification.from_pretrained("EleutherAI/gpt-neo-1.3B", num_labels=num_labels)

labels = torch.tensor([1])
loss = model(**inputs, labels=labels).loss`,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> AutoTokenizer, GPTNeoForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&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><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = logits.argmax().item()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&quot;</span>, num_labels=num_labels)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor([<span class="hljs-number">1</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=n("p"),T=i("Example of single-label classification:"),f=p(),b(m.$$.fragment)},l(r){d=s(r,"P",{});var u=a(d);T=l(u,"Example of single-label classification:"),u.forEach(t),f=h(r),y(m.$$.fragment,r)},m(r,u){_(r,d,u),e(d,T),_(r,f,u),k(m,r,u),v=!0},p:Ht,i(r){v||(P(m.$$.fragment,r),v=!0)},o(r){w(m.$$.fragment,r),v=!1},d(r){r&&t(d),r&&t(f),$(m,r)}}}function dd(N){let d,T,f,m,v;return m=new Ve({props:{code:`import torch
from transformers import AutoTokenizer, GPTNeoForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")
model = GPTNeoForSequenceClassification.from_pretrained("EleutherAI/gpt-neo-1.3B", problem_type="multi_label_classification")

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

with torch.no_grad():
    logits = model(**inputs).logits

predicted_class_ids = torch.arange(0, logits.shape[-1])[torch.sigmoid(logits).squeeze(dim=0) > 0.5]

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = GPTNeoForSequenceClassification.from_pretrained(
    "EleutherAI/gpt-neo-1.3B", num_labels=num_labels, problem_type="multi_label_classification"
)

labels = torch.sum(
    torch.nn.functional.one_hot(predicted_class_ids[None, :].clone(), num_classes=num_labels), dim=1
).to(torch.float)
loss = model(**inputs, labels=labels).loss`,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> AutoTokenizer, GPTNeoForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&quot;</span>, problem_type=<span class="hljs-string">&quot;multi_label_classification&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><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_ids = torch.arange(<span class="hljs-number">0</span>, logits.shape[-<span class="hljs-number">1</span>])[torch.sigmoid(logits).squeeze(dim=<span class="hljs-number">0</span>) &gt; <span class="hljs-number">0.5</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&quot;</span>, num_labels=num_labels, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.<span class="hljs-built_in">sum</span>(
<span class="hljs-meta">... </span>    torch.nn.functional.one_hot(predicted_class_ids[<span class="hljs-literal">None</span>, :].clone(), num_classes=num_labels), dim=<span class="hljs-number">1</span>
<span class="hljs-meta">... </span>).to(torch.<span class="hljs-built_in">float</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=n("p"),T=i("Example of multi-label classification:"),f=p(),b(m.$$.fragment)},l(r){d=s(r,"P",{});var u=a(d);T=l(u,"Example of multi-label classification:"),u.forEach(t),f=h(r),y(m.$$.fragment,r)},m(r,u){_(r,d,u),e(d,T),_(r,f,u),k(m,r,u),v=!0},p:Ht,i(r){v||(P(m.$$.fragment,r),v=!0)},o(r){w(m.$$.fragment,r),v=!1},d(r){r&&t(d),r&&t(f),$(m,r)}}}function cd(N){let d,T,f,m,v;return{c(){d=n("p"),T=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=i("Module"),v=i(`
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(r){d=s(r,"P",{});var u=a(d);T=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(u,"CODE",{});var x=a(f);m=l(x,"Module"),x.forEach(t),v=l(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(r,u){_(r,d,u),e(d,T),e(d,f),e(f,m),e(d,v)},d(r){r&&t(d)}}}function pd(N){let d,T,f,m,v;return m=new Ve({props:{code:`from transformers import AutoTokenizer, FlaxGPTNeoModel

tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")
model = FlaxGPTNeoModel.from_pretrained("EleutherAI/gpt-neo-1.3B")

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> AutoTokenizer, FlaxGPTNeoModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxGPTNeoModel.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&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`}}),{c(){d=n("p"),T=i("Example:"),f=p(),b(m.$$.fragment)},l(r){d=s(r,"P",{});var u=a(d);T=l(u,"Example:"),u.forEach(t),f=h(r),y(m.$$.fragment,r)},m(r,u){_(r,d,u),e(d,T),_(r,f,u),k(m,r,u),v=!0},p:Ht,i(r){v||(P(m.$$.fragment,r),v=!0)},o(r){w(m.$$.fragment,r),v=!1},d(r){r&&t(d),r&&t(f),$(m,r)}}}function hd(N){let d,T,f,m,v;return{c(){d=n("p"),T=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=i("Module"),v=i(`
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(r){d=s(r,"P",{});var u=a(d);T=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(u,"CODE",{});var x=a(f);m=l(x,"Module"),x.forEach(t),v=l(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(r,u){_(r,d,u),e(d,T),e(d,f),e(f,m),e(d,v)},d(r){r&&t(d)}}}function ud(N){let d,T,f,m,v;return m=new Ve({props:{code:`from transformers import AutoTokenizer, FlaxGPTNeoForCausalLM

tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")
model = FlaxGPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-1.3B")

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> AutoTokenizer, FlaxGPTNeoForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxGPTNeoForCausalLM.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&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(){d=n("p"),T=i("Example:"),f=p(),b(m.$$.fragment)},l(r){d=s(r,"P",{});var u=a(d);T=l(u,"Example:"),u.forEach(t),f=h(r),y(m.$$.fragment,r)},m(r,u){_(r,d,u),e(d,T),_(r,f,u),k(m,r,u),v=!0},p:Ht,i(r){v||(P(m.$$.fragment,r),v=!0)},o(r){w(m.$$.fragment,r),v=!1},d(r){r&&t(d),r&&t(f),$(m,r)}}}function md(N){let d,T,f,m,v,r,u,x,ls,Tn,Y,fe,fo,Je,ds,go,cs,bn,V,ps,Re,hs,us,Xe,ms,fs,yn,Ut,gs,kn,ge,_s,Ke,vs,Ts,Pn,Z,_e,_o,Qe,bs,vo,ys,wn,ve,ks,To,Ps,ws,$n,Ye,Nn,ee,Te,bo,Ze,$s,yo,Ns,xn,be,ko,Vt,xs,Gs,Po,Jt,Ms,Gn,te,ye,wo,et,Fs,$o,Es,Mn,I,tt,Cs,oe,zs,Rt,qs,js,ot,As,Is,Ls,ne,Ss,Xt,Os,Ds,Kt,Bs,Ws,Hs,ke,Fn,se,Pe,No,nt,Us,xo,Vs,En,E,st,Js,Go,Rs,Xs,at,Ks,Qt,Qs,Ys,Zs,rt,ea,it,ta,oa,na,S,lt,sa,ae,aa,Yt,ra,ia,Mo,la,da,ca,we,pa,$e,Cn,re,Ne,Fo,dt,ha,Eo,ua,zn,C,ct,ma,Co,fa,ga,pt,_a,Zt,va,Ta,ba,ht,ya,ut,ka,Pa,wa,O,mt,$a,ie,Na,eo,xa,Ga,zo,Ma,Fa,Ea,xe,Ca,Ge,qn,le,Me,qo,ft,za,jo,qa,jn,G,gt,ja,Ao,Aa,Ia,to,oo,La,Sa,Oa,L,Da,Io,Ba,Wa,Lo,Ha,Ua,So,Va,Ja,Oo,Ra,Xa,Ka,_t,Qa,no,Ya,Za,er,vt,tr,Tt,or,nr,sr,z,bt,ar,de,rr,so,ir,lr,Do,dr,cr,pr,Fe,hr,Ee,ur,Ce,An,ce,ze,Bo,yt,mr,Wo,fr,In,M,kt,gr,Ho,_r,vr,Pt,Tr,ao,br,yr,kr,wt,Pr,$t,wr,$r,Nr,Uo,xr,Gr,W,Vo,Nt,Mr,Fr,Jo,xt,Er,Cr,Ro,Gt,zr,qr,Xo,Mt,jr,Ar,D,Ft,Ir,pe,Lr,Ko,Sr,Or,Qo,Dr,Br,Wr,qe,Hr,je,Ln,he,Ae,Yo,Et,Ur,Zo,Vr,Sn,F,Ct,Jr,en,Rr,Xr,zt,Kr,ro,Qr,Yr,Zr,qt,ei,jt,ti,oi,ni,tn,si,ai,H,on,At,ri,ii,nn,It,li,di,sn,Lt,ci,pi,an,St,hi,ui,B,Ot,mi,ue,fi,rn,gi,_i,ln,vi,Ti,bi,Ie,yi,Le,On;return r=new Q({}),Je=new Q({}),Qe=new Q({}),Ye=new Ve({props:{code:`from transformers import GPTNeoForCausalLM, GPT2Tokenizer

model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-1.3B")
tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")

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> GPTNeoForCausalLM, GPT2Tokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoForCausalLM.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = GPT2Tokenizer.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neo-1.3B&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>]`}}),Ze=new Q({}),et=new Q({}),tt=new U({props:{name:"class transformers.GPTNeoConfig",anchor:"transformers.GPTNeoConfig",parameters:[{name:"vocab_size",val:" = 50257"},{name:"max_position_embeddings",val:" = 2048"},{name:"hidden_size",val:" = 2048"},{name:"num_layers",val:" = 24"},{name:"attention_types",val:" = [[['global', 'local'], 12]]"},{name:"num_heads",val:" = 16"},{name:"intermediate_size",val:" = None"},{name:"window_size",val:" = 256"},{name:"activation_function",val:" = 'gelu_new'"},{name:"resid_dropout",val:" = 0.0"},{name:"embed_dropout",val:" = 0.0"},{name:"attention_dropout",val:" = 0.0"},{name:"layer_norm_epsilon",val:" = 1e-05"},{name:"initializer_range",val:" = 0.02"},{name:"use_cache",val:" = True"},{name:"bos_token_id",val:" = 50256"},{name:"eos_token_id",val:" = 50256"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GPTNeoConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50257) &#x2014;
Vocabulary size of the GPT Neo model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoModel">GPTNeoModel</a>. Vocabulary size of the model. Defines the different
tokens that can be represented by the <em>inputs_ids</em> passed to the forward method of <a href="/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoModel">GPTNeoModel</a>.`,name:"vocab_size"},{anchor:"transformers.GPTNeoConfig.attention_types",description:`<strong>attention_types</strong> (<code>List</code>, <em>optional</em>, defaults to <code>[[[&quot;global&quot;, &quot;local&quot;], 12]]</code>) &#x2014;
The type of attention for each layer in a <code>List</code> of the following format <code>[[[&quot;attention_type&quot;], num_layerss]]</code> e.g. for a 24 layer model <code>[[[&quot;global&quot;], 24]]</code> or <code>[[[&quot;global&quot;, &quot;local&quot;], 12]]</code> Choose the
value of <code>attention_type</code> from <code>[&quot;global&quot;, &quot;local&quot;]</code>`,name:"attention_types"},{anchor:"transformers.GPTNeoConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.GPTNeoConfig.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 24) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_layers"},{anchor:"transformers.GPTNeoConfig.num_heads",description:`<strong>num_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_heads"},{anchor:"transformers.GPTNeoConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8192) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.GPTNeoConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"activation_function"},{anchor:"transformers.GPTNeoConfig.embed_dropout",description:`<strong>embed_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"embed_dropout"},{anchor:"transformers.GPTNeoConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.GPTNeoConfig.max_position_embeddings",description:`<strong>max_position_embeddings</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:"max_position_embeddings"},{anchor:"transformers.GPTNeoConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoModel">GPTNeoModel</a>.`,name:"type_vocab_size"},{anchor:"transformers.GPTNeoConfig.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.GPTNeoConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_epsilon"},{anchor:"transformers.GPTNeoConfig.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). Only
relevant if <code>config.is_decoder=True</code>.`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/gpt_neo/configuration_gpt_neo.py#L34"}}),ke=new Wt({props:{anchor:"transformers.GPTNeoConfig.example",$$slots:{default:[od]},$$scope:{ctx:N}}}),nt=new Q({}),st=new U({props:{name:"class transformers.GPTNeoModel",anchor:"transformers.GPTNeoModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTNeoModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoConfig">GPTNeoConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/gpt_neo/modeling_gpt_neo.py#L474"}}),lt=new U({props:{name:"forward",anchor:"transformers.GPTNeoModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.GPTNeoModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else
<code>past_key_values[0][0].shape[-2]</code> (<code>sequence_length</code> of input past key value states). Indices of input
sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/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.GPTNeoModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.num_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.GPTNeoModel.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.GPTNeoModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_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.GPTNeoModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTNeoModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.GPTNeoModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.GPTNeoModel.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.GPTNeoModel.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.GPTNeoModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/gpt_neo/modeling_gpt_neo.py#L495",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoConfig"
>GPTNeoConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
<code>config.is_encoder_decoder=True</code> in the cross-attention blocks) that can be used (see <code>past_key_values</code>
input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> and <code>config.add_cross_attention=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),we=new vn({props:{$$slots:{default:[nd]},$$scope:{ctx:N}}}),$e=new Wt({props:{anchor:"transformers.GPTNeoModel.forward.example",$$slots:{default:[sd]},$$scope:{ctx:N}}}),dt=new Q({}),ct=new U({props:{name:"class transformers.GPTNeoForCausalLM",anchor:"transformers.GPTNeoForCausalLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTNeoForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoConfig">GPTNeoConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/gpt_neo/modeling_gpt_neo.py#L662"}}),mt=new U({props:{name:"forward",anchor:"transformers.GPTNeoForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.GPTNeoForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else
<code>past_key_values[0][0].shape[-2]</code> (<code>sequence_length</code> of input past key value states). Indices of input
sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/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.GPTNeoForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.num_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.GPTNeoForCausalLM.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.GPTNeoForCausalLM.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_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.GPTNeoForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTNeoForCausalLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.GPTNeoForCausalLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoForCausalLM.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.GPTNeoForCausalLM.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.GPTNeoForCausalLM.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.GPTNeoForCausalLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTNeoForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for language modeling. Note that the labels <strong>are shifted</strong> inside the model, i.e. you can set
<code>labels = input_ids</code> Indices are selected in <code>[-100, 0, ..., config.vocab_size]</code> All labels set to <code>-100</code>
are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/gpt_neo/modeling_gpt_neo.py#L712",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoConfig"
>GPTNeoConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Cross attentions weights after the attention softmax, used to compute the weighted average in the
cross-attention heads.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> tuples of length <code>config.n_layers</code>, with each tuple containing the cached key,
value states of the self-attention and the cross-attention layers if model is used in encoder-decoder
setting. Only relevant if <code>config.is_decoder = True</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),xe=new vn({props:{$$slots:{default:[ad]},$$scope:{ctx:N}}}),Ge=new Wt({props:{anchor:"transformers.GPTNeoForCausalLM.forward.example",$$slots:{default:[rd]},$$scope:{ctx:N}}}),ft=new Q({}),gt=new U({props:{name:"class transformers.GPTNeoForSequenceClassification",anchor:"transformers.GPTNeoForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTNeoForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoConfig">GPTNeoConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/gpt_neo/modeling_gpt_neo.py#L816"}}),bt=new U({props:{name:"forward",anchor:"transformers.GPTNeoForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.GPTNeoForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else
<code>past_key_values[0][0].shape[-2]</code> (<code>sequence_length</code> of input past key value states). Indices of input
sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/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.GPTNeoForSequenceClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.num_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.GPTNeoForSequenceClassification.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.GPTNeoForSequenceClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_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.GPTNeoForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTNeoForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.GPTNeoForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoForSequenceClassification.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.GPTNeoForSequenceClassification.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.GPTNeoForSequenceClassification.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.GPTNeoForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTNeoForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/gpt_neo/modeling_gpt_neo.py#L828",returnDescription:`
<p>A <code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoConfig"
>GPTNeoConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Fe=new vn({props:{$$slots:{default:[id]},$$scope:{ctx:N}}}),Ee=new Wt({props:{anchor:"transformers.GPTNeoForSequenceClassification.forward.example",$$slots:{default:[ld]},$$scope:{ctx:N}}}),Ce=new Wt({props:{anchor:"transformers.GPTNeoForSequenceClassification.forward.example-2",$$slots:{default:[dd]},$$scope:{ctx:N}}}),yt=new Q({}),kt=new U({props:{name:"class transformers.FlaxGPTNeoModel",anchor:"transformers.FlaxGPTNeoModel",parameters:[{name:"config",val:": GPTNeoConfig"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxGPTNeoModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoConfig">GPTNeoConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxGPTNeoModel.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/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/gpt_neo/modeling_flax_gpt_neo.py#L591"}}),Ft=new U({props:{name:"__call__",anchor:"transformers.FlaxGPTNeoModel.__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"}],parametersDescription:[{anchor:"transformers.FlaxGPTNeoModel.__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 <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/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.FlaxGPTNeoModel.__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.FlaxGPTNeoModel.__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.FlaxGPTNeoModel.__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.FlaxGPTNeoModel.__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.FlaxGPTNeoModel.__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.FlaxGPTNeoModel.__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/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/gpt_neo/modeling_flax_gpt_neo.py#L401",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutput"
>transformers.modeling_flax_outputs.FlaxBaseModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoConfig"
>GPTNeoConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>jnp.ndarray</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>
</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/v4.27.1/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutput"
>transformers.modeling_flax_outputs.FlaxBaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),qe=new vn({props:{$$slots:{default:[cd]},$$scope:{ctx:N}}}),je=new Wt({props:{anchor:"transformers.FlaxGPTNeoModel.__call__.example",$$slots:{default:[pd]},$$scope:{ctx:N}}}),Et=new Q({}),Ct=new U({props:{name:"class transformers.FlaxGPTNeoForCausalLM",anchor:"transformers.FlaxGPTNeoForCausalLM",parameters:[{name:"config",val:": GPTNeoConfig"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxGPTNeoForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoConfig">GPTNeoConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxGPTNeoForCausalLM.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/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/gpt_neo/modeling_flax_gpt_neo.py#L654"}}),Ot=new U({props:{name:"__call__",anchor:"transformers.FlaxGPTNeoForCausalLM.__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"}],parametersDescription:[{anchor:"transformers.FlaxGPTNeoForCausalLM.__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 <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/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.FlaxGPTNeoForCausalLM.__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.FlaxGPTNeoForCausalLM.__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.FlaxGPTNeoForCausalLM.__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.FlaxGPTNeoForCausalLM.__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.FlaxGPTNeoForCausalLM.__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.FlaxGPTNeoForCausalLM.__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/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/gpt_neo/modeling_flax_gpt_neo.py#L401",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/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/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoConfig"
>GPTNeoConfig</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/v4.27.1/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput"
>transformers.modeling_flax_outputs.FlaxMaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ie=new vn({props:{$$slots:{default:[hd]},$$scope:{ctx:N}}}),Le=new Wt({props:{anchor:"transformers.FlaxGPTNeoForCausalLM.__call__.example",$$slots:{default:[ud]},$$scope:{ctx:N}}}),{c(){d=n("meta"),T=p(),f=n("h1"),m=n("a"),v=n("span"),b(r.$$.fragment),u=p(),x=n("span"),ls=i("GPT Neo"),Tn=p(),Y=n("h2"),fe=n("a"),fo=n("span"),b(Je.$$.fragment),ds=p(),go=n("span"),cs=i("Overview"),bn=p(),V=n("p"),ps=i("The GPTNeo model was released in the "),Re=n("a"),hs=i("EleutherAI/gpt-neo"),us=i(` repository by Sid
Black, Stella Biderman, Leo Gao, Phil Wang and Connor Leahy. It is a GPT2 like causal language model trained on the
`),Xe=n("a"),ms=i("Pile"),fs=i(" dataset."),yn=p(),Ut=n("p"),gs=i(`The architecture is similar to GPT2 except that GPT Neo uses local attention in every other layer with a window size of
256 tokens.`),kn=p(),ge=n("p"),_s=i("This model was contributed by "),Ke=n("a"),vs=i("valhalla"),Ts=i("."),Pn=p(),Z=n("h3"),_e=n("a"),_o=n("span"),b(Qe.$$.fragment),bs=p(),vo=n("span"),ys=i("Generation"),wn=p(),ve=n("p"),ks=i("The "),To=n("code"),Ps=i("generate()"),ws=i(" method can be used to generate text using GPT Neo model."),$n=p(),b(Ye.$$.fragment),Nn=p(),ee=n("h2"),Te=n("a"),bo=n("span"),b(Ze.$$.fragment),$s=p(),yo=n("span"),Ns=i("Documentation resources"),xn=p(),be=n("ul"),ko=n("li"),Vt=n("a"),xs=i("Text classification task guide"),Gs=p(),Po=n("li"),Jt=n("a"),Ms=i("Causal language modeling task guide"),Gn=p(),te=n("h2"),ye=n("a"),wo=n("span"),b(et.$$.fragment),Fs=p(),$o=n("span"),Es=i("GPTNeoConfig"),Mn=p(),I=n("div"),b(tt.$$.fragment),Cs=p(),oe=n("p"),zs=i("This is the configuration class to store the configuration of a "),Rt=n("a"),qs=i("GPTNeoModel"),js=i(`. It is used to instantiate a GPT
Neo 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 GPTNeo
`),ot=n("a"),As=i("EleutherAI/gpt-neo-1.3B"),Is=i(" architecture."),Ls=p(),ne=n("p"),Ss=i("Configuration objects inherit from "),Xt=n("a"),Os=i("PretrainedConfig"),Ds=i(` and can be used to control the model outputs. Read the
documentation from `),Kt=n("a"),Bs=i("PretrainedConfig"),Ws=i(" for more information."),Hs=p(),b(ke.$$.fragment),Fn=p(),se=n("h2"),Pe=n("a"),No=n("span"),b(nt.$$.fragment),Us=p(),xo=n("span"),Vs=i("GPTNeoModel"),En=p(),E=n("div"),b(st.$$.fragment),Js=p(),Go=n("p"),Rs=i("The bare GPT Neo Model transformer outputting raw hidden-states without any specific head on top."),Xs=p(),at=n("p"),Ks=i("This model inherits from "),Qt=n("a"),Qs=i("PreTrainedModel"),Ys=i(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Zs=p(),rt=n("p"),ea=i("This model is also a PyTorch "),it=n("a"),ta=i("torch.nn.Module"),oa=i(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),na=p(),S=n("div"),b(lt.$$.fragment),sa=p(),ae=n("p"),aa=i("The "),Yt=n("a"),ra=i("GPTNeoModel"),ia=i(" forward method, overrides the "),Mo=n("code"),la=i("__call__"),da=i(" special method."),ca=p(),b(we.$$.fragment),pa=p(),b($e.$$.fragment),Cn=p(),re=n("h2"),Ne=n("a"),Fo=n("span"),b(dt.$$.fragment),ha=p(),Eo=n("span"),ua=i("GPTNeoForCausalLM"),zn=p(),C=n("div"),b(ct.$$.fragment),ma=p(),Co=n("p"),fa=i(`The GPT Neo Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),ga=p(),pt=n("p"),_a=i("This model inherits from "),Zt=n("a"),va=i("PreTrainedModel"),Ta=i(`. 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.)`),ba=p(),ht=n("p"),ya=i("This model is also a PyTorch "),ut=n("a"),ka=i("torch.nn.Module"),Pa=i(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),wa=p(),O=n("div"),b(mt.$$.fragment),$a=p(),ie=n("p"),Na=i("The "),eo=n("a"),xa=i("GPTNeoForCausalLM"),Ga=i(" forward method, overrides the "),zo=n("code"),Ma=i("__call__"),Fa=i(" special method."),Ea=p(),b(xe.$$.fragment),Ca=p(),b(Ge.$$.fragment),qn=p(),le=n("h2"),Me=n("a"),qo=n("span"),b(ft.$$.fragment),za=p(),jo=n("span"),qa=i("GPTNeoForSequenceClassification"),jn=p(),G=n("div"),b(gt.$$.fragment),ja=p(),Ao=n("p"),Aa=i("The GPTNeo Model transformer with a sequence classification head on top (linear layer)."),Ia=p(),to=n("p"),oo=n("a"),La=i("GPTNeoForSequenceClassification"),Sa=i(` uses the last token in order to do the classification, as other causal models
(e.g. GPT-1) do.`),Oa=p(),L=n("p"),Da=i(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Io=n("code"),Ba=i("pad_token_id"),Wa=i(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Lo=n("code"),Ha=i("pad_token_id"),Ua=i(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),So=n("code"),Va=i("inputs_embeds"),Ja=i(" are passed instead of "),Oo=n("code"),Ra=i("input_ids"),Xa=i(`, it does the same (take the last value in
each row of the batch).`),Ka=p(),_t=n("p"),Qa=i("This model inherits from "),no=n("a"),Ya=i("PreTrainedModel"),Za=i(`. 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.)`),er=p(),vt=n("p"),tr=i("This model is also a PyTorch "),Tt=n("a"),or=i("torch.nn.Module"),nr=i(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),sr=p(),z=n("div"),b(bt.$$.fragment),ar=p(),de=n("p"),rr=i("The "),so=n("a"),ir=i("GPTNeoForSequenceClassification"),lr=i(" forward method, overrides the "),Do=n("code"),dr=i("__call__"),cr=i(" special method."),pr=p(),b(Fe.$$.fragment),hr=p(),b(Ee.$$.fragment),ur=p(),b(Ce.$$.fragment),An=p(),ce=n("h2"),ze=n("a"),Bo=n("span"),b(yt.$$.fragment),mr=p(),Wo=n("span"),fr=i("FlaxGPTNeoModel"),In=p(),M=n("div"),b(kt.$$.fragment),gr=p(),Ho=n("p"),_r=i("The bare GPTNeo Model transformer outputting raw hidden-states without any specific head on top."),vr=p(),Pt=n("p"),Tr=i("This model inherits from "),ao=n("a"),br=i("FlaxPreTrainedModel"),yr=i(`. 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.)`),kr=p(),wt=n("p"),Pr=i(`This model is also a Flax Linen
`),$t=n("a"),wr=i("flax.nn.Module"),$r=i(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Nr=p(),Uo=n("p"),xr=i("Finally, this model supports inherent JAX features such as:"),Gr=p(),W=n("ul"),Vo=n("li"),Nt=n("a"),Mr=i("Just-In-Time (JIT) compilation"),Fr=p(),Jo=n("li"),xt=n("a"),Er=i("Automatic Differentiation"),Cr=p(),Ro=n("li"),Gt=n("a"),zr=i("Vectorization"),qr=p(),Xo=n("li"),Mt=n("a"),jr=i("Parallelization"),Ar=p(),D=n("div"),b(Ft.$$.fragment),Ir=p(),pe=n("p"),Lr=i("The "),Ko=n("code"),Sr=i("FlaxGPTNeoPreTrainedModel"),Or=i(" forward method, overrides the "),Qo=n("code"),Dr=i("__call__"),Br=i(" special method."),Wr=p(),b(qe.$$.fragment),Hr=p(),b(je.$$.fragment),Ln=p(),he=n("h2"),Ae=n("a"),Yo=n("span"),b(Et.$$.fragment),Ur=p(),Zo=n("span"),Vr=i("FlaxGPTNeoForCausalLM"),Sn=p(),F=n("div"),b(Ct.$$.fragment),Jr=p(),en=n("p"),Rr=i(`The GPTNeo Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),Xr=p(),zt=n("p"),Kr=i("This model inherits from "),ro=n("a"),Qr=i("FlaxPreTrainedModel"),Yr=i(`. 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.)`),Zr=p(),qt=n("p"),ei=i(`This model is also a Flax Linen
`),jt=n("a"),ti=i("flax.nn.Module"),oi=i(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),ni=p(),tn=n("p"),si=i("Finally, this model supports inherent JAX features such as:"),ai=p(),H=n("ul"),on=n("li"),At=n("a"),ri=i("Just-In-Time (JIT) compilation"),ii=p(),nn=n("li"),It=n("a"),li=i("Automatic Differentiation"),di=p(),sn=n("li"),Lt=n("a"),ci=i("Vectorization"),pi=p(),an=n("li"),St=n("a"),hi=i("Parallelization"),ui=p(),B=n("div"),b(Ot.$$.fragment),mi=p(),ue=n("p"),fi=i("The "),rn=n("code"),gi=i("FlaxGPTNeoPreTrainedModel"),_i=i(" forward method, overrides the "),ln=n("code"),vi=i("__call__"),Ti=i(" special method."),bi=p(),b(Ie.$$.fragment),yi=p(),b(Le.$$.fragment),this.h()},l(o){const g=ed('[data-svelte="svelte-1phssyn"]',document.head);d=s(g,"META",{name:!0,content:!0}),g.forEach(t),T=h(o),f=s(o,"H1",{class:!0});var Dt=a(f);m=s(Dt,"A",{id:!0,class:!0,href:!0});var dn=a(m);v=s(dn,"SPAN",{});var cn=a(v);y(r.$$.fragment,cn),cn.forEach(t),dn.forEach(t),u=h(Dt),x=s(Dt,"SPAN",{});var pn=a(x);ls=l(pn,"GPT Neo"),pn.forEach(t),Dt.forEach(t),Tn=h(o),Y=s(o,"H2",{class:!0});var Bt=a(Y);fe=s(Bt,"A",{id:!0,class:!0,href:!0});var hn=a(fe);fo=s(hn,"SPAN",{});var un=a(fo);y(Je.$$.fragment,un),un.forEach(t),hn.forEach(t),ds=h(Bt),go=s(Bt,"SPAN",{});var mn=a(go);cs=l(mn,"Overview"),mn.forEach(t),Bt.forEach(t),bn=h(o),V=s(o,"P",{});var me=a(V);ps=l(me,"The GPTNeo model was released in the "),Re=s(me,"A",{href:!0,rel:!0});var fn=a(Re);hs=l(fn,"EleutherAI/gpt-neo"),fn.forEach(t),us=l(me,` repository by Sid
Black, Stella Biderman, Leo Gao, Phil Wang and Connor Leahy. It is a GPT2 like causal language model trained on the
`),Xe=s(me,"A",{href:!0,rel:!0});var gn=a(Xe);ms=l(gn,"Pile"),gn.forEach(t),fs=l(me," dataset."),me.forEach(t),yn=h(o),Ut=s(o,"P",{});var _n=a(Ut);gs=l(_n,`The architecture is similar to GPT2 except that GPT Neo uses local attention in every other layer with a window size of
256 tokens.`),_n.forEach(t),kn=h(o),ge=s(o,"P",{});var Dn=a(ge);_s=l(Dn,"This model was contributed by "),Ke=s(Dn,"A",{href:!0,rel:!0});var Pi=a(Ke);vs=l(Pi,"valhalla"),Pi.forEach(t),Ts=l(Dn,"."),Dn.forEach(t),Pn=h(o),Z=s(o,"H3",{class:!0});var Bn=a(Z);_e=s(Bn,"A",{id:!0,class:!0,href:!0});var wi=a(_e);_o=s(wi,"SPAN",{});var $i=a(_o);y(Qe.$$.fragment,$i),$i.forEach(t),wi.forEach(t),bs=h(Bn),vo=s(Bn,"SPAN",{});var Ni=a(vo);ys=l(Ni,"Generation"),Ni.forEach(t),Bn.forEach(t),wn=h(o),ve=s(o,"P",{});var Wn=a(ve);ks=l(Wn,"The "),To=s(Wn,"CODE",{});var xi=a(To);Ps=l(xi,"generate()"),xi.forEach(t),ws=l(Wn," method can be used to generate text using GPT Neo model."),Wn.forEach(t),$n=h(o),y(Ye.$$.fragment,o),Nn=h(o),ee=s(o,"H2",{class:!0});var Hn=a(ee);Te=s(Hn,"A",{id:!0,class:!0,href:!0});var Gi=a(Te);bo=s(Gi,"SPAN",{});var Mi=a(bo);y(Ze.$$.fragment,Mi),Mi.forEach(t),Gi.forEach(t),$s=h(Hn),yo=s(Hn,"SPAN",{});var Fi=a(yo);Ns=l(Fi,"Documentation resources"),Fi.forEach(t),Hn.forEach(t),xn=h(o),be=s(o,"UL",{});var Un=a(be);ko=s(Un,"LI",{});var Ei=a(ko);Vt=s(Ei,"A",{href:!0});var Ci=a(Vt);xs=l(Ci,"Text classification task guide"),Ci.forEach(t),Ei.forEach(t),Gs=h(Un),Po=s(Un,"LI",{});var zi=a(Po);Jt=s(zi,"A",{href:!0});var qi=a(Jt);Ms=l(qi,"Causal language modeling task guide"),qi.forEach(t),zi.forEach(t),Un.forEach(t),Gn=h(o),te=s(o,"H2",{class:!0});var Vn=a(te);ye=s(Vn,"A",{id:!0,class:!0,href:!0});var ji=a(ye);wo=s(ji,"SPAN",{});var Ai=a(wo);y(et.$$.fragment,Ai),Ai.forEach(t),ji.forEach(t),Fs=h(Vn),$o=s(Vn,"SPAN",{});var Ii=a($o);Es=l(Ii,"GPTNeoConfig"),Ii.forEach(t),Vn.forEach(t),Mn=h(o),I=s(o,"DIV",{class:!0});var Se=a(I);y(tt.$$.fragment,Se),Cs=h(Se),oe=s(Se,"P",{});var io=a(oe);zs=l(io,"This is the configuration class to store the configuration of a "),Rt=s(io,"A",{href:!0});var Li=a(Rt);qs=l(Li,"GPTNeoModel"),Li.forEach(t),js=l(io,`. It is used to instantiate a GPT
Neo 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 GPTNeo
`),ot=s(io,"A",{href:!0,rel:!0});var Si=a(ot);As=l(Si,"EleutherAI/gpt-neo-1.3B"),Si.forEach(t),Is=l(io," architecture."),io.forEach(t),Ls=h(Se),ne=s(Se,"P",{});var lo=a(ne);Ss=l(lo,"Configuration objects inherit from "),Xt=s(lo,"A",{href:!0});var Oi=a(Xt);Os=l(Oi,"PretrainedConfig"),Oi.forEach(t),Ds=l(lo,` and can be used to control the model outputs. Read the
documentation from `),Kt=s(lo,"A",{href:!0});var Di=a(Kt);Bs=l(Di,"PretrainedConfig"),Di.forEach(t),Ws=l(lo," for more information."),lo.forEach(t),Hs=h(Se),y(ke.$$.fragment,Se),Se.forEach(t),Fn=h(o),se=s(o,"H2",{class:!0});var Jn=a(se);Pe=s(Jn,"A",{id:!0,class:!0,href:!0});var Bi=a(Pe);No=s(Bi,"SPAN",{});var Wi=a(No);y(nt.$$.fragment,Wi),Wi.forEach(t),Bi.forEach(t),Us=h(Jn),xo=s(Jn,"SPAN",{});var Hi=a(xo);Vs=l(Hi,"GPTNeoModel"),Hi.forEach(t),Jn.forEach(t),En=h(o),E=s(o,"DIV",{class:!0});var J=a(E);y(st.$$.fragment,J),Js=h(J),Go=s(J,"P",{});var Ui=a(Go);Rs=l(Ui,"The bare GPT Neo Model transformer outputting raw hidden-states without any specific head on top."),Ui.forEach(t),Xs=h(J),at=s(J,"P",{});var Rn=a(at);Ks=l(Rn,"This model inherits from "),Qt=s(Rn,"A",{href:!0});var Vi=a(Qt);Qs=l(Vi,"PreTrainedModel"),Vi.forEach(t),Ys=l(Rn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Rn.forEach(t),Zs=h(J),rt=s(J,"P",{});var Xn=a(rt);ea=l(Xn,"This model is also a PyTorch "),it=s(Xn,"A",{href:!0,rel:!0});var Ji=a(it);ta=l(Ji,"torch.nn.Module"),Ji.forEach(t),oa=l(Xn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Xn.forEach(t),na=h(J),S=s(J,"DIV",{class:!0});var Oe=a(S);y(lt.$$.fragment,Oe),sa=h(Oe),ae=s(Oe,"P",{});var co=a(ae);aa=l(co,"The "),Yt=s(co,"A",{href:!0});var Ri=a(Yt);ra=l(Ri,"GPTNeoModel"),Ri.forEach(t),ia=l(co," forward method, overrides the "),Mo=s(co,"CODE",{});var Xi=a(Mo);la=l(Xi,"__call__"),Xi.forEach(t),da=l(co," special method."),co.forEach(t),ca=h(Oe),y(we.$$.fragment,Oe),pa=h(Oe),y($e.$$.fragment,Oe),Oe.forEach(t),J.forEach(t),Cn=h(o),re=s(o,"H2",{class:!0});var Kn=a(re);Ne=s(Kn,"A",{id:!0,class:!0,href:!0});var Ki=a(Ne);Fo=s(Ki,"SPAN",{});var Qi=a(Fo);y(dt.$$.fragment,Qi),Qi.forEach(t),Ki.forEach(t),ha=h(Kn),Eo=s(Kn,"SPAN",{});var Yi=a(Eo);ua=l(Yi,"GPTNeoForCausalLM"),Yi.forEach(t),Kn.forEach(t),zn=h(o),C=s(o,"DIV",{class:!0});var R=a(C);y(ct.$$.fragment,R),ma=h(R),Co=s(R,"P",{});var Zi=a(Co);fa=l(Zi,`The GPT Neo Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),Zi.forEach(t),ga=h(R),pt=s(R,"P",{});var Qn=a(pt);_a=l(Qn,"This model inherits from "),Zt=s(Qn,"A",{href:!0});var el=a(Zt);va=l(el,"PreTrainedModel"),el.forEach(t),Ta=l(Qn,`. 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.)`),Qn.forEach(t),ba=h(R),ht=s(R,"P",{});var Yn=a(ht);ya=l(Yn,"This model is also a PyTorch "),ut=s(Yn,"A",{href:!0,rel:!0});var tl=a(ut);ka=l(tl,"torch.nn.Module"),tl.forEach(t),Pa=l(Yn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Yn.forEach(t),wa=h(R),O=s(R,"DIV",{class:!0});var De=a(O);y(mt.$$.fragment,De),$a=h(De),ie=s(De,"P",{});var po=a(ie);Na=l(po,"The "),eo=s(po,"A",{href:!0});var ol=a(eo);xa=l(ol,"GPTNeoForCausalLM"),ol.forEach(t),Ga=l(po," forward method, overrides the "),zo=s(po,"CODE",{});var nl=a(zo);Ma=l(nl,"__call__"),nl.forEach(t),Fa=l(po," special method."),po.forEach(t),Ea=h(De),y(xe.$$.fragment,De),Ca=h(De),y(Ge.$$.fragment,De),De.forEach(t),R.forEach(t),qn=h(o),le=s(o,"H2",{class:!0});var Zn=a(le);Me=s(Zn,"A",{id:!0,class:!0,href:!0});var sl=a(Me);qo=s(sl,"SPAN",{});var al=a(qo);y(ft.$$.fragment,al),al.forEach(t),sl.forEach(t),za=h(Zn),jo=s(Zn,"SPAN",{});var rl=a(jo);qa=l(rl,"GPTNeoForSequenceClassification"),rl.forEach(t),Zn.forEach(t),jn=h(o),G=s(o,"DIV",{class:!0});var q=a(G);y(gt.$$.fragment,q),ja=h(q),Ao=s(q,"P",{});var il=a(Ao);Aa=l(il,"The GPTNeo Model transformer with a sequence classification head on top (linear layer)."),il.forEach(t),Ia=h(q),to=s(q,"P",{});var ki=a(to);oo=s(ki,"A",{href:!0});var ll=a(oo);La=l(ll,"GPTNeoForSequenceClassification"),ll.forEach(t),Sa=l(ki,` uses the last token in order to do the classification, as other causal models
(e.g. GPT-1) do.`),ki.forEach(t),Oa=h(q),L=s(q,"P",{});var X=a(L);Da=l(X,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Io=s(X,"CODE",{});var dl=a(Io);Ba=l(dl,"pad_token_id"),dl.forEach(t),Wa=l(X,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Lo=s(X,"CODE",{});var cl=a(Lo);Ha=l(cl,"pad_token_id"),cl.forEach(t),Ua=l(X,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),So=s(X,"CODE",{});var pl=a(So);Va=l(pl,"inputs_embeds"),pl.forEach(t),Ja=l(X," are passed instead of "),Oo=s(X,"CODE",{});var hl=a(Oo);Ra=l(hl,"input_ids"),hl.forEach(t),Xa=l(X,`, it does the same (take the last value in
each row of the batch).`),X.forEach(t),Ka=h(q),_t=s(q,"P",{});var es=a(_t);Qa=l(es,"This model inherits from "),no=s(es,"A",{href:!0});var ul=a(no);Ya=l(ul,"PreTrainedModel"),ul.forEach(t),Za=l(es,`. 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.)`),es.forEach(t),er=h(q),vt=s(q,"P",{});var ts=a(vt);tr=l(ts,"This model is also a PyTorch "),Tt=s(ts,"A",{href:!0,rel:!0});var ml=a(Tt);or=l(ml,"torch.nn.Module"),ml.forEach(t),nr=l(ts,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ts.forEach(t),sr=h(q),z=s(q,"DIV",{class:!0});var K=a(z);y(bt.$$.fragment,K),ar=h(K),de=s(K,"P",{});var ho=a(de);rr=l(ho,"The "),so=s(ho,"A",{href:!0});var fl=a(so);ir=l(fl,"GPTNeoForSequenceClassification"),fl.forEach(t),lr=l(ho," forward method, overrides the "),Do=s(ho,"CODE",{});var gl=a(Do);dr=l(gl,"__call__"),gl.forEach(t),cr=l(ho," special method."),ho.forEach(t),pr=h(K),y(Fe.$$.fragment,K),hr=h(K),y(Ee.$$.fragment,K),ur=h(K),y(Ce.$$.fragment,K),K.forEach(t),q.forEach(t),An=h(o),ce=s(o,"H2",{class:!0});var os=a(ce);ze=s(os,"A",{id:!0,class:!0,href:!0});var _l=a(ze);Bo=s(_l,"SPAN",{});var vl=a(Bo);y(yt.$$.fragment,vl),vl.forEach(t),_l.forEach(t),mr=h(os),Wo=s(os,"SPAN",{});var Tl=a(Wo);fr=l(Tl,"FlaxGPTNeoModel"),Tl.forEach(t),os.forEach(t),In=h(o),M=s(o,"DIV",{class:!0});var j=a(M);y(kt.$$.fragment,j),gr=h(j),Ho=s(j,"P",{});var bl=a(Ho);_r=l(bl,"The bare GPTNeo Model transformer outputting raw hidden-states without any specific head on top."),bl.forEach(t),vr=h(j),Pt=s(j,"P",{});var ns=a(Pt);Tr=l(ns,"This model inherits from "),ao=s(ns,"A",{href:!0});var yl=a(ao);br=l(yl,"FlaxPreTrainedModel"),yl.forEach(t),yr=l(ns,`. 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.)`),ns.forEach(t),kr=h(j),wt=s(j,"P",{});var ss=a(wt);Pr=l(ss,`This model is also a Flax Linen
`),$t=s(ss,"A",{href:!0,rel:!0});var kl=a($t);wr=l(kl,"flax.nn.Module"),kl.forEach(t),$r=l(ss,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),ss.forEach(t),Nr=h(j),Uo=s(j,"P",{});var Pl=a(Uo);xr=l(Pl,"Finally, this model supports inherent JAX features such as:"),Pl.forEach(t),Gr=h(j),W=s(j,"UL",{});var Be=a(W);Vo=s(Be,"LI",{});var wl=a(Vo);Nt=s(wl,"A",{href:!0,rel:!0});var $l=a(Nt);Mr=l($l,"Just-In-Time (JIT) compilation"),$l.forEach(t),wl.forEach(t),Fr=h(Be),Jo=s(Be,"LI",{});var Nl=a(Jo);xt=s(Nl,"A",{href:!0,rel:!0});var xl=a(xt);Er=l(xl,"Automatic Differentiation"),xl.forEach(t),Nl.forEach(t),Cr=h(Be),Ro=s(Be,"LI",{});var Gl=a(Ro);Gt=s(Gl,"A",{href:!0,rel:!0});var Ml=a(Gt);zr=l(Ml,"Vectorization"),Ml.forEach(t),Gl.forEach(t),qr=h(Be),Xo=s(Be,"LI",{});var Fl=a(Xo);Mt=s(Fl,"A",{href:!0,rel:!0});var El=a(Mt);jr=l(El,"Parallelization"),El.forEach(t),Fl.forEach(t),Be.forEach(t),Ar=h(j),D=s(j,"DIV",{class:!0});var We=a(D);y(Ft.$$.fragment,We),Ir=h(We),pe=s(We,"P",{});var uo=a(pe);Lr=l(uo,"The "),Ko=s(uo,"CODE",{});var Cl=a(Ko);Sr=l(Cl,"FlaxGPTNeoPreTrainedModel"),Cl.forEach(t),Or=l(uo," forward method, overrides the "),Qo=s(uo,"CODE",{});var zl=a(Qo);Dr=l(zl,"__call__"),zl.forEach(t),Br=l(uo," special method."),uo.forEach(t),Wr=h(We),y(qe.$$.fragment,We),Hr=h(We),y(je.$$.fragment,We),We.forEach(t),j.forEach(t),Ln=h(o),he=s(o,"H2",{class:!0});var as=a(he);Ae=s(as,"A",{id:!0,class:!0,href:!0});var ql=a(Ae);Yo=s(ql,"SPAN",{});var jl=a(Yo);y(Et.$$.fragment,jl),jl.forEach(t),ql.forEach(t),Ur=h(as),Zo=s(as,"SPAN",{});var Al=a(Zo);Vr=l(Al,"FlaxGPTNeoForCausalLM"),Al.forEach(t),as.forEach(t),Sn=h(o),F=s(o,"DIV",{class:!0});var A=a(F);y(Ct.$$.fragment,A),Jr=h(A),en=s(A,"P",{});var Il=a(en);Rr=l(Il,`The GPTNeo Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),Il.forEach(t),Xr=h(A),zt=s(A,"P",{});var rs=a(zt);Kr=l(rs,"This model inherits from "),ro=s(rs,"A",{href:!0});var Ll=a(ro);Qr=l(Ll,"FlaxPreTrainedModel"),Ll.forEach(t),Yr=l(rs,`. 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.)`),rs.forEach(t),Zr=h(A),qt=s(A,"P",{});var is=a(qt);ei=l(is,`This model is also a Flax Linen
`),jt=s(is,"A",{href:!0,rel:!0});var Sl=a(jt);ti=l(Sl,"flax.nn.Module"),Sl.forEach(t),oi=l(is,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),is.forEach(t),ni=h(A),tn=s(A,"P",{});var Ol=a(tn);si=l(Ol,"Finally, this model supports inherent JAX features such as:"),Ol.forEach(t),ai=h(A),H=s(A,"UL",{});var He=a(H);on=s(He,"LI",{});var Dl=a(on);At=s(Dl,"A",{href:!0,rel:!0});var Bl=a(At);ri=l(Bl,"Just-In-Time (JIT) compilation"),Bl.forEach(t),Dl.forEach(t),ii=h(He),nn=s(He,"LI",{});var Wl=a(nn);It=s(Wl,"A",{href:!0,rel:!0});var Hl=a(It);li=l(Hl,"Automatic Differentiation"),Hl.forEach(t),Wl.forEach(t),di=h(He),sn=s(He,"LI",{});var Ul=a(sn);Lt=s(Ul,"A",{href:!0,rel:!0});var Vl=a(Lt);ci=l(Vl,"Vectorization"),Vl.forEach(t),Ul.forEach(t),pi=h(He),an=s(He,"LI",{});var Jl=a(an);St=s(Jl,"A",{href:!0,rel:!0});var Rl=a(St);hi=l(Rl,"Parallelization"),Rl.forEach(t),Jl.forEach(t),He.forEach(t),ui=h(A),B=s(A,"DIV",{class:!0});var Ue=a(B);y(Ot.$$.fragment,Ue),mi=h(Ue),ue=s(Ue,"P",{});var mo=a(ue);fi=l(mo,"The "),rn=s(mo,"CODE",{});var Xl=a(rn);gi=l(Xl,"FlaxGPTNeoPreTrainedModel"),Xl.forEach(t),_i=l(mo," forward method, overrides the "),ln=s(mo,"CODE",{});var Kl=a(ln);vi=l(Kl,"__call__"),Kl.forEach(t),Ti=l(mo," special method."),mo.forEach(t),bi=h(Ue),y(Ie.$$.fragment,Ue),yi=h(Ue),y(Le.$$.fragment,Ue),Ue.forEach(t),A.forEach(t),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(fd)),c(m,"id","gpt-neo"),c(m,"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"),c(m,"href","#gpt-neo"),c(f,"class","relative group"),c(fe,"id","overview"),c(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"),c(fe,"href","#overview"),c(Y,"class","relative group"),c(Re,"href","https://github.com/EleutherAI/gpt-neo"),c(Re,"rel","nofollow"),c(Xe,"href","https://pile.eleuther.ai/"),c(Xe,"rel","nofollow"),c(Ke,"href","https://huggingface.co/valhalla"),c(Ke,"rel","nofollow"),c(_e,"id","generation"),c(_e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(_e,"href","#generation"),c(Z,"class","relative group"),c(Te,"id","documentation-resources"),c(Te,"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"),c(Te,"href","#documentation-resources"),c(ee,"class","relative group"),c(Vt,"href","./tasks/sequence_classification"),c(Jt,"href","./tasks/language_modeling"),c(ye,"id","transformers.GPTNeoConfig"),c(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ye,"href","#transformers.GPTNeoConfig"),c(te,"class","relative group"),c(Rt,"href","/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoModel"),c(ot,"href","https://huggingface.co/EleutherAI/gpt-neo-1.3B"),c(ot,"rel","nofollow"),c(Xt,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),c(Kt,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),c(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Pe,"id","transformers.GPTNeoModel"),c(Pe,"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"),c(Pe,"href","#transformers.GPTNeoModel"),c(se,"class","relative group"),c(Qt,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),c(it,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(it,"rel","nofollow"),c(Yt,"href","/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoModel"),c(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ne,"id","transformers.GPTNeoForCausalLM"),c(Ne,"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"),c(Ne,"href","#transformers.GPTNeoForCausalLM"),c(re,"class","relative group"),c(Zt,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),c(ut,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(ut,"rel","nofollow"),c(eo,"href","/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoForCausalLM"),c(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Me,"id","transformers.GPTNeoForSequenceClassification"),c(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"),c(Me,"href","#transformers.GPTNeoForSequenceClassification"),c(le,"class","relative group"),c(oo,"href","/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoForSequenceClassification"),c(no,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),c(Tt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Tt,"rel","nofollow"),c(so,"href","/docs/transformers/v4.27.1/en/model_doc/gpt_neo#transformers.GPTNeoForSequenceClassification"),c(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ze,"id","transformers.FlaxGPTNeoModel"),c(ze,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ze,"href","#transformers.FlaxGPTNeoModel"),c(ce,"class","relative group"),c(ao,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel"),c($t,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),c($t,"rel","nofollow"),c(Nt,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),c(Nt,"rel","nofollow"),c(xt,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),c(xt,"rel","nofollow"),c(Gt,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),c(Gt,"rel","nofollow"),c(Mt,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),c(Mt,"rel","nofollow"),c(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ae,"id","transformers.FlaxGPTNeoForCausalLM"),c(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"),c(Ae,"href","#transformers.FlaxGPTNeoForCausalLM"),c(he,"class","relative group"),c(ro,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel"),c(jt,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),c(jt,"rel","nofollow"),c(At,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),c(At,"rel","nofollow"),c(It,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),c(It,"rel","nofollow"),c(Lt,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),c(Lt,"rel","nofollow"),c(St,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),c(St,"rel","nofollow"),c(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,g){e(document.head,d),_(o,T,g),_(o,f,g),e(f,m),e(m,v),k(r,v,null),e(f,u),e(f,x),e(x,ls),_(o,Tn,g),_(o,Y,g),e(Y,fe),e(fe,fo),k(Je,fo,null),e(Y,ds),e(Y,go),e(go,cs),_(o,bn,g),_(o,V,g),e(V,ps),e(V,Re),e(Re,hs),e(V,us),e(V,Xe),e(Xe,ms),e(V,fs),_(o,yn,g),_(o,Ut,g),e(Ut,gs),_(o,kn,g),_(o,ge,g),e(ge,_s),e(ge,Ke),e(Ke,vs),e(ge,Ts),_(o,Pn,g),_(o,Z,g),e(Z,_e),e(_e,_o),k(Qe,_o,null),e(Z,bs),e(Z,vo),e(vo,ys),_(o,wn,g),_(o,ve,g),e(ve,ks),e(ve,To),e(To,Ps),e(ve,ws),_(o,$n,g),k(Ye,o,g),_(o,Nn,g),_(o,ee,g),e(ee,Te),e(Te,bo),k(Ze,bo,null),e(ee,$s),e(ee,yo),e(yo,Ns),_(o,xn,g),_(o,be,g),e(be,ko),e(ko,Vt),e(Vt,xs),e(be,Gs),e(be,Po),e(Po,Jt),e(Jt,Ms),_(o,Gn,g),_(o,te,g),e(te,ye),e(ye,wo),k(et,wo,null),e(te,Fs),e(te,$o),e($o,Es),_(o,Mn,g),_(o,I,g),k(tt,I,null),e(I,Cs),e(I,oe),e(oe,zs),e(oe,Rt),e(Rt,qs),e(oe,js),e(oe,ot),e(ot,As),e(oe,Is),e(I,Ls),e(I,ne),e(ne,Ss),e(ne,Xt),e(Xt,Os),e(ne,Ds),e(ne,Kt),e(Kt,Bs),e(ne,Ws),e(I,Hs),k(ke,I,null),_(o,Fn,g),_(o,se,g),e(se,Pe),e(Pe,No),k(nt,No,null),e(se,Us),e(se,xo),e(xo,Vs),_(o,En,g),_(o,E,g),k(st,E,null),e(E,Js),e(E,Go),e(Go,Rs),e(E,Xs),e(E,at),e(at,Ks),e(at,Qt),e(Qt,Qs),e(at,Ys),e(E,Zs),e(E,rt),e(rt,ea),e(rt,it),e(it,ta),e(rt,oa),e(E,na),e(E,S),k(lt,S,null),e(S,sa),e(S,ae),e(ae,aa),e(ae,Yt),e(Yt,ra),e(ae,ia),e(ae,Mo),e(Mo,la),e(ae,da),e(S,ca),k(we,S,null),e(S,pa),k($e,S,null),_(o,Cn,g),_(o,re,g),e(re,Ne),e(Ne,Fo),k(dt,Fo,null),e(re,ha),e(re,Eo),e(Eo,ua),_(o,zn,g),_(o,C,g),k(ct,C,null),e(C,ma),e(C,Co),e(Co,fa),e(C,ga),e(C,pt),e(pt,_a),e(pt,Zt),e(Zt,va),e(pt,Ta),e(C,ba),e(C,ht),e(ht,ya),e(ht,ut),e(ut,ka),e(ht,Pa),e(C,wa),e(C,O),k(mt,O,null),e(O,$a),e(O,ie),e(ie,Na),e(ie,eo),e(eo,xa),e(ie,Ga),e(ie,zo),e(zo,Ma),e(ie,Fa),e(O,Ea),k(xe,O,null),e(O,Ca),k(Ge,O,null),_(o,qn,g),_(o,le,g),e(le,Me),e(Me,qo),k(ft,qo,null),e(le,za),e(le,jo),e(jo,qa),_(o,jn,g),_(o,G,g),k(gt,G,null),e(G,ja),e(G,Ao),e(Ao,Aa),e(G,Ia),e(G,to),e(to,oo),e(oo,La),e(to,Sa),e(G,Oa),e(G,L),e(L,Da),e(L,Io),e(Io,Ba),e(L,Wa),e(L,Lo),e(Lo,Ha),e(L,Ua),e(L,So),e(So,Va),e(L,Ja),e(L,Oo),e(Oo,Ra),e(L,Xa),e(G,Ka),e(G,_t),e(_t,Qa),e(_t,no),e(no,Ya),e(_t,Za),e(G,er),e(G,vt),e(vt,tr),e(vt,Tt),e(Tt,or),e(vt,nr),e(G,sr),e(G,z),k(bt,z,null),e(z,ar),e(z,de),e(de,rr),e(de,so),e(so,ir),e(de,lr),e(de,Do),e(Do,dr),e(de,cr),e(z,pr),k(Fe,z,null),e(z,hr),k(Ee,z,null),e(z,ur),k(Ce,z,null),_(o,An,g),_(o,ce,g),e(ce,ze),e(ze,Bo),k(yt,Bo,null),e(ce,mr),e(ce,Wo),e(Wo,fr),_(o,In,g),_(o,M,g),k(kt,M,null),e(M,gr),e(M,Ho),e(Ho,_r),e(M,vr),e(M,Pt),e(Pt,Tr),e(Pt,ao),e(ao,br),e(Pt,yr),e(M,kr),e(M,wt),e(wt,Pr),e(wt,$t),e($t,wr),e(wt,$r),e(M,Nr),e(M,Uo),e(Uo,xr),e(M,Gr),e(M,W),e(W,Vo),e(Vo,Nt),e(Nt,Mr),e(W,Fr),e(W,Jo),e(Jo,xt),e(xt,Er),e(W,Cr),e(W,Ro),e(Ro,Gt),e(Gt,zr),e(W,qr),e(W,Xo),e(Xo,Mt),e(Mt,jr),e(M,Ar),e(M,D),k(Ft,D,null),e(D,Ir),e(D,pe),e(pe,Lr),e(pe,Ko),e(Ko,Sr),e(pe,Or),e(pe,Qo),e(Qo,Dr),e(pe,Br),e(D,Wr),k(qe,D,null),e(D,Hr),k(je,D,null),_(o,Ln,g),_(o,he,g),e(he,Ae),e(Ae,Yo),k(Et,Yo,null),e(he,Ur),e(he,Zo),e(Zo,Vr),_(o,Sn,g),_(o,F,g),k(Ct,F,null),e(F,Jr),e(F,en),e(en,Rr),e(F,Xr),e(F,zt),e(zt,Kr),e(zt,ro),e(ro,Qr),e(zt,Yr),e(F,Zr),e(F,qt),e(qt,ei),e(qt,jt),e(jt,ti),e(qt,oi),e(F,ni),e(F,tn),e(tn,si),e(F,ai),e(F,H),e(H,on),e(on,At),e(At,ri),e(H,ii),e(H,nn),e(nn,It),e(It,li),e(H,di),e(H,sn),e(sn,Lt),e(Lt,ci),e(H,pi),e(H,an),e(an,St),e(St,hi),e(F,ui),e(F,B),k(Ot,B,null),e(B,mi),e(B,ue),e(ue,fi),e(ue,rn),e(rn,gi),e(ue,_i),e(ue,ln),e(ln,vi),e(ue,Ti),e(B,bi),k(Ie,B,null),e(B,yi),k(Le,B,null),On=!0},p(o,[g]){const Dt={};g&2&&(Dt.$$scope={dirty:g,ctx:o}),ke.$set(Dt);const dn={};g&2&&(dn.$$scope={dirty:g,ctx:o}),we.$set(dn);const cn={};g&2&&(cn.$$scope={dirty:g,ctx:o}),$e.$set(cn);const pn={};g&2&&(pn.$$scope={dirty:g,ctx:o}),xe.$set(pn);const Bt={};g&2&&(Bt.$$scope={dirty:g,ctx:o}),Ge.$set(Bt);const hn={};g&2&&(hn.$$scope={dirty:g,ctx:o}),Fe.$set(hn);const un={};g&2&&(un.$$scope={dirty:g,ctx:o}),Ee.$set(un);const mn={};g&2&&(mn.$$scope={dirty:g,ctx:o}),Ce.$set(mn);const me={};g&2&&(me.$$scope={dirty:g,ctx:o}),qe.$set(me);const fn={};g&2&&(fn.$$scope={dirty:g,ctx:o}),je.$set(fn);const gn={};g&2&&(gn.$$scope={dirty:g,ctx:o}),Ie.$set(gn);const _n={};g&2&&(_n.$$scope={dirty:g,ctx:o}),Le.$set(_n)},i(o){On||(P(r.$$.fragment,o),P(Je.$$.fragment,o),P(Qe.$$.fragment,o),P(Ye.$$.fragment,o),P(Ze.$$.fragment,o),P(et.$$.fragment,o),P(tt.$$.fragment,o),P(ke.$$.fragment,o),P(nt.$$.fragment,o),P(st.$$.fragment,o),P(lt.$$.fragment,o),P(we.$$.fragment,o),P($e.$$.fragment,o),P(dt.$$.fragment,o),P(ct.$$.fragment,o),P(mt.$$.fragment,o),P(xe.$$.fragment,o),P(Ge.$$.fragment,o),P(ft.$$.fragment,o),P(gt.$$.fragment,o),P(bt.$$.fragment,o),P(Fe.$$.fragment,o),P(Ee.$$.fragment,o),P(Ce.$$.fragment,o),P(yt.$$.fragment,o),P(kt.$$.fragment,o),P(Ft.$$.fragment,o),P(qe.$$.fragment,o),P(je.$$.fragment,o),P(Et.$$.fragment,o),P(Ct.$$.fragment,o),P(Ot.$$.fragment,o),P(Ie.$$.fragment,o),P(Le.$$.fragment,o),On=!0)},o(o){w(r.$$.fragment,o),w(Je.$$.fragment,o),w(Qe.$$.fragment,o),w(Ye.$$.fragment,o),w(Ze.$$.fragment,o),w(et.$$.fragment,o),w(tt.$$.fragment,o),w(ke.$$.fragment,o),w(nt.$$.fragment,o),w(st.$$.fragment,o),w(lt.$$.fragment,o),w(we.$$.fragment,o),w($e.$$.fragment,o),w(dt.$$.fragment,o),w(ct.$$.fragment,o),w(mt.$$.fragment,o),w(xe.$$.fragment,o),w(Ge.$$.fragment,o),w(ft.$$.fragment,o),w(gt.$$.fragment,o),w(bt.$$.fragment,o),w(Fe.$$.fragment,o),w(Ee.$$.fragment,o),w(Ce.$$.fragment,o),w(yt.$$.fragment,o),w(kt.$$.fragment,o),w(Ft.$$.fragment,o),w(qe.$$.fragment,o),w(je.$$.fragment,o),w(Et.$$.fragment,o),w(Ct.$$.fragment,o),w(Ot.$$.fragment,o),w(Ie.$$.fragment,o),w(Le.$$.fragment,o),On=!1},d(o){t(d),o&&t(T),o&&t(f),$(r),o&&t(Tn),o&&t(Y),$(Je),o&&t(bn),o&&t(V),o&&t(yn),o&&t(Ut),o&&t(kn),o&&t(ge),o&&t(Pn),o&&t(Z),$(Qe),o&&t(wn),o&&t(ve),o&&t($n),$(Ye,o),o&&t(Nn),o&&t(ee),$(Ze),o&&t(xn),o&&t(be),o&&t(Gn),o&&t(te),$(et),o&&t(Mn),o&&t(I),$(tt),$(ke),o&&t(Fn),o&&t(se),$(nt),o&&t(En),o&&t(E),$(st),$(lt),$(we),$($e),o&&t(Cn),o&&t(re),$(dt),o&&t(zn),o&&t(C),$(ct),$(mt),$(xe),$(Ge),o&&t(qn),o&&t(le),$(ft),o&&t(jn),o&&t(G),$(gt),$(bt),$(Fe),$(Ee),$(Ce),o&&t(An),o&&t(ce),$(yt),o&&t(In),o&&t(M),$(kt),$(Ft),$(qe),$(je),o&&t(Ln),o&&t(he),$(Et),o&&t(Sn),o&&t(F),$(Ct),$(Ot),$(Ie),$(Le)}}}const fd={local:"gpt-neo",sections:[{local:"overview",sections:[{local:"generation",title:"Generation"}],title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.GPTNeoConfig",title:"GPTNeoConfig"},{local:"transformers.GPTNeoModel",title:"GPTNeoModel"},{local:"transformers.GPTNeoForCausalLM",title:"GPTNeoForCausalLM"},{local:"transformers.GPTNeoForSequenceClassification",title:"GPTNeoForSequenceClassification"},{local:"transformers.FlaxGPTNeoModel",title:"FlaxGPTNeoModel"},{local:"transformers.FlaxGPTNeoForCausalLM",title:"FlaxGPTNeoForCausalLM"}],title:"GPT Neo"};function gd(N){return td(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Pd extends Ql{constructor(d){super();Yl(this,d,gd,md,Zl,{})}}export{Pd as default,fd as metadata};
