import{S as R_,i as S_,s as X_,e as a,k as p,w as v,t as n,M as Q_,c as r,d as t,m as h,a as l,x as w,h as s,b as m,G as e,g,y as M,q as k,o as J,B as $,v as L_,L as gt}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ve}from"../../chunks/Tip-hf-doc-builder.js";import{D as Te}from"../../chunks/Docstring-hf-doc-builder.js";import{C as He}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as lt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ft}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as H_}from"../../chunks/PipelineTag-hf-doc-builder.js";function O_(E){let d,y,u,f,T;return f=new He({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVEpNb2RlbCUyQyUyMEdQVEpDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwR1BULUolMjA2QiUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwR1BUSkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwZnJvbSUyMHRoZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMEdQVEpNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTJModel, GPTJConfig

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){d=a("p"),y=n("Example:"),u=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),u=h(i),w(f.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,u,c),M(f,i,c),T=!0},p:gt,i(i){T||(k(f.$$.fragment,i),T=!0)},o(i){J(f.$$.fragment,i),T=!1},d(i){i&&t(d),i&&t(u),$(f,i)}}}function D_(E){let d,y,u,f,T;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),f=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(c,"CODE",{});var j=l(u);f=s(j,"Module"),j.forEach(t),T=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,u),e(u,f),e(d,T)},d(i){i&&t(d)}}}function Y_(E){let d,y,u,f,T,i,c,j;return{c(){d=a("p"),y=n(`This example uses a random model as the real ones are all very big. To get proper results, you should use
EleutherAI/gpt-j-6B instead of hf-internal-testing/tiny-random-gptj. If you get out-of-memory when loading that checkpoint, you can try
adding `),u=a("code"),f=n('device_map="auto"'),T=n(" in the "),i=a("code"),c=n("from_pretrained"),j=n(" call.")},l(I){d=r(I,"P",{});var C=l(d);y=s(C,`This example uses a random model as the real ones are all very big. To get proper results, you should use
EleutherAI/gpt-j-6B instead of hf-internal-testing/tiny-random-gptj. If you get out-of-memory when loading that checkpoint, you can try
adding `),u=r(C,"CODE",{});var x=l(u);f=s(x,'device_map="auto"'),x.forEach(t),T=s(C," in the "),i=r(C,"CODE",{});var N=l(i);c=s(N,"from_pretrained"),N.forEach(t),j=s(C," call."),C.forEach(t)},m(I,C){g(I,d,C),e(d,y),e(d,u),e(u,f),e(d,T),e(d,i),e(i,c),e(d,j)},d(I){I&&t(d)}}}function K_(E){let d,y,u,f,T;return f=new He({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHUFRKTW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmhmLWludGVybmFsLXRlc3RpbmclMkZ0aW55LXJhbmRvbS1ncHRqJTIyKSUwQW1vZGVsJTIwJTNEJTIwR1BUSk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGdGlueS1yYW5kb20tZ3B0aiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTJModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;hf-internal-testing/tiny-random-gptj&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJModel.from_pretrained(<span class="hljs-string">&quot;hf-internal-testing/tiny-random-gptj&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){d=a("p"),y=n("Example:"),u=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),u=h(i),w(f.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,u,c),M(f,i,c),T=!0},p:gt,i(i){T||(k(f.$$.fragment,i),T=!0)},o(i){J(f.$$.fragment,i),T=!1},d(i){i&&t(d),i&&t(u),$(f,i)}}}function eT(E){let d,y,u,f,T;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),f=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(c,"CODE",{});var j=l(u);f=s(j,"Module"),j.forEach(t),T=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,u),e(u,f),e(d,T)},d(i){i&&t(d)}}}function tT(E){let d,y,u,f,T,i,c,j;return{c(){d=a("p"),y=n(`This example uses a random model as the real ones are all very big. To get proper results, you should use
EleutherAI/gpt-j-6B instead of hf-internal-testing/tiny-random-gptj. If you get out-of-memory when loading that checkpoint, you can try
adding `),u=a("code"),f=n('device_map="auto"'),T=n(" in the "),i=a("code"),c=n("from_pretrained"),j=n(" call.")},l(I){d=r(I,"P",{});var C=l(d);y=s(C,`This example uses a random model as the real ones are all very big. To get proper results, you should use
EleutherAI/gpt-j-6B instead of hf-internal-testing/tiny-random-gptj. If you get out-of-memory when loading that checkpoint, you can try
adding `),u=r(C,"CODE",{});var x=l(u);f=s(x,'device_map="auto"'),x.forEach(t),T=s(C," in the "),i=r(C,"CODE",{});var N=l(i);c=s(N,"from_pretrained"),N.forEach(t),j=s(C," call."),C.forEach(t)},m(I,C){g(I,d,C),e(d,y),e(d,u),e(u,f),e(d,T),e(d,i),e(i,c),e(d,j)},d(I){I&&t(d)}}}function oT(E){let d,y,u,f,T;return f=new He({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEdQVEpGb3JDYXVzYWxMTSUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmhmLWludGVybmFsLXRlc3RpbmclMkZ0aW55LXJhbmRvbS1ncHRqJTIyKSUwQW1vZGVsJTIwJTNEJTIwR1BUSkZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGdGlueS1yYW5kb20tZ3B0aiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEKSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTJForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;hf-internal-testing/tiny-random-gptj&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForCausalLM.from_pretrained(<span class="hljs-string">&quot;hf-internal-testing/tiny-random-gptj&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){d=a("p"),y=n("Example:"),u=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),u=h(i),w(f.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,u,c),M(f,i,c),T=!0},p:gt,i(i){T||(k(f.$$.fragment,i),T=!0)},o(i){J(f.$$.fragment,i),T=!1},d(i){i&&t(d),i&&t(u),$(f,i)}}}function nT(E){let d,y,u,f,T;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),f=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(c,"CODE",{});var j=l(u);f=s(j,"Module"),j.forEach(t),T=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,u),e(u,f),e(d,T)},d(i){i&&t(d)}}}function sT(E){let d,y,u,f,T,i,c,j;return{c(){d=a("p"),y=n(`This example uses a random model as the real ones are all very big. To get proper results, you should use
EleutherAI/gpt-j-6B instead of ydshieh/tiny-random-gptj-for-sequence-classification. If you get out-of-memory when loading that checkpoint, you can try
adding `),u=a("code"),f=n('device_map="auto"'),T=n(" in the "),i=a("code"),c=n("from_pretrained"),j=n(" call.")},l(I){d=r(I,"P",{});var C=l(d);y=s(C,`This example uses a random model as the real ones are all very big. To get proper results, you should use
EleutherAI/gpt-j-6B instead of ydshieh/tiny-random-gptj-for-sequence-classification. If you get out-of-memory when loading that checkpoint, you can try
adding `),u=r(C,"CODE",{});var x=l(u);f=s(x,'device_map="auto"'),x.forEach(t),T=s(C," in the "),i=r(C,"CODE",{});var N=l(i);c=s(N,"from_pretrained"),N.forEach(t),j=s(C," call."),C.forEach(t)},m(I,C){g(I,d,C),e(d,y),e(d,u),e(u,f),e(d,T),e(d,i),e(i,c),e(d,j)},d(I){I&&t(d)}}}function aT(E){let d,y,u,f,T;return f=new He({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEdQVEpGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyeWRzaGllaCUyRnRpbnktcmFuZG9tLWdwdGotZm9yLXNlcXVlbmNlLWNsYXNzaWZpY2F0aW9uJTIyKSUwQW1vZGVsJTIwJTNEJTIwR1BUSkZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMnlkc2hpZWglMkZ0aW55LXJhbmRvbS1ncHRqLWZvci1zZXF1ZW5jZS1jbGFzc2lmaWNhdGlvbiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWQlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KCkuaXRlbSgpJTBBJTBBJTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwR1BUSkZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMnlkc2hpZWglMkZ0aW55LXJhbmRvbS1ncHRqLWZvci1zZXF1ZW5jZS1jbGFzc2lmaWNhdGlvbiUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTJForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;ydshieh/tiny-random-gptj-for-sequence-classification&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;ydshieh/tiny-random-gptj-for-sequence-classification&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;ydshieh/tiny-random-gptj-for-sequence-classification&quot;</span>, num_labels=num_labels)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;ydshieh/tiny-random-gptj-for-sequence-classification&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;ydshieh/tiny-random-gptj-for-sequence-classification&quot;</span>, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;ydshieh/tiny-random-gptj-for-sequence-classification&quot;</span>, num_labels=num_labels, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.<span class="hljs-built_in">sum</span>(
<span class="hljs-meta">... </span>    torch.nn.functional.one_hot(predicted_class_ids[<span class="hljs-literal">None</span>, :].clone(), num_classes=num_labels), dim=<span class="hljs-number">1</span>
<span class="hljs-meta">... </span>).to(torch.<span class="hljs-built_in">float</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=a("p"),y=n("Example of multi-label classification:"),u=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example of multi-label classification:"),c.forEach(t),u=h(i),w(f.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,u,c),M(f,i,c),T=!0},p:gt,i(i){T||(k(f.$$.fragment,i),T=!0)},o(i){J(f.$$.fragment,i),T=!1},d(i){i&&t(d),i&&t(u),$(f,i)}}}function lT(E){let d,y,u,f,T;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),f=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(c,"CODE",{});var j=l(u);f=s(j,"Module"),j.forEach(t),T=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,u),e(u,f),e(d,T)},d(i){i&&t(d)}}}function iT(E){let d,y,u,f,T,i,c,j;return{c(){d=a("p"),y=n(`This example uses a random model as the real ones are all very big. To get proper results, you should use
EleutherAI/gpt-j-6B instead of hf-internal-testing/tiny-random-gptj. If you get out-of-memory when loading that checkpoint, you can try
adding `),u=a("code"),f=n('device_map="auto"'),T=n(" in the "),i=a("code"),c=n("from_pretrained"),j=n(" call.")},l(I){d=r(I,"P",{});var C=l(d);y=s(C,`This example uses a random model as the real ones are all very big. To get proper results, you should use
EleutherAI/gpt-j-6B instead of hf-internal-testing/tiny-random-gptj. If you get out-of-memory when loading that checkpoint, you can try
adding `),u=r(C,"CODE",{});var x=l(u);f=s(x,'device_map="auto"'),x.forEach(t),T=s(C," in the "),i=r(C,"CODE",{});var N=l(i);c=s(N,"from_pretrained"),N.forEach(t),j=s(C," call."),C.forEach(t)},m(I,C){g(I,d,C),e(d,y),e(d,u),e(u,f),e(d,T),e(d,i),e(i,c),e(d,j)},d(I){I&&t(d)}}}function dT(E){let d,y,u,f,T;return f=new He({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHUFRKRm9yUXVlc3Rpb25BbnN3ZXJpbmclMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmhmLWludGVybmFsLXRlc3RpbmclMkZ0aW55LXJhbmRvbS1ncHRqJTIyKSUwQW1vZGVsJTIwJTNEJTIwR1BUSkZvclF1ZXN0aW9uQW5zd2VyaW5nLmZyb21fcHJldHJhaW5lZCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGdGlueS1yYW5kb20tZ3B0aiUyMiklMEElMEFxdWVzdGlvbiUyQyUyMHRleHQlMjAlM0QlMjAlMjJXaG8lMjB3YXMlMjBKaW0lMjBIZW5zb24lM0YlMjIlMkMlMjAlMjJKaW0lMjBIZW5zb24lMjB3YXMlMjBhJTIwbmljZSUyMHB1cHBldCUyMiUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihxdWVzdGlvbiUyQyUyMHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBYW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNEJTIwb3V0cHV0cy5zdGFydF9sb2dpdHMuYXJnbWF4KCklMEFhbnN3ZXJfZW5kX2luZGV4JTIwJTNEJTIwb3V0cHV0cy5lbmRfbG9naXRzLmFyZ21heCgpJTBBJTBBcHJlZGljdF9hbnN3ZXJfdG9rZW5zJTIwJTNEJTIwaW5wdXRzLmlucHV0X2lkcyU1QjAlMkMlMjBhbnN3ZXJfc3RhcnRfaW5kZXglMjAlM0ElMjBhbnN3ZXJfZW5kX2luZGV4JTIwJTJCJTIwMSU1RCUwQSUwQSUyMyUyMHRhcmdldCUyMGlzJTIwJTIybmljZSUyMHB1cHBldCUyMiUwQXRhcmdldF9zdGFydF9pbmRleCUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxNCU1RCklMEF0YXJnZXRfZW5kX2luZGV4JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QjE1JTVEKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMHN0YXJ0X3Bvc2l0aW9ucyUzRHRhcmdldF9zdGFydF9pbmRleCUyQyUyMGVuZF9wb3NpdGlvbnMlM0R0YXJnZXRfZW5kX2luZGV4KSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3M=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTJForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;hf-internal-testing/tiny-random-gptj&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;hf-internal-testing/tiny-random-gptj&quot;</span>)

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss`}}),{c(){d=a("p"),y=n("Example:"),u=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),u=h(i),w(f.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,u,c),M(f,i,c),T=!0},p:gt,i(i){T||(k(f.$$.fragment,i),T=!0)},o(i){J(f.$$.fragment,i),T=!1},d(i){i&&t(d),i&&t(u),$(f,i)}}}function cT(E){let d,y,u,f,T,i,c,j,I,C,x,N,ne,G,$e,L,je,ye,B,Ge,re,D,Ee,le,Y,Fe,be,S,Pe,ie,de,U,z,ue,K,ve,me,V,Ce,ce,W,Ue,H,xe,Ie,O,pe,we,q,fe,Q,ze,ee,Z,We,A,te,Ze;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),u=a("code"),f=n("transformers"),T=n(" accept two formats as input:"),i=p(),c=a("ul"),j=a("li"),I=n("having all inputs as keyword arguments (like PyTorch models), or"),C=p(),x=a("li"),N=n("having all inputs as a list, tuple or dict in the first positional argument."),ne=p(),G=a("p"),$e=n(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),L=a("code"),je=n("model.fit()"),ye=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=a("code"),Ge=n("model.fit()"),re=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),D=a("code"),Ee=n("fit()"),le=n(" and "),Y=a("code"),Fe=n("predict()"),be=n(`, such as when creating your own layers or models with
the Keras `),S=a("code"),Pe=n("Functional"),ie=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),de=p(),U=a("ul"),z=a("li"),ue=n("a single Tensor with "),K=a("code"),ve=n("input_ids"),me=n(" only and nothing else: "),V=a("code"),Ce=n("model(input_ids)"),ce=p(),W=a("li"),Ue=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),H=a("code"),xe=n("model([input_ids, attention_mask])"),Ie=n(" or "),O=a("code"),pe=n("model([input_ids, attention_mask, token_type_ids])"),we=p(),q=a("li"),fe=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Q=a("code"),ze=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=p(),Z=a("p"),We=n(`Note that when creating models and layers with
`),A=a("a"),te=n("subclassing"),Ze=n(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(b){d=r(b,"P",{});var F=l(d);y=s(F,"TensorFlow models and layers in "),u=r(F,"CODE",{});var et=l(u);f=s(et,"transformers"),et.forEach(t),T=s(F," accept two formats as input:"),F.forEach(t),i=h(b),c=r(b,"UL",{});var se=l(c);j=r(se,"LI",{});var tt=l(j);I=s(tt,"having all inputs as keyword arguments (like PyTorch models), or"),tt.forEach(t),C=h(se),x=r(se,"LI",{});var ot=l(x);N=s(ot,"having all inputs as a list, tuple or dict in the first positional argument."),ot.forEach(t),se.forEach(t),ne=h(b),G=r(b,"P",{});var P=l(G);$e=s(P,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),L=r(P,"CODE",{});var nt=l(L);je=s(nt,"model.fit()"),nt.forEach(t),ye=s(P,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=r(P,"CODE",{});var st=l(B);Ge=s(st,"model.fit()"),st.forEach(t),re=s(P,` supports! If, however, you want to use the second
format outside of Keras methods like `),D=r(P,"CODE",{});var Oe=l(D);Ee=s(Oe,"fit()"),Oe.forEach(t),le=s(P," and "),Y=r(P,"CODE",{});var ge=l(Y);Fe=s(ge,"predict()"),ge.forEach(t),be=s(P,`, such as when creating your own layers or models with
the Keras `),S=r(P,"CODE",{});var Me=l(S);Pe=s(Me,"Functional"),Me.forEach(t),ie=s(P,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),P.forEach(t),de=h(b),U=r(b,"UL",{});var R=l(U);z=r(R,"LI",{});var X=l(z);ue=s(X,"a single Tensor with "),K=r(X,"CODE",{});var at=l(K);ve=s(at,"input_ids"),at.forEach(t),me=s(X," only and nothing else: "),V=r(X,"CODE",{});var Re=l(V);Ce=s(Re,"model(input_ids)"),Re.forEach(t),X.forEach(t),ce=h(R),W=r(R,"LI",{});var oe=l(W);Ue=s(oe,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),H=r(oe,"CODE",{});var De=l(H);xe=s(De,"model([input_ids, attention_mask])"),De.forEach(t),Ie=s(oe," or "),O=r(oe,"CODE",{});var ke=l(O);pe=s(ke,"model([input_ids, attention_mask, token_type_ids])"),ke.forEach(t),oe.forEach(t),we=h(R),q=r(R,"LI",{});var Ae=l(q);fe=s(Ae,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Q=r(Ae,"CODE",{});var Be=l(Q);ze=s(Be,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Be.forEach(t),Ae.forEach(t),R.forEach(t),ee=h(b),Z=r(b,"P",{});var he=l(Z);We=s(he,`Note that when creating models and layers with
`),A=r(he,"A",{href:!0,rel:!0});var rt=l(A);te=s(rt,"subclassing"),rt.forEach(t),Ze=s(he,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),he.forEach(t),this.h()},h(){m(A,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(A,"rel","nofollow")},m(b,F){g(b,d,F),e(d,y),e(d,u),e(u,f),e(d,T),g(b,i,F),g(b,c,F),e(c,j),e(j,I),e(c,C),e(c,x),e(x,N),g(b,ne,F),g(b,G,F),e(G,$e),e(G,L),e(L,je),e(G,ye),e(G,B),e(B,Ge),e(G,re),e(G,D),e(D,Ee),e(G,le),e(G,Y),e(Y,Fe),e(G,be),e(G,S),e(S,Pe),e(G,ie),g(b,de,F),g(b,U,F),e(U,z),e(z,ue),e(z,K),e(K,ve),e(z,me),e(z,V),e(V,Ce),e(U,ce),e(U,W),e(W,Ue),e(W,H),e(H,xe),e(W,Ie),e(W,O),e(O,pe),e(U,we),e(U,q),e(q,fe),e(q,Q),e(Q,ze),g(b,ee,F),g(b,Z,F),e(Z,We),e(Z,A),e(A,te),e(Z,Ze)},d(b){b&&t(d),b&&t(i),b&&t(c),b&&t(ne),b&&t(G),b&&t(de),b&&t(U),b&&t(ee),b&&t(Z)}}}function pT(E){let d,y,u,f,T;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),f=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(c,"CODE",{});var j=l(u);f=s(j,"Module"),j.forEach(t),T=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,u),e(u,f),e(d,T)},d(i){i&&t(d)}}}function hT(E){let d,y,u,f,T;return f=new He({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkdQVEpNb2RlbCUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyRWxldXRoZXJBSSUyRmdwdC1qLTZCJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZHUFRKTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtai02QiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFGPTJModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){d=a("p"),y=n("Example:"),u=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),u=h(i),w(f.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,u,c),M(f,i,c),T=!0},p:gt,i(i){T||(k(f.$$.fragment,i),T=!0)},o(i){J(f.$$.fragment,i),T=!1},d(i){i&&t(d),i&&t(u),$(f,i)}}}function uT(E){let d,y,u,f,T,i,c,j,I,C,x,N,ne,G,$e,L,je,ye,B,Ge,re,D,Ee,le,Y,Fe,be,S,Pe,ie,de,U,z,ue,K,ve,me,V,Ce,ce,W,Ue,H,xe,Ie,O,pe,we,q,fe,Q,ze,ee,Z,We,A,te,Ze;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),u=a("code"),f=n("transformers"),T=n(" accept two formats as input:"),i=p(),c=a("ul"),j=a("li"),I=n("having all inputs as keyword arguments (like PyTorch models), or"),C=p(),x=a("li"),N=n("having all inputs as a list, tuple or dict in the first positional argument."),ne=p(),G=a("p"),$e=n(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),L=a("code"),je=n("model.fit()"),ye=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=a("code"),Ge=n("model.fit()"),re=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),D=a("code"),Ee=n("fit()"),le=n(" and "),Y=a("code"),Fe=n("predict()"),be=n(`, such as when creating your own layers or models with
the Keras `),S=a("code"),Pe=n("Functional"),ie=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),de=p(),U=a("ul"),z=a("li"),ue=n("a single Tensor with "),K=a("code"),ve=n("input_ids"),me=n(" only and nothing else: "),V=a("code"),Ce=n("model(input_ids)"),ce=p(),W=a("li"),Ue=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),H=a("code"),xe=n("model([input_ids, attention_mask])"),Ie=n(" or "),O=a("code"),pe=n("model([input_ids, attention_mask, token_type_ids])"),we=p(),q=a("li"),fe=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Q=a("code"),ze=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=p(),Z=a("p"),We=n(`Note that when creating models and layers with
`),A=a("a"),te=n("subclassing"),Ze=n(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(b){d=r(b,"P",{});var F=l(d);y=s(F,"TensorFlow models and layers in "),u=r(F,"CODE",{});var et=l(u);f=s(et,"transformers"),et.forEach(t),T=s(F," accept two formats as input:"),F.forEach(t),i=h(b),c=r(b,"UL",{});var se=l(c);j=r(se,"LI",{});var tt=l(j);I=s(tt,"having all inputs as keyword arguments (like PyTorch models), or"),tt.forEach(t),C=h(se),x=r(se,"LI",{});var ot=l(x);N=s(ot,"having all inputs as a list, tuple or dict in the first positional argument."),ot.forEach(t),se.forEach(t),ne=h(b),G=r(b,"P",{});var P=l(G);$e=s(P,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),L=r(P,"CODE",{});var nt=l(L);je=s(nt,"model.fit()"),nt.forEach(t),ye=s(P,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=r(P,"CODE",{});var st=l(B);Ge=s(st,"model.fit()"),st.forEach(t),re=s(P,` supports! If, however, you want to use the second
format outside of Keras methods like `),D=r(P,"CODE",{});var Oe=l(D);Ee=s(Oe,"fit()"),Oe.forEach(t),le=s(P," and "),Y=r(P,"CODE",{});var ge=l(Y);Fe=s(ge,"predict()"),ge.forEach(t),be=s(P,`, such as when creating your own layers or models with
the Keras `),S=r(P,"CODE",{});var Me=l(S);Pe=s(Me,"Functional"),Me.forEach(t),ie=s(P,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),P.forEach(t),de=h(b),U=r(b,"UL",{});var R=l(U);z=r(R,"LI",{});var X=l(z);ue=s(X,"a single Tensor with "),K=r(X,"CODE",{});var at=l(K);ve=s(at,"input_ids"),at.forEach(t),me=s(X," only and nothing else: "),V=r(X,"CODE",{});var Re=l(V);Ce=s(Re,"model(input_ids)"),Re.forEach(t),X.forEach(t),ce=h(R),W=r(R,"LI",{});var oe=l(W);Ue=s(oe,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),H=r(oe,"CODE",{});var De=l(H);xe=s(De,"model([input_ids, attention_mask])"),De.forEach(t),Ie=s(oe," or "),O=r(oe,"CODE",{});var ke=l(O);pe=s(ke,"model([input_ids, attention_mask, token_type_ids])"),ke.forEach(t),oe.forEach(t),we=h(R),q=r(R,"LI",{});var Ae=l(q);fe=s(Ae,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Q=r(Ae,"CODE",{});var Be=l(Q);ze=s(Be,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Be.forEach(t),Ae.forEach(t),R.forEach(t),ee=h(b),Z=r(b,"P",{});var he=l(Z);We=s(he,`Note that when creating models and layers with
`),A=r(he,"A",{href:!0,rel:!0});var rt=l(A);te=s(rt,"subclassing"),rt.forEach(t),Ze=s(he,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),he.forEach(t),this.h()},h(){m(A,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(A,"rel","nofollow")},m(b,F){g(b,d,F),e(d,y),e(d,u),e(u,f),e(d,T),g(b,i,F),g(b,c,F),e(c,j),e(j,I),e(c,C),e(c,x),e(x,N),g(b,ne,F),g(b,G,F),e(G,$e),e(G,L),e(L,je),e(G,ye),e(G,B),e(B,Ge),e(G,re),e(G,D),e(D,Ee),e(G,le),e(G,Y),e(Y,Fe),e(G,be),e(G,S),e(S,Pe),e(G,ie),g(b,de,F),g(b,U,F),e(U,z),e(z,ue),e(z,K),e(K,ve),e(z,me),e(z,V),e(V,Ce),e(U,ce),e(U,W),e(W,Ue),e(W,H),e(H,xe),e(W,Ie),e(W,O),e(O,pe),e(U,we),e(U,q),e(q,fe),e(q,Q),e(Q,ze),g(b,ee,F),g(b,Z,F),e(Z,We),e(Z,A),e(A,te),e(Z,Ze)},d(b){b&&t(d),b&&t(i),b&&t(c),b&&t(ne),b&&t(G),b&&t(de),b&&t(U),b&&t(ee),b&&t(Z)}}}function mT(E){let d,y,u,f,T;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),f=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(c,"CODE",{});var j=l(u);f=s(j,"Module"),j.forEach(t),T=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,u),e(u,f),e(d,T)},d(i){i&&t(d)}}}function fT(E){let d,y,u,f,T;return f=new He({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkdQVEpGb3JDYXVzYWxMTSUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyRWxldXRoZXJBSSUyRmdwdC1qLTZCJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZHUFRKRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtai02QiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0cyklMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFGPTJForCausalLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){d=a("p"),y=n("Example:"),u=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),u=h(i),w(f.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,u,c),M(f,i,c),T=!0},p:gt,i(i){T||(k(f.$$.fragment,i),T=!0)},o(i){J(f.$$.fragment,i),T=!1},d(i){i&&t(d),i&&t(u),$(f,i)}}}function gT(E){let d,y,u,f,T,i,c,j,I,C,x,N,ne,G,$e,L,je,ye,B,Ge,re,D,Ee,le,Y,Fe,be,S,Pe,ie,de,U,z,ue,K,ve,me,V,Ce,ce,W,Ue,H,xe,Ie,O,pe,we,q,fe,Q,ze,ee,Z,We,A,te,Ze;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),u=a("code"),f=n("transformers"),T=n(" accept two formats as input:"),i=p(),c=a("ul"),j=a("li"),I=n("having all inputs as keyword arguments (like PyTorch models), or"),C=p(),x=a("li"),N=n("having all inputs as a list, tuple or dict in the first positional argument."),ne=p(),G=a("p"),$e=n(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),L=a("code"),je=n("model.fit()"),ye=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=a("code"),Ge=n("model.fit()"),re=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),D=a("code"),Ee=n("fit()"),le=n(" and "),Y=a("code"),Fe=n("predict()"),be=n(`, such as when creating your own layers or models with
the Keras `),S=a("code"),Pe=n("Functional"),ie=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),de=p(),U=a("ul"),z=a("li"),ue=n("a single Tensor with "),K=a("code"),ve=n("input_ids"),me=n(" only and nothing else: "),V=a("code"),Ce=n("model(input_ids)"),ce=p(),W=a("li"),Ue=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),H=a("code"),xe=n("model([input_ids, attention_mask])"),Ie=n(" or "),O=a("code"),pe=n("model([input_ids, attention_mask, token_type_ids])"),we=p(),q=a("li"),fe=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Q=a("code"),ze=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=p(),Z=a("p"),We=n(`Note that when creating models and layers with
`),A=a("a"),te=n("subclassing"),Ze=n(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(b){d=r(b,"P",{});var F=l(d);y=s(F,"TensorFlow models and layers in "),u=r(F,"CODE",{});var et=l(u);f=s(et,"transformers"),et.forEach(t),T=s(F," accept two formats as input:"),F.forEach(t),i=h(b),c=r(b,"UL",{});var se=l(c);j=r(se,"LI",{});var tt=l(j);I=s(tt,"having all inputs as keyword arguments (like PyTorch models), or"),tt.forEach(t),C=h(se),x=r(se,"LI",{});var ot=l(x);N=s(ot,"having all inputs as a list, tuple or dict in the first positional argument."),ot.forEach(t),se.forEach(t),ne=h(b),G=r(b,"P",{});var P=l(G);$e=s(P,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),L=r(P,"CODE",{});var nt=l(L);je=s(nt,"model.fit()"),nt.forEach(t),ye=s(P,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=r(P,"CODE",{});var st=l(B);Ge=s(st,"model.fit()"),st.forEach(t),re=s(P,` supports! If, however, you want to use the second
format outside of Keras methods like `),D=r(P,"CODE",{});var Oe=l(D);Ee=s(Oe,"fit()"),Oe.forEach(t),le=s(P," and "),Y=r(P,"CODE",{});var ge=l(Y);Fe=s(ge,"predict()"),ge.forEach(t),be=s(P,`, such as when creating your own layers or models with
the Keras `),S=r(P,"CODE",{});var Me=l(S);Pe=s(Me,"Functional"),Me.forEach(t),ie=s(P,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),P.forEach(t),de=h(b),U=r(b,"UL",{});var R=l(U);z=r(R,"LI",{});var X=l(z);ue=s(X,"a single Tensor with "),K=r(X,"CODE",{});var at=l(K);ve=s(at,"input_ids"),at.forEach(t),me=s(X," only and nothing else: "),V=r(X,"CODE",{});var Re=l(V);Ce=s(Re,"model(input_ids)"),Re.forEach(t),X.forEach(t),ce=h(R),W=r(R,"LI",{});var oe=l(W);Ue=s(oe,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),H=r(oe,"CODE",{});var De=l(H);xe=s(De,"model([input_ids, attention_mask])"),De.forEach(t),Ie=s(oe," or "),O=r(oe,"CODE",{});var ke=l(O);pe=s(ke,"model([input_ids, attention_mask, token_type_ids])"),ke.forEach(t),oe.forEach(t),we=h(R),q=r(R,"LI",{});var Ae=l(q);fe=s(Ae,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Q=r(Ae,"CODE",{});var Be=l(Q);ze=s(Be,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Be.forEach(t),Ae.forEach(t),R.forEach(t),ee=h(b),Z=r(b,"P",{});var he=l(Z);We=s(he,`Note that when creating models and layers with
`),A=r(he,"A",{href:!0,rel:!0});var rt=l(A);te=s(rt,"subclassing"),rt.forEach(t),Ze=s(he,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),he.forEach(t),this.h()},h(){m(A,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(A,"rel","nofollow")},m(b,F){g(b,d,F),e(d,y),e(d,u),e(u,f),e(d,T),g(b,i,F),g(b,c,F),e(c,j),e(j,I),e(c,C),e(c,x),e(x,N),g(b,ne,F),g(b,G,F),e(G,$e),e(G,L),e(L,je),e(G,ye),e(G,B),e(B,Ge),e(G,re),e(G,D),e(D,Ee),e(G,le),e(G,Y),e(Y,Fe),e(G,be),e(G,S),e(S,Pe),e(G,ie),g(b,de,F),g(b,U,F),e(U,z),e(z,ue),e(z,K),e(K,ve),e(z,me),e(z,V),e(V,Ce),e(U,ce),e(U,W),e(W,Ue),e(W,H),e(H,xe),e(W,Ie),e(W,O),e(O,pe),e(U,we),e(U,q),e(q,fe),e(q,Q),e(Q,ze),g(b,ee,F),g(b,Z,F),e(Z,We),e(Z,A),e(A,te),e(Z,Ze)},d(b){b&&t(d),b&&t(i),b&&t(c),b&&t(ne),b&&t(G),b&&t(de),b&&t(U),b&&t(ee),b&&t(Z)}}}function _T(E){let d,y,u,f,T;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),f=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(c,"CODE",{});var j=l(u);f=s(j,"Module"),j.forEach(t),T=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,u),e(u,f),e(d,T)},d(i){i&&t(d)}}}function TT(E){let d,y,u,f,T;return f=new He({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkdQVEpGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJFbGV1dGhlckFJJTJGZ3B0LWotNkIlMjIpJTBBbW9kZWwlMjAlM0QlMjBURkdQVEpGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJFbGV1dGhlckFJJTJGZ3B0LWotNkIlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQSUwQWxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWQlMjAlM0QlMjBpbnQodGYubWF0aC5hcmdtYXgobG9naXRzJTJDJTIwYXhpcyUzRC0xKSU1QjAlNUQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFGPTJForSequenceClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = <span class="hljs-built_in">int</span>(tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])`}}),{c(){d=a("p"),y=n("Example:"),u=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),u=h(i),w(f.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,u,c),M(f,i,c),T=!0},p:gt,i(i){T||(k(f.$$.fragment,i),T=!0)},o(i){J(f.$$.fragment,i),T=!1},d(i){i&&t(d),i&&t(u),$(f,i)}}}function yT(E){let d,y;return d=new He({props:{code:"JTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwVEZHUFRKRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyRWxldXRoZXJBSSUyRmdwdC1qLTZCJTIyJTJDJTIwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdGYuY29uc3RhbnQoMSklMEFsb3NzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjBsYWJlbHMlM0RsYWJlbHMpLmxvc3M=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on `num_labels` classes, you can pass `num_labels=num_labels` to `.from_pretrained(...)`</span>\n<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)\n<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFGPTJForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>, num_labels=num_labels)\n\n<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tf.constant(<span class="hljs-number">1</span>)\n<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss'}}),{c(){v(d.$$.fragment)},l(u){w(d.$$.fragment,u)},m(u,f){M(d,u,f),y=!0},p:gt,i(u){y||(k(d.$$.fragment,u),y=!0)},o(u){J(d.$$.fragment,u),y=!1},d(u){$(d,u)}}}function bT(E){let d,y,u,f,T,i,c,j,I,C,x,N,ne,G,$e,L,je,ye,B,Ge,re,D,Ee,le,Y,Fe,be,S,Pe,ie,de,U,z,ue,K,ve,me,V,Ce,ce,W,Ue,H,xe,Ie,O,pe,we,q,fe,Q,ze,ee,Z,We,A,te,Ze;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),u=a("code"),f=n("transformers"),T=n(" accept two formats as input:"),i=p(),c=a("ul"),j=a("li"),I=n("having all inputs as keyword arguments (like PyTorch models), or"),C=p(),x=a("li"),N=n("having all inputs as a list, tuple or dict in the first positional argument."),ne=p(),G=a("p"),$e=n(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),L=a("code"),je=n("model.fit()"),ye=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=a("code"),Ge=n("model.fit()"),re=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),D=a("code"),Ee=n("fit()"),le=n(" and "),Y=a("code"),Fe=n("predict()"),be=n(`, such as when creating your own layers or models with
the Keras `),S=a("code"),Pe=n("Functional"),ie=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),de=p(),U=a("ul"),z=a("li"),ue=n("a single Tensor with "),K=a("code"),ve=n("input_ids"),me=n(" only and nothing else: "),V=a("code"),Ce=n("model(input_ids)"),ce=p(),W=a("li"),Ue=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),H=a("code"),xe=n("model([input_ids, attention_mask])"),Ie=n(" or "),O=a("code"),pe=n("model([input_ids, attention_mask, token_type_ids])"),we=p(),q=a("li"),fe=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Q=a("code"),ze=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=p(),Z=a("p"),We=n(`Note that when creating models and layers with
`),A=a("a"),te=n("subclassing"),Ze=n(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(b){d=r(b,"P",{});var F=l(d);y=s(F,"TensorFlow models and layers in "),u=r(F,"CODE",{});var et=l(u);f=s(et,"transformers"),et.forEach(t),T=s(F," accept two formats as input:"),F.forEach(t),i=h(b),c=r(b,"UL",{});var se=l(c);j=r(se,"LI",{});var tt=l(j);I=s(tt,"having all inputs as keyword arguments (like PyTorch models), or"),tt.forEach(t),C=h(se),x=r(se,"LI",{});var ot=l(x);N=s(ot,"having all inputs as a list, tuple or dict in the first positional argument."),ot.forEach(t),se.forEach(t),ne=h(b),G=r(b,"P",{});var P=l(G);$e=s(P,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),L=r(P,"CODE",{});var nt=l(L);je=s(nt,"model.fit()"),nt.forEach(t),ye=s(P,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=r(P,"CODE",{});var st=l(B);Ge=s(st,"model.fit()"),st.forEach(t),re=s(P,` supports! If, however, you want to use the second
format outside of Keras methods like `),D=r(P,"CODE",{});var Oe=l(D);Ee=s(Oe,"fit()"),Oe.forEach(t),le=s(P," and "),Y=r(P,"CODE",{});var ge=l(Y);Fe=s(ge,"predict()"),ge.forEach(t),be=s(P,`, such as when creating your own layers or models with
the Keras `),S=r(P,"CODE",{});var Me=l(S);Pe=s(Me,"Functional"),Me.forEach(t),ie=s(P,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),P.forEach(t),de=h(b),U=r(b,"UL",{});var R=l(U);z=r(R,"LI",{});var X=l(z);ue=s(X,"a single Tensor with "),K=r(X,"CODE",{});var at=l(K);ve=s(at,"input_ids"),at.forEach(t),me=s(X," only and nothing else: "),V=r(X,"CODE",{});var Re=l(V);Ce=s(Re,"model(input_ids)"),Re.forEach(t),X.forEach(t),ce=h(R),W=r(R,"LI",{});var oe=l(W);Ue=s(oe,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),H=r(oe,"CODE",{});var De=l(H);xe=s(De,"model([input_ids, attention_mask])"),De.forEach(t),Ie=s(oe," or "),O=r(oe,"CODE",{});var ke=l(O);pe=s(ke,"model([input_ids, attention_mask, token_type_ids])"),ke.forEach(t),oe.forEach(t),we=h(R),q=r(R,"LI",{});var Ae=l(q);fe=s(Ae,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Q=r(Ae,"CODE",{});var Be=l(Q);ze=s(Be,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Be.forEach(t),Ae.forEach(t),R.forEach(t),ee=h(b),Z=r(b,"P",{});var he=l(Z);We=s(he,`Note that when creating models and layers with
`),A=r(he,"A",{href:!0,rel:!0});var rt=l(A);te=s(rt,"subclassing"),rt.forEach(t),Ze=s(he,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),he.forEach(t),this.h()},h(){m(A,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(A,"rel","nofollow")},m(b,F){g(b,d,F),e(d,y),e(d,u),e(u,f),e(d,T),g(b,i,F),g(b,c,F),e(c,j),e(j,I),e(c,C),e(c,x),e(x,N),g(b,ne,F),g(b,G,F),e(G,$e),e(G,L),e(L,je),e(G,ye),e(G,B),e(B,Ge),e(G,re),e(G,D),e(D,Ee),e(G,le),e(G,Y),e(Y,Fe),e(G,be),e(G,S),e(S,Pe),e(G,ie),g(b,de,F),g(b,U,F),e(U,z),e(z,ue),e(z,K),e(K,ve),e(z,me),e(z,V),e(V,Ce),e(U,ce),e(U,W),e(W,Ue),e(W,H),e(H,xe),e(W,Ie),e(W,O),e(O,pe),e(U,we),e(U,q),e(q,fe),e(q,Q),e(Q,ze),g(b,ee,F),g(b,Z,F),e(Z,We),e(Z,A),e(A,te),e(Z,Ze)},d(b){b&&t(d),b&&t(i),b&&t(c),b&&t(ne),b&&t(G),b&&t(de),b&&t(U),b&&t(ee),b&&t(Z)}}}function vT(E){let d,y,u,f,T;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),f=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(c,"CODE",{});var j=l(u);f=s(j,"Module"),j.forEach(t),T=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,u),e(u,f),e(d,T)},d(i){i&&t(d)}}}function wT(E){let d,y,u,f,T;return f=new He({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkdQVEpGb3JRdWVzdGlvbkFuc3dlcmluZyUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyRWxldXRoZXJBSSUyRmdwdC1qLTZCJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZHUFRKRm9yUXVlc3Rpb25BbnN3ZXJpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtai02QiUyMiklMEElMEFxdWVzdGlvbiUyQyUyMHRleHQlMjAlM0QlMjAlMjJXaG8lMjB3YXMlMjBKaW0lMjBIZW5zb24lM0YlMjIlMkMlMjAlMjJKaW0lMjBIZW5zb24lMjB3YXMlMjBhJTIwbmljZSUyMHB1cHBldCUyMiUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihxdWVzdGlvbiUyQyUyMHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFhbnN3ZXJfc3RhcnRfaW5kZXglMjAlM0QlMjBpbnQodGYubWF0aC5hcmdtYXgob3V0cHV0cy5zdGFydF9sb2dpdHMlMkMlMjBheGlzJTNELTEpJTVCMCU1RCklMEFhbnN3ZXJfZW5kX2luZGV4JTIwJTNEJTIwaW50KHRmLm1hdGguYXJnbWF4KG91dHB1dHMuZW5kX2xvZ2l0cyUyQyUyMGF4aXMlM0QtMSklNUIwJTVEKSUwQSUwQXByZWRpY3RfYW5zd2VyX3Rva2VucyUyMCUzRCUyMGlucHV0cy5pbnB1dF9pZHMlNUIwJTJDJTIwYW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNBJTIwYW5zd2VyX2VuZF9pbmRleCUyMCUyQiUyMDElNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFGPTJForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>answer_start_index = <span class="hljs-built_in">int</span>(tf.math.argmax(outputs.start_logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_end_index = <span class="hljs-built_in">int</span>(tf.math.argmax(outputs.end_logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>predict_answer_tokens = inputs.input_ids[<span class="hljs-number">0</span>, answer_start_index : answer_end_index + <span class="hljs-number">1</span>]`}}),{c(){d=a("p"),y=n("Example:"),u=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),u=h(i),w(f.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,u,c),M(f,i,c),T=!0},p:gt,i(i){T||(k(f.$$.fragment,i),T=!0)},o(i){J(f.$$.fragment,i),T=!1},d(i){i&&t(d),i&&t(u),$(f,i)}}}function MT(E){let d,y;return d=new He({props:{code:"JTIzJTIwdGFyZ2V0JTIwaXMlMjAlMjJuaWNlJTIwcHVwcGV0JTIyJTBBdGFyZ2V0X3N0YXJ0X2luZGV4JTIwJTNEJTIwdGYuY29uc3RhbnQoJTVCMTQlNUQpJTBBdGFyZ2V0X2VuZF9pbmRleCUyMCUzRCUyMHRmLmNvbnN0YW50KCU1QjE1JTVEKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMHN0YXJ0X3Bvc2l0aW9ucyUzRHRhcmdldF9zdGFydF9pbmRleCUyQyUyMGVuZF9wb3NpdGlvbnMlM0R0YXJnZXRfZW5kX2luZGV4KSUwQWxvc3MlMjAlM0QlMjB0Zi5tYXRoLnJlZHVjZV9tZWFuKG91dHB1dHMubG9zcyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># target is &quot;nice puppet&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_start_index = tf.constant([<span class="hljs-number">14</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>target_end_index = tf.constant([<span class="hljs-number">15</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = tf.math.reduce_mean(outputs.loss)`}}),{c(){v(d.$$.fragment)},l(u){w(d.$$.fragment,u)},m(u,f){M(d,u,f),y=!0},p:gt,i(u){y||(k(d.$$.fragment,u),y=!0)},o(u){J(d.$$.fragment,u),y=!1},d(u){$(d,u)}}}function kT(E){let d,y,u,f,T;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),f=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(c,"CODE",{});var j=l(u);f=s(j,"Module"),j.forEach(t),T=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,u),e(u,f),e(d,T)},d(i){i&&t(d)}}}function JT(E){let d,y,u,f,T;return f=new He({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4R1BUSk1vZGVsJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ3B0aiUyMiklMEFtb2RlbCUyMCUzRCUyMEZsYXhHUFRKTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmdwdGolMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMmpheCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxGPTJModel

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){d=a("p"),y=n("Example:"),u=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),u=h(i),w(f.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,u,c),M(f,i,c),T=!0},p:gt,i(i){T||(k(f.$$.fragment,i),T=!0)},o(i){J(f.$$.fragment,i),T=!1},d(i){i&&t(d),i&&t(u),$(f,i)}}}function $T(E){let d,y,u,f,T;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),f=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(c,"CODE",{});var j=l(u);f=s(j,"Module"),j.forEach(t),T=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,u),e(u,f),e(d,T)},d(i){i&&t(d)}}}function jT(E){let d,y,u,f,T;return f=new He({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4R1BUSkZvckNhdXNhbExNJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ3B0aiUyMiklMEFtb2RlbCUyMCUzRCUyMEZsYXhHUFRKRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmdwdGolMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMm5wJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEElMjMlMjByZXRyaWV2ZSUyMGxvZ3RzJTIwZm9yJTIwbmV4dCUyMHRva2VuJTBBbmV4dF90b2tlbl9sb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cyU1QiUzQSUyQyUyMC0xJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxGPTJForCausalLM

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># retrieve logts for next token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>next_token_logits = outputs.logits[:, -<span class="hljs-number">1</span>]`}}),{c(){d=a("p"),y=n("Example:"),u=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),u=h(i),w(f.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,u,c),M(f,i,c),T=!0},p:gt,i(i){T||(k(f.$$.fragment,i),T=!0)},o(i){J(f.$$.fragment,i),T=!1},d(i){i&&t(d),i&&t(u),$(f,i)}}}function GT(E){let d,y,u,f,T,i,c,j,I,C,x,N,ne,G,$e,L,je,ye,B,Ge,re,D,Ee,le,Y,Fe,be,S,Pe,ie,de,U,z,ue,K,ve,me,V,Ce,ce,W,Ue,H,xe,Ie,O,pe,we,q,fe,Q,ze,ee,Z,We,A,te,Ze,b,F,et,se,tt,ot,P,nt,st,Oe,ge,Me,R,X,at,Re,oe,De,ke,Ae,Be,he,rt,Bl,vn,Vl,ha,ed,Rl,wn,Sl,Lt,wo,ar,Mn,td,rr,od,Xl,ua,nd,Ql,kn,Ll,ae,Jn,sd,$n,ad,rd,ld,jn,id,Gn,dd,cd,pd,En,hd,Fn,ud,md,fd,Pn,gd,Cn,_d,Td,yd,Un,bd,xn,vd,wd,Md,In,kd,zn,Jd,$d,jd,ma,Wn,Gd,Ed,Fd,wt,fa,Pd,Cd,Zn,Ud,xd,An,Id,zd,Nn,Wd,Zd,Ad,Wt,ga,Nd,qd,qn,Bd,Vd,Bn,Rd,Sd,Xd,Zt,_a,Qd,Ld,Vn,Hd,Od,Rn,Dd,Yd,Hl,Ta,lr,Kd,Ol,At,ir,ya,ec,tc,dr,ba,oc,nc,cr,va,sc,Dl,Ht,Mo,pr,Sn,ac,hr,rc,Yl,Ct,Xn,lc,_t,ic,wa,dc,cc,Qn,pc,hc,Ma,uc,mc,ka,fc,gc,_c,ko,Kl,Ot,Jo,ur,Ln,Tc,mr,yc,ei,Ut,Hn,bc,On,vc,Dn,wc,Mc,kc,it,Yn,Jc,Dt,$c,Ja,jc,Gc,fr,Ec,Fc,Pc,$o,Cc,jo,Uc,Go,ti,Yt,Eo,gr,Kn,xc,_r,Ic,oi,Tt,es,zc,Tr,Wc,Zc,ts,Ac,os,Nc,qc,Bc,dt,ns,Vc,Kt,Rc,$a,Sc,Xc,yr,Qc,Lc,Hc,Fo,Oc,Po,Dc,Co,ni,eo,Uo,br,ss,Yc,vr,Kc,si,Se,as,ep,wr,tp,op,ja,Ga,np,sp,ap,yt,rp,Mr,lp,ip,kr,dp,cp,Jr,pp,hp,$r,up,mp,fp,rs,gp,ls,_p,Tp,yp,Ye,is,bp,to,vp,Ea,wp,Mp,jr,kp,Jp,$p,xo,jp,Io,Gp,zo,Ep,Wo,ai,oo,Zo,Gr,ds,Fp,Er,Pp,ri,bt,cs,Cp,no,Up,Fr,xp,Ip,Pr,zp,Wp,Zp,ps,Ap,hs,Np,qp,Bp,ct,us,Vp,so,Rp,Fa,Sp,Xp,Cr,Qp,Lp,Hp,Ao,Op,No,Dp,qo,li,ao,Bo,Ur,ms,Yp,xr,Kp,ii,Xe,fs,eh,Ir,th,oh,gs,nh,Pa,sh,ah,rh,_s,lh,Ts,ih,dh,ch,Vo,ph,Mt,ys,hh,ro,uh,Ca,mh,fh,zr,gh,_h,Th,Ro,yh,So,di,lo,Xo,Wr,bs,bh,Zr,vh,ci,Qe,vs,wh,Ar,Mh,kh,ws,Jh,Ua,$h,jh,Gh,Ms,Eh,ks,Fh,Ph,Ch,Qo,Uh,kt,Js,xh,io,Ih,xa,zh,Wh,Nr,Zh,Ah,Nh,Lo,qh,Ho,pi,co,Oo,qr,$s,Bh,Br,Vh,hi,_e,js,Rh,Vr,Sh,Xh,Ia,za,Qh,Lh,Hh,vt,Oh,Rr,Dh,Yh,Sr,Kh,eu,Xr,tu,ou,Qr,nu,su,au,Gs,ru,Wa,lu,iu,du,Es,cu,Fs,pu,hu,uu,Do,mu,pt,Ps,fu,po,gu,Za,_u,Tu,Lr,yu,bu,vu,Yo,wu,Ko,Mu,en,ui,ho,tn,Hr,Cs,ku,Or,Ju,mi,Le,Us,$u,uo,ju,Dr,Gu,Eu,Yr,Fu,Pu,Cu,xs,Uu,Aa,xu,Iu,zu,Is,Wu,zs,Zu,Au,Nu,on,qu,ht,Ws,Bu,mo,Vu,Na,Ru,Su,Kr,Xu,Qu,Lu,nn,Hu,sn,Ou,an,fi,fo,rn,el,Zs,Du,tl,Yu,gi,Ne,As,Ku,ol,em,tm,Ns,om,qa,nm,sm,am,qs,rm,Bs,lm,im,dm,nl,cm,pm,xt,sl,Vs,hm,um,al,Rs,mm,fm,rl,Ss,gm,_m,ll,Xs,Tm,ym,Jt,Qs,bm,go,vm,il,wm,Mm,dl,km,Jm,$m,ln,jm,dn,_i,_o,cn,cl,Ls,Gm,pl,Em,Ti,qe,Hs,Fm,hl,Pm,Cm,Os,Um,Ba,xm,Im,zm,Ds,Wm,Ys,Zm,Am,Nm,ul,qm,Bm,It,ml,Ks,Vm,Rm,fl,ea,Sm,Xm,gl,ta,Qm,Lm,_l,oa,Hm,Om,$t,na,Dm,To,Ym,Tl,Km,ef,yl,tf,of,nf,pn,sf,hn,yi;return i=new lt({}),G=new lt({}),pe=new He({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVEpGb3JDYXVzYWxMTSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUwQW1vZGVsJTIwJTNEJTIwR1BUSkZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJFbGV1dGhlckFJJTJGZ3B0LWotNkIlMjIlMkMlMEElMjAlMjAlMjAlMjByZXZpc2lvbiUzRCUyMmZsb2F0MTYlMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMEEpLnRvKGRldmljZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTJForCausalLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTJForCausalLM.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>,
<span class="hljs-meta">... </span>    revision=<span class="hljs-string">&quot;float16&quot;</span>,
<span class="hljs-meta">... </span>    torch_dtype=torch.float16,
<span class="hljs-meta">... </span>).to(device)`}}),X=new lt({}),vn=new He({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMkVsZXV0aGVyQUklMkZncHQtai02QiUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJFbGV1dGhlckFJJTJGZ3B0LWotNkIlMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwKCUwQSUyMCUyMCUyMCUyMCUyMkluJTIwYSUyMHNob2NraW5nJTIwZmluZGluZyUyQyUyMHNjaWVudGlzdHMlMjBkaXNjb3ZlcmVkJTIwYSUyMGhlcmQlMjBvZiUyMHVuaWNvcm5zJTIwbGl2aW5nJTIwaW4lMjBhJTIwcmVtb3RlJTJDJTIwJTIyJTBBJTIwJTIwJTIwJTIwJTIycHJldmlvdXNseSUyMHVuZXhwbG9yZWQlMjB2YWxsZXklMkMlMjBpbiUyMHRoZSUyMEFuZGVzJTIwTW91bnRhaW5zLiUyMEV2ZW4lMjBtb3JlJTIwc3VycHJpc2luZyUyMHRvJTIwdGhlJTIwJTIyJTBBJTIwJTIwJTIwJTIwJTIycmVzZWFyY2hlcnMlMjB3YXMlMjB0aGUlMjBmYWN0JTIwdGhhdCUyMHRoZSUyMHVuaWNvcm5zJTIwc3Bva2UlMjBwZXJmZWN0JTIwRW5nbGlzaC4lMjIlMEEpJTBBJTBBaW5wdXRfaWRzJTIwJTNEJTIwdG9rZW5pemVyKHByb21wdCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcyUwQSUwQWdlbl90b2tlbnMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSglMEElMjAlMjAlMjAlMjBpbnB1dF9pZHMlMkMlMEElMjAlMjAlMjAlMjBkb19zYW1wbGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwdGVtcGVyYXR1cmUlM0QwLjklMkMlMEElMjAlMjAlMjAlMjBtYXhfbGVuZ3RoJTNEMTAwJTJDJTBBKSUwQWdlbl90ZXh0JTIwJTNEJTIwdG9rZW5pemVyLmJhdGNoX2RlY29kZShnZW5fdG9rZW5zKSU1QjAlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer

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

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

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>gen_tokens = model.generate(
<span class="hljs-meta">... </span>    input_ids,
<span class="hljs-meta">... </span>    do_sample=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    temperature=<span class="hljs-number">0.9</span>,
<span class="hljs-meta">... </span>    max_length=<span class="hljs-number">100</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>gen_text = tokenizer.batch_decode(gen_tokens)[<span class="hljs-number">0</span>]`}}),Mn=new lt({}),kn=new H_({props:{pipeline:"text-generation"}}),Sn=new lt({}),Xn=new Te({props:{name:"class transformers.GPTJConfig",anchor:"transformers.GPTJConfig",parameters:[{name:"vocab_size",val:" = 50400"},{name:"n_positions",val:" = 2048"},{name:"n_embd",val:" = 4096"},{name:"n_layer",val:" = 28"},{name:"n_head",val:" = 16"},{name:"rotary_dim",val:" = 64"},{name:"n_inner",val:" = None"},{name:"activation_function",val:" = 'gelu_new'"},{name:"resid_pdrop",val:" = 0.0"},{name:"embd_pdrop",val:" = 0.0"},{name:"attn_pdrop",val:" = 0.0"},{name:"layer_norm_epsilon",val:" = 1e-05"},{name:"initializer_range",val:" = 0.02"},{name:"use_cache",val:" = True"},{name:"bos_token_id",val:" = 50256"},{name:"eos_token_id",val:" = 50256"},{name:"tie_word_embeddings",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GPTJConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50400) &#x2014;
Vocabulary size of the GPT-J model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJModel">GPTJModel</a>.`,name:"vocab_size"},{anchor:"transformers.GPTJConfig.n_positions",description:`<strong>n_positions</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"n_positions"},{anchor:"transformers.GPTJConfig.n_embd",description:`<strong>n_embd</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimensionality of the embeddings and hidden states.`,name:"n_embd"},{anchor:"transformers.GPTJConfig.n_layer",description:`<strong>n_layer</strong> (<code>int</code>, <em>optional</em>, defaults to 28) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"n_layer"},{anchor:"transformers.GPTJConfig.n_head",description:`<strong>n_head</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"n_head"},{anchor:"transformers.GPTJConfig.rotary_dim",description:`<strong>rotary_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Number of dimensions in the embedding that Rotary Position Embedding is applied to.`,name:"rotary_dim"},{anchor:"transformers.GPTJConfig.n_inner",description:`<strong>n_inner</strong> (<code>int</code>, <em>optional</em>, defaults to None) &#x2014;
Dimensionality of the inner feed-forward layers. <code>None</code> will set it to 4 times n_embd`,name:"n_inner"},{anchor:"transformers.GPTJConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
Activation function, to be selected in the list <code>[&quot;relu&quot;, &quot;silu&quot;, &quot;gelu&quot;, &quot;tanh&quot;, &quot;gelu_new&quot;]</code>.`,name:"activation_function"},{anchor:"transformers.GPTJConfig.resid_pdrop",description:`<strong>resid_pdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"resid_pdrop"},{anchor:"transformers.GPTJConfig.embd_pdrop",description:`<strong>embd_pdrop</strong> (<code>int</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the embeddings.`,name:"embd_pdrop"},{anchor:"transformers.GPTJConfig.attn_pdrop",description:`<strong>attn_pdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention.`,name:"attn_pdrop"},{anchor:"transformers.GPTJConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon to use in the layer normalization layers.`,name:"layer_norm_epsilon"},{anchor:"transformers.GPTJConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.GPTJConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/configuration_gptj.py#L33"}}),ko=new ft({props:{anchor:"transformers.GPTJConfig.example",$$slots:{default:[O_]},$$scope:{ctx:E}}}),Ln=new lt({}),Hn=new Te({props:{name:"class transformers.GPTJModel",anchor:"transformers.GPTJModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTJModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_gptj.py#L482"}}),Yn=new Te({props:{name:"forward",anchor:"transformers.GPTJModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"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.GPTJModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPTJModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GPTJModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.GPTJModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTJModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_attention_heads,)</code> or <code>(n_layer, num_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.GPTJModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_dim)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTJModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.GPTJModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.GPTJModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_gptj.py#L549",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/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/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
<code>config.is_encoder_decoder=True</code> in the cross-attention blocks) that can be used (see <code>past_key_values</code>
input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),$o=new Ve({props:{$$slots:{default:[D_]},$$scope:{ctx:E}}}),jo=new Ve({props:{warning:!0,$$slots:{default:[Y_]},$$scope:{ctx:E}}}),Go=new ft({props:{anchor:"transformers.GPTJModel.forward.example",$$slots:{default:[K_]},$$scope:{ctx:E}}}),Kn=new lt({}),es=new Te({props:{name:"class transformers.GPTJForCausalLM",anchor:"transformers.GPTJForCausalLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTJForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_gptj.py#L736"}}),ns=new Te({props:{name:"forward",anchor:"transformers.GPTJForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.GPTJForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPTJForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GPTJForCausalLM.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.GPTJForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTJForCausalLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_attention_heads,)</code> or <code>(n_layer, num_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.GPTJForCausalLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_dim)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTJForCausalLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.GPTJForCausalLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.GPTJForCausalLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTJForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for language modeling. Note that the labels <strong>are shifted</strong> inside the model, i.e. you can set
<code>labels = input_ids</code> Indices are selected in <code>[-100, 0, ..., config.vocab_size]</code> All labels set to <code>-100</code>
are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_gptj.py#L824",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/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/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Fo=new Ve({props:{$$slots:{default:[eT]},$$scope:{ctx:E}}}),Po=new Ve({props:{warning:!0,$$slots:{default:[tT]},$$scope:{ctx:E}}}),Co=new ft({props:{anchor:"transformers.GPTJForCausalLM.forward.example",$$slots:{default:[oT]},$$scope:{ctx:E}}}),ss=new lt({}),as=new Te({props:{name:"class transformers.GPTJForSequenceClassification",anchor:"transformers.GPTJForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTJForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_gptj.py#L934"}}),is=new Te({props:{name:"forward",anchor:"transformers.GPTJForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.GPTJForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPTJForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GPTJForSequenceClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.GPTJForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTJForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_attention_heads,)</code> or <code>(n_layer, num_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.GPTJForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_dim)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTJForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.GPTJForSequenceClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.GPTJForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTJForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_gptj.py#L948",returnDescription:`
<p>A <code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),xo=new Ve({props:{$$slots:{default:[nT]},$$scope:{ctx:E}}}),Io=new Ve({props:{warning:!0,$$slots:{default:[sT]},$$scope:{ctx:E}}}),zo=new ft({props:{anchor:"transformers.GPTJForSequenceClassification.forward.example",$$slots:{default:[aT]},$$scope:{ctx:E}}}),Wo=new ft({props:{anchor:"transformers.GPTJForSequenceClassification.forward.example-2",$$slots:{default:[rT]},$$scope:{ctx:E}}}),ds=new lt({}),cs=new Te({props:{name:"class transformers.GPTJForQuestionAnswering",anchor:"transformers.GPTJForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTJForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_gptj.py#L1058"}}),us=new Te({props:{name:"forward",anchor:"transformers.GPTJForQuestionAnswering.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.GPTJForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPTJForQuestionAnswering.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GPTJForQuestionAnswering.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.GPTJForQuestionAnswering.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPTJForQuestionAnswering.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_attention_heads,)</code> or <code>(n_layer, num_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.GPTJForQuestionAnswering.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_dim)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GPTJForQuestionAnswering.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.GPTJForQuestionAnswering.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.GPTJForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPTJForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.GPTJForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_gptj.py#L1072",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/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/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ao=new Ve({props:{$$slots:{default:[lT]},$$scope:{ctx:E}}}),No=new Ve({props:{warning:!0,$$slots:{default:[iT]},$$scope:{ctx:E}}}),qo=new ft({props:{anchor:"transformers.GPTJForQuestionAnswering.forward.example",$$slots:{default:[dT]},$$scope:{ctx:E}}}),ms=new lt({}),fs=new Te({props:{name:"class transformers.TFGPTJModel",anchor:"transformers.TFGPTJModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFGPTJModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_tf_gptj.py#L625"}}),Vo=new Ve({props:{$$slots:{default:[cT]},$$scope:{ctx:E}}}),ys=new Te({props:{name:"call",anchor:"transformers.TFGPTJModel.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"past_key_values",val:": Optional[Tuple[Tuple[Union[np.ndarray, tf.Tensor]]]] = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"use_cache",val:": Optional[bool] = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFGPTJModel.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past</code> is <code>None</code> else <code>past[0].shape[-2]</code> (<code>sequence_length</code> of
input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past</code> is used, only input IDs that do not have their past calculated should be passed as <code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFGPTJModel.call.past_key_values",description:`<strong>past_key_values</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past</code> output below). Can be used to speed up sequential decoding. The token ids which have their past
given to this model should not be passed as input ids as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.TFGPTJModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFGPTJModel.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFGPTJModel.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFGPTJModel.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFGPTJModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFGPTJModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFGPTJModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFGPTJModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used
in eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFGPTJModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFGPTJModel.call.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past</code>). Set to <code>False</code> during training, <code>True</code> during generation`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_tf_gptj.py#L630",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPast"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPast</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>List[tf.Tensor]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 List of <code>tf.Tensor</code> of length <code>config.n_layers</code>, with each tensor of shape <code>(2, batch_size, num_heads, sequence_length, embed_size_per_head)</code>).</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPast"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPast</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Ro=new Ve({props:{$$slots:{default:[pT]},$$scope:{ctx:E}}}),So=new ft({props:{anchor:"transformers.TFGPTJModel.call.example",$$slots:{default:[hT]},$$scope:{ctx:E}}}),bs=new lt({}),vs=new Te({props:{name:"class transformers.TFGPTJForCausalLM",anchor:"transformers.TFGPTJForCausalLM",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFGPTJForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_tf_gptj.py#L682"}}),Qo=new Ve({props:{$$slots:{default:[uT]},$$scope:{ctx:E}}}),Js=new Te({props:{name:"call",anchor:"transformers.TFGPTJForCausalLM.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"past_key_values",val:": Optional[Tuple[Tuple[Union[np.ndarray, tf.Tensor]]]] = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"use_cache",val:": Optional[bool] = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFGPTJForCausalLM.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past</code> is <code>None</code> else <code>past[0].shape[-2]</code> (<code>sequence_length</code> of
input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past</code> is used, only input IDs that do not have their past calculated should be passed as <code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFGPTJForCausalLM.call.past_key_values",description:`<strong>past_key_values</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past</code> output below). Can be used to speed up sequential decoding. The token ids which have their past
given to this model should not be passed as input ids as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.TFGPTJForCausalLM.call.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFGPTJForCausalLM.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFGPTJForCausalLM.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFGPTJForCausalLM.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFGPTJForCausalLM.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFGPTJForCausalLM.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFGPTJForCausalLM.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFGPTJForCausalLM.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used
in eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFGPTJForCausalLM.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFGPTJForCausalLM.call.labels",description:`<strong>labels</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for language modeling. Note that the labels <strong>are shifted</strong> inside the model, i.e. you can set
<code>labels = input_ids</code> Indices are selected in <code>[-100, 0, ..., config.vocab_size]</code> All labels set to <code>-100</code>
are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_tf_gptj.py#L721",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutputWithPast"
>transformers.modeling_tf_outputs.TFCausalLMOutputWithPast</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(n,)</code>, <em>optional</em>, where n is the number of non-masked labels, returned when <code>labels</code> is provided) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>List[tf.Tensor]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 List of <code>tf.Tensor</code> of length <code>config.n_layers</code>, with each tensor of shape <code>(2, batch_size, num_heads, sequence_length, embed_size_per_head)</code>).</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutputWithPast"
>transformers.modeling_tf_outputs.TFCausalLMOutputWithPast</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Lo=new Ve({props:{$$slots:{default:[mT]},$$scope:{ctx:E}}}),Ho=new ft({props:{anchor:"transformers.TFGPTJForCausalLM.call.example",$$slots:{default:[fT]},$$scope:{ctx:E}}}),$s=new lt({}),js=new Te({props:{name:"class transformers.TFGPTJForSequenceClassification",anchor:"transformers.TFGPTJForSequenceClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFGPTJForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_tf_gptj.py#L803"}}),Do=new Ve({props:{$$slots:{default:[gT]},$$scope:{ctx:E}}}),Ps=new Te({props:{name:"call",anchor:"transformers.TFGPTJForSequenceClassification.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"past_key_values",val:": Optional[Tuple[Tuple[Union[np.ndarray, tf.Tensor]]]] = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"use_cache",val:": Optional[bool] = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFGPTJForSequenceClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past</code> is <code>None</code> else <code>past[0].shape[-2]</code> (<code>sequence_length</code> of
input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past</code> is used, only input IDs that do not have their past calculated should be passed as <code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFGPTJForSequenceClassification.call.past_key_values",description:`<strong>past_key_values</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past</code> output below). Can be used to speed up sequential decoding. The token ids which have their past
given to this model should not be passed as input ids as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.TFGPTJForSequenceClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFGPTJForSequenceClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFGPTJForSequenceClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFGPTJForSequenceClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFGPTJForSequenceClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFGPTJForSequenceClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFGPTJForSequenceClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFGPTJForSequenceClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used
in eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFGPTJForSequenceClassification.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFGPTJForSequenceClassification.call.labels",description:`<strong>labels</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_tf_gptj.py#L817",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/model_doc/gpt2#transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>List[tf.Tensor]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 List of <code>tf.Tensor</code> of length <code>config.n_layers</code>, with each tensor of shape <code>(2, batch_size, num_heads, sequence_length, embed_size_per_head)</code>).</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/model_doc/gpt2#transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Yo=new Ve({props:{$$slots:{default:[_T]},$$scope:{ctx:E}}}),Ko=new ft({props:{anchor:"transformers.TFGPTJForSequenceClassification.call.example",$$slots:{default:[TT]},$$scope:{ctx:E}}}),en=new ft({props:{anchor:"transformers.TFGPTJForSequenceClassification.call.example-2",$$slots:{default:[yT]},$$scope:{ctx:E}}}),Cs=new lt({}),Us=new Te({props:{name:"class transformers.TFGPTJForQuestionAnswering",anchor:"transformers.TFGPTJForQuestionAnswering",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFGPTJForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_tf_gptj.py#L919"}}),on=new Ve({props:{$$slots:{default:[bT]},$$scope:{ctx:E}}}),Ws=new Te({props:{name:"call",anchor:"transformers.TFGPTJForQuestionAnswering.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"past_key_values",val:": Optional[Tuple[Tuple[Union[np.ndarray, tf.Tensor]]]] = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"start_positions",val:": np.ndarray | tf.Tensor | None = None"},{name:"end_positions",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFGPTJForQuestionAnswering.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past</code> is <code>None</code> else <code>past[0].shape[-2]</code> (<code>sequence_length</code> of
input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past</code> is used, only input IDs that do not have their past calculated should be passed as <code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFGPTJForQuestionAnswering.call.past_key_values",description:`<strong>past_key_values</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past</code> output below). Can be used to speed up sequential decoding. The token ids which have their past
given to this model should not be passed as input ids as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.TFGPTJForQuestionAnswering.call.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFGPTJForQuestionAnswering.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFGPTJForQuestionAnswering.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFGPTJForQuestionAnswering.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFGPTJForQuestionAnswering.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFGPTJForQuestionAnswering.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFGPTJForQuestionAnswering.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFGPTJForQuestionAnswering.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used
in eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFGPTJForQuestionAnswering.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFGPTJForQuestionAnswering.call.start_positions",description:`<strong>start_positions</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.TFGPTJForQuestionAnswering.call.end_positions",description:`<strong>end_positions</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_tf_gptj.py#L930",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput"
>transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>, returned when <code>start_positions</code> and <code>end_positions</code> are provided) \u2014 Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput"
>transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),nn=new Ve({props:{$$slots:{default:[vT]},$$scope:{ctx:E}}}),sn=new ft({props:{anchor:"transformers.TFGPTJForQuestionAnswering.call.example",$$slots:{default:[wT]},$$scope:{ctx:E}}}),an=new ft({props:{anchor:"transformers.TFGPTJForQuestionAnswering.call.example-2",$$slots:{default:[MT]},$$scope:{ctx:E}}}),Zs=new lt({}),As=new Te({props:{name:"class transformers.FlaxGPTJModel",anchor:"transformers.FlaxGPTJModel",parameters:[{name:"config",val:": GPTJConfig"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxGPTJModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxGPTJModel.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_flax_gptj.py#L616"}}),Qs=new Te({props:{name:"__call__",anchor:"transformers.FlaxGPTJModel.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"position_ids",val:" = None"},{name:"params",val:": dict = None"},{name:"past_key_values",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FlaxGPTJModel.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code>. Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__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.FlaxGPTJModel.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.FlaxGPTJModel.__call__.position_ids",description:`<strong>position_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.`,name:"position_ids"},{anchor:"transformers.FlaxGPTJModel.__call__.past_key_values",description:`<strong>past_key_values</strong> (<code>Dict[str, np.ndarray]</code>, <em>optional</em>, returned by <code>init_cache</code> or when passing previous <code>past_key_values</code>) &#x2014;
Dictionary of pre-computed hidden-states (key and values in the attention blocks) that can be used for fast
auto-regressive decoding. Pre-computed key and value hidden-states are of shape <em>[batch_size, max_length]</em>.`,name:"past_key_values"},{anchor:"transformers.FlaxGPTJModel.__call__.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.FlaxGPTJModel.__call__.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.FlaxGPTJModel.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_flax_gptj.py#L434",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput"
>transformers.modeling_flax_outputs.FlaxMaskedLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>logits</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>jnp.ndarray</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>jnp.ndarray</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput"
>transformers.modeling_flax_outputs.FlaxMaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ln=new Ve({props:{$$slots:{default:[kT]},$$scope:{ctx:E}}}),dn=new ft({props:{anchor:"transformers.FlaxGPTJModel.__call__.example",$$slots:{default:[JT]},$$scope:{ctx:E}}}),Ls=new lt({}),Hs=new Te({props:{name:"class transformers.FlaxGPTJForCausalLM",anchor:"transformers.FlaxGPTJForCausalLM",parameters:[{name:"config",val:": GPTJConfig"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxGPTJForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig">GPTJConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxGPTJForCausalLM.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_flax_gptj.py#L682"}}),na=new Te({props:{name:"__call__",anchor:"transformers.FlaxGPTJForCausalLM.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"position_ids",val:" = None"},{name:"params",val:": dict = None"},{name:"past_key_values",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FlaxGPTJForCausalLM.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code>. Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__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.FlaxGPTJForCausalLM.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.FlaxGPTJForCausalLM.__call__.position_ids",description:`<strong>position_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.`,name:"position_ids"},{anchor:"transformers.FlaxGPTJForCausalLM.__call__.past_key_values",description:`<strong>past_key_values</strong> (<code>Dict[str, np.ndarray]</code>, <em>optional</em>, returned by <code>init_cache</code> or when passing previous <code>past_key_values</code>) &#x2014;
Dictionary of pre-computed hidden-states (key and values in the attention blocks) that can be used for fast
auto-regressive decoding. Pre-computed key and value hidden-states are of shape <em>[batch_size, max_length]</em>.`,name:"past_key_values"},{anchor:"transformers.FlaxGPTJForCausalLM.__call__.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.FlaxGPTJForCausalLM.__call__.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.FlaxGPTJForCausalLM.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/gptj/modeling_flax_gptj.py#L434",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput"
>transformers.modeling_flax_outputs.FlaxMaskedLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJConfig"
>GPTJConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>logits</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>jnp.ndarray</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>jnp.ndarray</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput"
>transformers.modeling_flax_outputs.FlaxMaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),pn=new Ve({props:{$$slots:{default:[$T]},$$scope:{ctx:E}}}),hn=new ft({props:{anchor:"transformers.FlaxGPTJForCausalLM.__call__.example",$$slots:{default:[jT]},$$scope:{ctx:E}}}),{c(){d=a("meta"),y=p(),u=a("h1"),f=a("a"),T=a("span"),v(i.$$.fragment),c=p(),j=a("span"),I=n("GPT-J"),C=p(),x=a("h2"),N=a("a"),ne=a("span"),v(G.$$.fragment),$e=p(),L=a("span"),je=n("Overview"),ye=p(),B=a("p"),Ge=n("The GPT-J model was released in the "),re=a("a"),D=n("kingoflolz/mesh-transformer-jax"),Ee=n(` repository by Ben Wang and Aran Komatsuzaki. It is a GPT-2-like
causal language model trained on `),le=a("a"),Y=n("the Pile"),Fe=n(" dataset."),be=p(),S=a("p"),Pe=n("This model was contributed by "),ie=a("a"),de=n("Stella Biderman"),U=n("."),z=p(),ue=a("p"),K=n("Tips:"),ve=p(),me=a("ul"),V=a("li"),Ce=n("To load "),ce=a("a"),W=n("GPT-J"),Ue=n(` in float32 one would need at least 2x model size
RAM: 1x for initial weights and another 1x to load the checkpoint. So for GPT-J it would take at least 48GB
RAM to just load the model. To reduce the RAM usage there are a few options. The `),H=a("code"),xe=n("torch_dtype"),Ie=n(` argument can be
used to initialize the model in half-precision on a CUDA device only. There is also a fp16 branch which stores the fp16 weights,
which could be used to further minimize the RAM usage:`),O=p(),v(pe.$$.fragment),we=p(),q=a("ul"),fe=a("li"),Q=a("p"),ze=n(`The model should fit on 16GB GPU for inference. For training/fine-tuning it would take much more GPU RAM. Adam
optimizer for example makes four copies of the model: model, gradients, average and squared average of the gradients.
So it would need at least 4x model size GPU memory, even with mixed precision as gradient updates are in fp32. This
is not including the activations and data batches, which would again require some more GPU RAM. So one should explore
solutions such as DeepSpeed, to train/fine-tune the model. Another option is to use the original codebase to
train/fine-tune the model on TPU and then convert the model to Transformers format for inference. Instructions for
that could be found `),ee=a("a"),Z=n("here"),We=p(),A=a("li"),te=a("p"),Ze=n(`Although the embedding matrix has a size of 50400, only 50257 entries are used by the GPT-2 tokenizer. These extra
tokens are added for the sake of efficiency on TPUs. To avoid the mismatch between embedding matrix size and vocab
size, the tokenizer for `),b=a("a"),F=n("GPT-J"),et=n(` contains 143 extra tokens
`),se=a("code"),tt=n("<|extratoken_1|>... <|extratoken_143|>"),ot=n(", so the "),P=a("code"),nt=n("vocab_size"),st=n(" of tokenizer also becomes 50400."),Oe=p(),ge=a("h3"),Me=a("a"),R=a("span"),v(X.$$.fragment),at=p(),Re=a("span"),oe=n("Generation"),De=p(),ke=a("p"),Ae=n("The "),Be=a("a"),he=n("generate()"),rt=n(` method can be used to generate text using GPT-J
model.`),Bl=p(),v(vn.$$.fragment),Vl=p(),ha=a("p"),ed=n("\u2026or in float16 precision:"),Rl=p(),v(wn.$$.fragment),Sl=p(),Lt=a("h2"),wo=a("a"),ar=a("span"),v(Mn.$$.fragment),td=p(),rr=a("span"),od=n("Resources"),Xl=p(),ua=a("p"),nd=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with GPT-J. If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Ql=p(),v(kn.$$.fragment),Ll=p(),ae=a("ul"),Jn=a("li"),sd=n("Description of "),$n=a("a"),ad=n("GPT-J"),rd=n("."),ld=p(),jn=a("li"),id=n("A blog on how to "),Gn=a("a"),dd=n("Deploy GPT-J 6B for inference using Hugging Face Transformers and Amazon SageMaker"),cd=n("."),pd=p(),En=a("li"),hd=n("A blog on how to "),Fn=a("a"),ud=n("Accelerate GPT-J inference with DeepSpeed-Inference on GPUs"),md=n("."),fd=p(),Pn=a("li"),gd=n("A blog post introducing "),Cn=a("a"),_d=n("GPT-J-6B: 6B JAX-Based Transformer"),Td=n(". \u{1F30E}"),yd=p(),Un=a("li"),bd=n("A notebook for "),xn=a("a"),vd=n("GPT-J-6B Inference Demo"),wd=n(". \u{1F30E}"),Md=p(),In=a("li"),kd=n("Another notebook demonstrating "),zn=a("a"),Jd=n("Inference with GPT-J-6B"),$d=n("."),jd=p(),ma=a("li"),Wn=a("a"),Gd=n("Causal language modeling"),Ed=n(" chapter of the \u{1F917} Hugging Face Course."),Fd=p(),wt=a("li"),fa=a("a"),Pd=n("GPTJForCausalLM"),Cd=n(" is supported by this "),Zn=a("a"),Ud=n("causal language modeling example script"),xd=n(", "),An=a("a"),Id=n("text generation example script"),zd=n(", and "),Nn=a("a"),Wd=n("notebook"),Zd=n("."),Ad=p(),Wt=a("li"),ga=a("a"),Nd=n("TFGPTJForCausalLM"),qd=n(" is supported by this "),qn=a("a"),Bd=n("causal language modeling example script"),Vd=n(" and "),Bn=a("a"),Rd=n("notebook"),Sd=n("."),Xd=p(),Zt=a("li"),_a=a("a"),Qd=n("FlaxGPTJForCausalLM"),Ld=n(" is supported by this "),Vn=a("a"),Hd=n("causal language modeling example script"),Od=n(" and "),Rn=a("a"),Dd=n("notebook"),Yd=n("."),Hl=p(),Ta=a("p"),lr=a("strong"),Kd=n("Documentation resources"),Ol=p(),At=a("ul"),ir=a("li"),ya=a("a"),ec=n("Text classification task guide"),tc=p(),dr=a("li"),ba=a("a"),oc=n("Question answering task guide"),nc=p(),cr=a("li"),va=a("a"),sc=n("Causal language modeling task guide"),Dl=p(),Ht=a("h2"),Mo=a("a"),pr=a("span"),v(Sn.$$.fragment),ac=p(),hr=a("span"),rc=n("GPTJConfig"),Yl=p(),Ct=a("div"),v(Xn.$$.fragment),lc=p(),_t=a("p"),ic=n("This is the configuration class to store the configuration of a "),wa=a("a"),dc=n("GPTJModel"),cc=n(`. It is used to instantiate a GPT-J
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configuration to that of the GPT-J
`),Qn=a("a"),pc=n("EleutherAI/gpt-j-6B"),hc=n(` architecture. Configuration objects inherit from
`),Ma=a("a"),uc=n("PretrainedConfig"),mc=n(" and can be used to control the model outputs. Read the documentation from "),ka=a("a"),fc=n("PretrainedConfig"),gc=n(`
for more information.`),_c=p(),v(ko.$$.fragment),Kl=p(),Ot=a("h2"),Jo=a("a"),ur=a("span"),v(Ln.$$.fragment),Tc=p(),mr=a("span"),yc=n("GPTJModel"),ei=p(),Ut=a("div"),v(Hn.$$.fragment),bc=p(),On=a("p"),vc=n(`The bare GPT-J Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Dn=a("a"),wc=n("torch.nn.Module"),Mc=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),kc=p(),it=a("div"),v(Yn.$$.fragment),Jc=p(),Dt=a("p"),$c=n("The "),Ja=a("a"),jc=n("GPTJModel"),Gc=n(" forward method, overrides the "),fr=a("code"),Ec=n("__call__"),Fc=n(" special method."),Pc=p(),v($o.$$.fragment),Cc=p(),v(jo.$$.fragment),Uc=p(),v(Go.$$.fragment),ti=p(),Yt=a("h2"),Eo=a("a"),gr=a("span"),v(Kn.$$.fragment),xc=p(),_r=a("span"),Ic=n("GPTJForCausalLM"),oi=p(),Tt=a("div"),v(es.$$.fragment),zc=p(),Tr=a("p"),Wc=n("The GPT-J Model transformer with a language modeling head on top."),Zc=p(),ts=a("p"),Ac=n("This model is a PyTorch "),os=a("a"),Nc=n("torch.nn.Module"),qc=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Bc=p(),dt=a("div"),v(ns.$$.fragment),Vc=p(),Kt=a("p"),Rc=n("The "),$a=a("a"),Sc=n("GPTJForCausalLM"),Xc=n(" forward method, overrides the "),yr=a("code"),Qc=n("__call__"),Lc=n(" special method."),Hc=p(),v(Fo.$$.fragment),Oc=p(),v(Po.$$.fragment),Dc=p(),v(Co.$$.fragment),ni=p(),eo=a("h2"),Uo=a("a"),br=a("span"),v(ss.$$.fragment),Yc=p(),vr=a("span"),Kc=n("GPTJForSequenceClassification"),si=p(),Se=a("div"),v(as.$$.fragment),ep=p(),wr=a("p"),tp=n("The GPT-J Model transformer with a sequence classification head on top (linear layer)."),op=p(),ja=a("p"),Ga=a("a"),np=n("GPTJForSequenceClassification"),sp=n(` uses the last token in order to do the classification, as other causal models
(e.g. GPT, GPT-2, GPT-Neo) do.`),ap=p(),yt=a("p"),rp=n(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Mr=a("code"),lp=n("pad_token_id"),ip=n(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),kr=a("code"),dp=n("pad_token_id"),cp=n(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Jr=a("code"),pp=n("inputs_embeds"),hp=n(" are passed instead of "),$r=a("code"),up=n("input_ids"),mp=n(`, it does the same (take the last value in
each row of the batch).`),fp=p(),rs=a("p"),gp=n("This model is a PyTorch "),ls=a("a"),_p=n("torch.nn.Module"),Tp=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),yp=p(),Ye=a("div"),v(is.$$.fragment),bp=p(),to=a("p"),vp=n("The "),Ea=a("a"),wp=n("GPTJForSequenceClassification"),Mp=n(" forward method, overrides the "),jr=a("code"),kp=n("__call__"),Jp=n(" special method."),$p=p(),v(xo.$$.fragment),jp=p(),v(Io.$$.fragment),Gp=p(),v(zo.$$.fragment),Ep=p(),v(Wo.$$.fragment),ai=p(),oo=a("h2"),Zo=a("a"),Gr=a("span"),v(ds.$$.fragment),Fp=p(),Er=a("span"),Pp=n("GPTJForQuestionAnswering"),ri=p(),bt=a("div"),v(cs.$$.fragment),Cp=p(),no=a("p"),Up=n(`The GPT-J Model transformer with a span classification head on top for extractive question-answering tasks like
SQuAD (a linear layers on top of the hidden-states output to compute `),Fr=a("code"),xp=n("span start logits"),Ip=n(" and "),Pr=a("code"),zp=n("span end logits"),Wp=n(")."),Zp=p(),ps=a("p"),Ap=n("This model is a PyTorch "),hs=a("a"),Np=n("torch.nn.Module"),qp=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Bp=p(),ct=a("div"),v(us.$$.fragment),Vp=p(),so=a("p"),Rp=n("The "),Fa=a("a"),Sp=n("GPTJForQuestionAnswering"),Xp=n(" forward method, overrides the "),Cr=a("code"),Qp=n("__call__"),Lp=n(" special method."),Hp=p(),v(Ao.$$.fragment),Op=p(),v(No.$$.fragment),Dp=p(),v(qo.$$.fragment),li=p(),ao=a("h2"),Bo=a("a"),Ur=a("span"),v(ms.$$.fragment),Yp=p(),xr=a("span"),Kp=n("TFGPTJModel"),ii=p(),Xe=a("div"),v(fs.$$.fragment),eh=p(),Ir=a("p"),th=n("The bare GPT-J Model transformer outputting raw hidden-states without any specific head on top."),oh=p(),gs=a("p"),nh=n("This model inherits from "),Pa=a("a"),sh=n("TFPreTrainedModel"),ah=n(`. 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.)`),rh=p(),_s=a("p"),lh=n("This model is also a "),Ts=a("a"),ih=n("tf.keras.Model"),dh=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),ch=p(),v(Vo.$$.fragment),ph=p(),Mt=a("div"),v(ys.$$.fragment),hh=p(),ro=a("p"),uh=n("The "),Ca=a("a"),mh=n("TFGPTJModel"),fh=n(" forward method, overrides the "),zr=a("code"),gh=n("__call__"),_h=n(" special method."),Th=p(),v(Ro.$$.fragment),yh=p(),v(So.$$.fragment),di=p(),lo=a("h2"),Xo=a("a"),Wr=a("span"),v(bs.$$.fragment),bh=p(),Zr=a("span"),vh=n("TFGPTJForCausalLM"),ci=p(),Qe=a("div"),v(vs.$$.fragment),wh=p(),Ar=a("p"),Mh=n("The GPT-J Model transformer with a language modeling head on top."),kh=p(),ws=a("p"),Jh=n("This model inherits from "),Ua=a("a"),$h=n("TFPreTrainedModel"),jh=n(`. 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.)`),Gh=p(),Ms=a("p"),Eh=n("This model is also a "),ks=a("a"),Fh=n("tf.keras.Model"),Ph=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Ch=p(),v(Qo.$$.fragment),Uh=p(),kt=a("div"),v(Js.$$.fragment),xh=p(),io=a("p"),Ih=n("The "),xa=a("a"),zh=n("TFGPTJForCausalLM"),Wh=n(" forward method, overrides the "),Nr=a("code"),Zh=n("__call__"),Ah=n(" special method."),Nh=p(),v(Lo.$$.fragment),qh=p(),v(Ho.$$.fragment),pi=p(),co=a("h2"),Oo=a("a"),qr=a("span"),v($s.$$.fragment),Bh=p(),Br=a("span"),Vh=n("TFGPTJForSequenceClassification"),hi=p(),_e=a("div"),v(js.$$.fragment),Rh=p(),Vr=a("p"),Sh=n("The GPT-J Model transformer with a sequence classification head on top (linear layer)."),Xh=p(),Ia=a("p"),za=a("a"),Qh=n("GPTJForSequenceClassification"),Lh=n(` uses the last token in order to do the classification, as other causal models
(e.g. GPT, GPT-2, GPT-Neo) do.`),Hh=p(),vt=a("p"),Oh=n(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Rr=a("code"),Dh=n("pad_token_id"),Yh=n(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Sr=a("code"),Kh=n("pad_token_id"),eu=n(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Xr=a("code"),tu=n("inputs_embeds"),ou=n(" are passed instead of "),Qr=a("code"),nu=n("input_ids"),su=n(`, it does the same (take the last value in
each row of the batch).`),au=p(),Gs=a("p"),ru=n("This model inherits from "),Wa=a("a"),lu=n("TFPreTrainedModel"),iu=n(`. 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.)`),du=p(),Es=a("p"),cu=n("This model is also a "),Fs=a("a"),pu=n("tf.keras.Model"),hu=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),uu=p(),v(Do.$$.fragment),mu=p(),pt=a("div"),v(Ps.$$.fragment),fu=p(),po=a("p"),gu=n("The "),Za=a("a"),_u=n("TFGPTJForSequenceClassification"),Tu=n(" forward method, overrides the "),Lr=a("code"),yu=n("__call__"),bu=n(" special method."),vu=p(),v(Yo.$$.fragment),wu=p(),v(Ko.$$.fragment),Mu=p(),v(en.$$.fragment),ui=p(),ho=a("h2"),tn=a("a"),Hr=a("span"),v(Cs.$$.fragment),ku=p(),Or=a("span"),Ju=n("TFGPTJForQuestionAnswering"),mi=p(),Le=a("div"),v(Us.$$.fragment),$u=p(),uo=a("p"),ju=n(`The GPT-J Model transformer with a span classification head on top for extractive question-answering tasks like
SQuAD (a linear layers on top of the hidden-states output to compute `),Dr=a("code"),Gu=n("span start logits"),Eu=n(" and "),Yr=a("code"),Fu=n("span end logits"),Pu=n(")."),Cu=p(),xs=a("p"),Uu=n("This model inherits from "),Aa=a("a"),xu=n("TFPreTrainedModel"),Iu=n(`. 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.)`),zu=p(),Is=a("p"),Wu=n("This model is also a "),zs=a("a"),Zu=n("tf.keras.Model"),Au=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Nu=p(),v(on.$$.fragment),qu=p(),ht=a("div"),v(Ws.$$.fragment),Bu=p(),mo=a("p"),Vu=n("The "),Na=a("a"),Ru=n("TFGPTJForQuestionAnswering"),Su=n(" forward method, overrides the "),Kr=a("code"),Xu=n("__call__"),Qu=n(" special method."),Lu=p(),v(nn.$$.fragment),Hu=p(),v(sn.$$.fragment),Ou=p(),v(an.$$.fragment),fi=p(),fo=a("h2"),rn=a("a"),el=a("span"),v(Zs.$$.fragment),Du=p(),tl=a("span"),Yu=n("FlaxGPTJModel"),gi=p(),Ne=a("div"),v(As.$$.fragment),Ku=p(),ol=a("p"),em=n("The bare GPTJ Model transformer outputting raw hidden-states without any specific head on top."),tm=p(),Ns=a("p"),om=n("This model inherits from "),qa=a("a"),nm=n("FlaxPreTrainedModel"),sm=n(`. 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.)`),am=p(),qs=a("p"),rm=n(`This model is also a Flax Linen
`),Bs=a("a"),lm=n("flax.nn.Module"),im=n(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),dm=p(),nl=a("p"),cm=n("Finally, this model supports inherent JAX features such as:"),pm=p(),xt=a("ul"),sl=a("li"),Vs=a("a"),hm=n("Just-In-Time (JIT) compilation"),um=p(),al=a("li"),Rs=a("a"),mm=n("Automatic Differentiation"),fm=p(),rl=a("li"),Ss=a("a"),gm=n("Vectorization"),_m=p(),ll=a("li"),Xs=a("a"),Tm=n("Parallelization"),ym=p(),Jt=a("div"),v(Qs.$$.fragment),bm=p(),go=a("p"),vm=n("The "),il=a("code"),wm=n("FlaxGPTJPreTrainedModel"),Mm=n(" forward method, overrides the "),dl=a("code"),km=n("__call__"),Jm=n(" special method."),$m=p(),v(ln.$$.fragment),jm=p(),v(dn.$$.fragment),_i=p(),_o=a("h2"),cn=a("a"),cl=a("span"),v(Ls.$$.fragment),Gm=p(),pl=a("span"),Em=n("FlaxGPTJForCausalLM"),Ti=p(),qe=a("div"),v(Hs.$$.fragment),Fm=p(),hl=a("p"),Pm=n("The GPTJ Model transformer with a language modeling head on top."),Cm=p(),Os=a("p"),Um=n("This model inherits from "),Ba=a("a"),xm=n("FlaxPreTrainedModel"),Im=n(`. 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.)`),zm=p(),Ds=a("p"),Wm=n(`This model is also a Flax Linen
`),Ys=a("a"),Zm=n("flax.nn.Module"),Am=n(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Nm=p(),ul=a("p"),qm=n("Finally, this model supports inherent JAX features such as:"),Bm=p(),It=a("ul"),ml=a("li"),Ks=a("a"),Vm=n("Just-In-Time (JIT) compilation"),Rm=p(),fl=a("li"),ea=a("a"),Sm=n("Automatic Differentiation"),Xm=p(),gl=a("li"),ta=a("a"),Qm=n("Vectorization"),Lm=p(),_l=a("li"),oa=a("a"),Hm=n("Parallelization"),Om=p(),$t=a("div"),v(na.$$.fragment),Dm=p(),To=a("p"),Ym=n("The "),Tl=a("code"),Km=n("FlaxGPTJPreTrainedModel"),ef=n(" forward method, overrides the "),yl=a("code"),tf=n("__call__"),of=n(" special method."),nf=p(),v(pn.$$.fragment),sf=p(),v(hn.$$.fragment),this.h()},l(o){const _=Q_('[data-svelte="svelte-1phssyn"]',document.head);d=r(_,"META",{name:!0,content:!0}),_.forEach(t),y=h(o),u=r(o,"H1",{class:!0});var sa=l(u);f=r(sa,"A",{id:!0,class:!0,href:!0});var bl=l(f);T=r(bl,"SPAN",{});var vl=l(T);w(i.$$.fragment,vl),vl.forEach(t),bl.forEach(t),c=h(sa),j=r(sa,"SPAN",{});var wl=l(j);I=s(wl,"GPT-J"),wl.forEach(t),sa.forEach(t),C=h(o),x=r(o,"H2",{class:!0});var aa=l(x);N=r(aa,"A",{id:!0,class:!0,href:!0});var Ml=l(N);ne=r(Ml,"SPAN",{});var kl=l(ne);w(G.$$.fragment,kl),kl.forEach(t),Ml.forEach(t),$e=h(aa),L=r(aa,"SPAN",{});var Jl=l(L);je=s(Jl,"Overview"),Jl.forEach(t),aa.forEach(t),ye=h(o),B=r(o,"P",{});var yo=l(B);Ge=s(yo,"The GPT-J model was released in the "),re=r(yo,"A",{href:!0,rel:!0});var $l=l(re);D=s($l,"kingoflolz/mesh-transformer-jax"),$l.forEach(t),Ee=s(yo,` repository by Ben Wang and Aran Komatsuzaki. It is a GPT-2-like
causal language model trained on `),le=r(yo,"A",{href:!0,rel:!0});var jl=l(le);Y=s(jl,"the Pile"),jl.forEach(t),Fe=s(yo," dataset."),yo.forEach(t),be=h(o),S=r(o,"P",{});var ra=l(S);Pe=s(ra,"This model was contributed by "),ie=r(ra,"A",{href:!0,rel:!0});var Gl=l(ie);de=s(Gl,"Stella Biderman"),Gl.forEach(t),U=s(ra,"."),ra.forEach(t),z=h(o),ue=r(o,"P",{});var El=l(ue);K=s(El,"Tips:"),El.forEach(t),ve=h(o),me=r(o,"UL",{});var Fl=l(me);V=r(Fl,"LI",{});var bo=l(V);Ce=s(bo,"To load "),ce=r(bo,"A",{href:!0,rel:!0});var Pl=l(ce);W=s(Pl,"GPT-J"),Pl.forEach(t),Ue=s(bo,` in float32 one would need at least 2x model size
RAM: 1x for initial weights and another 1x to load the checkpoint. So for GPT-J it would take at least 48GB
RAM to just load the model. To reduce the RAM usage there are a few options. The `),H=r(bo,"CODE",{});var Cl=l(H);xe=s(Cl,"torch_dtype"),Cl.forEach(t),Ie=s(bo,` argument can be
used to initialize the model in half-precision on a CUDA device only. There is also a fp16 branch which stores the fp16 weights,
which could be used to further minimize the RAM usage:`),bo.forEach(t),Fl.forEach(t),O=h(o),w(pe.$$.fragment,o),we=h(o),q=r(o,"UL",{});var la=l(q);fe=r(la,"LI",{});var Ul=l(fe);Q=r(Ul,"P",{});var Va=l(Q);ze=s(Va,`The model should fit on 16GB GPU for inference. For training/fine-tuning it would take much more GPU RAM. Adam
optimizer for example makes four copies of the model: model, gradients, average and squared average of the gradients.
So it would need at least 4x model size GPU memory, even with mixed precision as gradient updates are in fp32. This
is not including the activations and data batches, which would again require some more GPU RAM. So one should explore
solutions such as DeepSpeed, to train/fine-tune the model. Another option is to use the original codebase to
train/fine-tune the model on TPU and then convert the model to Transformers format for inference. Instructions for
that could be found `),ee=r(Va,"A",{href:!0,rel:!0});var xl=l(ee);Z=s(xl,"here"),xl.forEach(t),Va.forEach(t),Ul.forEach(t),We=h(la),A=r(la,"LI",{});var Il=l(A);te=r(Il,"P",{});var zt=l(te);Ze=s(zt,`Although the embedding matrix has a size of 50400, only 50257 entries are used by the GPT-2 tokenizer. These extra
tokens are added for the sake of efficiency on TPUs. To avoid the mismatch between embedding matrix size and vocab
size, the tokenizer for `),b=r(zt,"A",{href:!0,rel:!0});var zl=l(b);F=s(zl,"GPT-J"),zl.forEach(t),et=s(zt,` contains 143 extra tokens
`),se=r(zt,"CODE",{});var Wl=l(se);tt=s(Wl,"<|extratoken_1|>... <|extratoken_143|>"),Wl.forEach(t),ot=s(zt,", so the "),P=r(zt,"CODE",{});var Zl=l(P);nt=s(Zl,"vocab_size"),Zl.forEach(t),st=s(zt," of tokenizer also becomes 50400."),zt.forEach(t),Il.forEach(t),la.forEach(t),Oe=h(o),ge=r(o,"H3",{class:!0});var ia=l(ge);Me=r(ia,"A",{id:!0,class:!0,href:!0});var Al=l(Me);R=r(Al,"SPAN",{});var Nl=l(R);w(X.$$.fragment,Nl),Nl.forEach(t),Al.forEach(t),at=h(ia),Re=r(ia,"SPAN",{});var ql=l(Re);oe=s(ql,"Generation"),ql.forEach(t),ia.forEach(t),De=h(o),ke=r(o,"P",{});var da=l(ke);Ae=s(da,"The "),Be=r(da,"A",{href:!0});var df=l(Be);he=s(df,"generate()"),df.forEach(t),rt=s(da,` method can be used to generate text using GPT-J
model.`),da.forEach(t),Bl=h(o),w(vn.$$.fragment,o),Vl=h(o),ha=r(o,"P",{});var cf=l(ha);ed=s(cf,"\u2026or in float16 precision:"),cf.forEach(t),Rl=h(o),w(wn.$$.fragment,o),Sl=h(o),Lt=r(o,"H2",{class:!0});var bi=l(Lt);wo=r(bi,"A",{id:!0,class:!0,href:!0});var pf=l(wo);ar=r(pf,"SPAN",{});var hf=l(ar);w(Mn.$$.fragment,hf),hf.forEach(t),pf.forEach(t),td=h(bi),rr=r(bi,"SPAN",{});var uf=l(rr);od=s(uf,"Resources"),uf.forEach(t),bi.forEach(t),Xl=h(o),ua=r(o,"P",{});var mf=l(ua);nd=s(mf,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with GPT-J. If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),mf.forEach(t),Ql=h(o),w(kn.$$.fragment,o),Ll=h(o),ae=r(o,"UL",{});var Je=l(ae);Jn=r(Je,"LI",{});var vi=l(Jn);sd=s(vi,"Description of "),$n=r(vi,"A",{href:!0,rel:!0});var ff=l($n);ad=s(ff,"GPT-J"),ff.forEach(t),rd=s(vi,"."),vi.forEach(t),ld=h(Je),jn=r(Je,"LI",{});var wi=l(jn);id=s(wi,"A blog on how to "),Gn=r(wi,"A",{href:!0,rel:!0});var gf=l(Gn);dd=s(gf,"Deploy GPT-J 6B for inference using Hugging Face Transformers and Amazon SageMaker"),gf.forEach(t),cd=s(wi,"."),wi.forEach(t),pd=h(Je),En=r(Je,"LI",{});var Mi=l(En);hd=s(Mi,"A blog on how to "),Fn=r(Mi,"A",{href:!0,rel:!0});var _f=l(Fn);ud=s(_f,"Accelerate GPT-J inference with DeepSpeed-Inference on GPUs"),_f.forEach(t),md=s(Mi,"."),Mi.forEach(t),fd=h(Je),Pn=r(Je,"LI",{});var ki=l(Pn);gd=s(ki,"A blog post introducing "),Cn=r(ki,"A",{href:!0,rel:!0});var Tf=l(Cn);_d=s(Tf,"GPT-J-6B: 6B JAX-Based Transformer"),Tf.forEach(t),Td=s(ki,". \u{1F30E}"),ki.forEach(t),yd=h(Je),Un=r(Je,"LI",{});var Ji=l(Un);bd=s(Ji,"A notebook for "),xn=r(Ji,"A",{href:!0,rel:!0});var yf=l(xn);vd=s(yf,"GPT-J-6B Inference Demo"),yf.forEach(t),wd=s(Ji,". \u{1F30E}"),Ji.forEach(t),Md=h(Je),In=r(Je,"LI",{});var $i=l(In);kd=s($i,"Another notebook demonstrating "),zn=r($i,"A",{href:!0,rel:!0});var bf=l(zn);Jd=s(bf,"Inference with GPT-J-6B"),bf.forEach(t),$d=s($i,"."),$i.forEach(t),jd=h(Je),ma=r(Je,"LI",{});var af=l(ma);Wn=r(af,"A",{href:!0,rel:!0});var vf=l(Wn);Gd=s(vf,"Causal language modeling"),vf.forEach(t),Ed=s(af," chapter of the \u{1F917} Hugging Face Course."),af.forEach(t),Fd=h(Je),wt=r(Je,"LI",{});var vo=l(wt);fa=r(vo,"A",{href:!0});var wf=l(fa);Pd=s(wf,"GPTJForCausalLM"),wf.forEach(t),Cd=s(vo," is supported by this "),Zn=r(vo,"A",{href:!0,rel:!0});var Mf=l(Zn);Ud=s(Mf,"causal language modeling example script"),Mf.forEach(t),xd=s(vo,", "),An=r(vo,"A",{href:!0,rel:!0});var kf=l(An);Id=s(kf,"text generation example script"),kf.forEach(t),zd=s(vo,", and "),Nn=r(vo,"A",{href:!0,rel:!0});var Jf=l(Nn);Wd=s(Jf,"notebook"),Jf.forEach(t),Zd=s(vo,"."),vo.forEach(t),Ad=h(Je),Wt=r(Je,"LI",{});var ca=l(Wt);ga=r(ca,"A",{href:!0});var $f=l(ga);Nd=s($f,"TFGPTJForCausalLM"),$f.forEach(t),qd=s(ca," is supported by this "),qn=r(ca,"A",{href:!0,rel:!0});var jf=l(qn);Bd=s(jf,"causal language modeling example script"),jf.forEach(t),Vd=s(ca," and "),Bn=r(ca,"A",{href:!0,rel:!0});var Gf=l(Bn);Rd=s(Gf,"notebook"),Gf.forEach(t),Sd=s(ca,"."),ca.forEach(t),Xd=h(Je),Zt=r(Je,"LI",{});var pa=l(Zt);_a=r(pa,"A",{href:!0});var Ef=l(_a);Qd=s(Ef,"FlaxGPTJForCausalLM"),Ef.forEach(t),Ld=s(pa," is supported by this "),Vn=r(pa,"A",{href:!0,rel:!0});var Ff=l(Vn);Hd=s(Ff,"causal language modeling example script"),Ff.forEach(t),Od=s(pa," and "),Rn=r(pa,"A",{href:!0,rel:!0});var Pf=l(Rn);Dd=s(Pf,"notebook"),Pf.forEach(t),Yd=s(pa,"."),pa.forEach(t),Je.forEach(t),Hl=h(o),Ta=r(o,"P",{});var Cf=l(Ta);lr=r(Cf,"STRONG",{});var Uf=l(lr);Kd=s(Uf,"Documentation resources"),Uf.forEach(t),Cf.forEach(t),Ol=h(o),At=r(o,"UL",{});var Ra=l(At);ir=r(Ra,"LI",{});var xf=l(ir);ya=r(xf,"A",{href:!0});var If=l(ya);ec=s(If,"Text classification task guide"),If.forEach(t),xf.forEach(t),tc=h(Ra),dr=r(Ra,"LI",{});var zf=l(dr);ba=r(zf,"A",{href:!0});var Wf=l(ba);oc=s(Wf,"Question answering task guide"),Wf.forEach(t),zf.forEach(t),nc=h(Ra),cr=r(Ra,"LI",{});var Zf=l(cr);va=r(Zf,"A",{href:!0});var Af=l(va);sc=s(Af,"Causal language modeling task guide"),Af.forEach(t),Zf.forEach(t),Ra.forEach(t),Dl=h(o),Ht=r(o,"H2",{class:!0});var ji=l(Ht);Mo=r(ji,"A",{id:!0,class:!0,href:!0});var Nf=l(Mo);pr=r(Nf,"SPAN",{});var qf=l(pr);w(Sn.$$.fragment,qf),qf.forEach(t),Nf.forEach(t),ac=h(ji),hr=r(ji,"SPAN",{});var Bf=l(hr);rc=s(Bf,"GPTJConfig"),Bf.forEach(t),ji.forEach(t),Yl=h(o),Ct=r(o,"DIV",{class:!0});var Sa=l(Ct);w(Xn.$$.fragment,Sa),lc=h(Sa),_t=r(Sa,"P",{});var Nt=l(_t);ic=s(Nt,"This is the configuration class to store the configuration of a "),wa=r(Nt,"A",{href:!0});var Vf=l(wa);dc=s(Vf,"GPTJModel"),Vf.forEach(t),cc=s(Nt,`. It is used to instantiate a GPT-J
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configuration to that of the GPT-J
`),Qn=r(Nt,"A",{href:!0,rel:!0});var Rf=l(Qn);pc=s(Rf,"EleutherAI/gpt-j-6B"),Rf.forEach(t),hc=s(Nt,` architecture. Configuration objects inherit from
`),Ma=r(Nt,"A",{href:!0});var Sf=l(Ma);uc=s(Sf,"PretrainedConfig"),Sf.forEach(t),mc=s(Nt," and can be used to control the model outputs. Read the documentation from "),ka=r(Nt,"A",{href:!0});var Xf=l(ka);fc=s(Xf,"PretrainedConfig"),Xf.forEach(t),gc=s(Nt,`
for more information.`),Nt.forEach(t),_c=h(Sa),w(ko.$$.fragment,Sa),Sa.forEach(t),Kl=h(o),Ot=r(o,"H2",{class:!0});var Gi=l(Ot);Jo=r(Gi,"A",{id:!0,class:!0,href:!0});var Qf=l(Jo);ur=r(Qf,"SPAN",{});var Lf=l(ur);w(Ln.$$.fragment,Lf),Lf.forEach(t),Qf.forEach(t),Tc=h(Gi),mr=r(Gi,"SPAN",{});var Hf=l(mr);yc=s(Hf,"GPTJModel"),Hf.forEach(t),Gi.forEach(t),ei=h(o),Ut=r(o,"DIV",{class:!0});var Xa=l(Ut);w(Hn.$$.fragment,Xa),bc=h(Xa),On=r(Xa,"P",{});var Ei=l(On);vc=s(Ei,`The bare GPT-J Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Dn=r(Ei,"A",{href:!0,rel:!0});var Of=l(Dn);wc=s(Of,"torch.nn.Module"),Of.forEach(t),Mc=s(Ei,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ei.forEach(t),kc=h(Xa),it=r(Xa,"DIV",{class:!0});var qt=l(it);w(Yn.$$.fragment,qt),Jc=h(qt),Dt=r(qt,"P",{});var Qa=l(Dt);$c=s(Qa,"The "),Ja=r(Qa,"A",{href:!0});var Df=l(Ja);jc=s(Df,"GPTJModel"),Df.forEach(t),Gc=s(Qa," forward method, overrides the "),fr=r(Qa,"CODE",{});var Yf=l(fr);Ec=s(Yf,"__call__"),Yf.forEach(t),Fc=s(Qa," special method."),Qa.forEach(t),Pc=h(qt),w($o.$$.fragment,qt),Cc=h(qt),w(jo.$$.fragment,qt),Uc=h(qt),w(Go.$$.fragment,qt),qt.forEach(t),Xa.forEach(t),ti=h(o),Yt=r(o,"H2",{class:!0});var Fi=l(Yt);Eo=r(Fi,"A",{id:!0,class:!0,href:!0});var Kf=l(Eo);gr=r(Kf,"SPAN",{});var eg=l(gr);w(Kn.$$.fragment,eg),eg.forEach(t),Kf.forEach(t),xc=h(Fi),_r=r(Fi,"SPAN",{});var tg=l(_r);Ic=s(tg,"GPTJForCausalLM"),tg.forEach(t),Fi.forEach(t),oi=h(o),Tt=r(o,"DIV",{class:!0});var un=l(Tt);w(es.$$.fragment,un),zc=h(un),Tr=r(un,"P",{});var og=l(Tr);Wc=s(og,"The GPT-J Model transformer with a language modeling head on top."),og.forEach(t),Zc=h(un),ts=r(un,"P",{});var Pi=l(ts);Ac=s(Pi,"This model is a PyTorch "),os=r(Pi,"A",{href:!0,rel:!0});var ng=l(os);Nc=s(ng,"torch.nn.Module"),ng.forEach(t),qc=s(Pi,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Pi.forEach(t),Bc=h(un),dt=r(un,"DIV",{class:!0});var Bt=l(dt);w(ns.$$.fragment,Bt),Vc=h(Bt),Kt=r(Bt,"P",{});var La=l(Kt);Rc=s(La,"The "),$a=r(La,"A",{href:!0});var sg=l($a);Sc=s(sg,"GPTJForCausalLM"),sg.forEach(t),Xc=s(La," forward method, overrides the "),yr=r(La,"CODE",{});var ag=l(yr);Qc=s(ag,"__call__"),ag.forEach(t),Lc=s(La," special method."),La.forEach(t),Hc=h(Bt),w(Fo.$$.fragment,Bt),Oc=h(Bt),w(Po.$$.fragment,Bt),Dc=h(Bt),w(Co.$$.fragment,Bt),Bt.forEach(t),un.forEach(t),ni=h(o),eo=r(o,"H2",{class:!0});var Ci=l(eo);Uo=r(Ci,"A",{id:!0,class:!0,href:!0});var rg=l(Uo);br=r(rg,"SPAN",{});var lg=l(br);w(ss.$$.fragment,lg),lg.forEach(t),rg.forEach(t),Yc=h(Ci),vr=r(Ci,"SPAN",{});var ig=l(vr);Kc=s(ig,"GPTJForSequenceClassification"),ig.forEach(t),Ci.forEach(t),si=h(o),Se=r(o,"DIV",{class:!0});var jt=l(Se);w(as.$$.fragment,jt),ep=h(jt),wr=r(jt,"P",{});var dg=l(wr);tp=s(dg,"The GPT-J Model transformer with a sequence classification head on top (linear layer)."),dg.forEach(t),op=h(jt),ja=r(jt,"P",{});var rf=l(ja);Ga=r(rf,"A",{href:!0});var cg=l(Ga);np=s(cg,"GPTJForSequenceClassification"),cg.forEach(t),sp=s(rf,` uses the last token in order to do the classification, as other causal models
(e.g. GPT, GPT-2, GPT-Neo) do.`),rf.forEach(t),ap=h(jt),yt=r(jt,"P",{});var Vt=l(yt);rp=s(Vt,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Mr=r(Vt,"CODE",{});var pg=l(Mr);lp=s(pg,"pad_token_id"),pg.forEach(t),ip=s(Vt,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),kr=r(Vt,"CODE",{});var hg=l(kr);dp=s(hg,"pad_token_id"),hg.forEach(t),cp=s(Vt,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Jr=r(Vt,"CODE",{});var ug=l(Jr);pp=s(ug,"inputs_embeds"),ug.forEach(t),hp=s(Vt," are passed instead of "),$r=r(Vt,"CODE",{});var mg=l($r);up=s(mg,"input_ids"),mg.forEach(t),mp=s(Vt,`, it does the same (take the last value in
each row of the batch).`),Vt.forEach(t),fp=h(jt),rs=r(jt,"P",{});var Ui=l(rs);gp=s(Ui,"This model is a PyTorch "),ls=r(Ui,"A",{href:!0,rel:!0});var fg=l(ls);_p=s(fg,"torch.nn.Module"),fg.forEach(t),Tp=s(Ui,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ui.forEach(t),yp=h(jt),Ye=r(jt,"DIV",{class:!0});var Gt=l(Ye);w(is.$$.fragment,Gt),bp=h(Gt),to=r(Gt,"P",{});var Ha=l(to);vp=s(Ha,"The "),Ea=r(Ha,"A",{href:!0});var gg=l(Ea);wp=s(gg,"GPTJForSequenceClassification"),gg.forEach(t),Mp=s(Ha," forward method, overrides the "),jr=r(Ha,"CODE",{});var _g=l(jr);kp=s(_g,"__call__"),_g.forEach(t),Jp=s(Ha," special method."),Ha.forEach(t),$p=h(Gt),w(xo.$$.fragment,Gt),jp=h(Gt),w(Io.$$.fragment,Gt),Gp=h(Gt),w(zo.$$.fragment,Gt),Ep=h(Gt),w(Wo.$$.fragment,Gt),Gt.forEach(t),jt.forEach(t),ai=h(o),oo=r(o,"H2",{class:!0});var xi=l(oo);Zo=r(xi,"A",{id:!0,class:!0,href:!0});var Tg=l(Zo);Gr=r(Tg,"SPAN",{});var yg=l(Gr);w(ds.$$.fragment,yg),yg.forEach(t),Tg.forEach(t),Fp=h(xi),Er=r(xi,"SPAN",{});var bg=l(Er);Pp=s(bg,"GPTJForQuestionAnswering"),bg.forEach(t),xi.forEach(t),ri=h(o),bt=r(o,"DIV",{class:!0});var mn=l(bt);w(cs.$$.fragment,mn),Cp=h(mn),no=r(mn,"P",{});var Oa=l(no);Up=s(Oa,`The GPT-J Model transformer with a span classification head on top for extractive question-answering tasks like
SQuAD (a linear layers on top of the hidden-states output to compute `),Fr=r(Oa,"CODE",{});var vg=l(Fr);xp=s(vg,"span start logits"),vg.forEach(t),Ip=s(Oa," and "),Pr=r(Oa,"CODE",{});var wg=l(Pr);zp=s(wg,"span end logits"),wg.forEach(t),Wp=s(Oa,")."),Oa.forEach(t),Zp=h(mn),ps=r(mn,"P",{});var Ii=l(ps);Ap=s(Ii,"This model is a PyTorch "),hs=r(Ii,"A",{href:!0,rel:!0});var Mg=l(hs);Np=s(Mg,"torch.nn.Module"),Mg.forEach(t),qp=s(Ii,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ii.forEach(t),Bp=h(mn),ct=r(mn,"DIV",{class:!0});var Rt=l(ct);w(us.$$.fragment,Rt),Vp=h(Rt),so=r(Rt,"P",{});var Da=l(so);Rp=s(Da,"The "),Fa=r(Da,"A",{href:!0});var kg=l(Fa);Sp=s(kg,"GPTJForQuestionAnswering"),kg.forEach(t),Xp=s(Da," forward method, overrides the "),Cr=r(Da,"CODE",{});var Jg=l(Cr);Qp=s(Jg,"__call__"),Jg.forEach(t),Lp=s(Da," special method."),Da.forEach(t),Hp=h(Rt),w(Ao.$$.fragment,Rt),Op=h(Rt),w(No.$$.fragment,Rt),Dp=h(Rt),w(qo.$$.fragment,Rt),Rt.forEach(t),mn.forEach(t),li=h(o),ao=r(o,"H2",{class:!0});var zi=l(ao);Bo=r(zi,"A",{id:!0,class:!0,href:!0});var $g=l(Bo);Ur=r($g,"SPAN",{});var jg=l(Ur);w(ms.$$.fragment,jg),jg.forEach(t),$g.forEach(t),Yp=h(zi),xr=r(zi,"SPAN",{});var Gg=l(xr);Kp=s(Gg,"TFGPTJModel"),Gg.forEach(t),zi.forEach(t),ii=h(o),Xe=r(o,"DIV",{class:!0});var Et=l(Xe);w(fs.$$.fragment,Et),eh=h(Et),Ir=r(Et,"P",{});var Eg=l(Ir);th=s(Eg,"The bare GPT-J Model transformer outputting raw hidden-states without any specific head on top."),Eg.forEach(t),oh=h(Et),gs=r(Et,"P",{});var Wi=l(gs);nh=s(Wi,"This model inherits from "),Pa=r(Wi,"A",{href:!0});var Fg=l(Pa);sh=s(Fg,"TFPreTrainedModel"),Fg.forEach(t),ah=s(Wi,`. 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.)`),Wi.forEach(t),rh=h(Et),_s=r(Et,"P",{});var Zi=l(_s);lh=s(Zi,"This model is also a "),Ts=r(Zi,"A",{href:!0,rel:!0});var Pg=l(Ts);ih=s(Pg,"tf.keras.Model"),Pg.forEach(t),dh=s(Zi,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Zi.forEach(t),ch=h(Et),w(Vo.$$.fragment,Et),ph=h(Et),Mt=r(Et,"DIV",{class:!0});var fn=l(Mt);w(ys.$$.fragment,fn),hh=h(fn),ro=r(fn,"P",{});var Ya=l(ro);uh=s(Ya,"The "),Ca=r(Ya,"A",{href:!0});var Cg=l(Ca);mh=s(Cg,"TFGPTJModel"),Cg.forEach(t),fh=s(Ya," forward method, overrides the "),zr=r(Ya,"CODE",{});var Ug=l(zr);gh=s(Ug,"__call__"),Ug.forEach(t),_h=s(Ya," special method."),Ya.forEach(t),Th=h(fn),w(Ro.$$.fragment,fn),yh=h(fn),w(So.$$.fragment,fn),fn.forEach(t),Et.forEach(t),di=h(o),lo=r(o,"H2",{class:!0});var Ai=l(lo);Xo=r(Ai,"A",{id:!0,class:!0,href:!0});var xg=l(Xo);Wr=r(xg,"SPAN",{});var Ig=l(Wr);w(bs.$$.fragment,Ig),Ig.forEach(t),xg.forEach(t),bh=h(Ai),Zr=r(Ai,"SPAN",{});var zg=l(Zr);vh=s(zg,"TFGPTJForCausalLM"),zg.forEach(t),Ai.forEach(t),ci=h(o),Qe=r(o,"DIV",{class:!0});var Ft=l(Qe);w(vs.$$.fragment,Ft),wh=h(Ft),Ar=r(Ft,"P",{});var Wg=l(Ar);Mh=s(Wg,"The GPT-J Model transformer with a language modeling head on top."),Wg.forEach(t),kh=h(Ft),ws=r(Ft,"P",{});var Ni=l(ws);Jh=s(Ni,"This model inherits from "),Ua=r(Ni,"A",{href:!0});var Zg=l(Ua);$h=s(Zg,"TFPreTrainedModel"),Zg.forEach(t),jh=s(Ni,`. 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.)`),Ni.forEach(t),Gh=h(Ft),Ms=r(Ft,"P",{});var qi=l(Ms);Eh=s(qi,"This model is also a "),ks=r(qi,"A",{href:!0,rel:!0});var Ag=l(ks);Fh=s(Ag,"tf.keras.Model"),Ag.forEach(t),Ph=s(qi,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),qi.forEach(t),Ch=h(Ft),w(Qo.$$.fragment,Ft),Uh=h(Ft),kt=r(Ft,"DIV",{class:!0});var gn=l(kt);w(Js.$$.fragment,gn),xh=h(gn),io=r(gn,"P",{});var Ka=l(io);Ih=s(Ka,"The "),xa=r(Ka,"A",{href:!0});var Ng=l(xa);zh=s(Ng,"TFGPTJForCausalLM"),Ng.forEach(t),Wh=s(Ka," forward method, overrides the "),Nr=r(Ka,"CODE",{});var qg=l(Nr);Zh=s(qg,"__call__"),qg.forEach(t),Ah=s(Ka," special method."),Ka.forEach(t),Nh=h(gn),w(Lo.$$.fragment,gn),qh=h(gn),w(Ho.$$.fragment,gn),gn.forEach(t),Ft.forEach(t),pi=h(o),co=r(o,"H2",{class:!0});var Bi=l(co);Oo=r(Bi,"A",{id:!0,class:!0,href:!0});var Bg=l(Oo);qr=r(Bg,"SPAN",{});var Vg=l(qr);w($s.$$.fragment,Vg),Vg.forEach(t),Bg.forEach(t),Bh=h(Bi),Br=r(Bi,"SPAN",{});var Rg=l(Br);Vh=s(Rg,"TFGPTJForSequenceClassification"),Rg.forEach(t),Bi.forEach(t),hi=h(o),_e=r(o,"DIV",{class:!0});var Ke=l(_e);w(js.$$.fragment,Ke),Rh=h(Ke),Vr=r(Ke,"P",{});var Sg=l(Vr);Sh=s(Sg,"The GPT-J Model transformer with a sequence classification head on top (linear layer)."),Sg.forEach(t),Xh=h(Ke),Ia=r(Ke,"P",{});var lf=l(Ia);za=r(lf,"A",{href:!0});var Xg=l(za);Qh=s(Xg,"GPTJForSequenceClassification"),Xg.forEach(t),Lh=s(lf,` uses the last token in order to do the classification, as other causal models
(e.g. GPT, GPT-2, GPT-Neo) do.`),lf.forEach(t),Hh=h(Ke),vt=r(Ke,"P",{});var St=l(vt);Oh=s(St,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Rr=r(St,"CODE",{});var Qg=l(Rr);Dh=s(Qg,"pad_token_id"),Qg.forEach(t),Yh=s(St,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Sr=r(St,"CODE",{});var Lg=l(Sr);Kh=s(Lg,"pad_token_id"),Lg.forEach(t),eu=s(St,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Xr=r(St,"CODE",{});var Hg=l(Xr);tu=s(Hg,"inputs_embeds"),Hg.forEach(t),ou=s(St," are passed instead of "),Qr=r(St,"CODE",{});var Og=l(Qr);nu=s(Og,"input_ids"),Og.forEach(t),su=s(St,`, it does the same (take the last value in
each row of the batch).`),St.forEach(t),au=h(Ke),Gs=r(Ke,"P",{});var Vi=l(Gs);ru=s(Vi,"This model inherits from "),Wa=r(Vi,"A",{href:!0});var Dg=l(Wa);lu=s(Dg,"TFPreTrainedModel"),Dg.forEach(t),iu=s(Vi,`. 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.)`),Vi.forEach(t),du=h(Ke),Es=r(Ke,"P",{});var Ri=l(Es);cu=s(Ri,"This model is also a "),Fs=r(Ri,"A",{href:!0,rel:!0});var Yg=l(Fs);pu=s(Yg,"tf.keras.Model"),Yg.forEach(t),hu=s(Ri,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Ri.forEach(t),uu=h(Ke),w(Do.$$.fragment,Ke),mu=h(Ke),pt=r(Ke,"DIV",{class:!0});var Xt=l(pt);w(Ps.$$.fragment,Xt),fu=h(Xt),po=r(Xt,"P",{});var er=l(po);gu=s(er,"The "),Za=r(er,"A",{href:!0});var Kg=l(Za);_u=s(Kg,"TFGPTJForSequenceClassification"),Kg.forEach(t),Tu=s(er," forward method, overrides the "),Lr=r(er,"CODE",{});var e_=l(Lr);yu=s(e_,"__call__"),e_.forEach(t),bu=s(er," special method."),er.forEach(t),vu=h(Xt),w(Yo.$$.fragment,Xt),wu=h(Xt),w(Ko.$$.fragment,Xt),Mu=h(Xt),w(en.$$.fragment,Xt),Xt.forEach(t),Ke.forEach(t),ui=h(o),ho=r(o,"H2",{class:!0});var Si=l(ho);tn=r(Si,"A",{id:!0,class:!0,href:!0});var t_=l(tn);Hr=r(t_,"SPAN",{});var o_=l(Hr);w(Cs.$$.fragment,o_),o_.forEach(t),t_.forEach(t),ku=h(Si),Or=r(Si,"SPAN",{});var n_=l(Or);Ju=s(n_,"TFGPTJForQuestionAnswering"),n_.forEach(t),Si.forEach(t),mi=h(o),Le=r(o,"DIV",{class:!0});var Pt=l(Le);w(Us.$$.fragment,Pt),$u=h(Pt),uo=r(Pt,"P",{});var tr=l(uo);ju=s(tr,`The GPT-J Model transformer with a span classification head on top for extractive question-answering tasks like
SQuAD (a linear layers on top of the hidden-states output to compute `),Dr=r(tr,"CODE",{});var s_=l(Dr);Gu=s(s_,"span start logits"),s_.forEach(t),Eu=s(tr," and "),Yr=r(tr,"CODE",{});var a_=l(Yr);Fu=s(a_,"span end logits"),a_.forEach(t),Pu=s(tr,")."),tr.forEach(t),Cu=h(Pt),xs=r(Pt,"P",{});var Xi=l(xs);Uu=s(Xi,"This model inherits from "),Aa=r(Xi,"A",{href:!0});var r_=l(Aa);xu=s(r_,"TFPreTrainedModel"),r_.forEach(t),Iu=s(Xi,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Xi.forEach(t),zu=h(Pt),Is=r(Pt,"P",{});var Qi=l(Is);Wu=s(Qi,"This model is also a "),zs=r(Qi,"A",{href:!0,rel:!0});var l_=l(zs);Zu=s(l_,"tf.keras.Model"),l_.forEach(t),Au=s(Qi,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Qi.forEach(t),Nu=h(Pt),w(on.$$.fragment,Pt),qu=h(Pt),ht=r(Pt,"DIV",{class:!0});var Qt=l(ht);w(Ws.$$.fragment,Qt),Bu=h(Qt),mo=r(Qt,"P",{});var or=l(mo);Vu=s(or,"The "),Na=r(or,"A",{href:!0});var i_=l(Na);Ru=s(i_,"TFGPTJForQuestionAnswering"),i_.forEach(t),Su=s(or," forward method, overrides the "),Kr=r(or,"CODE",{});var d_=l(Kr);Xu=s(d_,"__call__"),d_.forEach(t),Qu=s(or," special method."),or.forEach(t),Lu=h(Qt),w(nn.$$.fragment,Qt),Hu=h(Qt),w(sn.$$.fragment,Qt),Ou=h(Qt),w(an.$$.fragment,Qt),Qt.forEach(t),Pt.forEach(t),fi=h(o),fo=r(o,"H2",{class:!0});var Li=l(fo);rn=r(Li,"A",{id:!0,class:!0,href:!0});var c_=l(rn);el=r(c_,"SPAN",{});var p_=l(el);w(Zs.$$.fragment,p_),p_.forEach(t),c_.forEach(t),Du=h(Li),tl=r(Li,"SPAN",{});var h_=l(tl);Yu=s(h_,"FlaxGPTJModel"),h_.forEach(t),Li.forEach(t),gi=h(o),Ne=r(o,"DIV",{class:!0});var ut=l(Ne);w(As.$$.fragment,ut),Ku=h(ut),ol=r(ut,"P",{});var u_=l(ol);em=s(u_,"The bare GPTJ Model transformer outputting raw hidden-states without any specific head on top."),u_.forEach(t),tm=h(ut),Ns=r(ut,"P",{});var Hi=l(Ns);om=s(Hi,"This model inherits from "),qa=r(Hi,"A",{href:!0});var m_=l(qa);nm=s(m_,"FlaxPreTrainedModel"),m_.forEach(t),sm=s(Hi,`. 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.)`),Hi.forEach(t),am=h(ut),qs=r(ut,"P",{});var Oi=l(qs);rm=s(Oi,`This model is also a Flax Linen
`),Bs=r(Oi,"A",{href:!0,rel:!0});var f_=l(Bs);lm=s(f_,"flax.nn.Module"),f_.forEach(t),im=s(Oi,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Oi.forEach(t),dm=h(ut),nl=r(ut,"P",{});var g_=l(nl);cm=s(g_,"Finally, this model supports inherent JAX features such as:"),g_.forEach(t),pm=h(ut),xt=r(ut,"UL",{});var _n=l(xt);sl=r(_n,"LI",{});var __=l(sl);Vs=r(__,"A",{href:!0,rel:!0});var T_=l(Vs);hm=s(T_,"Just-In-Time (JIT) compilation"),T_.forEach(t),__.forEach(t),um=h(_n),al=r(_n,"LI",{});var y_=l(al);Rs=r(y_,"A",{href:!0,rel:!0});var b_=l(Rs);mm=s(b_,"Automatic Differentiation"),b_.forEach(t),y_.forEach(t),fm=h(_n),rl=r(_n,"LI",{});var v_=l(rl);Ss=r(v_,"A",{href:!0,rel:!0});var w_=l(Ss);gm=s(w_,"Vectorization"),w_.forEach(t),v_.forEach(t),_m=h(_n),ll=r(_n,"LI",{});var M_=l(ll);Xs=r(M_,"A",{href:!0,rel:!0});var k_=l(Xs);Tm=s(k_,"Parallelization"),k_.forEach(t),M_.forEach(t),_n.forEach(t),ym=h(ut),Jt=r(ut,"DIV",{class:!0});var Tn=l(Jt);w(Qs.$$.fragment,Tn),bm=h(Tn),go=r(Tn,"P",{});var nr=l(go);vm=s(nr,"The "),il=r(nr,"CODE",{});var J_=l(il);wm=s(J_,"FlaxGPTJPreTrainedModel"),J_.forEach(t),Mm=s(nr," forward method, overrides the "),dl=r(nr,"CODE",{});var $_=l(dl);km=s($_,"__call__"),$_.forEach(t),Jm=s(nr," special method."),nr.forEach(t),$m=h(Tn),w(ln.$$.fragment,Tn),jm=h(Tn),w(dn.$$.fragment,Tn),Tn.forEach(t),ut.forEach(t),_i=h(o),_o=r(o,"H2",{class:!0});var Di=l(_o);cn=r(Di,"A",{id:!0,class:!0,href:!0});var j_=l(cn);cl=r(j_,"SPAN",{});var G_=l(cl);w(Ls.$$.fragment,G_),G_.forEach(t),j_.forEach(t),Gm=h(Di),pl=r(Di,"SPAN",{});var E_=l(pl);Em=s(E_,"FlaxGPTJForCausalLM"),E_.forEach(t),Di.forEach(t),Ti=h(o),qe=r(o,"DIV",{class:!0});var mt=l(qe);w(Hs.$$.fragment,mt),Fm=h(mt),hl=r(mt,"P",{});var F_=l(hl);Pm=s(F_,"The GPTJ Model transformer with a language modeling head on top."),F_.forEach(t),Cm=h(mt),Os=r(mt,"P",{});var Yi=l(Os);Um=s(Yi,"This model inherits from "),Ba=r(Yi,"A",{href:!0});var P_=l(Ba);xm=s(P_,"FlaxPreTrainedModel"),P_.forEach(t),Im=s(Yi,`. 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.)`),Yi.forEach(t),zm=h(mt),Ds=r(mt,"P",{});var Ki=l(Ds);Wm=s(Ki,`This model is also a Flax Linen
`),Ys=r(Ki,"A",{href:!0,rel:!0});var C_=l(Ys);Zm=s(C_,"flax.nn.Module"),C_.forEach(t),Am=s(Ki,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Ki.forEach(t),Nm=h(mt),ul=r(mt,"P",{});var U_=l(ul);qm=s(U_,"Finally, this model supports inherent JAX features such as:"),U_.forEach(t),Bm=h(mt),It=r(mt,"UL",{});var yn=l(It);ml=r(yn,"LI",{});var x_=l(ml);Ks=r(x_,"A",{href:!0,rel:!0});var I_=l(Ks);Vm=s(I_,"Just-In-Time (JIT) compilation"),I_.forEach(t),x_.forEach(t),Rm=h(yn),fl=r(yn,"LI",{});var z_=l(fl);ea=r(z_,"A",{href:!0,rel:!0});var W_=l(ea);Sm=s(W_,"Automatic Differentiation"),W_.forEach(t),z_.forEach(t),Xm=h(yn),gl=r(yn,"LI",{});var Z_=l(gl);ta=r(Z_,"A",{href:!0,rel:!0});var A_=l(ta);Qm=s(A_,"Vectorization"),A_.forEach(t),Z_.forEach(t),Lm=h(yn),_l=r(yn,"LI",{});var N_=l(_l);oa=r(N_,"A",{href:!0,rel:!0});var q_=l(oa);Hm=s(q_,"Parallelization"),q_.forEach(t),N_.forEach(t),yn.forEach(t),Om=h(mt),$t=r(mt,"DIV",{class:!0});var bn=l($t);w(na.$$.fragment,bn),Dm=h(bn),To=r(bn,"P",{});var sr=l(To);Ym=s(sr,"The "),Tl=r(sr,"CODE",{});var B_=l(Tl);Km=s(B_,"FlaxGPTJPreTrainedModel"),B_.forEach(t),ef=s(sr," forward method, overrides the "),yl=r(sr,"CODE",{});var V_=l(yl);tf=s(V_,"__call__"),V_.forEach(t),of=s(sr," special method."),sr.forEach(t),nf=h(bn),w(pn.$$.fragment,bn),sf=h(bn),w(hn.$$.fragment,bn),bn.forEach(t),mt.forEach(t),this.h()},h(){m(d,"name","hf:doc:metadata"),m(d,"content",JSON.stringify(ET)),m(f,"id","gptj"),m(f,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(f,"href","#gptj"),m(u,"class","relative group"),m(N,"id","overview"),m(N,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(N,"href","#overview"),m(x,"class","relative group"),m(re,"href","https://github.com/kingoflolz/mesh-transformer-jax"),m(re,"rel","nofollow"),m(le,"href","https://pile.eleuther.ai/"),m(le,"rel","nofollow"),m(ie,"href","https://huggingface.co/stellaathena"),m(ie,"rel","nofollow"),m(ce,"href","https://huggingface.co/EleutherAI/gpt-j-6B"),m(ce,"rel","nofollow"),m(ee,"href","https://github.com/kingoflolz/mesh-transformer-jax/blob/master/howto_finetune.md"),m(ee,"rel","nofollow"),m(b,"href","https://huggingface.co/EleutherAI/gpt-j-6B"),m(b,"rel","nofollow"),m(Me,"id","generation"),m(Me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Me,"href","#generation"),m(ge,"class","relative group"),m(Be,"href","/docs/transformers/v4.31.0/en/main_classes/text_generation#transformers.GenerationMixin.generate"),m(wo,"id","resources"),m(wo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(wo,"href","#resources"),m(Lt,"class","relative group"),m($n,"href","https://huggingface.co/EleutherAI/gpt-j-6B"),m($n,"rel","nofollow"),m(Gn,"href","https://huggingface.co/blog/gptj-sagemaker"),m(Gn,"rel","nofollow"),m(Fn,"href","https://www.philschmid.de/gptj-deepspeed-inference"),m(Fn,"rel","nofollow"),m(Cn,"href","https://arankomatsuzaki.wordpress.com/2021/06/04/gpt-j/"),m(Cn,"rel","nofollow"),m(xn,"href","https://colab.research.google.com/github/kingoflolz/mesh-transformer-jax/blob/master/colab_demo.ipynb"),m(xn,"rel","nofollow"),m(zn,"href","https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/GPT-J-6B/Inference_with_GPT_J_6B.ipynb"),m(zn,"rel","nofollow"),m(Wn,"href","https://huggingface.co/course/en/chapter7/6?fw=pt#training-a-causal-language-model-from-scratch"),m(Wn,"rel","nofollow"),m(fa,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJForCausalLM"),m(Zn,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#gpt-2gpt-and-causal-language-modeling"),m(Zn,"rel","nofollow"),m(An,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-generation"),m(An,"rel","nofollow"),m(Nn,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb"),m(Nn,"rel","nofollow"),m(ga,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.TFGPTJForCausalLM"),m(qn,"href","https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_clmpy"),m(qn,"rel","nofollow"),m(Bn,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb"),m(Bn,"rel","nofollow"),m(_a,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.FlaxGPTJForCausalLM"),m(Vn,"href","https://github.com/huggingface/transformers/tree/main/examples/flax/language-modeling#causal-language-modeling"),m(Vn,"rel","nofollow"),m(Rn,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/causal_language_modeling_flax.ipynb"),m(Rn,"rel","nofollow"),m(ya,"href","../tasks/sequence_classification"),m(ba,"href","../tasks/question_answering"),m(va,"href","../tasks/language_modeling"),m(Mo,"id","transformers.GPTJConfig"),m(Mo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Mo,"href","#transformers.GPTJConfig"),m(Ht,"class","relative group"),m(wa,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJModel"),m(Qn,"href","https://huggingface.co/EleutherAI/gpt-j-6B"),m(Qn,"rel","nofollow"),m(Ma,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),m(ka,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),m(Ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Jo,"id","transformers.GPTJModel"),m(Jo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Jo,"href","#transformers.GPTJModel"),m(Ot,"class","relative group"),m(Dn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(Dn,"rel","nofollow"),m(Ja,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJModel"),m(it,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Eo,"id","transformers.GPTJForCausalLM"),m(Eo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Eo,"href","#transformers.GPTJForCausalLM"),m(Yt,"class","relative group"),m(os,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(os,"rel","nofollow"),m($a,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJForCausalLM"),m(dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Uo,"id","transformers.GPTJForSequenceClassification"),m(Uo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Uo,"href","#transformers.GPTJForSequenceClassification"),m(eo,"class","relative group"),m(Ga,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJForSequenceClassification"),m(ls,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(ls,"rel","nofollow"),m(Ea,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJForSequenceClassification"),m(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Zo,"id","transformers.GPTJForQuestionAnswering"),m(Zo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Zo,"href","#transformers.GPTJForQuestionAnswering"),m(oo,"class","relative group"),m(hs,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(hs,"rel","nofollow"),m(Fa,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJForQuestionAnswering"),m(ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(bt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Bo,"id","transformers.TFGPTJModel"),m(Bo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Bo,"href","#transformers.TFGPTJModel"),m(ao,"class","relative group"),m(Pa,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(Ts,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(Ts,"rel","nofollow"),m(Ca,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.TFGPTJModel"),m(Mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Xo,"id","transformers.TFGPTJForCausalLM"),m(Xo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Xo,"href","#transformers.TFGPTJForCausalLM"),m(lo,"class","relative group"),m(Ua,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(ks,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(ks,"rel","nofollow"),m(xa,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.TFGPTJForCausalLM"),m(kt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Oo,"id","transformers.TFGPTJForSequenceClassification"),m(Oo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Oo,"href","#transformers.TFGPTJForSequenceClassification"),m(co,"class","relative group"),m(za,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.GPTJForSequenceClassification"),m(Wa,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(Fs,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(Fs,"rel","nofollow"),m(Za,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.TFGPTJForSequenceClassification"),m(pt,"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,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(tn,"id","transformers.TFGPTJForQuestionAnswering"),m(tn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(tn,"href","#transformers.TFGPTJForQuestionAnswering"),m(ho,"class","relative group"),m(Aa,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(zs,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(zs,"rel","nofollow"),m(Na,"href","/docs/transformers/v4.31.0/en/model_doc/gptj#transformers.TFGPTJForQuestionAnswering"),m(ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(rn,"id","transformers.FlaxGPTJModel"),m(rn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(rn,"href","#transformers.FlaxGPTJModel"),m(fo,"class","relative group"),m(qa,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel"),m(Bs,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),m(Bs,"rel","nofollow"),m(Vs,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),m(Vs,"rel","nofollow"),m(Rs,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),m(Rs,"rel","nofollow"),m(Ss,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),m(Ss,"rel","nofollow"),m(Xs,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),m(Xs,"rel","nofollow"),m(Jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(cn,"id","transformers.FlaxGPTJForCausalLM"),m(cn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(cn,"href","#transformers.FlaxGPTJForCausalLM"),m(_o,"class","relative group"),m(Ba,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel"),m(Ys,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),m(Ys,"rel","nofollow"),m(Ks,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),m(Ks,"rel","nofollow"),m(ea,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),m(ea,"rel","nofollow"),m(ta,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),m(ta,"rel","nofollow"),m(oa,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),m(oa,"rel","nofollow"),m($t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,_){e(document.head,d),g(o,y,_),g(o,u,_),e(u,f),e(f,T),M(i,T,null),e(u,c),e(u,j),e(j,I),g(o,C,_),g(o,x,_),e(x,N),e(N,ne),M(G,ne,null),e(x,$e),e(x,L),e(L,je),g(o,ye,_),g(o,B,_),e(B,Ge),e(B,re),e(re,D),e(B,Ee),e(B,le),e(le,Y),e(B,Fe),g(o,be,_),g(o,S,_),e(S,Pe),e(S,ie),e(ie,de),e(S,U),g(o,z,_),g(o,ue,_),e(ue,K),g(o,ve,_),g(o,me,_),e(me,V),e(V,Ce),e(V,ce),e(ce,W),e(V,Ue),e(V,H),e(H,xe),e(V,Ie),g(o,O,_),M(pe,o,_),g(o,we,_),g(o,q,_),e(q,fe),e(fe,Q),e(Q,ze),e(Q,ee),e(ee,Z),e(q,We),e(q,A),e(A,te),e(te,Ze),e(te,b),e(b,F),e(te,et),e(te,se),e(se,tt),e(te,ot),e(te,P),e(P,nt),e(te,st),g(o,Oe,_),g(o,ge,_),e(ge,Me),e(Me,R),M(X,R,null),e(ge,at),e(ge,Re),e(Re,oe),g(o,De,_),g(o,ke,_),e(ke,Ae),e(ke,Be),e(Be,he),e(ke,rt),g(o,Bl,_),M(vn,o,_),g(o,Vl,_),g(o,ha,_),e(ha,ed),g(o,Rl,_),M(wn,o,_),g(o,Sl,_),g(o,Lt,_),e(Lt,wo),e(wo,ar),M(Mn,ar,null),e(Lt,td),e(Lt,rr),e(rr,od),g(o,Xl,_),g(o,ua,_),e(ua,nd),g(o,Ql,_),M(kn,o,_),g(o,Ll,_),g(o,ae,_),e(ae,Jn),e(Jn,sd),e(Jn,$n),e($n,ad),e(Jn,rd),e(ae,ld),e(ae,jn),e(jn,id),e(jn,Gn),e(Gn,dd),e(jn,cd),e(ae,pd),e(ae,En),e(En,hd),e(En,Fn),e(Fn,ud),e(En,md),e(ae,fd),e(ae,Pn),e(Pn,gd),e(Pn,Cn),e(Cn,_d),e(Pn,Td),e(ae,yd),e(ae,Un),e(Un,bd),e(Un,xn),e(xn,vd),e(Un,wd),e(ae,Md),e(ae,In),e(In,kd),e(In,zn),e(zn,Jd),e(In,$d),e(ae,jd),e(ae,ma),e(ma,Wn),e(Wn,Gd),e(ma,Ed),e(ae,Fd),e(ae,wt),e(wt,fa),e(fa,Pd),e(wt,Cd),e(wt,Zn),e(Zn,Ud),e(wt,xd),e(wt,An),e(An,Id),e(wt,zd),e(wt,Nn),e(Nn,Wd),e(wt,Zd),e(ae,Ad),e(ae,Wt),e(Wt,ga),e(ga,Nd),e(Wt,qd),e(Wt,qn),e(qn,Bd),e(Wt,Vd),e(Wt,Bn),e(Bn,Rd),e(Wt,Sd),e(ae,Xd),e(ae,Zt),e(Zt,_a),e(_a,Qd),e(Zt,Ld),e(Zt,Vn),e(Vn,Hd),e(Zt,Od),e(Zt,Rn),e(Rn,Dd),e(Zt,Yd),g(o,Hl,_),g(o,Ta,_),e(Ta,lr),e(lr,Kd),g(o,Ol,_),g(o,At,_),e(At,ir),e(ir,ya),e(ya,ec),e(At,tc),e(At,dr),e(dr,ba),e(ba,oc),e(At,nc),e(At,cr),e(cr,va),e(va,sc),g(o,Dl,_),g(o,Ht,_),e(Ht,Mo),e(Mo,pr),M(Sn,pr,null),e(Ht,ac),e(Ht,hr),e(hr,rc),g(o,Yl,_),g(o,Ct,_),M(Xn,Ct,null),e(Ct,lc),e(Ct,_t),e(_t,ic),e(_t,wa),e(wa,dc),e(_t,cc),e(_t,Qn),e(Qn,pc),e(_t,hc),e(_t,Ma),e(Ma,uc),e(_t,mc),e(_t,ka),e(ka,fc),e(_t,gc),e(Ct,_c),M(ko,Ct,null),g(o,Kl,_),g(o,Ot,_),e(Ot,Jo),e(Jo,ur),M(Ln,ur,null),e(Ot,Tc),e(Ot,mr),e(mr,yc),g(o,ei,_),g(o,Ut,_),M(Hn,Ut,null),e(Ut,bc),e(Ut,On),e(On,vc),e(On,Dn),e(Dn,wc),e(On,Mc),e(Ut,kc),e(Ut,it),M(Yn,it,null),e(it,Jc),e(it,Dt),e(Dt,$c),e(Dt,Ja),e(Ja,jc),e(Dt,Gc),e(Dt,fr),e(fr,Ec),e(Dt,Fc),e(it,Pc),M($o,it,null),e(it,Cc),M(jo,it,null),e(it,Uc),M(Go,it,null),g(o,ti,_),g(o,Yt,_),e(Yt,Eo),e(Eo,gr),M(Kn,gr,null),e(Yt,xc),e(Yt,_r),e(_r,Ic),g(o,oi,_),g(o,Tt,_),M(es,Tt,null),e(Tt,zc),e(Tt,Tr),e(Tr,Wc),e(Tt,Zc),e(Tt,ts),e(ts,Ac),e(ts,os),e(os,Nc),e(ts,qc),e(Tt,Bc),e(Tt,dt),M(ns,dt,null),e(dt,Vc),e(dt,Kt),e(Kt,Rc),e(Kt,$a),e($a,Sc),e(Kt,Xc),e(Kt,yr),e(yr,Qc),e(Kt,Lc),e(dt,Hc),M(Fo,dt,null),e(dt,Oc),M(Po,dt,null),e(dt,Dc),M(Co,dt,null),g(o,ni,_),g(o,eo,_),e(eo,Uo),e(Uo,br),M(ss,br,null),e(eo,Yc),e(eo,vr),e(vr,Kc),g(o,si,_),g(o,Se,_),M(as,Se,null),e(Se,ep),e(Se,wr),e(wr,tp),e(Se,op),e(Se,ja),e(ja,Ga),e(Ga,np),e(ja,sp),e(Se,ap),e(Se,yt),e(yt,rp),e(yt,Mr),e(Mr,lp),e(yt,ip),e(yt,kr),e(kr,dp),e(yt,cp),e(yt,Jr),e(Jr,pp),e(yt,hp),e(yt,$r),e($r,up),e(yt,mp),e(Se,fp),e(Se,rs),e(rs,gp),e(rs,ls),e(ls,_p),e(rs,Tp),e(Se,yp),e(Se,Ye),M(is,Ye,null),e(Ye,bp),e(Ye,to),e(to,vp),e(to,Ea),e(Ea,wp),e(to,Mp),e(to,jr),e(jr,kp),e(to,Jp),e(Ye,$p),M(xo,Ye,null),e(Ye,jp),M(Io,Ye,null),e(Ye,Gp),M(zo,Ye,null),e(Ye,Ep),M(Wo,Ye,null),g(o,ai,_),g(o,oo,_),e(oo,Zo),e(Zo,Gr),M(ds,Gr,null),e(oo,Fp),e(oo,Er),e(Er,Pp),g(o,ri,_),g(o,bt,_),M(cs,bt,null),e(bt,Cp),e(bt,no),e(no,Up),e(no,Fr),e(Fr,xp),e(no,Ip),e(no,Pr),e(Pr,zp),e(no,Wp),e(bt,Zp),e(bt,ps),e(ps,Ap),e(ps,hs),e(hs,Np),e(ps,qp),e(bt,Bp),e(bt,ct),M(us,ct,null),e(ct,Vp),e(ct,so),e(so,Rp),e(so,Fa),e(Fa,Sp),e(so,Xp),e(so,Cr),e(Cr,Qp),e(so,Lp),e(ct,Hp),M(Ao,ct,null),e(ct,Op),M(No,ct,null),e(ct,Dp),M(qo,ct,null),g(o,li,_),g(o,ao,_),e(ao,Bo),e(Bo,Ur),M(ms,Ur,null),e(ao,Yp),e(ao,xr),e(xr,Kp),g(o,ii,_),g(o,Xe,_),M(fs,Xe,null),e(Xe,eh),e(Xe,Ir),e(Ir,th),e(Xe,oh),e(Xe,gs),e(gs,nh),e(gs,Pa),e(Pa,sh),e(gs,ah),e(Xe,rh),e(Xe,_s),e(_s,lh),e(_s,Ts),e(Ts,ih),e(_s,dh),e(Xe,ch),M(Vo,Xe,null),e(Xe,ph),e(Xe,Mt),M(ys,Mt,null),e(Mt,hh),e(Mt,ro),e(ro,uh),e(ro,Ca),e(Ca,mh),e(ro,fh),e(ro,zr),e(zr,gh),e(ro,_h),e(Mt,Th),M(Ro,Mt,null),e(Mt,yh),M(So,Mt,null),g(o,di,_),g(o,lo,_),e(lo,Xo),e(Xo,Wr),M(bs,Wr,null),e(lo,bh),e(lo,Zr),e(Zr,vh),g(o,ci,_),g(o,Qe,_),M(vs,Qe,null),e(Qe,wh),e(Qe,Ar),e(Ar,Mh),e(Qe,kh),e(Qe,ws),e(ws,Jh),e(ws,Ua),e(Ua,$h),e(ws,jh),e(Qe,Gh),e(Qe,Ms),e(Ms,Eh),e(Ms,ks),e(ks,Fh),e(Ms,Ph),e(Qe,Ch),M(Qo,Qe,null),e(Qe,Uh),e(Qe,kt),M(Js,kt,null),e(kt,xh),e(kt,io),e(io,Ih),e(io,xa),e(xa,zh),e(io,Wh),e(io,Nr),e(Nr,Zh),e(io,Ah),e(kt,Nh),M(Lo,kt,null),e(kt,qh),M(Ho,kt,null),g(o,pi,_),g(o,co,_),e(co,Oo),e(Oo,qr),M($s,qr,null),e(co,Bh),e(co,Br),e(Br,Vh),g(o,hi,_),g(o,_e,_),M(js,_e,null),e(_e,Rh),e(_e,Vr),e(Vr,Sh),e(_e,Xh),e(_e,Ia),e(Ia,za),e(za,Qh),e(Ia,Lh),e(_e,Hh),e(_e,vt),e(vt,Oh),e(vt,Rr),e(Rr,Dh),e(vt,Yh),e(vt,Sr),e(Sr,Kh),e(vt,eu),e(vt,Xr),e(Xr,tu),e(vt,ou),e(vt,Qr),e(Qr,nu),e(vt,su),e(_e,au),e(_e,Gs),e(Gs,ru),e(Gs,Wa),e(Wa,lu),e(Gs,iu),e(_e,du),e(_e,Es),e(Es,cu),e(Es,Fs),e(Fs,pu),e(Es,hu),e(_e,uu),M(Do,_e,null),e(_e,mu),e(_e,pt),M(Ps,pt,null),e(pt,fu),e(pt,po),e(po,gu),e(po,Za),e(Za,_u),e(po,Tu),e(po,Lr),e(Lr,yu),e(po,bu),e(pt,vu),M(Yo,pt,null),e(pt,wu),M(Ko,pt,null),e(pt,Mu),M(en,pt,null),g(o,ui,_),g(o,ho,_),e(ho,tn),e(tn,Hr),M(Cs,Hr,null),e(ho,ku),e(ho,Or),e(Or,Ju),g(o,mi,_),g(o,Le,_),M(Us,Le,null),e(Le,$u),e(Le,uo),e(uo,ju),e(uo,Dr),e(Dr,Gu),e(uo,Eu),e(uo,Yr),e(Yr,Fu),e(uo,Pu),e(Le,Cu),e(Le,xs),e(xs,Uu),e(xs,Aa),e(Aa,xu),e(xs,Iu),e(Le,zu),e(Le,Is),e(Is,Wu),e(Is,zs),e(zs,Zu),e(Is,Au),e(Le,Nu),M(on,Le,null),e(Le,qu),e(Le,ht),M(Ws,ht,null),e(ht,Bu),e(ht,mo),e(mo,Vu),e(mo,Na),e(Na,Ru),e(mo,Su),e(mo,Kr),e(Kr,Xu),e(mo,Qu),e(ht,Lu),M(nn,ht,null),e(ht,Hu),M(sn,ht,null),e(ht,Ou),M(an,ht,null),g(o,fi,_),g(o,fo,_),e(fo,rn),e(rn,el),M(Zs,el,null),e(fo,Du),e(fo,tl),e(tl,Yu),g(o,gi,_),g(o,Ne,_),M(As,Ne,null),e(Ne,Ku),e(Ne,ol),e(ol,em),e(Ne,tm),e(Ne,Ns),e(Ns,om),e(Ns,qa),e(qa,nm),e(Ns,sm),e(Ne,am),e(Ne,qs),e(qs,rm),e(qs,Bs),e(Bs,lm),e(qs,im),e(Ne,dm),e(Ne,nl),e(nl,cm),e(Ne,pm),e(Ne,xt),e(xt,sl),e(sl,Vs),e(Vs,hm),e(xt,um),e(xt,al),e(al,Rs),e(Rs,mm),e(xt,fm),e(xt,rl),e(rl,Ss),e(Ss,gm),e(xt,_m),e(xt,ll),e(ll,Xs),e(Xs,Tm),e(Ne,ym),e(Ne,Jt),M(Qs,Jt,null),e(Jt,bm),e(Jt,go),e(go,vm),e(go,il),e(il,wm),e(go,Mm),e(go,dl),e(dl,km),e(go,Jm),e(Jt,$m),M(ln,Jt,null),e(Jt,jm),M(dn,Jt,null),g(o,_i,_),g(o,_o,_),e(_o,cn),e(cn,cl),M(Ls,cl,null),e(_o,Gm),e(_o,pl),e(pl,Em),g(o,Ti,_),g(o,qe,_),M(Hs,qe,null),e(qe,Fm),e(qe,hl),e(hl,Pm),e(qe,Cm),e(qe,Os),e(Os,Um),e(Os,Ba),e(Ba,xm),e(Os,Im),e(qe,zm),e(qe,Ds),e(Ds,Wm),e(Ds,Ys),e(Ys,Zm),e(Ds,Am),e(qe,Nm),e(qe,ul),e(ul,qm),e(qe,Bm),e(qe,It),e(It,ml),e(ml,Ks),e(Ks,Vm),e(It,Rm),e(It,fl),e(fl,ea),e(ea,Sm),e(It,Xm),e(It,gl),e(gl,ta),e(ta,Qm),e(It,Lm),e(It,_l),e(_l,oa),e(oa,Hm),e(qe,Om),e(qe,$t),M(na,$t,null),e($t,Dm),e($t,To),e(To,Ym),e(To,Tl),e(Tl,Km),e(To,ef),e(To,yl),e(yl,tf),e(To,of),e($t,nf),M(pn,$t,null),e($t,sf),M(hn,$t,null),yi=!0},p(o,[_]){const sa={};_&2&&(sa.$$scope={dirty:_,ctx:o}),ko.$set(sa);const bl={};_&2&&(bl.$$scope={dirty:_,ctx:o}),$o.$set(bl);const vl={};_&2&&(vl.$$scope={dirty:_,ctx:o}),jo.$set(vl);const wl={};_&2&&(wl.$$scope={dirty:_,ctx:o}),Go.$set(wl);const aa={};_&2&&(aa.$$scope={dirty:_,ctx:o}),Fo.$set(aa);const Ml={};_&2&&(Ml.$$scope={dirty:_,ctx:o}),Po.$set(Ml);const kl={};_&2&&(kl.$$scope={dirty:_,ctx:o}),Co.$set(kl);const Jl={};_&2&&(Jl.$$scope={dirty:_,ctx:o}),xo.$set(Jl);const yo={};_&2&&(yo.$$scope={dirty:_,ctx:o}),Io.$set(yo);const $l={};_&2&&($l.$$scope={dirty:_,ctx:o}),zo.$set($l);const jl={};_&2&&(jl.$$scope={dirty:_,ctx:o}),Wo.$set(jl);const ra={};_&2&&(ra.$$scope={dirty:_,ctx:o}),Ao.$set(ra);const Gl={};_&2&&(Gl.$$scope={dirty:_,ctx:o}),No.$set(Gl);const El={};_&2&&(El.$$scope={dirty:_,ctx:o}),qo.$set(El);const Fl={};_&2&&(Fl.$$scope={dirty:_,ctx:o}),Vo.$set(Fl);const bo={};_&2&&(bo.$$scope={dirty:_,ctx:o}),Ro.$set(bo);const Pl={};_&2&&(Pl.$$scope={dirty:_,ctx:o}),So.$set(Pl);const Cl={};_&2&&(Cl.$$scope={dirty:_,ctx:o}),Qo.$set(Cl);const la={};_&2&&(la.$$scope={dirty:_,ctx:o}),Lo.$set(la);const Ul={};_&2&&(Ul.$$scope={dirty:_,ctx:o}),Ho.$set(Ul);const Va={};_&2&&(Va.$$scope={dirty:_,ctx:o}),Do.$set(Va);const xl={};_&2&&(xl.$$scope={dirty:_,ctx:o}),Yo.$set(xl);const Il={};_&2&&(Il.$$scope={dirty:_,ctx:o}),Ko.$set(Il);const zt={};_&2&&(zt.$$scope={dirty:_,ctx:o}),en.$set(zt);const zl={};_&2&&(zl.$$scope={dirty:_,ctx:o}),on.$set(zl);const Wl={};_&2&&(Wl.$$scope={dirty:_,ctx:o}),nn.$set(Wl);const Zl={};_&2&&(Zl.$$scope={dirty:_,ctx:o}),sn.$set(Zl);const ia={};_&2&&(ia.$$scope={dirty:_,ctx:o}),an.$set(ia);const Al={};_&2&&(Al.$$scope={dirty:_,ctx:o}),ln.$set(Al);const Nl={};_&2&&(Nl.$$scope={dirty:_,ctx:o}),dn.$set(Nl);const ql={};_&2&&(ql.$$scope={dirty:_,ctx:o}),pn.$set(ql);const da={};_&2&&(da.$$scope={dirty:_,ctx:o}),hn.$set(da)},i(o){yi||(k(i.$$.fragment,o),k(G.$$.fragment,o),k(pe.$$.fragment,o),k(X.$$.fragment,o),k(vn.$$.fragment,o),k(wn.$$.fragment,o),k(Mn.$$.fragment,o),k(kn.$$.fragment,o),k(Sn.$$.fragment,o),k(Xn.$$.fragment,o),k(ko.$$.fragment,o),k(Ln.$$.fragment,o),k(Hn.$$.fragment,o),k(Yn.$$.fragment,o),k($o.$$.fragment,o),k(jo.$$.fragment,o),k(Go.$$.fragment,o),k(Kn.$$.fragment,o),k(es.$$.fragment,o),k(ns.$$.fragment,o),k(Fo.$$.fragment,o),k(Po.$$.fragment,o),k(Co.$$.fragment,o),k(ss.$$.fragment,o),k(as.$$.fragment,o),k(is.$$.fragment,o),k(xo.$$.fragment,o),k(Io.$$.fragment,o),k(zo.$$.fragment,o),k(Wo.$$.fragment,o),k(ds.$$.fragment,o),k(cs.$$.fragment,o),k(us.$$.fragment,o),k(Ao.$$.fragment,o),k(No.$$.fragment,o),k(qo.$$.fragment,o),k(ms.$$.fragment,o),k(fs.$$.fragment,o),k(Vo.$$.fragment,o),k(ys.$$.fragment,o),k(Ro.$$.fragment,o),k(So.$$.fragment,o),k(bs.$$.fragment,o),k(vs.$$.fragment,o),k(Qo.$$.fragment,o),k(Js.$$.fragment,o),k(Lo.$$.fragment,o),k(Ho.$$.fragment,o),k($s.$$.fragment,o),k(js.$$.fragment,o),k(Do.$$.fragment,o),k(Ps.$$.fragment,o),k(Yo.$$.fragment,o),k(Ko.$$.fragment,o),k(en.$$.fragment,o),k(Cs.$$.fragment,o),k(Us.$$.fragment,o),k(on.$$.fragment,o),k(Ws.$$.fragment,o),k(nn.$$.fragment,o),k(sn.$$.fragment,o),k(an.$$.fragment,o),k(Zs.$$.fragment,o),k(As.$$.fragment,o),k(Qs.$$.fragment,o),k(ln.$$.fragment,o),k(dn.$$.fragment,o),k(Ls.$$.fragment,o),k(Hs.$$.fragment,o),k(na.$$.fragment,o),k(pn.$$.fragment,o),k(hn.$$.fragment,o),yi=!0)},o(o){J(i.$$.fragment,o),J(G.$$.fragment,o),J(pe.$$.fragment,o),J(X.$$.fragment,o),J(vn.$$.fragment,o),J(wn.$$.fragment,o),J(Mn.$$.fragment,o),J(kn.$$.fragment,o),J(Sn.$$.fragment,o),J(Xn.$$.fragment,o),J(ko.$$.fragment,o),J(Ln.$$.fragment,o),J(Hn.$$.fragment,o),J(Yn.$$.fragment,o),J($o.$$.fragment,o),J(jo.$$.fragment,o),J(Go.$$.fragment,o),J(Kn.$$.fragment,o),J(es.$$.fragment,o),J(ns.$$.fragment,o),J(Fo.$$.fragment,o),J(Po.$$.fragment,o),J(Co.$$.fragment,o),J(ss.$$.fragment,o),J(as.$$.fragment,o),J(is.$$.fragment,o),J(xo.$$.fragment,o),J(Io.$$.fragment,o),J(zo.$$.fragment,o),J(Wo.$$.fragment,o),J(ds.$$.fragment,o),J(cs.$$.fragment,o),J(us.$$.fragment,o),J(Ao.$$.fragment,o),J(No.$$.fragment,o),J(qo.$$.fragment,o),J(ms.$$.fragment,o),J(fs.$$.fragment,o),J(Vo.$$.fragment,o),J(ys.$$.fragment,o),J(Ro.$$.fragment,o),J(So.$$.fragment,o),J(bs.$$.fragment,o),J(vs.$$.fragment,o),J(Qo.$$.fragment,o),J(Js.$$.fragment,o),J(Lo.$$.fragment,o),J(Ho.$$.fragment,o),J($s.$$.fragment,o),J(js.$$.fragment,o),J(Do.$$.fragment,o),J(Ps.$$.fragment,o),J(Yo.$$.fragment,o),J(Ko.$$.fragment,o),J(en.$$.fragment,o),J(Cs.$$.fragment,o),J(Us.$$.fragment,o),J(on.$$.fragment,o),J(Ws.$$.fragment,o),J(nn.$$.fragment,o),J(sn.$$.fragment,o),J(an.$$.fragment,o),J(Zs.$$.fragment,o),J(As.$$.fragment,o),J(Qs.$$.fragment,o),J(ln.$$.fragment,o),J(dn.$$.fragment,o),J(Ls.$$.fragment,o),J(Hs.$$.fragment,o),J(na.$$.fragment,o),J(pn.$$.fragment,o),J(hn.$$.fragment,o),yi=!1},d(o){t(d),o&&t(y),o&&t(u),$(i),o&&t(C),o&&t(x),$(G),o&&t(ye),o&&t(B),o&&t(be),o&&t(S),o&&t(z),o&&t(ue),o&&t(ve),o&&t(me),o&&t(O),$(pe,o),o&&t(we),o&&t(q),o&&t(Oe),o&&t(ge),$(X),o&&t(De),o&&t(ke),o&&t(Bl),$(vn,o),o&&t(Vl),o&&t(ha),o&&t(Rl),$(wn,o),o&&t(Sl),o&&t(Lt),$(Mn),o&&t(Xl),o&&t(ua),o&&t(Ql),$(kn,o),o&&t(Ll),o&&t(ae),o&&t(Hl),o&&t(Ta),o&&t(Ol),o&&t(At),o&&t(Dl),o&&t(Ht),$(Sn),o&&t(Yl),o&&t(Ct),$(Xn),$(ko),o&&t(Kl),o&&t(Ot),$(Ln),o&&t(ei),o&&t(Ut),$(Hn),$(Yn),$($o),$(jo),$(Go),o&&t(ti),o&&t(Yt),$(Kn),o&&t(oi),o&&t(Tt),$(es),$(ns),$(Fo),$(Po),$(Co),o&&t(ni),o&&t(eo),$(ss),o&&t(si),o&&t(Se),$(as),$(is),$(xo),$(Io),$(zo),$(Wo),o&&t(ai),o&&t(oo),$(ds),o&&t(ri),o&&t(bt),$(cs),$(us),$(Ao),$(No),$(qo),o&&t(li),o&&t(ao),$(ms),o&&t(ii),o&&t(Xe),$(fs),$(Vo),$(ys),$(Ro),$(So),o&&t(di),o&&t(lo),$(bs),o&&t(ci),o&&t(Qe),$(vs),$(Qo),$(Js),$(Lo),$(Ho),o&&t(pi),o&&t(co),$($s),o&&t(hi),o&&t(_e),$(js),$(Do),$(Ps),$(Yo),$(Ko),$(en),o&&t(ui),o&&t(ho),$(Cs),o&&t(mi),o&&t(Le),$(Us),$(on),$(Ws),$(nn),$(sn),$(an),o&&t(fi),o&&t(fo),$(Zs),o&&t(gi),o&&t(Ne),$(As),$(Qs),$(ln),$(dn),o&&t(_i),o&&t(_o),$(Ls),o&&t(Ti),o&&t(qe),$(Hs),$(na),$(pn),$(hn)}}}const ET={local:"gptj",sections:[{local:"overview",sections:[{local:"generation",title:"Generation"}],title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.GPTJConfig",title:"GPTJConfig"},{local:"transformers.GPTJModel",title:"GPTJModel"},{local:"transformers.GPTJForCausalLM",title:"GPTJForCausalLM"},{local:"transformers.GPTJForSequenceClassification",title:"GPTJForSequenceClassification"},{local:"transformers.GPTJForQuestionAnswering",title:"GPTJForQuestionAnswering"},{local:"transformers.TFGPTJModel",title:"TFGPTJModel"},{local:"transformers.TFGPTJForCausalLM",title:"TFGPTJForCausalLM"},{local:"transformers.TFGPTJForSequenceClassification",title:"TFGPTJForSequenceClassification"},{local:"transformers.TFGPTJForQuestionAnswering",title:"TFGPTJForQuestionAnswering"},{local:"transformers.FlaxGPTJModel",title:"FlaxGPTJModel"},{local:"transformers.FlaxGPTJForCausalLM",title:"FlaxGPTJForCausalLM"}],title:"GPT-J"};function FT(E){return L_(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ZT extends R_{constructor(d){super();S_(this,d,FT,GT,X_,{})}}export{ZT as default,ET as metadata};
