import{S as n_,i as s_,s as a_,e as a,k as c,w as y,t as n,M as r_,c as r,d as t,m as p,a as i,x as w,h as s,b as h,G as e,g as m,y as k,q as $,o as P,B as O,v as i_,L as gt}from"../../chunks/vendor-hf-doc-builder.js";import{T as It}from"../../chunks/Tip-hf-doc-builder.js";import{D as he}from"../../chunks/Docstring-hf-doc-builder.js";import{C as pt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as lt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as mt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Eu}from"../../chunks/PipelineTag-hf-doc-builder.js";function l_(E){let d,v,u,_,b;return _=new pt({props:{code:`from transformers import OpenAIGPTConfig, OpenAIGPTModel

# Initializing a GPT configuration
configuration = OpenAIGPTConfig()

# Initializing a model (with random weights) from the configuration
model = OpenAIGPTModel(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> OpenAIGPTConfig, OpenAIGPTModel

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OpenAIGPTModel(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"),v=n("Examples:"),u=c(),y(_.$$.fragment)},l(l){d=r(l,"P",{});var f=i(d);v=s(f,"Examples:"),f.forEach(t),u=p(l),w(_.$$.fragment,l)},m(l,f){m(l,d,f),e(d,v),m(l,u,f),k(_,l,f),b=!0},p:gt,i(l){b||($(_.$$.fragment,l),b=!0)},o(l){P(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(u),O(_,l)}}}function d_(E){let d,v,u,_,b;return{c(){d=a("p"),v=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),_=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=r(l,"P",{});var f=i(d);v=s(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(f,"CODE",{});var M=i(u);_=s(M,"Module"),M.forEach(t),b=s(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(t)},m(l,f){m(l,d,f),e(d,v),e(d,u),e(u,_),e(d,b)},d(l){l&&t(d)}}}function c_(E){let d,v,u,_,b;return _=new pt({props:{code:`from transformers import OpenAIGPTTokenizer, OpenAIGPTModel
import torch

tokenizer = OpenAIGPTTokenizer.from_pretrained("openai-gpt")
model = OpenAIGPTModel.from_pretrained("openai-gpt")

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> OpenAIGPTTokenizer, OpenAIGPTModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = OpenAIGPTTokenizer.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OpenAIGPTModel.from_pretrained(<span class="hljs-string">&quot;openai-gpt&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"),v=n("Example:"),u=c(),y(_.$$.fragment)},l(l){d=r(l,"P",{});var f=i(d);v=s(f,"Example:"),f.forEach(t),u=p(l),w(_.$$.fragment,l)},m(l,f){m(l,d,f),e(d,v),m(l,u,f),k(_,l,f),b=!0},p:gt,i(l){b||($(_.$$.fragment,l),b=!0)},o(l){P(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(u),O(_,l)}}}function p_(E){let d,v,u,_,b;return{c(){d=a("p"),v=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),_=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=r(l,"P",{});var f=i(d);v=s(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(f,"CODE",{});var M=i(u);_=s(M,"Module"),M.forEach(t),b=s(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(t)},m(l,f){m(l,d,f),e(d,v),e(d,u),e(u,_),e(d,b)},d(l){l&&t(d)}}}function h_(E){let d,v,u,_,b;return _=new pt({props:{code:`import torch
from transformers import OpenAIGPTTokenizer, OpenAIGPTLMHeadModel

tokenizer = OpenAIGPTTokenizer.from_pretrained("openai-gpt")
model = OpenAIGPTLMHeadModel.from_pretrained("openai-gpt")

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> OpenAIGPTTokenizer, OpenAIGPTLMHeadModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = OpenAIGPTTokenizer.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OpenAIGPTLMHeadModel.from_pretrained(<span class="hljs-string">&quot;openai-gpt&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"),v=n("Example:"),u=c(),y(_.$$.fragment)},l(l){d=r(l,"P",{});var f=i(d);v=s(f,"Example:"),f.forEach(t),u=p(l),w(_.$$.fragment,l)},m(l,f){m(l,d,f),e(d,v),m(l,u,f),k(_,l,f),b=!0},p:gt,i(l){b||($(_.$$.fragment,l),b=!0)},o(l){P(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(u),O(_,l)}}}function f_(E){let d,v,u,_,b;return{c(){d=a("p"),v=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),_=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=r(l,"P",{});var f=i(d);v=s(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(f,"CODE",{});var M=i(u);_=s(M,"Module"),M.forEach(t),b=s(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(t)},m(l,f){m(l,d,f),e(d,v),e(d,u),e(u,_),e(d,b)},d(l){l&&t(d)}}}function u_(E){let d,v,u,_,b;return _=new pt({props:{code:`from transformers import OpenAIGPTTokenizer, OpenAIGPTDoubleHeadsModel
import torch

tokenizer = OpenAIGPTTokenizer.from_pretrained("openai-gpt")
model = OpenAIGPTDoubleHeadsModel.from_pretrained("openai-gpt")
tokenizer.add_special_tokens(
    {"cls_token": "[CLS]"}
)  # Add a [CLS] to the vocabulary (we should train it also!)
model.resize_token_embeddings(len(tokenizer))

choices = ["Hello, my dog is cute [CLS]", "Hello, my cat is cute [CLS]"]
input_ids = torch.tensor([tokenizer.encode(s) for s in choices]).unsqueeze(0)  # Batch size 1, 2 choices
mc_token_ids = torch.tensor([input_ids.size(-1) - 1, input_ids.size(-1) - 1]).unsqueeze(0)  # Batch size 1

outputs = model(input_ids, mc_token_ids=mc_token_ids)
lm_logits = outputs.logits
mc_logits = outputs.mc_logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> OpenAIGPTTokenizer, OpenAIGPTDoubleHeadsModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = OpenAIGPTTokenizer.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OpenAIGPTDoubleHeadsModel.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.add_special_tokens(
<span class="hljs-meta">... </span>    {<span class="hljs-string">&quot;cls_token&quot;</span>: <span class="hljs-string">&quot;[CLS]&quot;</span>}
<span class="hljs-meta">... </span>)  <span class="hljs-comment"># Add a [CLS] to the vocabulary (we should train it also!)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.resize_token_embeddings(<span class="hljs-built_in">len</span>(tokenizer))

<span class="hljs-meta">&gt;&gt;&gt; </span>choices = [<span class="hljs-string">&quot;Hello, my dog is cute [CLS]&quot;</span>, <span class="hljs-string">&quot;Hello, my cat is cute [CLS]&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = torch.tensor([tokenizer.encode(s) <span class="hljs-keyword">for</span> s <span class="hljs-keyword">in</span> choices]).unsqueeze(<span class="hljs-number">0</span>)  <span class="hljs-comment"># Batch size 1, 2 choices</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>mc_token_ids = torch.tensor([input_ids.size(-<span class="hljs-number">1</span>) - <span class="hljs-number">1</span>, input_ids.size(-<span class="hljs-number">1</span>) - <span class="hljs-number">1</span>]).unsqueeze(<span class="hljs-number">0</span>)  <span class="hljs-comment"># Batch size 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids, mc_token_ids=mc_token_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>lm_logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span>mc_logits = outputs.mc_logits`}}),{c(){d=a("p"),v=n("Examples:"),u=c(),y(_.$$.fragment)},l(l){d=r(l,"P",{});var f=i(d);v=s(f,"Examples:"),f.forEach(t),u=p(l),w(_.$$.fragment,l)},m(l,f){m(l,d,f),e(d,v),m(l,u,f),k(_,l,f),b=!0},p:gt,i(l){b||($(_.$$.fragment,l),b=!0)},o(l){P(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(u),O(_,l)}}}function m_(E){let d,v,u,_,b;return{c(){d=a("p"),v=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),_=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=r(l,"P",{});var f=i(d);v=s(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(f,"CODE",{});var M=i(u);_=s(M,"Module"),M.forEach(t),b=s(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(t)},m(l,f){m(l,d,f),e(d,v),e(d,u),e(u,_),e(d,b)},d(l){l&&t(d)}}}function g_(E){let d,v,u,_,b;return _=new pt({props:{code:`import torch
from transformers import OpenAIGPTTokenizer, OpenAIGPTForSequenceClassification

tokenizer = OpenAIGPTTokenizer.from_pretrained("openai-gpt")
model = OpenAIGPTForSequenceClassification.from_pretrained("openai-gpt")

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

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

predicted_class_id = logits.argmax().item()
model.config.id2label[predicted_class_id]
`,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> OpenAIGPTTokenizer, OpenAIGPTForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = OpenAIGPTTokenizer.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OpenAIGPTForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;openai-gpt&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>model.config.id2label[predicted_class_id]
`}}),{c(){d=a("p"),v=n("Example of single-label classification:"),u=c(),y(_.$$.fragment)},l(l){d=r(l,"P",{});var f=i(d);v=s(f,"Example of single-label classification:"),f.forEach(t),u=p(l),w(_.$$.fragment,l)},m(l,f){m(l,d,f),e(d,v),m(l,u,f),k(_,l,f),b=!0},p:gt,i(l){b||($(_.$$.fragment,l),b=!0)},o(l){P(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(u),O(_,l)}}}function __(E){let d,v;return d=new pt({props:{code:`# 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 = OpenAIGPTForSequenceClassification.from_pretrained("openai-gpt", num_labels=num_labels)

labels = torch.tensor([1])
loss = model(**inputs, labels=labels).loss
round(loss.item(), 2)
`,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>
<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 = OpenAIGPTForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;openai-gpt&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
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
`}}),{c(){y(d.$$.fragment)},l(u){w(d.$$.fragment,u)},m(u,_){k(d,u,_),v=!0},p:gt,i(u){v||($(d.$$.fragment,u),v=!0)},o(u){P(d.$$.fragment,u),v=!1},d(u){O(d,u)}}}function T_(E){let d,v,u,_,b;return _=new pt({props:{code:`import torch
from transformers import OpenAIGPTTokenizer, OpenAIGPTForSequenceClassification

tokenizer = OpenAIGPTTokenizer.from_pretrained("openai-gpt")
model = OpenAIGPTForSequenceClassification.from_pretrained("openai-gpt", 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_id = logits.argmax().item()
model.config.id2label[predicted_class_id]
`,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> OpenAIGPTTokenizer, OpenAIGPTForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = OpenAIGPTTokenizer.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OpenAIGPTForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;openai-gpt&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_id = logits.argmax().item()
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.id2label[predicted_class_id]
`}}),{c(){d=a("p"),v=n("Example of multi-label classification:"),u=c(),y(_.$$.fragment)},l(l){d=r(l,"P",{});var f=i(d);v=s(f,"Example of multi-label classification:"),f.forEach(t),u=p(l),w(_.$$.fragment,l)},m(l,f){m(l,d,f),e(d,v),m(l,u,f),k(_,l,f),b=!0},p:gt,i(l){b||($(_.$$.fragment,l),b=!0)},o(l){P(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(u),O(_,l)}}}function v_(E){let d,v;return d=new pt({props:{code:`# 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 = OpenAIGPTForSequenceClassification.from_pretrained(
    "openai-gpt", num_labels=num_labels, problem_type="multi_label_classification"
)

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

tokenizer = OpenAIGPTTokenizer.from_pretrained("openai-gpt")
model = TFOpenAIGPTModel.from_pretrained("openai-gpt")

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

tokenizer = OpenAIGPTTokenizer.from_pretrained("openai-gpt")
model = TFOpenAIGPTLMHeadModel.from_pretrained("openai-gpt")

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

tokenizer = OpenAIGPTTokenizer.from_pretrained("openai-gpt")
model = TFOpenAIGPTDoubleHeadsModel.from_pretrained("openai-gpt")

# Add a [CLS] to the vocabulary (we should train it also!)
tokenizer.add_special_tokens({"cls_token": "[CLS]"})
model.resize_token_embeddings(len(tokenizer))  # Update the model embeddings with the new vocabulary size
print(tokenizer.cls_token_id, len(tokenizer))  # The newly token the last token of the vocabulary

choices = ["Hello, my dog is cute [CLS]", "Hello, my cat is cute [CLS]"]
encoding = tokenizer(choices, return_tensors="tf")
inputs = {k: tf.expand_dims(v, 0) for k, v in encoding.items()}
inputs["mc_token_ids"] = tf.constant(
    [inputs["input_ids"].shape[-1] - 1, inputs["input_ids"].shape[-1] - 1]
)[
    None, :
]  # Batch size 1
outputs = model(inputs)
lm_prediction_scores, mc_prediction_scores = outputs[:2]`,highlighted:`<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><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> OpenAIGPTTokenizer, TFOpenAIGPTDoubleHeadsModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = OpenAIGPTTokenizer.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFOpenAIGPTDoubleHeadsModel.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Add a [CLS] to the vocabulary (we should train it also!)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.add_special_tokens({<span class="hljs-string">&quot;cls_token&quot;</span>: <span class="hljs-string">&quot;[CLS]&quot;</span>})
<span class="hljs-meta">&gt;&gt;&gt; </span>model.resize_token_embeddings(<span class="hljs-built_in">len</span>(tokenizer))  <span class="hljs-comment"># Update the model embeddings with the new vocabulary size</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.cls_token_id, <span class="hljs-built_in">len</span>(tokenizer))  <span class="hljs-comment"># The newly token the last token of the vocabulary</span>

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

tokenizer = OpenAIGPTTokenizer.from_pretrained("openai-gpt")
model = TFOpenAIGPTForSequenceClassification.from_pretrained("openai-gpt")

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])
model.config.id2label[predicted_class_id]
`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> OpenAIGPTTokenizer, TFOpenAIGPTForSequenceClassification
<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 = OpenAIGPTTokenizer.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFOpenAIGPTForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;openai-gpt&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>])
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.id2label[predicted_class_id]
`}}),{c(){d=a("p"),v=n("Example:"),u=c(),y(_.$$.fragment)},l(l){d=r(l,"P",{});var f=i(d);v=s(f,"Example:"),f.forEach(t),u=p(l),w(_.$$.fragment,l)},m(l,f){m(l,d,f),e(d,v),m(l,u,f),k(_,l,f),b=!0},p:gt,i(l){b||($(_.$$.fragment,l),b=!0)},o(l){P(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(u),O(_,l)}}}function F_(E){let d,v;return d=new pt({props:{code:`# 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 = TFOpenAIGPTForSequenceClassification.from_pretrained("openai-gpt", num_labels=num_labels)

labels = tf.constant(1)
loss = model(**inputs, labels=labels).loss
round(float(loss), 2)
`,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>
<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 = TFOpenAIGPTForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>, num_labels=num_labels)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tf.constant(<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(<span class="hljs-built_in">float</span>(loss), <span class="hljs-number">2</span>)
`}}),{c(){y(d.$$.fragment)},l(u){w(d.$$.fragment,u)},m(u,_){k(d,u,_),v=!0},p:gt,i(u){v||($(d.$$.fragment,u),v=!0)},o(u){P(d.$$.fragment,u),v=!1},d(u){O(d,u)}}}function z_(E){let d,v,u,_,b,l,f,M,Pe,_e,j,oe,te,A,Oe,K,Ae,Te,D,Ie,ae,V,Ge,ve,W,Me,be,U,fe,Ee,ne,F,q,ye,H,ue,Fe,X,re,ze,z,qe,J,we,ie,N,xe,Ce,L,Z,Q,le,de,x,ce,C,je,ke,T,I,Re,S,Je,Le,G,Qe,Se,Ye,Ze,Ne,B,Y,Ve,De,R,ee,et,me,tt,pe,Be,Cl,jl,Zs,Dl,Hl,Na,Ll,Sl,pi,St,uo,Ba,dn,Nl,Wa,Bl,hi,ea,Wl,fi,cn,ui,ta,pn,Ul,hn,Kl,Rl,mi,fn,gi,se,un,Vl,mn,Xl,Jl,Ql,gn,Yl,_n,Zl,ed,td,Tn,od,vn,nd,sd,ad,bn,rd,yn,id,ld,dd,wn,cd,kn,pd,hd,fd,$n,ud,Pn,md,gd,_d,On,Td,An,vd,bd,yd,oa,In,wd,kd,$d,_t,na,Pd,Od,Gn,Ad,Id,Mn,Gd,Md,En,Ed,Fd,zd,Ft,sa,qd,xd,Fn,Cd,jd,zn,Dd,Hd,_i,qn,Ti,aa,xn,Ld,Cn,Sd,Nd,vi,Nt,mo,Ua,jn,Bd,Ka,Wd,bi,ht,Dn,Ud,Gt,Kd,ra,Rd,Vd,ia,Xd,Jd,Hn,Qd,Yd,Zd,Bt,ec,la,tc,oc,da,nc,sc,ac,go,yi,Wt,_o,Ra,Ln,rc,Va,ic,wi,ot,Sn,lc,Xa,dc,cc,Nn,Ja,pc,hc,Mt,fc,Qa,uc,mc,Ya,gc,_c,Za,Tc,vc,bc,Bn,yc,ca,wc,kc,$c,pa,Wn,ki,Ut,To,er,Un,Pc,tr,Oc,$i,ft,Kn,Ac,Rn,Ic,or,Gc,Mc,Ec,Vn,nr,Fc,zc,sr,qc,xc,Xn,Cc,ha,jc,Dc,Pi,Kt,vo,ar,Jn,Hc,rr,Lc,Oi,Rt,Qn,Sc,ir,Nc,Ai,Vt,Yn,Bc,lr,Wc,Ii,Xt,bo,dr,Zn,Uc,cr,Kc,Gi,nt,es,Rc,pr,Vc,Xc,ts,Jc,fa,Qc,Yc,Zc,os,ep,ns,tp,op,np,Tt,ss,sp,Jt,ap,ua,rp,ip,hr,lp,dp,cp,yo,pp,wo,Mi,Qt,ko,fr,as,hp,ur,fp,Ei,st,rs,up,mr,mp,gp,is,_p,ma,Tp,vp,bp,ls,yp,ds,wp,kp,$p,vt,cs,Pp,Yt,Op,ga,Ap,Ip,gr,Gp,Mp,Ep,$o,Fp,Po,Fi,Zt,Oo,_r,ps,zp,Tr,qp,zi,at,hs,xp,vr,Cp,jp,fs,Dp,_a,Hp,Lp,Sp,us,Np,ms,Bp,Wp,Up,bt,gs,Kp,eo,Rp,Ta,Vp,Xp,br,Jp,Qp,Yp,Ao,Zp,Io,qi,to,Go,yr,_s,eh,wr,th,xi,rt,Ts,oh,it,nh,va,sh,ah,kr,rh,ih,$r,lh,dh,Pr,ch,ph,Or,hh,fh,uh,vs,mh,ba,gh,_h,Th,bs,vh,ys,bh,yh,wh,He,ws,kh,oo,$h,ya,Ph,Oh,Ar,Ah,Ih,Gh,Mo,Mh,Eo,Eh,Fo,Fh,zo,zh,qo,Ci,no,xo,Ir,ks,qh,Gr,xh,ji,We,$s,Ch,Mr,jh,Dh,Ps,Hh,wa,Lh,Sh,Nh,Os,Bh,As,Wh,Uh,Kh,Co,Rh,yt,Is,Vh,so,Xh,ka,Jh,Qh,Er,Yh,Zh,ef,jo,tf,Do,Di,ao,Ho,Fr,Gs,of,zr,nf,Hi,Ue,Ms,sf,qr,af,rf,Es,lf,$a,df,cf,pf,Fs,hf,zs,ff,uf,mf,Lo,gf,wt,qs,_f,ro,Tf,Pa,vf,bf,xr,yf,wf,kf,So,$f,No,Li,io,Bo,Cr,xs,Pf,jr,Of,Si,Ke,Cs,Af,Dr,If,Gf,js,Mf,Oa,Ef,Ff,zf,Ds,qf,Hs,xf,Cf,jf,Wo,Df,kt,Ls,Hf,lo,Lf,Aa,Sf,Nf,Hr,Bf,Wf,Uf,Uo,Kf,Ko,Ni,co,Ro,Lr,Ss,Rf,Sr,Vf,Bi,ge,Ns,Xf,Nr,Jf,Qf,Ia,Ga,Yf,Zf,eu,ut,tu,Br,ou,nu,Wr,su,au,Ur,ru,iu,Kr,lu,du,cu,Bs,pu,Ma,hu,fu,uu,Ws,mu,Us,gu,_u,Tu,Vo,vu,dt,Ks,bu,po,yu,Ea,wu,ku,Rr,$u,Pu,Ou,Xo,Au,Jo,Iu,Qo,Wi;return l=new lt({}),A=new lt({}),De=new pt({props:{code:`pip install spacy ftfy==4.4.3
python -m spacy download en`,highlighted:`pip install spacy ftfy==4.4.3
python -m spacy download en`}}),dn=new lt({}),cn=new Eu({props:{pipeline:"text-classification"}}),fn=new Eu({props:{pipeline:"text-generation"}}),qn=new Eu({props:{pipeline:"token-classification"}}),jn=new lt({}),Dn=new he({props:{name:"class transformers.OpenAIGPTConfig",anchor:"transformers.OpenAIGPTConfig",parameters:[{name:"vocab_size",val:" = 40478"},{name:"n_positions",val:" = 512"},{name:"n_embd",val:" = 768"},{name:"n_layer",val:" = 12"},{name:"n_head",val:" = 12"},{name:"afn",val:" = 'gelu'"},{name:"resid_pdrop",val:" = 0.1"},{name:"embd_pdrop",val:" = 0.1"},{name:"attn_pdrop",val:" = 0.1"},{name:"layer_norm_epsilon",val:" = 1e-05"},{name:"initializer_range",val:" = 0.02"},{name:"predict_special_tokens",val:" = True"},{name:"summary_type",val:" = 'cls_index'"},{name:"summary_use_proj",val:" = True"},{name:"summary_activation",val:" = None"},{name:"summary_proj_to_labels",val:" = True"},{name:"summary_first_dropout",val:" = 0.1"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.OpenAIGPTConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 40478) &#x2014;
Vocabulary size of the GPT-2 model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTModel">OpenAIGPTModel</a> or <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.TFOpenAIGPTModel">TFOpenAIGPTModel</a>.`,name:"vocab_size"},{anchor:"transformers.OpenAIGPTConfig.n_positions",description:`<strong>n_positions</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#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.OpenAIGPTConfig.n_embd",description:`<strong>n_embd</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the embeddings and hidden states.`,name:"n_embd"},{anchor:"transformers.OpenAIGPTConfig.n_layer",description:`<strong>n_layer</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"n_layer"},{anchor:"transformers.OpenAIGPTConfig.n_head",description:`<strong>n_head</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"n_head"},{anchor:"transformers.OpenAIGPTConfig.afn",description:`<strong>afn</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"afn"},{anchor:"transformers.OpenAIGPTConfig.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.OpenAIGPTConfig.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.OpenAIGPTConfig.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.OpenAIGPTConfig.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.OpenAIGPTConfig.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.OpenAIGPTConfig.predict_special_tokens",description:`<strong>predict_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not special tokens should be predicted when the model has a language modeling head.`,name:"predict_special_tokens"},{anchor:"transformers.OpenAIGPTConfig.summary_type",description:`<strong>summary_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;cls_index&quot;</code>) &#x2014;
Argument used when doing sequence summary, used in the models <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a> and
<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a>.</p>
<p>Has to be one of the following options:</p>
<ul>
<li><code>&quot;last&quot;</code>: Take the last token hidden state (like XLNet).</li>
<li><code>&quot;first&quot;</code>: Take the first token hidden state (like BERT).</li>
<li><code>&quot;mean&quot;</code>: Take the mean of all tokens hidden states.</li>
<li><code>&quot;cls_index&quot;</code>: Supply a Tensor of classification token position (like GPT/GPT-2).</li>
<li><code>&quot;attn&quot;</code>: Not implemented now, use multi-head attention.</li>
</ul>`,name:"summary_type"},{anchor:"transformers.OpenAIGPTConfig.summary_use_proj",description:`<strong>summary_use_proj</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Argument used when doing sequence summary, used in the models <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a> and
<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a>.</p>
<p>Whether or not to add a projection after the vector extraction.`,name:"summary_use_proj"},{anchor:"transformers.OpenAIGPTConfig.summary_activation",description:`<strong>summary_activation</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Argument used when doing sequence summary, used in the models <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a> and
<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a>.</p>
<p>Pass <code>&quot;tanh&quot;</code> for a tanh activation to the output, any other value will result in no activation.`,name:"summary_activation"},{anchor:"transformers.OpenAIGPTConfig.summary_proj_to_labels",description:`<strong>summary_proj_to_labels</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Argument used when doing sequence summary, used in the models <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a> and
<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a>.</p>
<p>Whether the projection outputs should have <code>config.num_labels</code> or <code>config.hidden_size</code> classes.`,name:"summary_proj_to_labels"},{anchor:"transformers.OpenAIGPTConfig.summary_first_dropout",description:`<strong>summary_first_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
Argument used when doing sequence summary, used in the models <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a> and
<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a>.</p>
<p>The dropout ratio to be used after the projection and activation.`,name:"summary_first_dropout"},{anchor:"transformers.OpenAIGPTConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/configuration_openai.py#L27"}}),go=new mt({props:{anchor:"transformers.OpenAIGPTConfig.example",$$slots:{default:[l_]},$$scope:{ctx:E}}}),Ln=new lt({}),Sn=new he({props:{name:"class transformers.OpenAIGPTTokenizer",anchor:"transformers.OpenAIGPTTokenizer",parameters:[{name:"vocab_file",val:""},{name:"merges_file",val:""},{name:"unk_token",val:" = '<unk>'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.OpenAIGPTTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.OpenAIGPTTokenizer.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.OpenAIGPTTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/tokenization_openai.py#L233"}}),Wn=new he({props:{name:"save_vocabulary",anchor:"transformers.OpenAIGPTTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/tokenization_openai.py#L366"}}),Un=new lt({}),Kn=new he({props:{name:"class transformers.OpenAIGPTTokenizerFast",anchor:"transformers.OpenAIGPTTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"merges_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"unk_token",val:" = '<unk>'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.OpenAIGPTTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.OpenAIGPTTokenizerFast.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.OpenAIGPTTokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/tokenization_openai_fast.py#L40"}}),Jn=new lt({}),Qn=new he({props:{name:"class transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput",anchor:"transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"mc_loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"logits",val:": FloatTensor = None"},{name:"mc_logits",val:": FloatTensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput.loss",description:`<strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Language modeling loss.`,name:"loss"},{anchor:"transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput.mc_loss",description:`<strong>mc_loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>mc_labels</code> is provided) &#x2014;
Multiple choice classification loss.`,name:"mc_loss"},{anchor:"transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput.logits",description:`<strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, sequence_length, config.vocab_size)</code>) &#x2014;
Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).`,name:"logits"},{anchor:"transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput.mc_logits",description:`<strong>mc_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>) &#x2014;
Prediction scores of the multiple choice classification head (scores for each choice before SoftMax).`,name:"mc_logits"},{anchor:"transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput.hidden_states",description:`<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>) &#x2014;
Tuple of <code>torch.FloatTensor</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.`,name:"hidden_states"},{anchor:"transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput.attentions",description:`<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>) &#x2014;
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.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_openai.py#L298"}}),Yn=new he({props:{name:"class transformers.models.openai.modeling_tf_openai.TFOpenAIGPTDoubleHeadsModelOutput",anchor:"transformers.models.openai.modeling_tf_openai.TFOpenAIGPTDoubleHeadsModelOutput",parameters:[{name:"logits",val:": Tensor = None"},{name:"mc_logits",val:": Tensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"}],parametersDescription:[{anchor:"transformers.models.openai.modeling_tf_openai.TFOpenAIGPTDoubleHeadsModelOutput.logits",description:`<strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length, config.vocab_size)</code>) &#x2014;
Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).`,name:"logits"},{anchor:"transformers.models.openai.modeling_tf_openai.TFOpenAIGPTDoubleHeadsModelOutput.mc_logits",description:`<strong>mc_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices)</code>) &#x2014;
Prediction scores of the multiple choice classification head (scores for each choice before SoftMax).`,name:"mc_logits"},{anchor:"transformers.models.openai.modeling_tf_openai.TFOpenAIGPTDoubleHeadsModelOutput.hidden_states",description:`<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>) &#x2014;
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.`,name:"hidden_states"},{anchor:"transformers.models.openai.modeling_tf_openai.TFOpenAIGPTDoubleHeadsModelOutput.attentions",description:`<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>) &#x2014;
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.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_tf_openai.py#L394"}}),Zn=new lt({}),es=new he({props:{name:"class transformers.OpenAIGPTModel",anchor:"transformers.OpenAIGPTModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.OpenAIGPTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig">OpenAIGPTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_openai.py#L402"}}),ss=new he({props:{name:"forward",anchor:"transformers.OpenAIGPTModel.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:"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.OpenAIGPTModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTTokenizer">OpenAIGPTTokenizer</a>. See <a href="/docs/transformers/v4.25.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.25.1/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.OpenAIGPTModel.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.OpenAIGPTModel.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.OpenAIGPTModel.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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.OpenAIGPTModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.OpenAIGPTModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.OpenAIGPTModel.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.OpenAIGPTModel.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.OpenAIGPTModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_openai.py#L428",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig"
>OpenAIGPTConfig</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>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),yo=new It({props:{$$slots:{default:[d_]},$$scope:{ctx:E}}}),wo=new mt({props:{anchor:"transformers.OpenAIGPTModel.forward.example",$$slots:{default:[c_]},$$scope:{ctx:E}}}),as=new lt({}),rs=new he({props:{name:"class transformers.OpenAIGPTLMHeadModel",anchor:"transformers.OpenAIGPTLMHeadModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.OpenAIGPTLMHeadModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig">OpenAIGPTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_openai.py#L533"}}),cs=new he({props:{name:"forward",anchor:"transformers.OpenAIGPTLMHeadModel.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:"labels",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.OpenAIGPTLMHeadModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTTokenizer">OpenAIGPTTokenizer</a>. See <a href="/docs/transformers/v4.25.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.25.1/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.OpenAIGPTLMHeadModel.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.OpenAIGPTLMHeadModel.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.OpenAIGPTLMHeadModel.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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.OpenAIGPTLMHeadModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.OpenAIGPTLMHeadModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.OpenAIGPTLMHeadModel.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.OpenAIGPTLMHeadModel.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.OpenAIGPTLMHeadModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.OpenAIGPTLMHeadModel.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for language modeling. Note that the labels <strong>are shifted</strong> inside the model, i.e. you can set
<code>labels = input_ids</code> Indices are selected in <code>[-100, 0, ..., config.vocab_size]</code> All labels set to <code>-100</code>
are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_openai.py#L550",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_outputs.CausalLMOutput"
>transformers.modeling_outputs.CausalLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig"
>OpenAIGPTConfig</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>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_outputs.CausalLMOutput"
>transformers.modeling_outputs.CausalLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),$o=new It({props:{$$slots:{default:[p_]},$$scope:{ctx:E}}}),Po=new mt({props:{anchor:"transformers.OpenAIGPTLMHeadModel.forward.example",$$slots:{default:[h_]},$$scope:{ctx:E}}}),ps=new lt({}),hs=new he({props:{name:"class transformers.OpenAIGPTDoubleHeadsModel",anchor:"transformers.OpenAIGPTDoubleHeadsModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.OpenAIGPTDoubleHeadsModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig">OpenAIGPTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_openai.py#L625"}}),gs=new he({props:{name:"forward",anchor:"transformers.OpenAIGPTDoubleHeadsModel.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:"mc_token_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"mc_labels",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.OpenAIGPTDoubleHeadsModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTTokenizer">OpenAIGPTTokenizer</a>. See <a href="/docs/transformers/v4.25.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.25.1/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.OpenAIGPTDoubleHeadsModel.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.OpenAIGPTDoubleHeadsModel.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.OpenAIGPTDoubleHeadsModel.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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.OpenAIGPTDoubleHeadsModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.OpenAIGPTDoubleHeadsModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.OpenAIGPTDoubleHeadsModel.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.OpenAIGPTDoubleHeadsModel.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.OpenAIGPTDoubleHeadsModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.OpenAIGPTDoubleHeadsModel.forward.mc_token_ids",description:`<strong>mc_token_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices)</code>, <em>optional</em>, default to index of the last token of the input) &#x2014;
Index of the classification token in each input sequence. Selected in the range <code>[0, input_ids.size(-1) - 1]</code>.`,name:"mc_token_ids"},{anchor:"transformers.OpenAIGPTDoubleHeadsModel.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>[-1, 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"},{anchor:"transformers.OpenAIGPTDoubleHeadsModel.forward.mc_labels",description:`<strong>mc_labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size)</code>, <em>optional</em>) &#x2014;
Labels for computing the multiple choice classification loss. Indices should be in <code>[0, ..., num_choices]</code>
where <em>num_choices</em> is the size of the second dimension of the input tensors. (see <em>input_ids</em> above)`,name:"mc_labels"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_openai.py#L645",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput"
>transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig"
>OpenAIGPTConfig</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.</p>
</li>
<li>
<p><strong>mc_loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>mc_labels</code> is provided) \u2014 Multiple choice classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, 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>mc_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>) \u2014 Prediction scores of the multiple choice classification head (scores for each choice 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 + 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(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput"
>transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ao=new It({props:{$$slots:{default:[f_]},$$scope:{ctx:E}}}),Io=new mt({props:{anchor:"transformers.OpenAIGPTDoubleHeadsModel.forward.example",$$slots:{default:[u_]},$$scope:{ctx:E}}}),_s=new lt({}),Ts=new he({props:{name:"class transformers.OpenAIGPTForSequenceClassification",anchor:"transformers.OpenAIGPTForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.OpenAIGPTForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig">OpenAIGPTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_openai.py#L753"}}),ws=new he({props:{name:"forward",anchor:"transformers.OpenAIGPTForSequenceClassification.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:"labels",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.OpenAIGPTForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTTokenizer">OpenAIGPTTokenizer</a>. See <a href="/docs/transformers/v4.25.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.25.1/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.OpenAIGPTForSequenceClassification.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.OpenAIGPTForSequenceClassification.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.OpenAIGPTForSequenceClassification.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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.OpenAIGPTForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.OpenAIGPTForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.OpenAIGPTForSequenceClassification.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.OpenAIGPTForSequenceClassification.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.OpenAIGPTForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.OpenAIGPTForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_openai.py#L763",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig"
>OpenAIGPTConfig</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>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Mo=new It({props:{$$slots:{default:[m_]},$$scope:{ctx:E}}}),Eo=new mt({props:{anchor:"transformers.OpenAIGPTForSequenceClassification.forward.example",$$slots:{default:[g_]},$$scope:{ctx:E}}}),Fo=new mt({props:{anchor:"transformers.OpenAIGPTForSequenceClassification.forward.example-2",$$slots:{default:[__]},$$scope:{ctx:E}}}),zo=new mt({props:{anchor:"transformers.OpenAIGPTForSequenceClassification.forward.example-3",$$slots:{default:[T_]},$$scope:{ctx:E}}}),qo=new mt({props:{anchor:"transformers.OpenAIGPTForSequenceClassification.forward.example-4",$$slots:{default:[v_]},$$scope:{ctx:E}}}),ks=new lt({}),$s=new he({props:{name:"class transformers.TFOpenAIGPTModel",anchor:"transformers.TFOpenAIGPTModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFOpenAIGPTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig">OpenAIGPTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_tf_openai.py#L524"}}),Co=new It({props:{$$slots:{default:[b_]},$$scope:{ctx:E}}}),Is=new he({props:{name:"call",anchor:"transformers.TFOpenAIGPTModel.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[tensorflow.python.keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, tensorflow.python.keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, tensorflow.python.keras.engine.keras_tensor.KerasTensor, 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:"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.TFOpenAIGPTModel.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTTokenizer">OpenAIGPTTokenizer</a>. See <a href="/docs/transformers/v4.25.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.25.1/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.TFOpenAIGPTModel.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.TFOpenAIGPTModel.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.TFOpenAIGPTModel.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.TFOpenAIGPTModel.call.head_mask",description:`<strong>head_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</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.TFOpenAIGPTModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> or <code>Numpy array</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.TFOpenAIGPTModel.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.TFOpenAIGPTModel.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.TFOpenAIGPTModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.25.1/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.TFOpenAIGPTModel.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"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_tf_openai.py#L529",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput"
>transformers.modeling_tf_outputs.TFBaseModelOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig"
>OpenAIGPTConfig</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>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.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>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput"
>transformers.modeling_tf_outputs.TFBaseModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),jo=new It({props:{$$slots:{default:[y_]},$$scope:{ctx:E}}}),Do=new mt({props:{anchor:"transformers.TFOpenAIGPTModel.call.example",$$slots:{default:[w_]},$$scope:{ctx:E}}}),Gs=new lt({}),Ms=new he({props:{name:"class transformers.TFOpenAIGPTLMHeadModel",anchor:"transformers.TFOpenAIGPTLMHeadModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFOpenAIGPTLMHeadModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig">OpenAIGPTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_tf_openai.py#L580"}}),Lo=new It({props:{$$slots:{default:[k_]},$$scope:{ctx:E}}}),qs=new he({props:{name:"call",anchor:"transformers.TFOpenAIGPTLMHeadModel.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[tensorflow.python.keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, tensorflow.python.keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, tensorflow.python.keras.engine.keras_tensor.KerasTensor, 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:"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:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"training",val:": typing.Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFOpenAIGPTLMHeadModel.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTTokenizer">OpenAIGPTTokenizer</a>. See <a href="/docs/transformers/v4.25.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.25.1/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.TFOpenAIGPTLMHeadModel.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.TFOpenAIGPTLMHeadModel.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.TFOpenAIGPTLMHeadModel.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.TFOpenAIGPTLMHeadModel.call.head_mask",description:`<strong>head_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</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.TFOpenAIGPTLMHeadModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> or <code>Numpy array</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.TFOpenAIGPTLMHeadModel.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.TFOpenAIGPTLMHeadModel.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.TFOpenAIGPTLMHeadModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.25.1/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.TFOpenAIGPTLMHeadModel.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.TFOpenAIGPTLMHeadModel.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the cross entropy classification loss. Indices should be in <code>[0, ..., config.vocab_size - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_tf_openai.py#L593",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutput"
>transformers.modeling_tf_outputs.TFCausalLMOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig"
>OpenAIGPTConfig</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>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutput"
>transformers.modeling_tf_outputs.TFCausalLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),So=new It({props:{$$slots:{default:[$_]},$$scope:{ctx:E}}}),No=new mt({props:{anchor:"transformers.TFOpenAIGPTLMHeadModel.call.example",$$slots:{default:[P_]},$$scope:{ctx:E}}}),xs=new lt({}),Cs=new he({props:{name:"class transformers.TFOpenAIGPTDoubleHeadsModel",anchor:"transformers.TFOpenAIGPTDoubleHeadsModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFOpenAIGPTDoubleHeadsModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig">OpenAIGPTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_tf_openai.py#L674"}}),Wo=new It({props:{$$slots:{default:[O_]},$$scope:{ctx:E}}}),Ls=new he({props:{name:"call",anchor:"transformers.TFOpenAIGPTDoubleHeadsModel.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[tensorflow.python.keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, tensorflow.python.keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, tensorflow.python.keras.engine.keras_tensor.KerasTensor, 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:"mc_token_ids",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.TFOpenAIGPTDoubleHeadsModel.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTTokenizer">OpenAIGPTTokenizer</a>. See <a href="/docs/transformers/v4.25.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.25.1/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.TFOpenAIGPTDoubleHeadsModel.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.TFOpenAIGPTDoubleHeadsModel.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.TFOpenAIGPTDoubleHeadsModel.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.TFOpenAIGPTDoubleHeadsModel.call.head_mask",description:`<strong>head_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</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.TFOpenAIGPTDoubleHeadsModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> or <code>Numpy array</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.TFOpenAIGPTDoubleHeadsModel.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.TFOpenAIGPTDoubleHeadsModel.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.TFOpenAIGPTDoubleHeadsModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.25.1/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.TFOpenAIGPTDoubleHeadsModel.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.TFOpenAIGPTDoubleHeadsModel.call.mc_token_ids",description:`<strong>mc_token_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, num_choices)</code>, <em>optional</em>, default to index of the last token of the input) &#x2014;
Index of the classification token in each input sequence. Selected in the range <code>[0, input_ids.size(-1) - 1]</code>.`,name:"mc_token_ids"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_tf_openai.py#L683",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.models.openai.modeling_tf_openai.TFOpenAIGPTDoubleHeadsModelOutput"
>transformers.models.openai.modeling_tf_openai.TFOpenAIGPTDoubleHeadsModelOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig"
>OpenAIGPTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices, 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>mc_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices)</code>) \u2014 Prediction scores of the multiple choice classification head (scores for each choice before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.models.openai.modeling_tf_openai.TFOpenAIGPTDoubleHeadsModelOutput"
>transformers.models.openai.modeling_tf_openai.TFOpenAIGPTDoubleHeadsModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Uo=new It({props:{$$slots:{default:[A_]},$$scope:{ctx:E}}}),Ko=new mt({props:{anchor:"transformers.TFOpenAIGPTDoubleHeadsModel.call.example",$$slots:{default:[I_]},$$scope:{ctx:E}}}),Ss=new lt({}),Ns=new he({props:{name:"class transformers.TFOpenAIGPTForSequenceClassification",anchor:"transformers.TFOpenAIGPTForSequenceClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFOpenAIGPTForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig">OpenAIGPTConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_tf_openai.py#L809"}}),Vo=new It({props:{$$slots:{default:[G_]},$$scope:{ctx:E}}}),Ks=new he({props:{name:"call",anchor:"transformers.TFOpenAIGPTForSequenceClassification.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[tensorflow.python.keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, tensorflow.python.keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, tensorflow.python.keras.engine.keras_tensor.KerasTensor, 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:"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:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"training",val:": typing.Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFOpenAIGPTForSequenceClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTTokenizer">OpenAIGPTTokenizer</a>. See <a href="/docs/transformers/v4.25.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.25.1/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.TFOpenAIGPTForSequenceClassification.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.TFOpenAIGPTForSequenceClassification.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.TFOpenAIGPTForSequenceClassification.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.TFOpenAIGPTForSequenceClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</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.TFOpenAIGPTForSequenceClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> or <code>Numpy array</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.TFOpenAIGPTForSequenceClassification.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.TFOpenAIGPTForSequenceClassification.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.TFOpenAIGPTForSequenceClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.25.1/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.TFOpenAIGPTForSequenceClassification.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.TFOpenAIGPTForSequenceClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the cross entropy classification loss. Indices should be in <code>[0, ..., config.vocab_size - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/openai/modeling_tf_openai.py#L821",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTConfig"
>OpenAIGPTConfig</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>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Xo=new It({props:{$$slots:{default:[M_]},$$scope:{ctx:E}}}),Jo=new mt({props:{anchor:"transformers.TFOpenAIGPTForSequenceClassification.call.example",$$slots:{default:[E_]},$$scope:{ctx:E}}}),Qo=new mt({props:{anchor:"transformers.TFOpenAIGPTForSequenceClassification.call.example-2",$$slots:{default:[F_]},$$scope:{ctx:E}}}),{c(){d=a("meta"),v=c(),u=a("h1"),_=a("a"),b=a("span"),y(l.$$.fragment),f=c(),M=a("span"),Pe=n("OpenAI GPT"),_e=c(),j=a("h2"),oe=a("a"),te=a("span"),y(A.$$.fragment),Oe=c(),K=a("span"),Ae=n("Overview"),Te=c(),D=a("p"),Ie=n("OpenAI GPT model was proposed in "),ae=a("a"),V=n("Improving Language Understanding by Generative Pre-Training"),Ge=n(`
by Alec Radford, Karthik Narasimhan, Tim Salimans and Ilya Sutskever. It\u2019s a causal (unidirectional) transformer
pre-trained using language modeling on a large corpus will long range dependencies, the Toronto Book Corpus.`),ve=c(),W=a("p"),Me=n("The abstract from the paper is the following:"),be=c(),U=a("p"),fe=a("em"),Ee=n(`Natural language understanding comprises a wide range of diverse tasks such as textual entailment, question answering,
semantic similarity assessment, and document classification. Although large unlabeled text corpora are abundant,
labeled data for learning these specific tasks is scarce, making it challenging for discriminatively trained models to
perform adequately. We demonstrate that large gains on these tasks can be realized by generative pretraining of a
language model on a diverse corpus of unlabeled text, followed by discriminative fine-tuning on each specific task. In
contrast to previous approaches, we make use of task-aware input transformations during fine-tuning to achieve
effective transfer while requiring minimal changes to the model architecture. We demonstrate the effectiveness of our
approach on a wide range of benchmarks for natural language understanding. Our general task-agnostic model outperforms
discriminatively trained models that use architectures specifically crafted for each task, significantly improving upon
the state of the art in 9 out of the 12 tasks studied.`),ne=c(),F=a("p"),q=n("Tips:"),ye=c(),H=a("ul"),ue=a("li"),Fe=n(`GPT is a model with absolute position embeddings so it\u2019s usually advised to pad the inputs on the right rather than
the left.`),X=c(),re=a("li"),ze=n(`GPT was trained with a causal language modeling (CLM) objective and is therefore powerful at predicting the next
token in a sequence. Leveraging this feature allows GPT-2 to generate syntactically coherent text as it can be
observed in the `),z=a("em"),qe=n("run_generation.py"),J=n(" example script."),we=c(),ie=a("p"),N=a("a"),xe=n("Write With Transformer"),Ce=n(` is a webapp created and hosted by Hugging Face
showcasing the generative capabilities of several models. GPT is one of them.`),L=c(),Z=a("p"),Q=n("This model was contributed by "),le=a("a"),de=n("thomwolf"),x=n(". The original code can be found "),ce=a("a"),C=n("here"),je=n("."),ke=c(),T=a("p"),I=n("Note:"),Re=c(),S=a("p"),Je=n("If you want to reproduce the original tokenization process of the "),Le=a("em"),G=n("OpenAI GPT"),Qe=n(" paper, you will need to install "),Se=a("code"),Ye=n("ftfy"),Ze=n(`
and `),Ne=a("code"),B=n("SpaCy"),Y=n(":"),Ve=c(),y(De.$$.fragment),R=c(),ee=a("p"),et=n("If you don\u2019t install "),me=a("code"),tt=n("ftfy"),pe=n(" and "),Be=a("code"),Cl=n("SpaCy"),jl=n(", the "),Zs=a("a"),Dl=n("OpenAIGPTTokenizer"),Hl=n(` will default to tokenize
using BERT\u2019s `),Na=a("code"),Ll=n("BasicTokenizer"),Sl=n(" followed by Byte-Pair Encoding (which should be fine for most usage, don\u2019t worry)."),pi=c(),St=a("h2"),uo=a("a"),Ba=a("span"),y(dn.$$.fragment),Nl=c(),Wa=a("span"),Bl=n("Resources"),hi=c(),ea=a("p"),Wl=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with DistilBERT. 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."),fi=c(),y(cn.$$.fragment),ui=c(),ta=a("ul"),pn=a("li"),Ul=n("A blog post on "),hn=a("a"),Kl=n("outperforming OpenAI GPT-3 with SetFit for text-classification"),Rl=n("."),mi=c(),y(fn.$$.fragment),gi=c(),se=a("ul"),un=a("li"),Vl=n("A blog on how to "),mn=a("a"),Xl=n("Finetune a non-English GPT-2 Model with Hugging Face"),Jl=n("."),Ql=c(),gn=a("li"),Yl=n("A blog on "),_n=a("a"),Zl=n("How to generate text: using different decoding methods for language generation with Transformers"),ed=n(" with GPT-2."),td=c(),Tn=a("li"),od=n("A blog on "),vn=a("a"),nd=n("Training CodeParrot \u{1F99C} from Scratch"),sd=n(", a large GPT-2 model."),ad=c(),bn=a("li"),rd=n("A blog on "),yn=a("a"),id=n("Faster Text Generation with TensorFlow and XLA"),ld=n(" with GPT-2."),dd=c(),wn=a("li"),cd=n("A blog on "),kn=a("a"),pd=n("How to train a Language Model with Megatron-LM"),hd=n(" with a GPT-2 model."),fd=c(),$n=a("li"),ud=n("A notebook on how to "),Pn=a("a"),md=n("finetune GPT2 to generate lyrics in the style of your favorite artist"),gd=n(". \u{1F30E}"),_d=c(),On=a("li"),Td=n("A notebook on how to "),An=a("a"),vd=n("finetune GPT2 to generate tweets in the style of your favorite Twitter user"),bd=n(". \u{1F30E}"),yd=c(),oa=a("li"),In=a("a"),wd=n("Causal language modeling"),kd=n(" chapter of the \u{1F917} Hugging Face Course."),$d=c(),_t=a("li"),na=a("a"),Pd=n("OpenAIGPTLMHeadModel"),Od=n(" is supported by this "),Gn=a("a"),Ad=n("causal language modeling example script"),Id=n(", "),Mn=a("a"),Gd=n("text generation example script"),Md=n(" and "),En=a("a"),Ed=n("notebook"),Fd=n("."),zd=c(),Ft=a("li"),sa=a("a"),qd=n("TFOpenAIGPTLMHeadModel"),xd=n(" is supported by this "),Fn=a("a"),Cd=n("causal language modeling example script"),jd=n(" and "),zn=a("a"),Dd=n("notebook"),Hd=n("."),_i=c(),y(qn.$$.fragment),Ti=c(),aa=a("ul"),xn=a("li"),Ld=n("A course material on "),Cn=a("a"),Sd=n("Byte-Pair Encoding tokenization"),Nd=n("."),vi=c(),Nt=a("h2"),mo=a("a"),Ua=a("span"),y(jn.$$.fragment),Bd=c(),Ka=a("span"),Wd=n("OpenAIGPTConfig"),bi=c(),ht=a("div"),y(Dn.$$.fragment),Ud=c(),Gt=a("p"),Kd=n("This is the configuration class to store the configuration of a "),ra=a("a"),Rd=n("OpenAIGPTModel"),Vd=n(" or a "),ia=a("a"),Xd=n("TFOpenAIGPTModel"),Jd=n(`. It is
used to instantiate a GPT 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
`),Hn=a("a"),Qd=n("openai-gpt"),Yd=n(" architecture from OpenAI."),Zd=c(),Bt=a("p"),ec=n("Configuration objects inherit from "),la=a("a"),tc=n("PretrainedConfig"),oc=n(` and can be used to control the model outputs. Read the
documentation from `),da=a("a"),nc=n("PretrainedConfig"),sc=n(" for more information."),ac=c(),y(go.$$.fragment),yi=c(),Wt=a("h2"),_o=a("a"),Ra=a("span"),y(Ln.$$.fragment),rc=c(),Va=a("span"),ic=n("OpenAIGPTTokenizer"),wi=c(),ot=a("div"),y(Sn.$$.fragment),lc=c(),Xa=a("p"),dc=n("Construct a GPT Tokenizer. Based on Byte-Pair-Encoding with the following peculiarities:"),cc=c(),Nn=a("ul"),Ja=a("li"),pc=n("lowercases all inputs,"),hc=c(),Mt=a("li"),fc=n("uses "),Qa=a("code"),uc=n("SpaCy"),mc=n(" tokenizer and "),Ya=a("code"),gc=n("ftfy"),_c=n(` for pre-BPE tokenization if they are installed, fallback to BERT\u2019s
`),Za=a("code"),Tc=n("BasicTokenizer"),vc=n(" if not."),bc=c(),Bn=a("p"),yc=n("This tokenizer inherits from "),ca=a("a"),wc=n("PreTrainedTokenizer"),kc=n(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),$c=c(),pa=a("div"),y(Wn.$$.fragment),ki=c(),Ut=a("h2"),To=a("a"),er=a("span"),y(Un.$$.fragment),Pc=c(),tr=a("span"),Oc=n("OpenAIGPTTokenizerFast"),$i=c(),ft=a("div"),y(Kn.$$.fragment),Ac=c(),Rn=a("p"),Ic=n("Construct a \u201Cfast\u201D GPT Tokenizer (backed by HuggingFace\u2019s "),or=a("em"),Gc=n("tokenizers"),Mc=n(` library). Based on Byte-Pair-Encoding with
the following peculiarities:`),Ec=c(),Vn=a("ul"),nr=a("li"),Fc=n("lower case all inputs"),zc=c(),sr=a("li"),qc=n("uses BERT\u2019s BasicTokenizer for pre-BPE tokenization"),xc=c(),Xn=a("p"),Cc=n("This tokenizer inherits from "),ha=a("a"),jc=n("PreTrainedTokenizerFast"),Dc=n(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Pi=c(),Kt=a("h2"),vo=a("a"),ar=a("span"),y(Jn.$$.fragment),Hc=c(),rr=a("span"),Lc=n("OpenAI specific outputs"),Oi=c(),Rt=a("div"),y(Qn.$$.fragment),Sc=c(),ir=a("p"),Nc=n("Base class for outputs of models predicting if two sentences are consecutive or not."),Ai=c(),Vt=a("div"),y(Yn.$$.fragment),Bc=c(),lr=a("p"),Wc=n("Base class for outputs of models predicting if two sentences are consecutive or not."),Ii=c(),Xt=a("h2"),bo=a("a"),dr=a("span"),y(Zn.$$.fragment),Uc=c(),cr=a("span"),Kc=n("OpenAIGPTModel"),Gi=c(),nt=a("div"),y(es.$$.fragment),Rc=c(),pr=a("p"),Vc=n("The bare OpenAI GPT transformer model outputting raw hidden-states without any specific head on top."),Xc=c(),ts=a("p"),Jc=n("This model inherits from "),fa=a("a"),Qc=n("PreTrainedModel"),Yc=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Zc=c(),os=a("p"),ep=n("This model is also a PyTorch "),ns=a("a"),tp=n("torch.nn.Module"),op=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),np=c(),Tt=a("div"),y(ss.$$.fragment),sp=c(),Jt=a("p"),ap=n("The "),ua=a("a"),rp=n("OpenAIGPTModel"),ip=n(" forward method, overrides the "),hr=a("code"),lp=n("__call__"),dp=n(" special method."),cp=c(),y(yo.$$.fragment),pp=c(),y(wo.$$.fragment),Mi=c(),Qt=a("h2"),ko=a("a"),fr=a("span"),y(as.$$.fragment),hp=c(),ur=a("span"),fp=n("OpenAIGPTLMHeadModel"),Ei=c(),st=a("div"),y(rs.$$.fragment),up=c(),mr=a("p"),mp=n(`OpenAI GPT Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),gp=c(),is=a("p"),_p=n("This model inherits from "),ma=a("a"),Tp=n("PreTrainedModel"),vp=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),bp=c(),ls=a("p"),yp=n("This model is also a PyTorch "),ds=a("a"),wp=n("torch.nn.Module"),kp=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),$p=c(),vt=a("div"),y(cs.$$.fragment),Pp=c(),Yt=a("p"),Op=n("The "),ga=a("a"),Ap=n("OpenAIGPTLMHeadModel"),Ip=n(" forward method, overrides the "),gr=a("code"),Gp=n("__call__"),Mp=n(" special method."),Ep=c(),y($o.$$.fragment),Fp=c(),y(Po.$$.fragment),Fi=c(),Zt=a("h2"),Oo=a("a"),_r=a("span"),y(ps.$$.fragment),zp=c(),Tr=a("span"),qp=n("OpenAIGPTDoubleHeadsModel"),zi=c(),at=a("div"),y(hs.$$.fragment),xp=c(),vr=a("p"),Cp=n(`OpenAI GPT Model transformer with a language modeling and a multiple-choice classification head on top e.g. for
RocStories/SWAG tasks. The two heads are two linear layers. The language modeling head has its weights tied to the
input embeddings, the classification head takes as input the input of a specified classification token index in the
input sequence).`),jp=c(),fs=a("p"),Dp=n("This model inherits from "),_a=a("a"),Hp=n("PreTrainedModel"),Lp=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Sp=c(),us=a("p"),Np=n("This model is also a PyTorch "),ms=a("a"),Bp=n("torch.nn.Module"),Wp=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Up=c(),bt=a("div"),y(gs.$$.fragment),Kp=c(),eo=a("p"),Rp=n("The "),Ta=a("a"),Vp=n("OpenAIGPTDoubleHeadsModel"),Xp=n(" forward method, overrides the "),br=a("code"),Jp=n("__call__"),Qp=n(" special method."),Yp=c(),y(Ao.$$.fragment),Zp=c(),y(Io.$$.fragment),qi=c(),to=a("h2"),Go=a("a"),yr=a("span"),y(_s.$$.fragment),eh=c(),wr=a("span"),th=n("OpenAIGPTForSequenceClassification"),xi=c(),rt=a("div"),y(Ts.$$.fragment),oh=c(),it=a("p"),nh=n(`The Original OpenAI GPT Model transformer with a sequence classification head on top (linear layer).
`),va=a("a"),sh=n("OpenAIGPTForSequenceClassification"),ah=n(` uses the last token in order to do the classification, as other causal
models (e.g. GPT-2) do. Since it does classification on the last token, it requires to know the position of the
last token. If a `),kr=a("code"),rh=n("pad_token_id"),ih=n(` is defined in the configuration, it finds the last token that is not a padding
token in each row. If no `),$r=a("code"),lh=n("pad_token_id"),dh=n(` is defined, it simply takes the last value in each row of the batch. Since
it cannot guess the padding tokens when `),Pr=a("code"),ch=n("inputs_embeds"),ph=n(" are passed instead of "),Or=a("code"),hh=n("input_ids"),fh=n(`, it does the same (take
the last value in each row of the batch).`),uh=c(),vs=a("p"),mh=n("This model inherits from "),ba=a("a"),gh=n("PreTrainedModel"),_h=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Th=c(),bs=a("p"),vh=n("This model is also a PyTorch "),ys=a("a"),bh=n("torch.nn.Module"),yh=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),wh=c(),He=a("div"),y(ws.$$.fragment),kh=c(),oo=a("p"),$h=n("The "),ya=a("a"),Ph=n("OpenAIGPTForSequenceClassification"),Oh=n(" forward method, overrides the "),Ar=a("code"),Ah=n("__call__"),Ih=n(" special method."),Gh=c(),y(Mo.$$.fragment),Mh=c(),y(Eo.$$.fragment),Eh=c(),y(Fo.$$.fragment),Fh=c(),y(zo.$$.fragment),zh=c(),y(qo.$$.fragment),Ci=c(),no=a("h2"),xo=a("a"),Ir=a("span"),y(ks.$$.fragment),qh=c(),Gr=a("span"),xh=n("TFOpenAIGPTModel"),ji=c(),We=a("div"),y($s.$$.fragment),Ch=c(),Mr=a("p"),jh=n("The bare OpenAI GPT transformer model outputting raw hidden-states without any specific head on top."),Dh=c(),Ps=a("p"),Hh=n("This model inherits from "),wa=a("a"),Lh=n("TFPreTrainedModel"),Sh=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Nh=c(),Os=a("p"),Bh=n("This model is also a "),As=a("a"),Wh=n("tf.keras.Model"),Uh=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Kh=c(),y(Co.$$.fragment),Rh=c(),yt=a("div"),y(Is.$$.fragment),Vh=c(),so=a("p"),Xh=n("The "),ka=a("a"),Jh=n("TFOpenAIGPTModel"),Qh=n(" forward method, overrides the "),Er=a("code"),Yh=n("__call__"),Zh=n(" special method."),ef=c(),y(jo.$$.fragment),tf=c(),y(Do.$$.fragment),Di=c(),ao=a("h2"),Ho=a("a"),Fr=a("span"),y(Gs.$$.fragment),of=c(),zr=a("span"),nf=n("TFOpenAIGPTLMHeadModel"),Hi=c(),Ue=a("div"),y(Ms.$$.fragment),sf=c(),qr=a("p"),af=n(`OpenAI GPT Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),rf=c(),Es=a("p"),lf=n("This model inherits from "),$a=a("a"),df=n("TFPreTrainedModel"),cf=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),pf=c(),Fs=a("p"),hf=n("This model is also a "),zs=a("a"),ff=n("tf.keras.Model"),uf=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),mf=c(),y(Lo.$$.fragment),gf=c(),wt=a("div"),y(qs.$$.fragment),_f=c(),ro=a("p"),Tf=n("The "),Pa=a("a"),vf=n("TFOpenAIGPTLMHeadModel"),bf=n(" forward method, overrides the "),xr=a("code"),yf=n("__call__"),wf=n(" special method."),kf=c(),y(So.$$.fragment),$f=c(),y(No.$$.fragment),Li=c(),io=a("h2"),Bo=a("a"),Cr=a("span"),y(xs.$$.fragment),Pf=c(),jr=a("span"),Of=n("TFOpenAIGPTDoubleHeadsModel"),Si=c(),Ke=a("div"),y(Cs.$$.fragment),Af=c(),Dr=a("p"),If=n(`OpenAI GPT Model transformer with a language modeling and a multiple-choice classification head on top e.g. for
RocStories/SWAG tasks. The two heads are two linear layers. The language modeling head has its weights tied to the
input embeddings, the classification head takes as input the input of a specified classification token index in the
input sequence).`),Gf=c(),js=a("p"),Mf=n("This model inherits from "),Oa=a("a"),Ef=n("TFPreTrainedModel"),Ff=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),zf=c(),Ds=a("p"),qf=n("This model is also a "),Hs=a("a"),xf=n("tf.keras.Model"),Cf=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),jf=c(),y(Wo.$$.fragment),Df=c(),kt=a("div"),y(Ls.$$.fragment),Hf=c(),lo=a("p"),Lf=n("The "),Aa=a("a"),Sf=n("TFOpenAIGPTDoubleHeadsModel"),Nf=n(" forward method, overrides the "),Hr=a("code"),Bf=n("__call__"),Wf=n(" special method."),Uf=c(),y(Uo.$$.fragment),Kf=c(),y(Ko.$$.fragment),Ni=c(),co=a("h2"),Ro=a("a"),Lr=a("span"),y(Ss.$$.fragment),Rf=c(),Sr=a("span"),Vf=n("TFOpenAIGPTForSequenceClassification"),Bi=c(),ge=a("div"),y(Ns.$$.fragment),Xf=c(),Nr=a("p"),Jf=n("The OpenAI GPT Model transformer with a sequence classification head on top (linear layer)."),Qf=c(),Ia=a("p"),Ga=a("a"),Yf=n("TFOpenAIGPTForSequenceClassification"),Zf=n(` uses the last token in order to do the classification, as other causal
models (e.g. GPT-2) do.`),eu=c(),ut=a("p"),tu=n(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Br=a("code"),ou=n("pad_token_id"),nu=n(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Wr=a("code"),su=n("pad_token_id"),au=n(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ur=a("code"),ru=n("inputs_embeds"),iu=n(" are passed instead of "),Kr=a("code"),lu=n("input_ids"),du=n(`, it does the same (take the last value in
each row of the batch).`),cu=c(),Bs=a("p"),pu=n("This model inherits from "),Ma=a("a"),hu=n("TFPreTrainedModel"),fu=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),uu=c(),Ws=a("p"),mu=n("This model is also a "),Us=a("a"),gu=n("tf.keras.Model"),_u=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Tu=c(),y(Vo.$$.fragment),vu=c(),dt=a("div"),y(Ks.$$.fragment),bu=c(),po=a("p"),yu=n("The "),Ea=a("a"),wu=n("TFOpenAIGPTForSequenceClassification"),ku=n(" forward method, overrides the "),Rr=a("code"),$u=n("__call__"),Pu=n(" special method."),Ou=c(),y(Xo.$$.fragment),Au=c(),y(Jo.$$.fragment),Iu=c(),y(Qo.$$.fragment),this.h()},l(o){const g=r_('[data-svelte="svelte-1phssyn"]',document.head);d=r(g,"META",{name:!0,content:!0}),g.forEach(t),v=p(o),u=r(o,"H1",{class:!0});var Rs=i(u);_=r(Rs,"A",{id:!0,class:!0,href:!0});var Vr=i(_);b=r(Vr,"SPAN",{});var Xr=i(b);w(l.$$.fragment,Xr),Xr.forEach(t),Vr.forEach(t),f=p(Rs),M=r(Rs,"SPAN",{});var Jr=i(M);Pe=s(Jr,"OpenAI GPT"),Jr.forEach(t),Rs.forEach(t),_e=p(o),j=r(o,"H2",{class:!0});var Vs=i(j);oe=r(Vs,"A",{id:!0,class:!0,href:!0});var Qr=i(oe);te=r(Qr,"SPAN",{});var Yr=i(te);w(A.$$.fragment,Yr),Yr.forEach(t),Qr.forEach(t),Oe=p(Vs),K=r(Vs,"SPAN",{});var Zr=i(K);Ae=s(Zr,"Overview"),Zr.forEach(t),Vs.forEach(t),Te=p(o),D=r(o,"P",{});var Xs=i(D);Ie=s(Xs,"OpenAI GPT model was proposed in "),ae=r(Xs,"A",{href:!0,rel:!0});var ei=i(ae);V=s(ei,"Improving Language Understanding by Generative Pre-Training"),ei.forEach(t),Ge=s(Xs,`
by Alec Radford, Karthik Narasimhan, Tim Salimans and Ilya Sutskever. It\u2019s a causal (unidirectional) transformer
pre-trained using language modeling on a large corpus will long range dependencies, the Toronto Book Corpus.`),Xs.forEach(t),ve=p(o),W=r(o,"P",{});var ti=i(W);Me=s(ti,"The abstract from the paper is the following:"),ti.forEach(t),be=p(o),U=r(o,"P",{});var oi=i(U);fe=r(oi,"EM",{});var ni=i(fe);Ee=s(ni,`Natural language understanding comprises a wide range of diverse tasks such as textual entailment, question answering,
semantic similarity assessment, and document classification. Although large unlabeled text corpora are abundant,
labeled data for learning these specific tasks is scarce, making it challenging for discriminatively trained models to
perform adequately. We demonstrate that large gains on these tasks can be realized by generative pretraining of a
language model on a diverse corpus of unlabeled text, followed by discriminative fine-tuning on each specific task. In
contrast to previous approaches, we make use of task-aware input transformations during fine-tuning to achieve
effective transfer while requiring minimal changes to the model architecture. We demonstrate the effectiveness of our
approach on a wide range of benchmarks for natural language understanding. Our general task-agnostic model outperforms
discriminatively trained models that use architectures specifically crafted for each task, significantly improving upon
the state of the art in 9 out of the 12 tasks studied.`),ni.forEach(t),oi.forEach(t),ne=p(o),F=r(o,"P",{});var si=i(F);q=s(si,"Tips:"),si.forEach(t),ye=p(o),H=r(o,"UL",{});var Js=i(H);ue=r(Js,"LI",{});var ai=i(ue);Fe=s(ai,`GPT is a model with absolute position embeddings so it\u2019s usually advised to pad the inputs on the right rather than
the left.`),ai.forEach(t),X=p(Js),re=r(Js,"LI",{});var Qs=i(re);ze=s(Qs,`GPT was trained with a causal language modeling (CLM) objective and is therefore powerful at predicting the next
token in a sequence. Leveraging this feature allows GPT-2 to generate syntactically coherent text as it can be
observed in the `),z=r(Qs,"EM",{});var ri=i(z);qe=s(ri,"run_generation.py"),ri.forEach(t),J=s(Qs," example script."),Qs.forEach(t),Js.forEach(t),we=p(o),ie=r(o,"P",{});var Fa=i(ie);N=r(Fa,"A",{href:!0,rel:!0});var ii=i(N);xe=s(ii,"Write With Transformer"),ii.forEach(t),Ce=s(Fa,` is a webapp created and hosted by Hugging Face
showcasing the generative capabilities of several models. GPT is one of them.`),Fa.forEach(t),L=p(o),Z=r(o,"P",{});var ho=i(Z);Q=s(ho,"This model was contributed by "),le=r(ho,"A",{href:!0,rel:!0});var li=i(le);de=s(li,"thomwolf"),li.forEach(t),x=s(ho,". The original code can be found "),ce=r(ho,"A",{href:!0,rel:!0});var di=i(ce);C=s(di,"here"),di.forEach(t),je=s(ho,"."),ho.forEach(t),ke=p(o),T=r(o,"P",{});var ci=i(T);I=s(ci,"Note:"),ci.forEach(t),Re=p(o),S=r(o,"P",{});var Et=i(S);Je=s(Et,"If you want to reproduce the original tokenization process of the "),Le=r(Et,"EM",{});var Fu=i(Le);G=s(Fu,"OpenAI GPT"),Fu.forEach(t),Qe=s(Et," paper, you will need to install "),Se=r(Et,"CODE",{});var zu=i(Se);Ye=s(zu,"ftfy"),zu.forEach(t),Ze=s(Et,`
and `),Ne=r(Et,"CODE",{});var qu=i(Ne);B=s(qu,"SpaCy"),qu.forEach(t),Y=s(Et,":"),Et.forEach(t),Ve=p(o),w(De.$$.fragment,o),R=p(o),ee=r(o,"P",{});var zt=i(ee);et=s(zt,"If you don\u2019t install "),me=r(zt,"CODE",{});var xu=i(me);tt=s(xu,"ftfy"),xu.forEach(t),pe=s(zt," and "),Be=r(zt,"CODE",{});var Cu=i(Be);Cl=s(Cu,"SpaCy"),Cu.forEach(t),jl=s(zt,", the "),Zs=r(zt,"A",{href:!0});var ju=i(Zs);Dl=s(ju,"OpenAIGPTTokenizer"),ju.forEach(t),Hl=s(zt,` will default to tokenize
using BERT\u2019s `),Na=r(zt,"CODE",{});var Du=i(Na);Ll=s(Du,"BasicTokenizer"),Du.forEach(t),Sl=s(zt," followed by Byte-Pair Encoding (which should be fine for most usage, don\u2019t worry)."),zt.forEach(t),pi=p(o),St=r(o,"H2",{class:!0});var Ui=i(St);uo=r(Ui,"A",{id:!0,class:!0,href:!0});var Hu=i(uo);Ba=r(Hu,"SPAN",{});var Lu=i(Ba);w(dn.$$.fragment,Lu),Lu.forEach(t),Hu.forEach(t),Nl=p(Ui),Wa=r(Ui,"SPAN",{});var Su=i(Wa);Bl=s(Su,"Resources"),Su.forEach(t),Ui.forEach(t),hi=p(o),ea=r(o,"P",{});var Nu=i(ea);Wl=s(Nu,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with DistilBERT. 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."),Nu.forEach(t),fi=p(o),w(cn.$$.fragment,o),ui=p(o),ta=r(o,"UL",{});var Bu=i(ta);pn=r(Bu,"LI",{});var Ki=i(pn);Ul=s(Ki,"A blog post on "),hn=r(Ki,"A",{href:!0,rel:!0});var Wu=i(hn);Kl=s(Wu,"outperforming OpenAI GPT-3 with SetFit for text-classification"),Wu.forEach(t),Rl=s(Ki,"."),Ki.forEach(t),Bu.forEach(t),mi=p(o),w(fn.$$.fragment,o),gi=p(o),se=r(o,"UL",{});var $e=i(se);un=r($e,"LI",{});var Ri=i(un);Vl=s(Ri,"A blog on how to "),mn=r(Ri,"A",{href:!0,rel:!0});var Uu=i(mn);Xl=s(Uu,"Finetune a non-English GPT-2 Model with Hugging Face"),Uu.forEach(t),Jl=s(Ri,"."),Ri.forEach(t),Ql=p($e),gn=r($e,"LI",{});var Vi=i(gn);Yl=s(Vi,"A blog on "),_n=r(Vi,"A",{href:!0,rel:!0});var Ku=i(_n);Zl=s(Ku,"How to generate text: using different decoding methods for language generation with Transformers"),Ku.forEach(t),ed=s(Vi," with GPT-2."),Vi.forEach(t),td=p($e),Tn=r($e,"LI",{});var Xi=i(Tn);od=s(Xi,"A blog on "),vn=r(Xi,"A",{href:!0,rel:!0});var Ru=i(vn);nd=s(Ru,"Training CodeParrot \u{1F99C} from Scratch"),Ru.forEach(t),sd=s(Xi,", a large GPT-2 model."),Xi.forEach(t),ad=p($e),bn=r($e,"LI",{});var Ji=i(bn);rd=s(Ji,"A blog on "),yn=r(Ji,"A",{href:!0,rel:!0});var Vu=i(yn);id=s(Vu,"Faster Text Generation with TensorFlow and XLA"),Vu.forEach(t),ld=s(Ji," with GPT-2."),Ji.forEach(t),dd=p($e),wn=r($e,"LI",{});var Qi=i(wn);cd=s(Qi,"A blog on "),kn=r(Qi,"A",{href:!0,rel:!0});var Xu=i(kn);pd=s(Xu,"How to train a Language Model with Megatron-LM"),Xu.forEach(t),hd=s(Qi," with a GPT-2 model."),Qi.forEach(t),fd=p($e),$n=r($e,"LI",{});var Yi=i($n);ud=s(Yi,"A notebook on how to "),Pn=r(Yi,"A",{href:!0,rel:!0});var Ju=i(Pn);md=s(Ju,"finetune GPT2 to generate lyrics in the style of your favorite artist"),Ju.forEach(t),gd=s(Yi,". \u{1F30E}"),Yi.forEach(t),_d=p($e),On=r($e,"LI",{});var Zi=i(On);Td=s(Zi,"A notebook on how to "),An=r(Zi,"A",{href:!0,rel:!0});var Qu=i(An);vd=s(Qu,"finetune GPT2 to generate tweets in the style of your favorite Twitter user"),Qu.forEach(t),bd=s(Zi,". \u{1F30E}"),Zi.forEach(t),yd=p($e),oa=r($e,"LI",{});var Gu=i(oa);In=r(Gu,"A",{href:!0,rel:!0});var Yu=i(In);wd=s(Yu,"Causal language modeling"),Yu.forEach(t),kd=s(Gu," chapter of the \u{1F917} Hugging Face Course."),Gu.forEach(t),$d=p($e),_t=r($e,"LI",{});var fo=i(_t);na=r(fo,"A",{href:!0});var Zu=i(na);Pd=s(Zu,"OpenAIGPTLMHeadModel"),Zu.forEach(t),Od=s(fo," is supported by this "),Gn=r(fo,"A",{href:!0,rel:!0});var em=i(Gn);Ad=s(em,"causal language modeling example script"),em.forEach(t),Id=s(fo,", "),Mn=r(fo,"A",{href:!0,rel:!0});var tm=i(Mn);Gd=s(tm,"text generation example script"),tm.forEach(t),Md=s(fo," and "),En=r(fo,"A",{href:!0,rel:!0});var om=i(En);Ed=s(om,"notebook"),om.forEach(t),Fd=s(fo,"."),fo.forEach(t),zd=p($e),Ft=r($e,"LI",{});var Ys=i(Ft);sa=r(Ys,"A",{href:!0});var nm=i(sa);qd=s(nm,"TFOpenAIGPTLMHeadModel"),nm.forEach(t),xd=s(Ys," is supported by this "),Fn=r(Ys,"A",{href:!0,rel:!0});var sm=i(Fn);Cd=s(sm,"causal language modeling example script"),sm.forEach(t),jd=s(Ys," and "),zn=r(Ys,"A",{href:!0,rel:!0});var am=i(zn);Dd=s(am,"notebook"),am.forEach(t),Hd=s(Ys,"."),Ys.forEach(t),$e.forEach(t),_i=p(o),w(qn.$$.fragment,o),Ti=p(o),aa=r(o,"UL",{});var rm=i(aa);xn=r(rm,"LI",{});var el=i(xn);Ld=s(el,"A course material on "),Cn=r(el,"A",{href:!0,rel:!0});var im=i(Cn);Sd=s(im,"Byte-Pair Encoding tokenization"),im.forEach(t),Nd=s(el,"."),el.forEach(t),rm.forEach(t),vi=p(o),Nt=r(o,"H2",{class:!0});var tl=i(Nt);mo=r(tl,"A",{id:!0,class:!0,href:!0});var lm=i(mo);Ua=r(lm,"SPAN",{});var dm=i(Ua);w(jn.$$.fragment,dm),dm.forEach(t),lm.forEach(t),Bd=p(tl),Ka=r(tl,"SPAN",{});var cm=i(Ka);Wd=s(cm,"OpenAIGPTConfig"),cm.forEach(t),tl.forEach(t),bi=p(o),ht=r(o,"DIV",{class:!0});var Yo=i(ht);w(Dn.$$.fragment,Yo),Ud=p(Yo),Gt=r(Yo,"P",{});var Zo=i(Gt);Kd=s(Zo,"This is the configuration class to store the configuration of a "),ra=r(Zo,"A",{href:!0});var pm=i(ra);Rd=s(pm,"OpenAIGPTModel"),pm.forEach(t),Vd=s(Zo," or a "),ia=r(Zo,"A",{href:!0});var hm=i(ia);Xd=s(hm,"TFOpenAIGPTModel"),hm.forEach(t),Jd=s(Zo,`. It is
used to instantiate a GPT 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
`),Hn=r(Zo,"A",{href:!0,rel:!0});var fm=i(Hn);Qd=s(fm,"openai-gpt"),fm.forEach(t),Yd=s(Zo," architecture from OpenAI."),Zo.forEach(t),Zd=p(Yo),Bt=r(Yo,"P",{});var za=i(Bt);ec=s(za,"Configuration objects inherit from "),la=r(za,"A",{href:!0});var um=i(la);tc=s(um,"PretrainedConfig"),um.forEach(t),oc=s(za,` and can be used to control the model outputs. Read the
documentation from `),da=r(za,"A",{href:!0});var mm=i(da);nc=s(mm,"PretrainedConfig"),mm.forEach(t),sc=s(za," for more information."),za.forEach(t),ac=p(Yo),w(go.$$.fragment,Yo),Yo.forEach(t),yi=p(o),Wt=r(o,"H2",{class:!0});var ol=i(Wt);_o=r(ol,"A",{id:!0,class:!0,href:!0});var gm=i(_o);Ra=r(gm,"SPAN",{});var _m=i(Ra);w(Ln.$$.fragment,_m),_m.forEach(t),gm.forEach(t),rc=p(ol),Va=r(ol,"SPAN",{});var Tm=i(Va);ic=s(Tm,"OpenAIGPTTokenizer"),Tm.forEach(t),ol.forEach(t),wi=p(o),ot=r(o,"DIV",{class:!0});var qt=i(ot);w(Sn.$$.fragment,qt),lc=p(qt),Xa=r(qt,"P",{});var vm=i(Xa);dc=s(vm,"Construct a GPT Tokenizer. Based on Byte-Pair-Encoding with the following peculiarities:"),vm.forEach(t),cc=p(qt),Nn=r(qt,"UL",{});var nl=i(Nn);Ja=r(nl,"LI",{});var bm=i(Ja);pc=s(bm,"lowercases all inputs,"),bm.forEach(t),hc=p(nl),Mt=r(nl,"LI",{});var en=i(Mt);fc=s(en,"uses "),Qa=r(en,"CODE",{});var ym=i(Qa);uc=s(ym,"SpaCy"),ym.forEach(t),mc=s(en," tokenizer and "),Ya=r(en,"CODE",{});var wm=i(Ya);gc=s(wm,"ftfy"),wm.forEach(t),_c=s(en,` for pre-BPE tokenization if they are installed, fallback to BERT\u2019s
`),Za=r(en,"CODE",{});var km=i(Za);Tc=s(km,"BasicTokenizer"),km.forEach(t),vc=s(en," if not."),en.forEach(t),nl.forEach(t),bc=p(qt),Bn=r(qt,"P",{});var sl=i(Bn);yc=s(sl,"This tokenizer inherits from "),ca=r(sl,"A",{href:!0});var $m=i(ca);wc=s($m,"PreTrainedTokenizer"),$m.forEach(t),kc=s(sl,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),sl.forEach(t),$c=p(qt),pa=r(qt,"DIV",{class:!0});var Pm=i(pa);w(Wn.$$.fragment,Pm),Pm.forEach(t),qt.forEach(t),ki=p(o),Ut=r(o,"H2",{class:!0});var al=i(Ut);To=r(al,"A",{id:!0,class:!0,href:!0});var Om=i(To);er=r(Om,"SPAN",{});var Am=i(er);w(Un.$$.fragment,Am),Am.forEach(t),Om.forEach(t),Pc=p(al),tr=r(al,"SPAN",{});var Im=i(tr);Oc=s(Im,"OpenAIGPTTokenizerFast"),Im.forEach(t),al.forEach(t),$i=p(o),ft=r(o,"DIV",{class:!0});var tn=i(ft);w(Kn.$$.fragment,tn),Ac=p(tn),Rn=r(tn,"P",{});var rl=i(Rn);Ic=s(rl,"Construct a \u201Cfast\u201D GPT Tokenizer (backed by HuggingFace\u2019s "),or=r(rl,"EM",{});var Gm=i(or);Gc=s(Gm,"tokenizers"),Gm.forEach(t),Mc=s(rl,` library). Based on Byte-Pair-Encoding with
the following peculiarities:`),rl.forEach(t),Ec=p(tn),Vn=r(tn,"UL",{});var il=i(Vn);nr=r(il,"LI",{});var Mm=i(nr);Fc=s(Mm,"lower case all inputs"),Mm.forEach(t),zc=p(il),sr=r(il,"LI",{});var Em=i(sr);qc=s(Em,"uses BERT\u2019s BasicTokenizer for pre-BPE tokenization"),Em.forEach(t),il.forEach(t),xc=p(tn),Xn=r(tn,"P",{});var ll=i(Xn);Cc=s(ll,"This tokenizer inherits from "),ha=r(ll,"A",{href:!0});var Fm=i(ha);jc=s(Fm,"PreTrainedTokenizerFast"),Fm.forEach(t),Dc=s(ll,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),ll.forEach(t),tn.forEach(t),Pi=p(o),Kt=r(o,"H2",{class:!0});var dl=i(Kt);vo=r(dl,"A",{id:!0,class:!0,href:!0});var zm=i(vo);ar=r(zm,"SPAN",{});var qm=i(ar);w(Jn.$$.fragment,qm),qm.forEach(t),zm.forEach(t),Hc=p(dl),rr=r(dl,"SPAN",{});var xm=i(rr);Lc=s(xm,"OpenAI specific outputs"),xm.forEach(t),dl.forEach(t),Oi=p(o),Rt=r(o,"DIV",{class:!0});var cl=i(Rt);w(Qn.$$.fragment,cl),Sc=p(cl),ir=r(cl,"P",{});var Cm=i(ir);Nc=s(Cm,"Base class for outputs of models predicting if two sentences are consecutive or not."),Cm.forEach(t),cl.forEach(t),Ai=p(o),Vt=r(o,"DIV",{class:!0});var pl=i(Vt);w(Yn.$$.fragment,pl),Bc=p(pl),lr=r(pl,"P",{});var jm=i(lr);Wc=s(jm,"Base class for outputs of models predicting if two sentences are consecutive or not."),jm.forEach(t),pl.forEach(t),Ii=p(o),Xt=r(o,"H2",{class:!0});var hl=i(Xt);bo=r(hl,"A",{id:!0,class:!0,href:!0});var Dm=i(bo);dr=r(Dm,"SPAN",{});var Hm=i(dr);w(Zn.$$.fragment,Hm),Hm.forEach(t),Dm.forEach(t),Uc=p(hl),cr=r(hl,"SPAN",{});var Lm=i(cr);Kc=s(Lm,"OpenAIGPTModel"),Lm.forEach(t),hl.forEach(t),Gi=p(o),nt=r(o,"DIV",{class:!0});var xt=i(nt);w(es.$$.fragment,xt),Rc=p(xt),pr=r(xt,"P",{});var Sm=i(pr);Vc=s(Sm,"The bare OpenAI GPT transformer model outputting raw hidden-states without any specific head on top."),Sm.forEach(t),Xc=p(xt),ts=r(xt,"P",{});var fl=i(ts);Jc=s(fl,"This model inherits from "),fa=r(fl,"A",{href:!0});var Nm=i(fa);Qc=s(Nm,"PreTrainedModel"),Nm.forEach(t),Yc=s(fl,`. 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.)`),fl.forEach(t),Zc=p(xt),os=r(xt,"P",{});var ul=i(os);ep=s(ul,"This model is also a PyTorch "),ns=r(ul,"A",{href:!0,rel:!0});var Bm=i(ns);tp=s(Bm,"torch.nn.Module"),Bm.forEach(t),op=s(ul,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ul.forEach(t),np=p(xt),Tt=r(xt,"DIV",{class:!0});var on=i(Tt);w(ss.$$.fragment,on),sp=p(on),Jt=r(on,"P",{});var qa=i(Jt);ap=s(qa,"The "),ua=r(qa,"A",{href:!0});var Wm=i(ua);rp=s(Wm,"OpenAIGPTModel"),Wm.forEach(t),ip=s(qa," forward method, overrides the "),hr=r(qa,"CODE",{});var Um=i(hr);lp=s(Um,"__call__"),Um.forEach(t),dp=s(qa," special method."),qa.forEach(t),cp=p(on),w(yo.$$.fragment,on),pp=p(on),w(wo.$$.fragment,on),on.forEach(t),xt.forEach(t),Mi=p(o),Qt=r(o,"H2",{class:!0});var ml=i(Qt);ko=r(ml,"A",{id:!0,class:!0,href:!0});var Km=i(ko);fr=r(Km,"SPAN",{});var Rm=i(fr);w(as.$$.fragment,Rm),Rm.forEach(t),Km.forEach(t),hp=p(ml),ur=r(ml,"SPAN",{});var Vm=i(ur);fp=s(Vm,"OpenAIGPTLMHeadModel"),Vm.forEach(t),ml.forEach(t),Ei=p(o),st=r(o,"DIV",{class:!0});var Ct=i(st);w(rs.$$.fragment,Ct),up=p(Ct),mr=r(Ct,"P",{});var Xm=i(mr);mp=s(Xm,`OpenAI GPT Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),Xm.forEach(t),gp=p(Ct),is=r(Ct,"P",{});var gl=i(is);_p=s(gl,"This model inherits from "),ma=r(gl,"A",{href:!0});var Jm=i(ma);Tp=s(Jm,"PreTrainedModel"),Jm.forEach(t),vp=s(gl,`. 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.)`),gl.forEach(t),bp=p(Ct),ls=r(Ct,"P",{});var _l=i(ls);yp=s(_l,"This model is also a PyTorch "),ds=r(_l,"A",{href:!0,rel:!0});var Qm=i(ds);wp=s(Qm,"torch.nn.Module"),Qm.forEach(t),kp=s(_l,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),_l.forEach(t),$p=p(Ct),vt=r(Ct,"DIV",{class:!0});var nn=i(vt);w(cs.$$.fragment,nn),Pp=p(nn),Yt=r(nn,"P",{});var xa=i(Yt);Op=s(xa,"The "),ga=r(xa,"A",{href:!0});var Ym=i(ga);Ap=s(Ym,"OpenAIGPTLMHeadModel"),Ym.forEach(t),Ip=s(xa," forward method, overrides the "),gr=r(xa,"CODE",{});var Zm=i(gr);Gp=s(Zm,"__call__"),Zm.forEach(t),Mp=s(xa," special method."),xa.forEach(t),Ep=p(nn),w($o.$$.fragment,nn),Fp=p(nn),w(Po.$$.fragment,nn),nn.forEach(t),Ct.forEach(t),Fi=p(o),Zt=r(o,"H2",{class:!0});var Tl=i(Zt);Oo=r(Tl,"A",{id:!0,class:!0,href:!0});var eg=i(Oo);_r=r(eg,"SPAN",{});var tg=i(_r);w(ps.$$.fragment,tg),tg.forEach(t),eg.forEach(t),zp=p(Tl),Tr=r(Tl,"SPAN",{});var og=i(Tr);qp=s(og,"OpenAIGPTDoubleHeadsModel"),og.forEach(t),Tl.forEach(t),zi=p(o),at=r(o,"DIV",{class:!0});var jt=i(at);w(hs.$$.fragment,jt),xp=p(jt),vr=r(jt,"P",{});var ng=i(vr);Cp=s(ng,`OpenAI GPT Model transformer with a language modeling and a multiple-choice classification head on top e.g. for
RocStories/SWAG tasks. The two heads are two linear layers. The language modeling head has its weights tied to the
input embeddings, the classification head takes as input the input of a specified classification token index in the
input sequence).`),ng.forEach(t),jp=p(jt),fs=r(jt,"P",{});var vl=i(fs);Dp=s(vl,"This model inherits from "),_a=r(vl,"A",{href:!0});var sg=i(_a);Hp=s(sg,"PreTrainedModel"),sg.forEach(t),Lp=s(vl,`. 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.)`),vl.forEach(t),Sp=p(jt),us=r(jt,"P",{});var bl=i(us);Np=s(bl,"This model is also a PyTorch "),ms=r(bl,"A",{href:!0,rel:!0});var ag=i(ms);Bp=s(ag,"torch.nn.Module"),ag.forEach(t),Wp=s(bl,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),bl.forEach(t),Up=p(jt),bt=r(jt,"DIV",{class:!0});var sn=i(bt);w(gs.$$.fragment,sn),Kp=p(sn),eo=r(sn,"P",{});var Ca=i(eo);Rp=s(Ca,"The "),Ta=r(Ca,"A",{href:!0});var rg=i(Ta);Vp=s(rg,"OpenAIGPTDoubleHeadsModel"),rg.forEach(t),Xp=s(Ca," forward method, overrides the "),br=r(Ca,"CODE",{});var ig=i(br);Jp=s(ig,"__call__"),ig.forEach(t),Qp=s(Ca," special method."),Ca.forEach(t),Yp=p(sn),w(Ao.$$.fragment,sn),Zp=p(sn),w(Io.$$.fragment,sn),sn.forEach(t),jt.forEach(t),qi=p(o),to=r(o,"H2",{class:!0});var yl=i(to);Go=r(yl,"A",{id:!0,class:!0,href:!0});var lg=i(Go);yr=r(lg,"SPAN",{});var dg=i(yr);w(_s.$$.fragment,dg),dg.forEach(t),lg.forEach(t),eh=p(yl),wr=r(yl,"SPAN",{});var cg=i(wr);th=s(cg,"OpenAIGPTForSequenceClassification"),cg.forEach(t),yl.forEach(t),xi=p(o),rt=r(o,"DIV",{class:!0});var Dt=i(rt);w(Ts.$$.fragment,Dt),oh=p(Dt),it=r(Dt,"P",{});var $t=i(it);nh=s($t,`The Original OpenAI GPT Model transformer with a sequence classification head on top (linear layer).
`),va=r($t,"A",{href:!0});var pg=i(va);sh=s(pg,"OpenAIGPTForSequenceClassification"),pg.forEach(t),ah=s($t,` uses the last token in order to do the classification, as other causal
models (e.g. GPT-2) do. Since it does classification on the last token, it requires to know the position of the
last token. If a `),kr=r($t,"CODE",{});var hg=i(kr);rh=s(hg,"pad_token_id"),hg.forEach(t),ih=s($t,` is defined in the configuration, it finds the last token that is not a padding
token in each row. If no `),$r=r($t,"CODE",{});var fg=i($r);lh=s(fg,"pad_token_id"),fg.forEach(t),dh=s($t,` is defined, it simply takes the last value in each row of the batch. Since
it cannot guess the padding tokens when `),Pr=r($t,"CODE",{});var ug=i(Pr);ch=s(ug,"inputs_embeds"),ug.forEach(t),ph=s($t," are passed instead of "),Or=r($t,"CODE",{});var mg=i(Or);hh=s(mg,"input_ids"),mg.forEach(t),fh=s($t,`, it does the same (take
the last value in each row of the batch).`),$t.forEach(t),uh=p(Dt),vs=r(Dt,"P",{});var wl=i(vs);mh=s(wl,"This model inherits from "),ba=r(wl,"A",{href:!0});var gg=i(ba);gh=s(gg,"PreTrainedModel"),gg.forEach(t),_h=s(wl,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),wl.forEach(t),Th=p(Dt),bs=r(Dt,"P",{});var kl=i(bs);vh=s(kl,"This model is also a PyTorch "),ys=r(kl,"A",{href:!0,rel:!0});var _g=i(ys);bh=s(_g,"torch.nn.Module"),_g.forEach(t),yh=s(kl,` subclass.
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),wh=p(Dt),He=r(Dt,"DIV",{class:!0});var ct=i(He);w(ws.$$.fragment,ct),kh=p(ct),oo=r(ct,"P",{});var ja=i(oo);$h=s(ja,"The "),ya=r(ja,"A",{href:!0});var Tg=i(ya);Ph=s(Tg,"OpenAIGPTForSequenceClassification"),Tg.forEach(t),Oh=s(ja," forward method, overrides the "),Ar=r(ja,"CODE",{});var vg=i(Ar);Ah=s(vg,"__call__"),vg.forEach(t),Ih=s(ja," special method."),ja.forEach(t),Gh=p(ct),w(Mo.$$.fragment,ct),Mh=p(ct),w(Eo.$$.fragment,ct),Eh=p(ct),w(Fo.$$.fragment,ct),Fh=p(ct),w(zo.$$.fragment,ct),zh=p(ct),w(qo.$$.fragment,ct),ct.forEach(t),Dt.forEach(t),Ci=p(o),no=r(o,"H2",{class:!0});var $l=i(no);xo=r($l,"A",{id:!0,class:!0,href:!0});var bg=i(xo);Ir=r(bg,"SPAN",{});var yg=i(Ir);w(ks.$$.fragment,yg),yg.forEach(t),bg.forEach(t),qh=p($l),Gr=r($l,"SPAN",{});var wg=i(Gr);xh=s(wg,"TFOpenAIGPTModel"),wg.forEach(t),$l.forEach(t),ji=p(o),We=r(o,"DIV",{class:!0});var Pt=i(We);w($s.$$.fragment,Pt),Ch=p(Pt),Mr=r(Pt,"P",{});var kg=i(Mr);jh=s(kg,"The bare OpenAI GPT transformer model outputting raw hidden-states without any specific head on top."),kg.forEach(t),Dh=p(Pt),Ps=r(Pt,"P",{});var Pl=i(Ps);Hh=s(Pl,"This model inherits from "),wa=r(Pl,"A",{href:!0});var $g=i(wa);Lh=s($g,"TFPreTrainedModel"),$g.forEach(t),Sh=s(Pl,`. 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.)`),Pl.forEach(t),Nh=p(Pt),Os=r(Pt,"P",{});var Ol=i(Os);Bh=s(Ol,"This model is also a "),As=r(Ol,"A",{href:!0,rel:!0});var Pg=i(As);Wh=s(Pg,"tf.keras.Model"),Pg.forEach(t),Uh=s(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),Kh=p(Pt),w(Co.$$.fragment,Pt),Rh=p(Pt),yt=r(Pt,"DIV",{class:!0});var an=i(yt);w(Is.$$.fragment,an),Vh=p(an),so=r(an,"P",{});var Da=i(so);Xh=s(Da,"The "),ka=r(Da,"A",{href:!0});var Og=i(ka);Jh=s(Og,"TFOpenAIGPTModel"),Og.forEach(t),Qh=s(Da," forward method, overrides the "),Er=r(Da,"CODE",{});var Ag=i(Er);Yh=s(Ag,"__call__"),Ag.forEach(t),Zh=s(Da," special method."),Da.forEach(t),ef=p(an),w(jo.$$.fragment,an),tf=p(an),w(Do.$$.fragment,an),an.forEach(t),Pt.forEach(t),Di=p(o),ao=r(o,"H2",{class:!0});var Al=i(ao);Ho=r(Al,"A",{id:!0,class:!0,href:!0});var Ig=i(Ho);Fr=r(Ig,"SPAN",{});var Gg=i(Fr);w(Gs.$$.fragment,Gg),Gg.forEach(t),Ig.forEach(t),of=p(Al),zr=r(Al,"SPAN",{});var Mg=i(zr);nf=s(Mg,"TFOpenAIGPTLMHeadModel"),Mg.forEach(t),Al.forEach(t),Hi=p(o),Ue=r(o,"DIV",{class:!0});var Ot=i(Ue);w(Ms.$$.fragment,Ot),sf=p(Ot),qr=r(Ot,"P",{});var Eg=i(qr);af=s(Eg,`OpenAI GPT Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),Eg.forEach(t),rf=p(Ot),Es=r(Ot,"P",{});var Il=i(Es);lf=s(Il,"This model inherits from "),$a=r(Il,"A",{href:!0});var Fg=i($a);df=s(Fg,"TFPreTrainedModel"),Fg.forEach(t),cf=s(Il,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Il.forEach(t),pf=p(Ot),Fs=r(Ot,"P",{});var Gl=i(Fs);hf=s(Gl,"This model is also a "),zs=r(Gl,"A",{href:!0,rel:!0});var zg=i(zs);ff=s(zg,"tf.keras.Model"),zg.forEach(t),uf=s(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),mf=p(Ot),w(Lo.$$.fragment,Ot),gf=p(Ot),wt=r(Ot,"DIV",{class:!0});var rn=i(wt);w(qs.$$.fragment,rn),_f=p(rn),ro=r(rn,"P",{});var Ha=i(ro);Tf=s(Ha,"The "),Pa=r(Ha,"A",{href:!0});var qg=i(Pa);vf=s(qg,"TFOpenAIGPTLMHeadModel"),qg.forEach(t),bf=s(Ha," forward method, overrides the "),xr=r(Ha,"CODE",{});var xg=i(xr);yf=s(xg,"__call__"),xg.forEach(t),wf=s(Ha," special method."),Ha.forEach(t),kf=p(rn),w(So.$$.fragment,rn),$f=p(rn),w(No.$$.fragment,rn),rn.forEach(t),Ot.forEach(t),Li=p(o),io=r(o,"H2",{class:!0});var Ml=i(io);Bo=r(Ml,"A",{id:!0,class:!0,href:!0});var Cg=i(Bo);Cr=r(Cg,"SPAN",{});var jg=i(Cr);w(xs.$$.fragment,jg),jg.forEach(t),Cg.forEach(t),Pf=p(Ml),jr=r(Ml,"SPAN",{});var Dg=i(jr);Of=s(Dg,"TFOpenAIGPTDoubleHeadsModel"),Dg.forEach(t),Ml.forEach(t),Si=p(o),Ke=r(o,"DIV",{class:!0});var At=i(Ke);w(Cs.$$.fragment,At),Af=p(At),Dr=r(At,"P",{});var Hg=i(Dr);If=s(Hg,`OpenAI GPT Model transformer with a language modeling and a multiple-choice classification head on top e.g. for
RocStories/SWAG tasks. The two heads are two linear layers. The language modeling head has its weights tied to the
input embeddings, the classification head takes as input the input of a specified classification token index in the
input sequence).`),Hg.forEach(t),Gf=p(At),js=r(At,"P",{});var El=i(js);Mf=s(El,"This model inherits from "),Oa=r(El,"A",{href:!0});var Lg=i(Oa);Ef=s(Lg,"TFPreTrainedModel"),Lg.forEach(t),Ff=s(El,`. 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.)`),El.forEach(t),zf=p(At),Ds=r(At,"P",{});var Fl=i(Ds);qf=s(Fl,"This model is also a "),Hs=r(Fl,"A",{href:!0,rel:!0});var Sg=i(Hs);xf=s(Sg,"tf.keras.Model"),Sg.forEach(t),Cf=s(Fl,` 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.`),Fl.forEach(t),jf=p(At),w(Wo.$$.fragment,At),Df=p(At),kt=r(At,"DIV",{class:!0});var ln=i(kt);w(Ls.$$.fragment,ln),Hf=p(ln),lo=r(ln,"P",{});var La=i(lo);Lf=s(La,"The "),Aa=r(La,"A",{href:!0});var Ng=i(Aa);Sf=s(Ng,"TFOpenAIGPTDoubleHeadsModel"),Ng.forEach(t),Nf=s(La," forward method, overrides the "),Hr=r(La,"CODE",{});var Bg=i(Hr);Bf=s(Bg,"__call__"),Bg.forEach(t),Wf=s(La," special method."),La.forEach(t),Uf=p(ln),w(Uo.$$.fragment,ln),Kf=p(ln),w(Ko.$$.fragment,ln),ln.forEach(t),At.forEach(t),Ni=p(o),co=r(o,"H2",{class:!0});var zl=i(co);Ro=r(zl,"A",{id:!0,class:!0,href:!0});var Wg=i(Ro);Lr=r(Wg,"SPAN",{});var Ug=i(Lr);w(Ss.$$.fragment,Ug),Ug.forEach(t),Wg.forEach(t),Rf=p(zl),Sr=r(zl,"SPAN",{});var Kg=i(Sr);Vf=s(Kg,"TFOpenAIGPTForSequenceClassification"),Kg.forEach(t),zl.forEach(t),Bi=p(o),ge=r(o,"DIV",{class:!0});var Xe=i(ge);w(Ns.$$.fragment,Xe),Xf=p(Xe),Nr=r(Xe,"P",{});var Rg=i(Nr);Jf=s(Rg,"The OpenAI GPT Model transformer with a sequence classification head on top (linear layer)."),Rg.forEach(t),Qf=p(Xe),Ia=r(Xe,"P",{});var Mu=i(Ia);Ga=r(Mu,"A",{href:!0});var Vg=i(Ga);Yf=s(Vg,"TFOpenAIGPTForSequenceClassification"),Vg.forEach(t),Zf=s(Mu,` uses the last token in order to do the classification, as other causal
models (e.g. GPT-2) do.`),Mu.forEach(t),eu=p(Xe),ut=r(Xe,"P",{});var Ht=i(ut);tu=s(Ht,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Br=r(Ht,"CODE",{});var Xg=i(Br);ou=s(Xg,"pad_token_id"),Xg.forEach(t),nu=s(Ht,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Wr=r(Ht,"CODE",{});var Jg=i(Wr);su=s(Jg,"pad_token_id"),Jg.forEach(t),au=s(Ht,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ur=r(Ht,"CODE",{});var Qg=i(Ur);ru=s(Qg,"inputs_embeds"),Qg.forEach(t),iu=s(Ht," are passed instead of "),Kr=r(Ht,"CODE",{});var Yg=i(Kr);lu=s(Yg,"input_ids"),Yg.forEach(t),du=s(Ht,`, it does the same (take the last value in
each row of the batch).`),Ht.forEach(t),cu=p(Xe),Bs=r(Xe,"P",{});var ql=i(Bs);pu=s(ql,"This model inherits from "),Ma=r(ql,"A",{href:!0});var Zg=i(Ma);hu=s(Zg,"TFPreTrainedModel"),Zg.forEach(t),fu=s(ql,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ql.forEach(t),uu=p(Xe),Ws=r(Xe,"P",{});var xl=i(Ws);mu=s(xl,"This model is also a "),Us=r(xl,"A",{href:!0,rel:!0});var e_=i(Us);gu=s(e_,"tf.keras.Model"),e_.forEach(t),_u=s(xl,` 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.`),xl.forEach(t),Tu=p(Xe),w(Vo.$$.fragment,Xe),vu=p(Xe),dt=r(Xe,"DIV",{class:!0});var Lt=i(dt);w(Ks.$$.fragment,Lt),bu=p(Lt),po=r(Lt,"P",{});var Sa=i(po);yu=s(Sa,"The "),Ea=r(Sa,"A",{href:!0});var t_=i(Ea);wu=s(t_,"TFOpenAIGPTForSequenceClassification"),t_.forEach(t),ku=s(Sa," forward method, overrides the "),Rr=r(Sa,"CODE",{});var o_=i(Rr);$u=s(o_,"__call__"),o_.forEach(t),Pu=s(Sa," special method."),Sa.forEach(t),Ou=p(Lt),w(Xo.$$.fragment,Lt),Au=p(Lt),w(Jo.$$.fragment,Lt),Iu=p(Lt),w(Qo.$$.fragment,Lt),Lt.forEach(t),Xe.forEach(t),this.h()},h(){h(d,"name","hf:doc:metadata"),h(d,"content",JSON.stringify(q_)),h(_,"id","openai-gpt"),h(_,"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"),h(_,"href","#openai-gpt"),h(u,"class","relative group"),h(oe,"id","overview"),h(oe,"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"),h(oe,"href","#overview"),h(j,"class","relative group"),h(ae,"href","https://s3-us-west-2.amazonaws.com/openai-assets/research-covers/language-unsupervised/language_understanding_paper.pdf"),h(ae,"rel","nofollow"),h(N,"href","https://transformer.huggingface.co/doc/gpt"),h(N,"rel","nofollow"),h(le,"href","https://huggingface.co/thomwolf"),h(le,"rel","nofollow"),h(ce,"href","https://github.com/openai/finetune-transformer-lm"),h(ce,"rel","nofollow"),h(Zs,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTTokenizer"),h(uo,"id","resources"),h(uo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(uo,"href","#resources"),h(St,"class","relative group"),h(hn,"href","https://www.philschmid.de/getting-started-setfit"),h(hn,"rel","nofollow"),h(mn,"href","https://www.philschmid.de/fine-tune-a-non-english-gpt-2-model-with-huggingface"),h(mn,"rel","nofollow"),h(_n,"href","https://huggingface.co/blog/how-to-generate"),h(_n,"rel","nofollow"),h(vn,"href","https://huggingface.co/blog/codeparrot"),h(vn,"rel","nofollow"),h(yn,"href","https://huggingface.co/blog/tf-xla-generate"),h(yn,"rel","nofollow"),h(kn,"href","https://huggingface.co/blog/megatron-training"),h(kn,"rel","nofollow"),h(Pn,"href","https://colab.research.google.com/github/AlekseyKorshuk/huggingartists/blob/master/huggingartists-demo.ipynb"),h(Pn,"rel","nofollow"),h(An,"href","https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb"),h(An,"rel","nofollow"),h(In,"href","https://huggingface.co/course/en/chapter7/6?fw=pt#training-a-causal-language-model-from-scratch"),h(In,"rel","nofollow"),h(na,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTLMHeadModel"),h(Gn,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#gpt-2gpt-and-causal-language-modeling"),h(Gn,"rel","nofollow"),h(Mn,"href","https://github.com/huggingface/transformers/blob/main/examples/pytorch/text-generation/run_generation.py"),h(Mn,"rel","nofollow"),h(En,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb"),h(En,"rel","nofollow"),h(sa,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.TFOpenAIGPTLMHeadModel"),h(Fn,"href","https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_clmpy"),h(Fn,"rel","nofollow"),h(zn,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb"),h(zn,"rel","nofollow"),h(Cn,"href","https://huggingface.co/course/en/chapter6/5"),h(Cn,"rel","nofollow"),h(mo,"id","transformers.OpenAIGPTConfig"),h(mo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(mo,"href","#transformers.OpenAIGPTConfig"),h(Nt,"class","relative group"),h(ra,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTModel"),h(ia,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.TFOpenAIGPTModel"),h(Hn,"href","https://huggingface.co/openai-gpt"),h(Hn,"rel","nofollow"),h(la,"href","/docs/transformers/v4.25.1/en/main_classes/configuration#transformers.PretrainedConfig"),h(da,"href","/docs/transformers/v4.25.1/en/main_classes/configuration#transformers.PretrainedConfig"),h(ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(_o,"id","transformers.OpenAIGPTTokenizer"),h(_o,"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"),h(_o,"href","#transformers.OpenAIGPTTokenizer"),h(Wt,"class","relative group"),h(ca,"href","/docs/transformers/v4.25.1/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),h(pa,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ot,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(To,"id","transformers.OpenAIGPTTokenizerFast"),h(To,"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"),h(To,"href","#transformers.OpenAIGPTTokenizerFast"),h(Ut,"class","relative group"),h(ha,"href","/docs/transformers/v4.25.1/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),h(ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(vo,"id","transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput"),h(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"),h(vo,"href","#transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput"),h(Kt,"class","relative group"),h(Rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Vt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(bo,"id","transformers.OpenAIGPTModel"),h(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"),h(bo,"href","#transformers.OpenAIGPTModel"),h(Xt,"class","relative group"),h(fa,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel"),h(ns,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(ns,"rel","nofollow"),h(ua,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTModel"),h(Tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(nt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ko,"id","transformers.OpenAIGPTLMHeadModel"),h(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"),h(ko,"href","#transformers.OpenAIGPTLMHeadModel"),h(Qt,"class","relative group"),h(ma,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel"),h(ds,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(ds,"rel","nofollow"),h(ga,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTLMHeadModel"),h(vt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(st,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Oo,"id","transformers.OpenAIGPTDoubleHeadsModel"),h(Oo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Oo,"href","#transformers.OpenAIGPTDoubleHeadsModel"),h(Zt,"class","relative group"),h(_a,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel"),h(ms,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(ms,"rel","nofollow"),h(Ta,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel"),h(bt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(at,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Go,"id","transformers.OpenAIGPTForSequenceClassification"),h(Go,"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"),h(Go,"href","#transformers.OpenAIGPTForSequenceClassification"),h(to,"class","relative group"),h(va,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTForSequenceClassification"),h(ba,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel"),h(ys,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(ys,"rel","nofollow"),h(ya,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.OpenAIGPTForSequenceClassification"),h(He,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(xo,"id","transformers.TFOpenAIGPTModel"),h(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"),h(xo,"href","#transformers.TFOpenAIGPTModel"),h(no,"class","relative group"),h(wa,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel"),h(As,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(As,"rel","nofollow"),h(ka,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.TFOpenAIGPTModel"),h(yt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(We,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ho,"id","transformers.TFOpenAIGPTLMHeadModel"),h(Ho,"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"),h(Ho,"href","#transformers.TFOpenAIGPTLMHeadModel"),h(ao,"class","relative group"),h($a,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel"),h(zs,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(zs,"rel","nofollow"),h(Pa,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.TFOpenAIGPTLMHeadModel"),h(wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Bo,"id","transformers.TFOpenAIGPTDoubleHeadsModel"),h(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"),h(Bo,"href","#transformers.TFOpenAIGPTDoubleHeadsModel"),h(io,"class","relative group"),h(Oa,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel"),h(Hs,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(Hs,"rel","nofollow"),h(Aa,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.TFOpenAIGPTDoubleHeadsModel"),h(kt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ro,"id","transformers.TFOpenAIGPTForSequenceClassification"),h(Ro,"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"),h(Ro,"href","#transformers.TFOpenAIGPTForSequenceClassification"),h(co,"class","relative group"),h(Ga,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.TFOpenAIGPTForSequenceClassification"),h(Ma,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel"),h(Us,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(Us,"rel","nofollow"),h(Ea,"href","/docs/transformers/v4.25.1/en/model_doc/openai-gpt#transformers.TFOpenAIGPTForSequenceClassification"),h(dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,g){e(document.head,d),m(o,v,g),m(o,u,g),e(u,_),e(_,b),k(l,b,null),e(u,f),e(u,M),e(M,Pe),m(o,_e,g),m(o,j,g),e(j,oe),e(oe,te),k(A,te,null),e(j,Oe),e(j,K),e(K,Ae),m(o,Te,g),m(o,D,g),e(D,Ie),e(D,ae),e(ae,V),e(D,Ge),m(o,ve,g),m(o,W,g),e(W,Me),m(o,be,g),m(o,U,g),e(U,fe),e(fe,Ee),m(o,ne,g),m(o,F,g),e(F,q),m(o,ye,g),m(o,H,g),e(H,ue),e(ue,Fe),e(H,X),e(H,re),e(re,ze),e(re,z),e(z,qe),e(re,J),m(o,we,g),m(o,ie,g),e(ie,N),e(N,xe),e(ie,Ce),m(o,L,g),m(o,Z,g),e(Z,Q),e(Z,le),e(le,de),e(Z,x),e(Z,ce),e(ce,C),e(Z,je),m(o,ke,g),m(o,T,g),e(T,I),m(o,Re,g),m(o,S,g),e(S,Je),e(S,Le),e(Le,G),e(S,Qe),e(S,Se),e(Se,Ye),e(S,Ze),e(S,Ne),e(Ne,B),e(S,Y),m(o,Ve,g),k(De,o,g),m(o,R,g),m(o,ee,g),e(ee,et),e(ee,me),e(me,tt),e(ee,pe),e(ee,Be),e(Be,Cl),e(ee,jl),e(ee,Zs),e(Zs,Dl),e(ee,Hl),e(ee,Na),e(Na,Ll),e(ee,Sl),m(o,pi,g),m(o,St,g),e(St,uo),e(uo,Ba),k(dn,Ba,null),e(St,Nl),e(St,Wa),e(Wa,Bl),m(o,hi,g),m(o,ea,g),e(ea,Wl),m(o,fi,g),k(cn,o,g),m(o,ui,g),m(o,ta,g),e(ta,pn),e(pn,Ul),e(pn,hn),e(hn,Kl),e(pn,Rl),m(o,mi,g),k(fn,o,g),m(o,gi,g),m(o,se,g),e(se,un),e(un,Vl),e(un,mn),e(mn,Xl),e(un,Jl),e(se,Ql),e(se,gn),e(gn,Yl),e(gn,_n),e(_n,Zl),e(gn,ed),e(se,td),e(se,Tn),e(Tn,od),e(Tn,vn),e(vn,nd),e(Tn,sd),e(se,ad),e(se,bn),e(bn,rd),e(bn,yn),e(yn,id),e(bn,ld),e(se,dd),e(se,wn),e(wn,cd),e(wn,kn),e(kn,pd),e(wn,hd),e(se,fd),e(se,$n),e($n,ud),e($n,Pn),e(Pn,md),e($n,gd),e(se,_d),e(se,On),e(On,Td),e(On,An),e(An,vd),e(On,bd),e(se,yd),e(se,oa),e(oa,In),e(In,wd),e(oa,kd),e(se,$d),e(se,_t),e(_t,na),e(na,Pd),e(_t,Od),e(_t,Gn),e(Gn,Ad),e(_t,Id),e(_t,Mn),e(Mn,Gd),e(_t,Md),e(_t,En),e(En,Ed),e(_t,Fd),e(se,zd),e(se,Ft),e(Ft,sa),e(sa,qd),e(Ft,xd),e(Ft,Fn),e(Fn,Cd),e(Ft,jd),e(Ft,zn),e(zn,Dd),e(Ft,Hd),m(o,_i,g),k(qn,o,g),m(o,Ti,g),m(o,aa,g),e(aa,xn),e(xn,Ld),e(xn,Cn),e(Cn,Sd),e(xn,Nd),m(o,vi,g),m(o,Nt,g),e(Nt,mo),e(mo,Ua),k(jn,Ua,null),e(Nt,Bd),e(Nt,Ka),e(Ka,Wd),m(o,bi,g),m(o,ht,g),k(Dn,ht,null),e(ht,Ud),e(ht,Gt),e(Gt,Kd),e(Gt,ra),e(ra,Rd),e(Gt,Vd),e(Gt,ia),e(ia,Xd),e(Gt,Jd),e(Gt,Hn),e(Hn,Qd),e(Gt,Yd),e(ht,Zd),e(ht,Bt),e(Bt,ec),e(Bt,la),e(la,tc),e(Bt,oc),e(Bt,da),e(da,nc),e(Bt,sc),e(ht,ac),k(go,ht,null),m(o,yi,g),m(o,Wt,g),e(Wt,_o),e(_o,Ra),k(Ln,Ra,null),e(Wt,rc),e(Wt,Va),e(Va,ic),m(o,wi,g),m(o,ot,g),k(Sn,ot,null),e(ot,lc),e(ot,Xa),e(Xa,dc),e(ot,cc),e(ot,Nn),e(Nn,Ja),e(Ja,pc),e(Nn,hc),e(Nn,Mt),e(Mt,fc),e(Mt,Qa),e(Qa,uc),e(Mt,mc),e(Mt,Ya),e(Ya,gc),e(Mt,_c),e(Mt,Za),e(Za,Tc),e(Mt,vc),e(ot,bc),e(ot,Bn),e(Bn,yc),e(Bn,ca),e(ca,wc),e(Bn,kc),e(ot,$c),e(ot,pa),k(Wn,pa,null),m(o,ki,g),m(o,Ut,g),e(Ut,To),e(To,er),k(Un,er,null),e(Ut,Pc),e(Ut,tr),e(tr,Oc),m(o,$i,g),m(o,ft,g),k(Kn,ft,null),e(ft,Ac),e(ft,Rn),e(Rn,Ic),e(Rn,or),e(or,Gc),e(Rn,Mc),e(ft,Ec),e(ft,Vn),e(Vn,nr),e(nr,Fc),e(Vn,zc),e(Vn,sr),e(sr,qc),e(ft,xc),e(ft,Xn),e(Xn,Cc),e(Xn,ha),e(ha,jc),e(Xn,Dc),m(o,Pi,g),m(o,Kt,g),e(Kt,vo),e(vo,ar),k(Jn,ar,null),e(Kt,Hc),e(Kt,rr),e(rr,Lc),m(o,Oi,g),m(o,Rt,g),k(Qn,Rt,null),e(Rt,Sc),e(Rt,ir),e(ir,Nc),m(o,Ai,g),m(o,Vt,g),k(Yn,Vt,null),e(Vt,Bc),e(Vt,lr),e(lr,Wc),m(o,Ii,g),m(o,Xt,g),e(Xt,bo),e(bo,dr),k(Zn,dr,null),e(Xt,Uc),e(Xt,cr),e(cr,Kc),m(o,Gi,g),m(o,nt,g),k(es,nt,null),e(nt,Rc),e(nt,pr),e(pr,Vc),e(nt,Xc),e(nt,ts),e(ts,Jc),e(ts,fa),e(fa,Qc),e(ts,Yc),e(nt,Zc),e(nt,os),e(os,ep),e(os,ns),e(ns,tp),e(os,op),e(nt,np),e(nt,Tt),k(ss,Tt,null),e(Tt,sp),e(Tt,Jt),e(Jt,ap),e(Jt,ua),e(ua,rp),e(Jt,ip),e(Jt,hr),e(hr,lp),e(Jt,dp),e(Tt,cp),k(yo,Tt,null),e(Tt,pp),k(wo,Tt,null),m(o,Mi,g),m(o,Qt,g),e(Qt,ko),e(ko,fr),k(as,fr,null),e(Qt,hp),e(Qt,ur),e(ur,fp),m(o,Ei,g),m(o,st,g),k(rs,st,null),e(st,up),e(st,mr),e(mr,mp),e(st,gp),e(st,is),e(is,_p),e(is,ma),e(ma,Tp),e(is,vp),e(st,bp),e(st,ls),e(ls,yp),e(ls,ds),e(ds,wp),e(ls,kp),e(st,$p),e(st,vt),k(cs,vt,null),e(vt,Pp),e(vt,Yt),e(Yt,Op),e(Yt,ga),e(ga,Ap),e(Yt,Ip),e(Yt,gr),e(gr,Gp),e(Yt,Mp),e(vt,Ep),k($o,vt,null),e(vt,Fp),k(Po,vt,null),m(o,Fi,g),m(o,Zt,g),e(Zt,Oo),e(Oo,_r),k(ps,_r,null),e(Zt,zp),e(Zt,Tr),e(Tr,qp),m(o,zi,g),m(o,at,g),k(hs,at,null),e(at,xp),e(at,vr),e(vr,Cp),e(at,jp),e(at,fs),e(fs,Dp),e(fs,_a),e(_a,Hp),e(fs,Lp),e(at,Sp),e(at,us),e(us,Np),e(us,ms),e(ms,Bp),e(us,Wp),e(at,Up),e(at,bt),k(gs,bt,null),e(bt,Kp),e(bt,eo),e(eo,Rp),e(eo,Ta),e(Ta,Vp),e(eo,Xp),e(eo,br),e(br,Jp),e(eo,Qp),e(bt,Yp),k(Ao,bt,null),e(bt,Zp),k(Io,bt,null),m(o,qi,g),m(o,to,g),e(to,Go),e(Go,yr),k(_s,yr,null),e(to,eh),e(to,wr),e(wr,th),m(o,xi,g),m(o,rt,g),k(Ts,rt,null),e(rt,oh),e(rt,it),e(it,nh),e(it,va),e(va,sh),e(it,ah),e(it,kr),e(kr,rh),e(it,ih),e(it,$r),e($r,lh),e(it,dh),e(it,Pr),e(Pr,ch),e(it,ph),e(it,Or),e(Or,hh),e(it,fh),e(rt,uh),e(rt,vs),e(vs,mh),e(vs,ba),e(ba,gh),e(vs,_h),e(rt,Th),e(rt,bs),e(bs,vh),e(bs,ys),e(ys,bh),e(bs,yh),e(rt,wh),e(rt,He),k(ws,He,null),e(He,kh),e(He,oo),e(oo,$h),e(oo,ya),e(ya,Ph),e(oo,Oh),e(oo,Ar),e(Ar,Ah),e(oo,Ih),e(He,Gh),k(Mo,He,null),e(He,Mh),k(Eo,He,null),e(He,Eh),k(Fo,He,null),e(He,Fh),k(zo,He,null),e(He,zh),k(qo,He,null),m(o,Ci,g),m(o,no,g),e(no,xo),e(xo,Ir),k(ks,Ir,null),e(no,qh),e(no,Gr),e(Gr,xh),m(o,ji,g),m(o,We,g),k($s,We,null),e(We,Ch),e(We,Mr),e(Mr,jh),e(We,Dh),e(We,Ps),e(Ps,Hh),e(Ps,wa),e(wa,Lh),e(Ps,Sh),e(We,Nh),e(We,Os),e(Os,Bh),e(Os,As),e(As,Wh),e(Os,Uh),e(We,Kh),k(Co,We,null),e(We,Rh),e(We,yt),k(Is,yt,null),e(yt,Vh),e(yt,so),e(so,Xh),e(so,ka),e(ka,Jh),e(so,Qh),e(so,Er),e(Er,Yh),e(so,Zh),e(yt,ef),k(jo,yt,null),e(yt,tf),k(Do,yt,null),m(o,Di,g),m(o,ao,g),e(ao,Ho),e(Ho,Fr),k(Gs,Fr,null),e(ao,of),e(ao,zr),e(zr,nf),m(o,Hi,g),m(o,Ue,g),k(Ms,Ue,null),e(Ue,sf),e(Ue,qr),e(qr,af),e(Ue,rf),e(Ue,Es),e(Es,lf),e(Es,$a),e($a,df),e(Es,cf),e(Ue,pf),e(Ue,Fs),e(Fs,hf),e(Fs,zs),e(zs,ff),e(Fs,uf),e(Ue,mf),k(Lo,Ue,null),e(Ue,gf),e(Ue,wt),k(qs,wt,null),e(wt,_f),e(wt,ro),e(ro,Tf),e(ro,Pa),e(Pa,vf),e(ro,bf),e(ro,xr),e(xr,yf),e(ro,wf),e(wt,kf),k(So,wt,null),e(wt,$f),k(No,wt,null),m(o,Li,g),m(o,io,g),e(io,Bo),e(Bo,Cr),k(xs,Cr,null),e(io,Pf),e(io,jr),e(jr,Of),m(o,Si,g),m(o,Ke,g),k(Cs,Ke,null),e(Ke,Af),e(Ke,Dr),e(Dr,If),e(Ke,Gf),e(Ke,js),e(js,Mf),e(js,Oa),e(Oa,Ef),e(js,Ff),e(Ke,zf),e(Ke,Ds),e(Ds,qf),e(Ds,Hs),e(Hs,xf),e(Ds,Cf),e(Ke,jf),k(Wo,Ke,null),e(Ke,Df),e(Ke,kt),k(Ls,kt,null),e(kt,Hf),e(kt,lo),e(lo,Lf),e(lo,Aa),e(Aa,Sf),e(lo,Nf),e(lo,Hr),e(Hr,Bf),e(lo,Wf),e(kt,Uf),k(Uo,kt,null),e(kt,Kf),k(Ko,kt,null),m(o,Ni,g),m(o,co,g),e(co,Ro),e(Ro,Lr),k(Ss,Lr,null),e(co,Rf),e(co,Sr),e(Sr,Vf),m(o,Bi,g),m(o,ge,g),k(Ns,ge,null),e(ge,Xf),e(ge,Nr),e(Nr,Jf),e(ge,Qf),e(ge,Ia),e(Ia,Ga),e(Ga,Yf),e(Ia,Zf),e(ge,eu),e(ge,ut),e(ut,tu),e(ut,Br),e(Br,ou),e(ut,nu),e(ut,Wr),e(Wr,su),e(ut,au),e(ut,Ur),e(Ur,ru),e(ut,iu),e(ut,Kr),e(Kr,lu),e(ut,du),e(ge,cu),e(ge,Bs),e(Bs,pu),e(Bs,Ma),e(Ma,hu),e(Bs,fu),e(ge,uu),e(ge,Ws),e(Ws,mu),e(Ws,Us),e(Us,gu),e(Ws,_u),e(ge,Tu),k(Vo,ge,null),e(ge,vu),e(ge,dt),k(Ks,dt,null),e(dt,bu),e(dt,po),e(po,yu),e(po,Ea),e(Ea,wu),e(po,ku),e(po,Rr),e(Rr,$u),e(po,Pu),e(dt,Ou),k(Xo,dt,null),e(dt,Au),k(Jo,dt,null),e(dt,Iu),k(Qo,dt,null),Wi=!0},p(o,[g]){const Rs={};g&2&&(Rs.$$scope={dirty:g,ctx:o}),go.$set(Rs);const Vr={};g&2&&(Vr.$$scope={dirty:g,ctx:o}),yo.$set(Vr);const Xr={};g&2&&(Xr.$$scope={dirty:g,ctx:o}),wo.$set(Xr);const Jr={};g&2&&(Jr.$$scope={dirty:g,ctx:o}),$o.$set(Jr);const Vs={};g&2&&(Vs.$$scope={dirty:g,ctx:o}),Po.$set(Vs);const Qr={};g&2&&(Qr.$$scope={dirty:g,ctx:o}),Ao.$set(Qr);const Yr={};g&2&&(Yr.$$scope={dirty:g,ctx:o}),Io.$set(Yr);const Zr={};g&2&&(Zr.$$scope={dirty:g,ctx:o}),Mo.$set(Zr);const Xs={};g&2&&(Xs.$$scope={dirty:g,ctx:o}),Eo.$set(Xs);const ei={};g&2&&(ei.$$scope={dirty:g,ctx:o}),Fo.$set(ei);const ti={};g&2&&(ti.$$scope={dirty:g,ctx:o}),zo.$set(ti);const oi={};g&2&&(oi.$$scope={dirty:g,ctx:o}),qo.$set(oi);const ni={};g&2&&(ni.$$scope={dirty:g,ctx:o}),Co.$set(ni);const si={};g&2&&(si.$$scope={dirty:g,ctx:o}),jo.$set(si);const Js={};g&2&&(Js.$$scope={dirty:g,ctx:o}),Do.$set(Js);const ai={};g&2&&(ai.$$scope={dirty:g,ctx:o}),Lo.$set(ai);const Qs={};g&2&&(Qs.$$scope={dirty:g,ctx:o}),So.$set(Qs);const ri={};g&2&&(ri.$$scope={dirty:g,ctx:o}),No.$set(ri);const Fa={};g&2&&(Fa.$$scope={dirty:g,ctx:o}),Wo.$set(Fa);const ii={};g&2&&(ii.$$scope={dirty:g,ctx:o}),Uo.$set(ii);const ho={};g&2&&(ho.$$scope={dirty:g,ctx:o}),Ko.$set(ho);const li={};g&2&&(li.$$scope={dirty:g,ctx:o}),Vo.$set(li);const di={};g&2&&(di.$$scope={dirty:g,ctx:o}),Xo.$set(di);const ci={};g&2&&(ci.$$scope={dirty:g,ctx:o}),Jo.$set(ci);const Et={};g&2&&(Et.$$scope={dirty:g,ctx:o}),Qo.$set(Et)},i(o){Wi||($(l.$$.fragment,o),$(A.$$.fragment,o),$(De.$$.fragment,o),$(dn.$$.fragment,o),$(cn.$$.fragment,o),$(fn.$$.fragment,o),$(qn.$$.fragment,o),$(jn.$$.fragment,o),$(Dn.$$.fragment,o),$(go.$$.fragment,o),$(Ln.$$.fragment,o),$(Sn.$$.fragment,o),$(Wn.$$.fragment,o),$(Un.$$.fragment,o),$(Kn.$$.fragment,o),$(Jn.$$.fragment,o),$(Qn.$$.fragment,o),$(Yn.$$.fragment,o),$(Zn.$$.fragment,o),$(es.$$.fragment,o),$(ss.$$.fragment,o),$(yo.$$.fragment,o),$(wo.$$.fragment,o),$(as.$$.fragment,o),$(rs.$$.fragment,o),$(cs.$$.fragment,o),$($o.$$.fragment,o),$(Po.$$.fragment,o),$(ps.$$.fragment,o),$(hs.$$.fragment,o),$(gs.$$.fragment,o),$(Ao.$$.fragment,o),$(Io.$$.fragment,o),$(_s.$$.fragment,o),$(Ts.$$.fragment,o),$(ws.$$.fragment,o),$(Mo.$$.fragment,o),$(Eo.$$.fragment,o),$(Fo.$$.fragment,o),$(zo.$$.fragment,o),$(qo.$$.fragment,o),$(ks.$$.fragment,o),$($s.$$.fragment,o),$(Co.$$.fragment,o),$(Is.$$.fragment,o),$(jo.$$.fragment,o),$(Do.$$.fragment,o),$(Gs.$$.fragment,o),$(Ms.$$.fragment,o),$(Lo.$$.fragment,o),$(qs.$$.fragment,o),$(So.$$.fragment,o),$(No.$$.fragment,o),$(xs.$$.fragment,o),$(Cs.$$.fragment,o),$(Wo.$$.fragment,o),$(Ls.$$.fragment,o),$(Uo.$$.fragment,o),$(Ko.$$.fragment,o),$(Ss.$$.fragment,o),$(Ns.$$.fragment,o),$(Vo.$$.fragment,o),$(Ks.$$.fragment,o),$(Xo.$$.fragment,o),$(Jo.$$.fragment,o),$(Qo.$$.fragment,o),Wi=!0)},o(o){P(l.$$.fragment,o),P(A.$$.fragment,o),P(De.$$.fragment,o),P(dn.$$.fragment,o),P(cn.$$.fragment,o),P(fn.$$.fragment,o),P(qn.$$.fragment,o),P(jn.$$.fragment,o),P(Dn.$$.fragment,o),P(go.$$.fragment,o),P(Ln.$$.fragment,o),P(Sn.$$.fragment,o),P(Wn.$$.fragment,o),P(Un.$$.fragment,o),P(Kn.$$.fragment,o),P(Jn.$$.fragment,o),P(Qn.$$.fragment,o),P(Yn.$$.fragment,o),P(Zn.$$.fragment,o),P(es.$$.fragment,o),P(ss.$$.fragment,o),P(yo.$$.fragment,o),P(wo.$$.fragment,o),P(as.$$.fragment,o),P(rs.$$.fragment,o),P(cs.$$.fragment,o),P($o.$$.fragment,o),P(Po.$$.fragment,o),P(ps.$$.fragment,o),P(hs.$$.fragment,o),P(gs.$$.fragment,o),P(Ao.$$.fragment,o),P(Io.$$.fragment,o),P(_s.$$.fragment,o),P(Ts.$$.fragment,o),P(ws.$$.fragment,o),P(Mo.$$.fragment,o),P(Eo.$$.fragment,o),P(Fo.$$.fragment,o),P(zo.$$.fragment,o),P(qo.$$.fragment,o),P(ks.$$.fragment,o),P($s.$$.fragment,o),P(Co.$$.fragment,o),P(Is.$$.fragment,o),P(jo.$$.fragment,o),P(Do.$$.fragment,o),P(Gs.$$.fragment,o),P(Ms.$$.fragment,o),P(Lo.$$.fragment,o),P(qs.$$.fragment,o),P(So.$$.fragment,o),P(No.$$.fragment,o),P(xs.$$.fragment,o),P(Cs.$$.fragment,o),P(Wo.$$.fragment,o),P(Ls.$$.fragment,o),P(Uo.$$.fragment,o),P(Ko.$$.fragment,o),P(Ss.$$.fragment,o),P(Ns.$$.fragment,o),P(Vo.$$.fragment,o),P(Ks.$$.fragment,o),P(Xo.$$.fragment,o),P(Jo.$$.fragment,o),P(Qo.$$.fragment,o),Wi=!1},d(o){t(d),o&&t(v),o&&t(u),O(l),o&&t(_e),o&&t(j),O(A),o&&t(Te),o&&t(D),o&&t(ve),o&&t(W),o&&t(be),o&&t(U),o&&t(ne),o&&t(F),o&&t(ye),o&&t(H),o&&t(we),o&&t(ie),o&&t(L),o&&t(Z),o&&t(ke),o&&t(T),o&&t(Re),o&&t(S),o&&t(Ve),O(De,o),o&&t(R),o&&t(ee),o&&t(pi),o&&t(St),O(dn),o&&t(hi),o&&t(ea),o&&t(fi),O(cn,o),o&&t(ui),o&&t(ta),o&&t(mi),O(fn,o),o&&t(gi),o&&t(se),o&&t(_i),O(qn,o),o&&t(Ti),o&&t(aa),o&&t(vi),o&&t(Nt),O(jn),o&&t(bi),o&&t(ht),O(Dn),O(go),o&&t(yi),o&&t(Wt),O(Ln),o&&t(wi),o&&t(ot),O(Sn),O(Wn),o&&t(ki),o&&t(Ut),O(Un),o&&t($i),o&&t(ft),O(Kn),o&&t(Pi),o&&t(Kt),O(Jn),o&&t(Oi),o&&t(Rt),O(Qn),o&&t(Ai),o&&t(Vt),O(Yn),o&&t(Ii),o&&t(Xt),O(Zn),o&&t(Gi),o&&t(nt),O(es),O(ss),O(yo),O(wo),o&&t(Mi),o&&t(Qt),O(as),o&&t(Ei),o&&t(st),O(rs),O(cs),O($o),O(Po),o&&t(Fi),o&&t(Zt),O(ps),o&&t(zi),o&&t(at),O(hs),O(gs),O(Ao),O(Io),o&&t(qi),o&&t(to),O(_s),o&&t(xi),o&&t(rt),O(Ts),O(ws),O(Mo),O(Eo),O(Fo),O(zo),O(qo),o&&t(Ci),o&&t(no),O(ks),o&&t(ji),o&&t(We),O($s),O(Co),O(Is),O(jo),O(Do),o&&t(Di),o&&t(ao),O(Gs),o&&t(Hi),o&&t(Ue),O(Ms),O(Lo),O(qs),O(So),O(No),o&&t(Li),o&&t(io),O(xs),o&&t(Si),o&&t(Ke),O(Cs),O(Wo),O(Ls),O(Uo),O(Ko),o&&t(Ni),o&&t(co),O(Ss),o&&t(Bi),o&&t(ge),O(Ns),O(Vo),O(Ks),O(Xo),O(Jo),O(Qo)}}}const q_={local:"openai-gpt",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.OpenAIGPTConfig",title:"OpenAIGPTConfig"},{local:"transformers.OpenAIGPTTokenizer",title:"OpenAIGPTTokenizer"},{local:"transformers.OpenAIGPTTokenizerFast",title:"OpenAIGPTTokenizerFast"},{local:"transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput",title:"OpenAI specific outputs"},{local:"transformers.OpenAIGPTModel",title:"OpenAIGPTModel"},{local:"transformers.OpenAIGPTLMHeadModel",title:"OpenAIGPTLMHeadModel"},{local:"transformers.OpenAIGPTDoubleHeadsModel",title:"OpenAIGPTDoubleHeadsModel"},{local:"transformers.OpenAIGPTForSequenceClassification",title:"OpenAIGPTForSequenceClassification"},{local:"transformers.TFOpenAIGPTModel",title:"TFOpenAIGPTModel"},{local:"transformers.TFOpenAIGPTLMHeadModel",title:"TFOpenAIGPTLMHeadModel"},{local:"transformers.TFOpenAIGPTDoubleHeadsModel",title:"TFOpenAIGPTDoubleHeadsModel"},{local:"transformers.TFOpenAIGPTForSequenceClassification",title:"TFOpenAIGPTForSequenceClassification"}],title:"OpenAI GPT"};function x_(E){return i_(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class B_ extends n_{constructor(d){super();s_(this,d,x_,z_,a_,{})}}export{B_ as default,q_ as metadata};
