import{S as U_,i as B_,s as Q_,e as a,k as p,w,t as n,M as H_,c as r,d as t,m as h,a as i,x as b,h as s,b as f,G as e,g,y as k,q as $,o as P,B as F,v as K_,L as gt}from"../../chunks/vendor-hf-doc-builder.js";import{T as We}from"../../chunks/Tip-hf-doc-builder.js";import{D as Te}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Re}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as it}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as mt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as R_}from"../../chunks/PipelineTag-hf-doc-builder.js";function V_(x){let d,y,u,m,T;return m=new Re({props:{code:`from transformers import GPTJModel, GPTJConfig

# Initializing a GPT-J 6B configuration
configuration = GPTJConfig()

# Initializing a model from the configuration
model = GPTJModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> 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(),w(m.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=s(c,"Example:"),c.forEach(t),u=h(l),b(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,u,c),k(m,l,c),T=!0},p:gt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(u),F(m,l)}}}function X_(x){let d,y,u,m,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"),m=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(l){d=r(l,"P",{});var c=i(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 E=i(u);m=s(E,"Module"),E.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(l,c){g(l,d,c),e(d,y),e(d,u),e(u,m),e(d,T)},d(l){l&&t(d)}}}function Y_(x){let d,y,u,m,T,l,c,E;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"),m=n('device_map="auto"'),T=n(" in the "),l=a("code"),c=n("from_pretrained"),E=n(" call.")},l(C){d=r(C,"P",{});var M=i(d);y=s(M,`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(M,"CODE",{});var A=i(u);m=s(A,'device_map="auto"'),A.forEach(t),T=s(M," in the "),l=r(M,"CODE",{});var N=i(l);c=s(N,"from_pretrained"),N.forEach(t),E=s(M," call."),M.forEach(t)},m(C,M){g(C,d,M),e(d,y),e(d,u),e(u,m),e(d,T),e(d,l),e(l,c),e(d,E)},d(C){C&&t(d)}}}function Z_(x){let d,y,u,m,T;return m=new Re({props:{code:`from transformers import AutoTokenizer, GPTJModel
import torch

tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-gptj")
model = GPTJModel.from_pretrained("hf-internal-testing/tiny-random-gptj")

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

last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, 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(),w(m.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=s(c,"Example:"),c.forEach(t),u=h(l),b(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,u,c),k(m,l,c),T=!0},p:gt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(u),F(m,l)}}}function eT(x){let d,y,u,m,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"),m=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(l){d=r(l,"P",{});var c=i(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 E=i(u);m=s(E,"Module"),E.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(l,c){g(l,d,c),e(d,y),e(d,u),e(u,m),e(d,T)},d(l){l&&t(d)}}}function tT(x){let d,y,u,m,T,l,c,E;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"),m=n('device_map="auto"'),T=n(" in the "),l=a("code"),c=n("from_pretrained"),E=n(" call.")},l(C){d=r(C,"P",{});var M=i(d);y=s(M,`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(M,"CODE",{});var A=i(u);m=s(A,'device_map="auto"'),A.forEach(t),T=s(M," in the "),l=r(M,"CODE",{});var N=i(l);c=s(N,"from_pretrained"),N.forEach(t),E=s(M," call."),M.forEach(t)},m(C,M){g(C,d,M),e(d,y),e(d,u),e(u,m),e(d,T),e(d,l),e(l,c),e(d,E)},d(C){C&&t(d)}}}function oT(x){let d,y,u,m,T;return m=new Re({props:{code:`import torch
from transformers import AutoTokenizer, GPTJForCausalLM

tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-gptj")
model = GPTJForCausalLM.from_pretrained("hf-internal-testing/tiny-random-gptj")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs, labels=inputs["input_ids"])
loss = outputs.loss
logits = outputs.logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, 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(),w(m.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=s(c,"Example:"),c.forEach(t),u=h(l),b(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,u,c),k(m,l,c),T=!0},p:gt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(u),F(m,l)}}}function nT(x){let d,y,u,m,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"),m=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(l){d=r(l,"P",{});var c=i(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 E=i(u);m=s(E,"Module"),E.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(l,c){g(l,d,c),e(d,y),e(d,u),e(u,m),e(d,T)},d(l){l&&t(d)}}}function sT(x){let d,y,u,m,T,l,c,E;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"),m=n('device_map="auto"'),T=n(" in the "),l=a("code"),c=n("from_pretrained"),E=n(" call.")},l(C){d=r(C,"P",{});var M=i(d);y=s(M,`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(M,"CODE",{});var A=i(u);m=s(A,'device_map="auto"'),A.forEach(t),T=s(M," in the "),l=r(M,"CODE",{});var N=i(l);c=s(N,"from_pretrained"),N.forEach(t),E=s(M," call."),M.forEach(t)},m(C,M){g(C,d,M),e(d,y),e(d,u),e(u,m),e(d,T),e(d,l),e(l,c),e(d,E)},d(C){C&&t(d)}}}function aT(x){let d,y,u,m,T;return m=new Re({props:{code:`import torch
from transformers import AutoTokenizer, GPTJForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("ydshieh/tiny-random-gptj-for-sequence-classification")
model = GPTJForSequenceClassification.from_pretrained("ydshieh/tiny-random-gptj-for-sequence-classification")

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

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

predicted_class_id = logits.argmax().item()

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = GPTJForSequenceClassification.from_pretrained("ydshieh/tiny-random-gptj-for-sequence-classification", num_labels=num_labels)

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

tokenizer = AutoTokenizer.from_pretrained("ydshieh/tiny-random-gptj-for-sequence-classification")
model = GPTJForSequenceClassification.from_pretrained("ydshieh/tiny-random-gptj-for-sequence-classification", problem_type="multi_label_classification")

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

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

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

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = GPTJForSequenceClassification.from_pretrained(
    "ydshieh/tiny-random-gptj-for-sequence-classification", num_labels=num_labels, problem_type="multi_label_classification"
)

labels = torch.sum(
    torch.nn.functional.one_hot(predicted_class_ids[None, :].clone(), num_classes=num_labels), dim=1
).to(torch.float)
loss = model(**inputs, labels=labels).loss`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, 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(),w(m.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=s(c,"Example of multi-label classification:"),c.forEach(t),u=h(l),b(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,u,c),k(m,l,c),T=!0},p:gt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(u),F(m,l)}}}function iT(x){let d,y,u,m,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"),m=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(l){d=r(l,"P",{});var c=i(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 E=i(u);m=s(E,"Module"),E.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(l,c){g(l,d,c),e(d,y),e(d,u),e(u,m),e(d,T)},d(l){l&&t(d)}}}function lT(x){let d,y,u,m,T,l,c,E;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"),m=n('device_map="auto"'),T=n(" in the "),l=a("code"),c=n("from_pretrained"),E=n(" call.")},l(C){d=r(C,"P",{});var M=i(d);y=s(M,`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(M,"CODE",{});var A=i(u);m=s(A,'device_map="auto"'),A.forEach(t),T=s(M," in the "),l=r(M,"CODE",{});var N=i(l);c=s(N,"from_pretrained"),N.forEach(t),E=s(M," call."),M.forEach(t)},m(C,M){g(C,d,M),e(d,y),e(d,u),e(u,m),e(d,T),e(d,l),e(l,c),e(d,E)},d(C){C&&t(d)}}}function dT(x){let d,y,u,m,T;return m=new Re({props:{code:`from transformers import AutoTokenizer, GPTJForQuestionAnswering
import torch

tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-gptj")
model = GPTJForQuestionAnswering.from_pretrained("hf-internal-testing/tiny-random-gptj")

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"

inputs = tokenizer(question, text, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)

answer_start_index = outputs.start_logits.argmax()
answer_end_index = outputs.end_logits.argmax()

predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]

# target is "nice puppet"
target_start_index = torch.tensor([14])
target_end_index = torch.tensor([15])

outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index)
loss = outputs.loss`,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(),w(m.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=s(c,"Example:"),c.forEach(t),u=h(l),b(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,u,c),k(m,l,c),T=!0},p:gt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(u),F(m,l)}}}function cT(x){let d,y,u,m,T,l,c,E,C,M,A,N,ne,j,Fe,K,Ee,ye,S,je,re,X,xe,ie,Y,Ge,ve,B,Je,le,de,q,z,ue,Z,we,fe,W,Me,ce,I,qe,R,Ae,Ce,V,pe,be,D,me,H,ze,ee,L,Ie,O,te,Le;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),u=a("code"),m=n("transformers"),T=n(" accept two formats as input:"),l=p(),c=a("ul"),E=a("li"),C=n("having all inputs as keyword arguments (like PyTorch models), or"),M=p(),A=a("li"),N=n("having all inputs as a list, tuple or dict in the first positional argument."),ne=p(),j=a("p"),Fe=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 `),K=a("code"),Ee=n("model.fit()"),ye=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a("code"),je=n("model.fit()"),re=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),X=a("code"),xe=n("fit()"),ie=n(" and "),Y=a("code"),Ge=n("predict()"),ve=n(`, such as when creating your own layers or models with
the Keras `),B=a("code"),Je=n("Functional"),le=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),de=p(),q=a("ul"),z=a("li"),ue=n("a single Tensor with "),Z=a("code"),we=n("input_ids"),fe=n(" only and nothing else: "),W=a("code"),Me=n("model(input_ids)"),ce=p(),I=a("li"),qe=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),R=a("code"),Ae=n("model([input_ids, attention_mask])"),Ce=n(" or "),V=a("code"),pe=n("model([input_ids, attention_mask, token_type_ids])"),be=p(),D=a("li"),me=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=a("code"),ze=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=p(),L=a("p"),Ie=n(`Note that when creating models and layers with
`),O=a("a"),te=n("subclassing"),Le=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(v){d=r(v,"P",{});var G=i(d);y=s(G,"TensorFlow models and layers in "),u=r(G,"CODE",{});var et=i(u);m=s(et,"transformers"),et.forEach(t),T=s(G," accept two formats as input:"),G.forEach(t),l=h(v),c=r(v,"UL",{});var se=i(c);E=r(se,"LI",{});var tt=i(E);C=s(tt,"having all inputs as keyword arguments (like PyTorch models), or"),tt.forEach(t),M=h(se),A=r(se,"LI",{});var ot=i(A);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(v),j=r(v,"P",{});var J=i(j);Fe=s(J,`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 `),K=r(J,"CODE",{});var nt=i(K);Ee=s(nt,"model.fit()"),nt.forEach(t),ye=s(J,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r(J,"CODE",{});var st=i(S);je=s(st,"model.fit()"),st.forEach(t),re=s(J,` supports! If, however, you want to use the second
format outside of Keras methods like `),X=r(J,"CODE",{});var Ve=i(X);xe=s(Ve,"fit()"),Ve.forEach(t),ie=s(J," and "),Y=r(J,"CODE",{});var ge=i(Y);Ge=s(ge,"predict()"),ge.forEach(t),ve=s(J,`, such as when creating your own layers or models with
the Keras `),B=r(J,"CODE",{});var ke=i(B);Je=s(ke,"Functional"),ke.forEach(t),le=s(J,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),J.forEach(t),de=h(v),q=r(v,"UL",{});var U=i(q);z=r(U,"LI",{});var Q=i(z);ue=s(Q,"a single Tensor with "),Z=r(Q,"CODE",{});var at=i(Z);we=s(at,"input_ids"),at.forEach(t),fe=s(Q," only and nothing else: "),W=r(Q,"CODE",{});var Ue=i(W);Me=s(Ue,"model(input_ids)"),Ue.forEach(t),Q.forEach(t),ce=h(U),I=r(U,"LI",{});var oe=i(I);qe=s(oe,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),R=r(oe,"CODE",{});var Xe=i(R);Ae=s(Xe,"model([input_ids, attention_mask])"),Xe.forEach(t),Ce=s(oe," or "),V=r(oe,"CODE",{});var $e=i(V);pe=s($e,"model([input_ids, attention_mask, token_type_ids])"),$e.forEach(t),oe.forEach(t),be=h(U),D=r(U,"LI",{});var Oe=i(D);me=s(Oe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=r(Oe,"CODE",{});var Se=i(H);ze=s(Se,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Se.forEach(t),Oe.forEach(t),U.forEach(t),ee=h(v),L=r(v,"P",{});var he=i(L);Ie=s(he,`Note that when creating models and layers with
`),O=r(he,"A",{href:!0,rel:!0});var rt=i(O);te=s(rt,"subclassing"),rt.forEach(t),Le=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(){f(O,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),f(O,"rel","nofollow")},m(v,G){g(v,d,G),e(d,y),e(d,u),e(u,m),e(d,T),g(v,l,G),g(v,c,G),e(c,E),e(E,C),e(c,M),e(c,A),e(A,N),g(v,ne,G),g(v,j,G),e(j,Fe),e(j,K),e(K,Ee),e(j,ye),e(j,S),e(S,je),e(j,re),e(j,X),e(X,xe),e(j,ie),e(j,Y),e(Y,Ge),e(j,ve),e(j,B),e(B,Je),e(j,le),g(v,de,G),g(v,q,G),e(q,z),e(z,ue),e(z,Z),e(Z,we),e(z,fe),e(z,W),e(W,Me),e(q,ce),e(q,I),e(I,qe),e(I,R),e(R,Ae),e(I,Ce),e(I,V),e(V,pe),e(q,be),e(q,D),e(D,me),e(D,H),e(H,ze),g(v,ee,G),g(v,L,G),e(L,Ie),e(L,O),e(O,te),e(L,Le)},d(v){v&&t(d),v&&t(l),v&&t(c),v&&t(ne),v&&t(j),v&&t(de),v&&t(q),v&&t(ee),v&&t(L)}}}function pT(x){let d,y,u,m,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"),m=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(l){d=r(l,"P",{});var c=i(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 E=i(u);m=s(E,"Module"),E.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(l,c){g(l,d,c),e(d,y),e(d,u),e(u,m),e(d,T)},d(l){l&&t(d)}}}function hT(x){let d,y,u,m,T;return m=new Re({props:{code:`from transformers import AutoTokenizer, TFGPTJModel
import tensorflow as tf

tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
model = TFGPTJModel.from_pretrained("EleutherAI/gpt-j-6B")

inputs = tokenizer("Hello, my dog is cute", return_tensors="tf")
outputs = model(inputs)

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

tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
model = TFGPTJForCausalLM.from_pretrained("EleutherAI/gpt-j-6B")

inputs = tokenizer("Hello, my dog is cute", return_tensors="tf")
outputs = model(inputs)
logits = outputs.logits`,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(),w(m.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=s(c,"Example:"),c.forEach(t),u=h(l),b(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,u,c),k(m,l,c),T=!0},p:gt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(u),F(m,l)}}}function gT(x){let d,y,u,m,T,l,c,E,C,M,A,N,ne,j,Fe,K,Ee,ye,S,je,re,X,xe,ie,Y,Ge,ve,B,Je,le,de,q,z,ue,Z,we,fe,W,Me,ce,I,qe,R,Ae,Ce,V,pe,be,D,me,H,ze,ee,L,Ie,O,te,Le;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),u=a("code"),m=n("transformers"),T=n(" accept two formats as input:"),l=p(),c=a("ul"),E=a("li"),C=n("having all inputs as keyword arguments (like PyTorch models), or"),M=p(),A=a("li"),N=n("having all inputs as a list, tuple or dict in the first positional argument."),ne=p(),j=a("p"),Fe=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 `),K=a("code"),Ee=n("model.fit()"),ye=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a("code"),je=n("model.fit()"),re=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),X=a("code"),xe=n("fit()"),ie=n(" and "),Y=a("code"),Ge=n("predict()"),ve=n(`, such as when creating your own layers or models with
the Keras `),B=a("code"),Je=n("Functional"),le=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),de=p(),q=a("ul"),z=a("li"),ue=n("a single Tensor with "),Z=a("code"),we=n("input_ids"),fe=n(" only and nothing else: "),W=a("code"),Me=n("model(input_ids)"),ce=p(),I=a("li"),qe=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),R=a("code"),Ae=n("model([input_ids, attention_mask])"),Ce=n(" or "),V=a("code"),pe=n("model([input_ids, attention_mask, token_type_ids])"),be=p(),D=a("li"),me=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=a("code"),ze=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=p(),L=a("p"),Ie=n(`Note that when creating models and layers with
`),O=a("a"),te=n("subclassing"),Le=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(v){d=r(v,"P",{});var G=i(d);y=s(G,"TensorFlow models and layers in "),u=r(G,"CODE",{});var et=i(u);m=s(et,"transformers"),et.forEach(t),T=s(G," accept two formats as input:"),G.forEach(t),l=h(v),c=r(v,"UL",{});var se=i(c);E=r(se,"LI",{});var tt=i(E);C=s(tt,"having all inputs as keyword arguments (like PyTorch models), or"),tt.forEach(t),M=h(se),A=r(se,"LI",{});var ot=i(A);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(v),j=r(v,"P",{});var J=i(j);Fe=s(J,`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 `),K=r(J,"CODE",{});var nt=i(K);Ee=s(nt,"model.fit()"),nt.forEach(t),ye=s(J,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r(J,"CODE",{});var st=i(S);je=s(st,"model.fit()"),st.forEach(t),re=s(J,` supports! If, however, you want to use the second
format outside of Keras methods like `),X=r(J,"CODE",{});var Ve=i(X);xe=s(Ve,"fit()"),Ve.forEach(t),ie=s(J," and "),Y=r(J,"CODE",{});var ge=i(Y);Ge=s(ge,"predict()"),ge.forEach(t),ve=s(J,`, such as when creating your own layers or models with
the Keras `),B=r(J,"CODE",{});var ke=i(B);Je=s(ke,"Functional"),ke.forEach(t),le=s(J,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),J.forEach(t),de=h(v),q=r(v,"UL",{});var U=i(q);z=r(U,"LI",{});var Q=i(z);ue=s(Q,"a single Tensor with "),Z=r(Q,"CODE",{});var at=i(Z);we=s(at,"input_ids"),at.forEach(t),fe=s(Q," only and nothing else: "),W=r(Q,"CODE",{});var Ue=i(W);Me=s(Ue,"model(input_ids)"),Ue.forEach(t),Q.forEach(t),ce=h(U),I=r(U,"LI",{});var oe=i(I);qe=s(oe,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),R=r(oe,"CODE",{});var Xe=i(R);Ae=s(Xe,"model([input_ids, attention_mask])"),Xe.forEach(t),Ce=s(oe," or "),V=r(oe,"CODE",{});var $e=i(V);pe=s($e,"model([input_ids, attention_mask, token_type_ids])"),$e.forEach(t),oe.forEach(t),be=h(U),D=r(U,"LI",{});var Oe=i(D);me=s(Oe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=r(Oe,"CODE",{});var Se=i(H);ze=s(Se,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Se.forEach(t),Oe.forEach(t),U.forEach(t),ee=h(v),L=r(v,"P",{});var he=i(L);Ie=s(he,`Note that when creating models and layers with
`),O=r(he,"A",{href:!0,rel:!0});var rt=i(O);te=s(rt,"subclassing"),rt.forEach(t),Le=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(){f(O,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),f(O,"rel","nofollow")},m(v,G){g(v,d,G),e(d,y),e(d,u),e(u,m),e(d,T),g(v,l,G),g(v,c,G),e(c,E),e(E,C),e(c,M),e(c,A),e(A,N),g(v,ne,G),g(v,j,G),e(j,Fe),e(j,K),e(K,Ee),e(j,ye),e(j,S),e(S,je),e(j,re),e(j,X),e(X,xe),e(j,ie),e(j,Y),e(Y,Ge),e(j,ve),e(j,B),e(B,Je),e(j,le),g(v,de,G),g(v,q,G),e(q,z),e(z,ue),e(z,Z),e(Z,we),e(z,fe),e(z,W),e(W,Me),e(q,ce),e(q,I),e(I,qe),e(I,R),e(R,Ae),e(I,Ce),e(I,V),e(V,pe),e(q,be),e(q,D),e(D,me),e(D,H),e(H,ze),g(v,ee,G),g(v,L,G),e(L,Ie),e(L,O),e(O,te),e(L,Le)},d(v){v&&t(d),v&&t(l),v&&t(c),v&&t(ne),v&&t(j),v&&t(de),v&&t(q),v&&t(ee),v&&t(L)}}}function _T(x){let d,y,u,m,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"),m=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(l){d=r(l,"P",{});var c=i(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 E=i(u);m=s(E,"Module"),E.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(l,c){g(l,d,c),e(d,y),e(d,u),e(u,m),e(d,T)},d(l){l&&t(d)}}}function TT(x){let d,y,u,m,T;return m=new Re({props:{code:`from transformers import AutoTokenizer, TFGPTJForSequenceClassification
import tensorflow as tf

tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
model = TFGPTJForSequenceClassification.from_pretrained("EleutherAI/gpt-j-6B")

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

logits = model(**inputs).logits

predicted_class_id = int(tf.math.argmax(logits, axis=-1)[0])`,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(),w(m.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=s(c,"Example:"),c.forEach(t),u=h(l),b(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,u,c),k(m,l,c),T=!0},p:gt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(u),F(m,l)}}}function yT(x){let d,y;return d=new Re({props:{code:'# To train a model on `num_labels` classes, you can pass `num_labels=num_labels` to `.from_pretrained(...)`\nnum_labels = len(model.config.id2label)\nmodel = TFGPTJForSequenceClassification.from_pretrained("EleutherAI/gpt-j-6B", num_labels=num_labels)\n\nlabels = tf.constant(1)\nloss = model(**inputs, labels=labels).loss',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(){w(d.$$.fragment)},l(u){b(d.$$.fragment,u)},m(u,m){k(d,u,m),y=!0},p:gt,i(u){y||($(d.$$.fragment,u),y=!0)},o(u){P(d.$$.fragment,u),y=!1},d(u){F(d,u)}}}function vT(x){let d,y,u,m,T,l,c,E,C,M,A,N,ne,j,Fe,K,Ee,ye,S,je,re,X,xe,ie,Y,Ge,ve,B,Je,le,de,q,z,ue,Z,we,fe,W,Me,ce,I,qe,R,Ae,Ce,V,pe,be,D,me,H,ze,ee,L,Ie,O,te,Le;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),u=a("code"),m=n("transformers"),T=n(" accept two formats as input:"),l=p(),c=a("ul"),E=a("li"),C=n("having all inputs as keyword arguments (like PyTorch models), or"),M=p(),A=a("li"),N=n("having all inputs as a list, tuple or dict in the first positional argument."),ne=p(),j=a("p"),Fe=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 `),K=a("code"),Ee=n("model.fit()"),ye=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a("code"),je=n("model.fit()"),re=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),X=a("code"),xe=n("fit()"),ie=n(" and "),Y=a("code"),Ge=n("predict()"),ve=n(`, such as when creating your own layers or models with
the Keras `),B=a("code"),Je=n("Functional"),le=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),de=p(),q=a("ul"),z=a("li"),ue=n("a single Tensor with "),Z=a("code"),we=n("input_ids"),fe=n(" only and nothing else: "),W=a("code"),Me=n("model(input_ids)"),ce=p(),I=a("li"),qe=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),R=a("code"),Ae=n("model([input_ids, attention_mask])"),Ce=n(" or "),V=a("code"),pe=n("model([input_ids, attention_mask, token_type_ids])"),be=p(),D=a("li"),me=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=a("code"),ze=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=p(),L=a("p"),Ie=n(`Note that when creating models and layers with
`),O=a("a"),te=n("subclassing"),Le=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(v){d=r(v,"P",{});var G=i(d);y=s(G,"TensorFlow models and layers in "),u=r(G,"CODE",{});var et=i(u);m=s(et,"transformers"),et.forEach(t),T=s(G," accept two formats as input:"),G.forEach(t),l=h(v),c=r(v,"UL",{});var se=i(c);E=r(se,"LI",{});var tt=i(E);C=s(tt,"having all inputs as keyword arguments (like PyTorch models), or"),tt.forEach(t),M=h(se),A=r(se,"LI",{});var ot=i(A);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(v),j=r(v,"P",{});var J=i(j);Fe=s(J,`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 `),K=r(J,"CODE",{});var nt=i(K);Ee=s(nt,"model.fit()"),nt.forEach(t),ye=s(J,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r(J,"CODE",{});var st=i(S);je=s(st,"model.fit()"),st.forEach(t),re=s(J,` supports! If, however, you want to use the second
format outside of Keras methods like `),X=r(J,"CODE",{});var Ve=i(X);xe=s(Ve,"fit()"),Ve.forEach(t),ie=s(J," and "),Y=r(J,"CODE",{});var ge=i(Y);Ge=s(ge,"predict()"),ge.forEach(t),ve=s(J,`, such as when creating your own layers or models with
the Keras `),B=r(J,"CODE",{});var ke=i(B);Je=s(ke,"Functional"),ke.forEach(t),le=s(J,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),J.forEach(t),de=h(v),q=r(v,"UL",{});var U=i(q);z=r(U,"LI",{});var Q=i(z);ue=s(Q,"a single Tensor with "),Z=r(Q,"CODE",{});var at=i(Z);we=s(at,"input_ids"),at.forEach(t),fe=s(Q," only and nothing else: "),W=r(Q,"CODE",{});var Ue=i(W);Me=s(Ue,"model(input_ids)"),Ue.forEach(t),Q.forEach(t),ce=h(U),I=r(U,"LI",{});var oe=i(I);qe=s(oe,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),R=r(oe,"CODE",{});var Xe=i(R);Ae=s(Xe,"model([input_ids, attention_mask])"),Xe.forEach(t),Ce=s(oe," or "),V=r(oe,"CODE",{});var $e=i(V);pe=s($e,"model([input_ids, attention_mask, token_type_ids])"),$e.forEach(t),oe.forEach(t),be=h(U),D=r(U,"LI",{});var Oe=i(D);me=s(Oe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=r(Oe,"CODE",{});var Se=i(H);ze=s(Se,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Se.forEach(t),Oe.forEach(t),U.forEach(t),ee=h(v),L=r(v,"P",{});var he=i(L);Ie=s(he,`Note that when creating models and layers with
`),O=r(he,"A",{href:!0,rel:!0});var rt=i(O);te=s(rt,"subclassing"),rt.forEach(t),Le=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(){f(O,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),f(O,"rel","nofollow")},m(v,G){g(v,d,G),e(d,y),e(d,u),e(u,m),e(d,T),g(v,l,G),g(v,c,G),e(c,E),e(E,C),e(c,M),e(c,A),e(A,N),g(v,ne,G),g(v,j,G),e(j,Fe),e(j,K),e(K,Ee),e(j,ye),e(j,S),e(S,je),e(j,re),e(j,X),e(X,xe),e(j,ie),e(j,Y),e(Y,Ge),e(j,ve),e(j,B),e(B,Je),e(j,le),g(v,de,G),g(v,q,G),e(q,z),e(z,ue),e(z,Z),e(Z,we),e(z,fe),e(z,W),e(W,Me),e(q,ce),e(q,I),e(I,qe),e(I,R),e(R,Ae),e(I,Ce),e(I,V),e(V,pe),e(q,be),e(q,D),e(D,me),e(D,H),e(H,ze),g(v,ee,G),g(v,L,G),e(L,Ie),e(L,O),e(O,te),e(L,Le)},d(v){v&&t(d),v&&t(l),v&&t(c),v&&t(ne),v&&t(j),v&&t(de),v&&t(q),v&&t(ee),v&&t(L)}}}function wT(x){let d,y,u,m,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"),m=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(l){d=r(l,"P",{});var c=i(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 E=i(u);m=s(E,"Module"),E.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(l,c){g(l,d,c),e(d,y),e(d,u),e(u,m),e(d,T)},d(l){l&&t(d)}}}function bT(x){let d,y,u,m,T;return m=new Re({props:{code:`from transformers import AutoTokenizer, TFGPTJForQuestionAnswering
import tensorflow as tf

tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
model = TFGPTJForQuestionAnswering.from_pretrained("EleutherAI/gpt-j-6B")

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"

inputs = tokenizer(question, text, return_tensors="tf")
outputs = model(**inputs)

answer_start_index = int(tf.math.argmax(outputs.start_logits, axis=-1)[0])
answer_end_index = int(tf.math.argmax(outputs.end_logits, axis=-1)[0])

predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]`,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(),w(m.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=s(c,"Example:"),c.forEach(t),u=h(l),b(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,u,c),k(m,l,c),T=!0},p:gt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(u),F(m,l)}}}function kT(x){let d,y;return d=new Re({props:{code:`# target is "nice puppet"
target_start_index = tf.constant([14])
target_end_index = tf.constant([15])

outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index)
loss = tf.math.reduce_mean(outputs.loss)`,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(){w(d.$$.fragment)},l(u){b(d.$$.fragment,u)},m(u,m){k(d,u,m),y=!0},p:gt,i(u){y||($(d.$$.fragment,u),y=!0)},o(u){P(d.$$.fragment,u),y=!1},d(u){F(d,u)}}}function $T(x){let d,y,u,m,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"),m=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(l){d=r(l,"P",{});var c=i(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 E=i(u);m=s(E,"Module"),E.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(l,c){g(l,d,c),e(d,y),e(d,u),e(u,m),e(d,T)},d(l){l&&t(d)}}}function PT(x){let d,y,u,m,T;return m=new Re({props:{code:`from transformers import AutoTokenizer, FlaxGPTJModel

tokenizer = AutoTokenizer.from_pretrained("gptj")
model = FlaxGPTJModel.from_pretrained("gptj")

inputs = tokenizer("Hello, my dog is cute", return_tensors="jax")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, 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(),w(m.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=s(c,"Example:"),c.forEach(t),u=h(l),b(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,u,c),k(m,l,c),T=!0},p:gt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(u),F(m,l)}}}function FT(x){let d,y,u,m,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"),m=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(l){d=r(l,"P",{});var c=i(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 E=i(u);m=s(E,"Module"),E.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(l,c){g(l,d,c),e(d,y),e(d,u),e(u,m),e(d,T)},d(l){l&&t(d)}}}function ET(x){let d,y,u,m,T;return m=new Re({props:{code:`from transformers import AutoTokenizer, FlaxGPTJForCausalLM

tokenizer = AutoTokenizer.from_pretrained("gptj")
model = FlaxGPTJForCausalLM.from_pretrained("gptj")

inputs = tokenizer("Hello, my dog is cute", return_tensors="np")
outputs = model(**inputs)

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

device = "cuda"
model = GPTJForCausalLM.from_pretrained(
    "EleutherAI/gpt-j-6B",
    revision="float16",
    torch_dtype=torch.float16,
).to(device)`,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)`}}),Q=new it({}),wn=new Re({props:{code:`from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-j-6B")
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")

prompt = (
    "In a shocking finding, scientists discovered a herd of unicorns living in a remote, "
    "previously unexplored valley, in the Andes Mountains. Even more surprising to the "
    "researchers was the fact that the unicorns spoke perfect English."
)

input_ids = tokenizer(prompt, return_tensors="pt").input_ids

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

device = "cuda"
model = GPTJForCausalLM.from_pretrained("EleutherAI/gpt-j-6B", torch_dtype=torch.float16).to(device)
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")

prompt = (
    "In a shocking finding, scientists discovered a herd of unicorns living in a remote, "
    "previously unexplored valley, in the Andes Mountains. Even more surprising to the "
    "researchers was the fact that the unicorns spoke perfect English."
)

input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)

gen_tokens = model.generate(
    input_ids,
    do_sample=True,
    temperature=0.9,
    max_length=100,
)
gen_text = tokenizer.batch_decode(gen_tokens)[0]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> 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>]`}}),kn=new it({}),$n=new R_({props:{pipeline:"text-generation"}}),Bn=new it({}),Qn=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.29.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.29.0/src/transformers/models/gptj/configuration_gptj.py#L33"}}),$o=new mt({props:{anchor:"transformers.GPTJConfig.example",$$slots:{default:[V_]},$$scope:{ctx:x}}}),Kn=new it({}),Rn=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.29.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.29.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.29.0/src/transformers/models/gptj/modeling_gptj.py#L481"}}),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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/gptj/modeling_gptj.py#L548",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Fo=new We({props:{$$slots:{default:[X_]},$$scope:{ctx:x}}}),Eo=new We({props:{warning:!0,$$slots:{default:[Y_]},$$scope:{ctx:x}}}),jo=new mt({props:{anchor:"transformers.GPTJModel.forward.example",$$slots:{default:[Z_]},$$scope:{ctx:x}}}),Zn=new it({}),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.29.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.29.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.29.0/src/transformers/models/gptj/modeling_gptj.py#L735"}}),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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/gptj/modeling_gptj.py#L823",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Go=new We({props:{$$slots:{default:[eT]},$$scope:{ctx:x}}}),Jo=new We({props:{warning:!0,$$slots:{default:[tT]},$$scope:{ctx:x}}}),Mo=new mt({props:{anchor:"transformers.GPTJForCausalLM.forward.example",$$slots:{default:[oT]},$$scope:{ctx:x}}}),ss=new it({}),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.29.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.29.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.29.0/src/transformers/models/gptj/modeling_gptj.py#L933"}}),ls=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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/gptj/modeling_gptj.py#L949",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.29.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>
`}}),Ao=new We({props:{$$slots:{default:[nT]},$$scope:{ctx:x}}}),Co=new We({props:{warning:!0,$$slots:{default:[sT]},$$scope:{ctx:x}}}),zo=new mt({props:{anchor:"transformers.GPTJForSequenceClassification.forward.example",$$slots:{default:[aT]},$$scope:{ctx:x}}}),Io=new mt({props:{anchor:"transformers.GPTJForSequenceClassification.forward.example-2",$$slots:{default:[rT]},$$scope:{ctx:x}}}),ds=new it({}),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.29.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.29.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.29.0/src/transformers/models/gptj/modeling_gptj.py#L1059"}}),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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/gptj/modeling_gptj.py#L1075",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Oo=new We({props:{$$slots:{default:[iT]},$$scope:{ctx:x}}}),No=new We({props:{warning:!0,$$slots:{default:[lT]},$$scope:{ctx:x}}}),Do=new mt({props:{anchor:"transformers.GPTJForQuestionAnswering.forward.example",$$slots:{default:[dT]},$$scope:{ctx:x}}}),fs=new it({}),ms=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.29.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.29.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.29.0/src/transformers/models/gptj/modeling_tf_gptj.py#L657"}}),Wo=new We({props:{$$slots:{default:[cT]},$$scope:{ctx:x}}}),ys=new Te({props:{name:"call",anchor:"transformers.TFGPTJModel.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor]]], NoneType] = None"},{name:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"training",val:": typing.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.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.29.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.29.0/src/transformers/models/gptj/modeling_tf_gptj.py#L662",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPast"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPast</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Uo=new We({props:{$$slots:{default:[pT]},$$scope:{ctx:x}}}),Bo=new mt({props:{anchor:"transformers.TFGPTJModel.call.example",$$slots:{default:[hT]},$$scope:{ctx:x}}}),vs=new it({}),ws=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.29.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.29.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.29.0/src/transformers/models/gptj/modeling_tf_gptj.py#L726"}}),Ho=new We({props:{$$slots:{default:[uT]},$$scope:{ctx:x}}}),Ps=new Te({props:{name:"call",anchor:"transformers.TFGPTJForCausalLM.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor]]], NoneType] = None"},{name:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"training",val:": typing.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.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.29.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.29.0/src/transformers/models/gptj/modeling_tf_gptj.py#L765",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutputWithPast"
>transformers.modeling_tf_outputs.TFCausalLMOutputWithPast</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Ko=new We({props:{$$slots:{default:[fT]},$$scope:{ctx:x}}}),Ro=new mt({props:{anchor:"transformers.TFGPTJForCausalLM.call.example",$$slots:{default:[mT]},$$scope:{ctx:x}}}),Fs=new it({}),Es=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.29.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.29.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.29.0/src/transformers/models/gptj/modeling_tf_gptj.py#L854"}}),Xo=new We({props:{$$slots:{default:[gT]},$$scope:{ctx:x}}}),Js=new Te({props:{name:"call",anchor:"transformers.TFGPTJForSequenceClassification.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor]]], NoneType] = None"},{name:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"training",val:": typing.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.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.29.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.29.0/src/transformers/models/gptj/modeling_tf_gptj.py#L868",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.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 We({props:{$$slots:{default:[_T]},$$scope:{ctx:x}}}),Zo=new mt({props:{anchor:"transformers.TFGPTJForSequenceClassification.call.example",$$slots:{default:[TT]},$$scope:{ctx:x}}}),en=new mt({props:{anchor:"transformers.TFGPTJForSequenceClassification.call.example-2",$$slots:{default:[yT]},$$scope:{ctx:x}}}),Ms=new it({}),qs=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.29.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.29.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.29.0/src/transformers/models/gptj/modeling_tf_gptj.py#L979"}}),on=new We({props:{$$slots:{default:[vT]},$$scope:{ctx:x}}}),Is=new Te({props:{name:"call",anchor:"transformers.TFGPTJForQuestionAnswering.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor]]], NoneType] = None"},{name:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"start_positions",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"end_positions",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"training",val:": typing.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.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.29.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.29.0/src/transformers/models/gptj/modeling_tf_gptj.py#L990",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.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 We({props:{$$slots:{default:[wT]},$$scope:{ctx:x}}}),sn=new mt({props:{anchor:"transformers.TFGPTJForQuestionAnswering.call.example",$$slots:{default:[bT]},$$scope:{ctx:x}}}),an=new mt({props:{anchor:"transformers.TFGPTJForQuestionAnswering.call.example-2",$$slots:{default:[kT]},$$scope:{ctx:x}}}),Ls=new it({}),Os=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.29.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.29.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.29.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/gptj/modeling_flax_gptj.py#L616"}}),Hs=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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/gptj/modeling_flax_gptj.py#L434",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.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 We({props:{$$slots:{default:[$T]},$$scope:{ctx:x}}}),dn=new mt({props:{anchor:"transformers.FlaxGPTJModel.__call__.example",$$slots:{default:[PT]},$$scope:{ctx:x}}}),Ks=new it({}),Rs=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.29.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.29.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.29.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.29.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/gptj/modeling_flax_gptj.py#L434",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.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 We({props:{$$slots:{default:[FT]},$$scope:{ctx:x}}}),hn=new mt({props:{anchor:"transformers.FlaxGPTJForCausalLM.__call__.example",$$slots:{default:[ET]},$$scope:{ctx:x}}}),{c(){d=a("meta"),y=p(),u=a("h1"),m=a("a"),T=a("span"),w(l.$$.fragment),c=p(),E=a("span"),C=n("GPT-J"),M=p(),A=a("h2"),N=a("a"),ne=a("span"),w(j.$$.fragment),Fe=p(),K=a("span"),Ee=n("Overview"),ye=p(),S=a("p"),je=n("The GPT-J model was released in the "),re=a("a"),X=n("kingoflolz/mesh-transformer-jax"),xe=n(` repository by Ben Wang and Aran Komatsuzaki. It is a GPT-2-like
causal language model trained on `),ie=a("a"),Y=n("the Pile"),Ge=n(" dataset."),ve=p(),B=a("p"),Je=n("This model was contributed by "),le=a("a"),de=n("Stella Biderman"),q=n("."),z=p(),ue=a("p"),Z=n("Tips:"),we=p(),fe=a("ul"),W=a("li"),Me=n("To load "),ce=a("a"),I=n("GPT-J"),qe=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 `),R=a("code"),Ae=n("torch_dtype"),Ce=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:`),V=p(),w(pe.$$.fragment),be=p(),D=a("ul"),me=a("li"),H=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"),L=n("here"),Ie=p(),O=a("li"),te=a("p"),Le=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 `),v=a("a"),G=n("GPT-J"),et=n(` contains 143 extra tokens
`),se=a("code"),tt=n("<|extratoken_1|>... <|extratoken_143|>"),ot=n(", so the "),J=a("code"),nt=n("vocab_size"),st=n(" of tokenizer also becomes 50400."),Ve=p(),ge=a("h3"),ke=a("a"),U=a("span"),w(Q.$$.fragment),at=p(),Ue=a("span"),oe=n("Generation"),Xe=p(),$e=a("p"),Oe=n("The "),Se=a("a"),he=n("generate()"),rt=n(` method can be used to generate text using GPT-J
model.`),Si=p(),w(wn.$$.fragment),Wi=p(),ha=a("p"),ed=n("\u2026or in float16 precision:"),Ui=p(),w(bn.$$.fragment),Bi=p(),Kt=a("h2"),bo=a("a"),ar=a("span"),w(kn.$$.fragment),td=p(),rr=a("span"),od=n("Resources"),Qi=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."),Hi=p(),w($n.$$.fragment),Ki=p(),ae=a("ul"),Pn=a("li"),sd=n("Description of "),Fn=a("a"),ad=n("GPT-J"),rd=n("."),id=p(),En=a("li"),ld=n("A blog on how to "),jn=a("a"),dd=n("Deploy GPT-J 6B for inference using Hugging Face Transformers and Amazon SageMaker"),cd=n("."),pd=p(),xn=a("li"),hd=n("A blog on how to "),Gn=a("a"),ud=n("Accelerate GPT-J inference with DeepSpeed-Inference on GPUs"),fd=n("."),md=p(),Jn=a("li"),gd=n("A blog post introducing "),Mn=a("a"),_d=n("GPT-J-6B: 6B JAX-Based Transformer"),Td=n(". \u{1F30E}"),yd=p(),qn=a("li"),vd=n("A notebook for "),An=a("a"),wd=n("GPT-J-6B Inference Demo"),bd=n(". \u{1F30E}"),kd=p(),Cn=a("li"),$d=n("Another notebook demonstrating "),zn=a("a"),Pd=n("Inference with GPT-J-6B"),Fd=n("."),Ed=p(),fa=a("li"),In=a("a"),jd=n("Causal language modeling"),xd=n(" chapter of the \u{1F917} Hugging Face Course."),Gd=p(),bt=a("li"),ma=a("a"),Jd=n("GPTJForCausalLM"),Md=n(" is supported by this "),Ln=a("a"),qd=n("causal language modeling example script"),Ad=n(", "),On=a("a"),Cd=n("text generation example script"),zd=n(", and "),Nn=a("a"),Id=n("notebook"),Ld=n("."),Od=p(),It=a("li"),ga=a("a"),Nd=n("TFGPTJForCausalLM"),Dd=n(" is supported by this "),Dn=a("a"),Sd=n("causal language modeling example script"),Wd=n(" and "),Sn=a("a"),Ud=n("notebook"),Bd=n("."),Qd=p(),Lt=a("li"),_a=a("a"),Hd=n("FlaxGPTJForCausalLM"),Kd=n(" is supported by this "),Wn=a("a"),Rd=n("causal language modeling example script"),Vd=n(" and "),Un=a("a"),Xd=n("notebook"),Yd=n("."),Ri=p(),Ta=a("p"),ir=a("strong"),Zd=n("Documentation resources"),Vi=p(),Ot=a("ul"),lr=a("li"),ya=a("a"),ec=n("Text classification task guide"),tc=p(),dr=a("li"),va=a("a"),oc=n("Question answering task guide"),nc=p(),cr=a("li"),wa=a("a"),sc=n("Causal language modeling task guide"),Xi=p(),Rt=a("h2"),ko=a("a"),pr=a("span"),w(Bn.$$.fragment),ac=p(),hr=a("span"),rc=n("GPTJConfig"),Yi=p(),Mt=a("div"),w(Qn.$$.fragment),ic=p(),_t=a("p"),lc=n("This is the configuration class to store the configuration of a "),ba=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
`),Hn=a("a"),pc=n("EleutherAI/gpt-j-6B"),hc=n(` architecture. Configuration objects inherit from
`),ka=a("a"),uc=n("PretrainedConfig"),fc=n(" and can be used to control the model outputs. Read the documentation from "),$a=a("a"),mc=n("PretrainedConfig"),gc=n(`
for more information.`),_c=p(),w($o.$$.fragment),Zi=p(),Vt=a("h2"),Po=a("a"),ur=a("span"),w(Kn.$$.fragment),Tc=p(),fr=a("span"),yc=n("GPTJModel"),el=p(),qt=a("div"),w(Rn.$$.fragment),vc=p(),Vn=a("p"),wc=n(`The bare GPT-J Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Xn=a("a"),bc=n("torch.nn.Module"),kc=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.`),$c=p(),lt=a("div"),w(Yn.$$.fragment),Pc=p(),Xt=a("p"),Fc=n("The "),Pa=a("a"),Ec=n("GPTJModel"),jc=n(" forward method, overrides the "),mr=a("code"),xc=n("__call__"),Gc=n(" special method."),Jc=p(),w(Fo.$$.fragment),Mc=p(),w(Eo.$$.fragment),qc=p(),w(jo.$$.fragment),tl=p(),Yt=a("h2"),xo=a("a"),gr=a("span"),w(Zn.$$.fragment),Ac=p(),_r=a("span"),Cc=n("GPTJForCausalLM"),ol=p(),Tt=a("div"),w(es.$$.fragment),zc=p(),Tr=a("p"),Ic=n("The GPT-J Model transformer with a language modeling head on top."),Lc=p(),ts=a("p"),Oc=n("This model is a PyTorch "),os=a("a"),Nc=n("torch.nn.Module"),Dc=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.`),Sc=p(),dt=a("div"),w(ns.$$.fragment),Wc=p(),Zt=a("p"),Uc=n("The "),Fa=a("a"),Bc=n("GPTJForCausalLM"),Qc=n(" forward method, overrides the "),yr=a("code"),Hc=n("__call__"),Kc=n(" special method."),Rc=p(),w(Go.$$.fragment),Vc=p(),w(Jo.$$.fragment),Xc=p(),w(Mo.$$.fragment),nl=p(),eo=a("h2"),qo=a("a"),vr=a("span"),w(ss.$$.fragment),Yc=p(),wr=a("span"),Zc=n("GPTJForSequenceClassification"),sl=p(),Be=a("div"),w(as.$$.fragment),ep=p(),br=a("p"),tp=n("The GPT-J Model transformer with a sequence classification head on top (linear layer)."),op=p(),Ea=a("p"),ja=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
`),kr=a("code"),ip=n("pad_token_id"),lp=n(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),$r=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 `),Pr=a("code"),pp=n("inputs_embeds"),hp=n(" are passed instead of "),Fr=a("code"),up=n("input_ids"),fp=n(`, it does the same (take the last value in
each row of the batch).`),mp=p(),rs=a("p"),gp=n("This model is a PyTorch "),is=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"),w(ls.$$.fragment),vp=p(),to=a("p"),wp=n("The "),xa=a("a"),bp=n("GPTJForSequenceClassification"),kp=n(" forward method, overrides the "),Er=a("code"),$p=n("__call__"),Pp=n(" special method."),Fp=p(),w(Ao.$$.fragment),Ep=p(),w(Co.$$.fragment),jp=p(),w(zo.$$.fragment),xp=p(),w(Io.$$.fragment),al=p(),oo=a("h2"),Lo=a("a"),jr=a("span"),w(ds.$$.fragment),Gp=p(),xr=a("span"),Jp=n("GPTJForQuestionAnswering"),rl=p(),vt=a("div"),w(cs.$$.fragment),Mp=p(),no=a("p"),qp=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 `),Gr=a("code"),Ap=n("span start logits"),Cp=n(" and "),Jr=a("code"),zp=n("span end logits"),Ip=n(")."),Lp=p(),ps=a("p"),Op=n("This model is a PyTorch "),hs=a("a"),Np=n("torch.nn.Module"),Dp=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.`),Sp=p(),ct=a("div"),w(us.$$.fragment),Wp=p(),so=a("p"),Up=n("The "),Ga=a("a"),Bp=n("GPTJForQuestionAnswering"),Qp=n(" forward method, overrides the "),Mr=a("code"),Hp=n("__call__"),Kp=n(" special method."),Rp=p(),w(Oo.$$.fragment),Vp=p(),w(No.$$.fragment),Xp=p(),w(Do.$$.fragment),il=p(),ao=a("h2"),So=a("a"),qr=a("span"),w(fs.$$.fragment),Yp=p(),Ar=a("span"),Zp=n("TFGPTJModel"),ll=p(),Qe=a("div"),w(ms.$$.fragment),eh=p(),Cr=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 "),Ja=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"),ih=n("This model is also a "),Ts=a("a"),lh=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(),w(Wo.$$.fragment),ph=p(),kt=a("div"),w(ys.$$.fragment),hh=p(),ro=a("p"),uh=n("The "),Ma=a("a"),fh=n("TFGPTJModel"),mh=n(" forward method, overrides the "),zr=a("code"),gh=n("__call__"),_h=n(" special method."),Th=p(),w(Uo.$$.fragment),yh=p(),w(Bo.$$.fragment),dl=p(),io=a("h2"),Qo=a("a"),Ir=a("span"),w(vs.$$.fragment),vh=p(),Lr=a("span"),wh=n("TFGPTJForCausalLM"),cl=p(),He=a("div"),w(ws.$$.fragment),bh=p(),Or=a("p"),kh=n("The GPT-J Model transformer with a language modeling head on top."),$h=p(),bs=a("p"),Ph=n("This model inherits from "),qa=a("a"),Fh=n("TFPreTrainedModel"),Eh=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.)`),jh=p(),ks=a("p"),xh=n("This model is also a "),$s=a("a"),Gh=n("tf.keras.Model"),Jh=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.`),Mh=p(),w(Ho.$$.fragment),qh=p(),$t=a("div"),w(Ps.$$.fragment),Ah=p(),lo=a("p"),Ch=n("The "),Aa=a("a"),zh=n("TFGPTJForCausalLM"),Ih=n(" forward method, overrides the "),Nr=a("code"),Lh=n("__call__"),Oh=n(" special method."),Nh=p(),w(Ko.$$.fragment),Dh=p(),w(Ro.$$.fragment),pl=p(),co=a("h2"),Vo=a("a"),Dr=a("span"),w(Fs.$$.fragment),Sh=p(),Sr=a("span"),Wh=n("TFGPTJForSequenceClassification"),hl=p(),_e=a("div"),w(Es.$$.fragment),Uh=p(),Wr=a("p"),Bh=n("The GPT-J Model transformer with a sequence classification head on top (linear layer)."),Qh=p(),Ca=a("p"),za=a("a"),Hh=n("GPTJForSequenceClassification"),Kh=n(` uses the last token in order to do the classification, as other causal models
(e.g. GPT, GPT-2, GPT-Neo) do.`),Rh=p(),wt=a("p"),Vh=n(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Ur=a("code"),Xh=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 `),Br=a("code"),Zh=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 `),Qr=a("code"),tu=n("inputs_embeds"),ou=n(" are passed instead of "),Hr=a("code"),nu=n("input_ids"),su=n(`, it does the same (take the last value in
each row of the batch).`),au=p(),js=a("p"),ru=n("This model inherits from "),Ia=a("a"),iu=n("TFPreTrainedModel"),lu=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(),xs=a("p"),cu=n("This model is also a "),Gs=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(),w(Xo.$$.fragment),fu=p(),pt=a("div"),w(Js.$$.fragment),mu=p(),po=a("p"),gu=n("The "),La=a("a"),_u=n("TFGPTJForSequenceClassification"),Tu=n(" forward method, overrides the "),Kr=a("code"),yu=n("__call__"),vu=n(" special method."),wu=p(),w(Yo.$$.fragment),bu=p(),w(Zo.$$.fragment),ku=p(),w(en.$$.fragment),ul=p(),ho=a("h2"),tn=a("a"),Rr=a("span"),w(Ms.$$.fragment),$u=p(),Vr=a("span"),Pu=n("TFGPTJForQuestionAnswering"),fl=p(),Ke=a("div"),w(qs.$$.fragment),Fu=p(),uo=a("p"),Eu=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 `),Xr=a("code"),ju=n("span start logits"),xu=n(" and "),Yr=a("code"),Gu=n("span end logits"),Ju=n(")."),Mu=p(),As=a("p"),qu=n("This model inherits from "),Oa=a("a"),Au=n("TFPreTrainedModel"),Cu=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(),Cs=a("p"),Iu=n("This model is also a "),zs=a("a"),Lu=n("tf.keras.Model"),Ou=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(),w(on.$$.fragment),Du=p(),ht=a("div"),w(Is.$$.fragment),Su=p(),fo=a("p"),Wu=n("The "),Na=a("a"),Uu=n("TFGPTJForQuestionAnswering"),Bu=n(" forward method, overrides the "),Zr=a("code"),Qu=n("__call__"),Hu=n(" special method."),Ku=p(),w(nn.$$.fragment),Ru=p(),w(sn.$$.fragment),Vu=p(),w(an.$$.fragment),ml=p(),mo=a("h2"),rn=a("a"),ei=a("span"),w(Ls.$$.fragment),Xu=p(),ti=a("span"),Yu=n("FlaxGPTJModel"),gl=p(),Ne=a("div"),w(Os.$$.fragment),Zu=p(),oi=a("p"),ef=n("The bare GPTJ Model transformer outputting raw hidden-states without any specific head on top."),tf=p(),Ns=a("p"),of=n("This model inherits from "),Da=a("a"),nf=n("FlaxPreTrainedModel"),sf=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.)`),af=p(),Ds=a("p"),rf=n(`This model is also a Flax Linen
`),Ss=a("a"),lf=n("flax.nn.Module"),df=n(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),cf=p(),ni=a("p"),pf=n("Finally, this model supports inherent JAX features such as:"),hf=p(),At=a("ul"),si=a("li"),Ws=a("a"),uf=n("Just-In-Time (JIT) compilation"),ff=p(),ai=a("li"),Us=a("a"),mf=n("Automatic Differentiation"),gf=p(),ri=a("li"),Bs=a("a"),_f=n("Vectorization"),Tf=p(),ii=a("li"),Qs=a("a"),yf=n("Parallelization"),vf=p(),Pt=a("div"),w(Hs.$$.fragment),wf=p(),go=a("p"),bf=n("The "),li=a("code"),kf=n("FlaxGPTJPreTrainedModel"),$f=n(" forward method, overrides the "),di=a("code"),Pf=n("__call__"),Ff=n(" special method."),Ef=p(),w(ln.$$.fragment),jf=p(),w(dn.$$.fragment),_l=p(),_o=a("h2"),cn=a("a"),ci=a("span"),w(Ks.$$.fragment),xf=p(),pi=a("span"),Gf=n("FlaxGPTJForCausalLM"),Tl=p(),De=a("div"),w(Rs.$$.fragment),Jf=p(),hi=a("p"),Mf=n("The GPTJ Model transformer with a language modeling head on top."),qf=p(),Vs=a("p"),Af=n("This model inherits from "),Sa=a("a"),Cf=n("FlaxPreTrainedModel"),zf=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.)`),If=p(),Xs=a("p"),Lf=n(`This model is also a Flax Linen
`),Ys=a("a"),Of=n("flax.nn.Module"),Nf=n(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Df=p(),ui=a("p"),Sf=n("Finally, this model supports inherent JAX features such as:"),Wf=p(),Ct=a("ul"),fi=a("li"),Zs=a("a"),Uf=n("Just-In-Time (JIT) compilation"),Bf=p(),mi=a("li"),ea=a("a"),Qf=n("Automatic Differentiation"),Hf=p(),gi=a("li"),ta=a("a"),Kf=n("Vectorization"),Rf=p(),_i=a("li"),oa=a("a"),Vf=n("Parallelization"),Xf=p(),Ft=a("div"),w(na.$$.fragment),Yf=p(),To=a("p"),Zf=n("The "),Ti=a("code"),em=n("FlaxGPTJPreTrainedModel"),tm=n(" forward method, overrides the "),yi=a("code"),om=n("__call__"),nm=n(" special method."),sm=p(),w(pn.$$.fragment),am=p(),w(hn.$$.fragment),this.h()},l(o){const _=H_('[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=i(u);m=r(sa,"A",{id:!0,class:!0,href:!0});var vi=i(m);T=r(vi,"SPAN",{});var wi=i(T);b(l.$$.fragment,wi),wi.forEach(t),vi.forEach(t),c=h(sa),E=r(sa,"SPAN",{});var bi=i(E);C=s(bi,"GPT-J"),bi.forEach(t),sa.forEach(t),M=h(o),A=r(o,"H2",{class:!0});var aa=i(A);N=r(aa,"A",{id:!0,class:!0,href:!0});var ki=i(N);ne=r(ki,"SPAN",{});var $i=i(ne);b(j.$$.fragment,$i),$i.forEach(t),ki.forEach(t),Fe=h(aa),K=r(aa,"SPAN",{});var Pi=i(K);Ee=s(Pi,"Overview"),Pi.forEach(t),aa.forEach(t),ye=h(o),S=r(o,"P",{});var yo=i(S);je=s(yo,"The GPT-J model was released in the "),re=r(yo,"A",{href:!0,rel:!0});var Fi=i(re);X=s(Fi,"kingoflolz/mesh-transformer-jax"),Fi.forEach(t),xe=s(yo,` repository by Ben Wang and Aran Komatsuzaki. It is a GPT-2-like
causal language model trained on `),ie=r(yo,"A",{href:!0,rel:!0});var Ei=i(ie);Y=s(Ei,"the Pile"),Ei.forEach(t),Ge=s(yo," dataset."),yo.forEach(t),ve=h(o),B=r(o,"P",{});var ra=i(B);Je=s(ra,"This model was contributed by "),le=r(ra,"A",{href:!0,rel:!0});var ji=i(le);de=s(ji,"Stella Biderman"),ji.forEach(t),q=s(ra,"."),ra.forEach(t),z=h(o),ue=r(o,"P",{});var xi=i(ue);Z=s(xi,"Tips:"),xi.forEach(t),we=h(o),fe=r(o,"UL",{});var Gi=i(fe);W=r(Gi,"LI",{});var vo=i(W);Me=s(vo,"To load "),ce=r(vo,"A",{href:!0,rel:!0});var Ji=i(ce);I=s(Ji,"GPT-J"),Ji.forEach(t),qe=s(vo,` 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 `),R=r(vo,"CODE",{});var Mi=i(R);Ae=s(Mi,"torch_dtype"),Mi.forEach(t),Ce=s(vo,` 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:`),vo.forEach(t),Gi.forEach(t),V=h(o),b(pe.$$.fragment,o),be=h(o),D=r(o,"UL",{});var ia=i(D);me=r(ia,"LI",{});var qi=i(me);H=r(qi,"P",{});var Wa=i(H);ze=s(Wa,`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(Wa,"A",{href:!0,rel:!0});var Ai=i(ee);L=s(Ai,"here"),Ai.forEach(t),Wa.forEach(t),qi.forEach(t),Ie=h(ia),O=r(ia,"LI",{});var Ci=i(O);te=r(Ci,"P",{});var zt=i(te);Le=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 `),v=r(zt,"A",{href:!0,rel:!0});var zi=i(v);G=s(zi,"GPT-J"),zi.forEach(t),et=s(zt,` contains 143 extra tokens
`),se=r(zt,"CODE",{});var Ii=i(se);tt=s(Ii,"<|extratoken_1|>... <|extratoken_143|>"),Ii.forEach(t),ot=s(zt,", so the "),J=r(zt,"CODE",{});var Li=i(J);nt=s(Li,"vocab_size"),Li.forEach(t),st=s(zt," of tokenizer also becomes 50400."),zt.forEach(t),Ci.forEach(t),ia.forEach(t),Ve=h(o),ge=r(o,"H3",{class:!0});var la=i(ge);ke=r(la,"A",{id:!0,class:!0,href:!0});var Oi=i(ke);U=r(Oi,"SPAN",{});var Ni=i(U);b(Q.$$.fragment,Ni),Ni.forEach(t),Oi.forEach(t),at=h(la),Ue=r(la,"SPAN",{});var Di=i(Ue);oe=s(Di,"Generation"),Di.forEach(t),la.forEach(t),Xe=h(o),$e=r(o,"P",{});var da=i($e);Oe=s(da,"The "),Se=r(da,"A",{href:!0});var dm=i(Se);he=s(dm,"generate()"),dm.forEach(t),rt=s(da,` method can be used to generate text using GPT-J
model.`),da.forEach(t),Si=h(o),b(wn.$$.fragment,o),Wi=h(o),ha=r(o,"P",{});var cm=i(ha);ed=s(cm,"\u2026or in float16 precision:"),cm.forEach(t),Ui=h(o),b(bn.$$.fragment,o),Bi=h(o),Kt=r(o,"H2",{class:!0});var vl=i(Kt);bo=r(vl,"A",{id:!0,class:!0,href:!0});var pm=i(bo);ar=r(pm,"SPAN",{});var hm=i(ar);b(kn.$$.fragment,hm),hm.forEach(t),pm.forEach(t),td=h(vl),rr=r(vl,"SPAN",{});var um=i(rr);od=s(um,"Resources"),um.forEach(t),vl.forEach(t),Qi=h(o),ua=r(o,"P",{});var fm=i(ua);nd=s(fm,"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."),fm.forEach(t),Hi=h(o),b($n.$$.fragment,o),Ki=h(o),ae=r(o,"UL",{});var Pe=i(ae);Pn=r(Pe,"LI",{});var wl=i(Pn);sd=s(wl,"Description of "),Fn=r(wl,"A",{href:!0,rel:!0});var mm=i(Fn);ad=s(mm,"GPT-J"),mm.forEach(t),rd=s(wl,"."),wl.forEach(t),id=h(Pe),En=r(Pe,"LI",{});var bl=i(En);ld=s(bl,"A blog on how to "),jn=r(bl,"A",{href:!0,rel:!0});var gm=i(jn);dd=s(gm,"Deploy GPT-J 6B for inference using Hugging Face Transformers and Amazon SageMaker"),gm.forEach(t),cd=s(bl,"."),bl.forEach(t),pd=h(Pe),xn=r(Pe,"LI",{});var kl=i(xn);hd=s(kl,"A blog on how to "),Gn=r(kl,"A",{href:!0,rel:!0});var _m=i(Gn);ud=s(_m,"Accelerate GPT-J inference with DeepSpeed-Inference on GPUs"),_m.forEach(t),fd=s(kl,"."),kl.forEach(t),md=h(Pe),Jn=r(Pe,"LI",{});var $l=i(Jn);gd=s($l,"A blog post introducing "),Mn=r($l,"A",{href:!0,rel:!0});var Tm=i(Mn);_d=s(Tm,"GPT-J-6B: 6B JAX-Based Transformer"),Tm.forEach(t),Td=s($l,". \u{1F30E}"),$l.forEach(t),yd=h(Pe),qn=r(Pe,"LI",{});var Pl=i(qn);vd=s(Pl,"A notebook for "),An=r(Pl,"A",{href:!0,rel:!0});var ym=i(An);wd=s(ym,"GPT-J-6B Inference Demo"),ym.forEach(t),bd=s(Pl,". \u{1F30E}"),Pl.forEach(t),kd=h(Pe),Cn=r(Pe,"LI",{});var Fl=i(Cn);$d=s(Fl,"Another notebook demonstrating "),zn=r(Fl,"A",{href:!0,rel:!0});var vm=i(zn);Pd=s(vm,"Inference with GPT-J-6B"),vm.forEach(t),Fd=s(Fl,"."),Fl.forEach(t),Ed=h(Pe),fa=r(Pe,"LI",{});var rm=i(fa);In=r(rm,"A",{href:!0,rel:!0});var wm=i(In);jd=s(wm,"Causal language modeling"),wm.forEach(t),xd=s(rm," chapter of the \u{1F917} Hugging Face Course."),rm.forEach(t),Gd=h(Pe),bt=r(Pe,"LI",{});var wo=i(bt);ma=r(wo,"A",{href:!0});var bm=i(ma);Jd=s(bm,"GPTJForCausalLM"),bm.forEach(t),Md=s(wo," is supported by this "),Ln=r(wo,"A",{href:!0,rel:!0});var km=i(Ln);qd=s(km,"causal language modeling example script"),km.forEach(t),Ad=s(wo,", "),On=r(wo,"A",{href:!0,rel:!0});var $m=i(On);Cd=s($m,"text generation example script"),$m.forEach(t),zd=s(wo,", and "),Nn=r(wo,"A",{href:!0,rel:!0});var Pm=i(Nn);Id=s(Pm,"notebook"),Pm.forEach(t),Ld=s(wo,"."),wo.forEach(t),Od=h(Pe),It=r(Pe,"LI",{});var ca=i(It);ga=r(ca,"A",{href:!0});var Fm=i(ga);Nd=s(Fm,"TFGPTJForCausalLM"),Fm.forEach(t),Dd=s(ca," is supported by this "),Dn=r(ca,"A",{href:!0,rel:!0});var Em=i(Dn);Sd=s(Em,"causal language modeling example script"),Em.forEach(t),Wd=s(ca," and "),Sn=r(ca,"A",{href:!0,rel:!0});var jm=i(Sn);Ud=s(jm,"notebook"),jm.forEach(t),Bd=s(ca,"."),ca.forEach(t),Qd=h(Pe),Lt=r(Pe,"LI",{});var pa=i(Lt);_a=r(pa,"A",{href:!0});var xm=i(_a);Hd=s(xm,"FlaxGPTJForCausalLM"),xm.forEach(t),Kd=s(pa," is supported by this "),Wn=r(pa,"A",{href:!0,rel:!0});var Gm=i(Wn);Rd=s(Gm,"causal language modeling example script"),Gm.forEach(t),Vd=s(pa," and "),Un=r(pa,"A",{href:!0,rel:!0});var Jm=i(Un);Xd=s(Jm,"notebook"),Jm.forEach(t),Yd=s(pa,"."),pa.forEach(t),Pe.forEach(t),Ri=h(o),Ta=r(o,"P",{});var Mm=i(Ta);ir=r(Mm,"STRONG",{});var qm=i(ir);Zd=s(qm,"Documentation resources"),qm.forEach(t),Mm.forEach(t),Vi=h(o),Ot=r(o,"UL",{});var Ua=i(Ot);lr=r(Ua,"LI",{});var Am=i(lr);ya=r(Am,"A",{href:!0});var Cm=i(ya);ec=s(Cm,"Text classification task guide"),Cm.forEach(t),Am.forEach(t),tc=h(Ua),dr=r(Ua,"LI",{});var zm=i(dr);va=r(zm,"A",{href:!0});var Im=i(va);oc=s(Im,"Question answering task guide"),Im.forEach(t),zm.forEach(t),nc=h(Ua),cr=r(Ua,"LI",{});var Lm=i(cr);wa=r(Lm,"A",{href:!0});var Om=i(wa);sc=s(Om,"Causal language modeling task guide"),Om.forEach(t),Lm.forEach(t),Ua.forEach(t),Xi=h(o),Rt=r(o,"H2",{class:!0});var El=i(Rt);ko=r(El,"A",{id:!0,class:!0,href:!0});var Nm=i(ko);pr=r(Nm,"SPAN",{});var Dm=i(pr);b(Bn.$$.fragment,Dm),Dm.forEach(t),Nm.forEach(t),ac=h(El),hr=r(El,"SPAN",{});var Sm=i(hr);rc=s(Sm,"GPTJConfig"),Sm.forEach(t),El.forEach(t),Yi=h(o),Mt=r(o,"DIV",{class:!0});var Ba=i(Mt);b(Qn.$$.fragment,Ba),ic=h(Ba),_t=r(Ba,"P",{});var Nt=i(_t);lc=s(Nt,"This is the configuration class to store the configuration of a "),ba=r(Nt,"A",{href:!0});var Wm=i(ba);dc=s(Wm,"GPTJModel"),Wm.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
`),Hn=r(Nt,"A",{href:!0,rel:!0});var Um=i(Hn);pc=s(Um,"EleutherAI/gpt-j-6B"),Um.forEach(t),hc=s(Nt,` architecture. Configuration objects inherit from
`),ka=r(Nt,"A",{href:!0});var Bm=i(ka);uc=s(Bm,"PretrainedConfig"),Bm.forEach(t),fc=s(Nt," and can be used to control the model outputs. Read the documentation from "),$a=r(Nt,"A",{href:!0});var Qm=i($a);mc=s(Qm,"PretrainedConfig"),Qm.forEach(t),gc=s(Nt,`
for more information.`),Nt.forEach(t),_c=h(Ba),b($o.$$.fragment,Ba),Ba.forEach(t),Zi=h(o),Vt=r(o,"H2",{class:!0});var jl=i(Vt);Po=r(jl,"A",{id:!0,class:!0,href:!0});var Hm=i(Po);ur=r(Hm,"SPAN",{});var Km=i(ur);b(Kn.$$.fragment,Km),Km.forEach(t),Hm.forEach(t),Tc=h(jl),fr=r(jl,"SPAN",{});var Rm=i(fr);yc=s(Rm,"GPTJModel"),Rm.forEach(t),jl.forEach(t),el=h(o),qt=r(o,"DIV",{class:!0});var Qa=i(qt);b(Rn.$$.fragment,Qa),vc=h(Qa),Vn=r(Qa,"P",{});var xl=i(Vn);wc=s(xl,`The bare GPT-J Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Xn=r(xl,"A",{href:!0,rel:!0});var Vm=i(Xn);bc=s(Vm,"torch.nn.Module"),Vm.forEach(t),kc=s(xl,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),xl.forEach(t),$c=h(Qa),lt=r(Qa,"DIV",{class:!0});var Dt=i(lt);b(Yn.$$.fragment,Dt),Pc=h(Dt),Xt=r(Dt,"P",{});var Ha=i(Xt);Fc=s(Ha,"The "),Pa=r(Ha,"A",{href:!0});var Xm=i(Pa);Ec=s(Xm,"GPTJModel"),Xm.forEach(t),jc=s(Ha," forward method, overrides the "),mr=r(Ha,"CODE",{});var Ym=i(mr);xc=s(Ym,"__call__"),Ym.forEach(t),Gc=s(Ha," special method."),Ha.forEach(t),Jc=h(Dt),b(Fo.$$.fragment,Dt),Mc=h(Dt),b(Eo.$$.fragment,Dt),qc=h(Dt),b(jo.$$.fragment,Dt),Dt.forEach(t),Qa.forEach(t),tl=h(o),Yt=r(o,"H2",{class:!0});var Gl=i(Yt);xo=r(Gl,"A",{id:!0,class:!0,href:!0});var Zm=i(xo);gr=r(Zm,"SPAN",{});var eg=i(gr);b(Zn.$$.fragment,eg),eg.forEach(t),Zm.forEach(t),Ac=h(Gl),_r=r(Gl,"SPAN",{});var tg=i(_r);Cc=s(tg,"GPTJForCausalLM"),tg.forEach(t),Gl.forEach(t),ol=h(o),Tt=r(o,"DIV",{class:!0});var un=i(Tt);b(es.$$.fragment,un),zc=h(un),Tr=r(un,"P",{});var og=i(Tr);Ic=s(og,"The GPT-J Model transformer with a language modeling head on top."),og.forEach(t),Lc=h(un),ts=r(un,"P",{});var Jl=i(ts);Oc=s(Jl,"This model is a PyTorch "),os=r(Jl,"A",{href:!0,rel:!0});var ng=i(os);Nc=s(ng,"torch.nn.Module"),ng.forEach(t),Dc=s(Jl,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Jl.forEach(t),Sc=h(un),dt=r(un,"DIV",{class:!0});var St=i(dt);b(ns.$$.fragment,St),Wc=h(St),Zt=r(St,"P",{});var Ka=i(Zt);Uc=s(Ka,"The "),Fa=r(Ka,"A",{href:!0});var sg=i(Fa);Bc=s(sg,"GPTJForCausalLM"),sg.forEach(t),Qc=s(Ka," forward method, overrides the "),yr=r(Ka,"CODE",{});var ag=i(yr);Hc=s(ag,"__call__"),ag.forEach(t),Kc=s(Ka," special method."),Ka.forEach(t),Rc=h(St),b(Go.$$.fragment,St),Vc=h(St),b(Jo.$$.fragment,St),Xc=h(St),b(Mo.$$.fragment,St),St.forEach(t),un.forEach(t),nl=h(o),eo=r(o,"H2",{class:!0});var Ml=i(eo);qo=r(Ml,"A",{id:!0,class:!0,href:!0});var rg=i(qo);vr=r(rg,"SPAN",{});var ig=i(vr);b(ss.$$.fragment,ig),ig.forEach(t),rg.forEach(t),Yc=h(Ml),wr=r(Ml,"SPAN",{});var lg=i(wr);Zc=s(lg,"GPTJForSequenceClassification"),lg.forEach(t),Ml.forEach(t),sl=h(o),Be=r(o,"DIV",{class:!0});var Et=i(Be);b(as.$$.fragment,Et),ep=h(Et),br=r(Et,"P",{});var dg=i(br);tp=s(dg,"The GPT-J Model transformer with a sequence classification head on top (linear layer)."),dg.forEach(t),op=h(Et),Ea=r(Et,"P",{});var im=i(Ea);ja=r(im,"A",{href:!0});var cg=i(ja);np=s(cg,"GPTJForSequenceClassification"),cg.forEach(t),sp=s(im,` uses the last token in order to do the classification, as other causal models
(e.g. GPT, GPT-2, GPT-Neo) do.`),im.forEach(t),ap=h(Et),yt=r(Et,"P",{});var Wt=i(yt);rp=s(Wt,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),kr=r(Wt,"CODE",{});var pg=i(kr);ip=s(pg,"pad_token_id"),pg.forEach(t),lp=s(Wt,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),$r=r(Wt,"CODE",{});var hg=i($r);dp=s(hg,"pad_token_id"),hg.forEach(t),cp=s(Wt,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Pr=r(Wt,"CODE",{});var ug=i(Pr);pp=s(ug,"inputs_embeds"),ug.forEach(t),hp=s(Wt," are passed instead of "),Fr=r(Wt,"CODE",{});var fg=i(Fr);up=s(fg,"input_ids"),fg.forEach(t),fp=s(Wt,`, it does the same (take the last value in
each row of the batch).`),Wt.forEach(t),mp=h(Et),rs=r(Et,"P",{});var ql=i(rs);gp=s(ql,"This model is a PyTorch "),is=r(ql,"A",{href:!0,rel:!0});var mg=i(is);_p=s(mg,"torch.nn.Module"),mg.forEach(t),Tp=s(ql,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ql.forEach(t),yp=h(Et),Ye=r(Et,"DIV",{class:!0});var jt=i(Ye);b(ls.$$.fragment,jt),vp=h(jt),to=r(jt,"P",{});var Ra=i(to);wp=s(Ra,"The "),xa=r(Ra,"A",{href:!0});var gg=i(xa);bp=s(gg,"GPTJForSequenceClassification"),gg.forEach(t),kp=s(Ra," forward method, overrides the "),Er=r(Ra,"CODE",{});var _g=i(Er);$p=s(_g,"__call__"),_g.forEach(t),Pp=s(Ra," special method."),Ra.forEach(t),Fp=h(jt),b(Ao.$$.fragment,jt),Ep=h(jt),b(Co.$$.fragment,jt),jp=h(jt),b(zo.$$.fragment,jt),xp=h(jt),b(Io.$$.fragment,jt),jt.forEach(t),Et.forEach(t),al=h(o),oo=r(o,"H2",{class:!0});var Al=i(oo);Lo=r(Al,"A",{id:!0,class:!0,href:!0});var Tg=i(Lo);jr=r(Tg,"SPAN",{});var yg=i(jr);b(ds.$$.fragment,yg),yg.forEach(t),Tg.forEach(t),Gp=h(Al),xr=r(Al,"SPAN",{});var vg=i(xr);Jp=s(vg,"GPTJForQuestionAnswering"),vg.forEach(t),Al.forEach(t),rl=h(o),vt=r(o,"DIV",{class:!0});var fn=i(vt);b(cs.$$.fragment,fn),Mp=h(fn),no=r(fn,"P",{});var Va=i(no);qp=s(Va,`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 `),Gr=r(Va,"CODE",{});var wg=i(Gr);Ap=s(wg,"span start logits"),wg.forEach(t),Cp=s(Va," and "),Jr=r(Va,"CODE",{});var bg=i(Jr);zp=s(bg,"span end logits"),bg.forEach(t),Ip=s(Va,")."),Va.forEach(t),Lp=h(fn),ps=r(fn,"P",{});var Cl=i(ps);Op=s(Cl,"This model is a PyTorch "),hs=r(Cl,"A",{href:!0,rel:!0});var kg=i(hs);Np=s(kg,"torch.nn.Module"),kg.forEach(t),Dp=s(Cl,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Cl.forEach(t),Sp=h(fn),ct=r(fn,"DIV",{class:!0});var Ut=i(ct);b(us.$$.fragment,Ut),Wp=h(Ut),so=r(Ut,"P",{});var Xa=i(so);Up=s(Xa,"The "),Ga=r(Xa,"A",{href:!0});var $g=i(Ga);Bp=s($g,"GPTJForQuestionAnswering"),$g.forEach(t),Qp=s(Xa," forward method, overrides the "),Mr=r(Xa,"CODE",{});var Pg=i(Mr);Hp=s(Pg,"__call__"),Pg.forEach(t),Kp=s(Xa," special method."),Xa.forEach(t),Rp=h(Ut),b(Oo.$$.fragment,Ut),Vp=h(Ut),b(No.$$.fragment,Ut),Xp=h(Ut),b(Do.$$.fragment,Ut),Ut.forEach(t),fn.forEach(t),il=h(o),ao=r(o,"H2",{class:!0});var zl=i(ao);So=r(zl,"A",{id:!0,class:!0,href:!0});var Fg=i(So);qr=r(Fg,"SPAN",{});var Eg=i(qr);b(fs.$$.fragment,Eg),Eg.forEach(t),Fg.forEach(t),Yp=h(zl),Ar=r(zl,"SPAN",{});var jg=i(Ar);Zp=s(jg,"TFGPTJModel"),jg.forEach(t),zl.forEach(t),ll=h(o),Qe=r(o,"DIV",{class:!0});var xt=i(Qe);b(ms.$$.fragment,xt),eh=h(xt),Cr=r(xt,"P",{});var xg=i(Cr);th=s(xg,"The bare GPT-J Model transformer outputting raw hidden-states without any specific head on top."),xg.forEach(t),oh=h(xt),gs=r(xt,"P",{});var Il=i(gs);nh=s(Il,"This model inherits from "),Ja=r(Il,"A",{href:!0});var Gg=i(Ja);sh=s(Gg,"TFPreTrainedModel"),Gg.forEach(t),ah=s(Il,`. 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.)`),Il.forEach(t),rh=h(xt),_s=r(xt,"P",{});var Ll=i(_s);ih=s(Ll,"This model is also a "),Ts=r(Ll,"A",{href:!0,rel:!0});var Jg=i(Ts);lh=s(Jg,"tf.keras.Model"),Jg.forEach(t),dh=s(Ll,` 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.`),Ll.forEach(t),ch=h(xt),b(Wo.$$.fragment,xt),ph=h(xt),kt=r(xt,"DIV",{class:!0});var mn=i(kt);b(ys.$$.fragment,mn),hh=h(mn),ro=r(mn,"P",{});var Ya=i(ro);uh=s(Ya,"The "),Ma=r(Ya,"A",{href:!0});var Mg=i(Ma);fh=s(Mg,"TFGPTJModel"),Mg.forEach(t),mh=s(Ya," forward method, overrides the "),zr=r(Ya,"CODE",{});var qg=i(zr);gh=s(qg,"__call__"),qg.forEach(t),_h=s(Ya," special method."),Ya.forEach(t),Th=h(mn),b(Uo.$$.fragment,mn),yh=h(mn),b(Bo.$$.fragment,mn),mn.forEach(t),xt.forEach(t),dl=h(o),io=r(o,"H2",{class:!0});var Ol=i(io);Qo=r(Ol,"A",{id:!0,class:!0,href:!0});var Ag=i(Qo);Ir=r(Ag,"SPAN",{});var Cg=i(Ir);b(vs.$$.fragment,Cg),Cg.forEach(t),Ag.forEach(t),vh=h(Ol),Lr=r(Ol,"SPAN",{});var zg=i(Lr);wh=s(zg,"TFGPTJForCausalLM"),zg.forEach(t),Ol.forEach(t),cl=h(o),He=r(o,"DIV",{class:!0});var Gt=i(He);b(ws.$$.fragment,Gt),bh=h(Gt),Or=r(Gt,"P",{});var Ig=i(Or);kh=s(Ig,"The GPT-J Model transformer with a language modeling head on top."),Ig.forEach(t),$h=h(Gt),bs=r(Gt,"P",{});var Nl=i(bs);Ph=s(Nl,"This model inherits from "),qa=r(Nl,"A",{href:!0});var Lg=i(qa);Fh=s(Lg,"TFPreTrainedModel"),Lg.forEach(t),Eh=s(Nl,`. 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.)`),Nl.forEach(t),jh=h(Gt),ks=r(Gt,"P",{});var Dl=i(ks);xh=s(Dl,"This model is also a "),$s=r(Dl,"A",{href:!0,rel:!0});var Og=i($s);Gh=s(Og,"tf.keras.Model"),Og.forEach(t),Jh=s(Dl,` 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.`),Dl.forEach(t),Mh=h(Gt),b(Ho.$$.fragment,Gt),qh=h(Gt),$t=r(Gt,"DIV",{class:!0});var gn=i($t);b(Ps.$$.fragment,gn),Ah=h(gn),lo=r(gn,"P",{});var Za=i(lo);Ch=s(Za,"The "),Aa=r(Za,"A",{href:!0});var Ng=i(Aa);zh=s(Ng,"TFGPTJForCausalLM"),Ng.forEach(t),Ih=s(Za," forward method, overrides the "),Nr=r(Za,"CODE",{});var Dg=i(Nr);Lh=s(Dg,"__call__"),Dg.forEach(t),Oh=s(Za," special method."),Za.forEach(t),Nh=h(gn),b(Ko.$$.fragment,gn),Dh=h(gn),b(Ro.$$.fragment,gn),gn.forEach(t),Gt.forEach(t),pl=h(o),co=r(o,"H2",{class:!0});var Sl=i(co);Vo=r(Sl,"A",{id:!0,class:!0,href:!0});var Sg=i(Vo);Dr=r(Sg,"SPAN",{});var Wg=i(Dr);b(Fs.$$.fragment,Wg),Wg.forEach(t),Sg.forEach(t),Sh=h(Sl),Sr=r(Sl,"SPAN",{});var Ug=i(Sr);Wh=s(Ug,"TFGPTJForSequenceClassification"),Ug.forEach(t),Sl.forEach(t),hl=h(o),_e=r(o,"DIV",{class:!0});var Ze=i(_e);b(Es.$$.fragment,Ze),Uh=h(Ze),Wr=r(Ze,"P",{});var Bg=i(Wr);Bh=s(Bg,"The GPT-J Model transformer with a sequence classification head on top (linear layer)."),Bg.forEach(t),Qh=h(Ze),Ca=r(Ze,"P",{});var lm=i(Ca);za=r(lm,"A",{href:!0});var Qg=i(za);Hh=s(Qg,"GPTJForSequenceClassification"),Qg.forEach(t),Kh=s(lm,` uses the last token in order to do the classification, as other causal models
(e.g. GPT, GPT-2, GPT-Neo) do.`),lm.forEach(t),Rh=h(Ze),wt=r(Ze,"P",{});var Bt=i(wt);Vh=s(Bt,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Ur=r(Bt,"CODE",{});var Hg=i(Ur);Xh=s(Hg,"pad_token_id"),Hg.forEach(t),Yh=s(Bt,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Br=r(Bt,"CODE",{});var Kg=i(Br);Zh=s(Kg,"pad_token_id"),Kg.forEach(t),eu=s(Bt,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Qr=r(Bt,"CODE",{});var Rg=i(Qr);tu=s(Rg,"inputs_embeds"),Rg.forEach(t),ou=s(Bt," are passed instead of "),Hr=r(Bt,"CODE",{});var Vg=i(Hr);nu=s(Vg,"input_ids"),Vg.forEach(t),su=s(Bt,`, it does the same (take the last value in
each row of the batch).`),Bt.forEach(t),au=h(Ze),js=r(Ze,"P",{});var Wl=i(js);ru=s(Wl,"This model inherits from "),Ia=r(Wl,"A",{href:!0});var Xg=i(Ia);iu=s(Xg,"TFPreTrainedModel"),Xg.forEach(t),lu=s(Wl,`. 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.)`),Wl.forEach(t),du=h(Ze),xs=r(Ze,"P",{});var Ul=i(xs);cu=s(Ul,"This model is also a "),Gs=r(Ul,"A",{href:!0,rel:!0});var Yg=i(Gs);pu=s(Yg,"tf.keras.Model"),Yg.forEach(t),hu=s(Ul,` 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.`),Ul.forEach(t),uu=h(Ze),b(Xo.$$.fragment,Ze),fu=h(Ze),pt=r(Ze,"DIV",{class:!0});var Qt=i(pt);b(Js.$$.fragment,Qt),mu=h(Qt),po=r(Qt,"P",{});var er=i(po);gu=s(er,"The "),La=r(er,"A",{href:!0});var Zg=i(La);_u=s(Zg,"TFGPTJForSequenceClassification"),Zg.forEach(t),Tu=s(er," forward method, overrides the "),Kr=r(er,"CODE",{});var e_=i(Kr);yu=s(e_,"__call__"),e_.forEach(t),vu=s(er," special method."),er.forEach(t),wu=h(Qt),b(Yo.$$.fragment,Qt),bu=h(Qt),b(Zo.$$.fragment,Qt),ku=h(Qt),b(en.$$.fragment,Qt),Qt.forEach(t),Ze.forEach(t),ul=h(o),ho=r(o,"H2",{class:!0});var Bl=i(ho);tn=r(Bl,"A",{id:!0,class:!0,href:!0});var t_=i(tn);Rr=r(t_,"SPAN",{});var o_=i(Rr);b(Ms.$$.fragment,o_),o_.forEach(t),t_.forEach(t),$u=h(Bl),Vr=r(Bl,"SPAN",{});var n_=i(Vr);Pu=s(n_,"TFGPTJForQuestionAnswering"),n_.forEach(t),Bl.forEach(t),fl=h(o),Ke=r(o,"DIV",{class:!0});var Jt=i(Ke);b(qs.$$.fragment,Jt),Fu=h(Jt),uo=r(Jt,"P",{});var tr=i(uo);Eu=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 `),Xr=r(tr,"CODE",{});var s_=i(Xr);ju=s(s_,"span start logits"),s_.forEach(t),xu=s(tr," and "),Yr=r(tr,"CODE",{});var a_=i(Yr);Gu=s(a_,"span end logits"),a_.forEach(t),Ju=s(tr,")."),tr.forEach(t),Mu=h(Jt),As=r(Jt,"P",{});var Ql=i(As);qu=s(Ql,"This model inherits from "),Oa=r(Ql,"A",{href:!0});var r_=i(Oa);Au=s(r_,"TFPreTrainedModel"),r_.forEach(t),Cu=s(Ql,`. 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.)`),Ql.forEach(t),zu=h(Jt),Cs=r(Jt,"P",{});var Hl=i(Cs);Iu=s(Hl,"This model is also a "),zs=r(Hl,"A",{href:!0,rel:!0});var i_=i(zs);Lu=s(i_,"tf.keras.Model"),i_.forEach(t),Ou=s(Hl,` 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.`),Hl.forEach(t),Nu=h(Jt),b(on.$$.fragment,Jt),Du=h(Jt),ht=r(Jt,"DIV",{class:!0});var Ht=i(ht);b(Is.$$.fragment,Ht),Su=h(Ht),fo=r(Ht,"P",{});var or=i(fo);Wu=s(or,"The "),Na=r(or,"A",{href:!0});var l_=i(Na);Uu=s(l_,"TFGPTJForQuestionAnswering"),l_.forEach(t),Bu=s(or," forward method, overrides the "),Zr=r(or,"CODE",{});var d_=i(Zr);Qu=s(d_,"__call__"),d_.forEach(t),Hu=s(or," special method."),or.forEach(t),Ku=h(Ht),b(nn.$$.fragment,Ht),Ru=h(Ht),b(sn.$$.fragment,Ht),Vu=h(Ht),b(an.$$.fragment,Ht),Ht.forEach(t),Jt.forEach(t),ml=h(o),mo=r(o,"H2",{class:!0});var Kl=i(mo);rn=r(Kl,"A",{id:!0,class:!0,href:!0});var c_=i(rn);ei=r(c_,"SPAN",{});var p_=i(ei);b(Ls.$$.fragment,p_),p_.forEach(t),c_.forEach(t),Xu=h(Kl),ti=r(Kl,"SPAN",{});var h_=i(ti);Yu=s(h_,"FlaxGPTJModel"),h_.forEach(t),Kl.forEach(t),gl=h(o),Ne=r(o,"DIV",{class:!0});var ut=i(Ne);b(Os.$$.fragment,ut),Zu=h(ut),oi=r(ut,"P",{});var u_=i(oi);ef=s(u_,"The bare GPTJ Model transformer outputting raw hidden-states without any specific head on top."),u_.forEach(t),tf=h(ut),Ns=r(ut,"P",{});var Rl=i(Ns);of=s(Rl,"This model inherits from "),Da=r(Rl,"A",{href:!0});var f_=i(Da);nf=s(f_,"FlaxPreTrainedModel"),f_.forEach(t),sf=s(Rl,`. 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.)`),Rl.forEach(t),af=h(ut),Ds=r(ut,"P",{});var Vl=i(Ds);rf=s(Vl,`This model is also a Flax Linen
`),Ss=r(Vl,"A",{href:!0,rel:!0});var m_=i(Ss);lf=s(m_,"flax.nn.Module"),m_.forEach(t),df=s(Vl,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Vl.forEach(t),cf=h(ut),ni=r(ut,"P",{});var g_=i(ni);pf=s(g_,"Finally, this model supports inherent JAX features such as:"),g_.forEach(t),hf=h(ut),At=r(ut,"UL",{});var _n=i(At);si=r(_n,"LI",{});var __=i(si);Ws=r(__,"A",{href:!0,rel:!0});var T_=i(Ws);uf=s(T_,"Just-In-Time (JIT) compilation"),T_.forEach(t),__.forEach(t),ff=h(_n),ai=r(_n,"LI",{});var y_=i(ai);Us=r(y_,"A",{href:!0,rel:!0});var v_=i(Us);mf=s(v_,"Automatic Differentiation"),v_.forEach(t),y_.forEach(t),gf=h(_n),ri=r(_n,"LI",{});var w_=i(ri);Bs=r(w_,"A",{href:!0,rel:!0});var b_=i(Bs);_f=s(b_,"Vectorization"),b_.forEach(t),w_.forEach(t),Tf=h(_n),ii=r(_n,"LI",{});var k_=i(ii);Qs=r(k_,"A",{href:!0,rel:!0});var $_=i(Qs);yf=s($_,"Parallelization"),$_.forEach(t),k_.forEach(t),_n.forEach(t),vf=h(ut),Pt=r(ut,"DIV",{class:!0});var Tn=i(Pt);b(Hs.$$.fragment,Tn),wf=h(Tn),go=r(Tn,"P",{});var nr=i(go);bf=s(nr,"The "),li=r(nr,"CODE",{});var P_=i(li);kf=s(P_,"FlaxGPTJPreTrainedModel"),P_.forEach(t),$f=s(nr," forward method, overrides the "),di=r(nr,"CODE",{});var F_=i(di);Pf=s(F_,"__call__"),F_.forEach(t),Ff=s(nr," special method."),nr.forEach(t),Ef=h(Tn),b(ln.$$.fragment,Tn),jf=h(Tn),b(dn.$$.fragment,Tn),Tn.forEach(t),ut.forEach(t),_l=h(o),_o=r(o,"H2",{class:!0});var Xl=i(_o);cn=r(Xl,"A",{id:!0,class:!0,href:!0});var E_=i(cn);ci=r(E_,"SPAN",{});var j_=i(ci);b(Ks.$$.fragment,j_),j_.forEach(t),E_.forEach(t),xf=h(Xl),pi=r(Xl,"SPAN",{});var x_=i(pi);Gf=s(x_,"FlaxGPTJForCausalLM"),x_.forEach(t),Xl.forEach(t),Tl=h(o),De=r(o,"DIV",{class:!0});var ft=i(De);b(Rs.$$.fragment,ft),Jf=h(ft),hi=r(ft,"P",{});var G_=i(hi);Mf=s(G_,"The GPTJ Model transformer with a language modeling head on top."),G_.forEach(t),qf=h(ft),Vs=r(ft,"P",{});var Yl=i(Vs);Af=s(Yl,"This model inherits from "),Sa=r(Yl,"A",{href:!0});var J_=i(Sa);Cf=s(J_,"FlaxPreTrainedModel"),J_.forEach(t),zf=s(Yl,`. 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.)`),Yl.forEach(t),If=h(ft),Xs=r(ft,"P",{});var Zl=i(Xs);Lf=s(Zl,`This model is also a Flax Linen
`),Ys=r(Zl,"A",{href:!0,rel:!0});var M_=i(Ys);Of=s(M_,"flax.nn.Module"),M_.forEach(t),Nf=s(Zl,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Zl.forEach(t),Df=h(ft),ui=r(ft,"P",{});var q_=i(ui);Sf=s(q_,"Finally, this model supports inherent JAX features such as:"),q_.forEach(t),Wf=h(ft),Ct=r(ft,"UL",{});var yn=i(Ct);fi=r(yn,"LI",{});var A_=i(fi);Zs=r(A_,"A",{href:!0,rel:!0});var C_=i(Zs);Uf=s(C_,"Just-In-Time (JIT) compilation"),C_.forEach(t),A_.forEach(t),Bf=h(yn),mi=r(yn,"LI",{});var z_=i(mi);ea=r(z_,"A",{href:!0,rel:!0});var I_=i(ea);Qf=s(I_,"Automatic Differentiation"),I_.forEach(t),z_.forEach(t),Hf=h(yn),gi=r(yn,"LI",{});var L_=i(gi);ta=r(L_,"A",{href:!0,rel:!0});var O_=i(ta);Kf=s(O_,"Vectorization"),O_.forEach(t),L_.forEach(t),Rf=h(yn),_i=r(yn,"LI",{});var N_=i(_i);oa=r(N_,"A",{href:!0,rel:!0});var D_=i(oa);Vf=s(D_,"Parallelization"),D_.forEach(t),N_.forEach(t),yn.forEach(t),Xf=h(ft),Ft=r(ft,"DIV",{class:!0});var vn=i(Ft);b(na.$$.fragment,vn),Yf=h(vn),To=r(vn,"P",{});var sr=i(To);Zf=s(sr,"The "),Ti=r(sr,"CODE",{});var S_=i(Ti);em=s(S_,"FlaxGPTJPreTrainedModel"),S_.forEach(t),tm=s(sr," forward method, overrides the "),yi=r(sr,"CODE",{});var W_=i(yi);om=s(W_,"__call__"),W_.forEach(t),nm=s(sr," special method."),sr.forEach(t),sm=h(vn),b(pn.$$.fragment,vn),am=h(vn),b(hn.$$.fragment,vn),vn.forEach(t),ft.forEach(t),this.h()},h(){f(d,"name","hf:doc:metadata"),f(d,"content",JSON.stringify(xT)),f(m,"id","gptj"),f(m,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(m,"href","#gptj"),f(u,"class","relative group"),f(N,"id","overview"),f(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"),f(N,"href","#overview"),f(A,"class","relative group"),f(re,"href","https://github.com/kingoflolz/mesh-transformer-jax"),f(re,"rel","nofollow"),f(ie,"href","https://pile.eleuther.ai/"),f(ie,"rel","nofollow"),f(le,"href","https://huggingface.co/stellaathena"),f(le,"rel","nofollow"),f(ce,"href","https://huggingface.co/EleutherAI/gpt-j-6B"),f(ce,"rel","nofollow"),f(ee,"href","https://github.com/kingoflolz/mesh-transformer-jax/blob/master/howto_finetune.md"),f(ee,"rel","nofollow"),f(v,"href","https://huggingface.co/EleutherAI/gpt-j-6B"),f(v,"rel","nofollow"),f(ke,"id","generation"),f(ke,"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"),f(ke,"href","#generation"),f(ge,"class","relative group"),f(Se,"href","/docs/transformers/v4.29.0/en/main_classes/text_generation#transformers.GenerationMixin.generate"),f(bo,"id","resources"),f(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"),f(bo,"href","#resources"),f(Kt,"class","relative group"),f(Fn,"href","https://huggingface.co/EleutherAI/gpt-j-6B"),f(Fn,"rel","nofollow"),f(jn,"href","https://huggingface.co/blog/gptj-sagemaker"),f(jn,"rel","nofollow"),f(Gn,"href","https://www.philschmid.de/gptj-deepspeed-inference"),f(Gn,"rel","nofollow"),f(Mn,"href","https://arankomatsuzaki.wordpress.com/2021/06/04/gpt-j/"),f(Mn,"rel","nofollow"),f(An,"href","https://colab.research.google.com/github/kingoflolz/mesh-transformer-jax/blob/master/colab_demo.ipynb"),f(An,"rel","nofollow"),f(zn,"href","https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/GPT-J-6B/Inference_with_GPT_J_6B.ipynb"),f(zn,"rel","nofollow"),f(In,"href","https://huggingface.co/course/en/chapter7/6?fw=pt#training-a-causal-language-model-from-scratch"),f(In,"rel","nofollow"),f(ma,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.GPTJForCausalLM"),f(Ln,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#gpt-2gpt-and-causal-language-modeling"),f(Ln,"rel","nofollow"),f(On,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-generation"),f(On,"rel","nofollow"),f(Nn,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb"),f(Nn,"rel","nofollow"),f(ga,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.TFGPTJForCausalLM"),f(Dn,"href","https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_clmpy"),f(Dn,"rel","nofollow"),f(Sn,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb"),f(Sn,"rel","nofollow"),f(_a,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.FlaxGPTJForCausalLM"),f(Wn,"href","https://github.com/huggingface/transformers/tree/main/examples/flax/language-modeling#causal-language-modeling"),f(Wn,"rel","nofollow"),f(Un,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/causal_language_modeling_flax.ipynb"),f(Un,"rel","nofollow"),f(ya,"href","../tasks/sequence_classification"),f(va,"href","../tasks/question_answering"),f(wa,"href","../tasks/language_modeling"),f(ko,"id","transformers.GPTJConfig"),f(ko,"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"),f(ko,"href","#transformers.GPTJConfig"),f(Rt,"class","relative group"),f(ba,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.GPTJModel"),f(Hn,"href","https://huggingface.co/EleutherAI/gpt-j-6B"),f(Hn,"rel","nofollow"),f(ka,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),f($a,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),f(Mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Po,"id","transformers.GPTJModel"),f(Po,"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"),f(Po,"href","#transformers.GPTJModel"),f(Vt,"class","relative group"),f(Xn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),f(Xn,"rel","nofollow"),f(Pa,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.GPTJModel"),f(lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(qt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(xo,"id","transformers.GPTJForCausalLM"),f(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"),f(xo,"href","#transformers.GPTJForCausalLM"),f(Yt,"class","relative group"),f(os,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),f(os,"rel","nofollow"),f(Fa,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.GPTJForCausalLM"),f(dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(qo,"id","transformers.GPTJForSequenceClassification"),f(qo,"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"),f(qo,"href","#transformers.GPTJForSequenceClassification"),f(eo,"class","relative group"),f(ja,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.GPTJForSequenceClassification"),f(is,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),f(is,"rel","nofollow"),f(xa,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.GPTJForSequenceClassification"),f(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Lo,"id","transformers.GPTJForQuestionAnswering"),f(Lo,"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"),f(Lo,"href","#transformers.GPTJForQuestionAnswering"),f(oo,"class","relative group"),f(hs,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),f(hs,"rel","nofollow"),f(Ga,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.GPTJForQuestionAnswering"),f(ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(vt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(So,"id","transformers.TFGPTJModel"),f(So,"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"),f(So,"href","#transformers.TFGPTJModel"),f(ao,"class","relative group"),f(Ja,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),f(Ts,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),f(Ts,"rel","nofollow"),f(Ma,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.TFGPTJModel"),f(kt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Qo,"id","transformers.TFGPTJForCausalLM"),f(Qo,"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"),f(Qo,"href","#transformers.TFGPTJForCausalLM"),f(io,"class","relative group"),f(qa,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),f($s,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),f($s,"rel","nofollow"),f(Aa,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.TFGPTJForCausalLM"),f($t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(He,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Vo,"id","transformers.TFGPTJForSequenceClassification"),f(Vo,"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"),f(Vo,"href","#transformers.TFGPTJForSequenceClassification"),f(co,"class","relative group"),f(za,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.GPTJForSequenceClassification"),f(Ia,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),f(Gs,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),f(Gs,"rel","nofollow"),f(La,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.TFGPTJForSequenceClassification"),f(pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(tn,"id","transformers.TFGPTJForQuestionAnswering"),f(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"),f(tn,"href","#transformers.TFGPTJForQuestionAnswering"),f(ho,"class","relative group"),f(Oa,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),f(zs,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),f(zs,"rel","nofollow"),f(Na,"href","/docs/transformers/v4.29.0/en/model_doc/gptj#transformers.TFGPTJForQuestionAnswering"),f(ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(rn,"id","transformers.FlaxGPTJModel"),f(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"),f(rn,"href","#transformers.FlaxGPTJModel"),f(mo,"class","relative group"),f(Da,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.FlaxPreTrainedModel"),f(Ss,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),f(Ss,"rel","nofollow"),f(Ws,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),f(Ws,"rel","nofollow"),f(Us,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),f(Us,"rel","nofollow"),f(Bs,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),f(Bs,"rel","nofollow"),f(Qs,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),f(Qs,"rel","nofollow"),f(Pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(cn,"id","transformers.FlaxGPTJForCausalLM"),f(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"),f(cn,"href","#transformers.FlaxGPTJForCausalLM"),f(_o,"class","relative group"),f(Sa,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.FlaxPreTrainedModel"),f(Ys,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),f(Ys,"rel","nofollow"),f(Zs,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),f(Zs,"rel","nofollow"),f(ea,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),f(ea,"rel","nofollow"),f(ta,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),f(ta,"rel","nofollow"),f(oa,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),f(oa,"rel","nofollow"),f(Ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(De,"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,m),e(m,T),k(l,T,null),e(u,c),e(u,E),e(E,C),g(o,M,_),g(o,A,_),e(A,N),e(N,ne),k(j,ne,null),e(A,Fe),e(A,K),e(K,Ee),g(o,ye,_),g(o,S,_),e(S,je),e(S,re),e(re,X),e(S,xe),e(S,ie),e(ie,Y),e(S,Ge),g(o,ve,_),g(o,B,_),e(B,Je),e(B,le),e(le,de),e(B,q),g(o,z,_),g(o,ue,_),e(ue,Z),g(o,we,_),g(o,fe,_),e(fe,W),e(W,Me),e(W,ce),e(ce,I),e(W,qe),e(W,R),e(R,Ae),e(W,Ce),g(o,V,_),k(pe,o,_),g(o,be,_),g(o,D,_),e(D,me),e(me,H),e(H,ze),e(H,ee),e(ee,L),e(D,Ie),e(D,O),e(O,te),e(te,Le),e(te,v),e(v,G),e(te,et),e(te,se),e(se,tt),e(te,ot),e(te,J),e(J,nt),e(te,st),g(o,Ve,_),g(o,ge,_),e(ge,ke),e(ke,U),k(Q,U,null),e(ge,at),e(ge,Ue),e(Ue,oe),g(o,Xe,_),g(o,$e,_),e($e,Oe),e($e,Se),e(Se,he),e($e,rt),g(o,Si,_),k(wn,o,_),g(o,Wi,_),g(o,ha,_),e(ha,ed),g(o,Ui,_),k(bn,o,_),g(o,Bi,_),g(o,Kt,_),e(Kt,bo),e(bo,ar),k(kn,ar,null),e(Kt,td),e(Kt,rr),e(rr,od),g(o,Qi,_),g(o,ua,_),e(ua,nd),g(o,Hi,_),k($n,o,_),g(o,Ki,_),g(o,ae,_),e(ae,Pn),e(Pn,sd),e(Pn,Fn),e(Fn,ad),e(Pn,rd),e(ae,id),e(ae,En),e(En,ld),e(En,jn),e(jn,dd),e(En,cd),e(ae,pd),e(ae,xn),e(xn,hd),e(xn,Gn),e(Gn,ud),e(xn,fd),e(ae,md),e(ae,Jn),e(Jn,gd),e(Jn,Mn),e(Mn,_d),e(Jn,Td),e(ae,yd),e(ae,qn),e(qn,vd),e(qn,An),e(An,wd),e(qn,bd),e(ae,kd),e(ae,Cn),e(Cn,$d),e(Cn,zn),e(zn,Pd),e(Cn,Fd),e(ae,Ed),e(ae,fa),e(fa,In),e(In,jd),e(fa,xd),e(ae,Gd),e(ae,bt),e(bt,ma),e(ma,Jd),e(bt,Md),e(bt,Ln),e(Ln,qd),e(bt,Ad),e(bt,On),e(On,Cd),e(bt,zd),e(bt,Nn),e(Nn,Id),e(bt,Ld),e(ae,Od),e(ae,It),e(It,ga),e(ga,Nd),e(It,Dd),e(It,Dn),e(Dn,Sd),e(It,Wd),e(It,Sn),e(Sn,Ud),e(It,Bd),e(ae,Qd),e(ae,Lt),e(Lt,_a),e(_a,Hd),e(Lt,Kd),e(Lt,Wn),e(Wn,Rd),e(Lt,Vd),e(Lt,Un),e(Un,Xd),e(Lt,Yd),g(o,Ri,_),g(o,Ta,_),e(Ta,ir),e(ir,Zd),g(o,Vi,_),g(o,Ot,_),e(Ot,lr),e(lr,ya),e(ya,ec),e(Ot,tc),e(Ot,dr),e(dr,va),e(va,oc),e(Ot,nc),e(Ot,cr),e(cr,wa),e(wa,sc),g(o,Xi,_),g(o,Rt,_),e(Rt,ko),e(ko,pr),k(Bn,pr,null),e(Rt,ac),e(Rt,hr),e(hr,rc),g(o,Yi,_),g(o,Mt,_),k(Qn,Mt,null),e(Mt,ic),e(Mt,_t),e(_t,lc),e(_t,ba),e(ba,dc),e(_t,cc),e(_t,Hn),e(Hn,pc),e(_t,hc),e(_t,ka),e(ka,uc),e(_t,fc),e(_t,$a),e($a,mc),e(_t,gc),e(Mt,_c),k($o,Mt,null),g(o,Zi,_),g(o,Vt,_),e(Vt,Po),e(Po,ur),k(Kn,ur,null),e(Vt,Tc),e(Vt,fr),e(fr,yc),g(o,el,_),g(o,qt,_),k(Rn,qt,null),e(qt,vc),e(qt,Vn),e(Vn,wc),e(Vn,Xn),e(Xn,bc),e(Vn,kc),e(qt,$c),e(qt,lt),k(Yn,lt,null),e(lt,Pc),e(lt,Xt),e(Xt,Fc),e(Xt,Pa),e(Pa,Ec),e(Xt,jc),e(Xt,mr),e(mr,xc),e(Xt,Gc),e(lt,Jc),k(Fo,lt,null),e(lt,Mc),k(Eo,lt,null),e(lt,qc),k(jo,lt,null),g(o,tl,_),g(o,Yt,_),e(Yt,xo),e(xo,gr),k(Zn,gr,null),e(Yt,Ac),e(Yt,_r),e(_r,Cc),g(o,ol,_),g(o,Tt,_),k(es,Tt,null),e(Tt,zc),e(Tt,Tr),e(Tr,Ic),e(Tt,Lc),e(Tt,ts),e(ts,Oc),e(ts,os),e(os,Nc),e(ts,Dc),e(Tt,Sc),e(Tt,dt),k(ns,dt,null),e(dt,Wc),e(dt,Zt),e(Zt,Uc),e(Zt,Fa),e(Fa,Bc),e(Zt,Qc),e(Zt,yr),e(yr,Hc),e(Zt,Kc),e(dt,Rc),k(Go,dt,null),e(dt,Vc),k(Jo,dt,null),e(dt,Xc),k(Mo,dt,null),g(o,nl,_),g(o,eo,_),e(eo,qo),e(qo,vr),k(ss,vr,null),e(eo,Yc),e(eo,wr),e(wr,Zc),g(o,sl,_),g(o,Be,_),k(as,Be,null),e(Be,ep),e(Be,br),e(br,tp),e(Be,op),e(Be,Ea),e(Ea,ja),e(ja,np),e(Ea,sp),e(Be,ap),e(Be,yt),e(yt,rp),e(yt,kr),e(kr,ip),e(yt,lp),e(yt,$r),e($r,dp),e(yt,cp),e(yt,Pr),e(Pr,pp),e(yt,hp),e(yt,Fr),e(Fr,up),e(yt,fp),e(Be,mp),e(Be,rs),e(rs,gp),e(rs,is),e(is,_p),e(rs,Tp),e(Be,yp),e(Be,Ye),k(ls,Ye,null),e(Ye,vp),e(Ye,to),e(to,wp),e(to,xa),e(xa,bp),e(to,kp),e(to,Er),e(Er,$p),e(to,Pp),e(Ye,Fp),k(Ao,Ye,null),e(Ye,Ep),k(Co,Ye,null),e(Ye,jp),k(zo,Ye,null),e(Ye,xp),k(Io,Ye,null),g(o,al,_),g(o,oo,_),e(oo,Lo),e(Lo,jr),k(ds,jr,null),e(oo,Gp),e(oo,xr),e(xr,Jp),g(o,rl,_),g(o,vt,_),k(cs,vt,null),e(vt,Mp),e(vt,no),e(no,qp),e(no,Gr),e(Gr,Ap),e(no,Cp),e(no,Jr),e(Jr,zp),e(no,Ip),e(vt,Lp),e(vt,ps),e(ps,Op),e(ps,hs),e(hs,Np),e(ps,Dp),e(vt,Sp),e(vt,ct),k(us,ct,null),e(ct,Wp),e(ct,so),e(so,Up),e(so,Ga),e(Ga,Bp),e(so,Qp),e(so,Mr),e(Mr,Hp),e(so,Kp),e(ct,Rp),k(Oo,ct,null),e(ct,Vp),k(No,ct,null),e(ct,Xp),k(Do,ct,null),g(o,il,_),g(o,ao,_),e(ao,So),e(So,qr),k(fs,qr,null),e(ao,Yp),e(ao,Ar),e(Ar,Zp),g(o,ll,_),g(o,Qe,_),k(ms,Qe,null),e(Qe,eh),e(Qe,Cr),e(Cr,th),e(Qe,oh),e(Qe,gs),e(gs,nh),e(gs,Ja),e(Ja,sh),e(gs,ah),e(Qe,rh),e(Qe,_s),e(_s,ih),e(_s,Ts),e(Ts,lh),e(_s,dh),e(Qe,ch),k(Wo,Qe,null),e(Qe,ph),e(Qe,kt),k(ys,kt,null),e(kt,hh),e(kt,ro),e(ro,uh),e(ro,Ma),e(Ma,fh),e(ro,mh),e(ro,zr),e(zr,gh),e(ro,_h),e(kt,Th),k(Uo,kt,null),e(kt,yh),k(Bo,kt,null),g(o,dl,_),g(o,io,_),e(io,Qo),e(Qo,Ir),k(vs,Ir,null),e(io,vh),e(io,Lr),e(Lr,wh),g(o,cl,_),g(o,He,_),k(ws,He,null),e(He,bh),e(He,Or),e(Or,kh),e(He,$h),e(He,bs),e(bs,Ph),e(bs,qa),e(qa,Fh),e(bs,Eh),e(He,jh),e(He,ks),e(ks,xh),e(ks,$s),e($s,Gh),e(ks,Jh),e(He,Mh),k(Ho,He,null),e(He,qh),e(He,$t),k(Ps,$t,null),e($t,Ah),e($t,lo),e(lo,Ch),e(lo,Aa),e(Aa,zh),e(lo,Ih),e(lo,Nr),e(Nr,Lh),e(lo,Oh),e($t,Nh),k(Ko,$t,null),e($t,Dh),k(Ro,$t,null),g(o,pl,_),g(o,co,_),e(co,Vo),e(Vo,Dr),k(Fs,Dr,null),e(co,Sh),e(co,Sr),e(Sr,Wh),g(o,hl,_),g(o,_e,_),k(Es,_e,null),e(_e,Uh),e(_e,Wr),e(Wr,Bh),e(_e,Qh),e(_e,Ca),e(Ca,za),e(za,Hh),e(Ca,Kh),e(_e,Rh),e(_e,wt),e(wt,Vh),e(wt,Ur),e(Ur,Xh),e(wt,Yh),e(wt,Br),e(Br,Zh),e(wt,eu),e(wt,Qr),e(Qr,tu),e(wt,ou),e(wt,Hr),e(Hr,nu),e(wt,su),e(_e,au),e(_e,js),e(js,ru),e(js,Ia),e(Ia,iu),e(js,lu),e(_e,du),e(_e,xs),e(xs,cu),e(xs,Gs),e(Gs,pu),e(xs,hu),e(_e,uu),k(Xo,_e,null),e(_e,fu),e(_e,pt),k(Js,pt,null),e(pt,mu),e(pt,po),e(po,gu),e(po,La),e(La,_u),e(po,Tu),e(po,Kr),e(Kr,yu),e(po,vu),e(pt,wu),k(Yo,pt,null),e(pt,bu),k(Zo,pt,null),e(pt,ku),k(en,pt,null),g(o,ul,_),g(o,ho,_),e(ho,tn),e(tn,Rr),k(Ms,Rr,null),e(ho,$u),e(ho,Vr),e(Vr,Pu),g(o,fl,_),g(o,Ke,_),k(qs,Ke,null),e(Ke,Fu),e(Ke,uo),e(uo,Eu),e(uo,Xr),e(Xr,ju),e(uo,xu),e(uo,Yr),e(Yr,Gu),e(uo,Ju),e(Ke,Mu),e(Ke,As),e(As,qu),e(As,Oa),e(Oa,Au),e(As,Cu),e(Ke,zu),e(Ke,Cs),e(Cs,Iu),e(Cs,zs),e(zs,Lu),e(Cs,Ou),e(Ke,Nu),k(on,Ke,null),e(Ke,Du),e(Ke,ht),k(Is,ht,null),e(ht,Su),e(ht,fo),e(fo,Wu),e(fo,Na),e(Na,Uu),e(fo,Bu),e(fo,Zr),e(Zr,Qu),e(fo,Hu),e(ht,Ku),k(nn,ht,null),e(ht,Ru),k(sn,ht,null),e(ht,Vu),k(an,ht,null),g(o,ml,_),g(o,mo,_),e(mo,rn),e(rn,ei),k(Ls,ei,null),e(mo,Xu),e(mo,ti),e(ti,Yu),g(o,gl,_),g(o,Ne,_),k(Os,Ne,null),e(Ne,Zu),e(Ne,oi),e(oi,ef),e(Ne,tf),e(Ne,Ns),e(Ns,of),e(Ns,Da),e(Da,nf),e(Ns,sf),e(Ne,af),e(Ne,Ds),e(Ds,rf),e(Ds,Ss),e(Ss,lf),e(Ds,df),e(Ne,cf),e(Ne,ni),e(ni,pf),e(Ne,hf),e(Ne,At),e(At,si),e(si,Ws),e(Ws,uf),e(At,ff),e(At,ai),e(ai,Us),e(Us,mf),e(At,gf),e(At,ri),e(ri,Bs),e(Bs,_f),e(At,Tf),e(At,ii),e(ii,Qs),e(Qs,yf),e(Ne,vf),e(Ne,Pt),k(Hs,Pt,null),e(Pt,wf),e(Pt,go),e(go,bf),e(go,li),e(li,kf),e(go,$f),e(go,di),e(di,Pf),e(go,Ff),e(Pt,Ef),k(ln,Pt,null),e(Pt,jf),k(dn,Pt,null),g(o,_l,_),g(o,_o,_),e(_o,cn),e(cn,ci),k(Ks,ci,null),e(_o,xf),e(_o,pi),e(pi,Gf),g(o,Tl,_),g(o,De,_),k(Rs,De,null),e(De,Jf),e(De,hi),e(hi,Mf),e(De,qf),e(De,Vs),e(Vs,Af),e(Vs,Sa),e(Sa,Cf),e(Vs,zf),e(De,If),e(De,Xs),e(Xs,Lf),e(Xs,Ys),e(Ys,Of),e(Xs,Nf),e(De,Df),e(De,ui),e(ui,Sf),e(De,Wf),e(De,Ct),e(Ct,fi),e(fi,Zs),e(Zs,Uf),e(Ct,Bf),e(Ct,mi),e(mi,ea),e(ea,Qf),e(Ct,Hf),e(Ct,gi),e(gi,ta),e(ta,Kf),e(Ct,Rf),e(Ct,_i),e(_i,oa),e(oa,Vf),e(De,Xf),e(De,Ft),k(na,Ft,null),e(Ft,Yf),e(Ft,To),e(To,Zf),e(To,Ti),e(Ti,em),e(To,tm),e(To,yi),e(yi,om),e(To,nm),e(Ft,sm),k(pn,Ft,null),e(Ft,am),k(hn,Ft,null),yl=!0},p(o,[_]){const sa={};_&2&&(sa.$$scope={dirty:_,ctx:o}),$o.$set(sa);const vi={};_&2&&(vi.$$scope={dirty:_,ctx:o}),Fo.$set(vi);const wi={};_&2&&(wi.$$scope={dirty:_,ctx:o}),Eo.$set(wi);const bi={};_&2&&(bi.$$scope={dirty:_,ctx:o}),jo.$set(bi);const aa={};_&2&&(aa.$$scope={dirty:_,ctx:o}),Go.$set(aa);const ki={};_&2&&(ki.$$scope={dirty:_,ctx:o}),Jo.$set(ki);const $i={};_&2&&($i.$$scope={dirty:_,ctx:o}),Mo.$set($i);const Pi={};_&2&&(Pi.$$scope={dirty:_,ctx:o}),Ao.$set(Pi);const yo={};_&2&&(yo.$$scope={dirty:_,ctx:o}),Co.$set(yo);const Fi={};_&2&&(Fi.$$scope={dirty:_,ctx:o}),zo.$set(Fi);const Ei={};_&2&&(Ei.$$scope={dirty:_,ctx:o}),Io.$set(Ei);const ra={};_&2&&(ra.$$scope={dirty:_,ctx:o}),Oo.$set(ra);const ji={};_&2&&(ji.$$scope={dirty:_,ctx:o}),No.$set(ji);const xi={};_&2&&(xi.$$scope={dirty:_,ctx:o}),Do.$set(xi);const Gi={};_&2&&(Gi.$$scope={dirty:_,ctx:o}),Wo.$set(Gi);const vo={};_&2&&(vo.$$scope={dirty:_,ctx:o}),Uo.$set(vo);const Ji={};_&2&&(Ji.$$scope={dirty:_,ctx:o}),Bo.$set(Ji);const Mi={};_&2&&(Mi.$$scope={dirty:_,ctx:o}),Ho.$set(Mi);const ia={};_&2&&(ia.$$scope={dirty:_,ctx:o}),Ko.$set(ia);const qi={};_&2&&(qi.$$scope={dirty:_,ctx:o}),Ro.$set(qi);const Wa={};_&2&&(Wa.$$scope={dirty:_,ctx:o}),Xo.$set(Wa);const Ai={};_&2&&(Ai.$$scope={dirty:_,ctx:o}),Yo.$set(Ai);const Ci={};_&2&&(Ci.$$scope={dirty:_,ctx:o}),Zo.$set(Ci);const zt={};_&2&&(zt.$$scope={dirty:_,ctx:o}),en.$set(zt);const zi={};_&2&&(zi.$$scope={dirty:_,ctx:o}),on.$set(zi);const Ii={};_&2&&(Ii.$$scope={dirty:_,ctx:o}),nn.$set(Ii);const Li={};_&2&&(Li.$$scope={dirty:_,ctx:o}),sn.$set(Li);const la={};_&2&&(la.$$scope={dirty:_,ctx:o}),an.$set(la);const Oi={};_&2&&(Oi.$$scope={dirty:_,ctx:o}),ln.$set(Oi);const Ni={};_&2&&(Ni.$$scope={dirty:_,ctx:o}),dn.$set(Ni);const Di={};_&2&&(Di.$$scope={dirty:_,ctx:o}),pn.$set(Di);const da={};_&2&&(da.$$scope={dirty:_,ctx:o}),hn.$set(da)},i(o){yl||($(l.$$.fragment,o),$(j.$$.fragment,o),$(pe.$$.fragment,o),$(Q.$$.fragment,o),$(wn.$$.fragment,o),$(bn.$$.fragment,o),$(kn.$$.fragment,o),$($n.$$.fragment,o),$(Bn.$$.fragment,o),$(Qn.$$.fragment,o),$($o.$$.fragment,o),$(Kn.$$.fragment,o),$(Rn.$$.fragment,o),$(Yn.$$.fragment,o),$(Fo.$$.fragment,o),$(Eo.$$.fragment,o),$(jo.$$.fragment,o),$(Zn.$$.fragment,o),$(es.$$.fragment,o),$(ns.$$.fragment,o),$(Go.$$.fragment,o),$(Jo.$$.fragment,o),$(Mo.$$.fragment,o),$(ss.$$.fragment,o),$(as.$$.fragment,o),$(ls.$$.fragment,o),$(Ao.$$.fragment,o),$(Co.$$.fragment,o),$(zo.$$.fragment,o),$(Io.$$.fragment,o),$(ds.$$.fragment,o),$(cs.$$.fragment,o),$(us.$$.fragment,o),$(Oo.$$.fragment,o),$(No.$$.fragment,o),$(Do.$$.fragment,o),$(fs.$$.fragment,o),$(ms.$$.fragment,o),$(Wo.$$.fragment,o),$(ys.$$.fragment,o),$(Uo.$$.fragment,o),$(Bo.$$.fragment,o),$(vs.$$.fragment,o),$(ws.$$.fragment,o),$(Ho.$$.fragment,o),$(Ps.$$.fragment,o),$(Ko.$$.fragment,o),$(Ro.$$.fragment,o),$(Fs.$$.fragment,o),$(Es.$$.fragment,o),$(Xo.$$.fragment,o),$(Js.$$.fragment,o),$(Yo.$$.fragment,o),$(Zo.$$.fragment,o),$(en.$$.fragment,o),$(Ms.$$.fragment,o),$(qs.$$.fragment,o),$(on.$$.fragment,o),$(Is.$$.fragment,o),$(nn.$$.fragment,o),$(sn.$$.fragment,o),$(an.$$.fragment,o),$(Ls.$$.fragment,o),$(Os.$$.fragment,o),$(Hs.$$.fragment,o),$(ln.$$.fragment,o),$(dn.$$.fragment,o),$(Ks.$$.fragment,o),$(Rs.$$.fragment,o),$(na.$$.fragment,o),$(pn.$$.fragment,o),$(hn.$$.fragment,o),yl=!0)},o(o){P(l.$$.fragment,o),P(j.$$.fragment,o),P(pe.$$.fragment,o),P(Q.$$.fragment,o),P(wn.$$.fragment,o),P(bn.$$.fragment,o),P(kn.$$.fragment,o),P($n.$$.fragment,o),P(Bn.$$.fragment,o),P(Qn.$$.fragment,o),P($o.$$.fragment,o),P(Kn.$$.fragment,o),P(Rn.$$.fragment,o),P(Yn.$$.fragment,o),P(Fo.$$.fragment,o),P(Eo.$$.fragment,o),P(jo.$$.fragment,o),P(Zn.$$.fragment,o),P(es.$$.fragment,o),P(ns.$$.fragment,o),P(Go.$$.fragment,o),P(Jo.$$.fragment,o),P(Mo.$$.fragment,o),P(ss.$$.fragment,o),P(as.$$.fragment,o),P(ls.$$.fragment,o),P(Ao.$$.fragment,o),P(Co.$$.fragment,o),P(zo.$$.fragment,o),P(Io.$$.fragment,o),P(ds.$$.fragment,o),P(cs.$$.fragment,o),P(us.$$.fragment,o),P(Oo.$$.fragment,o),P(No.$$.fragment,o),P(Do.$$.fragment,o),P(fs.$$.fragment,o),P(ms.$$.fragment,o),P(Wo.$$.fragment,o),P(ys.$$.fragment,o),P(Uo.$$.fragment,o),P(Bo.$$.fragment,o),P(vs.$$.fragment,o),P(ws.$$.fragment,o),P(Ho.$$.fragment,o),P(Ps.$$.fragment,o),P(Ko.$$.fragment,o),P(Ro.$$.fragment,o),P(Fs.$$.fragment,o),P(Es.$$.fragment,o),P(Xo.$$.fragment,o),P(Js.$$.fragment,o),P(Yo.$$.fragment,o),P(Zo.$$.fragment,o),P(en.$$.fragment,o),P(Ms.$$.fragment,o),P(qs.$$.fragment,o),P(on.$$.fragment,o),P(Is.$$.fragment,o),P(nn.$$.fragment,o),P(sn.$$.fragment,o),P(an.$$.fragment,o),P(Ls.$$.fragment,o),P(Os.$$.fragment,o),P(Hs.$$.fragment,o),P(ln.$$.fragment,o),P(dn.$$.fragment,o),P(Ks.$$.fragment,o),P(Rs.$$.fragment,o),P(na.$$.fragment,o),P(pn.$$.fragment,o),P(hn.$$.fragment,o),yl=!1},d(o){t(d),o&&t(y),o&&t(u),F(l),o&&t(M),o&&t(A),F(j),o&&t(ye),o&&t(S),o&&t(ve),o&&t(B),o&&t(z),o&&t(ue),o&&t(we),o&&t(fe),o&&t(V),F(pe,o),o&&t(be),o&&t(D),o&&t(Ve),o&&t(ge),F(Q),o&&t(Xe),o&&t($e),o&&t(Si),F(wn,o),o&&t(Wi),o&&t(ha),o&&t(Ui),F(bn,o),o&&t(Bi),o&&t(Kt),F(kn),o&&t(Qi),o&&t(ua),o&&t(Hi),F($n,o),o&&t(Ki),o&&t(ae),o&&t(Ri),o&&t(Ta),o&&t(Vi),o&&t(Ot),o&&t(Xi),o&&t(Rt),F(Bn),o&&t(Yi),o&&t(Mt),F(Qn),F($o),o&&t(Zi),o&&t(Vt),F(Kn),o&&t(el),o&&t(qt),F(Rn),F(Yn),F(Fo),F(Eo),F(jo),o&&t(tl),o&&t(Yt),F(Zn),o&&t(ol),o&&t(Tt),F(es),F(ns),F(Go),F(Jo),F(Mo),o&&t(nl),o&&t(eo),F(ss),o&&t(sl),o&&t(Be),F(as),F(ls),F(Ao),F(Co),F(zo),F(Io),o&&t(al),o&&t(oo),F(ds),o&&t(rl),o&&t(vt),F(cs),F(us),F(Oo),F(No),F(Do),o&&t(il),o&&t(ao),F(fs),o&&t(ll),o&&t(Qe),F(ms),F(Wo),F(ys),F(Uo),F(Bo),o&&t(dl),o&&t(io),F(vs),o&&t(cl),o&&t(He),F(ws),F(Ho),F(Ps),F(Ko),F(Ro),o&&t(pl),o&&t(co),F(Fs),o&&t(hl),o&&t(_e),F(Es),F(Xo),F(Js),F(Yo),F(Zo),F(en),o&&t(ul),o&&t(ho),F(Ms),o&&t(fl),o&&t(Ke),F(qs),F(on),F(Is),F(nn),F(sn),F(an),o&&t(ml),o&&t(mo),F(Ls),o&&t(gl),o&&t(Ne),F(Os),F(Hs),F(ln),F(dn),o&&t(_l),o&&t(_o),F(Ks),o&&t(Tl),o&&t(De),F(Rs),F(na),F(pn),F(hn)}}}const xT={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 GT(x){return K_(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class LT extends U_{constructor(d){super();B_(this,d,GT,jT,Q_,{})}}export{LT as default,xT as metadata};
