import{S as Al,i as Sl,s as Ql,e as a,k as u,w as y,t as i,M as Ll,c as r,d as o,m as f,a as l,x as w,h as d,b as g,G as e,g as T,y as M,q as v,o as k,B as G,v as Hl,L as De}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ye}from"../../chunks/Tip-hf-doc-builder.js";import{D as R}from"../../chunks/Docstring-hf-doc-builder.js";import{C as D}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Q}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Oe}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Yl($){let s,b;return s=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVE5lb1hDb25maWclMkMlMjBHUFROZW9YTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwR1BUTmVvWCUyMGdwdC1uZW94LTIwYiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBHUFROZW9YQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMGdwdC1uZW94LTIwYiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwR1BUTmVvWE1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTNeoXConfig, GPTNeoXModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a GPTNeoX gpt-neox-20b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = GPTNeoXConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the gpt-neox-20b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoXModel(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(){y(s.$$.fragment)},l(c){w(s.$$.fragment,c)},m(c,h){M(s,c,h),b=!0},p:De,i(c){b||(v(s.$$.fragment,c),b=!0)},o(c){k(s.$$.fragment,c),b=!1},d(c){G(s,c)}}}function Ol($){let s,b,c,h,_;return h=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVE5lb1hUb2tlbml6ZXJGYXN0JTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwR1BUTmVvWFRva2VuaXplckZhc3QuZnJvbV9wcmV0cmFpbmVkKCUyMmdwdDIlMjIpJTBBdG9rZW5pemVyKCUyMkhlbGxvJTIwd29ybGQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTBBdG9rZW5pemVyKCUyMiUyMEhlbGxvJTIwd29ybGQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTNeoXTokenizerFast

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = GPTNeoXTokenizerFast.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">15496</span>, <span class="hljs-number">995</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot; Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">18435</span>, <span class="hljs-number">995</span>]`}}),{c(){s=a("p"),b=i("be encoded differently whether it is at the beginning of the sentence (without space) or not:"),c=u(),y(h.$$.fragment)},l(n){s=r(n,"P",{});var p=l(s);b=d(p,"be encoded differently whether it is at the beginning of the sentence (without space) or not:"),p.forEach(o),c=f(n),w(h.$$.fragment,n)},m(n,p){T(n,s,p),e(s,b),T(n,c,p),M(h,n,p),_=!0},p:De,i(n){_||(v(h.$$.fragment,n),_=!0)},o(n){k(h.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(c),G(h,n)}}}function Dl($){let s,b,c,h,_,n,p,N;return{c(){s=a("p"),b=i("When used with "),c=a("code"),h=i("is_split_into_words=True"),_=i(", this tokenizer needs to be instantiated with "),n=a("code"),p=i("add_prefix_space=True"),N=i(".")},l(j){s=r(j,"P",{});var X=l(s);b=d(X,"When used with "),c=r(X,"CODE",{});var F=l(c);h=d(F,"is_split_into_words=True"),F.forEach(o),_=d(X,", this tokenizer needs to be instantiated with "),n=r(X,"CODE",{});var J=l(n);p=d(J,"add_prefix_space=True"),J.forEach(o),N=d(X,"."),X.forEach(o)},m(j,X){T(j,s,X),e(s,b),e(s,c),e(c,h),e(s,_),e(s,n),e(n,p),e(s,N)},d(j){j&&o(s)}}}function Kl($){let s,b,c,h,_;return{c(){s=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a("code"),h=i("Module"),_=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(n){s=r(n,"P",{});var p=l(s);b=d(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=r(p,"CODE",{});var N=l(c);h=d(N,"Module"),N.forEach(o),_=d(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(n,p){T(n,s,p),e(s,b),e(s,c),e(c,h),e(s,_)},d(n){n&&o(s)}}}function ei($){let s,b,c,h,_,n,p,N;return{c(){s=a("p"),b=i(`This example uses a random model as the real ones are all very big. To get proper results, you should use
EleutherAI/gpt-neox-20b instead of trl-internal-testing/tiny-random-GPTNeoXForCausalLM. If you get out-of-memory when loading that checkpoint, you can try
adding `),c=a("code"),h=i('device_map="auto"'),_=i(" in the "),n=a("code"),p=i("from_pretrained"),N=i(" call.")},l(j){s=r(j,"P",{});var X=l(s);b=d(X,`This example uses a random model as the real ones are all very big. To get proper results, you should use
EleutherAI/gpt-neox-20b instead of trl-internal-testing/tiny-random-GPTNeoXForCausalLM. If you get out-of-memory when loading that checkpoint, you can try
adding `),c=r(X,"CODE",{});var F=l(c);h=d(F,'device_map="auto"'),F.forEach(o),_=d(X," in the "),n=r(X,"CODE",{});var J=l(n);p=d(J,"from_pretrained"),J.forEach(o),N=d(X," call."),X.forEach(o)},m(j,X){T(j,s,X),e(s,b),e(s,c),e(c,h),e(s,_),e(s,n),e(n,p),e(s,N)},d(j){j&&o(s)}}}function ti($){let s,b,c,h,_;return h=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHUFROZW9YTW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnRybC1pbnRlcm5hbC10ZXN0aW5nJTJGdGlueS1yYW5kb20tR1BUTmVvWEZvckNhdXNhbExNJTIyKSUwQW1vZGVsJTIwJTNEJTIwR1BUTmVvWE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJ0cmwtaW50ZXJuYWwtdGVzdGluZyUyRnRpbnktcmFuZG9tLUdQVE5lb1hGb3JDYXVzYWxMTSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTNeoXModel
<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;trl-internal-testing/tiny-random-GPTNeoXForCausalLM&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoXModel.from_pretrained(<span class="hljs-string">&quot;trl-internal-testing/tiny-random-GPTNeoXForCausalLM&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(){s=a("p"),b=i("Example:"),c=u(),y(h.$$.fragment)},l(n){s=r(n,"P",{});var p=l(s);b=d(p,"Example:"),p.forEach(o),c=f(n),w(h.$$.fragment,n)},m(n,p){T(n,s,p),e(s,b),T(n,c,p),M(h,n,p),_=!0},p:De,i(n){_||(v(h.$$.fragment,n),_=!0)},o(n){k(h.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(c),G(h,n)}}}function oi($){let s,b,c,h,_;return{c(){s=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a("code"),h=i("Module"),_=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(n){s=r(n,"P",{});var p=l(s);b=d(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=r(p,"CODE",{});var N=l(c);h=d(N,"Module"),N.forEach(o),_=d(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(n,p){T(n,s,p),e(s,b),e(s,c),e(c,h),e(s,_)},d(n){n&&o(s)}}}function ni($){let s,b,c,h,_;return h=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHUFROZW9YRm9yQ2F1c2FsTE0lMkMlMjBHUFROZW9YQ29uZmlnJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJFbGV1dGhlckFJJTJGZ3B0LW5lb3gtMjBiJTIyKSUwQWNvbmZpZyUyMCUzRCUyMEdQVE5lb1hDb25maWcuZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtbmVveC0yMGIlMjIpJTBBY29uZmlnLmlzX2RlY29kZXIlMjAlM0QlMjBUcnVlJTBBbW9kZWwlMjAlM0QlMjBHUFROZW9YRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtbmVveC0yMGIlMjIlMkMlMjBjb25maWclM0Rjb25maWcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFwcmVkaWN0aW9uX2xvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTNeoXForCausalLM, GPTNeoXConfig
<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-neox-20b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>config = GPTNeoXConfig.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neox-20b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>config.is_decoder = <span class="hljs-literal">True</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoXForCausalLM.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neox-20b&quot;</span>, config=config)

<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>prediction_logits = outputs.logits`}}),{c(){s=a("p"),b=i("Example:"),c=u(),y(h.$$.fragment)},l(n){s=r(n,"P",{});var p=l(s);b=d(p,"Example:"),p.forEach(o),c=f(n),w(h.$$.fragment,n)},m(n,p){T(n,s,p),e(s,b),T(n,c,p),M(h,n,p),_=!0},p:De,i(n){_||(v(h.$$.fragment,n),_=!0)},o(n){k(h.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(c),G(h,n)}}}function si($){let s,b,c,h,_;return{c(){s=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a("code"),h=i("Module"),_=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(n){s=r(n,"P",{});var p=l(s);b=d(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=r(p,"CODE",{});var N=l(c);h=d(N,"Module"),N.forEach(o),_=d(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(n,p){T(n,s,p),e(s,b),e(s,c),e(c,h),e(s,_)},d(n){n&&o(s)}}}function ai($){let s,b,c,h,_,n,p,N;return{c(){s=a("p"),b=i(`This example uses a random model as the real ones are all very big. To get proper results, you should use
EleutherAI/gpt-neox-20b instead of trl-internal-testing/tiny-random-GPTNeoXForCausalLM. If you get out-of-memory when loading that checkpoint, you can try
adding `),c=a("code"),h=i('device_map="auto"'),_=i(" in the "),n=a("code"),p=i("from_pretrained"),N=i(" call.")},l(j){s=r(j,"P",{});var X=l(s);b=d(X,`This example uses a random model as the real ones are all very big. To get proper results, you should use
EleutherAI/gpt-neox-20b instead of trl-internal-testing/tiny-random-GPTNeoXForCausalLM. If you get out-of-memory when loading that checkpoint, you can try
adding `),c=r(X,"CODE",{});var F=l(c);h=d(F,'device_map="auto"'),F.forEach(o),_=d(X," in the "),n=r(X,"CODE",{});var J=l(n);p=d(J,"from_pretrained"),J.forEach(o),N=d(X," call."),X.forEach(o)},m(j,X){T(j,s,X),e(s,b),e(s,c),e(c,h),e(s,_),e(s,n),e(n,p),e(s,N)},d(j){j&&o(s)}}}function ri($){let s,b,c,h,_;return h=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHUFROZW9YRm9yUXVlc3Rpb25BbnN3ZXJpbmclMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnRybC1pbnRlcm5hbC10ZXN0aW5nJTJGdGlueS1yYW5kb20tR1BUTmVvWEZvckNhdXNhbExNJTIyKSUwQW1vZGVsJTIwJTNEJTIwR1BUTmVvWEZvclF1ZXN0aW9uQW5zd2VyaW5nLmZyb21fcHJldHJhaW5lZCglMjJ0cmwtaW50ZXJuYWwtdGVzdGluZyUyRnRpbnktcmFuZG9tLUdQVE5lb1hGb3JDYXVzYWxMTSUyMiklMEElMEFxdWVzdGlvbiUyQyUyMHRleHQlMjAlM0QlMjAlMjJXaG8lMjB3YXMlMjBKaW0lMjBIZW5zb24lM0YlMjIlMkMlMjAlMjJKaW0lMjBIZW5zb24lMjB3YXMlMjBhJTIwbmljZSUyMHB1cHBldCUyMiUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihxdWVzdGlvbiUyQyUyMHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBYW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNEJTIwb3V0cHV0cy5zdGFydF9sb2dpdHMuYXJnbWF4KCklMEFhbnN3ZXJfZW5kX2luZGV4JTIwJTNEJTIwb3V0cHV0cy5lbmRfbG9naXRzLmFyZ21heCgpJTBBJTBBcHJlZGljdF9hbnN3ZXJfdG9rZW5zJTIwJTNEJTIwaW5wdXRzLmlucHV0X2lkcyU1QjAlMkMlMjBhbnN3ZXJfc3RhcnRfaW5kZXglMjAlM0ElMjBhbnN3ZXJfZW5kX2luZGV4JTIwJTJCJTIwMSU1RCUwQSUwQSUyMyUyMHRhcmdldCUyMGlzJTIwJTIybmljZSUyMHB1cHBldCUyMiUwQXRhcmdldF9zdGFydF9pbmRleCUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxNCU1RCklMEF0YXJnZXRfZW5kX2luZGV4JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QjE1JTVEKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMHN0YXJ0X3Bvc2l0aW9ucyUzRHRhcmdldF9zdGFydF9pbmRleCUyQyUyMGVuZF9wb3NpdGlvbnMlM0R0YXJnZXRfZW5kX2luZGV4KSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3M=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTNeoXForQuestionAnswering
<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;trl-internal-testing/tiny-random-GPTNeoXForCausalLM&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoXForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;trl-internal-testing/tiny-random-GPTNeoXForCausalLM&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>question, text = <span class="hljs-string">&quot;Who was Jim Henson?&quot;</span>, <span class="hljs-string">&quot;Jim Henson was a nice puppet&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>answer_start_index = outputs.start_logits.argmax()
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_end_index = outputs.end_logits.argmax()

<span class="hljs-meta">&gt;&gt;&gt; </span>predict_answer_tokens = inputs.input_ids[<span class="hljs-number">0</span>, answer_start_index : answer_end_index + <span class="hljs-number">1</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># target is &quot;nice puppet&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_start_index = torch.tensor([<span class="hljs-number">14</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>target_end_index = torch.tensor([<span class="hljs-number">15</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss`}}),{c(){s=a("p"),b=i("Example:"),c=u(),y(h.$$.fragment)},l(n){s=r(n,"P",{});var p=l(s);b=d(p,"Example:"),p.forEach(o),c=f(n),w(h.$$.fragment,n)},m(n,p){T(n,s,p),e(s,b),T(n,c,p),M(h,n,p),_=!0},p:De,i(n){_||(v(h.$$.fragment,n),_=!0)},o(n){k(h.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(c),G(h,n)}}}function li($){let s,b,c,h,_;return{c(){s=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a("code"),h=i("Module"),_=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(n){s=r(n,"P",{});var p=l(s);b=d(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=r(p,"CODE",{});var N=l(c);h=d(N,"Module"),N.forEach(o),_=d(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(n,p){T(n,s,p),e(s,b),e(s,c),e(c,h),e(s,_)},d(n){n&&o(s)}}}function ii($){let s,b,c,h,_;return h=new D({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEdQVE5lb1hGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIydHJsLWludGVybmFsLXRlc3RpbmclMkZ0aW55LXJhbmRvbS1HUFROZW9YRm9yQ2F1c2FsTE0lMjIpJTBBbW9kZWwlMjAlM0QlMjBHUFROZW9YRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIydHJsLWludGVybmFsLXRlc3RpbmclMkZ0aW55LXJhbmRvbS1HUFROZW9YRm9yQ2F1c2FsTE0lMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkJTIwJTNEJTIwbG9naXRzLmFyZ21heCgpLml0ZW0oKSUwQSUwQSUyMyUyMFRvJTIwdHJhaW4lMjBhJTIwbW9kZWwlMjBvbiUyMCU2MG51bV9sYWJlbHMlNjAlMjBjbGFzc2VzJTJDJTIweW91JTIwY2FuJTIwcGFzcyUyMCU2MG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTYwJTIwdG8lMjAlNjAuZnJvbV9wcmV0cmFpbmVkKC4uLiklNjAlMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFtb2RlbCUyMCUzRCUyMEdQVE5lb1hGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJ0cmwtaW50ZXJuYWwtdGVzdGluZyUyRnRpbnktcmFuZG9tLUdQVE5lb1hGb3JDYXVzYWxMTSUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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, GPTNeoXForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;trl-internal-testing/tiny-random-GPTNeoXForCausalLM&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoXForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;trl-internal-testing/tiny-random-GPTNeoXForCausalLM&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 = GPTNeoXForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;trl-internal-testing/tiny-random-GPTNeoXForCausalLM&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(){s=a("p"),b=i("Example of single-label classification:"),c=u(),y(h.$$.fragment)},l(n){s=r(n,"P",{});var p=l(s);b=d(p,"Example of single-label classification:"),p.forEach(o),c=f(n),w(h.$$.fragment,n)},m(n,p){T(n,s,p),e(s,b),T(n,c,p),M(h,n,p),_=!0},p:De,i(n){_||(v(h.$$.fragment,n),_=!0)},o(n){k(h.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(c),G(h,n)}}}function di($){let s,b,c,h,_;return h=new D({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEdQVE5lb1hGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIydHJsLWludGVybmFsLXRlc3RpbmclMkZ0aW55LXJhbmRvbS1HUFROZW9YRm9yQ2F1c2FsTE0lMjIpJTBBbW9kZWwlMjAlM0QlMjBHUFROZW9YRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIydHJsLWludGVybmFsLXRlc3RpbmclMkZ0aW55LXJhbmRvbS1HUFROZW9YRm9yQ2F1c2FsTE0lMjIlMkMlMjBwcm9ibGVtX3R5cGUlM0QlMjJtdWx0aV9sYWJlbF9jbGFzc2lmaWNhdGlvbiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWRzJTIwJTNEJTIwdG9yY2guYXJhbmdlKDAlMkMlMjBsb2dpdHMuc2hhcGUlNUItMSU1RCklNUJ0b3JjaC5zaWdtb2lkKGxvZ2l0cykuc3F1ZWV6ZShkaW0lM0QwKSUyMCUzRSUyMDAuNSU1RCUwQSUwQSUyMyUyMFRvJTIwdHJhaW4lMjBhJTIwbW9kZWwlMjBvbiUyMCU2MG51bV9sYWJlbHMlNjAlMjBjbGFzc2VzJTJDJTIweW91JTIwY2FuJTIwcGFzcyUyMCU2MG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTYwJTIwdG8lMjAlNjAuZnJvbV9wcmV0cmFpbmVkKC4uLiklNjAlMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFtb2RlbCUyMCUzRCUyMEdQVE5lb1hGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJ0cmwtaW50ZXJuYWwtdGVzdGluZyUyRnRpbnktcmFuZG9tLUdQVE5lb1hGb3JDYXVzYWxMTSUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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, GPTNeoXForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;trl-internal-testing/tiny-random-GPTNeoXForCausalLM&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoXForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;trl-internal-testing/tiny-random-GPTNeoXForCausalLM&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 = GPTNeoXForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;trl-internal-testing/tiny-random-GPTNeoXForCausalLM&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(){s=a("p"),b=i("Example of multi-label classification:"),c=u(),y(h.$$.fragment)},l(n){s=r(n,"P",{});var p=l(s);b=d(p,"Example of multi-label classification:"),p.forEach(o),c=f(n),w(h.$$.fragment,n)},m(n,p){T(n,s,p),e(s,b),T(n,c,p),M(h,n,p),_=!0},p:De,i(n){_||(v(h.$$.fragment,n),_=!0)},o(n){k(h.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(c),G(h,n)}}}function ci($){let s,b,c,h,_;return{c(){s=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),c=a("code"),h=i("Module"),_=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(n){s=r(n,"P",{});var p=l(s);b=d(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=r(p,"CODE",{});var N=l(c);h=d(N,"Module"),N.forEach(o),_=d(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(n,p){T(n,s,p),e(s,b),e(s,c),e(c,h),e(s,_)},d(n){n&&o(s)}}}function pi($){let s,b,c,h,_;return h=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHUFROZW9YRm9yVG9rZW5DbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyTGFyc0pvbmFzc29uJTJGcHl0aGlhLTQxMG0tZGVkdXBlZC1zZnQtc3dlZGlzaCUyMiklMEFtb2RlbCUyMCUzRCUyMEdQVE5lb1hGb3JUb2tlbkNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJMYXJzSm9uYXNzb24lMkZweXRoaWEtNDEwbS1kZWR1cGVkLXNmdC1zd2VkaXNoJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjAlMjJIdWdnaW5nRmFjZSUyMGlzJTIwYSUyMGNvbXBhbnklMjBiYXNlZCUyMGluJTIwUGFyaXMlMjBhbmQlMjBOZXclMjBZb3JrJTIyJTJDJTIwYWRkX3NwZWNpYWxfdG9rZW5zJTNERmFsc2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoLTEpJTBBJTBBJTIzJTIwTm90ZSUyMHRoYXQlMjB0b2tlbnMlMjBhcmUlMjBjbGFzc2lmaWVkJTIwcmF0aGVyJTIwdGhlbiUyMGlucHV0JTIwd29yZHMlMjB3aGljaCUyMG1lYW5zJTIwdGhhdCUwQSUyMyUyMHRoZXJlJTIwbWlnaHQlMjBiZSUyMG1vcmUlMjBwcmVkaWN0ZWQlMjB0b2tlbiUyMGNsYXNzZXMlMjB0aGFuJTIwd29yZHMuJTBBJTIzJTIwTXVsdGlwbGUlMjB0b2tlbiUyMGNsYXNzZXMlMjBtaWdodCUyMGFjY291bnQlMjBmb3IlMjB0aGUlMjBzYW1lJTIwd29yZCUwQXByZWRpY3RlZF90b2tlbnNfY2xhc3NlcyUyMCUzRCUyMCU1Qm1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnQuaXRlbSgpJTVEJTIwZm9yJTIwdCUyMGluJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyU1QjAlNUQlNUQlMEElMEFsYWJlbHMlMjAlM0QlMjBwcmVkaWN0ZWRfdG9rZW5fY2xhc3NfaWRzJTBBbG9zcyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKS5sb3NzJTBBcm91bmQobG9zcy5pdGVtKCklMkMlMjAyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTNeoXForTokenClassification
<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;LarsJonasson/pythia-410m-deduped-sft-swedish&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoXForTokenClassification.from_pretrained(<span class="hljs-string">&quot;LarsJonasson/pythia-410m-deduped-sft-swedish&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;HuggingFace is a company based in Paris and New York&quot;</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </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_token_class_ids = logits.argmax(-<span class="hljs-number">1</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Note that tokens are classified rather then input words which means that</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># there might be more predicted token classes than words.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Multiple token classes might account for the same word</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_tokens_classes = [model.config.id2label[t.item()] <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> predicted_token_class_ids[<span class="hljs-number">0</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = predicted_token_class_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">0.25</span>`}}),{c(){s=a("p"),b=i("Example:"),c=u(),y(h.$$.fragment)},l(n){s=r(n,"P",{});var p=l(s);b=d(p,"Example:"),p.forEach(o),c=f(n),w(h.$$.fragment,n)},m(n,p){T(n,s,p),e(s,b),T(n,c,p),M(h,n,p),_=!0},p:De,i(n){_||(v(h.$$.fragment,n),_=!0)},o(n){k(h.$$.fragment,n),_=!1},d(n){n&&o(s),n&&o(c),G(h,n)}}}function hi($){let s,b,c,h,_,n,p,N,j,X,F,J,uo,Ke,On,fo,Dn,cn,Te,Kn,et,es,ts,pn,be,os,tt,ns,ss,hn,Bt,as,mn,ot,un,Vt,rs,fn,K,ye,go,nt,ls,_o,is,gn,we,ds,To,cs,ps,_n,st,Tn,ee,Me,bo,at,hs,yo,ms,bn,qt,wo,Rt,us,yn,te,ve,Mo,rt,fs,vo,gs,wn,x,lt,_s,oe,Ts,At,bs,ys,it,ws,Ms,vs,ne,ks,St,Gs,$s,Qt,Ns,Xs,js,ke,Mn,se,Ge,ko,dt,Ps,Go,Fs,vn,P,ct,Js,pt,Cs,$o,Es,zs,Us,No,Ws,xs,$e,Zs,ht,Is,Xo,Bs,Vs,qs,Ne,Rs,mt,As,Lt,Ss,Qs,kn,ae,Xe,jo,ut,Ls,Po,Hs,Gn,A,ft,Ys,gt,Os,_t,Ds,Ks,ea,E,Tt,ta,re,oa,Ht,na,sa,Fo,aa,ra,la,je,ia,Pe,da,Fe,$n,le,Je,Jo,bt,ca,Co,pa,Nn,S,yt,ha,ie,ma,Eo,ua,fa,wt,ga,_a,Ta,B,Mt,ba,de,ya,Yt,wa,Ma,zo,va,ka,Ga,Ce,$a,Ee,Xn,ce,ze,Uo,vt,Na,Wo,Xa,jn,Z,kt,ja,pe,Pa,xo,Fa,Ja,Zo,Ca,Ea,za,Gt,Ua,$t,Wa,xa,Za,z,Nt,Ia,he,Ba,Ot,Va,qa,Io,Ra,Aa,Sa,Ue,Qa,We,La,xe,Pn,me,Ze,Bo,Xt,Ha,Vo,Ya,Fn,C,jt,Oa,qo,Da,Ka,Dt,Kt,er,tr,or,I,nr,Ro,sr,ar,Ao,rr,lr,So,ir,dr,Qo,cr,pr,hr,Pt,mr,Ft,ur,fr,gr,U,Jt,_r,ue,Tr,eo,br,yr,Lo,wr,Mr,vr,Ie,kr,Be,Gr,Ve,Jn,fe,qe,Ho,Ct,$r,Yo,Nr,Cn,ge,Et,Xr,V,zt,jr,_e,Pr,to,Fr,Jr,Oo,Cr,Er,zr,Re,Ur,Ae,En;return n=new Q({}),Ke=new Q({}),ot=new D({props:{code:"bW9kZWwlMjAlM0QlMjBHUFROZW9YRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtbmVveC0yMGIlMjIpLmhhbGYoKS5jdWRhKCk=",highlighted:'model = GPTNeoXForCausalLM.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neox-20b&quot;</span>).half().cuda()'}}),nt=new Q({}),st=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVE5lb1hGb3JDYXVzYWxMTSUyQyUyMEdQVE5lb1hUb2tlbml6ZXJGYXN0JTBBJTBBbW9kZWwlMjAlM0QlMjBHUFROZW9YRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtbmVveC0yMGIlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwR1BUTmVvWFRva2VuaXplckZhc3QuZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtbmVveC0yMGIlMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyR1BUTmVvWDIwQiUyMGlzJTIwYSUyMDIwQi1wYXJhbWV0ZXIlMjBhdXRvcmVncmVzc2l2ZSUyMFRyYW5zZm9ybWVyJTIwbW9kZWwlMjBkZXZlbG9wZWQlMjBieSUyMEVsZXV0aGVyQUkuJTIyJTBBJTBBaW5wdXRfaWRzJTIwJTNEJTIwdG9rZW5pemVyKHByb21wdCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcyUwQSUwQWdlbl90b2tlbnMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSglMEElMjAlMjAlMjAlMjBpbnB1dF9pZHMlMkMlMEElMjAlMjAlMjAlMjBkb19zYW1wbGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwdGVtcGVyYXR1cmUlM0QwLjklMkMlMEElMjAlMjAlMjAlMjBtYXhfbGVuZ3RoJTNEMTAwJTJDJTBBKSUwQWdlbl90ZXh0JTIwJTNEJTIwdG9rZW5pemVyLmJhdGNoX2RlY29kZShnZW5fdG9rZW5zKSU1QjAlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTNeoXForCausalLM, GPTNeoXTokenizerFast

<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTNeoXForCausalLM.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neox-20b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = GPTNeoXTokenizerFast.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neox-20b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;GPTNeoX20B is a 20B-parameter autoregressive Transformer model developed by EleutherAI.&quot;</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>]`}}),at=new Q({}),rt=new Q({}),lt=new R({props:{name:"class transformers.GPTNeoXConfig",anchor:"transformers.GPTNeoXConfig",parameters:[{name:"vocab_size",val:" = 50432"},{name:"hidden_size",val:" = 6144"},{name:"num_hidden_layers",val:" = 44"},{name:"num_attention_heads",val:" = 64"},{name:"intermediate_size",val:" = 24576"},{name:"hidden_act",val:" = 'gelu'"},{name:"rotary_pct",val:" = 0.25"},{name:"rotary_emb_base",val:" = 10000"},{name:"attention_dropout",val:" = 0.0"},{name:"hidden_dropout",val:" = 0.0"},{name:"classifier_dropout",val:" = 0.1"},{name:"max_position_embeddings",val:" = 2048"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"use_cache",val:" = True"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"tie_word_embeddings",val:" = False"},{name:"use_parallel_residual",val:" = True"},{name:"rope_scaling",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GPTNeoXConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50432) &#x2014;
Vocabulary size of the GPTNeoX model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXModel">GPTNeoXModel</a>.`,name:"vocab_size"},{anchor:"transformers.GPTNeoXConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 6144) &#x2014;
Dimension of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.GPTNeoXConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 44) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.GPTNeoXConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.GPTNeoXConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 24576) &#x2014;
Dimension of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.GPTNeoXConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&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:"hidden_act"},{anchor:"transformers.GPTNeoXConfig.rotary_pct",description:`<strong>rotary_pct</strong> (<code>float</code>, <em>optional</em>, defaults to 0.25) &#x2014;
percentage of hidden dimensions to allocate to rotary embeddings`,name:"rotary_pct"},{anchor:"transformers.GPTNeoXConfig.rotary_emb_base",description:`<strong>rotary_emb_base</strong> (<code>int</code>, <em>optional</em>, defaults to 10000) &#x2014;
base for computing rotary embeddings frequency`,name:"rotary_emb_base"},{anchor:"transformers.GPTNeoXConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio probability of the attention score.`,name:"attention_dropout"},{anchor:"transformers.GPTNeoXConfig.hidden_dropout",description:`<strong>hidden_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio of (1) the word embeddings, (2) the post-attention hidden states, and (3) the post-mlp
hidden states.`,name:"hidden_dropout"},{anchor:"transformers.GPTNeoXConfig.classifier_dropout",description:`<strong>classifier_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
Argument used when doing token classification, used in the model <a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXForTokenClassification">GPTNeoXForTokenClassification</a>.</p>
<p>The dropout ratio for the hidden layer.`,name:"classifier_dropout"},{anchor:"transformers.GPTNeoXConfig.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.GPTNeoXConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.GPTNeoXConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.GPTNeoXConfig.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"},{anchor:"transformers.GPTNeoXConfig.use_parallel_residual",description:`<strong>use_parallel_residual</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use a &#x201C;parallel&#x201D; formulation in each Transformer layer, which can provide a slight training
speedup at large scales (e.g. 20B).`,name:"use_parallel_residual"},{anchor:"transformers.GPTNeoXConfig.rope_scaling",description:`<strong>rope_scaling</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
strategies: linear and dynamic. Their scaling factor must be an float greater than 1. The expected format
is <code>{&quot;type&quot;: strategy name, &quot;factor&quot;: scaling factor}</code>. When using this flag, don&#x2019;t update
<code>max_position_embeddings</code> to the expected new maximum. See the following thread for more information on how
these scaling strategies behave:
<a href="https://www.reddit.com/r/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/" rel="nofollow">https://www.reddit.com/r/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/</a>. This is an
experimental feature, subject to breaking API changes in future versions.</p>
<p>Example &#x2014;`,name:"rope_scaling"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/configuration_gpt_neox.py#L29"}}),ke=new Oe({props:{anchor:"transformers.GPTNeoXConfig.example",$$slots:{default:[Yl]},$$scope:{ctx:$}}}),dt=new Q({}),ct=new R({props:{name:"class transformers.GPTNeoXTokenizerFast",anchor:"transformers.GPTNeoXTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"merges_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"unk_token",val:" = '<|endoftext|>'"},{name:"bos_token",val:" = '<|endoftext|>'"},{name:"eos_token",val:" = '<|endoftext|>'"},{name:"add_prefix_space",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GPTNeoXTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.GPTNeoXTokenizerFast.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.GPTNeoXTokenizerFast.errors",description:`<strong>errors</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;replace&quot;</code>) &#x2014;
Paradigm to follow when decoding bytes to UTF-8. See
<a href="https://docs.python.org/3/library/stdtypes.html#bytes.decode" rel="nofollow">bytes.decode</a> for more information.`,name:"errors"},{anchor:"transformers.GPTNeoXTokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&lt;|endoftext|&gt;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.GPTNeoXTokenizerFast.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&lt;|endoftext|&gt;</code>) &#x2014;
The beginning of sequence token.`,name:"bos_token"},{anchor:"transformers.GPTNeoXTokenizerFast.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&lt;|endoftext|&gt;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.GPTNeoXTokenizerFast.add_prefix_space",description:`<strong>add_prefix_space</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add an initial space to the input. This allows to treat the leading word just as any
other word. (GPTNeoX tokenizer detect beginning of words by the preceding space).`,name:"add_prefix_space"},{anchor:"transformers.GPTNeoXTokenizerFast.trim_offsets",description:`<strong>trim_offsets</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the post-processing step should trim offsets to avoid including whitespaces.`,name:"trim_offsets"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/tokenization_gpt_neox_fast.py#L44"}}),$e=new Oe({props:{anchor:"transformers.GPTNeoXTokenizerFast.example",$$slots:{default:[Ol]},$$scope:{ctx:$}}}),Ne=new Ye({props:{$$slots:{default:[Dl]},$$scope:{ctx:$}}}),ut=new Q({}),ft=new R({props:{name:"class transformers.GPTNeoXModel",anchor:"transformers.GPTNeoXModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTNeoXModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXConfig">~GPTNeoXConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L513"}}),Tt=new R({props:{name:"forward",anchor:"transformers.GPTNeoXModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = 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.GPTNeoXModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.GPTNeoXModel.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.GPTNeoXModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTNeoXModel.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.GPTNeoXModel.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoXModel.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.GPTNeoXModel.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.GPTNeoXModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTNeoXModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.
If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.GPTNeoXModel.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L534",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXConfig"
>GPTNeoXConfig</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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),je=new Ye({props:{$$slots:{default:[Kl]},$$scope:{ctx:$}}}),Pe=new Ye({props:{warning:!0,$$slots:{default:[ei]},$$scope:{ctx:$}}}),Fe=new Oe({props:{anchor:"transformers.GPTNeoXModel.forward.example",$$slots:{default:[ti]},$$scope:{ctx:$}}}),bt=new Q({}),yt=new R({props:{name:"class transformers.GPTNeoXForCausalLM",anchor:"transformers.GPTNeoXForCausalLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTNeoXForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXConfig">~GPTNeoXConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L692"}}),Mt=new R({props:{name:"forward",anchor:"transformers.GPTNeoXForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = 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.GPTNeoXForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.GPTNeoXForCausalLM.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.GPTNeoXForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTNeoXForCausalLM.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.GPTNeoXForCausalLM.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoXForCausalLM.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.GPTNeoXForCausalLM.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.GPTNeoXForCausalLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTNeoXForCausalLM.forward.past_key_values",description:`<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>) &#x2014;
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 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>. The two additional tensors are
only required when the model is used as a decoder in a Sequence to Sequence model.</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>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.GPTNeoXForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the left-to-right language modeling loss (next word prediction). Indices should be in
<code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are
ignored (masked), the loss is only computed for the tokens with labels n <code>[0, ..., config.vocab_size]</code>.`,name:"labels"},{anchor:"transformers.GPTNeoXForCausalLM.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L710",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXConfig"
>GPTNeoXConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, 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><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ce=new Ye({props:{$$slots:{default:[oi]},$$scope:{ctx:$}}}),Ee=new Oe({props:{anchor:"transformers.GPTNeoXForCausalLM.forward.example",$$slots:{default:[ni]},$$scope:{ctx:$}}}),vt=new Q({}),kt=new R({props:{name:"class transformers.GPTNeoXForQuestionAnswering",anchor:"transformers.GPTNeoXForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTNeoXForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXConfig">~GPTNeoXConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L1062"}}),Nt=new R({props:{name:"forward",anchor:"transformers.GPTNeoXForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"end_positions",val:": typing.Optional[torch.LongTensor] = 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.GPTNeoXForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.GPTNeoXForQuestionAnswering.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.GPTNeoXForQuestionAnswering.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTNeoXForQuestionAnswering.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.GPTNeoXForQuestionAnswering.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoXForQuestionAnswering.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.GPTNeoXForQuestionAnswering.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.GPTNeoXForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTNeoXForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.GPTNeoXForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L1072",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXConfig"
>GPTNeoXConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, 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><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ue=new Ye({props:{$$slots:{default:[si]},$$scope:{ctx:$}}}),We=new Ye({props:{warning:!0,$$slots:{default:[ai]},$$scope:{ctx:$}}}),xe=new Oe({props:{anchor:"transformers.GPTNeoXForQuestionAnswering.forward.example",$$slots:{default:[ri]},$$scope:{ctx:$}}}),Xt=new Q({}),jt=new R({props:{name:"class transformers.GPTNeoXForSequenceClassification",anchor:"transformers.GPTNeoXForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTNeoXForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXConfig">~GPTNeoXConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L866"}}),Jt=new R({props:{name:"forward",anchor:"transformers.GPTNeoXForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = 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.GPTNeoXForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.GPTNeoXForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>({0})</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.GPTNeoXForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTNeoXForSequenceClassification.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.GPTNeoXForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>({0}, 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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoXForSequenceClassification.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.GPTNeoXForSequenceClassification.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.GPTNeoXForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTNeoXForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L876",returnDescription:`
<p>A <code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXConfig"
>GPTNeoXConfig</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>
`}}),Ie=new Ye({props:{$$slots:{default:[li]},$$scope:{ctx:$}}}),Be=new Oe({props:{anchor:"transformers.GPTNeoXForSequenceClassification.forward.example",$$slots:{default:[ii]},$$scope:{ctx:$}}}),Ve=new Oe({props:{anchor:"transformers.GPTNeoXForSequenceClassification.forward.example-2",$$slots:{default:[di]},$$scope:{ctx:$}}}),Ct=new Q({}),Et=new R({props:{name:"class transformers.GPTNeoXForTokenClassification",anchor:"transformers.GPTNeoXForTokenClassification",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L978"}}),zt=new R({props:{name:"forward",anchor:"transformers.GPTNeoXForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = 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.GPTNeoXForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.GPTNeoXForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>({0})</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.GPTNeoXForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTNeoXForTokenClassification.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.GPTNeoXForTokenClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>({0}, 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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoXForTokenClassification.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.GPTNeoXForTokenClassification.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.GPTNeoXForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTNeoXForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L990",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXConfig"
>GPTNeoXConfig</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 loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, 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><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Re=new Ye({props:{$$slots:{default:[ci]},$$scope:{ctx:$}}}),Ae=new Oe({props:{anchor:"transformers.GPTNeoXForTokenClassification.forward.example",$$slots:{default:[pi]},$$scope:{ctx:$}}}),{c(){s=a("meta"),b=u(),c=a("h1"),h=a("a"),_=a("span"),y(n.$$.fragment),p=u(),N=a("span"),j=i("GPT-NeoX"),X=u(),F=a("h2"),J=a("a"),uo=a("span"),y(Ke.$$.fragment),On=u(),fo=a("span"),Dn=i("Overview"),cn=u(),Te=a("p"),Kn=i(`We introduce GPT-NeoX-20B, a 20 billion parameter autoregressive language model trained on the Pile, whose weights will
be made freely and openly available to the public through a permissive license. It is, to the best of our knowledge,
the largest dense autoregressive model that has publicly available weights at the time of submission. In this work,
we describe GPT-NeoX-20B\u2019s architecture and training and evaluate its performance on a range of language-understanding,
mathematics, and knowledge-based tasks. We find that GPT-NeoX-20B is a particularly powerful few-shot reasoner and
gains far more in performance when evaluated five-shot than similarly sized GPT-3 and FairSeq models. We open-source
the training and evaluation code, as well as the model weights, at `),et=a("a"),es=i("https://github.com/EleutherAI/gpt-neox"),ts=i("."),pn=u(),be=a("p"),os=i(`Development of the model was led by Sid Black, Stella Biderman and Eric Hallahan, and the model was trained with
generous the support of `),tt=a("a"),ns=i("CoreWeave"),ss=i("."),hn=u(),Bt=a("p"),as=i("GPT-NeoX-20B was trained with fp16, thus it is recommended to initialize the model as follows:"),mn=u(),y(ot.$$.fragment),un=u(),Vt=a("p"),rs=i(`GPT-NeoX-20B also has a different tokenizer from the one used in GPT-J-6B and GPT-Neo. The new tokenizer allocates
additional tokens to whitespace characters, making the model more suitable for certain tasks like code generation.`),fn=u(),K=a("h3"),ye=a("a"),go=a("span"),y(nt.$$.fragment),ls=u(),_o=a("span"),is=i("Generation"),gn=u(),we=a("p"),ds=i("The "),To=a("code"),cs=i("generate()"),ps=i(" method can be used to generate text using GPT Neo model."),_n=u(),y(st.$$.fragment),Tn=u(),ee=a("h2"),Me=a("a"),bo=a("span"),y(at.$$.fragment),hs=u(),yo=a("span"),ms=i("Documentation resources"),bn=u(),qt=a("ul"),wo=a("li"),Rt=a("a"),us=i("Causal language modeling task guide"),yn=u(),te=a("h2"),ve=a("a"),Mo=a("span"),y(rt.$$.fragment),fs=u(),vo=a("span"),gs=i("GPTNeoXConfig"),wn=u(),x=a("div"),y(lt.$$.fragment),_s=u(),oe=a("p"),Ts=i("This is the configuration class to store the configuration of a "),At=a("a"),bs=i("GPTNeoXModel"),ys=i(`. It is used to instantiate an
GPTNeoX 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 GPTNeoX
`),it=a("a"),ws=i("EleutherAI/gpt-neox-20b"),Ms=i(" architecture."),vs=u(),ne=a("p"),ks=i("Configuration objects inherit from "),St=a("a"),Gs=i("PretrainedConfig"),$s=i(` and can be used to control the model outputs. Read the
documentation from `),Qt=a("a"),Ns=i("PretrainedConfig"),Xs=i(" for more information."),js=u(),y(ke.$$.fragment),Mn=u(),se=a("h2"),Ge=a("a"),ko=a("span"),y(dt.$$.fragment),Ps=u(),Go=a("span"),Fs=i("GPTNeoXTokenizerFast"),vn=u(),P=a("div"),y(ct.$$.fragment),Js=u(),pt=a("p"),Cs=i("Construct a \u201Cfast\u201D GPT-NeoX-20B tokenizer (backed by HuggingFace\u2019s "),$o=a("em"),Es=i("tokenizers"),zs=i(` library). Based on byte-level
Byte-Pair-Encoding.`),Us=u(),No=a("p"),Ws=i("This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),xs=u(),y($e.$$.fragment),Zs=u(),ht=a("p"),Is=i("You can get around that behavior by passing "),Xo=a("code"),Bs=i("add_prefix_space=True"),Vs=i(` when instantiating this tokenizer, but since
the model was not pretrained this way, it might yield a decrease in performance.`),qs=u(),y(Ne.$$.fragment),Rs=u(),mt=a("p"),As=i("This tokenizer inherits from "),Lt=a("a"),Ss=i("PreTrainedTokenizerFast"),Qs=i(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),kn=u(),ae=a("h2"),Xe=a("a"),jo=a("span"),y(ut.$$.fragment),Ls=u(),Po=a("span"),Hs=i("GPTNeoXModel"),Gn=u(),A=a("div"),y(ft.$$.fragment),Ys=u(),gt=a("p"),Os=i(`The bare GPTNeoX Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),_t=a("a"),Ds=i("torch.nn.Module"),Ks=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ea=u(),E=a("div"),y(Tt.$$.fragment),ta=u(),re=a("p"),oa=i("The "),Ht=a("a"),na=i("GPTNeoXModel"),sa=i(" forward method, overrides the "),Fo=a("code"),aa=i("__call__"),ra=i(" special method."),la=u(),y(je.$$.fragment),ia=u(),y(Pe.$$.fragment),da=u(),y(Fe.$$.fragment),$n=u(),le=a("h2"),Je=a("a"),Jo=a("span"),y(bt.$$.fragment),ca=u(),Co=a("span"),pa=i("GPTNeoXForCausalLM"),Nn=u(),S=a("div"),y(yt.$$.fragment),ha=u(),ie=a("p"),ma=i("GPTNeoX Model with a "),Eo=a("code"),ua=i("language modeling"),fa=i(` head on top for CLM fine-tuning.
This model is a PyTorch `),wt=a("a"),ga=i("torch.nn.Module"),_a=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ta=u(),B=a("div"),y(Mt.$$.fragment),ba=u(),de=a("p"),ya=i("The "),Yt=a("a"),wa=i("GPTNeoXForCausalLM"),Ma=i(" forward method, overrides the "),zo=a("code"),va=i("__call__"),ka=i(" special method."),Ga=u(),y(Ce.$$.fragment),$a=u(),y(Ee.$$.fragment),Xn=u(),ce=a("h2"),ze=a("a"),Uo=a("span"),y(vt.$$.fragment),Na=u(),Wo=a("span"),Xa=i("GPTNeoXForQuestionAnswering"),jn=u(),Z=a("div"),y(kt.$$.fragment),ja=u(),pe=a("p"),Pa=i(`The GPT-NeoX Model transformer with a span classification head on top for extractive question-answering tasks like
SQuAD (a linear layer on top of the hidden-states output to compute `),xo=a("code"),Fa=i("span start logits"),Ja=i(" and "),Zo=a("code"),Ca=i("span end logits"),Ea=i(")."),za=u(),Gt=a("p"),Ua=i("This model is a PyTorch "),$t=a("a"),Wa=i("torch.nn.Module"),xa=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Za=u(),z=a("div"),y(Nt.$$.fragment),Ia=u(),he=a("p"),Ba=i("The "),Ot=a("a"),Va=i("GPTNeoXForQuestionAnswering"),qa=i(" forward method, overrides the "),Io=a("code"),Ra=i("__call__"),Aa=i(" special method."),Sa=u(),y(Ue.$$.fragment),Qa=u(),y(We.$$.fragment),La=u(),y(xe.$$.fragment),Pn=u(),me=a("h2"),Ze=a("a"),Bo=a("span"),y(Xt.$$.fragment),Ha=u(),Vo=a("span"),Ya=i("GPTNeoXForSequenceClassification"),Fn=u(),C=a("div"),y(jt.$$.fragment),Oa=u(),qo=a("p"),Da=i("The GPTNeoX Model transformer with a sequence classification head on top (linear layer)."),Ka=u(),Dt=a("p"),Kt=a("a"),er=i("GPTNeoXForSequenceClassification"),tr=i(` uses the last token in order to do the classification, as other causal models
(e.g. GPT-1) do.`),or=u(),I=a("p"),nr=i(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Ro=a("code"),sr=i("pad_token_id"),ar=i(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Ao=a("code"),rr=i("pad_token_id"),lr=i(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),So=a("code"),ir=i("inputs_embeds"),dr=i(" are passed instead of "),Qo=a("code"),cr=i("input_ids"),pr=i(`, it does the same (take the last value in
each row of the batch).`),hr=u(),Pt=a("p"),mr=i("This model is a PyTorch "),Ft=a("a"),ur=i("torch.nn.Module"),fr=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),gr=u(),U=a("div"),y(Jt.$$.fragment),_r=u(),ue=a("p"),Tr=i("The "),eo=a("a"),br=i("GPTNeoXForSequenceClassification"),yr=i(" forward method, overrides the "),Lo=a("code"),wr=i("__call__"),Mr=i(" special method."),vr=u(),y(Ie.$$.fragment),kr=u(),y(Be.$$.fragment),Gr=u(),y(Ve.$$.fragment),Jn=u(),fe=a("h2"),qe=a("a"),Ho=a("span"),y(Ct.$$.fragment),$r=u(),Yo=a("span"),Nr=i("GPTNeoXForTokenClassification"),Cn=u(),ge=a("div"),y(Et.$$.fragment),Xr=u(),V=a("div"),y(zt.$$.fragment),jr=u(),_e=a("p"),Pr=i("The "),to=a("a"),Fr=i("GPTNeoXForTokenClassification"),Jr=i(" forward method, overrides the "),Oo=a("code"),Cr=i("__call__"),Er=i(" special method."),zr=u(),y(Re.$$.fragment),Ur=u(),y(Ae.$$.fragment),this.h()},l(t){const m=Ll('[data-svelte="svelte-1phssyn"]',document.head);s=r(m,"META",{name:!0,content:!0}),m.forEach(o),b=f(t),c=r(t,"H1",{class:!0});var Ut=l(c);h=r(Ut,"A",{id:!0,class:!0,href:!0});var Do=l(h);_=r(Do,"SPAN",{});var Ko=l(_);w(n.$$.fragment,Ko),Ko.forEach(o),Do.forEach(o),p=f(Ut),N=r(Ut,"SPAN",{});var en=l(N);j=d(en,"GPT-NeoX"),en.forEach(o),Ut.forEach(o),X=f(t),F=r(t,"H2",{class:!0});var Wt=l(F);J=r(Wt,"A",{id:!0,class:!0,href:!0});var tn=l(J);uo=r(tn,"SPAN",{});var on=l(uo);w(Ke.$$.fragment,on),on.forEach(o),tn.forEach(o),On=f(Wt),fo=r(Wt,"SPAN",{});var nn=l(fo);Dn=d(nn,"Overview"),nn.forEach(o),Wt.forEach(o),cn=f(t),Te=r(t,"P",{});var xt=l(Te);Kn=d(xt,`We introduce GPT-NeoX-20B, a 20 billion parameter autoregressive language model trained on the Pile, whose weights will
be made freely and openly available to the public through a permissive license. It is, to the best of our knowledge,
the largest dense autoregressive model that has publicly available weights at the time of submission. In this work,
we describe GPT-NeoX-20B\u2019s architecture and training and evaluate its performance on a range of language-understanding,
mathematics, and knowledge-based tasks. We find that GPT-NeoX-20B is a particularly powerful few-shot reasoner and
gains far more in performance when evaluated five-shot than similarly sized GPT-3 and FairSeq models. We open-source
the training and evaluation code, as well as the model weights, at `),et=r(xt,"A",{href:!0,rel:!0});var sn=l(et);es=d(sn,"https://github.com/EleutherAI/gpt-neox"),sn.forEach(o),ts=d(xt,"."),xt.forEach(o),pn=f(t),be=r(t,"P",{});var Zt=l(be);os=d(Zt,`Development of the model was led by Sid Black, Stella Biderman and Eric Hallahan, and the model was trained with
generous the support of `),tt=r(Zt,"A",{href:!0,rel:!0});var an=l(tt);ns=d(an,"CoreWeave"),an.forEach(o),ss=d(Zt,"."),Zt.forEach(o),hn=f(t),Bt=r(t,"P",{});var rn=l(Bt);as=d(rn,"GPT-NeoX-20B was trained with fp16, thus it is recommended to initialize the model as follows:"),rn.forEach(o),mn=f(t),w(ot.$$.fragment,t),un=f(t),Vt=r(t,"P",{});var ln=l(Vt);rs=d(ln,`GPT-NeoX-20B also has a different tokenizer from the one used in GPT-J-6B and GPT-Neo. The new tokenizer allocates
additional tokens to whitespace characters, making the model more suitable for certain tasks like code generation.`),ln.forEach(o),fn=f(t),K=r(t,"H3",{class:!0});var It=l(K);ye=r(It,"A",{id:!0,class:!0,href:!0});var dn=l(ye);go=r(dn,"SPAN",{});var xr=l(go);w(nt.$$.fragment,xr),xr.forEach(o),dn.forEach(o),ls=f(It),_o=r(It,"SPAN",{});var Zr=l(_o);is=d(Zr,"Generation"),Zr.forEach(o),It.forEach(o),gn=f(t),we=r(t,"P",{});var zn=l(we);ds=d(zn,"The "),To=r(zn,"CODE",{});var Ir=l(To);cs=d(Ir,"generate()"),Ir.forEach(o),ps=d(zn," method can be used to generate text using GPT Neo model."),zn.forEach(o),_n=f(t),w(st.$$.fragment,t),Tn=f(t),ee=r(t,"H2",{class:!0});var Un=l(ee);Me=r(Un,"A",{id:!0,class:!0,href:!0});var Br=l(Me);bo=r(Br,"SPAN",{});var Vr=l(bo);w(at.$$.fragment,Vr),Vr.forEach(o),Br.forEach(o),hs=f(Un),yo=r(Un,"SPAN",{});var qr=l(yo);ms=d(qr,"Documentation resources"),qr.forEach(o),Un.forEach(o),bn=f(t),qt=r(t,"UL",{});var Rr=l(qt);wo=r(Rr,"LI",{});var Ar=l(wo);Rt=r(Ar,"A",{href:!0});var Sr=l(Rt);us=d(Sr,"Causal language modeling task guide"),Sr.forEach(o),Ar.forEach(o),Rr.forEach(o),yn=f(t),te=r(t,"H2",{class:!0});var Wn=l(te);ve=r(Wn,"A",{id:!0,class:!0,href:!0});var Qr=l(ve);Mo=r(Qr,"SPAN",{});var Lr=l(Mo);w(rt.$$.fragment,Lr),Lr.forEach(o),Qr.forEach(o),fs=f(Wn),vo=r(Wn,"SPAN",{});var Hr=l(vo);gs=d(Hr,"GPTNeoXConfig"),Hr.forEach(o),Wn.forEach(o),wn=f(t),x=r(t,"DIV",{class:!0});var Se=l(x);w(lt.$$.fragment,Se),_s=f(Se),oe=r(Se,"P",{});var oo=l(oe);Ts=d(oo,"This is the configuration class to store the configuration of a "),At=r(oo,"A",{href:!0});var Yr=l(At);bs=d(Yr,"GPTNeoXModel"),Yr.forEach(o),ys=d(oo,`. It is used to instantiate an
GPTNeoX 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 GPTNeoX
`),it=r(oo,"A",{href:!0,rel:!0});var Or=l(it);ws=d(Or,"EleutherAI/gpt-neox-20b"),Or.forEach(o),Ms=d(oo," architecture."),oo.forEach(o),vs=f(Se),ne=r(Se,"P",{});var no=l(ne);ks=d(no,"Configuration objects inherit from "),St=r(no,"A",{href:!0});var Dr=l(St);Gs=d(Dr,"PretrainedConfig"),Dr.forEach(o),$s=d(no,` and can be used to control the model outputs. Read the
documentation from `),Qt=r(no,"A",{href:!0});var Kr=l(Qt);Ns=d(Kr,"PretrainedConfig"),Kr.forEach(o),Xs=d(no," for more information."),no.forEach(o),js=f(Se),w(ke.$$.fragment,Se),Se.forEach(o),Mn=f(t),se=r(t,"H2",{class:!0});var xn=l(se);Ge=r(xn,"A",{id:!0,class:!0,href:!0});var el=l(Ge);ko=r(el,"SPAN",{});var tl=l(ko);w(dt.$$.fragment,tl),tl.forEach(o),el.forEach(o),Ps=f(xn),Go=r(xn,"SPAN",{});var ol=l(Go);Fs=d(ol,"GPTNeoXTokenizerFast"),ol.forEach(o),xn.forEach(o),vn=f(t),P=r(t,"DIV",{class:!0});var W=l(P);w(ct.$$.fragment,W),Js=f(W),pt=r(W,"P",{});var Zn=l(pt);Cs=d(Zn,"Construct a \u201Cfast\u201D GPT-NeoX-20B tokenizer (backed by HuggingFace\u2019s "),$o=r(Zn,"EM",{});var nl=l($o);Es=d(nl,"tokenizers"),nl.forEach(o),zs=d(Zn,` library). Based on byte-level
Byte-Pair-Encoding.`),Zn.forEach(o),Us=f(W),No=r(W,"P",{});var sl=l(No);Ws=d(sl,"This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),sl.forEach(o),xs=f(W),w($e.$$.fragment,W),Zs=f(W),ht=r(W,"P",{});var In=l(ht);Is=d(In,"You can get around that behavior by passing "),Xo=r(In,"CODE",{});var al=l(Xo);Bs=d(al,"add_prefix_space=True"),al.forEach(o),Vs=d(In,` when instantiating this tokenizer, but since
the model was not pretrained this way, it might yield a decrease in performance.`),In.forEach(o),qs=f(W),w(Ne.$$.fragment,W),Rs=f(W),mt=r(W,"P",{});var Bn=l(mt);As=d(Bn,"This tokenizer inherits from "),Lt=r(Bn,"A",{href:!0});var rl=l(Lt);Ss=d(rl,"PreTrainedTokenizerFast"),rl.forEach(o),Qs=d(Bn,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Bn.forEach(o),W.forEach(o),kn=f(t),ae=r(t,"H2",{class:!0});var Vn=l(ae);Xe=r(Vn,"A",{id:!0,class:!0,href:!0});var ll=l(Xe);jo=r(ll,"SPAN",{});var il=l(jo);w(ut.$$.fragment,il),il.forEach(o),ll.forEach(o),Ls=f(Vn),Po=r(Vn,"SPAN",{});var dl=l(Po);Hs=d(dl,"GPTNeoXModel"),dl.forEach(o),Vn.forEach(o),Gn=f(t),A=r(t,"DIV",{class:!0});var so=l(A);w(ft.$$.fragment,so),Ys=f(so),gt=r(so,"P",{});var qn=l(gt);Os=d(qn,`The bare GPTNeoX Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),_t=r(qn,"A",{href:!0,rel:!0});var cl=l(_t);Ds=d(cl,"torch.nn.Module"),cl.forEach(o),Ks=d(qn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),qn.forEach(o),ea=f(so),E=r(so,"DIV",{class:!0});var L=l(E);w(Tt.$$.fragment,L),ta=f(L),re=r(L,"P",{});var ao=l(re);oa=d(ao,"The "),Ht=r(ao,"A",{href:!0});var pl=l(Ht);na=d(pl,"GPTNeoXModel"),pl.forEach(o),sa=d(ao," forward method, overrides the "),Fo=r(ao,"CODE",{});var hl=l(Fo);aa=d(hl,"__call__"),hl.forEach(o),ra=d(ao," special method."),ao.forEach(o),la=f(L),w(je.$$.fragment,L),ia=f(L),w(Pe.$$.fragment,L),da=f(L),w(Fe.$$.fragment,L),L.forEach(o),so.forEach(o),$n=f(t),le=r(t,"H2",{class:!0});var Rn=l(le);Je=r(Rn,"A",{id:!0,class:!0,href:!0});var ml=l(Je);Jo=r(ml,"SPAN",{});var ul=l(Jo);w(bt.$$.fragment,ul),ul.forEach(o),ml.forEach(o),ca=f(Rn),Co=r(Rn,"SPAN",{});var fl=l(Co);pa=d(fl,"GPTNeoXForCausalLM"),fl.forEach(o),Rn.forEach(o),Nn=f(t),S=r(t,"DIV",{class:!0});var ro=l(S);w(yt.$$.fragment,ro),ha=f(ro),ie=r(ro,"P",{});var lo=l(ie);ma=d(lo,"GPTNeoX Model with a "),Eo=r(lo,"CODE",{});var gl=l(Eo);ua=d(gl,"language modeling"),gl.forEach(o),fa=d(lo,` head on top for CLM fine-tuning.
This model is a PyTorch `),wt=r(lo,"A",{href:!0,rel:!0});var _l=l(wt);ga=d(_l,"torch.nn.Module"),_l.forEach(o),_a=d(lo,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),lo.forEach(o),Ta=f(ro),B=r(ro,"DIV",{class:!0});var Qe=l(B);w(Mt.$$.fragment,Qe),ba=f(Qe),de=r(Qe,"P",{});var io=l(de);ya=d(io,"The "),Yt=r(io,"A",{href:!0});var Tl=l(Yt);wa=d(Tl,"GPTNeoXForCausalLM"),Tl.forEach(o),Ma=d(io," forward method, overrides the "),zo=r(io,"CODE",{});var bl=l(zo);va=d(bl,"__call__"),bl.forEach(o),ka=d(io," special method."),io.forEach(o),Ga=f(Qe),w(Ce.$$.fragment,Qe),$a=f(Qe),w(Ee.$$.fragment,Qe),Qe.forEach(o),ro.forEach(o),Xn=f(t),ce=r(t,"H2",{class:!0});var An=l(ce);ze=r(An,"A",{id:!0,class:!0,href:!0});var yl=l(ze);Uo=r(yl,"SPAN",{});var wl=l(Uo);w(vt.$$.fragment,wl),wl.forEach(o),yl.forEach(o),Na=f(An),Wo=r(An,"SPAN",{});var Ml=l(Wo);Xa=d(Ml,"GPTNeoXForQuestionAnswering"),Ml.forEach(o),An.forEach(o),jn=f(t),Z=r(t,"DIV",{class:!0});var Le=l(Z);w(kt.$$.fragment,Le),ja=f(Le),pe=r(Le,"P",{});var co=l(pe);Pa=d(co,`The GPT-NeoX Model transformer with a span classification head on top for extractive question-answering tasks like
SQuAD (a linear layer on top of the hidden-states output to compute `),xo=r(co,"CODE",{});var vl=l(xo);Fa=d(vl,"span start logits"),vl.forEach(o),Ja=d(co," and "),Zo=r(co,"CODE",{});var kl=l(Zo);Ca=d(kl,"span end logits"),kl.forEach(o),Ea=d(co,")."),co.forEach(o),za=f(Le),Gt=r(Le,"P",{});var Sn=l(Gt);Ua=d(Sn,"This model is a PyTorch "),$t=r(Sn,"A",{href:!0,rel:!0});var Gl=l($t);Wa=d(Gl,"torch.nn.Module"),Gl.forEach(o),xa=d(Sn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Sn.forEach(o),Za=f(Le),z=r(Le,"DIV",{class:!0});var H=l(z);w(Nt.$$.fragment,H),Ia=f(H),he=r(H,"P",{});var po=l(he);Ba=d(po,"The "),Ot=r(po,"A",{href:!0});var $l=l(Ot);Va=d($l,"GPTNeoXForQuestionAnswering"),$l.forEach(o),qa=d(po," forward method, overrides the "),Io=r(po,"CODE",{});var Nl=l(Io);Ra=d(Nl,"__call__"),Nl.forEach(o),Aa=d(po," special method."),po.forEach(o),Sa=f(H),w(Ue.$$.fragment,H),Qa=f(H),w(We.$$.fragment,H),La=f(H),w(xe.$$.fragment,H),H.forEach(o),Le.forEach(o),Pn=f(t),me=r(t,"H2",{class:!0});var Qn=l(me);Ze=r(Qn,"A",{id:!0,class:!0,href:!0});var Xl=l(Ze);Bo=r(Xl,"SPAN",{});var jl=l(Bo);w(Xt.$$.fragment,jl),jl.forEach(o),Xl.forEach(o),Ha=f(Qn),Vo=r(Qn,"SPAN",{});var Pl=l(Vo);Ya=d(Pl,"GPTNeoXForSequenceClassification"),Pl.forEach(o),Qn.forEach(o),Fn=f(t),C=r(t,"DIV",{class:!0});var q=l(C);w(jt.$$.fragment,q),Oa=f(q),qo=r(q,"P",{});var Fl=l(qo);Da=d(Fl,"The GPTNeoX Model transformer with a sequence classification head on top (linear layer)."),Fl.forEach(o),Ka=f(q),Dt=r(q,"P",{});var Wr=l(Dt);Kt=r(Wr,"A",{href:!0});var Jl=l(Kt);er=d(Jl,"GPTNeoXForSequenceClassification"),Jl.forEach(o),tr=d(Wr,` uses the last token in order to do the classification, as other causal models
(e.g. GPT-1) do.`),Wr.forEach(o),or=f(q),I=r(q,"P",{});var Y=l(I);nr=d(Y,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Ro=r(Y,"CODE",{});var Cl=l(Ro);sr=d(Cl,"pad_token_id"),Cl.forEach(o),ar=d(Y,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Ao=r(Y,"CODE",{});var El=l(Ao);rr=d(El,"pad_token_id"),El.forEach(o),lr=d(Y,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),So=r(Y,"CODE",{});var zl=l(So);ir=d(zl,"inputs_embeds"),zl.forEach(o),dr=d(Y," are passed instead of "),Qo=r(Y,"CODE",{});var Ul=l(Qo);cr=d(Ul,"input_ids"),Ul.forEach(o),pr=d(Y,`, it does the same (take the last value in
each row of the batch).`),Y.forEach(o),hr=f(q),Pt=r(q,"P",{});var Ln=l(Pt);mr=d(Ln,"This model is a PyTorch "),Ft=r(Ln,"A",{href:!0,rel:!0});var Wl=l(Ft);ur=d(Wl,"torch.nn.Module"),Wl.forEach(o),fr=d(Ln,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ln.forEach(o),gr=f(q),U=r(q,"DIV",{class:!0});var O=l(U);w(Jt.$$.fragment,O),_r=f(O),ue=r(O,"P",{});var ho=l(ue);Tr=d(ho,"The "),eo=r(ho,"A",{href:!0});var xl=l(eo);br=d(xl,"GPTNeoXForSequenceClassification"),xl.forEach(o),yr=d(ho," forward method, overrides the "),Lo=r(ho,"CODE",{});var Zl=l(Lo);wr=d(Zl,"__call__"),Zl.forEach(o),Mr=d(ho," special method."),ho.forEach(o),vr=f(O),w(Ie.$$.fragment,O),kr=f(O),w(Be.$$.fragment,O),Gr=f(O),w(Ve.$$.fragment,O),O.forEach(o),q.forEach(o),Jn=f(t),fe=r(t,"H2",{class:!0});var Hn=l(fe);qe=r(Hn,"A",{id:!0,class:!0,href:!0});var Il=l(qe);Ho=r(Il,"SPAN",{});var Bl=l(Ho);w(Ct.$$.fragment,Bl),Bl.forEach(o),Il.forEach(o),$r=f(Hn),Yo=r(Hn,"SPAN",{});var Vl=l(Yo);Nr=d(Vl,"GPTNeoXForTokenClassification"),Vl.forEach(o),Hn.forEach(o),Cn=f(t),ge=r(t,"DIV",{class:!0});var Yn=l(ge);w(Et.$$.fragment,Yn),Xr=f(Yn),V=r(Yn,"DIV",{class:!0});var He=l(V);w(zt.$$.fragment,He),jr=f(He),_e=r(He,"P",{});var mo=l(_e);Pr=d(mo,"The "),to=r(mo,"A",{href:!0});var ql=l(to);Fr=d(ql,"GPTNeoXForTokenClassification"),ql.forEach(o),Jr=d(mo," forward method, overrides the "),Oo=r(mo,"CODE",{});var Rl=l(Oo);Cr=d(Rl,"__call__"),Rl.forEach(o),Er=d(mo," special method."),mo.forEach(o),zr=f(He),w(Re.$$.fragment,He),Ur=f(He),w(Ae.$$.fragment,He),He.forEach(o),Yn.forEach(o),this.h()},h(){g(s,"name","hf:doc:metadata"),g(s,"content",JSON.stringify(mi)),g(h,"id","gptneox"),g(h,"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"),g(h,"href","#gptneox"),g(c,"class","relative group"),g(J,"id","overview"),g(J,"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"),g(J,"href","#overview"),g(F,"class","relative group"),g(et,"href","https://github.com/EleutherAI/gpt-neox"),g(et,"rel","nofollow"),g(tt,"href","https://www.coreweave.com/"),g(tt,"rel","nofollow"),g(ye,"id","generation"),g(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"),g(ye,"href","#generation"),g(K,"class","relative group"),g(Me,"id","documentation-resources"),g(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"),g(Me,"href","#documentation-resources"),g(ee,"class","relative group"),g(Rt,"href","../tasks/language_modeling"),g(ve,"id","transformers.GPTNeoXConfig"),g(ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(ve,"href","#transformers.GPTNeoXConfig"),g(te,"class","relative group"),g(At,"href","/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXModel"),g(it,"href","https://huggingface.co/EleutherAI/gpt-neox-20b"),g(it,"rel","nofollow"),g(St,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),g(Qt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),g(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Ge,"id","transformers.GPTNeoXTokenizerFast"),g(Ge,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(Ge,"href","#transformers.GPTNeoXTokenizerFast"),g(se,"class","relative group"),g(Lt,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),g(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Xe,"id","transformers.GPTNeoXModel"),g(Xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(Xe,"href","#transformers.GPTNeoXModel"),g(ae,"class","relative group"),g(_t,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),g(_t,"rel","nofollow"),g(Ht,"href","/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXModel"),g(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Je,"id","transformers.GPTNeoXForCausalLM"),g(Je,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(Je,"href","#transformers.GPTNeoXForCausalLM"),g(le,"class","relative group"),g(wt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),g(wt,"rel","nofollow"),g(Yt,"href","/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXForCausalLM"),g(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(ze,"id","transformers.GPTNeoXForQuestionAnswering"),g(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"),g(ze,"href","#transformers.GPTNeoXForQuestionAnswering"),g(ce,"class","relative group"),g($t,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),g($t,"rel","nofollow"),g(Ot,"href","/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXForQuestionAnswering"),g(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Ze,"id","transformers.GPTNeoXForSequenceClassification"),g(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"),g(Ze,"href","#transformers.GPTNeoXForSequenceClassification"),g(me,"class","relative group"),g(Kt,"href","/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXForSequenceClassification"),g(Ft,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),g(Ft,"rel","nofollow"),g(eo,"href","/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXForSequenceClassification"),g(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(qe,"id","transformers.GPTNeoXForTokenClassification"),g(qe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(qe,"href","#transformers.GPTNeoXForTokenClassification"),g(fe,"class","relative group"),g(to,"href","/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXForTokenClassification"),g(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,m){e(document.head,s),T(t,b,m),T(t,c,m),e(c,h),e(h,_),M(n,_,null),e(c,p),e(c,N),e(N,j),T(t,X,m),T(t,F,m),e(F,J),e(J,uo),M(Ke,uo,null),e(F,On),e(F,fo),e(fo,Dn),T(t,cn,m),T(t,Te,m),e(Te,Kn),e(Te,et),e(et,es),e(Te,ts),T(t,pn,m),T(t,be,m),e(be,os),e(be,tt),e(tt,ns),e(be,ss),T(t,hn,m),T(t,Bt,m),e(Bt,as),T(t,mn,m),M(ot,t,m),T(t,un,m),T(t,Vt,m),e(Vt,rs),T(t,fn,m),T(t,K,m),e(K,ye),e(ye,go),M(nt,go,null),e(K,ls),e(K,_o),e(_o,is),T(t,gn,m),T(t,we,m),e(we,ds),e(we,To),e(To,cs),e(we,ps),T(t,_n,m),M(st,t,m),T(t,Tn,m),T(t,ee,m),e(ee,Me),e(Me,bo),M(at,bo,null),e(ee,hs),e(ee,yo),e(yo,ms),T(t,bn,m),T(t,qt,m),e(qt,wo),e(wo,Rt),e(Rt,us),T(t,yn,m),T(t,te,m),e(te,ve),e(ve,Mo),M(rt,Mo,null),e(te,fs),e(te,vo),e(vo,gs),T(t,wn,m),T(t,x,m),M(lt,x,null),e(x,_s),e(x,oe),e(oe,Ts),e(oe,At),e(At,bs),e(oe,ys),e(oe,it),e(it,ws),e(oe,Ms),e(x,vs),e(x,ne),e(ne,ks),e(ne,St),e(St,Gs),e(ne,$s),e(ne,Qt),e(Qt,Ns),e(ne,Xs),e(x,js),M(ke,x,null),T(t,Mn,m),T(t,se,m),e(se,Ge),e(Ge,ko),M(dt,ko,null),e(se,Ps),e(se,Go),e(Go,Fs),T(t,vn,m),T(t,P,m),M(ct,P,null),e(P,Js),e(P,pt),e(pt,Cs),e(pt,$o),e($o,Es),e(pt,zs),e(P,Us),e(P,No),e(No,Ws),e(P,xs),M($e,P,null),e(P,Zs),e(P,ht),e(ht,Is),e(ht,Xo),e(Xo,Bs),e(ht,Vs),e(P,qs),M(Ne,P,null),e(P,Rs),e(P,mt),e(mt,As),e(mt,Lt),e(Lt,Ss),e(mt,Qs),T(t,kn,m),T(t,ae,m),e(ae,Xe),e(Xe,jo),M(ut,jo,null),e(ae,Ls),e(ae,Po),e(Po,Hs),T(t,Gn,m),T(t,A,m),M(ft,A,null),e(A,Ys),e(A,gt),e(gt,Os),e(gt,_t),e(_t,Ds),e(gt,Ks),e(A,ea),e(A,E),M(Tt,E,null),e(E,ta),e(E,re),e(re,oa),e(re,Ht),e(Ht,na),e(re,sa),e(re,Fo),e(Fo,aa),e(re,ra),e(E,la),M(je,E,null),e(E,ia),M(Pe,E,null),e(E,da),M(Fe,E,null),T(t,$n,m),T(t,le,m),e(le,Je),e(Je,Jo),M(bt,Jo,null),e(le,ca),e(le,Co),e(Co,pa),T(t,Nn,m),T(t,S,m),M(yt,S,null),e(S,ha),e(S,ie),e(ie,ma),e(ie,Eo),e(Eo,ua),e(ie,fa),e(ie,wt),e(wt,ga),e(ie,_a),e(S,Ta),e(S,B),M(Mt,B,null),e(B,ba),e(B,de),e(de,ya),e(de,Yt),e(Yt,wa),e(de,Ma),e(de,zo),e(zo,va),e(de,ka),e(B,Ga),M(Ce,B,null),e(B,$a),M(Ee,B,null),T(t,Xn,m),T(t,ce,m),e(ce,ze),e(ze,Uo),M(vt,Uo,null),e(ce,Na),e(ce,Wo),e(Wo,Xa),T(t,jn,m),T(t,Z,m),M(kt,Z,null),e(Z,ja),e(Z,pe),e(pe,Pa),e(pe,xo),e(xo,Fa),e(pe,Ja),e(pe,Zo),e(Zo,Ca),e(pe,Ea),e(Z,za),e(Z,Gt),e(Gt,Ua),e(Gt,$t),e($t,Wa),e(Gt,xa),e(Z,Za),e(Z,z),M(Nt,z,null),e(z,Ia),e(z,he),e(he,Ba),e(he,Ot),e(Ot,Va),e(he,qa),e(he,Io),e(Io,Ra),e(he,Aa),e(z,Sa),M(Ue,z,null),e(z,Qa),M(We,z,null),e(z,La),M(xe,z,null),T(t,Pn,m),T(t,me,m),e(me,Ze),e(Ze,Bo),M(Xt,Bo,null),e(me,Ha),e(me,Vo),e(Vo,Ya),T(t,Fn,m),T(t,C,m),M(jt,C,null),e(C,Oa),e(C,qo),e(qo,Da),e(C,Ka),e(C,Dt),e(Dt,Kt),e(Kt,er),e(Dt,tr),e(C,or),e(C,I),e(I,nr),e(I,Ro),e(Ro,sr),e(I,ar),e(I,Ao),e(Ao,rr),e(I,lr),e(I,So),e(So,ir),e(I,dr),e(I,Qo),e(Qo,cr),e(I,pr),e(C,hr),e(C,Pt),e(Pt,mr),e(Pt,Ft),e(Ft,ur),e(Pt,fr),e(C,gr),e(C,U),M(Jt,U,null),e(U,_r),e(U,ue),e(ue,Tr),e(ue,eo),e(eo,br),e(ue,yr),e(ue,Lo),e(Lo,wr),e(ue,Mr),e(U,vr),M(Ie,U,null),e(U,kr),M(Be,U,null),e(U,Gr),M(Ve,U,null),T(t,Jn,m),T(t,fe,m),e(fe,qe),e(qe,Ho),M(Ct,Ho,null),e(fe,$r),e(fe,Yo),e(Yo,Nr),T(t,Cn,m),T(t,ge,m),M(Et,ge,null),e(ge,Xr),e(ge,V),M(zt,V,null),e(V,jr),e(V,_e),e(_e,Pr),e(_e,to),e(to,Fr),e(_e,Jr),e(_e,Oo),e(Oo,Cr),e(_e,Er),e(V,zr),M(Re,V,null),e(V,Ur),M(Ae,V,null),En=!0},p(t,[m]){const Ut={};m&2&&(Ut.$$scope={dirty:m,ctx:t}),ke.$set(Ut);const Do={};m&2&&(Do.$$scope={dirty:m,ctx:t}),$e.$set(Do);const Ko={};m&2&&(Ko.$$scope={dirty:m,ctx:t}),Ne.$set(Ko);const en={};m&2&&(en.$$scope={dirty:m,ctx:t}),je.$set(en);const Wt={};m&2&&(Wt.$$scope={dirty:m,ctx:t}),Pe.$set(Wt);const tn={};m&2&&(tn.$$scope={dirty:m,ctx:t}),Fe.$set(tn);const on={};m&2&&(on.$$scope={dirty:m,ctx:t}),Ce.$set(on);const nn={};m&2&&(nn.$$scope={dirty:m,ctx:t}),Ee.$set(nn);const xt={};m&2&&(xt.$$scope={dirty:m,ctx:t}),Ue.$set(xt);const sn={};m&2&&(sn.$$scope={dirty:m,ctx:t}),We.$set(sn);const Zt={};m&2&&(Zt.$$scope={dirty:m,ctx:t}),xe.$set(Zt);const an={};m&2&&(an.$$scope={dirty:m,ctx:t}),Ie.$set(an);const rn={};m&2&&(rn.$$scope={dirty:m,ctx:t}),Be.$set(rn);const ln={};m&2&&(ln.$$scope={dirty:m,ctx:t}),Ve.$set(ln);const It={};m&2&&(It.$$scope={dirty:m,ctx:t}),Re.$set(It);const dn={};m&2&&(dn.$$scope={dirty:m,ctx:t}),Ae.$set(dn)},i(t){En||(v(n.$$.fragment,t),v(Ke.$$.fragment,t),v(ot.$$.fragment,t),v(nt.$$.fragment,t),v(st.$$.fragment,t),v(at.$$.fragment,t),v(rt.$$.fragment,t),v(lt.$$.fragment,t),v(ke.$$.fragment,t),v(dt.$$.fragment,t),v(ct.$$.fragment,t),v($e.$$.fragment,t),v(Ne.$$.fragment,t),v(ut.$$.fragment,t),v(ft.$$.fragment,t),v(Tt.$$.fragment,t),v(je.$$.fragment,t),v(Pe.$$.fragment,t),v(Fe.$$.fragment,t),v(bt.$$.fragment,t),v(yt.$$.fragment,t),v(Mt.$$.fragment,t),v(Ce.$$.fragment,t),v(Ee.$$.fragment,t),v(vt.$$.fragment,t),v(kt.$$.fragment,t),v(Nt.$$.fragment,t),v(Ue.$$.fragment,t),v(We.$$.fragment,t),v(xe.$$.fragment,t),v(Xt.$$.fragment,t),v(jt.$$.fragment,t),v(Jt.$$.fragment,t),v(Ie.$$.fragment,t),v(Be.$$.fragment,t),v(Ve.$$.fragment,t),v(Ct.$$.fragment,t),v(Et.$$.fragment,t),v(zt.$$.fragment,t),v(Re.$$.fragment,t),v(Ae.$$.fragment,t),En=!0)},o(t){k(n.$$.fragment,t),k(Ke.$$.fragment,t),k(ot.$$.fragment,t),k(nt.$$.fragment,t),k(st.$$.fragment,t),k(at.$$.fragment,t),k(rt.$$.fragment,t),k(lt.$$.fragment,t),k(ke.$$.fragment,t),k(dt.$$.fragment,t),k(ct.$$.fragment,t),k($e.$$.fragment,t),k(Ne.$$.fragment,t),k(ut.$$.fragment,t),k(ft.$$.fragment,t),k(Tt.$$.fragment,t),k(je.$$.fragment,t),k(Pe.$$.fragment,t),k(Fe.$$.fragment,t),k(bt.$$.fragment,t),k(yt.$$.fragment,t),k(Mt.$$.fragment,t),k(Ce.$$.fragment,t),k(Ee.$$.fragment,t),k(vt.$$.fragment,t),k(kt.$$.fragment,t),k(Nt.$$.fragment,t),k(Ue.$$.fragment,t),k(We.$$.fragment,t),k(xe.$$.fragment,t),k(Xt.$$.fragment,t),k(jt.$$.fragment,t),k(Jt.$$.fragment,t),k(Ie.$$.fragment,t),k(Be.$$.fragment,t),k(Ve.$$.fragment,t),k(Ct.$$.fragment,t),k(Et.$$.fragment,t),k(zt.$$.fragment,t),k(Re.$$.fragment,t),k(Ae.$$.fragment,t),En=!1},d(t){o(s),t&&o(b),t&&o(c),G(n),t&&o(X),t&&o(F),G(Ke),t&&o(cn),t&&o(Te),t&&o(pn),t&&o(be),t&&o(hn),t&&o(Bt),t&&o(mn),G(ot,t),t&&o(un),t&&o(Vt),t&&o(fn),t&&o(K),G(nt),t&&o(gn),t&&o(we),t&&o(_n),G(st,t),t&&o(Tn),t&&o(ee),G(at),t&&o(bn),t&&o(qt),t&&o(yn),t&&o(te),G(rt),t&&o(wn),t&&o(x),G(lt),G(ke),t&&o(Mn),t&&o(se),G(dt),t&&o(vn),t&&o(P),G(ct),G($e),G(Ne),t&&o(kn),t&&o(ae),G(ut),t&&o(Gn),t&&o(A),G(ft),G(Tt),G(je),G(Pe),G(Fe),t&&o($n),t&&o(le),G(bt),t&&o(Nn),t&&o(S),G(yt),G(Mt),G(Ce),G(Ee),t&&o(Xn),t&&o(ce),G(vt),t&&o(jn),t&&o(Z),G(kt),G(Nt),G(Ue),G(We),G(xe),t&&o(Pn),t&&o(me),G(Xt),t&&o(Fn),t&&o(C),G(jt),G(Jt),G(Ie),G(Be),G(Ve),t&&o(Jn),t&&o(fe),G(Ct),t&&o(Cn),t&&o(ge),G(Et),G(zt),G(Re),G(Ae)}}}const mi={local:"gptneox",sections:[{local:"overview",sections:[{local:"generation",title:"Generation"}],title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.GPTNeoXConfig",title:"GPTNeoXConfig"},{local:"transformers.GPTNeoXTokenizerFast",title:"GPTNeoXTokenizerFast"},{local:"transformers.GPTNeoXModel",title:"GPTNeoXModel"},{local:"transformers.GPTNeoXForCausalLM",title:"GPTNeoXForCausalLM"},{local:"transformers.GPTNeoXForQuestionAnswering",title:"GPTNeoXForQuestionAnswering"},{local:"transformers.GPTNeoXForSequenceClassification",title:"GPTNeoXForSequenceClassification"},{local:"transformers.GPTNeoXForTokenClassification",title:"GPTNeoXForTokenClassification"}],title:"GPT-NeoX"};function ui($){return Hl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class wi extends Al{constructor(s){super();Sl(this,s,ui,hi,Ql,{})}}export{wi as default,mi as metadata};
