import{S as F_,i as E_,s as j_,e as a,k as h,w,t as o,M as x_,c as r,d as t,m as u,a as i,x as b,h as n,b as m,G as e,g,y as k,q as $,o as P,B as F,v as G_,L as gt}from"../../chunks/vendor-hf-doc-builder.js";import{T as De}from"../../chunks/Tip-hf-doc-builder.js";import{D as Te}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ke}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as it}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ft}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as J_}from"../../chunks/PipelineTag-hf-doc-builder.js";function M_(x){let d,y,p,f,T;return f=new Ke({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=o("Example:"),p=h(),w(f.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=n(c,"Example:"),c.forEach(t),p=u(l),b(f.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,p,c),k(f,l,c),T=!0},p:gt,i(l){T||($(f.$$.fragment,l),T=!0)},o(l){P(f.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(p),F(f,l)}}}function q_(x){let d,y,p,f,T;return{c(){d=a("p"),y=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),f=o("Module"),T=o(`
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=n(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(c,"CODE",{});var E=i(p);f=n(E,"Module"),E.forEach(t),T=n(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,p),e(p,f),e(d,T)},d(l){l&&t(d)}}}function C_(x){let d,y,p,f,T,l,c,E;return{c(){d=a("p"),y=o(`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 `),p=a("code"),f=o('device_map="auto"'),T=o(" in the "),l=a("code"),c=o("from_pretrained"),E=o(" call.")},l(A){d=r(A,"P",{});var M=i(d);y=n(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 `),p=r(M,"CODE",{});var C=i(p);f=n(C,'device_map="auto"'),C.forEach(t),T=n(M," in the "),l=r(M,"CODE",{});var D=i(l);c=n(D,"from_pretrained"),D.forEach(t),E=n(M," call."),M.forEach(t)},m(A,M){g(A,d,M),e(d,y),e(d,p),e(p,f),e(d,T),e(d,l),e(l,c),e(d,E)},d(A){A&&t(d)}}}function A_(x){let d,y,p,f,T;return f=new Ke({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=o("Example:"),p=h(),w(f.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=n(c,"Example:"),c.forEach(t),p=u(l),b(f.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,p,c),k(f,l,c),T=!0},p:gt,i(l){T||($(f.$$.fragment,l),T=!0)},o(l){P(f.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(p),F(f,l)}}}function z_(x){let d,y,p,f,T;return{c(){d=a("p"),y=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),f=o("Module"),T=o(`
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=n(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(c,"CODE",{});var E=i(p);f=n(E,"Module"),E.forEach(t),T=n(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,p),e(p,f),e(d,T)},d(l){l&&t(d)}}}function I_(x){let d,y,p,f,T,l,c,E;return{c(){d=a("p"),y=o(`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 `),p=a("code"),f=o('device_map="auto"'),T=o(" in the "),l=a("code"),c=o("from_pretrained"),E=o(" call.")},l(A){d=r(A,"P",{});var M=i(d);y=n(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 `),p=r(M,"CODE",{});var C=i(p);f=n(C,'device_map="auto"'),C.forEach(t),T=n(M," in the "),l=r(M,"CODE",{});var D=i(l);c=n(D,"from_pretrained"),D.forEach(t),E=n(M," call."),M.forEach(t)},m(A,M){g(A,d,M),e(d,y),e(d,p),e(p,f),e(d,T),e(d,l),e(l,c),e(d,E)},d(A){A&&t(d)}}}function L_(x){let d,y,p,f,T;return f=new Ke({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=o("Example:"),p=h(),w(f.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=n(c,"Example:"),c.forEach(t),p=u(l),b(f.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,p,c),k(f,l,c),T=!0},p:gt,i(l){T||($(f.$$.fragment,l),T=!0)},o(l){P(f.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(p),F(f,l)}}}function O_(x){let d,y,p,f,T;return{c(){d=a("p"),y=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),f=o("Module"),T=o(`
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=n(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(c,"CODE",{});var E=i(p);f=n(E,"Module"),E.forEach(t),T=n(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,p),e(p,f),e(d,T)},d(l){l&&t(d)}}}function N_(x){let d,y,p,f,T,l,c,E;return{c(){d=a("p"),y=o(`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 `),p=a("code"),f=o('device_map="auto"'),T=o(" in the "),l=a("code"),c=o("from_pretrained"),E=o(" call.")},l(A){d=r(A,"P",{});var M=i(d);y=n(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 `),p=r(M,"CODE",{});var C=i(p);f=n(C,'device_map="auto"'),C.forEach(t),T=n(M," in the "),l=r(M,"CODE",{});var D=i(l);c=n(D,"from_pretrained"),D.forEach(t),E=n(M," call."),M.forEach(t)},m(A,M){g(A,d,M),e(d,y),e(d,p),e(p,f),e(d,T),e(d,l),e(l,c),e(d,E)},d(A){A&&t(d)}}}function D_(x){let d,y,p,f,T;return f=new Ke({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=o("Example of single-label classification:"),p=h(),w(f.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=n(c,"Example of single-label classification:"),c.forEach(t),p=u(l),b(f.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,p,c),k(f,l,c),T=!0},p:gt,i(l){T||($(f.$$.fragment,l),T=!0)},o(l){P(f.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(p),F(f,l)}}}function S_(x){let d,y,p,f,T;return f=new Ke({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=o("Example of multi-label classification:"),p=h(),w(f.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=n(c,"Example of multi-label classification:"),c.forEach(t),p=u(l),b(f.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,p,c),k(f,l,c),T=!0},p:gt,i(l){T||($(f.$$.fragment,l),T=!0)},o(l){P(f.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(p),F(f,l)}}}function B_(x){let d,y,p,f,T;return{c(){d=a("p"),y=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),f=o("Module"),T=o(`
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=n(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(c,"CODE",{});var E=i(p);f=n(E,"Module"),E.forEach(t),T=n(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,p),e(p,f),e(d,T)},d(l){l&&t(d)}}}function U_(x){let d,y,p,f,T,l,c,E;return{c(){d=a("p"),y=o(`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 `),p=a("code"),f=o('device_map="auto"'),T=o(" in the "),l=a("code"),c=o("from_pretrained"),E=o(" call.")},l(A){d=r(A,"P",{});var M=i(d);y=n(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 `),p=r(M,"CODE",{});var C=i(p);f=n(C,'device_map="auto"'),C.forEach(t),T=n(M," in the "),l=r(M,"CODE",{});var D=i(l);c=n(D,"from_pretrained"),D.forEach(t),E=n(M," call."),M.forEach(t)},m(A,M){g(A,d,M),e(d,y),e(d,p),e(p,f),e(d,T),e(d,l),e(l,c),e(d,E)},d(A){A&&t(d)}}}function W_(x){let d,y,p,f,T;return f=new Ke({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=o("Example:"),p=h(),w(f.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=n(c,"Example:"),c.forEach(t),p=u(l),b(f.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,p,c),k(f,l,c),T=!0},p:gt,i(l){T||($(f.$$.fragment,l),T=!0)},o(l){P(f.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(p),F(f,l)}}}function Q_(x){let d,y,p,f,T,l,c,E,A,M,C,D,oe,j,Pe,H,Fe,ye,B,Ee,ie,V,je,le,X,xe,ve,Q,Ge,de,ce,q,z,me,Y,we,fe,O,Je,pe,L,Me,K,qe,Ce,R,Ae,ze,S,Ie,Z,be,ee,I,ae,N,ge,Le;return{c(){d=a("p"),y=o("TensorFlow models and layers in "),p=a("code"),f=o("transformers"),T=o(" accept two formats as input:"),l=h(),c=a("ul"),E=a("li"),A=o("having all inputs as keyword arguments (like PyTorch models), or"),M=h(),C=a("li"),D=o("having all inputs as a list, tuple or dict in the first positional argument."),oe=h(),j=a("p"),Pe=o(`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 `),H=a("code"),Fe=o("model.fit()"),ye=o(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=a("code"),Ee=o("model.fit()"),ie=o(` supports! If, however, you want to use the second
format outside of Keras methods like `),V=a("code"),je=o("fit()"),le=o(" and "),X=a("code"),xe=o("predict()"),ve=o(`, such as when creating your own layers or models with
the Keras `),Q=a("code"),Ge=o("Functional"),de=o(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),ce=h(),q=a("ul"),z=a("li"),me=o("a single Tensor with "),Y=a("code"),we=o("input_ids"),fe=o(" only and nothing else: "),O=a("code"),Je=o("model(input_ids)"),pe=h(),L=a("li"),Me=o(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),K=a("code"),qe=o("model([input_ids, attention_mask])"),Ce=o(" or "),R=a("code"),Ae=o("model([input_ids, attention_mask, token_type_ids])"),ze=h(),S=a("li"),Ie=o(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Z=a("code"),be=o('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=h(),I=a("p"),ae=o(`Note that when creating models and layers with
`),N=a("a"),ge=o("subclassing"),Le=o(` 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=n(G,"TensorFlow models and layers in "),p=r(G,"CODE",{});var Ye=i(p);f=n(Ye,"transformers"),Ye.forEach(t),T=n(G," accept two formats as input:"),G.forEach(t),l=u(v),c=r(v,"UL",{});var ne=i(c);E=r(ne,"LI",{});var he=i(E);A=n(he,"having all inputs as keyword arguments (like PyTorch models), or"),he.forEach(t),M=u(ne),C=r(ne,"LI",{});var Ze=i(C);D=n(Ze,"having all inputs as a list, tuple or dict in the first positional argument."),Ze.forEach(t),ne.forEach(t),oe=u(v),j=r(v,"P",{});var J=i(j);Pe=n(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 `),H=r(J,"CODE",{});var et=i(H);Fe=n(et,"model.fit()"),et.forEach(t),ye=n(J,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=r(J,"CODE",{});var tt=i(B);Ee=n(tt,"model.fit()"),tt.forEach(t),ie=n(J,` supports! If, however, you want to use the second
format outside of Keras methods like `),V=r(J,"CODE",{});var Se=i(V);je=n(Se,"fit()"),Se.forEach(t),le=n(J," and "),X=r(J,"CODE",{});var ot=i(X);xe=n(ot,"predict()"),ot.forEach(t),ve=n(J,`, such as when creating your own layers or models with
the Keras `),Q=r(J,"CODE",{});var nt=i(Q);Ge=n(nt,"Functional"),nt.forEach(t),de=n(J,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),J.forEach(t),ce=u(v),q=r(v,"UL",{});var U=i(q);z=r(U,"LI",{});var te=i(z);me=n(te,"a single Tensor with "),Y=r(te,"CODE",{});var st=i(Y);we=n(st,"input_ids"),st.forEach(t),fe=n(te," only and nothing else: "),O=r(te,"CODE",{});var Re=i(O);Je=n(Re,"model(input_ids)"),Re.forEach(t),te.forEach(t),pe=u(U),L=r(U,"LI",{});var W=i(L);Me=n(W,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),K=r(W,"CODE",{});var ke=i(K);qe=n(ke,"model([input_ids, attention_mask])"),ke.forEach(t),Ce=n(W," or "),R=r(W,"CODE",{});var Be=i(R);Ae=n(Be,"model([input_ids, attention_mask, token_type_ids])"),Be.forEach(t),W.forEach(t),ze=u(U),S=r(U,"LI",{});var ue=i(S);Ie=n(ue,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Z=r(ue,"CODE",{});var at=i(Z);be=n(at,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),at.forEach(t),ue.forEach(t),U.forEach(t),ee=u(v),I=r(v,"P",{});var se=i(I);ae=n(se,`Note that when creating models and layers with
`),N=r(se,"A",{href:!0,rel:!0});var rt=i(N);ge=n(rt,"subclassing"),rt.forEach(t),Le=n(se,` 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!`),se.forEach(t),this.h()},h(){m(N,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(N,"rel","nofollow")},m(v,G){g(v,d,G),e(d,y),e(d,p),e(p,f),e(d,T),g(v,l,G),g(v,c,G),e(c,E),e(E,A),e(c,M),e(c,C),e(C,D),g(v,oe,G),g(v,j,G),e(j,Pe),e(j,H),e(H,Fe),e(j,ye),e(j,B),e(B,Ee),e(j,ie),e(j,V),e(V,je),e(j,le),e(j,X),e(X,xe),e(j,ve),e(j,Q),e(Q,Ge),e(j,de),g(v,ce,G),g(v,q,G),e(q,z),e(z,me),e(z,Y),e(Y,we),e(z,fe),e(z,O),e(O,Je),e(q,pe),e(q,L),e(L,Me),e(L,K),e(K,qe),e(L,Ce),e(L,R),e(R,Ae),e(q,ze),e(q,S),e(S,Ie),e(S,Z),e(Z,be),g(v,ee,G),g(v,I,G),e(I,ae),e(I,N),e(N,ge),e(I,Le)},d(v){v&&t(d),v&&t(l),v&&t(c),v&&t(oe),v&&t(j),v&&t(ce),v&&t(q),v&&t(ee),v&&t(I)}}}function H_(x){let d,y,p,f,T;return{c(){d=a("p"),y=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),f=o("Module"),T=o(`
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=n(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(c,"CODE",{});var E=i(p);f=n(E,"Module"),E.forEach(t),T=n(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,p),e(p,f),e(d,T)},d(l){l&&t(d)}}}function K_(x){let d,y,p,f,T;return f=new Ke({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=o("Example:"),p=h(),w(f.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=n(c,"Example:"),c.forEach(t),p=u(l),b(f.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,p,c),k(f,l,c),T=!0},p:gt,i(l){T||($(f.$$.fragment,l),T=!0)},o(l){P(f.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(p),F(f,l)}}}function R_(x){let d,y,p,f,T,l,c,E,A,M,C,D,oe,j,Pe,H,Fe,ye,B,Ee,ie,V,je,le,X,xe,ve,Q,Ge,de,ce,q,z,me,Y,we,fe,O,Je,pe,L,Me,K,qe,Ce,R,Ae,ze,S,Ie,Z,be,ee,I,ae,N,ge,Le;return{c(){d=a("p"),y=o("TensorFlow models and layers in "),p=a("code"),f=o("transformers"),T=o(" accept two formats as input:"),l=h(),c=a("ul"),E=a("li"),A=o("having all inputs as keyword arguments (like PyTorch models), or"),M=h(),C=a("li"),D=o("having all inputs as a list, tuple or dict in the first positional argument."),oe=h(),j=a("p"),Pe=o(`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 `),H=a("code"),Fe=o("model.fit()"),ye=o(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=a("code"),Ee=o("model.fit()"),ie=o(` supports! If, however, you want to use the second
format outside of Keras methods like `),V=a("code"),je=o("fit()"),le=o(" and "),X=a("code"),xe=o("predict()"),ve=o(`, such as when creating your own layers or models with
the Keras `),Q=a("code"),Ge=o("Functional"),de=o(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),ce=h(),q=a("ul"),z=a("li"),me=o("a single Tensor with "),Y=a("code"),we=o("input_ids"),fe=o(" only and nothing else: "),O=a("code"),Je=o("model(input_ids)"),pe=h(),L=a("li"),Me=o(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),K=a("code"),qe=o("model([input_ids, attention_mask])"),Ce=o(" or "),R=a("code"),Ae=o("model([input_ids, attention_mask, token_type_ids])"),ze=h(),S=a("li"),Ie=o(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Z=a("code"),be=o('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=h(),I=a("p"),ae=o(`Note that when creating models and layers with
`),N=a("a"),ge=o("subclassing"),Le=o(` 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=n(G,"TensorFlow models and layers in "),p=r(G,"CODE",{});var Ye=i(p);f=n(Ye,"transformers"),Ye.forEach(t),T=n(G," accept two formats as input:"),G.forEach(t),l=u(v),c=r(v,"UL",{});var ne=i(c);E=r(ne,"LI",{});var he=i(E);A=n(he,"having all inputs as keyword arguments (like PyTorch models), or"),he.forEach(t),M=u(ne),C=r(ne,"LI",{});var Ze=i(C);D=n(Ze,"having all inputs as a list, tuple or dict in the first positional argument."),Ze.forEach(t),ne.forEach(t),oe=u(v),j=r(v,"P",{});var J=i(j);Pe=n(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 `),H=r(J,"CODE",{});var et=i(H);Fe=n(et,"model.fit()"),et.forEach(t),ye=n(J,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=r(J,"CODE",{});var tt=i(B);Ee=n(tt,"model.fit()"),tt.forEach(t),ie=n(J,` supports! If, however, you want to use the second
format outside of Keras methods like `),V=r(J,"CODE",{});var Se=i(V);je=n(Se,"fit()"),Se.forEach(t),le=n(J," and "),X=r(J,"CODE",{});var ot=i(X);xe=n(ot,"predict()"),ot.forEach(t),ve=n(J,`, such as when creating your own layers or models with
the Keras `),Q=r(J,"CODE",{});var nt=i(Q);Ge=n(nt,"Functional"),nt.forEach(t),de=n(J,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),J.forEach(t),ce=u(v),q=r(v,"UL",{});var U=i(q);z=r(U,"LI",{});var te=i(z);me=n(te,"a single Tensor with "),Y=r(te,"CODE",{});var st=i(Y);we=n(st,"input_ids"),st.forEach(t),fe=n(te," only and nothing else: "),O=r(te,"CODE",{});var Re=i(O);Je=n(Re,"model(input_ids)"),Re.forEach(t),te.forEach(t),pe=u(U),L=r(U,"LI",{});var W=i(L);Me=n(W,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),K=r(W,"CODE",{});var ke=i(K);qe=n(ke,"model([input_ids, attention_mask])"),ke.forEach(t),Ce=n(W," or "),R=r(W,"CODE",{});var Be=i(R);Ae=n(Be,"model([input_ids, attention_mask, token_type_ids])"),Be.forEach(t),W.forEach(t),ze=u(U),S=r(U,"LI",{});var ue=i(S);Ie=n(ue,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Z=r(ue,"CODE",{});var at=i(Z);be=n(at,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),at.forEach(t),ue.forEach(t),U.forEach(t),ee=u(v),I=r(v,"P",{});var se=i(I);ae=n(se,`Note that when creating models and layers with
`),N=r(se,"A",{href:!0,rel:!0});var rt=i(N);ge=n(rt,"subclassing"),rt.forEach(t),Le=n(se,` 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!`),se.forEach(t),this.h()},h(){m(N,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(N,"rel","nofollow")},m(v,G){g(v,d,G),e(d,y),e(d,p),e(p,f),e(d,T),g(v,l,G),g(v,c,G),e(c,E),e(E,A),e(c,M),e(c,C),e(C,D),g(v,oe,G),g(v,j,G),e(j,Pe),e(j,H),e(H,Fe),e(j,ye),e(j,B),e(B,Ee),e(j,ie),e(j,V),e(V,je),e(j,le),e(j,X),e(X,xe),e(j,ve),e(j,Q),e(Q,Ge),e(j,de),g(v,ce,G),g(v,q,G),e(q,z),e(z,me),e(z,Y),e(Y,we),e(z,fe),e(z,O),e(O,Je),e(q,pe),e(q,L),e(L,Me),e(L,K),e(K,qe),e(L,Ce),e(L,R),e(R,Ae),e(q,ze),e(q,S),e(S,Ie),e(S,Z),e(Z,be),g(v,ee,G),g(v,I,G),e(I,ae),e(I,N),e(N,ge),e(I,Le)},d(v){v&&t(d),v&&t(l),v&&t(c),v&&t(oe),v&&t(j),v&&t(ce),v&&t(q),v&&t(ee),v&&t(I)}}}function V_(x){let d,y,p,f,T;return{c(){d=a("p"),y=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),f=o("Module"),T=o(`
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=n(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(c,"CODE",{});var E=i(p);f=n(E,"Module"),E.forEach(t),T=n(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,p),e(p,f),e(d,T)},d(l){l&&t(d)}}}function X_(x){let d,y,p,f,T;return f=new Ke({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=o("Example:"),p=h(),w(f.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=n(c,"Example:"),c.forEach(t),p=u(l),b(f.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,p,c),k(f,l,c),T=!0},p:gt,i(l){T||($(f.$$.fragment,l),T=!0)},o(l){P(f.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(p),F(f,l)}}}function Y_(x){let d,y,p,f,T,l,c,E,A,M,C,D,oe,j,Pe,H,Fe,ye,B,Ee,ie,V,je,le,X,xe,ve,Q,Ge,de,ce,q,z,me,Y,we,fe,O,Je,pe,L,Me,K,qe,Ce,R,Ae,ze,S,Ie,Z,be,ee,I,ae,N,ge,Le;return{c(){d=a("p"),y=o("TensorFlow models and layers in "),p=a("code"),f=o("transformers"),T=o(" accept two formats as input:"),l=h(),c=a("ul"),E=a("li"),A=o("having all inputs as keyword arguments (like PyTorch models), or"),M=h(),C=a("li"),D=o("having all inputs as a list, tuple or dict in the first positional argument."),oe=h(),j=a("p"),Pe=o(`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 `),H=a("code"),Fe=o("model.fit()"),ye=o(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=a("code"),Ee=o("model.fit()"),ie=o(` supports! If, however, you want to use the second
format outside of Keras methods like `),V=a("code"),je=o("fit()"),le=o(" and "),X=a("code"),xe=o("predict()"),ve=o(`, such as when creating your own layers or models with
the Keras `),Q=a("code"),Ge=o("Functional"),de=o(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),ce=h(),q=a("ul"),z=a("li"),me=o("a single Tensor with "),Y=a("code"),we=o("input_ids"),fe=o(" only and nothing else: "),O=a("code"),Je=o("model(input_ids)"),pe=h(),L=a("li"),Me=o(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),K=a("code"),qe=o("model([input_ids, attention_mask])"),Ce=o(" or "),R=a("code"),Ae=o("model([input_ids, attention_mask, token_type_ids])"),ze=h(),S=a("li"),Ie=o(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Z=a("code"),be=o('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=h(),I=a("p"),ae=o(`Note that when creating models and layers with
`),N=a("a"),ge=o("subclassing"),Le=o(` 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=n(G,"TensorFlow models and layers in "),p=r(G,"CODE",{});var Ye=i(p);f=n(Ye,"transformers"),Ye.forEach(t),T=n(G," accept two formats as input:"),G.forEach(t),l=u(v),c=r(v,"UL",{});var ne=i(c);E=r(ne,"LI",{});var he=i(E);A=n(he,"having all inputs as keyword arguments (like PyTorch models), or"),he.forEach(t),M=u(ne),C=r(ne,"LI",{});var Ze=i(C);D=n(Ze,"having all inputs as a list, tuple or dict in the first positional argument."),Ze.forEach(t),ne.forEach(t),oe=u(v),j=r(v,"P",{});var J=i(j);Pe=n(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 `),H=r(J,"CODE",{});var et=i(H);Fe=n(et,"model.fit()"),et.forEach(t),ye=n(J,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=r(J,"CODE",{});var tt=i(B);Ee=n(tt,"model.fit()"),tt.forEach(t),ie=n(J,` supports! If, however, you want to use the second
format outside of Keras methods like `),V=r(J,"CODE",{});var Se=i(V);je=n(Se,"fit()"),Se.forEach(t),le=n(J," and "),X=r(J,"CODE",{});var ot=i(X);xe=n(ot,"predict()"),ot.forEach(t),ve=n(J,`, such as when creating your own layers or models with
the Keras `),Q=r(J,"CODE",{});var nt=i(Q);Ge=n(nt,"Functional"),nt.forEach(t),de=n(J,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),J.forEach(t),ce=u(v),q=r(v,"UL",{});var U=i(q);z=r(U,"LI",{});var te=i(z);me=n(te,"a single Tensor with "),Y=r(te,"CODE",{});var st=i(Y);we=n(st,"input_ids"),st.forEach(t),fe=n(te," only and nothing else: "),O=r(te,"CODE",{});var Re=i(O);Je=n(Re,"model(input_ids)"),Re.forEach(t),te.forEach(t),pe=u(U),L=r(U,"LI",{});var W=i(L);Me=n(W,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),K=r(W,"CODE",{});var ke=i(K);qe=n(ke,"model([input_ids, attention_mask])"),ke.forEach(t),Ce=n(W," or "),R=r(W,"CODE",{});var Be=i(R);Ae=n(Be,"model([input_ids, attention_mask, token_type_ids])"),Be.forEach(t),W.forEach(t),ze=u(U),S=r(U,"LI",{});var ue=i(S);Ie=n(ue,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Z=r(ue,"CODE",{});var at=i(Z);be=n(at,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),at.forEach(t),ue.forEach(t),U.forEach(t),ee=u(v),I=r(v,"P",{});var se=i(I);ae=n(se,`Note that when creating models and layers with
`),N=r(se,"A",{href:!0,rel:!0});var rt=i(N);ge=n(rt,"subclassing"),rt.forEach(t),Le=n(se,` 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!`),se.forEach(t),this.h()},h(){m(N,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(N,"rel","nofollow")},m(v,G){g(v,d,G),e(d,y),e(d,p),e(p,f),e(d,T),g(v,l,G),g(v,c,G),e(c,E),e(E,A),e(c,M),e(c,C),e(C,D),g(v,oe,G),g(v,j,G),e(j,Pe),e(j,H),e(H,Fe),e(j,ye),e(j,B),e(B,Ee),e(j,ie),e(j,V),e(V,je),e(j,le),e(j,X),e(X,xe),e(j,ve),e(j,Q),e(Q,Ge),e(j,de),g(v,ce,G),g(v,q,G),e(q,z),e(z,me),e(z,Y),e(Y,we),e(z,fe),e(z,O),e(O,Je),e(q,pe),e(q,L),e(L,Me),e(L,K),e(K,qe),e(L,Ce),e(L,R),e(R,Ae),e(q,ze),e(q,S),e(S,Ie),e(S,Z),e(Z,be),g(v,ee,G),g(v,I,G),e(I,ae),e(I,N),e(N,ge),e(I,Le)},d(v){v&&t(d),v&&t(l),v&&t(c),v&&t(oe),v&&t(j),v&&t(ce),v&&t(q),v&&t(ee),v&&t(I)}}}function Z_(x){let d,y,p,f,T;return{c(){d=a("p"),y=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),f=o("Module"),T=o(`
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=n(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(c,"CODE",{});var E=i(p);f=n(E,"Module"),E.forEach(t),T=n(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,p),e(p,f),e(d,T)},d(l){l&&t(d)}}}function eT(x){let d,y,p,f,T;return f=new Ke({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=o("Example:"),p=h(),w(f.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=n(c,"Example:"),c.forEach(t),p=u(l),b(f.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,p,c),k(f,l,c),T=!0},p:gt,i(l){T||($(f.$$.fragment,l),T=!0)},o(l){P(f.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(p),F(f,l)}}}function tT(x){let d,y;return d=new Ke({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(p){b(d.$$.fragment,p)},m(p,f){k(d,p,f),y=!0},p:gt,i(p){y||($(d.$$.fragment,p),y=!0)},o(p){P(d.$$.fragment,p),y=!1},d(p){F(d,p)}}}function oT(x){let d,y,p,f,T,l,c,E,A,M,C,D,oe,j,Pe,H,Fe,ye,B,Ee,ie,V,je,le,X,xe,ve,Q,Ge,de,ce,q,z,me,Y,we,fe,O,Je,pe,L,Me,K,qe,Ce,R,Ae,ze,S,Ie,Z,be,ee,I,ae,N,ge,Le;return{c(){d=a("p"),y=o("TensorFlow models and layers in "),p=a("code"),f=o("transformers"),T=o(" accept two formats as input:"),l=h(),c=a("ul"),E=a("li"),A=o("having all inputs as keyword arguments (like PyTorch models), or"),M=h(),C=a("li"),D=o("having all inputs as a list, tuple or dict in the first positional argument."),oe=h(),j=a("p"),Pe=o(`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 `),H=a("code"),Fe=o("model.fit()"),ye=o(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=a("code"),Ee=o("model.fit()"),ie=o(` supports! If, however, you want to use the second
format outside of Keras methods like `),V=a("code"),je=o("fit()"),le=o(" and "),X=a("code"),xe=o("predict()"),ve=o(`, such as when creating your own layers or models with
the Keras `),Q=a("code"),Ge=o("Functional"),de=o(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),ce=h(),q=a("ul"),z=a("li"),me=o("a single Tensor with "),Y=a("code"),we=o("input_ids"),fe=o(" only and nothing else: "),O=a("code"),Je=o("model(input_ids)"),pe=h(),L=a("li"),Me=o(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),K=a("code"),qe=o("model([input_ids, attention_mask])"),Ce=o(" or "),R=a("code"),Ae=o("model([input_ids, attention_mask, token_type_ids])"),ze=h(),S=a("li"),Ie=o(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Z=a("code"),be=o('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ee=h(),I=a("p"),ae=o(`Note that when creating models and layers with
`),N=a("a"),ge=o("subclassing"),Le=o(` 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=n(G,"TensorFlow models and layers in "),p=r(G,"CODE",{});var Ye=i(p);f=n(Ye,"transformers"),Ye.forEach(t),T=n(G," accept two formats as input:"),G.forEach(t),l=u(v),c=r(v,"UL",{});var ne=i(c);E=r(ne,"LI",{});var he=i(E);A=n(he,"having all inputs as keyword arguments (like PyTorch models), or"),he.forEach(t),M=u(ne),C=r(ne,"LI",{});var Ze=i(C);D=n(Ze,"having all inputs as a list, tuple or dict in the first positional argument."),Ze.forEach(t),ne.forEach(t),oe=u(v),j=r(v,"P",{});var J=i(j);Pe=n(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 `),H=r(J,"CODE",{});var et=i(H);Fe=n(et,"model.fit()"),et.forEach(t),ye=n(J,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),B=r(J,"CODE",{});var tt=i(B);Ee=n(tt,"model.fit()"),tt.forEach(t),ie=n(J,` supports! If, however, you want to use the second
format outside of Keras methods like `),V=r(J,"CODE",{});var Se=i(V);je=n(Se,"fit()"),Se.forEach(t),le=n(J," and "),X=r(J,"CODE",{});var ot=i(X);xe=n(ot,"predict()"),ot.forEach(t),ve=n(J,`, such as when creating your own layers or models with
the Keras `),Q=r(J,"CODE",{});var nt=i(Q);Ge=n(nt,"Functional"),nt.forEach(t),de=n(J,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),J.forEach(t),ce=u(v),q=r(v,"UL",{});var U=i(q);z=r(U,"LI",{});var te=i(z);me=n(te,"a single Tensor with "),Y=r(te,"CODE",{});var st=i(Y);we=n(st,"input_ids"),st.forEach(t),fe=n(te," only and nothing else: "),O=r(te,"CODE",{});var Re=i(O);Je=n(Re,"model(input_ids)"),Re.forEach(t),te.forEach(t),pe=u(U),L=r(U,"LI",{});var W=i(L);Me=n(W,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),K=r(W,"CODE",{});var ke=i(K);qe=n(ke,"model([input_ids, attention_mask])"),ke.forEach(t),Ce=n(W," or "),R=r(W,"CODE",{});var Be=i(R);Ae=n(Be,"model([input_ids, attention_mask, token_type_ids])"),Be.forEach(t),W.forEach(t),ze=u(U),S=r(U,"LI",{});var ue=i(S);Ie=n(ue,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Z=r(ue,"CODE",{});var at=i(Z);be=n(at,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),at.forEach(t),ue.forEach(t),U.forEach(t),ee=u(v),I=r(v,"P",{});var se=i(I);ae=n(se,`Note that when creating models and layers with
`),N=r(se,"A",{href:!0,rel:!0});var rt=i(N);ge=n(rt,"subclassing"),rt.forEach(t),Le=n(se,` 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!`),se.forEach(t),this.h()},h(){m(N,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(N,"rel","nofollow")},m(v,G){g(v,d,G),e(d,y),e(d,p),e(p,f),e(d,T),g(v,l,G),g(v,c,G),e(c,E),e(E,A),e(c,M),e(c,C),e(C,D),g(v,oe,G),g(v,j,G),e(j,Pe),e(j,H),e(H,Fe),e(j,ye),e(j,B),e(B,Ee),e(j,ie),e(j,V),e(V,je),e(j,le),e(j,X),e(X,xe),e(j,ve),e(j,Q),e(Q,Ge),e(j,de),g(v,ce,G),g(v,q,G),e(q,z),e(z,me),e(z,Y),e(Y,we),e(z,fe),e(z,O),e(O,Je),e(q,pe),e(q,L),e(L,Me),e(L,K),e(K,qe),e(L,Ce),e(L,R),e(R,Ae),e(q,ze),e(q,S),e(S,Ie),e(S,Z),e(Z,be),g(v,ee,G),g(v,I,G),e(I,ae),e(I,N),e(N,ge),e(I,Le)},d(v){v&&t(d),v&&t(l),v&&t(c),v&&t(oe),v&&t(j),v&&t(ce),v&&t(q),v&&t(ee),v&&t(I)}}}function nT(x){let d,y,p,f,T;return{c(){d=a("p"),y=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),f=o("Module"),T=o(`
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=n(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(c,"CODE",{});var E=i(p);f=n(E,"Module"),E.forEach(t),T=n(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,p),e(p,f),e(d,T)},d(l){l&&t(d)}}}function sT(x){let d,y,p,f,T;return f=new Ke({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=o("Example:"),p=h(),w(f.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=n(c,"Example:"),c.forEach(t),p=u(l),b(f.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,p,c),k(f,l,c),T=!0},p:gt,i(l){T||($(f.$$.fragment,l),T=!0)},o(l){P(f.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(p),F(f,l)}}}function aT(x){let d,y;return d=new Ke({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(p){b(d.$$.fragment,p)},m(p,f){k(d,p,f),y=!0},p:gt,i(p){y||($(d.$$.fragment,p),y=!0)},o(p){P(d.$$.fragment,p),y=!1},d(p){F(d,p)}}}function rT(x){let d,y,p,f,T;return{c(){d=a("p"),y=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),f=o("Module"),T=o(`
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=n(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(c,"CODE",{});var E=i(p);f=n(E,"Module"),E.forEach(t),T=n(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,p),e(p,f),e(d,T)},d(l){l&&t(d)}}}function iT(x){let d,y,p,f,T;return f=new Ke({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=o("Example:"),p=h(),w(f.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=n(c,"Example:"),c.forEach(t),p=u(l),b(f.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,p,c),k(f,l,c),T=!0},p:gt,i(l){T||($(f.$$.fragment,l),T=!0)},o(l){P(f.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(p),F(f,l)}}}function lT(x){let d,y,p,f,T;return{c(){d=a("p"),y=o("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),f=o("Module"),T=o(`
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=n(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(c,"CODE",{});var E=i(p);f=n(E,"Module"),E.forEach(t),T=n(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,p),e(p,f),e(d,T)},d(l){l&&t(d)}}}function dT(x){let d,y,p,f,T;return f=new Ke({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=o("Example:"),p=h(),w(f.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);y=n(c,"Example:"),c.forEach(t),p=u(l),b(f.$$.fragment,l)},m(l,c){g(l,d,c),e(d,y),g(l,p,c),k(f,l,c),T=!0},p:gt,i(l){T||($(f.$$.fragment,l),T=!0)},o(l){P(f.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(p),F(f,l)}}}function cT(x){let d,y,p,f,T,l,c,E,A,M,C,D,oe,j,Pe,H,Fe,ye,B,Ee,ie,V,je,le,X,xe,ve,Q,Ge,de,ce,q,z,me,Y,we,fe,O,Je,pe,L,Me,K,qe,Ce,R,Ae,ze,S,Ie,Z,be,ee,I,ae,N,ge,Le,v,G,Ye,ne,he,Ze,J,et,tt,Se,ot,nt,U,te,st,Re,W,ke,Be,ue,at,se,rt,Ci,wo,Ql,pa,Hl,Kl,Ai,wn,zi,ha,Rl,Ii,bn,Li,Kt,bo,er,kn,Vl,tr,Xl,Oi,ua,Yl,Ni,$n,Di,re,Pn,Zl,Fn,ed,td,od,En,nd,jn,sd,ad,rd,xn,id,Gn,ld,dd,cd,Jn,pd,Mn,hd,ud,md,qn,fd,Cn,gd,_d,Td,An,yd,zn,vd,wd,bd,ma,In,kd,$d,Pd,kt,fa,Fd,Ed,Ln,jd,xd,On,Gd,Jd,Nn,Md,qd,Cd,Lt,ga,Ad,zd,Dn,Id,Ld,Sn,Od,Nd,Dd,Ot,_a,Sd,Bd,Bn,Ud,Wd,Un,Qd,Hd,Si,Rt,ko,or,Wn,Kd,nr,Rd,Bi,qt,Qn,Vd,_t,Xd,Ta,Yd,Zd,Hn,ec,tc,ya,oc,nc,va,sc,ac,rc,$o,Ui,Vt,Po,sr,Kn,ic,ar,lc,Wi,Ct,Rn,dc,Vn,cc,Xn,pc,hc,uc,lt,Yn,mc,Xt,fc,wa,gc,_c,rr,Tc,yc,vc,Fo,wc,Eo,bc,jo,Qi,Yt,xo,ir,Zn,kc,lr,$c,Hi,Tt,es,Pc,dr,Fc,Ec,ts,jc,os,xc,Gc,Jc,dt,ns,Mc,Zt,qc,ba,Cc,Ac,cr,zc,Ic,Lc,Go,Oc,Jo,Nc,Mo,Ki,eo,qo,pr,ss,Dc,hr,Sc,Ri,Ue,as,Bc,ur,Uc,Wc,ka,$a,Qc,Hc,Kc,yt,Rc,mr,Vc,Xc,fr,Yc,Zc,gr,ep,tp,_r,op,np,sp,rs,ap,is,rp,ip,lp,Ve,ls,dp,to,cp,Pa,pp,hp,Tr,up,mp,fp,Co,gp,Ao,_p,zo,Tp,Io,Vi,oo,Lo,yr,ds,yp,vr,vp,Xi,vt,cs,wp,no,bp,wr,kp,$p,br,Pp,Fp,Ep,ps,jp,hs,xp,Gp,Jp,ct,us,Mp,so,qp,Fa,Cp,Ap,kr,zp,Ip,Lp,Oo,Op,No,Np,Do,Yi,ao,So,$r,ms,Dp,Pr,Sp,Zi,We,fs,Bp,Fr,Up,Wp,gs,Qp,Ea,Hp,Kp,Rp,_s,Vp,Ts,Xp,Yp,Zp,Bo,eh,$t,ys,th,ro,oh,ja,nh,sh,Er,ah,rh,ih,Uo,lh,Wo,el,io,Qo,jr,vs,dh,xr,ch,tl,Qe,ws,ph,Gr,hh,uh,bs,mh,xa,fh,gh,_h,ks,Th,$s,yh,vh,wh,Ho,bh,Pt,Ps,kh,lo,$h,Ga,Ph,Fh,Jr,Eh,jh,xh,Ko,Gh,Ro,ol,co,Vo,Mr,Fs,Jh,qr,Mh,nl,_e,Es,qh,Cr,Ch,Ah,Ja,Ma,zh,Ih,Lh,wt,Oh,Ar,Nh,Dh,zr,Sh,Bh,Ir,Uh,Wh,Lr,Qh,Hh,Kh,js,Rh,qa,Vh,Xh,Yh,xs,Zh,Gs,eu,tu,ou,Xo,nu,pt,Js,su,po,au,Ca,ru,iu,Or,lu,du,cu,Yo,pu,Zo,hu,en,sl,ho,tn,Nr,Ms,uu,Dr,mu,al,He,qs,fu,uo,gu,Sr,_u,Tu,Br,yu,vu,wu,Cs,bu,Aa,ku,$u,Pu,As,Fu,zs,Eu,ju,xu,on,Gu,ht,Is,Ju,mo,Mu,za,qu,Cu,Ur,Au,zu,Iu,nn,Lu,sn,Ou,an,rl,fo,rn,Wr,Ls,Nu,Qr,Du,il,Oe,Os,Su,Hr,Bu,Uu,Ns,Wu,Ia,Qu,Hu,Ku,Ds,Ru,Ss,Vu,Xu,Yu,Kr,Zu,em,At,Rr,Bs,tm,om,Vr,Us,nm,sm,Xr,Ws,am,rm,Yr,Qs,im,lm,Ft,Hs,dm,go,cm,Zr,pm,hm,ei,um,mm,fm,ln,gm,dn,ll,_o,cn,ti,Ks,_m,oi,Tm,dl,Ne,Rs,ym,ni,vm,wm,Vs,bm,La,km,$m,Pm,Xs,Fm,Ys,Em,jm,xm,si,Gm,Jm,zt,ai,Zs,Mm,qm,ri,ea,Cm,Am,ii,ta,zm,Im,li,oa,Lm,Om,Et,na,Nm,To,Dm,di,Sm,Bm,ci,Um,Wm,Qm,pn,Hm,hn,cl;return l=new it({}),j=new it({}),ee=new Ke({props:{code:`from transformers import GPTJForCausalLM
import torch

model = GPTJForCausalLM.from_pretrained(
    "EleutherAI/gpt-j-6B", revision="float16", torch_dtype=torch.float16, low_cpu_mem_usage=True
)`,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>model = GPTJForCausalLM.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;EleutherAI/gpt-j-6B&quot;</span>, revision=<span class="hljs-string">&quot;float16&quot;</span>, torch_dtype=torch.float16, low_cpu_mem_usage=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)`}}),ue=new it({}),wn=new Ke({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 Ke({props:{code:`from transformers import GPTJForCausalLM, AutoTokenizer
import torch

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