Buckets:
| import{s as zs,o as Fs,n as j}from"../chunks/scheduler.25b97de1.js";import{S as Js,i as Us,g as p,s as a,r as g,A as Ws,h,f as o,c as r,j as X,u as m,x as b,k as C,l as Is,y as d,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 W}from"../chunks/Docstring.ffac8efa.js";import{C as R}from"../chunks/CodeBlock.e6cd0d95.js";import{E as be}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as x,E as Zs}from"../chunks/EditOnGithub.91d95064.js";function qs(w){let n,y;return n=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVE5lb1hDb25maWclMkMlMjBHUFROZW9YTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwR1BUTmVvWCUyMGdwdC1uZW94LTIwYiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBHUFROZW9YQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMGdwdC1uZW94LTIwYiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwR1BUTmVvWE1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTNeoXConfig, GPTNeoXModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Initializing a GPTNeoX gpt-neox-20b style configuration</span> | |
| <span class="hljs-meta">>>> </span>configuration = GPTNeoXConfig() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Initializing a model (with random weights) from the gpt-neox-20b style configuration</span> | |
| <span class="hljs-meta">>>> </span>model = GPTNeoXModel(configuration) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Accessing the model configuration</span> | |
| <span class="hljs-meta">>>> </span>configuration = model.config`,wrap:!1}}),{c(){g(n.$$.fragment)},l(l){m(n.$$.fragment,l)},m(l,c){u(n,l,c),y=!0},p:j,i(l){y||(f(n.$$.fragment,l),y=!0)},o(l){_(n.$$.fragment,l),y=!1},d(l){T(n,l)}}}function Bs(w){let n,y="be encoded differently whether it is at the beginning of the sentence (without space) or not:",l,c,M;return c=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVE5lb1hUb2tlbml6ZXJGYXN0JTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwR1BUTmVvWFRva2VuaXplckZhc3QuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haS1jb21tdW5pdHklMkZncHQyJTIyKSUwQXRva2VuaXplciglMjJIZWxsbyUyMHdvcmxkJTIyKSU1QiUyMmlucHV0X2lkcyUyMiU1RCUwQSUwQXRva2VuaXplciglMjIlMjBIZWxsbyUyMHdvcmxkJTIyKSU1QiUyMmlucHV0X2lkcyUyMiU1RA==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTNeoXTokenizerFast | |
| <span class="hljs-meta">>>> </span>tokenizer = GPTNeoXTokenizerFast.from_pretrained(<span class="hljs-string">"openai-community/gpt2"</span>) | |
| <span class="hljs-meta">>>> </span>tokenizer(<span class="hljs-string">"Hello world"</span>)[<span class="hljs-string">"input_ids"</span>] | |
| [<span class="hljs-number">15496</span>, <span class="hljs-number">995</span>] | |
| <span class="hljs-meta">>>> </span>tokenizer(<span class="hljs-string">" Hello world"</span>)[<span class="hljs-string">"input_ids"</span>] | |
| [<span class="hljs-number">18435</span>, <span class="hljs-number">995</span>]`,wrap:!1}}),{c(){n=p("p"),n.textContent=y,l=a(),g(c.$$.fragment)},l(s){n=h(s,"P",{"data-svelte-h":!0}),b(n)!=="svelte-12atnao"&&(n.textContent=y),l=r(s),m(c.$$.fragment,s)},m(s,k){i(s,n,k),i(s,l,k),u(c,s,k),M=!0},p:j,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(c,s)}}}function Ls(w){let n,y="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=y},l(l){n=h(l,"P",{"data-svelte-h":!0}),b(n)!=="svelte-9gg91e"&&(n.innerHTML=y)},m(l,c){i(l,n,c)},p:j,d(l){l&&o(n)}}}function Vs(w){let n,y=`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=y},l(l){n=h(l,"P",{"data-svelte-h":!0}),b(n)!=="svelte-fincs2"&&(n.innerHTML=y)},m(l,c){i(l,n,c)},p:j,d(l){l&&o(n)}}}function Hs(w){let n,y=`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="auto"</code> in the <code>from_pretrained</code> call.`;return{c(){n=p("p"),n.innerHTML=y},l(l){n=h(l,"P",{"data-svelte-h":!0}),b(n)!=="svelte-1lgpfzy"&&(n.innerHTML=y)},m(l,c){i(l,n,c)},p:j,d(l){l&&o(n)}}}function Rs(w){let n,y="Example:",l,c,M;return c=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHUFROZW9YTW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnRybC1pbnRlcm5hbC10ZXN0aW5nJTJGdGlueS1yYW5kb20tR1BUTmVvWEZvckNhdXNhbExNJTIyKSUwQW1vZGVsJTIwJTNEJTIwR1BUTmVvWE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJ0cmwtaW50ZXJuYWwtdGVzdGluZyUyRnRpbnktcmFuZG9tLUdQVE5lb1hGb3JDYXVzYWxMTSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTNeoXModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"trl-internal-testing/tiny-random-GPTNeoXForCausalLM"</span>) | |
| <span class="hljs-meta">>>> </span>model = GPTNeoXModel.from_pretrained(<span class="hljs-string">"trl-internal-testing/tiny-random-GPTNeoXForCausalLM"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>last_hidden_states = outputs.last_hidden_state`,wrap:!1}}),{c(){n=p("p"),n.textContent=y,l=a(),g(c.$$.fragment)},l(s){n=h(s,"P",{"data-svelte-h":!0}),b(n)!=="svelte-11lpom8"&&(n.textContent=y),l=r(s),m(c.$$.fragment,s)},m(s,k){i(s,n,k),i(s,l,k),u(c,s,k),M=!0},p:j,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(c,s)}}}function Es(w){let n,y=`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=y},l(l){n=h(l,"P",{"data-svelte-h":!0}),b(n)!=="svelte-fincs2"&&(n.innerHTML=y)},m(l,c){i(l,n,c)},p:j,d(l){l&&o(n)}}}function Ss(w){let n,y="Example:",l,c,M;return c=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHUFROZW9YRm9yQ2F1c2FsTE0lMkMlMjBHUFROZW9YQ29uZmlnJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJFbGV1dGhlckFJJTJGZ3B0LW5lb3gtMjBiJTIyKSUwQWNvbmZpZyUyMCUzRCUyMEdQVE5lb1hDb25maWcuZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtbmVveC0yMGIlMjIpJTBBY29uZmlnLmlzX2RlY29kZXIlMjAlM0QlMjBUcnVlJTBBbW9kZWwlMjAlM0QlMjBHUFROZW9YRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtbmVveC0yMGIlMjIlMkMlMjBjb25maWclM0Rjb25maWcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFwcmVkaWN0aW9uX2xvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTNeoXForCausalLM, GPTNeoXConfig | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"EleutherAI/gpt-neox-20b"</span>) | |
| <span class="hljs-meta">>>> </span>config = GPTNeoXConfig.from_pretrained(<span class="hljs-string">"EleutherAI/gpt-neox-20b"</span>) | |
| <span class="hljs-meta">>>> </span>config.is_decoder = <span class="hljs-literal">True</span> | |
| <span class="hljs-meta">>>> </span>model = GPTNeoXForCausalLM.from_pretrained(<span class="hljs-string">"EleutherAI/gpt-neox-20b"</span>, config=config) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>prediction_logits = outputs.logits`,wrap:!1}}),{c(){n=p("p"),n.textContent=y,l=a(),g(c.$$.fragment)},l(s){n=h(s,"P",{"data-svelte-h":!0}),b(n)!=="svelte-11lpom8"&&(n.textContent=y),l=r(s),m(c.$$.fragment,s)},m(s,k){i(s,n,k),i(s,l,k),u(c,s,k),M=!0},p:j,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(c,s)}}}function Qs(w){let n,y=`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=y},l(l){n=h(l,"P",{"data-svelte-h":!0}),b(n)!=="svelte-fincs2"&&(n.innerHTML=y)},m(l,c){i(l,n,c)},p:j,d(l){l&&o(n)}}}function As(w){let n,y=`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="auto"</code> in the <code>from_pretrained</code> call.`;return{c(){n=p("p"),n.innerHTML=y},l(l){n=h(l,"P",{"data-svelte-h":!0}),b(n)!=="svelte-1lgpfzy"&&(n.innerHTML=y)},m(l,c){i(l,n,c)},p:j,d(l){l&&o(n)}}}function Ys(w){let n,y="Example:",l,c,M;return c=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHUFROZW9YRm9yUXVlc3Rpb25BbnN3ZXJpbmclMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnRybC1pbnRlcm5hbC10ZXN0aW5nJTJGdGlueS1yYW5kb20tR1BUTmVvWEZvckNhdXNhbExNJTIyKSUwQW1vZGVsJTIwJTNEJTIwR1BUTmVvWEZvclF1ZXN0aW9uQW5zd2VyaW5nLmZyb21fcHJldHJhaW5lZCglMjJ0cmwtaW50ZXJuYWwtdGVzdGluZyUyRnRpbnktcmFuZG9tLUdQVE5lb1hGb3JDYXVzYWxMTSUyMiklMEElMEFxdWVzdGlvbiUyQyUyMHRleHQlMjAlM0QlMjAlMjJXaG8lMjB3YXMlMjBKaW0lMjBIZW5zb24lM0YlMjIlMkMlMjAlMjJKaW0lMjBIZW5zb24lMjB3YXMlMjBhJTIwbmljZSUyMHB1cHBldCUyMiUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihxdWVzdGlvbiUyQyUyMHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBYW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNEJTIwb3V0cHV0cy5zdGFydF9sb2dpdHMuYXJnbWF4KCklMEFhbnN3ZXJfZW5kX2luZGV4JTIwJTNEJTIwb3V0cHV0cy5lbmRfbG9naXRzLmFyZ21heCgpJTBBJTBBcHJlZGljdF9hbnN3ZXJfdG9rZW5zJTIwJTNEJTIwaW5wdXRzLmlucHV0X2lkcyU1QjAlMkMlMjBhbnN3ZXJfc3RhcnRfaW5kZXglMjAlM0ElMjBhbnN3ZXJfZW5kX2luZGV4JTIwJTJCJTIwMSU1RCUwQSUwQSUyMyUyMHRhcmdldCUyMGlzJTIwJTIybmljZSUyMHB1cHBldCUyMiUwQXRhcmdldF9zdGFydF9pbmRleCUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxNCU1RCklMEF0YXJnZXRfZW5kX2luZGV4JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QjE1JTVEKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMHN0YXJ0X3Bvc2l0aW9ucyUzRHRhcmdldF9zdGFydF9pbmRleCUyQyUyMGVuZF9wb3NpdGlvbnMlM0R0YXJnZXRfZW5kX2luZGV4KSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3M=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTNeoXForQuestionAnswering | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"trl-internal-testing/tiny-random-GPTNeoXForCausalLM"</span>) | |
| <span class="hljs-meta">>>> </span>model = GPTNeoXForQuestionAnswering.from_pretrained(<span class="hljs-string">"trl-internal-testing/tiny-random-GPTNeoXForCausalLM"</span>) | |
| <span class="hljs-meta">>>> </span>question, text = <span class="hljs-string">"Who was Jim Henson?"</span>, <span class="hljs-string">"Jim Henson was a nice puppet"</span> | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>answer_start_index = outputs.start_logits.argmax() | |
| <span class="hljs-meta">>>> </span>answer_end_index = outputs.end_logits.argmax() | |
| <span class="hljs-meta">>>> </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">>>> </span><span class="hljs-comment"># target is "nice puppet"</span> | |
| <span class="hljs-meta">>>> </span>target_start_index = torch.tensor([<span class="hljs-number">14</span>]) | |
| <span class="hljs-meta">>>> </span>target_end_index = torch.tensor([<span class="hljs-number">15</span>]) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index) | |
| <span class="hljs-meta">>>> </span>loss = outputs.loss`,wrap:!1}}),{c(){n=p("p"),n.textContent=y,l=a(),g(c.$$.fragment)},l(s){n=h(s,"P",{"data-svelte-h":!0}),b(n)!=="svelte-11lpom8"&&(n.textContent=y),l=r(s),m(c.$$.fragment,s)},m(s,k){i(s,n,k),i(s,l,k),u(c,s,k),M=!0},p:j,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(c,s)}}}function Os(w){let n,y=`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=y},l(l){n=h(l,"P",{"data-svelte-h":!0}),b(n)!=="svelte-fincs2"&&(n.innerHTML=y)},m(l,c){i(l,n,c)},p:j,d(l){l&&o(n)}}}function Ds(w){let n,y="Example of single-label classification:",l,c,M;return c=new R({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEdQVE5lb1hGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIydHJsLWludGVybmFsLXRlc3RpbmclMkZ0aW55LXJhbmRvbS1HUFROZW9YRm9yQ2F1c2FsTE0lMjIpJTBBbW9kZWwlMjAlM0QlMjBHUFROZW9YRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIydHJsLWludGVybmFsLXRlc3RpbmclMkZ0aW55LXJhbmRvbS1HUFROZW9YRm9yQ2F1c2FsTE0lMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkJTIwJTNEJTIwbG9naXRzLmFyZ21heCgpLml0ZW0oKSUwQSUwQSUyMyUyMFRvJTIwdHJhaW4lMjBhJTIwbW9kZWwlMjBvbiUyMCU2MG51bV9sYWJlbHMlNjAlMjBjbGFzc2VzJTJDJTIweW91JTIwY2FuJTIwcGFzcyUyMCU2MG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTYwJTIwdG8lMjAlNjAuZnJvbV9wcmV0cmFpbmVkKC4uLiklNjAlMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFtb2RlbCUyMCUzRCUyMEdQVE5lb1hGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJ0cmwtaW50ZXJuYWwtdGVzdGluZyUyRnRpbnktcmFuZG9tLUdQVE5lb1hGb3JDYXVzYWxMTSUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTNeoXForSequenceClassification | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"trl-internal-testing/tiny-random-GPTNeoXForCausalLM"</span>) | |
| <span class="hljs-meta">>>> </span>model = GPTNeoXForSequenceClassification.from_pretrained(<span class="hljs-string">"trl-internal-testing/tiny-random-GPTNeoXForCausalLM"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_class_id = logits.argmax().item() | |
| <span class="hljs-meta">>>> </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">>>> </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label) | |
| <span class="hljs-meta">>>> </span>model = GPTNeoXForSequenceClassification.from_pretrained(<span class="hljs-string">"trl-internal-testing/tiny-random-GPTNeoXForCausalLM"</span>, num_labels=num_labels) | |
| <span class="hljs-meta">>>> </span>labels = torch.tensor([<span class="hljs-number">1</span>]) | |
| <span class="hljs-meta">>>> </span>loss = model(**inputs, labels=labels).loss`,wrap:!1}}),{c(){n=p("p"),n.textContent=y,l=a(),g(c.$$.fragment)},l(s){n=h(s,"P",{"data-svelte-h":!0}),b(n)!=="svelte-ykxpe4"&&(n.textContent=y),l=r(s),m(c.$$.fragment,s)},m(s,k){i(s,n,k),i(s,l,k),u(c,s,k),M=!0},p:j,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(c,s)}}}function Ks(w){let n,y="Example of multi-label classification:",l,c,M;return c=new R({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEdQVE5lb1hGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIydHJsLWludGVybmFsLXRlc3RpbmclMkZ0aW55LXJhbmRvbS1HUFROZW9YRm9yQ2F1c2FsTE0lMjIpJTBBbW9kZWwlMjAlM0QlMjBHUFROZW9YRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIydHJsLWludGVybmFsLXRlc3RpbmclMkZ0aW55LXJhbmRvbS1HUFROZW9YRm9yQ2F1c2FsTE0lMjIlMkMlMjBwcm9ibGVtX3R5cGUlM0QlMjJtdWx0aV9sYWJlbF9jbGFzc2lmaWNhdGlvbiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWRzJTIwJTNEJTIwdG9yY2guYXJhbmdlKDAlMkMlMjBsb2dpdHMuc2hhcGUlNUItMSU1RCklNUJ0b3JjaC5zaWdtb2lkKGxvZ2l0cykuc3F1ZWV6ZShkaW0lM0QwKSUyMCUzRSUyMDAuNSU1RCUwQSUwQSUyMyUyMFRvJTIwdHJhaW4lMjBhJTIwbW9kZWwlMjBvbiUyMCU2MG51bV9sYWJlbHMlNjAlMjBjbGFzc2VzJTJDJTIweW91JTIwY2FuJTIwcGFzcyUyMCU2MG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTYwJTIwdG8lMjAlNjAuZnJvbV9wcmV0cmFpbmVkKC4uLiklNjAlMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFtb2RlbCUyMCUzRCUyMEdQVE5lb1hGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJ0cmwtaW50ZXJuYWwtdGVzdGluZyUyRnRpbnktcmFuZG9tLUdQVE5lb1hGb3JDYXVzYWxMTSUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTNeoXForSequenceClassification | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"trl-internal-testing/tiny-random-GPTNeoXForCausalLM"</span>) | |
| <span class="hljs-meta">>>> </span>model = GPTNeoXForSequenceClassification.from_pretrained(<span class="hljs-string">"trl-internal-testing/tiny-random-GPTNeoXForCausalLM"</span>, problem_type=<span class="hljs-string">"multi_label_classification"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </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>) > <span class="hljs-number">0.5</span>] | |
| <span class="hljs-meta">>>> </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">>>> </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label) | |
| <span class="hljs-meta">>>> </span>model = GPTNeoXForSequenceClassification.from_pretrained( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"trl-internal-testing/tiny-random-GPTNeoXForCausalLM"</span>, num_labels=num_labels, problem_type=<span class="hljs-string">"multi_label_classification"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </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">>>> </span>loss = model(**inputs, labels=labels).loss`,wrap:!1}}),{c(){n=p("p"),n.textContent=y,l=a(),g(c.$$.fragment)},l(s){n=h(s,"P",{"data-svelte-h":!0}),b(n)!=="svelte-1l8e32d"&&(n.textContent=y),l=r(s),m(c.$$.fragment,s)},m(s,k){i(s,n,k),i(s,l,k),u(c,s,k),M=!0},p:j,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(c,s)}}}function ea(w){let n,y=`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=y},l(l){n=h(l,"P",{"data-svelte-h":!0}),b(n)!=="svelte-fincs2"&&(n.innerHTML=y)},m(l,c){i(l,n,c)},p:j,d(l){l&&o(n)}}}function ta(w){let n,y="Example:",l,c,M;return c=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHUFROZW9YRm9yVG9rZW5DbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyTGFyc0pvbmFzc29uJTJGcHl0aGlhLTQxMG0tZGVkdXBlZC1zZnQtc3dlZGlzaCUyMiklMEFtb2RlbCUyMCUzRCUyMEdQVE5lb1hGb3JUb2tlbkNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJMYXJzSm9uYXNzb24lMkZweXRoaWEtNDEwbS1kZWR1cGVkLXNmdC1zd2VkaXNoJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjAlMjJIdWdnaW5nRmFjZSUyMGlzJTIwYSUyMGNvbXBhbnklMjBiYXNlZCUyMGluJTIwUGFyaXMlMjBhbmQlMjBOZXclMjBZb3JrJTIyJTJDJTIwYWRkX3NwZWNpYWxfdG9rZW5zJTNERmFsc2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoLTEpJTBBJTBBJTIzJTIwTm90ZSUyMHRoYXQlMjB0b2tlbnMlMjBhcmUlMjBjbGFzc2lmaWVkJTIwcmF0aGVyJTIwdGhlbiUyMGlucHV0JTIwd29yZHMlMjB3aGljaCUyMG1lYW5zJTIwdGhhdCUwQSUyMyUyMHRoZXJlJTIwbWlnaHQlMjBiZSUyMG1vcmUlMjBwcmVkaWN0ZWQlMjB0b2tlbiUyMGNsYXNzZXMlMjB0aGFuJTIwd29yZHMuJTBBJTIzJTIwTXVsdGlwbGUlMjB0b2tlbiUyMGNsYXNzZXMlMjBtaWdodCUyMGFjY291bnQlMjBmb3IlMjB0aGUlMjBzYW1lJTIwd29yZCUwQXByZWRpY3RlZF90b2tlbnNfY2xhc3NlcyUyMCUzRCUyMCU1Qm1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnQuaXRlbSgpJTVEJTIwZm9yJTIwdCUyMGluJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyU1QjAlNUQlNUQlMEElMEFsYWJlbHMlMjAlM0QlMjBwcmVkaWN0ZWRfdG9rZW5fY2xhc3NfaWRzJTBBbG9zcyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKS5sb3NzJTBBcm91bmQobG9zcy5pdGVtKCklMkMlMjAyKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTNeoXForTokenClassification | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"LarsJonasson/pythia-410m-deduped-sft-swedish"</span>) | |
| <span class="hljs-meta">>>> </span>model = GPTNeoXForTokenClassification.from_pretrained(<span class="hljs-string">"LarsJonasson/pythia-410m-deduped-sft-swedish"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"HuggingFace is a company based in Paris and New York"</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">"pt"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_token_class_ids = logits.argmax(-<span class="hljs-number">1</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Note that tokens are classified rather then input words which means that</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># there might be more predicted token classes than words.</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Multiple token classes might account for the same word</span> | |
| <span class="hljs-meta">>>> </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">>>> </span>labels = predicted_token_class_ids | |
| <span class="hljs-meta">>>> </span>loss = model(**inputs, labels=labels).loss | |
| <span class="hljs-meta">>>> </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=y,l=a(),g(c.$$.fragment)},l(s){n=h(s,"P",{"data-svelte-h":!0}),b(n)!=="svelte-11lpom8"&&(n.textContent=y),l=r(s),m(c.$$.fragment,s)},m(s,k){i(s,n,k),i(s,l,k),u(c,s,k),M=!0},p:j,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(o(n),o(l)),T(c,s)}}}function na(w){let n,y,l,c,M,s,k,At,ye,Bo=`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>.`,Yt,Me,Lo=`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>.`,Ot,ke,Vo="GPT-NeoX-20B was trained with fp16, thus it is recommended to initialize the model as follows:",Dt,we,Kt,ve,Ho=`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.`,en,$e,tn,Ge,Ro="The <code>generate()</code> method can be used to generate text using GPT Neo model.",nn,xe,on,Ne,sn,Xe,Eo="Flash Attention 2 is an faster, optimized version of the model.",an,Ce,rn,je,So='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>.',ln,Pe,Qo='Next, <a href="https://github.com/Dao-AILab/flash-attention#installation-and-features" rel="nofollow">install</a> the latest version of Flash Attention 2:',dn,ze,cn,Fe,pn,Je,Ao='To load a model using Flash Attention 2, we can pass the argument <code>attn_implementation="flash_attention_2"</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:',hn,Ue,gn,We,mn,Ie,Yo="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.",un,K,Oo='<img src="https://huggingface.co/datasets/ybelkada/documentation-images/resolve/main/gpt-neox-1.8b-speedup.jpg"/>',fn,Ze,_n,qe,Do=`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.`,Tn,Be,Ko=`SDPA is used by default for <code>torch>=2.1.1</code> when an implementation is available, but you may also set | |
| <code>attn_implementation="sdpa"</code> in <code>from_pretrained()</code> to explicitly request SDPA to be used.`,bn,Le,yn,Ve,es="For the best speedups, we recommend loading the model in half-precision (e.g. <code>torch.float16</code> or <code>torch.bfloat16</code>).",Mn,He,ts=`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.`,kn,Re,wn,Ee,ns='<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>',vn,Se,$n,Qe,os='<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>',Gn,Ae,xn,Ye,ss='<li><a href="../tasks/language_modeling">Causal language modeling task guide</a></li>',Nn,Oe,Xn,I,De,Rn,kt,as=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_36287/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.`,En,wt,rs=`Configuration objects inherit from <a href="/docs/transformers/pr_36287/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/pr_36287/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Sn,ee,Cn,Ke,jn,v,et,Qn,vt,is=`Construct a “fast” GPT-NeoX-20B tokenizer (backed by HuggingFace’s <em>tokenizers</em> library). Based on byte-level | |
| Byte-Pair-Encoding.`,An,$t,ls="This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will",Yn,te,On,Gt,ds=`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.`,Dn,ne,Kn,xt,cs=`This tokenizer inherits from <a href="/docs/transformers/pr_36287/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.`,eo,oe,tt,to,Nt,ps=`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.`,no,se,nt,oo,Xt,hs="Updates the underlying post processor with the current <code>bos_token</code> and <code>eos_token</code>.",Pn,ot,zn,P,st,so,Ct,gs=`The bare GPTNeoX Model outputting raw hidden-states without any specific head on top. | |
| This model inherits from <a href="/docs/transformers/pr_36287/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,ao,jt,ms=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,ro,Pt,us="Transformer decoder consisting of <em>config.num_hidden_layers</em> layers. Each layer is a <code>GPTNeoXDecoderLayer</code>",io,F,at,lo,zt,fs='The <a href="/docs/transformers/pr_36287/en/model_doc/gpt_neox#transformers.GPTNeoXModel">GPTNeoXModel</a> forward method, overrides the <code>__call__</code> special method.',co,ae,po,re,ho,ie,Fn,rt,Jn,Z,it,go,Ft,_s=`GPTNeoX Model with a <code>language modeling</code> head on top for CLM fine-tuning. | |
| This model inherits from <a href="/docs/transformers/pr_36287/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,mo,Jt,Ts=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,uo,E,lt,fo,Ut,bs='The <a href="/docs/transformers/pr_36287/en/model_doc/gpt_neox#transformers.GPTNeoXForCausalLM">GPTNeoXForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',_o,le,To,de,Un,dt,Wn,z,ct,bo,Wt,ys=`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>).`,yo,It,Ms=`This model inherits from <a href="/docs/transformers/pr_36287/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,Mo,Zt,ks=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,ko,J,pt,wo,qt,ws='The <a href="/docs/transformers/pr_36287/en/model_doc/gpt_neox#transformers.GPTNeoXForQuestionAnswering">GPTNeoXForQuestionAnswering</a> forward method, overrides the <code>__call__</code> special method.',vo,ce,$o,pe,Go,he,In,ht,Zn,G,gt,xo,Bt,vs="The GPTNeoX Model transformer with a sequence classification head on top (linear layer).",No,Lt,$s=`<a href="/docs/transformers/pr_36287/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.`,Xo,Vt,Gs=`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).`,Co,Ht,xs=`This model inherits from <a href="/docs/transformers/pr_36287/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,jo,Rt,Ns=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,Po,U,mt,zo,Et,Xs='The <a href="/docs/transformers/pr_36287/en/model_doc/gpt_neox#transformers.GPTNeoXForSequenceClassification">GPTNeoXForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',Fo,ge,Jo,me,Uo,ue,qn,ut,Bn,D,ft,Wo,S,_t,Io,St,Cs='The <a href="/docs/transformers/pr_36287/en/model_doc/gpt_neox#transformers.GPTNeoXForTokenClassification">GPTNeoXForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',Zo,fe,qo,_e,Ln,Tt,Vn,Qt,Hn;return M=new x({props:{title:"GPT-NeoX",local:"gpt-neox",headingTag:"h1"}}),k=new x({props:{title:"Overview",local:"overview",headingTag:"h2"}}),we=new R({props:{code:"bW9kZWwlMjAlM0QlMjBHUFROZW9YRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtbmVveC0yMGIlMjIpLmhhbGYoKS5jdWRhKCk=",highlighted:'model = GPTNeoXForCausalLM.from_pretrained(<span class="hljs-string">"EleutherAI/gpt-neox-20b"</span>).half().cuda()',wrap:!1}}),$e=new x({props:{title:"Usage example",local:"usage-example",headingTag:"h2"}}),xe=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVE5lb1hGb3JDYXVzYWxMTSUyQyUyMEdQVE5lb1hUb2tlbml6ZXJGYXN0JTBBJTBBbW9kZWwlMjAlM0QlMjBHUFROZW9YRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtbmVveC0yMGIlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwR1BUTmVvWFRva2VuaXplckZhc3QuZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtbmVveC0yMGIlMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyR1BUTmVvWDIwQiUyMGlzJTIwYSUyMDIwQi1wYXJhbWV0ZXIlMjBhdXRvcmVncmVzc2l2ZSUyMFRyYW5zZm9ybWVyJTIwbW9kZWwlMjBkZXZlbG9wZWQlMjBieSUyMEVsZXV0aGVyQUkuJTIyJTBBJTBBaW5wdXRfaWRzJTIwJTNEJTIwdG9rZW5pemVyKHByb21wdCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcyUwQSUwQWdlbl90b2tlbnMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSglMEElMjAlMjAlMjAlMjBpbnB1dF9pZHMlMkMlMEElMjAlMjAlMjAlMjBkb19zYW1wbGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwdGVtcGVyYXR1cmUlM0QwLjklMkMlMEElMjAlMjAlMjAlMjBtYXhfbGVuZ3RoJTNEMTAwJTJDJTBBKSUwQWdlbl90ZXh0JTIwJTNEJTIwdG9rZW5pemVyLmJhdGNoX2RlY29kZShnZW5fdG9rZW5zKSU1QjAlNUQ=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTNeoXForCausalLM, GPTNeoXTokenizerFast | |
| <span class="hljs-meta">>>> </span>model = GPTNeoXForCausalLM.from_pretrained(<span class="hljs-string">"EleutherAI/gpt-neox-20b"</span>) | |
| <span class="hljs-meta">>>> </span>tokenizer = GPTNeoXTokenizerFast.from_pretrained(<span class="hljs-string">"EleutherAI/gpt-neox-20b"</span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"GPTNeoX20B is a 20B-parameter autoregressive Transformer model developed by EleutherAI."</span> | |
| <span class="hljs-meta">>>> </span>input_ids = tokenizer(prompt, return_tensors=<span class="hljs-string">"pt"</span>).input_ids | |
| <span class="hljs-meta">>>> </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">>>> </span>gen_text = tokenizer.batch_decode(gen_tokens)[<span class="hljs-number">0</span>]`,wrap:!1}}),Ne=new x({props:{title:"Using Flash Attention 2",local:"using-flash-attention-2",headingTag:"h2"}}),Ce=new x({props:{title:"Installation",local:"installation",headingTag:"h3"}}),ze=new R({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwZmxhc2gtYXR0biUyMC0tbm8tYnVpbGQtaXNvbGF0aW9u",highlighted:"pip install -U flash-attn --no-build-isolation",wrap:!1}}),Fe=new x({props:{title:"Usage",local:"usage",headingTag:"h3"}}),Ue=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVE5lb1hGb3JDYXVzYWxMTSUyQyUyMEdQVE5lb1hUb2tlbml6ZXJGYXN0JTBB",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTNeoXForCausalLM, GPTNeoXTokenizerFast | |
| model = GPTNeoXForCausalLM.from_pretrained(<span class="hljs-string">"EleutherAI/gpt-neox-20b"</span>, torch_dtype=torch.float16, attn_implementation=<span class="hljs-string">"flash_attention_2"</span>).to(device) | |
| ...`,wrap:!1}}),We=new x({props:{title:"Expected speedups",local:"expected-speedups",headingTag:"h3"}}),Ze=new x({props:{title:"Using Scaled Dot Product Attention (SDPA)",local:"using-scaled-dot-product-attention-sdpa",headingTag:"h2"}}),Le=new R({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">"EleutherAI/gpt-neox-20b"</span>, torch_dtype=torch.float16, attn_implementation=<span class="hljs-string">"sdpa"</span>) | |
| ...`,wrap:!1}}),Re=new x({props:{title:"Training",local:"training",headingTag:"h3"}}),Se=new x({props:{title:"Inference",local:"inference",headingTag:"h3"}}),Ae=new x({props:{title:"Resources",local:"resources",headingTag:"h2"}}),Oe=new x({props:{title:"GPTNeoXConfig",local:"transformers.GPTNeoXConfig",headingTag:"h2"}}),De=new W({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) — | |
| 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/pr_36287/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) — | |
| 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) — | |
| 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) — | |
| 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) — | |
| Dimension of the “intermediate” (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>"gelu"</code>) — | |
| The non-linear activation function (function or string) in the encoder and pooler. If string, <code>"gelu"</code>, | |
| <code>"relu"</code>, <code>"selu"</code> and <code>"gelu_new"</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) — | |
| 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) — | |
| 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) — | |
| 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) — | |
| 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) — | |
| Argument used when doing token classification, used in the model <a href="/docs/transformers/pr_36287/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) — | |
| 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) — | |
| 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) — | |
| 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>) — | |
| 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>) — | |
| Whether to use a “parallel” 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>) — | |
| Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type | |
| and you expect the model to work on longer <code>max_position_embeddings</code>, we recommend you to update this value | |
| accordingly. | |
| Expected contents: | |
| <code>rope_type</code> (<code>str</code>): | |
| The sub-variant of RoPE to use. Can be one of [‘default’, ‘linear’, ‘dynamic’, ‘yarn’, ‘longrope’, | |
| ‘llama3’], with ‘default’ being the original RoPE implementation. | |
| <code>factor</code> (<code>float</code>, <em>optional</em>): | |
| Used with all rope types except ‘default’. The scaling factor to apply to the RoPE embeddings. In | |
| most scaling types, a <code>factor</code> of x will enable the model to handle sequences of length x <em> | |
| original maximum pre-trained length. | |
| <code>original_max_position_embeddings</code> (<code>int</code>, </em>optional<em>): | |
| Used with ‘dynamic’, ‘longrope’ and ‘llama3’. The original max position embeddings used during | |
| pretraining. | |
| <code>attention_factor</code> (<code>float</code>, </em>optional<em>): | |
| Used with ‘yarn’ and ‘longrope’. The scaling factor to be applied on the attention | |
| computation. If unspecified, it defaults to value recommended by the implementation, using the | |
| <code>factor</code> field to infer the suggested value. | |
| <code>beta_fast</code> (<code>float</code>, </em>optional<em>): | |
| Only used with ‘yarn’. Parameter to set the boundary for extrapolation (only) in the linear | |
| ramp function. If unspecified, it defaults to 32. | |
| <code>beta_slow</code> (<code>float</code>, </em>optional<em>): | |
| Only used with ‘yarn’. Parameter to set the boundary for interpolation (only) in the linear | |
| ramp function. If unspecified, it defaults to 1. | |
| <code>short_factor</code> (<code>List[float]</code>, </em>optional<em>): | |
| Only used with ‘longrope’. The scaling factor to be applied to short contexts (< | |
| <code>original_max_position_embeddings</code>). Must be a list of numbers with the same length as the hidden | |
| size divided by the number of attention heads divided by 2 | |
| <code>long_factor</code> (<code>List[float]</code>, </em>optional<em>): | |
| Only used with ‘longrope’. The scaling factor to be applied to long contexts (< | |
| <code>original_max_position_embeddings</code>). Must be a list of numbers with the same length as the hidden | |
| size divided by the number of attention heads divided by 2 | |
| <code>low_freq_factor</code> (<code>float</code>, </em>optional<em>): | |
| Only used with ‘llama3’. Scaling factor applied to low frequency components of the RoPE | |
| <code>high_freq_factor</code> (<code>float</code>, </em>optional*): | |
| Only used with ‘llama3’. Scaling factor applied to high frequency components of the RoPE`,name:"rope_scaling"},{anchor:"transformers.GPTNeoXConfig.attention_bias",description:`<strong>attention_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to use a bias in the query, key, value and output projection layers during self-attention.`,name:"attention_bias"},{anchor:"transformers.GPTNeoXConfig.Example",description:"<strong>Example</strong> —",name:"Example"}],source:"https://github.com/huggingface/transformers/blob/vr_36287/src/transformers/models/gpt_neox/configuration_gpt_neox.py#L25"}}),ee=new be({props:{anchor:"transformers.GPTNeoXConfig.example",$$slots:{default:[qs]},$$scope:{ctx:w}}}),Ke=new x({props:{title:"GPTNeoXTokenizerFast",local:"transformers.GPTNeoXTokenizerFast",headingTag:"h2"}}),et=new W({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>) — | |
| Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.GPTNeoXTokenizerFast.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) — | |
| 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>"replace"</code>) — | |
| 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><|endoftext|></code>) — | |
| 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><|endoftext|></code>) — | |
| 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><|endoftext|></code>) — | |
| The end of sequence token.`,name:"eos_token"},{anchor:"transformers.GPTNeoXTokenizerFast.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| Whether or not the post-processing step should trim offsets to avoid including whitespaces.`,name:"trim_offsets"}],source:"https://github.com/huggingface/transformers/blob/vr_36287/src/transformers/models/gpt_neox/tokenization_gpt_neox_fast.py#L30"}}),te=new be({props:{anchor:"transformers.GPTNeoXTokenizerFast.example",$$slots:{default:[Bs]},$$scope:{ctx:w}}}),ne=new Te({props:{$$slots:{default:[Ls]},$$scope:{ctx:w}}}),tt=new W({props:{name:"get_special_tokens_mask",anchor:"transformers.GPTNeoXTokenizerFast.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = 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>) — | |
| 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>) — | |
| 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>) — | |
| 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/vr_36287/src/transformers/models/gpt_neox/tokenization_gpt_neox_fast.py#L170",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 W({props:{name:"update_post_processor",anchor:"transformers.GPTNeoXTokenizerFast.update_post_processor",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_36287/src/transformers/models/gpt_neox/tokenization_gpt_neox_fast.py#L143"}}),ot=new x({props:{title:"GPTNeoXModel",local:"transformers.GPTNeoXModel",headingTag:"h2"}}),st=new W({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/pr_36287/en/model_doc/gpt_neox#transformers.GPTNeoXConfig">GPTNeoXConfig</a>) — | |
| Model configuration class with all the parameters of the model. Initializing with a config file does not | |
| load the weights associated with the model, only the configuration. Check out the | |
| <a href="/docs/transformers/pr_36287/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.GPTNeoXModel.config",description:"<strong>config</strong> — GPTNeoXConfig",name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_36287/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L473"}}),at=new W({props:{name:"forward",anchor:"transformers.GPTNeoXModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"past_key_values",val:": typing.Optional[transformers.cache_utils.Cache] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = None"},{name:"**flash_attn_kwargs",val:": typing_extensions.Unpack[transformers.modeling_flash_attention_utils.FlashAttentionKwargs]"}],parametersDescription:[{anchor:"transformers.GPTNeoXModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide | |
| it.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36287/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36287/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.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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></p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36287/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p>If <code>past_key_values</code> is used, optionally only the last <code>input_ids</code> have to be input (see | |
| <code>past_key_values</code>).</p> | |
| <p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code> | |
| and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more | |
| information on the default strategy.</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:"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>) — | |
| 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.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Two formats are allowed:</p> | |
| <ul> | |
| <li>a <a href="/docs/transformers/pr_36287/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our | |
| <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li> | |
| <li>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>). This is also known as the legacy | |
| cache format.</li> | |
| </ul> | |
| <p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the | |
| legacy cache format will be returned.</p> | |
| <p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{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>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoXModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see | |
| <code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.GPTNeoXModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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>) — | |
| 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>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_36287/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTNeoXModel.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) — | |
| Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>, | |
| this tensor is not affected by padding. It is used to update the cache in the correct position and to infer | |
| the complete sequence length.`,name:"cache_position"}],source:"https://github.com/huggingface/transformers/blob/vr_36287/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L505",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_36287/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast" | |
| >transformers.modeling_outputs.BaseModelOutputWithPast</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_36287/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/pr_36287/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:[Vs]},$$scope:{ctx:w}}}),re=new Te({props:{warning:!0,$$slots:{default:[Hs]},$$scope:{ctx:w}}}),ie=new be({props:{anchor:"transformers.GPTNeoXModel.forward.example",$$slots:{default:[Rs]},$$scope:{ctx:w}}}),rt=new x({props:{title:"GPTNeoXForCausalLM",local:"transformers.GPTNeoXForCausalLM",headingTag:"h2"}}),it=new W({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/pr_36287/en/model_doc/gpt_neox#transformers.GPTNeoXConfig">GPTNeoXConfig</a>) — | |
| Model configuration class with all the parameters of the model. Initializing with a config file does not | |
| load the weights associated with the model, only the configuration. Check out the | |
| <a href="/docs/transformers/pr_36287/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/vr_36287/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L757"}}),lt=new W({props:{name:"forward",anchor:"transformers.GPTNeoXForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"past_key_values",val:": typing.Union[transformers.cache_utils.Cache, typing.Tuple[typing.Tuple[torch.FloatTensor]], NoneType] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = None"},{name:"logits_to_keep",val:": typing.Union[int, torch.Tensor] = 0"},{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.gpt_neox.modeling_gpt_neox.KwargsForCausalLM]"}],parametersDescription:[{anchor:"transformers.GPTNeoXForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide | |
| it.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36287/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36287/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.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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></p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36287/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p>If <code>past_key_values</code> is used, optionally only the last <code>input_ids</code> have to be input (see | |
| <code>past_key_values</code>).</p> | |
| <p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code> | |
| and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more | |
| information on the default strategy.</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:"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>) — | |
| 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.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Two formats are allowed:</p> | |
| <ul> | |
| <li>a <a href="/docs/transformers/pr_36287/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our | |
| <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li> | |
| <li>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>). This is also known as the legacy | |
| cache format.</li> | |
| </ul> | |
| <p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the | |
| legacy cache format will be returned.</p> | |
| <p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{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>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoXForCausalLM.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see | |
| <code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.GPTNeoXForCausalLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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>) — | |
| 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>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_36287/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTNeoXForCausalLM.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) — | |
| Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>, | |
| this tensor is not affected by padding. It is used to update the cache in the correct position and to infer | |
| the complete sequence length.`,name:"cache_position"},{anchor:"transformers.GPTNeoXForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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>) — | |
| 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/vr_36287/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L780",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_36287/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast" | |
| >transformers.modeling_outputs.CausalLMOutputWithPast</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_36287/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/pr_36287/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:[Es]},$$scope:{ctx:w}}}),de=new be({props:{anchor:"transformers.GPTNeoXForCausalLM.forward.example",$$slots:{default:[Ss]},$$scope:{ctx:w}}}),dt=new x({props:{title:"GPTNeoXForQuestionAnswering",local:"transformers.GPTNeoXForQuestionAnswering",headingTag:"h2"}}),ct=new W({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/pr_36287/en/model_doc/gpt_neox#transformers.GPTNeoXConfig">GPTNeoXConfig</a>) — | |
| Model configuration class with all the parameters of the model. Initializing with a config file does not | |
| load the weights associated with the model, only the configuration. Check out the | |
| <a href="/docs/transformers/pr_36287/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/vr_36287/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L1044"}}),pt=new W({props:{name:"forward",anchor:"transformers.GPTNeoXForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"end_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.GPTNeoXForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide | |
| it.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36287/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36287/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.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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></p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36287/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p>If <code>past_key_values</code> is used, optionally only the last <code>input_ids</code> have to be input (see | |
| <code>past_key_values</code>).</p> | |
| <p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code> | |
| and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more | |
| information on the default strategy.</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:"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>) — | |
| 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.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Two formats are allowed:</p> | |
| <ul> | |
| <li>a <a href="/docs/transformers/pr_36287/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our | |
| <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li> | |
| <li>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>). This is also known as the legacy | |
| cache format.</li> | |
| </ul> | |
| <p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the | |
| legacy cache format will be returned.</p> | |
| <p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{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>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoXForQuestionAnswering.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see | |
| <code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.GPTNeoXForQuestionAnswering.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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>) — | |
| 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>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_36287/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTNeoXForQuestionAnswering.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) — | |
| Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>, | |
| this tensor is not affected by padding. It is used to update the cache in the correct position and to infer | |
| the complete sequence length.`,name:"cache_position"},{anchor:"transformers.GPTNeoXForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| 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>) — | |
| 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/vr_36287/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L1061",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_36287/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput" | |
| >transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_36287/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/pr_36287/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:[Qs]},$$scope:{ctx:w}}}),pe=new Te({props:{warning:!0,$$slots:{default:[As]},$$scope:{ctx:w}}}),he=new be({props:{anchor:"transformers.GPTNeoXForQuestionAnswering.forward.example",$$slots:{default:[Ys]},$$scope:{ctx:w}}}),ht=new x({props:{title:"GPTNeoXForSequenceClassification",local:"transformers.GPTNeoXForSequenceClassification",headingTag:"h2"}}),gt=new W({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/pr_36287/en/model_doc/gpt_neox#transformers.GPTNeoXConfig">GPTNeoXConfig</a>) — | |
| Model configuration class with all the parameters of the model. Initializing with a config file does not | |
| load the weights associated with the model, only the configuration. Check out the | |
| <a href="/docs/transformers/pr_36287/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/vr_36287/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L865"}}),mt=new W({props:{name:"forward",anchor:"transformers.GPTNeoXForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"past_key_values",val:": typing.Union[transformers.cache_utils.Cache, typing.Tuple[typing.Tuple[torch.FloatTensor]], NoneType] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.GPTNeoXForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide | |
| it.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36287/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36287/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.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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></p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36287/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p>If <code>past_key_values</code> is used, optionally only the last <code>input_ids</code> have to be input (see | |
| <code>past_key_values</code>).</p> | |
| <p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code> | |
| and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more | |
| information on the default strategy.</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:"attention_mask"},{anchor:"transformers.GPTNeoXForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Two formats are allowed:</p> | |
| <ul> | |
| <li>a <a href="/docs/transformers/pr_36287/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our | |
| <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li> | |
| <li>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>). This is also known as the legacy | |
| cache format.</li> | |
| </ul> | |
| <p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the | |
| legacy cache format will be returned.</p> | |
| <p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.GPTNeoXForSequenceClassification.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>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoXForSequenceClassification.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see | |
| <code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.GPTNeoXForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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>) — | |
| 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>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_36287/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTNeoXForSequenceClassification.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) — | |
| Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>, | |
| this tensor is not affected by padding. It is used to update the cache in the correct position and to infer | |
| the complete sequence length.`,name:"cache_position"},{anchor:"transformers.GPTNeoXForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| 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 > 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_36287/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L890",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/pr_36287/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> | |
| `}}),ge=new Te({props:{$$slots:{default:[Os]},$$scope:{ctx:w}}}),me=new be({props:{anchor:"transformers.GPTNeoXForSequenceClassification.forward.example",$$slots:{default:[Ds]},$$scope:{ctx:w}}}),ue=new be({props:{anchor:"transformers.GPTNeoXForSequenceClassification.forward.example-2",$$slots:{default:[Ks]},$$scope:{ctx:w}}}),ut=new x({props:{title:"GPTNeoXForTokenClassification",local:"transformers.GPTNeoXForTokenClassification",headingTag:"h2"}}),ft=new W({props:{name:"class transformers.GPTNeoXForTokenClassification",anchor:"transformers.GPTNeoXForTokenClassification",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_36287/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L969"}}),_t=new W({props:{name:"forward",anchor:"transformers.GPTNeoXForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Union[transformers.cache_utils.Cache, typing.Tuple[typing.Tuple[torch.Tensor]], NoneType] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.GPTNeoXForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide | |
| it.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36287/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36287/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.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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></p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36287/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36287/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p>If <code>past_key_values</code> is used, optionally only the last <code>input_ids</code> have to be input (see | |
| <code>past_key_values</code>).</p> | |
| <p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code> | |
| and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more | |
| information on the default strategy.</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:"attention_mask"},{anchor:"transformers.GPTNeoXForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Two formats are allowed:</p> | |
| <ul> | |
| <li>a <a href="/docs/transformers/pr_36287/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our | |
| <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li> | |
| <li>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>). This is also known as the legacy | |
| cache format.</li> | |
| </ul> | |
| <p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the | |
| legacy cache format will be returned.</p> | |
| <p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.GPTNeoXForTokenClassification.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>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTNeoXForTokenClassification.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see | |
| <code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.GPTNeoXForTokenClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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>) — | |
| 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>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_36287/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTNeoXForTokenClassification.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) — | |
| Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>, | |
| this tensor is not affected by padding. It is used to update the cache in the correct position and to infer | |
| the complete sequence length.`,name:"cache_position"},{anchor:"transformers.GPTNeoXForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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 > 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_36287/src/transformers/models/gpt_neox/modeling_gpt_neox.py#L981",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_36287/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/pr_36287/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/pr_36287/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:[ea]},$$scope:{ctx:w}}}),_e=new be({props:{anchor:"transformers.GPTNeoXForTokenClassification.forward.example",$$slots:{default:[ta]},$$scope:{ctx:w}}}),Tt=new Zs({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/gpt_neox.md"}}),{c(){n=p("meta"),y=a(),l=p("p"),c=a(),g(M.$$.fragment),s=a(),g(k.$$.fragment),At=a(),ye=p("p"),ye.innerHTML=Bo,Yt=a(),Me=p("p"),Me.innerHTML=Lo,Ot=a(),ke=p("p"),ke.textContent=Vo,Dt=a(),g(we.$$.fragment),Kt=a(),ve=p("p"),ve.textContent=Ho,en=a(),g($e.$$.fragment),tn=a(),Ge=p("p"),Ge.innerHTML=Ro,nn=a(),g(xe.$$.fragment),on=a(),g(Ne.$$.fragment),sn=a(),Xe=p("p"),Xe.textContent=Eo,an=a(),g(Ce.$$.fragment),rn=a(),je=p("p"),je.innerHTML=So,ln=a(),Pe=p("p"),Pe.innerHTML=Qo,dn=a(),g(ze.$$.fragment),cn=a(),g(Fe.$$.fragment),pn=a(),Je=p("p"),Je.innerHTML=Ao,hn=a(),g(Ue.$$.fragment),gn=a(),g(We.$$.fragment),mn=a(),Ie=p("p"),Ie.innerHTML=Yo,un=a(),K=p("div"),K.innerHTML=Oo,fn=a(),g(Ze.$$.fragment),_n=a(),qe=p("p"),qe.innerHTML=Do,Tn=a(),Be=p("p"),Be.innerHTML=Ko,bn=a(),g(Le.$$.fragment),yn=a(),Ve=p("p"),Ve.innerHTML=es,Mn=a(),He=p("p"),He.innerHTML=ts,kn=a(),g(Re.$$.fragment),wn=a(),Ee=p("table"),Ee.innerHTML=ns,vn=a(),g(Se.$$.fragment),$n=a(),Qe=p("table"),Qe.innerHTML=os,Gn=a(),g(Ae.$$.fragment),xn=a(),Ye=p("ul"),Ye.innerHTML=ss,Nn=a(),g(Oe.$$.fragment),Xn=a(),I=p("div"),g(De.$$.fragment),Rn=a(),kt=p("p"),kt.innerHTML=as,En=a(),wt=p("p"),wt.innerHTML=rs,Sn=a(),g(ee.$$.fragment),Cn=a(),g(Ke.$$.fragment),jn=a(),v=p("div"),g(et.$$.fragment),Qn=a(),vt=p("p"),vt.innerHTML=is,An=a(),$t=p("p"),$t.textContent=ls,Yn=a(),g(te.$$.fragment),On=a(),Gt=p("p"),Gt.innerHTML=ds,Dn=a(),g(ne.$$.fragment),Kn=a(),xt=p("p"),xt.innerHTML=cs,eo=a(),oe=p("div"),g(tt.$$.fragment),to=a(),Nt=p("p"),Nt.innerHTML=ps,no=a(),se=p("div"),g(nt.$$.fragment),oo=a(),Xt=p("p"),Xt.innerHTML=hs,Pn=a(),g(ot.$$.fragment),zn=a(),P=p("div"),g(st.$$.fragment),so=a(),Ct=p("p"),Ct.innerHTML=gs,ao=a(),jt=p("p"),jt.innerHTML=ms,ro=a(),Pt=p("p"),Pt.innerHTML=us,io=a(),F=p("div"),g(at.$$.fragment),lo=a(),zt=p("p"),zt.innerHTML=fs,co=a(),g(ae.$$.fragment),po=a(),g(re.$$.fragment),ho=a(),g(ie.$$.fragment),Fn=a(),g(rt.$$.fragment),Jn=a(),Z=p("div"),g(it.$$.fragment),go=a(),Ft=p("p"),Ft.innerHTML=_s,mo=a(),Jt=p("p"),Jt.innerHTML=Ts,uo=a(),E=p("div"),g(lt.$$.fragment),fo=a(),Ut=p("p"),Ut.innerHTML=bs,_o=a(),g(le.$$.fragment),To=a(),g(de.$$.fragment),Un=a(),g(dt.$$.fragment),Wn=a(),z=p("div"),g(ct.$$.fragment),bo=a(),Wt=p("p"),Wt.innerHTML=ys,yo=a(),It=p("p"),It.innerHTML=Ms,Mo=a(),Zt=p("p"),Zt.innerHTML=ks,ko=a(),J=p("div"),g(pt.$$.fragment),wo=a(),qt=p("p"),qt.innerHTML=ws,vo=a(),g(ce.$$.fragment),$o=a(),g(pe.$$.fragment),Go=a(),g(he.$$.fragment),In=a(),g(ht.$$.fragment),Zn=a(),G=p("div"),g(gt.$$.fragment),xo=a(),Bt=p("p"),Bt.textContent=vs,No=a(),Lt=p("p"),Lt.innerHTML=$s,Xo=a(),Vt=p("p"),Vt.innerHTML=Gs,Co=a(),Ht=p("p"),Ht.innerHTML=xs,jo=a(),Rt=p("p"),Rt.innerHTML=Ns,Po=a(),U=p("div"),g(mt.$$.fragment),zo=a(),Et=p("p"),Et.innerHTML=Xs,Fo=a(),g(ge.$$.fragment),Jo=a(),g(me.$$.fragment),Uo=a(),g(ue.$$.fragment),qn=a(),g(ut.$$.fragment),Bn=a(),D=p("div"),g(ft.$$.fragment),Wo=a(),S=p("div"),g(_t.$$.fragment),Io=a(),St=p("p"),St.innerHTML=Cs,Zo=a(),g(fe.$$.fragment),qo=a(),g(_e.$$.fragment),Ln=a(),g(Tt.$$.fragment),Vn=a(),Qt=p("p"),this.h()},l(e){const t=Ws("svelte-u9bgzb",document.head);n=h(t,"META",{name:!0,content:!0}),t.forEach(o),y=r(e),l=h(e,"P",{}),X(l).forEach(o),c=r(e),m(M.$$.fragment,e),s=r(e),m(k.$$.fragment,e),At=r(e),ye=h(e,"P",{"data-svelte-h":!0}),b(ye)!=="svelte-utq0jy"&&(ye.innerHTML=Bo),Yt=r(e),Me=h(e,"P",{"data-svelte-h":!0}),b(Me)!=="svelte-ar2m2l"&&(Me.innerHTML=Lo),Ot=r(e),ke=h(e,"P",{"data-svelte-h":!0}),b(ke)!=="svelte-1fkanz5"&&(ke.textContent=Vo),Dt=r(e),m(we.$$.fragment,e),Kt=r(e),ve=h(e,"P",{"data-svelte-h":!0}),b(ve)!=="svelte-cswlyd"&&(ve.textContent=Ho),en=r(e),m($e.$$.fragment,e),tn=r(e),Ge=h(e,"P",{"data-svelte-h":!0}),b(Ge)!=="svelte-mhi95y"&&(Ge.innerHTML=Ro),nn=r(e),m(xe.$$.fragment,e),on=r(e),m(Ne.$$.fragment,e),sn=r(e),Xe=h(e,"P",{"data-svelte-h":!0}),b(Xe)!=="svelte-1r79v6g"&&(Xe.textContent=Eo),an=r(e),m(Ce.$$.fragment,e),rn=r(e),je=h(e,"P",{"data-svelte-h":!0}),b(je)!=="svelte-ib5l43"&&(je.innerHTML=So),ln=r(e),Pe=h(e,"P",{"data-svelte-h":!0}),b(Pe)!=="svelte-1pp3dkd"&&(Pe.innerHTML=Qo),dn=r(e),m(ze.$$.fragment,e),cn=r(e),m(Fe.$$.fragment,e),pn=r(e),Je=h(e,"P",{"data-svelte-h":!0}),b(Je)!=="svelte-10jrnsm"&&(Je.innerHTML=Ao),hn=r(e),m(Ue.$$.fragment,e),gn=r(e),m(We.$$.fragment,e),mn=r(e),Ie=h(e,"P",{"data-svelte-h":!0}),b(Ie)!=="svelte-1mm1lh6"&&(Ie.innerHTML=Yo),un=r(e),K=h(e,"DIV",{style:!0,"data-svelte-h":!0}),b(K)!=="svelte-1gyvfup"&&(K.innerHTML=Oo),fn=r(e),m(Ze.$$.fragment,e),_n=r(e),qe=h(e,"P",{"data-svelte-h":!0}),b(qe)!=="svelte-1cid2pe"&&(qe.innerHTML=Do),Tn=r(e),Be=h(e,"P",{"data-svelte-h":!0}),b(Be)!=="svelte-1x11lxg"&&(Be.innerHTML=Ko),bn=r(e),m(Le.$$.fragment,e),yn=r(e),Ve=h(e,"P",{"data-svelte-h":!0}),b(Ve)!=="svelte-djb2w0"&&(Ve.innerHTML=es),Mn=r(e),He=h(e,"P",{"data-svelte-h":!0}),b(He)!=="svelte-txr44"&&(He.innerHTML=ts),kn=r(e),m(Re.$$.fragment,e),wn=r(e),Ee=h(e,"TABLE",{"data-svelte-h":!0}),b(Ee)!=="svelte-f189pv"&&(Ee.innerHTML=ns),vn=r(e),m(Se.$$.fragment,e),$n=r(e),Qe=h(e,"TABLE",{"data-svelte-h":!0}),b(Qe)!=="svelte-tj67gt"&&(Qe.innerHTML=os),Gn=r(e),m(Ae.$$.fragment,e),xn=r(e),Ye=h(e,"UL",{"data-svelte-h":!0}),b(Ye)!=="svelte-162aebv"&&(Ye.innerHTML=ss),Nn=r(e),m(Oe.$$.fragment,e),Xn=r(e),I=h(e,"DIV",{class:!0});var Q=X(I);m(De.$$.fragment,Q),Rn=r(Q),kt=h(Q,"P",{"data-svelte-h":!0}),b(kt)!=="svelte-1ol9lr5"&&(kt.innerHTML=as),En=r(Q),wt=h(Q,"P",{"data-svelte-h":!0}),b(wt)!=="svelte-u1ptn"&&(wt.innerHTML=rs),Sn=r(Q),m(ee.$$.fragment,Q),Q.forEach(o),Cn=r(e),m(Ke.$$.fragment,e),jn=r(e),v=h(e,"DIV",{class:!0});var $=X(v);m(et.$$.fragment,$),Qn=r($),vt=h($,"P",{"data-svelte-h":!0}),b(vt)!=="svelte-1w4843d"&&(vt.innerHTML=is),An=r($),$t=h($,"P",{"data-svelte-h":!0}),b($t)!=="svelte-1s077p3"&&($t.textContent=ls),Yn=r($),m(te.$$.fragment,$),On=r($),Gt=h($,"P",{"data-svelte-h":!0}),b(Gt)!=="svelte-1afeqmz"&&(Gt.innerHTML=ds),Dn=r($),m(ne.$$.fragment,$),Kn=r($),xt=h($,"P",{"data-svelte-h":!0}),b(xt)!=="svelte-1vhqfou"&&(xt.innerHTML=cs),eo=r($),oe=h($,"DIV",{class:!0});var bt=X(oe);m(tt.$$.fragment,bt),to=r(bt),Nt=h(bt,"P",{"data-svelte-h":!0}),b(Nt)!=="svelte-1f4f5kp"&&(Nt.innerHTML=ps),bt.forEach(o),no=r($),se=h($,"DIV",{class:!0});var yt=X(se);m(nt.$$.fragment,yt),oo=r(yt),Xt=h(yt,"P",{"data-svelte-h":!0}),b(Xt)!=="svelte-nfci2w"&&(Xt.innerHTML=hs),yt.forEach(o),$.forEach(o),Pn=r(e),m(ot.$$.fragment,e),zn=r(e),P=h(e,"DIV",{class:!0});var q=X(P);m(st.$$.fragment,q),so=r(q),Ct=h(q,"P",{"data-svelte-h":!0}),b(Ct)!=="svelte-1p4qfv1"&&(Ct.innerHTML=gs),ao=r(q),jt=h(q,"P",{"data-svelte-h":!0}),b(jt)!=="svelte-hswkmf"&&(jt.innerHTML=ms),ro=r(q),Pt=h(q,"P",{"data-svelte-h":!0}),b(Pt)!=="svelte-atmxp6"&&(Pt.innerHTML=us),io=r(q),F=h(q,"DIV",{class:!0});var B=X(F);m(at.$$.fragment,B),lo=r(B),zt=h(B,"P",{"data-svelte-h":!0}),b(zt)!=="svelte-1bdgpzn"&&(zt.innerHTML=fs),co=r(B),m(ae.$$.fragment,B),po=r(B),m(re.$$.fragment,B),ho=r(B),m(ie.$$.fragment,B),B.forEach(o),q.forEach(o),Fn=r(e),m(rt.$$.fragment,e),Jn=r(e),Z=h(e,"DIV",{class:!0});var A=X(Z);m(it.$$.fragment,A),go=r(A),Ft=h(A,"P",{"data-svelte-h":!0}),b(Ft)!=="svelte-1to6vt8"&&(Ft.innerHTML=_s),mo=r(A),Jt=h(A,"P",{"data-svelte-h":!0}),b(Jt)!=="svelte-hswkmf"&&(Jt.innerHTML=Ts),uo=r(A),E=h(A,"DIV",{class:!0});var Y=X(E);m(lt.$$.fragment,Y),fo=r(Y),Ut=h(Y,"P",{"data-svelte-h":!0}),b(Ut)!=="svelte-1lbqecr"&&(Ut.innerHTML=bs),_o=r(Y),m(le.$$.fragment,Y),To=r(Y),m(de.$$.fragment,Y),Y.forEach(o),A.forEach(o),Un=r(e),m(dt.$$.fragment,e),Wn=r(e),z=h(e,"DIV",{class:!0});var L=X(z);m(ct.$$.fragment,L),bo=r(L),Wt=h(L,"P",{"data-svelte-h":!0}),b(Wt)!=="svelte-1ednh70"&&(Wt.innerHTML=ys),yo=r(L),It=h(L,"P",{"data-svelte-h":!0}),b(It)!=="svelte-13blcqs"&&(It.innerHTML=Ms),Mo=r(L),Zt=h(L,"P",{"data-svelte-h":!0}),b(Zt)!=="svelte-hswkmf"&&(Zt.innerHTML=ks),ko=r(L),J=h(L,"DIV",{class:!0});var V=X(J);m(pt.$$.fragment,V),wo=r(V),qt=h(V,"P",{"data-svelte-h":!0}),b(qt)!=="svelte-18qhbyv"&&(qt.innerHTML=ws),vo=r(V),m(ce.$$.fragment,V),$o=r(V),m(pe.$$.fragment,V),Go=r(V),m(he.$$.fragment,V),V.forEach(o),L.forEach(o),In=r(e),m(ht.$$.fragment,e),Zn=r(e),G=h(e,"DIV",{class:!0});var N=X(G);m(gt.$$.fragment,N),xo=r(N),Bt=h(N,"P",{"data-svelte-h":!0}),b(Bt)!=="svelte-16cei4n"&&(Bt.textContent=vs),No=r(N),Lt=h(N,"P",{"data-svelte-h":!0}),b(Lt)!=="svelte-rxcr6p"&&(Lt.innerHTML=$s),Xo=r(N),Vt=h(N,"P",{"data-svelte-h":!0}),b(Vt)!=="svelte-10ugs3m"&&(Vt.innerHTML=Gs),Co=r(N),Ht=h(N,"P",{"data-svelte-h":!0}),b(Ht)!=="svelte-13blcqs"&&(Ht.innerHTML=xs),jo=r(N),Rt=h(N,"P",{"data-svelte-h":!0}),b(Rt)!=="svelte-hswkmf"&&(Rt.innerHTML=Ns),Po=r(N),U=h(N,"DIV",{class:!0});var H=X(U);m(mt.$$.fragment,H),zo=r(H),Et=h(H,"P",{"data-svelte-h":!0}),b(Et)!=="svelte-1v4btnt"&&(Et.innerHTML=Xs),Fo=r(H),m(ge.$$.fragment,H),Jo=r(H),m(me.$$.fragment,H),Uo=r(H),m(ue.$$.fragment,H),H.forEach(o),N.forEach(o),qn=r(e),m(ut.$$.fragment,e),Bn=r(e),D=h(e,"DIV",{class:!0});var Mt=X(D);m(ft.$$.fragment,Mt),Wo=r(Mt),S=h(Mt,"DIV",{class:!0});var O=X(S);m(_t.$$.fragment,O),Io=r(O),St=h(O,"P",{"data-svelte-h":!0}),b(St)!=="svelte-16svko3"&&(St.innerHTML=Cs),Zo=r(O),m(fe.$$.fragment,O),qo=r(O),m(_e.$$.fragment,O),O.forEach(o),Mt.forEach(o),Ln=r(e),m(Tt.$$.fragment,e),Vn=r(e),Qt=h(e,"P",{}),X(Qt).forEach(o),this.h()},h(){C(n,"name","hf:doc:metadata"),C(n,"content",oa),Is(K,"text-align","center"),C(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(D,"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){d(document.head,n),i(e,y,t),i(e,l,t),i(e,c,t),u(M,e,t),i(e,s,t),u(k,e,t),i(e,At,t),i(e,ye,t),i(e,Yt,t),i(e,Me,t),i(e,Ot,t),i(e,ke,t),i(e,Dt,t),u(we,e,t),i(e,Kt,t),i(e,ve,t),i(e,en,t),u($e,e,t),i(e,tn,t),i(e,Ge,t),i(e,nn,t),u(xe,e,t),i(e,on,t),u(Ne,e,t),i(e,sn,t),i(e,Xe,t),i(e,an,t),u(Ce,e,t),i(e,rn,t),i(e,je,t),i(e,ln,t),i(e,Pe,t),i(e,dn,t),u(ze,e,t),i(e,cn,t),u(Fe,e,t),i(e,pn,t),i(e,Je,t),i(e,hn,t),u(Ue,e,t),i(e,gn,t),u(We,e,t),i(e,mn,t),i(e,Ie,t),i(e,un,t),i(e,K,t),i(e,fn,t),u(Ze,e,t),i(e,_n,t),i(e,qe,t),i(e,Tn,t),i(e,Be,t),i(e,bn,t),u(Le,e,t),i(e,yn,t),i(e,Ve,t),i(e,Mn,t),i(e,He,t),i(e,kn,t),u(Re,e,t),i(e,wn,t),i(e,Ee,t),i(e,vn,t),u(Se,e,t),i(e,$n,t),i(e,Qe,t),i(e,Gn,t),u(Ae,e,t),i(e,xn,t),i(e,Ye,t),i(e,Nn,t),u(Oe,e,t),i(e,Xn,t),i(e,I,t),u(De,I,null),d(I,Rn),d(I,kt),d(I,En),d(I,wt),d(I,Sn),u(ee,I,null),i(e,Cn,t),u(Ke,e,t),i(e,jn,t),i(e,v,t),u(et,v,null),d(v,Qn),d(v,vt),d(v,An),d(v,$t),d(v,Yn),u(te,v,null),d(v,On),d(v,Gt),d(v,Dn),u(ne,v,null),d(v,Kn),d(v,xt),d(v,eo),d(v,oe),u(tt,oe,null),d(oe,to),d(oe,Nt),d(v,no),d(v,se),u(nt,se,null),d(se,oo),d(se,Xt),i(e,Pn,t),u(ot,e,t),i(e,zn,t),i(e,P,t),u(st,P,null),d(P,so),d(P,Ct),d(P,ao),d(P,jt),d(P,ro),d(P,Pt),d(P,io),d(P,F),u(at,F,null),d(F,lo),d(F,zt),d(F,co),u(ae,F,null),d(F,po),u(re,F,null),d(F,ho),u(ie,F,null),i(e,Fn,t),u(rt,e,t),i(e,Jn,t),i(e,Z,t),u(it,Z,null),d(Z,go),d(Z,Ft),d(Z,mo),d(Z,Jt),d(Z,uo),d(Z,E),u(lt,E,null),d(E,fo),d(E,Ut),d(E,_o),u(le,E,null),d(E,To),u(de,E,null),i(e,Un,t),u(dt,e,t),i(e,Wn,t),i(e,z,t),u(ct,z,null),d(z,bo),d(z,Wt),d(z,yo),d(z,It),d(z,Mo),d(z,Zt),d(z,ko),d(z,J),u(pt,J,null),d(J,wo),d(J,qt),d(J,vo),u(ce,J,null),d(J,$o),u(pe,J,null),d(J,Go),u(he,J,null),i(e,In,t),u(ht,e,t),i(e,Zn,t),i(e,G,t),u(gt,G,null),d(G,xo),d(G,Bt),d(G,No),d(G,Lt),d(G,Xo),d(G,Vt),d(G,Co),d(G,Ht),d(G,jo),d(G,Rt),d(G,Po),d(G,U),u(mt,U,null),d(U,zo),d(U,Et),d(U,Fo),u(ge,U,null),d(U,Jo),u(me,U,null),d(U,Uo),u(ue,U,null),i(e,qn,t),u(ut,e,t),i(e,Bn,t),i(e,D,t),u(ft,D,null),d(D,Wo),d(D,S),u(_t,S,null),d(S,Io),d(S,St),d(S,Zo),u(fe,S,null),d(S,qo),u(_e,S,null),i(e,Ln,t),u(Tt,e,t),i(e,Vn,t),i(e,Qt,t),Hn=!0},p(e,[t]){const Q={};t&2&&(Q.$$scope={dirty:t,ctx:e}),ee.$set(Q);const $={};t&2&&($.$$scope={dirty:t,ctx:e}),te.$set($);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 q={};t&2&&(q.$$scope={dirty:t,ctx:e}),re.$set(q);const B={};t&2&&(B.$$scope={dirty:t,ctx:e}),ie.$set(B);const A={};t&2&&(A.$$scope={dirty:t,ctx:e}),le.$set(A);const Y={};t&2&&(Y.$$scope={dirty:t,ctx:e}),de.$set(Y);const L={};t&2&&(L.$$scope={dirty:t,ctx:e}),ce.$set(L);const V={};t&2&&(V.$$scope={dirty:t,ctx:e}),pe.$set(V);const N={};t&2&&(N.$$scope={dirty:t,ctx:e}),he.$set(N);const H={};t&2&&(H.$$scope={dirty:t,ctx:e}),ge.$set(H);const Mt={};t&2&&(Mt.$$scope={dirty:t,ctx:e}),me.$set(Mt);const O={};t&2&&(O.$$scope={dirty:t,ctx:e}),ue.$set(O);const js={};t&2&&(js.$$scope={dirty:t,ctx:e}),fe.$set(js);const Ps={};t&2&&(Ps.$$scope={dirty:t,ctx:e}),_e.$set(Ps)},i(e){Hn||(f(M.$$.fragment,e),f(k.$$.fragment,e),f(we.$$.fragment,e),f($e.$$.fragment,e),f(xe.$$.fragment,e),f(Ne.$$.fragment,e),f(Ce.$$.fragment,e),f(ze.$$.fragment,e),f(Fe.$$.fragment,e),f(Ue.$$.fragment,e),f(We.$$.fragment,e),f(Ze.$$.fragment,e),f(Le.$$.fragment,e),f(Re.$$.fragment,e),f(Se.$$.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(he.$$.fragment,e),f(ht.$$.fragment,e),f(gt.$$.fragment,e),f(mt.$$.fragment,e),f(ge.$$.fragment,e),f(me.$$.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),Hn=!0)},o(e){_(M.$$.fragment,e),_(k.$$.fragment,e),_(we.$$.fragment,e),_($e.$$.fragment,e),_(xe.$$.fragment,e),_(Ne.$$.fragment,e),_(Ce.$$.fragment,e),_(ze.$$.fragment,e),_(Fe.$$.fragment,e),_(Ue.$$.fragment,e),_(We.$$.fragment,e),_(Ze.$$.fragment,e),_(Le.$$.fragment,e),_(Re.$$.fragment,e),_(Se.$$.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),_(he.$$.fragment,e),_(ht.$$.fragment,e),_(gt.$$.fragment,e),_(mt.$$.fragment,e),_(ge.$$.fragment,e),_(me.$$.fragment,e),_(ue.$$.fragment,e),_(ut.$$.fragment,e),_(ft.$$.fragment,e),_(_t.$$.fragment,e),_(fe.$$.fragment,e),_(_e.$$.fragment,e),_(Tt.$$.fragment,e),Hn=!1},d(e){e&&(o(y),o(l),o(c),o(s),o(At),o(ye),o(Yt),o(Me),o(Ot),o(ke),o(Dt),o(Kt),o(ve),o(en),o(tn),o(Ge),o(nn),o(on),o(sn),o(Xe),o(an),o(rn),o(je),o(ln),o(Pe),o(dn),o(cn),o(pn),o(Je),o(hn),o(gn),o(mn),o(Ie),o(un),o(K),o(fn),o(_n),o(qe),o(Tn),o(Be),o(bn),o(yn),o(Ve),o(Mn),o(He),o(kn),o(wn),o(Ee),o(vn),o($n),o(Qe),o(Gn),o(xn),o(Ye),o(Nn),o(Xn),o(I),o(Cn),o(jn),o(v),o(Pn),o(zn),o(P),o(Fn),o(Jn),o(Z),o(Un),o(Wn),o(z),o(In),o(Zn),o(G),o(qn),o(Bn),o(D),o(Ln),o(Vn),o(Qt)),o(n),T(M,e),T(k,e),T(we,e),T($e,e),T(xe,e),T(Ne,e),T(Ce,e),T(ze,e),T(Fe,e),T(Ue,e),T(We,e),T(Ze,e),T(Le,e),T(Re,e),T(Se,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(he),T(ht,e),T(gt),T(mt),T(ge),T(me),T(ue),T(ut,e),T(ft),T(_t),T(fe),T(_e),T(Tt,e)}}}const oa='{"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 sa(w){return Fs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ha extends Js{constructor(n){super(),Us(this,n,sa,na,zs,{})}}export{ha as component}; | |
Xet Storage Details
- Size:
- 150 kB
- Xet hash:
- cb6857b5f6e29830ebb1246129238106c767261f03f1efc8dafd2da02629e911
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.