import{s as Ts,o as bs,n as x}from"../chunks/scheduler.25b97de1.js";import{S as ys,i as Ms,g as p,s as a,r as h,A as ws,h as m,f as o,c as r,j as N,u as g,x as y,k as j,l as ks,y as c,a as i,v as u,d as f,t as _,w as T}from"../chunks/index.d9030fc9.js";import{T as Te}from"../chunks/Tip.baa67368.js";import{D as U}from"../chunks/Docstring.e257edda.js";import{C as V}from"../chunks/CodeBlock.e6cd0d95.js";import{E as be}from"../chunks/ExampleCodeBlock.20db4b6e.js";import{H as G,E as $s}from"../chunks/EditOnGithub.91d95064.js";function vs(k){let n,b;return n=new V({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`,wrap:!1}}),{c(){h(n.$$.fragment)},l(l){g(n.$$.fragment,l)},m(l,d){u(n,l,d),b=!0},p:x,i(l){b||(f(n.$$.fragment,l),b=!0)},o(l){_(n.$$.fragment,l),b=!1},d(l){T(n,l)}}}function Gs(k){let n,b="be encoded differently whether it is at the beginning of the sentence (without space) or not:",l,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVE5lb1hUb2tlbml6ZXJGYXN0JTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwR1BUTmVvWFRva2VuaXplckZhc3QuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haS1jb21tdW5pdHklMkZncHQyJTIyKSUwQXRva2VuaXplciglMjJIZWxsbyUyMHdvcmxkJTIyKSU1QiUyMmlucHV0X2lkcyUyMiU1RCUwQSUwQXRva2VuaXplciglMjIlMjBIZWxsbyUyMHdvcmxkJTIyKSU1QiUyMmlucHV0X2lkcyUyMiU1RA==",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;openai-community/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>]`,wrap:!1}}),{c(){n=p("p"),n.textContent=b,l=a(),h(d.$$.fragment)},l(s){n=m(s,"P",{"data-svelte-h":!0}),y(n)!=="svelte-12atnao"&&(n.textContent=b),l=r(s),g(d.$$.fragment,s)},m(s,w){i(s,n,w),i(s,l,w),u(d,s,w),M=!0},p:x,i(s){M||(f(d.$$.fragment,s),M=!0)},o(s){_(d.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(d,s)}}}function Xs(k){let n,b="When used with <code>is_split_into_words=True</code>, this tokenizer needs to be instantiated with <code>add_prefix_space=True</code>.";return{c(){n=p("p"),n.innerHTML=b},l(l){n=m(l,"P",{"data-svelte-h":!0}),y(n)!=="svelte-9gg91e"&&(n.innerHTML=b)},m(l,d){i(l,n,d)},p:x,d(l){l&&o(n)}}}function Ns(k){let n,b=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=p("p"),n.innerHTML=b},l(l){n=m(l,"P",{"data-svelte-h":!0}),y(n)!=="svelte-fincs2"&&(n.innerHTML=b)},m(l,d){i(l,n,d)},p:x,d(l){l&&o(n)}}}function js(k){let n,b=`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 <code>device_map=&quot;auto&quot;</code> in the <code>from_pretrained</code> call.`;return{c(){n=p("p"),n.innerHTML=b},l(l){n=m(l,"P",{"data-svelte-h":!0}),y(n)!=="svelte-1lgpfzy"&&(n.innerHTML=b)},m(l,d){i(l,n,d)},p:x,d(l){l&&o(n)}}}function xs(k){let n,b="Example:",l,d,M;return d=new V({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`,wrap:!1}}),{c(){n=p("p"),n.textContent=b,l=a(),h(d.$$.fragment)},l(s){n=m(s,"P",{"data-svelte-h":!0}),y(n)!=="svelte-11lpom8"&&(n.textContent=b),l=r(s),g(d.$$.fragment,s)},m(s,w){i(s,n,w),i(s,l,w),u(d,s,w),M=!0},p:x,i(s){M||(f(d.$$.fragment,s),M=!0)},o(s){_(d.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(d,s)}}}function Cs(k){let n,b=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=p("p"),n.innerHTML=b},l(l){n=m(l,"P",{"data-svelte-h":!0}),y(n)!=="svelte-fincs2"&&(n.innerHTML=b)},m(l,d){i(l,n,d)},p:x,d(l){l&&o(n)}}}function Js(k){let n,b="Example:",l,d,M;return d=new V({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`,wrap:!1}}),{c(){n=p("p"),n.textContent=b,l=a(),h(d.$$.fragment)},l(s){n=m(s,"P",{"data-svelte-h":!0}),y(n)!=="svelte-11lpom8"&&(n.textContent=b),l=r(s),g(d.$$.fragment,s)},m(s,w){i(s,n,w),i(s,l,w),u(d,s,w),M=!0},p:x,i(s){M||(f(d.$$.fragment,s),M=!0)},o(s){_(d.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(d,s)}}}function Fs(k){let n,b=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=p("p"),n.innerHTML=b},l(l){n=m(l,"P",{"data-svelte-h":!0}),y(n)!=="svelte-fincs2"&&(n.innerHTML=b)},m(l,d){i(l,n,d)},p:x,d(l){l&&o(n)}}}function Ps(k){let n,b=`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 <code>device_map=&quot;auto&quot;</code> in the <code>from_pretrained</code> call.`;return{c(){n=p("p"),n.innerHTML=b},l(l){n=m(l,"P",{"data-svelte-h":!0}),y(n)!=="svelte-1lgpfzy"&&(n.innerHTML=b)},m(l,d){i(l,n,d)},p:x,d(l){l&&o(n)}}}function Us(k){let n,b="Example:",l,d,M;return d=new V({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`,wrap:!1}}),{c(){n=p("p"),n.textContent=b,l=a(),h(d.$$.fragment)},l(s){n=m(s,"P",{"data-svelte-h":!0}),y(n)!=="svelte-11lpom8"&&(n.textContent=b),l=r(s),g(d.$$.fragment,s)},m(s,w){i(s,n,w),i(s,l,w),u(d,s,w),M=!0},p:x,i(s){M||(f(d.$$.fragment,s),M=!0)},o(s){_(d.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(d,s)}}}function zs(k){let n,b=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=p("p"),n.innerHTML=b},l(l){n=m(l,"P",{"data-svelte-h":!0}),y(n)!=="svelte-fincs2"&&(n.innerHTML=b)},m(l,d){i(l,n,d)},p:x,d(l){l&&o(n)}}}function Ws(k){let n,b="Example of single-label classification:",l,d,M;return d=new V({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`,wrap:!1}}),{c(){n=p("p"),n.textContent=b,l=a(),h(d.$$.fragment)},l(s){n=m(s,"P",{"data-svelte-h":!0}),y(n)!=="svelte-ykxpe4"&&(n.textContent=b),l=r(s),g(d.$$.fragment,s)},m(s,w){i(s,n,w),i(s,l,w),u(d,s,w),M=!0},p:x,i(s){M||(f(d.$$.fragment,s),M=!0)},o(s){_(d.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(d,s)}}}function Zs(k){let n,b="Example of multi-label classification:",l,d,M;return d=new V({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`,wrap:!1}}),{c(){n=p("p"),n.textContent=b,l=a(),h(d.$$.fragment)},l(s){n=m(s,"P",{"data-svelte-h":!0}),y(n)!=="svelte-1l8e32d"&&(n.textContent=b),l=r(s),g(d.$$.fragment,s)},m(s,w){i(s,n,w),i(s,l,w),u(d,s,w),M=!0},p:x,i(s){M||(f(d.$$.fragment,s),M=!0)},o(s){_(d.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(d,s)}}}function Is(k){let n,b=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=p("p"),n.innerHTML=b},l(l){n=m(l,"P",{"data-svelte-h":!0}),y(n)!=="svelte-fincs2"&&(n.innerHTML=b)},m(l,d){i(l,n,d)},p:x,d(l){l&&o(n)}}}function Bs(k){let n,b="Example:",l,d,M;return d=new V({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>`,wrap:!1}}),{c(){n=p("p"),n.textContent=b,l=a(),h(d.$$.fragment)},l(s){n=m(s,"P",{"data-svelte-h":!0}),y(n)!=="svelte-11lpom8"&&(n.textContent=b),l=r(s),g(d.$$.fragment,s)},m(s,w){i(s,n,w),i(s,l,w),u(d,s,w),M=!0},p:x,i(s){M||(f(d.$$.fragment,s),M=!0)},o(s){_(d.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(d,s)}}}function Vs(k){let n,b,l,d,M,s,w,Lt,ye,Co=`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’s 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 <a href="https://github.com/EleutherAI/gpt-neox" rel="nofollow">https://github.com/EleutherAI/gpt-neox</a>.`,Rt,Me,Jo=`Development of the model was led by Sid Black, Stella Biderman and Eric Hallahan, and the model was trained with
generous the support of <a href="https://www.coreweave.com/" rel="nofollow">CoreWeave</a>.`,Et,we,Fo="GPT-NeoX-20B was trained with fp16, thus it is recommended to initialize the model as follows:",Qt,ke,St,$e,Po=`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.`,At,ve,Yt,Ge,Uo="The <code>generate()</code> method can be used to generate text using GPT Neo model.",Ot,Xe,Dt,Ne,Kt,je,zo="Flash Attention 2 is an faster, optimized version of the model.",en,xe,tn,Ce,Wo='First, check whether your hardware is compatible with Flash Attention 2. The latest list of compatible hardware can be found in the <a href="https://github.com/Dao-AILab/flash-attention#installation-and-features" rel="nofollow">official documentation</a>. If your hardware is not compatible with Flash Attention 2, you can still benefit from attention kernel optimisations through Better Transformer support covered <a href="https://huggingface.co/docs/transformers/main/en/model_doc/bark#using-better-transformer" rel="nofollow">above</a>.',nn,Je,Zo='Next, <a href="https://github.com/Dao-AILab/flash-attention#installation-and-features" rel="nofollow">install</a> the latest version of Flash Attention 2:',on,Fe,sn,Pe,an,Ue,Io='To load a model using Flash Attention 2, we can pass the argument <code>attn_implementation=&quot;flash_attention_2&quot;</code> to <a href="https://huggingface.co/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained" rel="nofollow"><code>.from_pretrained</code></a>. We’ll also load the model in half-precision (e.g. <code>torch.float16</code>), since it results in almost no degradation to audio quality but significantly lower memory usage and faster inference:',rn,ze,ln,We,dn,Ze,Bo="Below is an expected speedup diagram that compares pure inference time between the native implementation in transformers using <code>stockmark/gpt-neox-japanese-1.4b</code> checkpoint and the Flash Attention 2 version of the model using a sequence length of 2048.",cn,K,Vo='<img src="https://huggingface.co/datasets/ybelkada/documentation-images/resolve/main/gpt-neox-1.8b-speedup.jpg"/>',pn,Ie,mn,Be,qo=`PyTorch includes a native scaled dot-product attention (SDPA) operator as part of <code>torch.nn.functional</code>. This function
encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the
<a href="https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html" rel="nofollow">official documentation</a>
or the <a href="https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention" rel="nofollow">GPU Inference</a>
page for more information.`,hn,Ve,Ho=`SDPA is used by default for <code>torch&gt;=2.1.1</code> when an implementation is available, but you may also set
<code>attn_implementation=&quot;sdpa&quot;</code> in <code>from_pretrained()</code> to explicitly request SDPA to be used.`,gn,qe,un,He,Lo="For the best speedups, we recommend loading the model in half-precision (e.g. <code>torch.float16</code> or <code>torch.bfloat16</code>).",fn,Le,Ro=`On a local benchmark (rtx3080ti-16GB, PyTorch 2.2.1, OS Ubuntu 22.04) using <code>float16</code> with
<a href="https://huggingface.co/EleutherAI/pythia-410m-deduped" rel="nofollow">pythia-410m-deduped</a>, we saw the
following speedups during training and inference.`,_n,Re,Tn,Ee,Eo='<thead><tr><th align="right">Batch size</th> <th align="right">Seq len</th> <th align="right">Time per batch (Eager - s)</th> <th align="right">Time per batch (SDPA - s)</th> <th align="right">Speedup (%)</th> <th align="right">Eager peak mem (MB)</th> <th align="right">SDPA peak mem (MB)</th> <th align="right">Mem saving (%)</th></tr></thead> <tbody><tr><td align="right">1</td> <td align="right">128</td> <td align="right">0.024</td> <td align="right">0.019</td> <td align="right">28.945</td> <td align="right">1789.95</td> <td align="right">1789.95</td> <td align="right">0</td></tr> <tr><td align="right">1</td> <td align="right">256</td> <td align="right">0.039</td> <td align="right">0.031</td> <td align="right">23.18</td> <td align="right">1845.83</td> <td align="right">1844.84</td> <td align="right">0.053</td></tr> <tr><td align="right">1</td> <td align="right">512</td> <td align="right">0.08</td> <td align="right">0.055</td> <td align="right">45.524</td> <td align="right">2278.38</td> <td align="right">1953.76</td> <td align="right">16.615</td></tr> <tr><td align="right">1</td> <td align="right">1024</td> <td align="right">0.19</td> <td align="right">0.102</td> <td align="right">86.777</td> <td align="right">4772.36</td> <td align="right">2408.35</td> <td align="right">98.159</td></tr> <tr><td align="right">1</td> <td align="right">2048</td> <td align="right">0.565</td> <td align="right">0.204</td> <td align="right">177.098</td> <td align="right">13484.1</td> <td align="right">3882.01</td> <td align="right">247.348</td></tr> <tr><td align="right">2</td> <td align="right">128</td> <td align="right">0.037</td> <td align="right">0.032</td> <td align="right">15.121</td> <td align="right">1843.86</td> <td align="right">1844.78</td> <td align="right">-0.05</td></tr> <tr><td align="right">2</td> <td align="right">256</td> <td align="right">0.067</td> <td align="right">0.055</td> <td align="right">21.706</td> <td align="right">1999.72</td> <td align="right">1951.67</td> <td align="right">2.462</td></tr> <tr><td align="right">2</td> <td align="right">512</td> <td align="right">0.144</td> <td align="right">0.096</td> <td align="right">50.046</td> <td align="right">3613.16</td> <td align="right">2406.77</td> <td align="right">50.125</td></tr> <tr><td align="right">2</td> <td align="right">1024</td> <td align="right">0.366</td> <td align="right">0.193</td> <td align="right">89.666</td> <td align="right">8707.55</td> <td align="right">3878.86</td> <td align="right">124.487</td></tr> <tr><td align="right">2</td> <td align="right">2048</td> <td align="right">OOM</td> <td align="right">0.379</td> <td align="right">/</td> <td align="right">OOM</td> <td align="right">6825.13</td> <td align="right">SDPA does not OOM</td></tr> <tr><td align="right">4</td> <td align="right">128</td> <td align="right">0.06</td> <td align="right">0.054</td> <td align="right">11.539</td> <td align="right">1947.6</td> <td align="right">1952.06</td> <td align="right">-0.228</td></tr> <tr><td align="right">4</td> <td align="right">256</td> <td align="right">0.119</td> <td align="right">0.093</td> <td align="right">28.072</td> <td align="right">3008.39</td> <td align="right">2405.99</td> <td align="right">25.038</td></tr> <tr><td align="right">4</td> <td align="right">512</td> <td align="right">0.275</td> <td align="right">0.187</td> <td align="right">47.145</td> <td align="right">6290.58</td> <td align="right">3877.29</td> <td align="right">62.242</td></tr> <tr><td align="right">4</td> <td align="right">1024</td> <td align="right">OOM</td> <td align="right">0.36</td> <td align="right">/</td> <td align="right">OOM</td> <td align="right">6821.98</td> <td align="right">SDPA does not OOM</td></tr> <tr><td align="right">4</td> <td align="right">2048</td> <td align="right">OOM</td> <td align="right">0.731</td> <td align="right">/</td> <td align="right">OOM</td> <td align="right">12705.1</td> <td align="right">SDPA does not OOM</td></tr></tbody>',bn,Qe,yn,Se,Qo='<thead><tr><th align="right">Batch size</th> <th align="right">Seq len</th> <th align="right">Per token latency Eager (ms)</th> <th align="right">Per token latency SDPA (ms)</th> <th align="right">Speedup (%)</th> <th align="right">Mem Eager (MB)</th> <th align="right">Mem SDPA (MB)</th> <th align="right">Mem saved (%)</th></tr></thead> <tbody><tr><td align="right">1</td> <td align="right">128</td> <td align="right">6.569</td> <td align="right">5.858</td> <td align="right">12.14</td> <td align="right">974.831</td> <td align="right">974.826</td> <td align="right">0</td></tr> <tr><td align="right">1</td> <td align="right">256</td> <td align="right">7.009</td> <td align="right">5.863</td> <td align="right">19.542</td> <td align="right">1029.01</td> <td align="right">1028.08</td> <td align="right">0.09</td></tr> <tr><td align="right">1</td> <td align="right">512</td> <td align="right">7.157</td> <td align="right">5.965</td> <td align="right">19.983</td> <td align="right">1137.54</td> <td align="right">1137.52</td> <td align="right">0.001</td></tr> <tr><td align="right">1</td> <td align="right">1024</td> <td align="right">7.523</td> <td align="right">6.506</td> <td align="right">15.637</td> <td align="right">1329.3</td> <td align="right">1329.26</td> <td align="right">0.003</td></tr> <tr><td align="right">1</td> <td align="right">2048</td> <td align="right">9.271</td> <td align="right">9.205</td> <td align="right">0.713</td> <td align="right">1752.47</td> <td align="right">1734.51</td> <td align="right">1.036</td></tr> <tr><td align="right">2</td> <td align="right">128</td> <td align="right">7.239</td> <td align="right">5.959</td> <td align="right">21.493</td> <td align="right">1044.8</td> <td align="right">1028.37</td> <td align="right">1.597</td></tr> <tr><td align="right">2</td> <td align="right">256</td> <td align="right">7.228</td> <td align="right">6.036</td> <td align="right">19.757</td> <td align="right">1167.32</td> <td align="right">1137.73</td> <td align="right">2.601</td></tr> <tr><td align="right">2</td> <td align="right">512</td> <td align="right">7.538</td> <td align="right">6.693</td> <td align="right">12.628</td> <td align="right">1352.93</td> <td align="right">1329.55</td> <td align="right">1.758</td></tr> <tr><td align="right">2</td> <td align="right">1024</td> <td align="right">8.916</td> <td align="right">8.632</td> <td align="right">3.291</td> <td align="right">1752.56</td> <td align="right">1734.62</td> <td align="right">1.034</td></tr> <tr><td align="right">2</td> <td align="right">2048</td> <td align="right">12.628</td> <td align="right">12.606</td> <td align="right">0.181</td> <td align="right">2558.72</td> <td align="right">2545.8</td> <td align="right">0.508</td></tr> <tr><td align="right">4</td> <td align="right">128</td> <td align="right">7.278</td> <td align="right">6.046</td> <td align="right">20.373</td> <td align="right">1168.41</td> <td align="right">1137.79</td> <td align="right">2.691</td></tr> <tr><td align="right">4</td> <td align="right">256</td> <td align="right">7.614</td> <td align="right">6.588</td> <td align="right">15.574</td> <td align="right">1353.1</td> <td align="right">1329.79</td> <td align="right">1.753</td></tr> <tr><td align="right">4</td> <td align="right">512</td> <td align="right">8.798</td> <td align="right">8.144</td> <td align="right">8.028</td> <td align="right">1752.76</td> <td align="right">1734.85</td> <td align="right">1.032</td></tr> <tr><td align="right">4</td> <td align="right">1024</td> <td align="right">11.765</td> <td align="right">11.303</td> <td align="right">4.09</td> <td align="right">2558.96</td> <td align="right">2546.04</td> <td align="right">0.508</td></tr> <tr><td align="right">4</td> <td align="right">2048</td> <td align="right">19.568</td> <td align="right">17.735</td> <td align="right">10.33</td> <td align="right">4175.5</td> <td align="right">4165.26</td> <td align="right">0.246</td></tr></tbody>',Mn,Ae,wn,Ye,So='<li><a href="../tasks/language_modeling">Causal language modeling task guide</a></li>',kn,Oe,$n,z,De,Bn,wt,Ao=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXModel">GPTNeoXModel</a>. 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
<a href="https://huggingface.co/EleutherAI/gpt-neox-20b" rel="nofollow">EleutherAI/gpt-neox-20b</a> architecture.`,Vn,kt,Yo=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,qn,ee,vn,Ke,Gn,$,et,Hn,$t,Oo=`Construct a “fast” GPT-NeoX-20B tokenizer (backed by HuggingFace’s <em>tokenizers</em> library). Based on byte-level
Byte-Pair-Encoding.`,Ln,vt,Do="This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will",Rn,te,En,Gt,Ko=`You can get around that behavior by passing <code>add_prefix_space=True</code> when instantiating this tokenizer, but since
the model was not pretrained this way, it might yield a decrease in performance.`,Qn,ne,Sn,Xt,es=`This tokenizer inherits from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a> which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`,An,oe,tt,Yn,Nt,ts=`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer <code>prepare_for_model</code> method.`,On,se,nt,Dn,jt,ns="Updates the underlying post processor with the current <code>bos_token</code> and <code>eos_token</code>.",Xn,ot,Nn,L,st,Kn,xt,os=`The bare GPTNeoX Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,eo,J,at,to,Ct,ss='The <a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXModel">GPTNeoXModel</a> forward method, overrides the <code>__call__</code> special method.',no,ae,oo,re,so,ie,jn,rt,xn,R,it,ao,Jt,as=`GPTNeoX Model with a <code>language modeling</code> head on top for CLM fine-tuning.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,ro,q,lt,io,Ft,rs='The <a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXForCausalLM">GPTNeoXForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',lo,le,co,de,Cn,dt,Jn,W,ct,po,Pt,is=`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 <code>span start logits</code> and <code>span end logits</code>).`,mo,Ut,ls=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,ho,F,pt,go,zt,ds='The <a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXForQuestionAnswering">GPTNeoXForQuestionAnswering</a> forward method, overrides the <code>__call__</code> special method.',uo,ce,fo,pe,_o,me,Fn,mt,Pn,X,ht,To,Wt,cs="The GPTNeoX Model transformer with a sequence classification head on top (linear layer).",bo,Zt,ps=`<a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXForSequenceClassification">GPTNeoXForSequenceClassification</a> uses the last token in order to do the classification, as other causal models
(e.g. GPT-1) do.`,yo,It,ms=`Since it does classification on the last token, it requires to know the position of the last token. If a
<code>pad_token_id</code> is defined in the configuration, it finds the last token that is not a padding token in each row. If
no <code>pad_token_id</code> is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when <code>inputs_embeds</code> are passed instead of <code>input_ids</code>, it does the same (take the last value in
each row of the batch).`,Mo,Bt,hs=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,wo,P,gt,ko,Vt,gs='The <a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXForSequenceClassification">GPTNeoXForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',$o,he,vo,ge,Go,ue,Un,ut,zn,Y,ft,Xo,H,_t,No,qt,us='The <a href="/docs/transformers/main/en/model_doc/gpt_neox#transformers.GPTNeoXForTokenClassification">GPTNeoXForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',jo,fe,xo,_e,Wn,Tt,Zn,Ht,In;return M=new G({props:{title:"GPT-NeoX",local:"gpt-neox",headingTag:"h1"}}),w=new G({props:{title:"Overview",local:"overview",headingTag:"h2"}}),ke=new V({props:{code:"bW9kZWwlMjAlM0QlMjBHUFROZW9YRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtbmVveC0yMGIlMjIpLmhhbGYoKS5jdWRhKCk=",highlighted:'model = GPTNeoXForCausalLM.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neox-20b&quot;</span>).half().cuda()',wrap:!1}}),ve=new G({props:{title:"Usage example",local:"usage-example",headingTag:"h2"}}),Xe=new V({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>]`,wrap:!1}}),Ne=new G({props:{title:"Using Flash Attention 2",local:"using-flash-attention-2",headingTag:"h2"}}),xe=new G({props:{title:"Installation",local:"installation",headingTag:"h3"}}),Fe=new V({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwZmxhc2gtYXR0biUyMC0tbm8tYnVpbGQtaXNvbGF0aW9u",highlighted:"pip install -U flash-attn --no-build-isolation",wrap:!1}}),Pe=new G({props:{title:"Usage",local:"usage",headingTag:"h3"}}),ze=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVE5lb1hGb3JDYXVzYWxMTSUyQyUyMEdQVE5lb1hUb2tlbml6ZXJGYXN0JTBB",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTNeoXForCausalLM, GPTNeoXTokenizerFast

model = GPTNeoXForCausalLM.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neox-20b&quot;</span>, torch_dtype=torch.float16, attn_implementation=<span class="hljs-string">&quot;flash_attention_2&quot;</span>).to(device)
...`,wrap:!1}}),We=new G({props:{title:"Expected speedups",local:"expected-speedups",headingTag:"h3"}}),Ie=new G({props:{title:"Using Scaled Dot Product Attention (SDPA)",local:"using-scaled-dot-product-attention-sdpa",headingTag:"h2"}}),qe=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVE5lb1hGb3JDYXVzYWxMTSUwQW1vZGVsJTIwJTNEJTIwR1BUTmVvWEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJFbGV1dGhlckFJJTJGZ3B0LW5lb3gtMjBiJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwYXR0bl9pbXBsZW1lbnRhdGlvbiUzRCUyMnNkcGElMjIpJTBBLi4u",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTNeoXForCausalLM
model = GPTNeoXForCausalLM.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-neox-20b&quot;</span>, torch_dtype=torch.float16, attn_implementation=<span class="hljs-string">&quot;sdpa&quot;</span>)
...`,wrap:!1}}),Re=new G({props:{title:"Training",local:"training",headingTag:"h3"}}),Qe=new G({props:{title:"Inference",local:"inference",headingTag:"h3"}}),Ae=new G({props:{title:"Resources",local:"resources",headingTag:"h2"}}),Oe=new G({props:{title:"GPTNeoXConfig",local:"transformers.GPTNeoXConfig",headingTag:"h2"}}),De=new U({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:"attention_bias",val:" = True"},{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 a 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.`,name:"rope_scaling"},{anchor:"transformers.GPTNeoXConfig.attention_bias",description:`<strong>attention_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use a bias in the query, key, value and output projection layers during self-attention.</p>
<p>Example &#x2014;`,name:"attention_bias"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/configuration_gpt_neox.py#L24"}}),ee=new be({props:{anchor:"transformers.GPTNeoXConfig.example",$$slots:{default:[vs]},$$scope:{ctx:k}}}),Ke=new G({props:{title:"GPTNeoXTokenizerFast",local:"transformers.GPTNeoXTokenizerFast",headingTag:"h2"}}),et=new U({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:"pad_token",val:" = None"},{name:"add_bos_token",val:" = False"},{name:"add_eos_token",val:" = False"},{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.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Token for padding a sequence.`,name:"pad_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.add_bos_token",description:`<strong>add_bos_token</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add a <code>bos_token</code> at the start of sequences.`,name:"add_bos_token"},{anchor:"transformers.GPTNeoXTokenizerFast.add_eos_token",description:`<strong>add_eos_token</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add an <code>eos_token</code> at the end of sequences.`,name:"add_eos_token"},{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#L31"}}),te=new be({props:{anchor:"transformers.GPTNeoXTokenizerFast.example",$$slots:{default:[Gs]},$$scope:{ctx:k}}}),ne=new Te({props:{$$slots:{default:[Xs]},$$scope:{ctx:k}}}),tt=new U({props:{name:"get_special_tokens_mask",anchor:"transformers.GPTNeoXTokenizerFast.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.GPTNeoXTokenizerFast.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.GPTNeoXTokenizerFast.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.GPTNeoXTokenizerFast.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/tokenization_gpt_neox_fast.py#L179",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),nt=new U({props:{name:"update_post_processor",anchor:"transformers.GPTNeoXTokenizerFast.update_post_processor",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/tokenization_gpt_neox_fast.py#L152"}}),ot=new G({props:{title:"GPTNeoXModel",local:"transformers.GPTNeoXModel",headingTag:"h2"}}),st=new U({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#L842"}}),at=new U({props:{name:"forward",anchor:"transformers.GPTNeoXModel.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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#L869",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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>) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<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>
`}}),ae=new Te({props:{$$slots:{default:[Ns]},$$scope:{ctx:k}}}),re=new Te({props:{warning:!0,$$slots:{default:[js]},$$scope:{ctx:k}}}),ie=new be({props:{anchor:"transformers.GPTNeoXModel.forward.example",$$slots:{default:[xs]},$$scope:{ctx:k}}}),rt=new G({props:{title:"GPTNeoXForCausalLM",local:"transformers.GPTNeoXForCausalLM",headingTag:"h2"}}),it=new U({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#L1019"}}),lt=new U({props:{name:"forward",anchor:"transformers.GPTNeoXForCausalLM.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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#L1040",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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) — 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>) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<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>
`}}),le=new Te({props:{$$slots:{default:[Cs]},$$scope:{ctx:k}}}),de=new be({props:{anchor:"transformers.GPTNeoXForCausalLM.forward.example",$$slots:{default:[Js]},$$scope:{ctx:k}}}),dt=new G({props:{title:"GPTNeoXForQuestionAnswering",local:"transformers.GPTNeoXForQuestionAnswering",headingTag:"h2"}}),ct=new U({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#L1395"}}),pt=new U({props:{name:"forward",anchor:"transformers.GPTNeoXForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"start_positions",val:": Optional = None"},{name:"end_positions",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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#L1412",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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) — 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>) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<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>
`}}),ce=new Te({props:{$$slots:{default:[Fs]},$$scope:{ctx:k}}}),pe=new Te({props:{warning:!0,$$slots:{default:[Ps]},$$scope:{ctx:k}}}),me=new be({props:{anchor:"transformers.GPTNeoXForQuestionAnswering.forward.example",$$slots:{default:[Us]},$$scope:{ctx:k}}}),mt=new G({props:{title:"GPTNeoXForSequenceClassification",local:"transformers.GPTNeoXForSequenceClassification",headingTag:"h2"}}),ht=new U({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#L1190"}}),gt=new U({props:{name:"forward",anchor:"transformers.GPTNeoXForSequenceClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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#L1215",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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) — 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>) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),he=new Te({props:{$$slots:{default:[zs]},$$scope:{ctx:k}}}),ge=new be({props:{anchor:"transformers.GPTNeoXForSequenceClassification.forward.example",$$slots:{default:[Ws]},$$scope:{ctx:k}}}),ue=new be({props:{anchor:"transformers.GPTNeoXForSequenceClassification.forward.example-2",$$slots:{default:[Zs]},$$scope:{ctx:k}}}),ut=new G({props:{title:"GPTNeoXForTokenClassification",local:"transformers.GPTNeoXForTokenClassification",headingTag:"h2"}}),ft=new U({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#L1318"}}),_t=new U({props:{name:"forward",anchor:"transformers.GPTNeoXForTokenClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = 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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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#L1330",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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)  — Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<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>
`}}),fe=new Te({props:{$$slots:{default:[Is]},$$scope:{ctx:k}}}),_e=new be({props:{anchor:"transformers.GPTNeoXForTokenClassification.forward.example",$$slots:{default:[Bs]},$$scope:{ctx:k}}}),Tt=new $s({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/gpt_neox.md"}}),{c(){n=p("meta"),b=a(),l=p("p"),d=a(),h(M.$$.fragment),s=a(),h(w.$$.fragment),Lt=a(),ye=p("p"),ye.innerHTML=Co,Rt=a(),Me=p("p"),Me.innerHTML=Jo,Et=a(),we=p("p"),we.textContent=Fo,Qt=a(),h(ke.$$.fragment),St=a(),$e=p("p"),$e.textContent=Po,At=a(),h(ve.$$.fragment),Yt=a(),Ge=p("p"),Ge.innerHTML=Uo,Ot=a(),h(Xe.$$.fragment),Dt=a(),h(Ne.$$.fragment),Kt=a(),je=p("p"),je.textContent=zo,en=a(),h(xe.$$.fragment),tn=a(),Ce=p("p"),Ce.innerHTML=Wo,nn=a(),Je=p("p"),Je.innerHTML=Zo,on=a(),h(Fe.$$.fragment),sn=a(),h(Pe.$$.fragment),an=a(),Ue=p("p"),Ue.innerHTML=Io,rn=a(),h(ze.$$.fragment),ln=a(),h(We.$$.fragment),dn=a(),Ze=p("p"),Ze.innerHTML=Bo,cn=a(),K=p("div"),K.innerHTML=Vo,pn=a(),h(Ie.$$.fragment),mn=a(),Be=p("p"),Be.innerHTML=qo,hn=a(),Ve=p("p"),Ve.innerHTML=Ho,gn=a(),h(qe.$$.fragment),un=a(),He=p("p"),He.innerHTML=Lo,fn=a(),Le=p("p"),Le.innerHTML=Ro,_n=a(),h(Re.$$.fragment),Tn=a(),Ee=p("table"),Ee.innerHTML=Eo,bn=a(),h(Qe.$$.fragment),yn=a(),Se=p("table"),Se.innerHTML=Qo,Mn=a(),h(Ae.$$.fragment),wn=a(),Ye=p("ul"),Ye.innerHTML=So,kn=a(),h(Oe.$$.fragment),$n=a(),z=p("div"),h(De.$$.fragment),Bn=a(),wt=p("p"),wt.innerHTML=Ao,Vn=a(),kt=p("p"),kt.innerHTML=Yo,qn=a(),h(ee.$$.fragment),vn=a(),h(Ke.$$.fragment),Gn=a(),$=p("div"),h(et.$$.fragment),Hn=a(),$t=p("p"),$t.innerHTML=Oo,Ln=a(),vt=p("p"),vt.textContent=Do,Rn=a(),h(te.$$.fragment),En=a(),Gt=p("p"),Gt.innerHTML=Ko,Qn=a(),h(ne.$$.fragment),Sn=a(),Xt=p("p"),Xt.innerHTML=es,An=a(),oe=p("div"),h(tt.$$.fragment),Yn=a(),Nt=p("p"),Nt.innerHTML=ts,On=a(),se=p("div"),h(nt.$$.fragment),Dn=a(),jt=p("p"),jt.innerHTML=ns,Xn=a(),h(ot.$$.fragment),Nn=a(),L=p("div"),h(st.$$.fragment),Kn=a(),xt=p("p"),xt.innerHTML=os,eo=a(),J=p("div"),h(at.$$.fragment),to=a(),Ct=p("p"),Ct.innerHTML=ss,no=a(),h(ae.$$.fragment),oo=a(),h(re.$$.fragment),so=a(),h(ie.$$.fragment),jn=a(),h(rt.$$.fragment),xn=a(),R=p("div"),h(it.$$.fragment),ao=a(),Jt=p("p"),Jt.innerHTML=as,ro=a(),q=p("div"),h(lt.$$.fragment),io=a(),Ft=p("p"),Ft.innerHTML=rs,lo=a(),h(le.$$.fragment),co=a(),h(de.$$.fragment),Cn=a(),h(dt.$$.fragment),Jn=a(),W=p("div"),h(ct.$$.fragment),po=a(),Pt=p("p"),Pt.innerHTML=is,mo=a(),Ut=p("p"),Ut.innerHTML=ls,ho=a(),F=p("div"),h(pt.$$.fragment),go=a(),zt=p("p"),zt.innerHTML=ds,uo=a(),h(ce.$$.fragment),fo=a(),h(pe.$$.fragment),_o=a(),h(me.$$.fragment),Fn=a(),h(mt.$$.fragment),Pn=a(),X=p("div"),h(ht.$$.fragment),To=a(),Wt=p("p"),Wt.textContent=cs,bo=a(),Zt=p("p"),Zt.innerHTML=ps,yo=a(),It=p("p"),It.innerHTML=ms,Mo=a(),Bt=p("p"),Bt.innerHTML=hs,wo=a(),P=p("div"),h(gt.$$.fragment),ko=a(),Vt=p("p"),Vt.innerHTML=gs,$o=a(),h(he.$$.fragment),vo=a(),h(ge.$$.fragment),Go=a(),h(ue.$$.fragment),Un=a(),h(ut.$$.fragment),zn=a(),Y=p("div"),h(ft.$$.fragment),Xo=a(),H=p("div"),h(_t.$$.fragment),No=a(),qt=p("p"),qt.innerHTML=us,jo=a(),h(fe.$$.fragment),xo=a(),h(_e.$$.fragment),Wn=a(),h(Tt.$$.fragment),Zn=a(),Ht=p("p"),this.h()},l(e){const t=ws("svelte-u9bgzb",document.head);n=m(t,"META",{name:!0,content:!0}),t.forEach(o),b=r(e),l=m(e,"P",{}),N(l).forEach(o),d=r(e),g(M.$$.fragment,e),s=r(e),g(w.$$.fragment,e),Lt=r(e),ye=m(e,"P",{"data-svelte-h":!0}),y(ye)!=="svelte-utq0jy"&&(ye.innerHTML=Co),Rt=r(e),Me=m(e,"P",{"data-svelte-h":!0}),y(Me)!=="svelte-ar2m2l"&&(Me.innerHTML=Jo),Et=r(e),we=m(e,"P",{"data-svelte-h":!0}),y(we)!=="svelte-1fkanz5"&&(we.textContent=Fo),Qt=r(e),g(ke.$$.fragment,e),St=r(e),$e=m(e,"P",{"data-svelte-h":!0}),y($e)!=="svelte-cswlyd"&&($e.textContent=Po),At=r(e),g(ve.$$.fragment,e),Yt=r(e),Ge=m(e,"P",{"data-svelte-h":!0}),y(Ge)!=="svelte-mhi95y"&&(Ge.innerHTML=Uo),Ot=r(e),g(Xe.$$.fragment,e),Dt=r(e),g(Ne.$$.fragment,e),Kt=r(e),je=m(e,"P",{"data-svelte-h":!0}),y(je)!=="svelte-1r79v6g"&&(je.textContent=zo),en=r(e),g(xe.$$.fragment,e),tn=r(e),Ce=m(e,"P",{"data-svelte-h":!0}),y(Ce)!=="svelte-ib5l43"&&(Ce.innerHTML=Wo),nn=r(e),Je=m(e,"P",{"data-svelte-h":!0}),y(Je)!=="svelte-1pp3dkd"&&(Je.innerHTML=Zo),on=r(e),g(Fe.$$.fragment,e),sn=r(e),g(Pe.$$.fragment,e),an=r(e),Ue=m(e,"P",{"data-svelte-h":!0}),y(Ue)!=="svelte-10jrnsm"&&(Ue.innerHTML=Io),rn=r(e),g(ze.$$.fragment,e),ln=r(e),g(We.$$.fragment,e),dn=r(e),Ze=m(e,"P",{"data-svelte-h":!0}),y(Ze)!=="svelte-1mm1lh6"&&(Ze.innerHTML=Bo),cn=r(e),K=m(e,"DIV",{style:!0,"data-svelte-h":!0}),y(K)!=="svelte-1gyvfup"&&(K.innerHTML=Vo),pn=r(e),g(Ie.$$.fragment,e),mn=r(e),Be=m(e,"P",{"data-svelte-h":!0}),y(Be)!=="svelte-1cid2pe"&&(Be.innerHTML=qo),hn=r(e),Ve=m(e,"P",{"data-svelte-h":!0}),y(Ve)!=="svelte-1x11lxg"&&(Ve.innerHTML=Ho),gn=r(e),g(qe.$$.fragment,e),un=r(e),He=m(e,"P",{"data-svelte-h":!0}),y(He)!=="svelte-djb2w0"&&(He.innerHTML=Lo),fn=r(e),Le=m(e,"P",{"data-svelte-h":!0}),y(Le)!=="svelte-txr44"&&(Le.innerHTML=Ro),_n=r(e),g(Re.$$.fragment,e),Tn=r(e),Ee=m(e,"TABLE",{"data-svelte-h":!0}),y(Ee)!=="svelte-f189pv"&&(Ee.innerHTML=Eo),bn=r(e),g(Qe.$$.fragment,e),yn=r(e),Se=m(e,"TABLE",{"data-svelte-h":!0}),y(Se)!=="svelte-tj67gt"&&(Se.innerHTML=Qo),Mn=r(e),g(Ae.$$.fragment,e),wn=r(e),Ye=m(e,"UL",{"data-svelte-h":!0}),y(Ye)!=="svelte-162aebv"&&(Ye.innerHTML=So),kn=r(e),g(Oe.$$.fragment,e),$n=r(e),z=m(e,"DIV",{class:!0});var E=N(z);g(De.$$.fragment,E),Bn=r(E),wt=m(E,"P",{"data-svelte-h":!0}),y(wt)!=="svelte-1tddkzt"&&(wt.innerHTML=Ao),Vn=r(E),kt=m(E,"P",{"data-svelte-h":!0}),y(kt)!=="svelte-o55m63"&&(kt.innerHTML=Yo),qn=r(E),g(ee.$$.fragment,E),E.forEach(o),vn=r(e),g(Ke.$$.fragment,e),Gn=r(e),$=m(e,"DIV",{class:!0});var v=N($);g(et.$$.fragment,v),Hn=r(v),$t=m(v,"P",{"data-svelte-h":!0}),y($t)!=="svelte-1w4843d"&&($t.innerHTML=Oo),Ln=r(v),vt=m(v,"P",{"data-svelte-h":!0}),y(vt)!=="svelte-1s077p3"&&(vt.textContent=Do),Rn=r(v),g(te.$$.fragment,v),En=r(v),Gt=m(v,"P",{"data-svelte-h":!0}),y(Gt)!=="svelte-1afeqmz"&&(Gt.innerHTML=Ko),Qn=r(v),g(ne.$$.fragment,v),Sn=r(v),Xt=m(v,"P",{"data-svelte-h":!0}),y(Xt)!=="svelte-fh0aq"&&(Xt.innerHTML=es),An=r(v),oe=m(v,"DIV",{class:!0});var bt=N(oe);g(tt.$$.fragment,bt),Yn=r(bt),Nt=m(bt,"P",{"data-svelte-h":!0}),y(Nt)!=="svelte-1f4f5kp"&&(Nt.innerHTML=ts),bt.forEach(o),On=r(v),se=m(v,"DIV",{class:!0});var yt=N(se);g(nt.$$.fragment,yt),Dn=r(yt),jt=m(yt,"P",{"data-svelte-h":!0}),y(jt)!=="svelte-nfci2w"&&(jt.innerHTML=ns),yt.forEach(o),v.forEach(o),Xn=r(e),g(ot.$$.fragment,e),Nn=r(e),L=m(e,"DIV",{class:!0});var O=N(L);g(st.$$.fragment,O),Kn=r(O),xt=m(O,"P",{"data-svelte-h":!0}),y(xt)!=="svelte-qega57"&&(xt.innerHTML=os),eo=r(O),J=m(O,"DIV",{class:!0});var Z=N(J);g(at.$$.fragment,Z),to=r(Z),Ct=m(Z,"P",{"data-svelte-h":!0}),y(Ct)!=="svelte-1u81ycn"&&(Ct.innerHTML=ss),no=r(Z),g(ae.$$.fragment,Z),oo=r(Z),g(re.$$.fragment,Z),so=r(Z),g(ie.$$.fragment,Z),Z.forEach(o),O.forEach(o),jn=r(e),g(rt.$$.fragment,e),xn=r(e),R=m(e,"DIV",{class:!0});var D=N(R);g(it.$$.fragment,D),ao=r(D),Jt=m(D,"P",{"data-svelte-h":!0}),y(Jt)!=="svelte-5dl4wd"&&(Jt.innerHTML=as),ro=r(D),q=m(D,"DIV",{class:!0});var Q=N(q);g(lt.$$.fragment,Q),io=r(Q),Ft=m(Q,"P",{"data-svelte-h":!0}),y(Ft)!=="svelte-1hpyzov"&&(Ft.innerHTML=rs),lo=r(Q),g(le.$$.fragment,Q),co=r(Q),g(de.$$.fragment,Q),Q.forEach(o),D.forEach(o),Cn=r(e),g(dt.$$.fragment,e),Jn=r(e),W=m(e,"DIV",{class:!0});var S=N(W);g(ct.$$.fragment,S),po=r(S),Pt=m(S,"P",{"data-svelte-h":!0}),y(Pt)!=="svelte-1ednh70"&&(Pt.innerHTML=is),mo=r(S),Ut=m(S,"P",{"data-svelte-h":!0}),y(Ut)!=="svelte-68lg8f"&&(Ut.innerHTML=ls),ho=r(S),F=m(S,"DIV",{class:!0});var I=N(F);g(pt.$$.fragment,I),go=r(I),zt=m(I,"P",{"data-svelte-h":!0}),y(zt)!=="svelte-c1ihr7"&&(zt.innerHTML=ds),uo=r(I),g(ce.$$.fragment,I),fo=r(I),g(pe.$$.fragment,I),_o=r(I),g(me.$$.fragment,I),I.forEach(o),S.forEach(o),Fn=r(e),g(mt.$$.fragment,e),Pn=r(e),X=m(e,"DIV",{class:!0});var C=N(X);g(ht.$$.fragment,C),To=r(C),Wt=m(C,"P",{"data-svelte-h":!0}),y(Wt)!=="svelte-16cei4n"&&(Wt.textContent=cs),bo=r(C),Zt=m(C,"P",{"data-svelte-h":!0}),y(Zt)!=="svelte-66iibd"&&(Zt.innerHTML=ps),yo=r(C),It=m(C,"P",{"data-svelte-h":!0}),y(It)!=="svelte-10ugs3m"&&(It.innerHTML=ms),Mo=r(C),Bt=m(C,"P",{"data-svelte-h":!0}),y(Bt)!=="svelte-68lg8f"&&(Bt.innerHTML=hs),wo=r(C),P=m(C,"DIV",{class:!0});var B=N(P);g(gt.$$.fragment,B),ko=r(B),Vt=m(B,"P",{"data-svelte-h":!0}),y(Vt)!=="svelte-1d9zwvd"&&(Vt.innerHTML=gs),$o=r(B),g(he.$$.fragment,B),vo=r(B),g(ge.$$.fragment,B),Go=r(B),g(ue.$$.fragment,B),B.forEach(o),C.forEach(o),Un=r(e),g(ut.$$.fragment,e),zn=r(e),Y=m(e,"DIV",{class:!0});var Mt=N(Y);g(ft.$$.fragment,Mt),Xo=r(Mt),H=m(Mt,"DIV",{class:!0});var A=N(H);g(_t.$$.fragment,A),No=r(A),qt=m(A,"P",{"data-svelte-h":!0}),y(qt)!=="svelte-u6cunr"&&(qt.innerHTML=us),jo=r(A),g(fe.$$.fragment,A),xo=r(A),g(_e.$$.fragment,A),A.forEach(o),Mt.forEach(o),Wn=r(e),g(Tt.$$.fragment,e),Zn=r(e),Ht=m(e,"P",{}),N(Ht).forEach(o),this.h()},h(){j(n,"name","hf:doc:metadata"),j(n,"content",qs),ks(K,"text-align","center"),j(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){c(document.head,n),i(e,b,t),i(e,l,t),i(e,d,t),u(M,e,t),i(e,s,t),u(w,e,t),i(e,Lt,t),i(e,ye,t),i(e,Rt,t),i(e,Me,t),i(e,Et,t),i(e,we,t),i(e,Qt,t),u(ke,e,t),i(e,St,t),i(e,$e,t),i(e,At,t),u(ve,e,t),i(e,Yt,t),i(e,Ge,t),i(e,Ot,t),u(Xe,e,t),i(e,Dt,t),u(Ne,e,t),i(e,Kt,t),i(e,je,t),i(e,en,t),u(xe,e,t),i(e,tn,t),i(e,Ce,t),i(e,nn,t),i(e,Je,t),i(e,on,t),u(Fe,e,t),i(e,sn,t),u(Pe,e,t),i(e,an,t),i(e,Ue,t),i(e,rn,t),u(ze,e,t),i(e,ln,t),u(We,e,t),i(e,dn,t),i(e,Ze,t),i(e,cn,t),i(e,K,t),i(e,pn,t),u(Ie,e,t),i(e,mn,t),i(e,Be,t),i(e,hn,t),i(e,Ve,t),i(e,gn,t),u(qe,e,t),i(e,un,t),i(e,He,t),i(e,fn,t),i(e,Le,t),i(e,_n,t),u(Re,e,t),i(e,Tn,t),i(e,Ee,t),i(e,bn,t),u(Qe,e,t),i(e,yn,t),i(e,Se,t),i(e,Mn,t),u(Ae,e,t),i(e,wn,t),i(e,Ye,t),i(e,kn,t),u(Oe,e,t),i(e,$n,t),i(e,z,t),u(De,z,null),c(z,Bn),c(z,wt),c(z,Vn),c(z,kt),c(z,qn),u(ee,z,null),i(e,vn,t),u(Ke,e,t),i(e,Gn,t),i(e,$,t),u(et,$,null),c($,Hn),c($,$t),c($,Ln),c($,vt),c($,Rn),u(te,$,null),c($,En),c($,Gt),c($,Qn),u(ne,$,null),c($,Sn),c($,Xt),c($,An),c($,oe),u(tt,oe,null),c(oe,Yn),c(oe,Nt),c($,On),c($,se),u(nt,se,null),c(se,Dn),c(se,jt),i(e,Xn,t),u(ot,e,t),i(e,Nn,t),i(e,L,t),u(st,L,null),c(L,Kn),c(L,xt),c(L,eo),c(L,J),u(at,J,null),c(J,to),c(J,Ct),c(J,no),u(ae,J,null),c(J,oo),u(re,J,null),c(J,so),u(ie,J,null),i(e,jn,t),u(rt,e,t),i(e,xn,t),i(e,R,t),u(it,R,null),c(R,ao),c(R,Jt),c(R,ro),c(R,q),u(lt,q,null),c(q,io),c(q,Ft),c(q,lo),u(le,q,null),c(q,co),u(de,q,null),i(e,Cn,t),u(dt,e,t),i(e,Jn,t),i(e,W,t),u(ct,W,null),c(W,po),c(W,Pt),c(W,mo),c(W,Ut),c(W,ho),c(W,F),u(pt,F,null),c(F,go),c(F,zt),c(F,uo),u(ce,F,null),c(F,fo),u(pe,F,null),c(F,_o),u(me,F,null),i(e,Fn,t),u(mt,e,t),i(e,Pn,t),i(e,X,t),u(ht,X,null),c(X,To),c(X,Wt),c(X,bo),c(X,Zt),c(X,yo),c(X,It),c(X,Mo),c(X,Bt),c(X,wo),c(X,P),u(gt,P,null),c(P,ko),c(P,Vt),c(P,$o),u(he,P,null),c(P,vo),u(ge,P,null),c(P,Go),u(ue,P,null),i(e,Un,t),u(ut,e,t),i(e,zn,t),i(e,Y,t),u(ft,Y,null),c(Y,Xo),c(Y,H),u(_t,H,null),c(H,No),c(H,qt),c(H,jo),u(fe,H,null),c(H,xo),u(_e,H,null),i(e,Wn,t),u(Tt,e,t),i(e,Zn,t),i(e,Ht,t),In=!0},p(e,[t]){const E={};t&2&&(E.$$scope={dirty:t,ctx:e}),ee.$set(E);const v={};t&2&&(v.$$scope={dirty:t,ctx:e}),te.$set(v);const bt={};t&2&&(bt.$$scope={dirty:t,ctx:e}),ne.$set(bt);const yt={};t&2&&(yt.$$scope={dirty:t,ctx:e}),ae.$set(yt);const O={};t&2&&(O.$$scope={dirty:t,ctx:e}),re.$set(O);const Z={};t&2&&(Z.$$scope={dirty:t,ctx:e}),ie.$set(Z);const D={};t&2&&(D.$$scope={dirty:t,ctx:e}),le.$set(D);const Q={};t&2&&(Q.$$scope={dirty:t,ctx:e}),de.$set(Q);const S={};t&2&&(S.$$scope={dirty:t,ctx:e}),ce.$set(S);const I={};t&2&&(I.$$scope={dirty:t,ctx:e}),pe.$set(I);const C={};t&2&&(C.$$scope={dirty:t,ctx:e}),me.$set(C);const B={};t&2&&(B.$$scope={dirty:t,ctx:e}),he.$set(B);const Mt={};t&2&&(Mt.$$scope={dirty:t,ctx:e}),ge.$set(Mt);const A={};t&2&&(A.$$scope={dirty:t,ctx:e}),ue.$set(A);const fs={};t&2&&(fs.$$scope={dirty:t,ctx:e}),fe.$set(fs);const _s={};t&2&&(_s.$$scope={dirty:t,ctx:e}),_e.$set(_s)},i(e){In||(f(M.$$.fragment,e),f(w.$$.fragment,e),f(ke.$$.fragment,e),f(ve.$$.fragment,e),f(Xe.$$.fragment,e),f(Ne.$$.fragment,e),f(xe.$$.fragment,e),f(Fe.$$.fragment,e),f(Pe.$$.fragment,e),f(ze.$$.fragment,e),f(We.$$.fragment,e),f(Ie.$$.fragment,e),f(qe.$$.fragment,e),f(Re.$$.fragment,e),f(Qe.$$.fragment,e),f(Ae.$$.fragment,e),f(Oe.$$.fragment,e),f(De.$$.fragment,e),f(ee.$$.fragment,e),f(Ke.$$.fragment,e),f(et.$$.fragment,e),f(te.$$.fragment,e),f(ne.$$.fragment,e),f(tt.$$.fragment,e),f(nt.$$.fragment,e),f(ot.$$.fragment,e),f(st.$$.fragment,e),f(at.$$.fragment,e),f(ae.$$.fragment,e),f(re.$$.fragment,e),f(ie.$$.fragment,e),f(rt.$$.fragment,e),f(it.$$.fragment,e),f(lt.$$.fragment,e),f(le.$$.fragment,e),f(de.$$.fragment,e),f(dt.$$.fragment,e),f(ct.$$.fragment,e),f(pt.$$.fragment,e),f(ce.$$.fragment,e),f(pe.$$.fragment,e),f(me.$$.fragment,e),f(mt.$$.fragment,e),f(ht.$$.fragment,e),f(gt.$$.fragment,e),f(he.$$.fragment,e),f(ge.$$.fragment,e),f(ue.$$.fragment,e),f(ut.$$.fragment,e),f(ft.$$.fragment,e),f(_t.$$.fragment,e),f(fe.$$.fragment,e),f(_e.$$.fragment,e),f(Tt.$$.fragment,e),In=!0)},o(e){_(M.$$.fragment,e),_(w.$$.fragment,e),_(ke.$$.fragment,e),_(ve.$$.fragment,e),_(Xe.$$.fragment,e),_(Ne.$$.fragment,e),_(xe.$$.fragment,e),_(Fe.$$.fragment,e),_(Pe.$$.fragment,e),_(ze.$$.fragment,e),_(We.$$.fragment,e),_(Ie.$$.fragment,e),_(qe.$$.fragment,e),_(Re.$$.fragment,e),_(Qe.$$.fragment,e),_(Ae.$$.fragment,e),_(Oe.$$.fragment,e),_(De.$$.fragment,e),_(ee.$$.fragment,e),_(Ke.$$.fragment,e),_(et.$$.fragment,e),_(te.$$.fragment,e),_(ne.$$.fragment,e),_(tt.$$.fragment,e),_(nt.$$.fragment,e),_(ot.$$.fragment,e),_(st.$$.fragment,e),_(at.$$.fragment,e),_(ae.$$.fragment,e),_(re.$$.fragment,e),_(ie.$$.fragment,e),_(rt.$$.fragment,e),_(it.$$.fragment,e),_(lt.$$.fragment,e),_(le.$$.fragment,e),_(de.$$.fragment,e),_(dt.$$.fragment,e),_(ct.$$.fragment,e),_(pt.$$.fragment,e),_(ce.$$.fragment,e),_(pe.$$.fragment,e),_(me.$$.fragment,e),_(mt.$$.fragment,e),_(ht.$$.fragment,e),_(gt.$$.fragment,e),_(he.$$.fragment,e),_(ge.$$.fragment,e),_(ue.$$.fragment,e),_(ut.$$.fragment,e),_(ft.$$.fragment,e),_(_t.$$.fragment,e),_(fe.$$.fragment,e),_(_e.$$.fragment,e),_(Tt.$$.fragment,e),In=!1},d(e){e&&(o(b),o(l),o(d),o(s),o(Lt),o(ye),o(Rt),o(Me),o(Et),o(we),o(Qt),o(St),o($e),o(At),o(Yt),o(Ge),o(Ot),o(Dt),o(Kt),o(je),o(en),o(tn),o(Ce),o(nn),o(Je),o(on),o(sn),o(an),o(Ue),o(rn),o(ln),o(dn),o(Ze),o(cn),o(K),o(pn),o(mn),o(Be),o(hn),o(Ve),o(gn),o(un),o(He),o(fn),o(Le),o(_n),o(Tn),o(Ee),o(bn),o(yn),o(Se),o(Mn),o(wn),o(Ye),o(kn),o($n),o(z),o(vn),o(Gn),o($),o(Xn),o(Nn),o(L),o(jn),o(xn),o(R),o(Cn),o(Jn),o(W),o(Fn),o(Pn),o(X),o(Un),o(zn),o(Y),o(Wn),o(Zn),o(Ht)),o(n),T(M,e),T(w,e),T(ke,e),T(ve,e),T(Xe,e),T(Ne,e),T(xe,e),T(Fe,e),T(Pe,e),T(ze,e),T(We,e),T(Ie,e),T(qe,e),T(Re,e),T(Qe,e),T(Ae,e),T(Oe,e),T(De),T(ee),T(Ke,e),T(et),T(te),T(ne),T(tt),T(nt),T(ot,e),T(st),T(at),T(ae),T(re),T(ie),T(rt,e),T(it),T(lt),T(le),T(de),T(dt,e),T(ct),T(pt),T(ce),T(pe),T(me),T(mt,e),T(ht),T(gt),T(he),T(ge),T(ue),T(ut,e),T(ft),T(_t),T(fe),T(_e),T(Tt,e)}}}const qs='{"title":"GPT-NeoX","local":"gpt-neox","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage example","local":"usage-example","sections":[],"depth":2},{"title":"Using Flash Attention 2","local":"using-flash-attention-2","sections":[{"title":"Installation","local":"installation","sections":[],"depth":3},{"title":"Usage","local":"usage","sections":[],"depth":3},{"title":"Expected speedups","local":"expected-speedups","sections":[],"depth":3}],"depth":2},{"title":"Using Scaled Dot Product Attention (SDPA)","local":"using-scaled-dot-product-attention-sdpa","sections":[{"title":"Training","local":"training","sections":[],"depth":3},{"title":"Inference","local":"inference","sections":[],"depth":3}],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"GPTNeoXConfig","local":"transformers.GPTNeoXConfig","sections":[],"depth":2},{"title":"GPTNeoXTokenizerFast","local":"transformers.GPTNeoXTokenizerFast","sections":[],"depth":2},{"title":"GPTNeoXModel","local":"transformers.GPTNeoXModel","sections":[],"depth":2},{"title":"GPTNeoXForCausalLM","local":"transformers.GPTNeoXForCausalLM","sections":[],"depth":2},{"title":"GPTNeoXForQuestionAnswering","local":"transformers.GPTNeoXForQuestionAnswering","sections":[],"depth":2},{"title":"GPTNeoXForSequenceClassification","local":"transformers.GPTNeoXForSequenceClassification","sections":[],"depth":2},{"title":"GPTNeoXForTokenClassification","local":"transformers.GPTNeoXForTokenClassification","sections":[],"depth":2}],"depth":1}';function Hs(k){return bs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Os extends ys{constructor(n){super(),Ms(this,n,Hs,Vs,Ts,{})}}export{Os as component};
