import{S as Zg,i as e_,s as t_,e as a,k as c,w as k,t as n,M as o_,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 u,y as $,q as P,o as A,B as O,v as n_,L as Mt}from"../../chunks/vendor-hf-doc-builder.js";import{T as $t}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 it}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as It}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Pu}from"../../chunks/PipelineTag-hf-doc-builder.js";function s_(z){let d,y,g,_,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"),y=n("Examples:"),g=c(),k(_.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);y=s(m,"Examples:"),m.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,m){u(l,d,m),e(d,y),u(l,g,m),$(_,l,m),b=!0},p:Mt,i(l){b||(P(_.$$.fragment,l),b=!0)},o(l){A(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(g),O(_,l)}}}function a_(z){let d,y,g,_,b;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=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 m=i(d);y=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(m,"CODE",{});var E=i(g);_=s(E,"Module"),E.forEach(t),b=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){u(l,d,m),e(d,y),e(d,g),e(g,_),e(d,b)},d(l){l&&t(d)}}}function r_(z){let d,y,g,_,b;return _=new Pt({props:{code:`from transformers import AutoTokenizer, OpenAIGPTModel
import torch

tokenizer = AutoTokenizer.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> AutoTokenizer, 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 = AutoTokenizer.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"),y=n("Example:"),g=c(),k(_.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);y=s(m,"Example:"),m.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,m){u(l,d,m),e(d,y),u(l,g,m),$(_,l,m),b=!0},p:Mt,i(l){b||(P(_.$$.fragment,l),b=!0)},o(l){A(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(g),O(_,l)}}}function i_(z){let d,y,g,_,b;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=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 m=i(d);y=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(m,"CODE",{});var E=i(g);_=s(E,"Module"),E.forEach(t),b=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){u(l,d,m),e(d,y),e(d,g),e(g,_),e(d,b)},d(l){l&&t(d)}}}function l_(z){let d,y,g,_,b;return _=new Pt({props:{code:`import torch
from transformers import AutoTokenizer, OpenAIGPTLMHeadModel

tokenizer = AutoTokenizer.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> AutoTokenizer, OpenAIGPTLMHeadModel

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

tokenizer = AutoTokenizer.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> AutoTokenizer, 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 = AutoTokenizer.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"),y=n("Examples:"),g=c(),k(_.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);y=s(m,"Examples:"),m.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,m){u(l,d,m),e(d,y),u(l,g,m),$(_,l,m),b=!0},p:Mt,i(l){b||(P(_.$$.fragment,l),b=!0)},o(l){A(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(g),O(_,l)}}}function p_(z){let d,y,g,_,b;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=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 m=i(d);y=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(m,"CODE",{});var E=i(g);_=s(E,"Module"),E.forEach(t),b=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){u(l,d,m),e(d,y),e(d,g),e(g,_),e(d,b)},d(l){l&&t(d)}}}function h_(z){let d,y,g,_,b;return _=new Pt({props:{code:`import torch
from transformers import AutoTokenizer, OpenAIGPTForSequenceClassification

tokenizer = AutoTokenizer.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()

# 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`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, OpenAIGPTForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.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><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`}}),{c(){d=a("p"),y=n("Example of single-label classification:"),g=c(),k(_.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);y=s(m,"Example of single-label classification:"),m.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,m){u(l,d,m),e(d,y),u(l,g,m),$(_,l,m),b=!0},p:Mt,i(l){b||(P(_.$$.fragment,l),b=!0)},o(l){A(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(g),O(_,l)}}}function m_(z){let d,y,g,_,b;return _=new Pt({props:{code:`import torch
from transformers import AutoTokenizer, OpenAIGPTForSequenceClassification

tokenizer = AutoTokenizer.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_ids = torch.arange(0, logits.shape[-1])[torch.sigmoid(logits).squeeze(dim=0) > 0.5]

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = OpenAIGPTForSequenceClassification.from_pretrained(
    "openai-gpt", num_labels=num_labels, problem_type="multi_label_classification"
)

labels = torch.sum(
    torch.nn.functional.one_hot(predicted_class_ids[None, :].clone(), num_classes=num_labels), dim=1
).to(torch.float)
loss = model(**inputs, labels=labels).loss`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, OpenAIGPTForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.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_ids = torch.arange(<span class="hljs-number">0</span>, logits.shape[-<span class="hljs-number">1</span>])[torch.sigmoid(logits).squeeze(dim=<span class="hljs-number">0</span>) &gt; <span class="hljs-number">0.5</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = 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.<span class="hljs-built_in">sum</span>(
<span class="hljs-meta">... </span>    torch.nn.functional.one_hot(predicted_class_ids[<span class="hljs-literal">None</span>, :].clone(), num_classes=num_labels), dim=<span class="hljs-number">1</span>
<span class="hljs-meta">... </span>).to(torch.<span class="hljs-built_in">float</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=a("p"),y=n("Example of multi-label classification:"),g=c(),k(_.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);y=s(m,"Example of multi-label classification:"),m.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,m){u(l,d,m),e(d,y),u(l,g,m),$(_,l,m),b=!0},p:Mt,i(l){b||(P(_.$$.fragment,l),b=!0)},o(l){A(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(g),O(_,l)}}}function u_(z){let d,y,g,_,b,l,m,E,Pe,_e,j,oe,te,v,Ae,K,Oe,Te,D,Ie,ae,V,Me,be,W,Ee,ye,U,me,Ge,ne,G,q,ve,H,ue,ze,X,re,Fe,F,qe,J,ke,ie,N,Ce,xe,L,Z,Q,le,de,C,ce,x,je,we;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),g=a("code"),_=n("transformers"),b=n(" accept two formats as input:"),l=c(),m=a("ul"),E=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(),v=a("p"),Ae=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"),Oe=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"),Me=n("fit()"),be=n(" and "),W=a("code"),Ee=n("predict()"),ye=n(`, such as when creating your own layers or models with
the Keras `),U=a("code"),me=n("Functional"),Ge=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),ne=c(),G=a("ul"),q=a("li"),ve=n("a single Tensor with "),H=a("code"),ue=n("input_ids"),ze=n(" only and nothing else: "),X=a("code"),re=n("model(input_ids)"),Fe=c(),F=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"),ke=n("model([input_ids, attention_mask])"),ie=n(" or "),N=a("code"),Ce=n("model([input_ids, attention_mask, token_type_ids])"),xe=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(),C=a("p"),ce=n(`Note that when creating models and layers with
`),x=a("a"),je=n("subclassing"),we=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);y=s(I,"TensorFlow models and layers in "),g=r(I,"CODE",{});var Ke=i(g);_=s(Ke,"transformers"),Ke.forEach(t),b=s(I," accept two formats as input:"),I.forEach(t),l=p(T),m=r(T,"UL",{});var S=i(m);E=r(S,"LI",{});var Xe=i(E);Pe=s(Xe,"having all inputs as keyword arguments (like PyTorch models), or"),Xe.forEach(t),_e=p(S),j=r(S,"LI",{});var He=i(j);oe=s(He,"having all inputs as a list, tuple or dict in the first positional argument."),He.forEach(t),S.forEach(t),te=p(T),v=r(T,"P",{});var M=i(v);Ae=s(M,`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(M,"CODE",{});var Je=i(K);Oe=s(Je,"model.fit()"),Je.forEach(t),Te=s(M,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=r(M,"CODE",{});var Le=i(D);Ie=s(Le,"model.fit()"),Le.forEach(t),ae=s(M,` supports! If, however, you want to use the second
format outside of Keras methods like `),V=r(M,"CODE",{});var Qe=i(V);Me=s(Qe,"fit()"),Qe.forEach(t),be=s(M," and "),W=r(M,"CODE",{});var Ye=i(W);Ee=s(Ye,"predict()"),Ye.forEach(t),ye=s(M,`, such as when creating your own layers or models with
the Keras `),U=r(M,"CODE",{});var Se=i(U);me=s(Se,"Functional"),Se.forEach(t),Ge=s(M,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),M.forEach(t),ne=p(T),G=r(T,"UL",{});var B=i(G);q=r(B,"LI",{});var Y=i(q);ve=s(Y,"a single Tensor with "),H=r(Y,"CODE",{});var Re=i(H);ue=s(Re,"input_ids"),Re.forEach(t),ze=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),Fe=p(B),F=r(B,"LI",{});var R=i(F);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);ke=s(ee,"model([input_ids, attention_mask])"),ee.forEach(t),ie=s(R," or "),N=r(R,"CODE",{});var Ze=i(N);Ce=s(Ze,"model([input_ids, attention_mask, token_type_ids])"),Ze.forEach(t),R.forEach(t),xe=p(B),L=r(B,"LI",{});var fe=i(L);Z=s(fe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Q=r(fe,"CODE",{});var et=i(Q);le=s(et,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),et.forEach(t),fe.forEach(t),B.forEach(t),de=p(T),C=r(T,"P",{});var pe=i(C);ce=s(pe,`Note that when creating models and layers with
`),x=r(pe,"A",{href:!0,rel:!0});var Ne=i(x);je=s(Ne,"subclassing"),Ne.forEach(t),we=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(x,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),h(x,"rel","nofollow")},m(T,I){u(T,d,I),e(d,y),e(d,g),e(g,_),e(d,b),u(T,l,I),u(T,m,I),e(m,E),e(E,Pe),e(m,_e),e(m,j),e(j,oe),u(T,te,I),u(T,v,I),e(v,Ae),e(v,K),e(K,Oe),e(v,Te),e(v,D),e(D,Ie),e(v,ae),e(v,V),e(V,Me),e(v,be),e(v,W),e(W,Ee),e(v,ye),e(v,U),e(U,me),e(v,Ge),u(T,ne,I),u(T,G,I),e(G,q),e(q,ve),e(q,H),e(H,ue),e(q,ze),e(q,X),e(X,re),e(G,Fe),e(G,F),e(F,qe),e(F,J),e(J,ke),e(F,ie),e(F,N),e(N,Ce),e(G,xe),e(G,L),e(L,Z),e(L,Q),e(Q,le),u(T,de,I),u(T,C,I),e(C,ce),e(C,x),e(x,je),e(C,we)},d(T){T&&t(d),T&&t(l),T&&t(m),T&&t(te),T&&t(v),T&&t(ne),T&&t(G),T&&t(de),T&&t(C)}}}function f_(z){let d,y,g,_,b;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=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 m=i(d);y=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(m,"CODE",{});var E=i(g);_=s(E,"Module"),E.forEach(t),b=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){u(l,d,m),e(d,y),e(d,g),e(g,_),e(d,b)},d(l){l&&t(d)}}}function g_(z){let d,y,g,_,b;return _=new Pt({props:{code:`from transformers import AutoTokenizer, TFOpenAIGPTModel
import tensorflow as tf

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

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

tokenizer = AutoTokenizer.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> AutoTokenizer, TFOpenAIGPTDoubleHeadsModel

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

tokenizer = AutoTokenizer.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])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, 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 = AutoTokenizer.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>])`}}),{c(){d=a("p"),y=n("Example:"),g=c(),k(_.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);y=s(m,"Example:"),m.forEach(t),g=p(l),w(_.$$.fragment,l)},m(l,m){u(l,d,m),e(d,y),u(l,g,m),$(_,l,m),b=!0},p:Mt,i(l){b||(P(_.$$.fragment,l),b=!0)},o(l){A(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(g),O(_,l)}}}function A_(z){let d,y;return d=new Pt({props:{code:'# To train a model on `num_labels` classes, you can pass `num_labels=num_labels` to `.from_pretrained(...)`\nnum_labels = len(model.config.id2label)\nmodel = TFOpenAIGPTForSequenceClassification.from_pretrained("openai-gpt", num_labels=num_labels)\n\nlabels = tf.constant(1)\nloss = model(**inputs, labels=labels).loss',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on `num_labels` classes, you can pass `num_labels=num_labels` to `.from_pretrained(...)`</span>\n<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)\n<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFOpenAIGPTForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>, num_labels=num_labels)\n\n<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tf.constant(<span class="hljs-number">1</span>)\n<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss'}}),{c(){k(d.$$.fragment)},l(g){w(d.$$.fragment,g)},m(g,_){$(d,g,_),y=!0},p:Mt,i(g){y||(P(d.$$.fragment,g),y=!0)},o(g){A(d.$$.fragment,g),y=!1},d(g){O(d,g)}}}function O_(z){let d,y,g,_,b,l,m,E,Pe,_e,j,oe,te,v,Ae,K,Oe,Te,D,Ie,ae,V,Me,be,W,Ee,ye,U,me,Ge,ne,G,q,ve,H,ue,ze,X,re,Fe,F,qe,J,ke,ie,N,Ce,xe,L,Z,Q,le,de,C,ce,x,je,we,T,I,Ke,S,Xe,He,M,Je,Le,Qe,Ye,Se,B,Y,Re,De,R,ee,Ze,fe,et,pe,Ne,Fl,ql,Qs,Cl,xl,La,jl,Dl,li,Lt,mo,Sa,rn,Hl,Na,Ll,di,Ys,Sl,ci,ln,pi,Zs,dn,Nl,cn,Bl,Wl,hi,pn,mi,se,hn,Ul,mn,Kl,Rl,Vl,un,Xl,fn,Jl,Ql,Yl,gn,Zl,_n,ed,td,od,Tn,nd,bn,sd,ad,rd,yn,id,vn,ld,dd,cd,kn,pd,wn,hd,md,ud,$n,fd,Pn,gd,_d,Td,ea,An,bd,yd,vd,mt,ta,kd,wd,On,$d,Pd,In,Ad,Od,Mn,Id,Md,Ed,Et,oa,Gd,zd,En,Fd,qd,Gn,Cd,xd,ui,zn,fi,na,Fn,jd,qn,Dd,Hd,gi,St,uo,Ba,Cn,Ld,Wa,Sd,_i,ct,xn,Nd,At,Bd,sa,Wd,Ud,aa,Kd,Rd,jn,Vd,Xd,Jd,Nt,Qd,ra,Yd,Zd,ia,ec,tc,oc,fo,Ti,Bt,go,Ua,Dn,nc,Ka,sc,bi,tt,Hn,ac,Ra,rc,ic,Ln,Va,lc,dc,Ot,cc,Xa,pc,hc,Ja,mc,uc,Qa,fc,gc,_c,Sn,Tc,la,bc,yc,vc,da,Nn,yi,Wt,_o,Ya,Bn,kc,Za,wc,vi,pt,Wn,$c,Un,Pc,er,Ac,Oc,Ic,Kn,tr,Mc,Ec,or,Gc,zc,Rn,Fc,ca,qc,Cc,ki,Ut,To,nr,Vn,xc,sr,jc,wi,Kt,Xn,Dc,ar,Hc,$i,Rt,Jn,Lc,rr,Sc,Pi,Vt,bo,ir,Qn,Nc,lr,Bc,Ai,ot,Yn,Wc,dr,Uc,Kc,Zn,Rc,pa,Vc,Xc,Jc,es,Qc,ts,Yc,Zc,ep,ut,os,tp,Xt,op,ha,np,sp,cr,ap,rp,ip,yo,lp,vo,Oi,Jt,ko,pr,ns,dp,hr,cp,Ii,nt,ss,pp,mr,hp,mp,as,up,ma,fp,gp,_p,rs,Tp,is,bp,yp,vp,ft,ls,kp,Qt,wp,ua,$p,Pp,ur,Ap,Op,Ip,wo,Mp,$o,Mi,Yt,Po,fr,ds,Ep,gr,Gp,Ei,st,cs,zp,_r,Fp,qp,ps,Cp,fa,xp,jp,Dp,hs,Hp,ms,Lp,Sp,Np,gt,us,Bp,Zt,Wp,ga,Up,Kp,Tr,Rp,Vp,Xp,Ao,Jp,Oo,Gi,eo,Io,br,fs,Qp,yr,Yp,zi,at,gs,Zp,rt,eh,_a,th,oh,vr,nh,sh,kr,ah,rh,wr,ih,lh,$r,dh,ch,ph,_s,hh,Ta,mh,uh,fh,Ts,gh,bs,_h,Th,bh,lt,ys,yh,to,vh,ba,kh,wh,Pr,$h,Ph,Ah,Mo,Oh,Eo,Ih,Go,Fi,oo,zo,Ar,vs,Mh,Or,Eh,qi,Be,ks,Gh,Ir,zh,Fh,ws,qh,ya,Ch,xh,jh,$s,Dh,Ps,Hh,Lh,Sh,Fo,Nh,_t,As,Bh,no,Wh,va,Uh,Kh,Mr,Rh,Vh,Xh,qo,Jh,Co,Ci,so,xo,Er,Os,Qh,Gr,Yh,xi,We,Is,Zh,zr,em,tm,Ms,om,ka,nm,sm,am,Es,rm,Gs,im,lm,dm,jo,cm,Tt,zs,pm,ao,hm,wa,mm,um,Fr,fm,gm,_m,Do,Tm,Ho,ji,ro,Lo,qr,Fs,bm,Cr,ym,Di,Ue,qs,vm,xr,km,wm,Cs,$m,$a,Pm,Am,Om,xs,Im,js,Mm,Em,Gm,So,zm,bt,Ds,Fm,io,qm,Pa,Cm,xm,jr,jm,Dm,Hm,No,Lm,Bo,Hi,lo,Wo,Dr,Hs,Sm,Hr,Nm,Li,ge,Ls,Bm,Lr,Wm,Um,Aa,Oa,Km,Rm,Vm,ht,Xm,Sr,Jm,Qm,Nr,Ym,Zm,Br,eu,tu,Wr,ou,nu,su,Ss,au,Ia,ru,iu,lu,Ns,du,Bs,cu,pu,hu,Uo,mu,dt,Ws,uu,co,fu,Ma,gu,_u,Ur,Tu,bu,yu,Ko,vu,Ro,ku,Vo,Si;return l=new it({}),v=new it({}),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`}}),rn=new it({}),ln=new Pu({props:{pipeline:"text-classification"}}),pn=new Pu({props:{pipeline:"text-generation"}}),zn=new Pu({props:{pipeline:"token-classification"}}),Cn=new it({}),xn=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:"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/main/en/model_doc/openai-gpt#transformers.OpenAIGPTModel">OpenAIGPTModel</a> or <a href="/docs/transformers/main/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.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/main/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a> and
<a href="/docs/transformers/main/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/main/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a> and
<a href="/docs/transformers/main/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/main/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a> and
<a href="/docs/transformers/main/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/main/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a> and
<a href="/docs/transformers/main/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/main/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel">OpenAIGPTDoubleHeadsModel</a> and
<a href="/docs/transformers/main/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/main/src/transformers/models/openai/configuration_openai.py#L27"}}),fo=new It({props:{anchor:"transformers.OpenAIGPTConfig.example",$$slots:{default:[s_]},$$scope:{ctx:z}}}),Dn=new it({}),Hn=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/main/src/transformers/models/openai/tokenization_openai.py#L233"}}),Nn=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/main/src/transformers/models/openai/tokenization_openai.py#L366"}}),Bn=new it({}),Wn=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/main/src/transformers/models/openai/tokenization_openai_fast.py#L40"}}),Vn=new it({}),Xn=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/main/src/transformers/models/openai/modeling_openai.py#L297"}}),Jn=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/main/src/transformers/models/openai/modeling_tf_openai.py#L392"}}),Qn=new it({}),Yn=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/openai/modeling_openai.py#L401"}}),os=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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/openai/modeling_openai.py#L427",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),yo=new $t({props:{$$slots:{default:[a_]},$$scope:{ctx:z}}}),vo=new It({props:{anchor:"transformers.OpenAIGPTModel.forward.example",$$slots:{default:[r_]},$$scope:{ctx:z}}}),ns=new it({}),ss=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/openai/modeling_openai.py#L531"}}),ls=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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/openai/modeling_openai.py#L548",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutput"
>transformers.modeling_outputs.CausalLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),wo=new $t({props:{$$slots:{default:[i_]},$$scope:{ctx:z}}}),$o=new It({props:{anchor:"transformers.OpenAIGPTLMHeadModel.forward.example",$$slots:{default:[l_]},$$scope:{ctx:z}}}),ds=new it({}),cs=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/openai/modeling_openai.py#L622"}}),us=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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/openai/modeling_openai.py#L642",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/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 $t({props:{$$slots:{default:[d_]},$$scope:{ctx:z}}}),Oo=new It({props:{anchor:"transformers.OpenAIGPTDoubleHeadsModel.forward.example",$$slots:{default:[c_]},$$scope:{ctx:z}}}),fs=new it({}),gs=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/openai/modeling_openai.py#L750"}}),ys=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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/openai/modeling_openai.py#L760",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Mo=new $t({props:{$$slots:{default:[p_]},$$scope:{ctx:z}}}),Eo=new It({props:{anchor:"transformers.OpenAIGPTForSequenceClassification.forward.example",$$slots:{default:[h_]},$$scope:{ctx:z}}}),Go=new It({props:{anchor:"transformers.OpenAIGPTForSequenceClassification.forward.example-2",$$slots:{default:[m_]},$$scope:{ctx:z}}}),vs=new it({}),ks=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/openai/modeling_tf_openai.py#L522"}}),Fo=new $t({props:{$$slots:{default:[u_]},$$scope:{ctx:z}}}),As=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[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.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/main/src/transformers/models/openai/modeling_tf_openai.py#L527",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput"
>transformers.modeling_tf_outputs.TFBaseModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),qo=new $t({props:{$$slots:{default:[f_]},$$scope:{ctx:z}}}),Co=new It({props:{anchor:"transformers.TFOpenAIGPTModel.call.example",$$slots:{default:[g_]},$$scope:{ctx:z}}}),Os=new it({}),Is=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/openai/modeling_tf_openai.py#L577"}}),jo=new $t({props:{$$slots:{default:[__]},$$scope:{ctx:z}}}),zs=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[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.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/main/src/transformers/models/openai/modeling_tf_openai.py#L590",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutput"
>transformers.modeling_tf_outputs.TFCausalLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Do=new $t({props:{$$slots:{default:[T_]},$$scope:{ctx:z}}}),Ho=new It({props:{anchor:"transformers.TFOpenAIGPTLMHeadModel.call.example",$$slots:{default:[b_]},$$scope:{ctx:z}}}),Fs=new it({}),qs=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/openai/modeling_tf_openai.py#L670"}}),So=new $t({props:{$$slots:{default:[y_]},$$scope:{ctx:z}}}),Ds=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[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.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/main/src/transformers/models/openai/modeling_tf_openai.py#L679",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/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>
`}}),No=new $t({props:{$$slots:{default:[v_]},$$scope:{ctx:z}}}),Bo=new It({props:{anchor:"transformers.TFOpenAIGPTDoubleHeadsModel.call.example",$$slots:{default:[k_]},$$scope:{ctx:z}}}),Hs=new it({}),Ls=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/openai/modeling_tf_openai.py#L805"}}),Uo=new $t({props:{$$slots:{default:[w_]},$$scope:{ctx:z}}}),Ws=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[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.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/main/src/transformers/models/openai/modeling_tf_openai.py#L817",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Ko=new $t({props:{$$slots:{default:[$_]},$$scope:{ctx:z}}}),Ro=new It({props:{anchor:"transformers.TFOpenAIGPTForSequenceClassification.call.example",$$slots:{default:[P_]},$$scope:{ctx:z}}}),Vo=new It({props:{anchor:"transformers.TFOpenAIGPTForSequenceClassification.call.example-2",$$slots:{default:[A_]},$$scope:{ctx:z}}}),{c(){d=a("meta"),y=c(),g=a("h1"),_=a("a"),b=a("span"),k(l.$$.fragment),m=c(),E=a("span"),Pe=n("OpenAI GPT"),_e=c(),j=a("h2"),oe=a("a"),te=a("span"),k(v.$$.fragment),Ae=c(),K=a("span"),Oe=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"),Me=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.`),be=c(),W=a("p"),Ee=n("The abstract from the paper is the following:"),ye=c(),U=a("p"),me=a("em"),Ge=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(),G=a("p"),q=n("Tips:"),ve=c(),H=a("ul"),ue=a("li"),ze=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"),Fe=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 `),F=a("em"),qe=n("run_generation.py"),J=n(" example script."),ke=c(),ie=a("p"),N=a("a"),Ce=n("Write With Transformer"),xe=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"),C=n(". The original code can be found "),ce=a("a"),x=n("here"),je=n("."),we=c(),T=a("p"),I=n("Note:"),Ke=c(),S=a("p"),Xe=n("If you want to reproduce the original tokenization process of the "),He=a("em"),M=n("OpenAI GPT"),Je=n(" paper, you will need to install "),Le=a("code"),Qe=n("ftfy"),Ye=n(`
and `),Se=a("code"),B=n("SpaCy"),Y=n(":"),Re=c(),k(De.$$.fragment),R=c(),ee=a("p"),Ze=n("If you don\u2019t install "),fe=a("code"),et=n("ftfy"),pe=n(" and "),Ne=a("code"),Fl=n("SpaCy"),ql=n(", the "),Qs=a("a"),Cl=n("OpenAIGPTTokenizer"),xl=n(` will default to tokenize
using BERT\u2019s `),La=a("code"),jl=n("BasicTokenizer"),Dl=n(" followed by Byte-Pair Encoding (which should be fine for most usage, don\u2019t worry)."),li=c(),Lt=a("h2"),mo=a("a"),Sa=a("span"),k(rn.$$.fragment),Hl=c(),Na=a("span"),Ll=n("Resources"),di=c(),Ys=a("p"),Sl=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with OpenAI GPT. 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."),ci=c(),k(ln.$$.fragment),pi=c(),Zs=a("ul"),dn=a("li"),Nl=n("A blog post on "),cn=a("a"),Bl=n("outperforming OpenAI GPT-3 with SetFit for text-classification"),Wl=n("."),hi=c(),k(pn.$$.fragment),mi=c(),se=a("ul"),hn=a("li"),Ul=n("A blog on how to "),mn=a("a"),Kl=n("Finetune a non-English GPT-2 Model with Hugging Face"),Rl=n("."),Vl=c(),un=a("li"),Xl=n("A blog on "),fn=a("a"),Jl=n("How to generate text: using different decoding methods for language generation with Transformers"),Ql=n(" with GPT-2."),Yl=c(),gn=a("li"),Zl=n("A blog on "),_n=a("a"),ed=n("Training CodeParrot \u{1F99C} from Scratch"),td=n(", a large GPT-2 model."),od=c(),Tn=a("li"),nd=n("A blog on "),bn=a("a"),sd=n("Faster Text Generation with TensorFlow and XLA"),ad=n(" with GPT-2."),rd=c(),yn=a("li"),id=n("A blog on "),vn=a("a"),ld=n("How to train a Language Model with Megatron-LM"),dd=n(" with a GPT-2 model."),cd=c(),kn=a("li"),pd=n("A notebook on how to "),wn=a("a"),hd=n("finetune GPT2 to generate lyrics in the style of your favorite artist"),md=n(". \u{1F30E}"),ud=c(),$n=a("li"),fd=n("A notebook on how to "),Pn=a("a"),gd=n("finetune GPT2 to generate tweets in the style of your favorite Twitter user"),_d=n(". \u{1F30E}"),Td=c(),ea=a("li"),An=a("a"),bd=n("Causal language modeling"),yd=n(" chapter of the \u{1F917} Hugging Face Course."),vd=c(),mt=a("li"),ta=a("a"),kd=n("OpenAIGPTLMHeadModel"),wd=n(" is supported by this "),On=a("a"),$d=n("causal language modeling example script"),Pd=n(", "),In=a("a"),Ad=n("text generation example script"),Od=n(" and "),Mn=a("a"),Id=n("notebook"),Md=n("."),Ed=c(),Et=a("li"),oa=a("a"),Gd=n("TFOpenAIGPTLMHeadModel"),zd=n(" is supported by this "),En=a("a"),Fd=n("causal language modeling example script"),qd=n(" and "),Gn=a("a"),Cd=n("notebook"),xd=n("."),ui=c(),k(zn.$$.fragment),fi=c(),na=a("ul"),Fn=a("li"),jd=n("A course material on "),qn=a("a"),Dd=n("Byte-Pair Encoding tokenization"),Hd=n("."),gi=c(),St=a("h2"),uo=a("a"),Ba=a("span"),k(Cn.$$.fragment),Ld=c(),Wa=a("span"),Sd=n("OpenAIGPTConfig"),_i=c(),ct=a("div"),k(xn.$$.fragment),Nd=c(),At=a("p"),Bd=n("This is the configuration class to store the configuration of a "),sa=a("a"),Wd=n("OpenAIGPTModel"),Ud=n(" or a "),aa=a("a"),Kd=n("TFOpenAIGPTModel"),Rd=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
`),jn=a("a"),Vd=n("openai-gpt"),Xd=n(" architecture from OpenAI."),Jd=c(),Nt=a("p"),Qd=n("Configuration objects inherit from "),ra=a("a"),Yd=n("PretrainedConfig"),Zd=n(` and can be used to control the model outputs. Read the
documentation from `),ia=a("a"),ec=n("PretrainedConfig"),tc=n(" for more information."),oc=c(),k(fo.$$.fragment),Ti=c(),Bt=a("h2"),go=a("a"),Ua=a("span"),k(Dn.$$.fragment),nc=c(),Ka=a("span"),sc=n("OpenAIGPTTokenizer"),bi=c(),tt=a("div"),k(Hn.$$.fragment),ac=c(),Ra=a("p"),rc=n("Construct a GPT Tokenizer. Based on Byte-Pair-Encoding with the following peculiarities:"),ic=c(),Ln=a("ul"),Va=a("li"),lc=n("lowercases all inputs,"),dc=c(),Ot=a("li"),cc=n("uses "),Xa=a("code"),pc=n("SpaCy"),hc=n(" tokenizer and "),Ja=a("code"),mc=n("ftfy"),uc=n(` for pre-BPE tokenization if they are installed, fallback to BERT\u2019s
`),Qa=a("code"),fc=n("BasicTokenizer"),gc=n(" if not."),_c=c(),Sn=a("p"),Tc=n("This tokenizer inherits from "),la=a("a"),bc=n("PreTrainedTokenizer"),yc=n(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),vc=c(),da=a("div"),k(Nn.$$.fragment),yi=c(),Wt=a("h2"),_o=a("a"),Ya=a("span"),k(Bn.$$.fragment),kc=c(),Za=a("span"),wc=n("OpenAIGPTTokenizerFast"),vi=c(),pt=a("div"),k(Wn.$$.fragment),$c=c(),Un=a("p"),Pc=n("Construct a \u201Cfast\u201D GPT Tokenizer (backed by HuggingFace\u2019s "),er=a("em"),Ac=n("tokenizers"),Oc=n(` library). Based on Byte-Pair-Encoding with
the following peculiarities:`),Ic=c(),Kn=a("ul"),tr=a("li"),Mc=n("lower case all inputs"),Ec=c(),or=a("li"),Gc=n("uses BERT\u2019s BasicTokenizer for pre-BPE tokenization"),zc=c(),Rn=a("p"),Fc=n("This tokenizer inherits from "),ca=a("a"),qc=n("PreTrainedTokenizerFast"),Cc=n(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),ki=c(),Ut=a("h2"),To=a("a"),nr=a("span"),k(Vn.$$.fragment),xc=c(),sr=a("span"),jc=n("OpenAI specific outputs"),wi=c(),Kt=a("div"),k(Xn.$$.fragment),Dc=c(),ar=a("p"),Hc=n("Base class for outputs of models predicting if two sentences are consecutive or not."),$i=c(),Rt=a("div"),k(Jn.$$.fragment),Lc=c(),rr=a("p"),Sc=n("Base class for outputs of models predicting if two sentences are consecutive or not."),Pi=c(),Vt=a("h2"),bo=a("a"),ir=a("span"),k(Qn.$$.fragment),Nc=c(),lr=a("span"),Bc=n("OpenAIGPTModel"),Ai=c(),ot=a("div"),k(Yn.$$.fragment),Wc=c(),dr=a("p"),Uc=n("The bare OpenAI GPT transformer model outputting raw hidden-states without any specific head on top."),Kc=c(),Zn=a("p"),Rc=n("This model inherits from "),pa=a("a"),Vc=n("PreTrainedModel"),Xc=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.)`),Jc=c(),es=a("p"),Qc=n("This model is also a PyTorch "),ts=a("a"),Yc=n("torch.nn.Module"),Zc=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ep=c(),ut=a("div"),k(os.$$.fragment),tp=c(),Xt=a("p"),op=n("The "),ha=a("a"),np=n("OpenAIGPTModel"),sp=n(" forward method, overrides the "),cr=a("code"),ap=n("__call__"),rp=n(" special method."),ip=c(),k(yo.$$.fragment),lp=c(),k(vo.$$.fragment),Oi=c(),Jt=a("h2"),ko=a("a"),pr=a("span"),k(ns.$$.fragment),dp=c(),hr=a("span"),cp=n("OpenAIGPTLMHeadModel"),Ii=c(),nt=a("div"),k(ss.$$.fragment),pp=c(),mr=a("p"),hp=n(`OpenAI GPT Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),mp=c(),as=a("p"),up=n("This model inherits from "),ma=a("a"),fp=n("PreTrainedModel"),gp=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.)`),_p=c(),rs=a("p"),Tp=n("This model is also a PyTorch "),is=a("a"),bp=n("torch.nn.Module"),yp=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),vp=c(),ft=a("div"),k(ls.$$.fragment),kp=c(),Qt=a("p"),wp=n("The "),ua=a("a"),$p=n("OpenAIGPTLMHeadModel"),Pp=n(" forward method, overrides the "),ur=a("code"),Ap=n("__call__"),Op=n(" special method."),Ip=c(),k(wo.$$.fragment),Mp=c(),k($o.$$.fragment),Mi=c(),Yt=a("h2"),Po=a("a"),fr=a("span"),k(ds.$$.fragment),Ep=c(),gr=a("span"),Gp=n("OpenAIGPTDoubleHeadsModel"),Ei=c(),st=a("div"),k(cs.$$.fragment),zp=c(),_r=a("p"),Fp=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).`),qp=c(),ps=a("p"),Cp=n("This model inherits from "),fa=a("a"),xp=n("PreTrainedModel"),jp=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.)`),Dp=c(),hs=a("p"),Hp=n("This model is also a PyTorch "),ms=a("a"),Lp=n("torch.nn.Module"),Sp=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(),gt=a("div"),k(us.$$.fragment),Bp=c(),Zt=a("p"),Wp=n("The "),ga=a("a"),Up=n("OpenAIGPTDoubleHeadsModel"),Kp=n(" forward method, overrides the "),Tr=a("code"),Rp=n("__call__"),Vp=n(" special method."),Xp=c(),k(Ao.$$.fragment),Jp=c(),k(Oo.$$.fragment),Gi=c(),eo=a("h2"),Io=a("a"),br=a("span"),k(fs.$$.fragment),Qp=c(),yr=a("span"),Yp=n("OpenAIGPTForSequenceClassification"),zi=c(),at=a("div"),k(gs.$$.fragment),Zp=c(),rt=a("p"),eh=n(`The Original OpenAI GPT Model transformer with a sequence classification head on top (linear layer).
`),_a=a("a"),th=n("OpenAIGPTForSequenceClassification"),oh=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 `),vr=a("code"),nh=n("pad_token_id"),sh=n(` is defined in the configuration, it finds the last token that is not a padding
token in each row. If no `),kr=a("code"),ah=n("pad_token_id"),rh=n(` is defined, it simply takes the last value in each row of the batch. Since
it cannot guess the padding tokens when `),wr=a("code"),ih=n("inputs_embeds"),lh=n(" are passed instead of "),$r=a("code"),dh=n("input_ids"),ch=n(`, it does the same (take
the last value in each row of the batch).`),ph=c(),_s=a("p"),hh=n("This model inherits from "),Ta=a("a"),mh=n("PreTrainedModel"),uh=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.)`),fh=c(),Ts=a("p"),gh=n("This model is also a PyTorch "),bs=a("a"),_h=n("torch.nn.Module"),Th=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),bh=c(),lt=a("div"),k(ys.$$.fragment),yh=c(),to=a("p"),vh=n("The "),ba=a("a"),kh=n("OpenAIGPTForSequenceClassification"),wh=n(" forward method, overrides the "),Pr=a("code"),$h=n("__call__"),Ph=n(" special method."),Ah=c(),k(Mo.$$.fragment),Oh=c(),k(Eo.$$.fragment),Ih=c(),k(Go.$$.fragment),Fi=c(),oo=a("h2"),zo=a("a"),Ar=a("span"),k(vs.$$.fragment),Mh=c(),Or=a("span"),Eh=n("TFOpenAIGPTModel"),qi=c(),Be=a("div"),k(ks.$$.fragment),Gh=c(),Ir=a("p"),zh=n("The bare OpenAI GPT transformer model outputting raw hidden-states without any specific head on top."),Fh=c(),ws=a("p"),qh=n("This model inherits from "),ya=a("a"),Ch=n("TFPreTrainedModel"),xh=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),jh=c(),$s=a("p"),Dh=n("This model is also a "),Ps=a("a"),Hh=n("tf.keras.Model"),Lh=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.`),Sh=c(),k(Fo.$$.fragment),Nh=c(),_t=a("div"),k(As.$$.fragment),Bh=c(),no=a("p"),Wh=n("The "),va=a("a"),Uh=n("TFOpenAIGPTModel"),Kh=n(" forward method, overrides the "),Mr=a("code"),Rh=n("__call__"),Vh=n(" special method."),Xh=c(),k(qo.$$.fragment),Jh=c(),k(Co.$$.fragment),Ci=c(),so=a("h2"),xo=a("a"),Er=a("span"),k(Os.$$.fragment),Qh=c(),Gr=a("span"),Yh=n("TFOpenAIGPTLMHeadModel"),xi=c(),We=a("div"),k(Is.$$.fragment),Zh=c(),zr=a("p"),em=n(`OpenAI GPT Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),tm=c(),Ms=a("p"),om=n("This model inherits from "),ka=a("a"),nm=n("TFPreTrainedModel"),sm=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),am=c(),Es=a("p"),rm=n("This model is also a "),Gs=a("a"),im=n("tf.keras.Model"),lm=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.`),dm=c(),k(jo.$$.fragment),cm=c(),Tt=a("div"),k(zs.$$.fragment),pm=c(),ao=a("p"),hm=n("The "),wa=a("a"),mm=n("TFOpenAIGPTLMHeadModel"),um=n(" forward method, overrides the "),Fr=a("code"),fm=n("__call__"),gm=n(" special method."),_m=c(),k(Do.$$.fragment),Tm=c(),k(Ho.$$.fragment),ji=c(),ro=a("h2"),Lo=a("a"),qr=a("span"),k(Fs.$$.fragment),bm=c(),Cr=a("span"),ym=n("TFOpenAIGPTDoubleHeadsModel"),Di=c(),Ue=a("div"),k(qs.$$.fragment),vm=c(),xr=a("p"),km=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).`),wm=c(),Cs=a("p"),$m=n("This model inherits from "),$a=a("a"),Pm=n("TFPreTrainedModel"),Am=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.)`),Om=c(),xs=a("p"),Im=n("This model is also a "),js=a("a"),Mm=n("tf.keras.Model"),Em=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.`),Gm=c(),k(So.$$.fragment),zm=c(),bt=a("div"),k(Ds.$$.fragment),Fm=c(),io=a("p"),qm=n("The "),Pa=a("a"),Cm=n("TFOpenAIGPTDoubleHeadsModel"),xm=n(" forward method, overrides the "),jr=a("code"),jm=n("__call__"),Dm=n(" special method."),Hm=c(),k(No.$$.fragment),Lm=c(),k(Bo.$$.fragment),Hi=c(),lo=a("h2"),Wo=a("a"),Dr=a("span"),k(Hs.$$.fragment),Sm=c(),Hr=a("span"),Nm=n("TFOpenAIGPTForSequenceClassification"),Li=c(),ge=a("div"),k(Ls.$$.fragment),Bm=c(),Lr=a("p"),Wm=n("The OpenAI GPT Model transformer with a sequence classification head on top (linear layer)."),Um=c(),Aa=a("p"),Oa=a("a"),Km=n("TFOpenAIGPTForSequenceClassification"),Rm=n(` uses the last token in order to do the classification, as other causal
models (e.g. GPT-2) do.`),Vm=c(),ht=a("p"),Xm=n(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Sr=a("code"),Jm=n("pad_token_id"),Qm=n(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Nr=a("code"),Ym=n("pad_token_id"),Zm=n(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Br=a("code"),eu=n("inputs_embeds"),tu=n(" are passed instead of "),Wr=a("code"),ou=n("input_ids"),nu=n(`, it does the same (take the last value in
each row of the batch).`),su=c(),Ss=a("p"),au=n("This model inherits from "),Ia=a("a"),ru=n("TFPreTrainedModel"),iu=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),lu=c(),Ns=a("p"),du=n("This model is also a "),Bs=a("a"),cu=n("tf.keras.Model"),pu=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.`),hu=c(),k(Uo.$$.fragment),mu=c(),dt=a("div"),k(Ws.$$.fragment),uu=c(),co=a("p"),fu=n("The "),Ma=a("a"),gu=n("TFOpenAIGPTForSequenceClassification"),_u=n(" forward method, overrides the "),Ur=a("code"),Tu=n("__call__"),bu=n(" special method."),yu=c(),k(Ko.$$.fragment),vu=c(),k(Ro.$$.fragment),ku=c(),k(Vo.$$.fragment),this.h()},l(o){const f=o_('[data-svelte="svelte-1phssyn"]',document.head);d=r(f,"META",{name:!0,content:!0}),f.forEach(t),y=p(o),g=r(o,"H1",{class:!0});var Us=i(g);_=r(Us,"A",{id:!0,class:!0,href:!0});var Kr=i(_);b=r(Kr,"SPAN",{});var Rr=i(b);w(l.$$.fragment,Rr),Rr.forEach(t),Kr.forEach(t),m=p(Us),E=r(Us,"SPAN",{});var Vr=i(E);Pe=s(Vr,"OpenAI GPT"),Vr.forEach(t),Us.forEach(t),_e=p(o),j=r(o,"H2",{class:!0});var Ks=i(j);oe=r(Ks,"A",{id:!0,class:!0,href:!0});var Xr=i(oe);te=r(Xr,"SPAN",{});var Jr=i(te);w(v.$$.fragment,Jr),Jr.forEach(t),Xr.forEach(t),Ae=p(Ks),K=r(Ks,"SPAN",{});var Qr=i(K);Oe=s(Qr,"Overview"),Qr.forEach(t),Ks.forEach(t),Te=p(o),D=r(o,"P",{});var Rs=i(D);Ie=s(Rs,"OpenAI GPT model was proposed in "),ae=r(Rs,"A",{href:!0,rel:!0});var Yr=i(ae);V=s(Yr,"Improving Language Understanding by Generative Pre-Training"),Yr.forEach(t),Me=s(Rs,`
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.`),Rs.forEach(t),be=p(o),W=r(o,"P",{});var Zr=i(W);Ee=s(Zr,"The abstract from the paper is the following:"),Zr.forEach(t),ye=p(o),U=r(o,"P",{});var ei=i(U);me=r(ei,"EM",{});var ti=i(me);Ge=s(ti,`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.`),ti.forEach(t),ei.forEach(t),ne=p(o),G=r(o,"P",{});var oi=i(G);q=s(oi,"Tips:"),oi.forEach(t),ve=p(o),H=r(o,"UL",{});var Vs=i(H);ue=r(Vs,"LI",{});var ni=i(ue);ze=s(ni,`GPT is a model with absolute position embeddings so it\u2019s usually advised to pad the inputs on the right rather than
the left.`),ni.forEach(t),X=p(Vs),re=r(Vs,"LI",{});var Xs=i(re);Fe=s(Xs,`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 `),F=r(Xs,"EM",{});var si=i(F);qe=s(si,"run_generation.py"),si.forEach(t),J=s(Xs," example script."),Xs.forEach(t),Vs.forEach(t),ke=p(o),ie=r(o,"P",{});var Ea=i(ie);N=r(Ea,"A",{href:!0,rel:!0});var ai=i(N);Ce=s(ai,"Write With Transformer"),ai.forEach(t),xe=s(Ea,` is a webapp created and hosted by Hugging Face
showcasing the generative capabilities of several models. GPT is one of them.`),Ea.forEach(t),L=p(o),Z=r(o,"P",{});var po=i(Z);Q=s(po,"This model was contributed by "),le=r(po,"A",{href:!0,rel:!0});var ri=i(le);de=s(ri,"thomwolf"),ri.forEach(t),C=s(po,". The original code can be found "),ce=r(po,"A",{href:!0,rel:!0});var ii=i(ce);x=s(ii,"here"),ii.forEach(t),je=s(po,"."),po.forEach(t),we=p(o),T=r(o,"P",{});var Au=i(T);I=s(Au,"Note:"),Au.forEach(t),Ke=p(o),S=r(o,"P",{});var Xo=i(S);Xe=s(Xo,"If you want to reproduce the original tokenization process of the "),He=r(Xo,"EM",{});var Ou=i(He);M=s(Ou,"OpenAI GPT"),Ou.forEach(t),Je=s(Xo," paper, you will need to install "),Le=r(Xo,"CODE",{});var Iu=i(Le);Qe=s(Iu,"ftfy"),Iu.forEach(t),Ye=s(Xo,`
and `),Se=r(Xo,"CODE",{});var Mu=i(Se);B=s(Mu,"SpaCy"),Mu.forEach(t),Y=s(Xo,":"),Xo.forEach(t),Re=p(o),w(De.$$.fragment,o),R=p(o),ee=r(o,"P",{});var Gt=i(ee);Ze=s(Gt,"If you don\u2019t install "),fe=r(Gt,"CODE",{});var Eu=i(fe);et=s(Eu,"ftfy"),Eu.forEach(t),pe=s(Gt," and "),Ne=r(Gt,"CODE",{});var Gu=i(Ne);Fl=s(Gu,"SpaCy"),Gu.forEach(t),ql=s(Gt,", the "),Qs=r(Gt,"A",{href:!0});var zu=i(Qs);Cl=s(zu,"OpenAIGPTTokenizer"),zu.forEach(t),xl=s(Gt,` will default to tokenize
using BERT\u2019s `),La=r(Gt,"CODE",{});var Fu=i(La);jl=s(Fu,"BasicTokenizer"),Fu.forEach(t),Dl=s(Gt," followed by Byte-Pair Encoding (which should be fine for most usage, don\u2019t worry)."),Gt.forEach(t),li=p(o),Lt=r(o,"H2",{class:!0});var Ni=i(Lt);mo=r(Ni,"A",{id:!0,class:!0,href:!0});var qu=i(mo);Sa=r(qu,"SPAN",{});var Cu=i(Sa);w(rn.$$.fragment,Cu),Cu.forEach(t),qu.forEach(t),Hl=p(Ni),Na=r(Ni,"SPAN",{});var xu=i(Na);Ll=s(xu,"Resources"),xu.forEach(t),Ni.forEach(t),di=p(o),Ys=r(o,"P",{});var ju=i(Ys);Sl=s(ju,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with OpenAI GPT. 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."),ju.forEach(t),ci=p(o),w(ln.$$.fragment,o),pi=p(o),Zs=r(o,"UL",{});var Du=i(Zs);dn=r(Du,"LI",{});var Bi=i(dn);Nl=s(Bi,"A blog post on "),cn=r(Bi,"A",{href:!0,rel:!0});var Hu=i(cn);Bl=s(Hu,"outperforming OpenAI GPT-3 with SetFit for text-classification"),Hu.forEach(t),Wl=s(Bi,"."),Bi.forEach(t),Du.forEach(t),hi=p(o),w(pn.$$.fragment,o),mi=p(o),se=r(o,"UL",{});var $e=i(se);hn=r($e,"LI",{});var Wi=i(hn);Ul=s(Wi,"A blog on how to "),mn=r(Wi,"A",{href:!0,rel:!0});var Lu=i(mn);Kl=s(Lu,"Finetune a non-English GPT-2 Model with Hugging Face"),Lu.forEach(t),Rl=s(Wi,"."),Wi.forEach(t),Vl=p($e),un=r($e,"LI",{});var Ui=i(un);Xl=s(Ui,"A blog on "),fn=r(Ui,"A",{href:!0,rel:!0});var Su=i(fn);Jl=s(Su,"How to generate text: using different decoding methods for language generation with Transformers"),Su.forEach(t),Ql=s(Ui," with GPT-2."),Ui.forEach(t),Yl=p($e),gn=r($e,"LI",{});var Ki=i(gn);Zl=s(Ki,"A blog on "),_n=r(Ki,"A",{href:!0,rel:!0});var Nu=i(_n);ed=s(Nu,"Training CodeParrot \u{1F99C} from Scratch"),Nu.forEach(t),td=s(Ki,", a large GPT-2 model."),Ki.forEach(t),od=p($e),Tn=r($e,"LI",{});var Ri=i(Tn);nd=s(Ri,"A blog on "),bn=r(Ri,"A",{href:!0,rel:!0});var Bu=i(bn);sd=s(Bu,"Faster Text Generation with TensorFlow and XLA"),Bu.forEach(t),ad=s(Ri," with GPT-2."),Ri.forEach(t),rd=p($e),yn=r($e,"LI",{});var Vi=i(yn);id=s(Vi,"A blog on "),vn=r(Vi,"A",{href:!0,rel:!0});var Wu=i(vn);ld=s(Wu,"How to train a Language Model with Megatron-LM"),Wu.forEach(t),dd=s(Vi," with a GPT-2 model."),Vi.forEach(t),cd=p($e),kn=r($e,"LI",{});var Xi=i(kn);pd=s(Xi,"A notebook on how to "),wn=r(Xi,"A",{href:!0,rel:!0});var Uu=i(wn);hd=s(Uu,"finetune GPT2 to generate lyrics in the style of your favorite artist"),Uu.forEach(t),md=s(Xi,". \u{1F30E}"),Xi.forEach(t),ud=p($e),$n=r($e,"LI",{});var Ji=i($n);fd=s(Ji,"A notebook on how to "),Pn=r(Ji,"A",{href:!0,rel:!0});var Ku=i(Pn);gd=s(Ku,"finetune GPT2 to generate tweets in the style of your favorite Twitter user"),Ku.forEach(t),_d=s(Ji,". \u{1F30E}"),Ji.forEach(t),Td=p($e),ea=r($e,"LI",{});var wu=i(ea);An=r(wu,"A",{href:!0,rel:!0});var Ru=i(An);bd=s(Ru,"Causal language modeling"),Ru.forEach(t),yd=s(wu," chapter of the \u{1F917} Hugging Face Course."),wu.forEach(t),vd=p($e),mt=r($e,"LI",{});var ho=i(mt);ta=r(ho,"A",{href:!0});var Vu=i(ta);kd=s(Vu,"OpenAIGPTLMHeadModel"),Vu.forEach(t),wd=s(ho," is supported by this "),On=r(ho,"A",{href:!0,rel:!0});var Xu=i(On);$d=s(Xu,"causal language modeling example script"),Xu.forEach(t),Pd=s(ho,", "),In=r(ho,"A",{href:!0,rel:!0});var Ju=i(In);Ad=s(Ju,"text generation example script"),Ju.forEach(t),Od=s(ho," and "),Mn=r(ho,"A",{href:!0,rel:!0});var Qu=i(Mn);Id=s(Qu,"notebook"),Qu.forEach(t),Md=s(ho,"."),ho.forEach(t),Ed=p($e),Et=r($e,"LI",{});var Js=i(Et);oa=r(Js,"A",{href:!0});var Yu=i(oa);Gd=s(Yu,"TFOpenAIGPTLMHeadModel"),Yu.forEach(t),zd=s(Js," is supported by this "),En=r(Js,"A",{href:!0,rel:!0});var Zu=i(En);Fd=s(Zu,"causal language modeling example script"),Zu.forEach(t),qd=s(Js," and "),Gn=r(Js,"A",{href:!0,rel:!0});var ef=i(Gn);Cd=s(ef,"notebook"),ef.forEach(t),xd=s(Js,"."),Js.forEach(t),$e.forEach(t),ui=p(o),w(zn.$$.fragment,o),fi=p(o),na=r(o,"UL",{});var tf=i(na);Fn=r(tf,"LI",{});var Qi=i(Fn);jd=s(Qi,"A course material on "),qn=r(Qi,"A",{href:!0,rel:!0});var of=i(qn);Dd=s(of,"Byte-Pair Encoding tokenization"),of.forEach(t),Hd=s(Qi,"."),Qi.forEach(t),tf.forEach(t),gi=p(o),St=r(o,"H2",{class:!0});var Yi=i(St);uo=r(Yi,"A",{id:!0,class:!0,href:!0});var nf=i(uo);Ba=r(nf,"SPAN",{});var sf=i(Ba);w(Cn.$$.fragment,sf),sf.forEach(t),nf.forEach(t),Ld=p(Yi),Wa=r(Yi,"SPAN",{});var af=i(Wa);Sd=s(af,"OpenAIGPTConfig"),af.forEach(t),Yi.forEach(t),_i=p(o),ct=r(o,"DIV",{class:!0});var Jo=i(ct);w(xn.$$.fragment,Jo),Nd=p(Jo),At=r(Jo,"P",{});var Qo=i(At);Bd=s(Qo,"This is the configuration class to store the configuration of a "),sa=r(Qo,"A",{href:!0});var rf=i(sa);Wd=s(rf,"OpenAIGPTModel"),rf.forEach(t),Ud=s(Qo," or a "),aa=r(Qo,"A",{href:!0});var lf=i(aa);Kd=s(lf,"TFOpenAIGPTModel"),lf.forEach(t),Rd=s(Qo,`. 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
`),jn=r(Qo,"A",{href:!0,rel:!0});var df=i(jn);Vd=s(df,"openai-gpt"),df.forEach(t),Xd=s(Qo," architecture from OpenAI."),Qo.forEach(t),Jd=p(Jo),Nt=r(Jo,"P",{});var Ga=i(Nt);Qd=s(Ga,"Configuration objects inherit from "),ra=r(Ga,"A",{href:!0});var cf=i(ra);Yd=s(cf,"PretrainedConfig"),cf.forEach(t),Zd=s(Ga,` and can be used to control the model outputs. Read the
documentation from `),ia=r(Ga,"A",{href:!0});var pf=i(ia);ec=s(pf,"PretrainedConfig"),pf.forEach(t),tc=s(Ga," for more information."),Ga.forEach(t),oc=p(Jo),w(fo.$$.fragment,Jo),Jo.forEach(t),Ti=p(o),Bt=r(o,"H2",{class:!0});var Zi=i(Bt);go=r(Zi,"A",{id:!0,class:!0,href:!0});var hf=i(go);Ua=r(hf,"SPAN",{});var mf=i(Ua);w(Dn.$$.fragment,mf),mf.forEach(t),hf.forEach(t),nc=p(Zi),Ka=r(Zi,"SPAN",{});var uf=i(Ka);sc=s(uf,"OpenAIGPTTokenizer"),uf.forEach(t),Zi.forEach(t),bi=p(o),tt=r(o,"DIV",{class:!0});var zt=i(tt);w(Hn.$$.fragment,zt),ac=p(zt),Ra=r(zt,"P",{});var ff=i(Ra);rc=s(ff,"Construct a GPT Tokenizer. Based on Byte-Pair-Encoding with the following peculiarities:"),ff.forEach(t),ic=p(zt),Ln=r(zt,"UL",{});var el=i(Ln);Va=r(el,"LI",{});var gf=i(Va);lc=s(gf,"lowercases all inputs,"),gf.forEach(t),dc=p(el),Ot=r(el,"LI",{});var Yo=i(Ot);cc=s(Yo,"uses "),Xa=r(Yo,"CODE",{});var _f=i(Xa);pc=s(_f,"SpaCy"),_f.forEach(t),hc=s(Yo," tokenizer and "),Ja=r(Yo,"CODE",{});var Tf=i(Ja);mc=s(Tf,"ftfy"),Tf.forEach(t),uc=s(Yo,` for pre-BPE tokenization if they are installed, fallback to BERT\u2019s
`),Qa=r(Yo,"CODE",{});var bf=i(Qa);fc=s(bf,"BasicTokenizer"),bf.forEach(t),gc=s(Yo," if not."),Yo.forEach(t),el.forEach(t),_c=p(zt),Sn=r(zt,"P",{});var tl=i(Sn);Tc=s(tl,"This tokenizer inherits from "),la=r(tl,"A",{href:!0});var yf=i(la);bc=s(yf,"PreTrainedTokenizer"),yf.forEach(t),yc=s(tl,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),tl.forEach(t),vc=p(zt),da=r(zt,"DIV",{class:!0});var vf=i(da);w(Nn.$$.fragment,vf),vf.forEach(t),zt.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 kf=i(_o);Ya=r(kf,"SPAN",{});var wf=i(Ya);w(Bn.$$.fragment,wf),wf.forEach(t),kf.forEach(t),kc=p(ol),Za=r(ol,"SPAN",{});var $f=i(Za);wc=s($f,"OpenAIGPTTokenizerFast"),$f.forEach(t),ol.forEach(t),vi=p(o),pt=r(o,"DIV",{class:!0});var Zo=i(pt);w(Wn.$$.fragment,Zo),$c=p(Zo),Un=r(Zo,"P",{});var nl=i(Un);Pc=s(nl,"Construct a \u201Cfast\u201D GPT Tokenizer (backed by HuggingFace\u2019s "),er=r(nl,"EM",{});var Pf=i(er);Ac=s(Pf,"tokenizers"),Pf.forEach(t),Oc=s(nl,` library). Based on Byte-Pair-Encoding with
the following peculiarities:`),nl.forEach(t),Ic=p(Zo),Kn=r(Zo,"UL",{});var sl=i(Kn);tr=r(sl,"LI",{});var Af=i(tr);Mc=s(Af,"lower case all inputs"),Af.forEach(t),Ec=p(sl),or=r(sl,"LI",{});var Of=i(or);Gc=s(Of,"uses BERT\u2019s BasicTokenizer for pre-BPE tokenization"),Of.forEach(t),sl.forEach(t),zc=p(Zo),Rn=r(Zo,"P",{});var al=i(Rn);Fc=s(al,"This tokenizer inherits from "),ca=r(al,"A",{href:!0});var If=i(ca);qc=s(If,"PreTrainedTokenizerFast"),If.forEach(t),Cc=s(al,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),al.forEach(t),Zo.forEach(t),ki=p(o),Ut=r(o,"H2",{class:!0});var rl=i(Ut);To=r(rl,"A",{id:!0,class:!0,href:!0});var Mf=i(To);nr=r(Mf,"SPAN",{});var Ef=i(nr);w(Vn.$$.fragment,Ef),Ef.forEach(t),Mf.forEach(t),xc=p(rl),sr=r(rl,"SPAN",{});var Gf=i(sr);jc=s(Gf,"OpenAI specific outputs"),Gf.forEach(t),rl.forEach(t),wi=p(o),Kt=r(o,"DIV",{class:!0});var il=i(Kt);w(Xn.$$.fragment,il),Dc=p(il),ar=r(il,"P",{});var zf=i(ar);Hc=s(zf,"Base class for outputs of models predicting if two sentences are consecutive or not."),zf.forEach(t),il.forEach(t),$i=p(o),Rt=r(o,"DIV",{class:!0});var ll=i(Rt);w(Jn.$$.fragment,ll),Lc=p(ll),rr=r(ll,"P",{});var Ff=i(rr);Sc=s(Ff,"Base class for outputs of models predicting if two sentences are consecutive or not."),Ff.forEach(t),ll.forEach(t),Pi=p(o),Vt=r(o,"H2",{class:!0});var dl=i(Vt);bo=r(dl,"A",{id:!0,class:!0,href:!0});var qf=i(bo);ir=r(qf,"SPAN",{});var Cf=i(ir);w(Qn.$$.fragment,Cf),Cf.forEach(t),qf.forEach(t),Nc=p(dl),lr=r(dl,"SPAN",{});var xf=i(lr);Bc=s(xf,"OpenAIGPTModel"),xf.forEach(t),dl.forEach(t),Ai=p(o),ot=r(o,"DIV",{class:!0});var Ft=i(ot);w(Yn.$$.fragment,Ft),Wc=p(Ft),dr=r(Ft,"P",{});var jf=i(dr);Uc=s(jf,"The bare OpenAI GPT transformer model outputting raw hidden-states without any specific head on top."),jf.forEach(t),Kc=p(Ft),Zn=r(Ft,"P",{});var cl=i(Zn);Rc=s(cl,"This model inherits from "),pa=r(cl,"A",{href:!0});var Df=i(pa);Vc=s(Df,"PreTrainedModel"),Df.forEach(t),Xc=s(cl,`. 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.)`),cl.forEach(t),Jc=p(Ft),es=r(Ft,"P",{});var pl=i(es);Qc=s(pl,"This model is also a PyTorch "),ts=r(pl,"A",{href:!0,rel:!0});var Hf=i(ts);Yc=s(Hf,"torch.nn.Module"),Hf.forEach(t),Zc=s(pl,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),pl.forEach(t),ep=p(Ft),ut=r(Ft,"DIV",{class:!0});var en=i(ut);w(os.$$.fragment,en),tp=p(en),Xt=r(en,"P",{});var za=i(Xt);op=s(za,"The "),ha=r(za,"A",{href:!0});var Lf=i(ha);np=s(Lf,"OpenAIGPTModel"),Lf.forEach(t),sp=s(za," forward method, overrides the "),cr=r(za,"CODE",{});var Sf=i(cr);ap=s(Sf,"__call__"),Sf.forEach(t),rp=s(za," special method."),za.forEach(t),ip=p(en),w(yo.$$.fragment,en),lp=p(en),w(vo.$$.fragment,en),en.forEach(t),Ft.forEach(t),Oi=p(o),Jt=r(o,"H2",{class:!0});var hl=i(Jt);ko=r(hl,"A",{id:!0,class:!0,href:!0});var Nf=i(ko);pr=r(Nf,"SPAN",{});var Bf=i(pr);w(ns.$$.fragment,Bf),Bf.forEach(t),Nf.forEach(t),dp=p(hl),hr=r(hl,"SPAN",{});var Wf=i(hr);cp=s(Wf,"OpenAIGPTLMHeadModel"),Wf.forEach(t),hl.forEach(t),Ii=p(o),nt=r(o,"DIV",{class:!0});var qt=i(nt);w(ss.$$.fragment,qt),pp=p(qt),mr=r(qt,"P",{});var Uf=i(mr);hp=s(Uf,`OpenAI GPT Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),Uf.forEach(t),mp=p(qt),as=r(qt,"P",{});var ml=i(as);up=s(ml,"This model inherits from "),ma=r(ml,"A",{href:!0});var Kf=i(ma);fp=s(Kf,"PreTrainedModel"),Kf.forEach(t),gp=s(ml,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ml.forEach(t),_p=p(qt),rs=r(qt,"P",{});var ul=i(rs);Tp=s(ul,"This model is also a PyTorch "),is=r(ul,"A",{href:!0,rel:!0});var Rf=i(is);bp=s(Rf,"torch.nn.Module"),Rf.forEach(t),yp=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),vp=p(qt),ft=r(qt,"DIV",{class:!0});var tn=i(ft);w(ls.$$.fragment,tn),kp=p(tn),Qt=r(tn,"P",{});var Fa=i(Qt);wp=s(Fa,"The "),ua=r(Fa,"A",{href:!0});var Vf=i(ua);$p=s(Vf,"OpenAIGPTLMHeadModel"),Vf.forEach(t),Pp=s(Fa," forward method, overrides the "),ur=r(Fa,"CODE",{});var Xf=i(ur);Ap=s(Xf,"__call__"),Xf.forEach(t),Op=s(Fa," special method."),Fa.forEach(t),Ip=p(tn),w(wo.$$.fragment,tn),Mp=p(tn),w($o.$$.fragment,tn),tn.forEach(t),qt.forEach(t),Mi=p(o),Yt=r(o,"H2",{class:!0});var fl=i(Yt);Po=r(fl,"A",{id:!0,class:!0,href:!0});var Jf=i(Po);fr=r(Jf,"SPAN",{});var Qf=i(fr);w(ds.$$.fragment,Qf),Qf.forEach(t),Jf.forEach(t),Ep=p(fl),gr=r(fl,"SPAN",{});var Yf=i(gr);Gp=s(Yf,"OpenAIGPTDoubleHeadsModel"),Yf.forEach(t),fl.forEach(t),Ei=p(o),st=r(o,"DIV",{class:!0});var Ct=i(st);w(cs.$$.fragment,Ct),zp=p(Ct),_r=r(Ct,"P",{});var Zf=i(_r);Fp=s(Zf,`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).`),Zf.forEach(t),qp=p(Ct),ps=r(Ct,"P",{});var gl=i(ps);Cp=s(gl,"This model inherits from "),fa=r(gl,"A",{href:!0});var eg=i(fa);xp=s(eg,"PreTrainedModel"),eg.forEach(t),jp=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),Dp=p(Ct),hs=r(Ct,"P",{});var _l=i(hs);Hp=s(_l,"This model is also a PyTorch "),ms=r(_l,"A",{href:!0,rel:!0});var tg=i(ms);Lp=s(tg,"torch.nn.Module"),tg.forEach(t),Sp=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),Np=p(Ct),gt=r(Ct,"DIV",{class:!0});var on=i(gt);w(us.$$.fragment,on),Bp=p(on),Zt=r(on,"P",{});var qa=i(Zt);Wp=s(qa,"The "),ga=r(qa,"A",{href:!0});var og=i(ga);Up=s(og,"OpenAIGPTDoubleHeadsModel"),og.forEach(t),Kp=s(qa," forward method, overrides the "),Tr=r(qa,"CODE",{});var ng=i(Tr);Rp=s(ng,"__call__"),ng.forEach(t),Vp=s(qa," special method."),qa.forEach(t),Xp=p(on),w(Ao.$$.fragment,on),Jp=p(on),w(Oo.$$.fragment,on),on.forEach(t),Ct.forEach(t),Gi=p(o),eo=r(o,"H2",{class:!0});var Tl=i(eo);Io=r(Tl,"A",{id:!0,class:!0,href:!0});var sg=i(Io);br=r(sg,"SPAN",{});var ag=i(br);w(fs.$$.fragment,ag),ag.forEach(t),sg.forEach(t),Qp=p(Tl),yr=r(Tl,"SPAN",{});var rg=i(yr);Yp=s(rg,"OpenAIGPTForSequenceClassification"),rg.forEach(t),Tl.forEach(t),zi=p(o),at=r(o,"DIV",{class:!0});var xt=i(at);w(gs.$$.fragment,xt),Zp=p(xt),rt=r(xt,"P",{});var yt=i(rt);eh=s(yt,`The Original OpenAI GPT Model transformer with a sequence classification head on top (linear layer).
`),_a=r(yt,"A",{href:!0});var ig=i(_a);th=s(ig,"OpenAIGPTForSequenceClassification"),ig.forEach(t),oh=s(yt,` 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 `),vr=r(yt,"CODE",{});var lg=i(vr);nh=s(lg,"pad_token_id"),lg.forEach(t),sh=s(yt,` is defined in the configuration, it finds the last token that is not a padding
token in each row. If no `),kr=r(yt,"CODE",{});var dg=i(kr);ah=s(dg,"pad_token_id"),dg.forEach(t),rh=s(yt,` is defined, it simply takes the last value in each row of the batch. Since
it cannot guess the padding tokens when `),wr=r(yt,"CODE",{});var cg=i(wr);ih=s(cg,"inputs_embeds"),cg.forEach(t),lh=s(yt," are passed instead of "),$r=r(yt,"CODE",{});var pg=i($r);dh=s(pg,"input_ids"),pg.forEach(t),ch=s(yt,`, it does the same (take
the last value in each row of the batch).`),yt.forEach(t),ph=p(xt),_s=r(xt,"P",{});var bl=i(_s);hh=s(bl,"This model inherits from "),Ta=r(bl,"A",{href:!0});var hg=i(Ta);mh=s(hg,"PreTrainedModel"),hg.forEach(t),uh=s(bl,`. 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.)`),bl.forEach(t),fh=p(xt),Ts=r(xt,"P",{});var yl=i(Ts);gh=s(yl,"This model is also a PyTorch "),bs=r(yl,"A",{href:!0,rel:!0});var mg=i(bs);_h=s(mg,"torch.nn.Module"),mg.forEach(t),Th=s(yl,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),yl.forEach(t),bh=p(xt),lt=r(xt,"DIV",{class:!0});var jt=i(lt);w(ys.$$.fragment,jt),yh=p(jt),to=r(jt,"P",{});var Ca=i(to);vh=s(Ca,"The "),ba=r(Ca,"A",{href:!0});var ug=i(ba);kh=s(ug,"OpenAIGPTForSequenceClassification"),ug.forEach(t),wh=s(Ca," forward method, overrides the "),Pr=r(Ca,"CODE",{});var fg=i(Pr);$h=s(fg,"__call__"),fg.forEach(t),Ph=s(Ca," special method."),Ca.forEach(t),Ah=p(jt),w(Mo.$$.fragment,jt),Oh=p(jt),w(Eo.$$.fragment,jt),Ih=p(jt),w(Go.$$.fragment,jt),jt.forEach(t),xt.forEach(t),Fi=p(o),oo=r(o,"H2",{class:!0});var vl=i(oo);zo=r(vl,"A",{id:!0,class:!0,href:!0});var gg=i(zo);Ar=r(gg,"SPAN",{});var _g=i(Ar);w(vs.$$.fragment,_g),_g.forEach(t),gg.forEach(t),Mh=p(vl),Or=r(vl,"SPAN",{});var Tg=i(Or);Eh=s(Tg,"TFOpenAIGPTModel"),Tg.forEach(t),vl.forEach(t),qi=p(o),Be=r(o,"DIV",{class:!0});var vt=i(Be);w(ks.$$.fragment,vt),Gh=p(vt),Ir=r(vt,"P",{});var bg=i(Ir);zh=s(bg,"The bare OpenAI GPT transformer model outputting raw hidden-states without any specific head on top."),bg.forEach(t),Fh=p(vt),ws=r(vt,"P",{});var kl=i(ws);qh=s(kl,"This model inherits from "),ya=r(kl,"A",{href:!0});var yg=i(ya);Ch=s(yg,"TFPreTrainedModel"),yg.forEach(t),xh=s(kl,`. 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.)`),kl.forEach(t),jh=p(vt),$s=r(vt,"P",{});var wl=i($s);Dh=s(wl,"This model is also a "),Ps=r(wl,"A",{href:!0,rel:!0});var vg=i(Ps);Hh=s(vg,"tf.keras.Model"),vg.forEach(t),Lh=s(wl,` 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.`),wl.forEach(t),Sh=p(vt),w(Fo.$$.fragment,vt),Nh=p(vt),_t=r(vt,"DIV",{class:!0});var nn=i(_t);w(As.$$.fragment,nn),Bh=p(nn),no=r(nn,"P",{});var xa=i(no);Wh=s(xa,"The "),va=r(xa,"A",{href:!0});var kg=i(va);Uh=s(kg,"TFOpenAIGPTModel"),kg.forEach(t),Kh=s(xa," forward method, overrides the "),Mr=r(xa,"CODE",{});var wg=i(Mr);Rh=s(wg,"__call__"),wg.forEach(t),Vh=s(xa," special method."),xa.forEach(t),Xh=p(nn),w(qo.$$.fragment,nn),Jh=p(nn),w(Co.$$.fragment,nn),nn.forEach(t),vt.forEach(t),Ci=p(o),so=r(o,"H2",{class:!0});var $l=i(so);xo=r($l,"A",{id:!0,class:!0,href:!0});var $g=i(xo);Er=r($g,"SPAN",{});var Pg=i(Er);w(Os.$$.fragment,Pg),Pg.forEach(t),$g.forEach(t),Qh=p($l),Gr=r($l,"SPAN",{});var Ag=i(Gr);Yh=s(Ag,"TFOpenAIGPTLMHeadModel"),Ag.forEach(t),$l.forEach(t),xi=p(o),We=r(o,"DIV",{class:!0});var kt=i(We);w(Is.$$.fragment,kt),Zh=p(kt),zr=r(kt,"P",{});var Og=i(zr);em=s(Og,`OpenAI GPT Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),Og.forEach(t),tm=p(kt),Ms=r(kt,"P",{});var Pl=i(Ms);om=s(Pl,"This model inherits from "),ka=r(Pl,"A",{href:!0});var Ig=i(ka);nm=s(Ig,"TFPreTrainedModel"),Ig.forEach(t),sm=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),am=p(kt),Es=r(kt,"P",{});var Al=i(Es);rm=s(Al,"This model is also a "),Gs=r(Al,"A",{href:!0,rel:!0});var Mg=i(Gs);im=s(Mg,"tf.keras.Model"),Mg.forEach(t),lm=s(Al,` 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.`),Al.forEach(t),dm=p(kt),w(jo.$$.fragment,kt),cm=p(kt),Tt=r(kt,"DIV",{class:!0});var sn=i(Tt);w(zs.$$.fragment,sn),pm=p(sn),ao=r(sn,"P",{});var ja=i(ao);hm=s(ja,"The "),wa=r(ja,"A",{href:!0});var Eg=i(wa);mm=s(Eg,"TFOpenAIGPTLMHeadModel"),Eg.forEach(t),um=s(ja," forward method, overrides the "),Fr=r(ja,"CODE",{});var Gg=i(Fr);fm=s(Gg,"__call__"),Gg.forEach(t),gm=s(ja," special method."),ja.forEach(t),_m=p(sn),w(Do.$$.fragment,sn),Tm=p(sn),w(Ho.$$.fragment,sn),sn.forEach(t),kt.forEach(t),ji=p(o),ro=r(o,"H2",{class:!0});var Ol=i(ro);Lo=r(Ol,"A",{id:!0,class:!0,href:!0});var zg=i(Lo);qr=r(zg,"SPAN",{});var Fg=i(qr);w(Fs.$$.fragment,Fg),Fg.forEach(t),zg.forEach(t),bm=p(Ol),Cr=r(Ol,"SPAN",{});var qg=i(Cr);ym=s(qg,"TFOpenAIGPTDoubleHeadsModel"),qg.forEach(t),Ol.forEach(t),Di=p(o),Ue=r(o,"DIV",{class:!0});var wt=i(Ue);w(qs.$$.fragment,wt),vm=p(wt),xr=r(wt,"P",{});var Cg=i(xr);km=s(Cg,`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).`),Cg.forEach(t),wm=p(wt),Cs=r(wt,"P",{});var Il=i(Cs);$m=s(Il,"This model inherits from "),$a=r(Il,"A",{href:!0});var xg=i($a);Pm=s(xg,"TFPreTrainedModel"),xg.forEach(t),Am=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),Om=p(wt),xs=r(wt,"P",{});var Ml=i(xs);Im=s(Ml,"This model is also a "),js=r(Ml,"A",{href:!0,rel:!0});var jg=i(js);Mm=s(jg,"tf.keras.Model"),jg.forEach(t),Em=s(Ml,` 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.`),Ml.forEach(t),Gm=p(wt),w(So.$$.fragment,wt),zm=p(wt),bt=r(wt,"DIV",{class:!0});var an=i(bt);w(Ds.$$.fragment,an),Fm=p(an),io=r(an,"P",{});var Da=i(io);qm=s(Da,"The "),Pa=r(Da,"A",{href:!0});var Dg=i(Pa);Cm=s(Dg,"TFOpenAIGPTDoubleHeadsModel"),Dg.forEach(t),xm=s(Da," forward method, overrides the "),jr=r(Da,"CODE",{});var Hg=i(jr);jm=s(Hg,"__call__"),Hg.forEach(t),Dm=s(Da," special method."),Da.forEach(t),Hm=p(an),w(No.$$.fragment,an),Lm=p(an),w(Bo.$$.fragment,an),an.forEach(t),wt.forEach(t),Hi=p(o),lo=r(o,"H2",{class:!0});var El=i(lo);Wo=r(El,"A",{id:!0,class:!0,href:!0});var Lg=i(Wo);Dr=r(Lg,"SPAN",{});var Sg=i(Dr);w(Hs.$$.fragment,Sg),Sg.forEach(t),Lg.forEach(t),Sm=p(El),Hr=r(El,"SPAN",{});var Ng=i(Hr);Nm=s(Ng,"TFOpenAIGPTForSequenceClassification"),Ng.forEach(t),El.forEach(t),Li=p(o),ge=r(o,"DIV",{class:!0});var Ve=i(ge);w(Ls.$$.fragment,Ve),Bm=p(Ve),Lr=r(Ve,"P",{});var Bg=i(Lr);Wm=s(Bg,"The OpenAI GPT Model transformer with a sequence classification head on top (linear layer)."),Bg.forEach(t),Um=p(Ve),Aa=r(Ve,"P",{});var $u=i(Aa);Oa=r($u,"A",{href:!0});var Wg=i(Oa);Km=s(Wg,"TFOpenAIGPTForSequenceClassification"),Wg.forEach(t),Rm=s($u,` uses the last token in order to do the classification, as other causal
models (e.g. GPT-2) do.`),$u.forEach(t),Vm=p(Ve),ht=r(Ve,"P",{});var Dt=i(ht);Xm=s(Dt,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Sr=r(Dt,"CODE",{});var Ug=i(Sr);Jm=s(Ug,"pad_token_id"),Ug.forEach(t),Qm=s(Dt,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Nr=r(Dt,"CODE",{});var Kg=i(Nr);Ym=s(Kg,"pad_token_id"),Kg.forEach(t),Zm=s(Dt,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Br=r(Dt,"CODE",{});var Rg=i(Br);eu=s(Rg,"inputs_embeds"),Rg.forEach(t),tu=s(Dt," are passed instead of "),Wr=r(Dt,"CODE",{});var Vg=i(Wr);ou=s(Vg,"input_ids"),Vg.forEach(t),nu=s(Dt,`, it does the same (take the last value in
each row of the batch).`),Dt.forEach(t),su=p(Ve),Ss=r(Ve,"P",{});var Gl=i(Ss);au=s(Gl,"This model inherits from "),Ia=r(Gl,"A",{href:!0});var Xg=i(Ia);ru=s(Xg,"TFPreTrainedModel"),Xg.forEach(t),iu=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),lu=p(Ve),Ns=r(Ve,"P",{});var zl=i(Ns);du=s(zl,"This model is also a "),Bs=r(zl,"A",{href:!0,rel:!0});var Jg=i(Bs);cu=s(Jg,"tf.keras.Model"),Jg.forEach(t),pu=s(zl,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),zl.forEach(t),hu=p(Ve),w(Uo.$$.fragment,Ve),mu=p(Ve),dt=r(Ve,"DIV",{class:!0});var Ht=i(dt);w(Ws.$$.fragment,Ht),uu=p(Ht),co=r(Ht,"P",{});var Ha=i(co);fu=s(Ha,"The "),Ma=r(Ha,"A",{href:!0});var Qg=i(Ma);gu=s(Qg,"TFOpenAIGPTForSequenceClassification"),Qg.forEach(t),_u=s(Ha," forward method, overrides the "),Ur=r(Ha,"CODE",{});var Yg=i(Ur);Tu=s(Yg,"__call__"),Yg.forEach(t),bu=s(Ha," special method."),Ha.forEach(t),yu=p(Ht),w(Ko.$$.fragment,Ht),vu=p(Ht),w(Ro.$$.fragment,Ht),ku=p(Ht),w(Vo.$$.fragment,Ht),Ht.forEach(t),Ve.forEach(t),this.h()},h(){h(d,"name","hf:doc:metadata"),h(d,"content",JSON.stringify(I_)),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(g,"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(Qs,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.OpenAIGPTTokenizer"),h(mo,"id","resources"),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","#resources"),h(Lt,"class","relative group"),h(cn,"href","https://www.philschmid.de/getting-started-setfit"),h(cn,"rel","nofollow"),h(mn,"href","https://www.philschmid.de/fine-tune-a-non-english-gpt-2-model-with-huggingface"),h(mn,"rel","nofollow"),h(fn,"href","https://huggingface.co/blog/how-to-generate"),h(fn,"rel","nofollow"),h(_n,"href","https://huggingface.co/blog/codeparrot"),h(_n,"rel","nofollow"),h(bn,"href","https://huggingface.co/blog/tf-xla-generate"),h(bn,"rel","nofollow"),h(vn,"href","https://huggingface.co/blog/megatron-training"),h(vn,"rel","nofollow"),h(wn,"href","https://colab.research.google.com/github/AlekseyKorshuk/huggingartists/blob/master/huggingartists-demo.ipynb"),h(wn,"rel","nofollow"),h(Pn,"href","https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb"),h(Pn,"rel","nofollow"),h(An,"href","https://huggingface.co/course/en/chapter7/6?fw=pt#training-a-causal-language-model-from-scratch"),h(An,"rel","nofollow"),h(ta,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.OpenAIGPTLMHeadModel"),h(On,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#gpt-2gpt-and-causal-language-modeling"),h(On,"rel","nofollow"),h(In,"href","https://github.com/huggingface/transformers/blob/main/examples/pytorch/text-generation/run_generation.py"),h(In,"rel","nofollow"),h(Mn,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb"),h(Mn,"rel","nofollow"),h(oa,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.TFOpenAIGPTLMHeadModel"),h(En,"href","https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_clmpy"),h(En,"rel","nofollow"),h(Gn,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb"),h(Gn,"rel","nofollow"),h(qn,"href","https://huggingface.co/course/en/chapter6/5"),h(qn,"rel","nofollow"),h(uo,"id","transformers.OpenAIGPTConfig"),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","#transformers.OpenAIGPTConfig"),h(St,"class","relative group"),h(sa,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.OpenAIGPTModel"),h(aa,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.TFOpenAIGPTModel"),h(jn,"href","https://huggingface.co/openai-gpt"),h(jn,"rel","nofollow"),h(ra,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),h(ia,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),h(ct,"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.OpenAIGPTTokenizer"),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.OpenAIGPTTokenizer"),h(Bt,"class","relative group"),h(la,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),h(da,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(_o,"id","transformers.OpenAIGPTTokenizerFast"),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.OpenAIGPTTokenizerFast"),h(Wt,"class","relative group"),h(ca,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),h(pt,"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.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput"),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.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput"),h(Ut,"class","relative group"),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(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(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(Vt,"class","relative group"),h(pa,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),h(ts,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(ts,"rel","nofollow"),h(ha,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.OpenAIGPTModel"),h(ut,"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(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(Jt,"class","relative group"),h(ma,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),h(is,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(is,"rel","nofollow"),h(ua,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.OpenAIGPTLMHeadModel"),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(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(Po,"id","transformers.OpenAIGPTDoubleHeadsModel"),h(Po,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Po,"href","#transformers.OpenAIGPTDoubleHeadsModel"),h(Yt,"class","relative group"),h(fa,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),h(ms,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(ms,"rel","nofollow"),h(ga,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.OpenAIGPTDoubleHeadsModel"),h(gt,"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(Io,"id","transformers.OpenAIGPTForSequenceClassification"),h(Io,"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(Io,"href","#transformers.OpenAIGPTForSequenceClassification"),h(eo,"class","relative group"),h(_a,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.OpenAIGPTForSequenceClassification"),h(Ta,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),h(bs,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(bs,"rel","nofollow"),h(ba,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.OpenAIGPTForSequenceClassification"),h(lt,"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(zo,"id","transformers.TFOpenAIGPTModel"),h(zo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(zo,"href","#transformers.TFOpenAIGPTModel"),h(oo,"class","relative group"),h(ya,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),h(Ps,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(Ps,"rel","nofollow"),h(va,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.TFOpenAIGPTModel"),h(_t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Be,"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.TFOpenAIGPTLMHeadModel"),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.TFOpenAIGPTLMHeadModel"),h(so,"class","relative group"),h(ka,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),h(Gs,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(Gs,"rel","nofollow"),h(wa,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.TFOpenAIGPTLMHeadModel"),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(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(Lo,"id","transformers.TFOpenAIGPTDoubleHeadsModel"),h(Lo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Lo,"href","#transformers.TFOpenAIGPTDoubleHeadsModel"),h(ro,"class","relative group"),h($a,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),h(js,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(js,"rel","nofollow"),h(Pa,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.TFOpenAIGPTDoubleHeadsModel"),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(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(Wo,"id","transformers.TFOpenAIGPTForSequenceClassification"),h(Wo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Wo,"href","#transformers.TFOpenAIGPTForSequenceClassification"),h(lo,"class","relative group"),h(Oa,"href","/docs/transformers/main/en/model_doc/openai-gpt#transformers.TFOpenAIGPTForSequenceClassification"),h(Ia,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),h(Bs,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(Bs,"rel","nofollow"),h(Ma,"href","/docs/transformers/main/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,f){e(document.head,d),u(o,y,f),u(o,g,f),e(g,_),e(_,b),$(l,b,null),e(g,m),e(g,E),e(E,Pe),u(o,_e,f),u(o,j,f),e(j,oe),e(oe,te),$(v,te,null),e(j,Ae),e(j,K),e(K,Oe),u(o,Te,f),u(o,D,f),e(D,Ie),e(D,ae),e(ae,V),e(D,Me),u(o,be,f),u(o,W,f),e(W,Ee),u(o,ye,f),u(o,U,f),e(U,me),e(me,Ge),u(o,ne,f),u(o,G,f),e(G,q),u(o,ve,f),u(o,H,f),e(H,ue),e(ue,ze),e(H,X),e(H,re),e(re,Fe),e(re,F),e(F,qe),e(re,J),u(o,ke,f),u(o,ie,f),e(ie,N),e(N,Ce),e(ie,xe),u(o,L,f),u(o,Z,f),e(Z,Q),e(Z,le),e(le,de),e(Z,C),e(Z,ce),e(ce,x),e(Z,je),u(o,we,f),u(o,T,f),e(T,I),u(o,Ke,f),u(o,S,f),e(S,Xe),e(S,He),e(He,M),e(S,Je),e(S,Le),e(Le,Qe),e(S,Ye),e(S,Se),e(Se,B),e(S,Y),u(o,Re,f),$(De,o,f),u(o,R,f),u(o,ee,f),e(ee,Ze),e(ee,fe),e(fe,et),e(ee,pe),e(ee,Ne),e(Ne,Fl),e(ee,ql),e(ee,Qs),e(Qs,Cl),e(ee,xl),e(ee,La),e(La,jl),e(ee,Dl),u(o,li,f),u(o,Lt,f),e(Lt,mo),e(mo,Sa),$(rn,Sa,null),e(Lt,Hl),e(Lt,Na),e(Na,Ll),u(o,di,f),u(o,Ys,f),e(Ys,Sl),u(o,ci,f),$(ln,o,f),u(o,pi,f),u(o,Zs,f),e(Zs,dn),e(dn,Nl),e(dn,cn),e(cn,Bl),e(dn,Wl),u(o,hi,f),$(pn,o,f),u(o,mi,f),u(o,se,f),e(se,hn),e(hn,Ul),e(hn,mn),e(mn,Kl),e(hn,Rl),e(se,Vl),e(se,un),e(un,Xl),e(un,fn),e(fn,Jl),e(un,Ql),e(se,Yl),e(se,gn),e(gn,Zl),e(gn,_n),e(_n,ed),e(gn,td),e(se,od),e(se,Tn),e(Tn,nd),e(Tn,bn),e(bn,sd),e(Tn,ad),e(se,rd),e(se,yn),e(yn,id),e(yn,vn),e(vn,ld),e(yn,dd),e(se,cd),e(se,kn),e(kn,pd),e(kn,wn),e(wn,hd),e(kn,md),e(se,ud),e(se,$n),e($n,fd),e($n,Pn),e(Pn,gd),e($n,_d),e(se,Td),e(se,ea),e(ea,An),e(An,bd),e(ea,yd),e(se,vd),e(se,mt),e(mt,ta),e(ta,kd),e(mt,wd),e(mt,On),e(On,$d),e(mt,Pd),e(mt,In),e(In,Ad),e(mt,Od),e(mt,Mn),e(Mn,Id),e(mt,Md),e(se,Ed),e(se,Et),e(Et,oa),e(oa,Gd),e(Et,zd),e(Et,En),e(En,Fd),e(Et,qd),e(Et,Gn),e(Gn,Cd),e(Et,xd),u(o,ui,f),$(zn,o,f),u(o,fi,f),u(o,na,f),e(na,Fn),e(Fn,jd),e(Fn,qn),e(qn,Dd),e(Fn,Hd),u(o,gi,f),u(o,St,f),e(St,uo),e(uo,Ba),$(Cn,Ba,null),e(St,Ld),e(St,Wa),e(Wa,Sd),u(o,_i,f),u(o,ct,f),$(xn,ct,null),e(ct,Nd),e(ct,At),e(At,Bd),e(At,sa),e(sa,Wd),e(At,Ud),e(At,aa),e(aa,Kd),e(At,Rd),e(At,jn),e(jn,Vd),e(At,Xd),e(ct,Jd),e(ct,Nt),e(Nt,Qd),e(Nt,ra),e(ra,Yd),e(Nt,Zd),e(Nt,ia),e(ia,ec),e(Nt,tc),e(ct,oc),$(fo,ct,null),u(o,Ti,f),u(o,Bt,f),e(Bt,go),e(go,Ua),$(Dn,Ua,null),e(Bt,nc),e(Bt,Ka),e(Ka,sc),u(o,bi,f),u(o,tt,f),$(Hn,tt,null),e(tt,ac),e(tt,Ra),e(Ra,rc),e(tt,ic),e(tt,Ln),e(Ln,Va),e(Va,lc),e(Ln,dc),e(Ln,Ot),e(Ot,cc),e(Ot,Xa),e(Xa,pc),e(Ot,hc),e(Ot,Ja),e(Ja,mc),e(Ot,uc),e(Ot,Qa),e(Qa,fc),e(Ot,gc),e(tt,_c),e(tt,Sn),e(Sn,Tc),e(Sn,la),e(la,bc),e(Sn,yc),e(tt,vc),e(tt,da),$(Nn,da,null),u(o,yi,f),u(o,Wt,f),e(Wt,_o),e(_o,Ya),$(Bn,Ya,null),e(Wt,kc),e(Wt,Za),e(Za,wc),u(o,vi,f),u(o,pt,f),$(Wn,pt,null),e(pt,$c),e(pt,Un),e(Un,Pc),e(Un,er),e(er,Ac),e(Un,Oc),e(pt,Ic),e(pt,Kn),e(Kn,tr),e(tr,Mc),e(Kn,Ec),e(Kn,or),e(or,Gc),e(pt,zc),e(pt,Rn),e(Rn,Fc),e(Rn,ca),e(ca,qc),e(Rn,Cc),u(o,ki,f),u(o,Ut,f),e(Ut,To),e(To,nr),$(Vn,nr,null),e(Ut,xc),e(Ut,sr),e(sr,jc),u(o,wi,f),u(o,Kt,f),$(Xn,Kt,null),e(Kt,Dc),e(Kt,ar),e(ar,Hc),u(o,$i,f),u(o,Rt,f),$(Jn,Rt,null),e(Rt,Lc),e(Rt,rr),e(rr,Sc),u(o,Pi,f),u(o,Vt,f),e(Vt,bo),e(bo,ir),$(Qn,ir,null),e(Vt,Nc),e(Vt,lr),e(lr,Bc),u(o,Ai,f),u(o,ot,f),$(Yn,ot,null),e(ot,Wc),e(ot,dr),e(dr,Uc),e(ot,Kc),e(ot,Zn),e(Zn,Rc),e(Zn,pa),e(pa,Vc),e(Zn,Xc),e(ot,Jc),e(ot,es),e(es,Qc),e(es,ts),e(ts,Yc),e(es,Zc),e(ot,ep),e(ot,ut),$(os,ut,null),e(ut,tp),e(ut,Xt),e(Xt,op),e(Xt,ha),e(ha,np),e(Xt,sp),e(Xt,cr),e(cr,ap),e(Xt,rp),e(ut,ip),$(yo,ut,null),e(ut,lp),$(vo,ut,null),u(o,Oi,f),u(o,Jt,f),e(Jt,ko),e(ko,pr),$(ns,pr,null),e(Jt,dp),e(Jt,hr),e(hr,cp),u(o,Ii,f),u(o,nt,f),$(ss,nt,null),e(nt,pp),e(nt,mr),e(mr,hp),e(nt,mp),e(nt,as),e(as,up),e(as,ma),e(ma,fp),e(as,gp),e(nt,_p),e(nt,rs),e(rs,Tp),e(rs,is),e(is,bp),e(rs,yp),e(nt,vp),e(nt,ft),$(ls,ft,null),e(ft,kp),e(ft,Qt),e(Qt,wp),e(Qt,ua),e(ua,$p),e(Qt,Pp),e(Qt,ur),e(ur,Ap),e(Qt,Op),e(ft,Ip),$(wo,ft,null),e(ft,Mp),$($o,ft,null),u(o,Mi,f),u(o,Yt,f),e(Yt,Po),e(Po,fr),$(ds,fr,null),e(Yt,Ep),e(Yt,gr),e(gr,Gp),u(o,Ei,f),u(o,st,f),$(cs,st,null),e(st,zp),e(st,_r),e(_r,Fp),e(st,qp),e(st,ps),e(ps,Cp),e(ps,fa),e(fa,xp),e(ps,jp),e(st,Dp),e(st,hs),e(hs,Hp),e(hs,ms),e(ms,Lp),e(hs,Sp),e(st,Np),e(st,gt),$(us,gt,null),e(gt,Bp),e(gt,Zt),e(Zt,Wp),e(Zt,ga),e(ga,Up),e(Zt,Kp),e(Zt,Tr),e(Tr,Rp),e(Zt,Vp),e(gt,Xp),$(Ao,gt,null),e(gt,Jp),$(Oo,gt,null),u(o,Gi,f),u(o,eo,f),e(eo,Io),e(Io,br),$(fs,br,null),e(eo,Qp),e(eo,yr),e(yr,Yp),u(o,zi,f),u(o,at,f),$(gs,at,null),e(at,Zp),e(at,rt),e(rt,eh),e(rt,_a),e(_a,th),e(rt,oh),e(rt,vr),e(vr,nh),e(rt,sh),e(rt,kr),e(kr,ah),e(rt,rh),e(rt,wr),e(wr,ih),e(rt,lh),e(rt,$r),e($r,dh),e(rt,ch),e(at,ph),e(at,_s),e(_s,hh),e(_s,Ta),e(Ta,mh),e(_s,uh),e(at,fh),e(at,Ts),e(Ts,gh),e(Ts,bs),e(bs,_h),e(Ts,Th),e(at,bh),e(at,lt),$(ys,lt,null),e(lt,yh),e(lt,to),e(to,vh),e(to,ba),e(ba,kh),e(to,wh),e(to,Pr),e(Pr,$h),e(to,Ph),e(lt,Ah),$(Mo,lt,null),e(lt,Oh),$(Eo,lt,null),e(lt,Ih),$(Go,lt,null),u(o,Fi,f),u(o,oo,f),e(oo,zo),e(zo,Ar),$(vs,Ar,null),e(oo,Mh),e(oo,Or),e(Or,Eh),u(o,qi,f),u(o,Be,f),$(ks,Be,null),e(Be,Gh),e(Be,Ir),e(Ir,zh),e(Be,Fh),e(Be,ws),e(ws,qh),e(ws,ya),e(ya,Ch),e(ws,xh),e(Be,jh),e(Be,$s),e($s,Dh),e($s,Ps),e(Ps,Hh),e($s,Lh),e(Be,Sh),$(Fo,Be,null),e(Be,Nh),e(Be,_t),$(As,_t,null),e(_t,Bh),e(_t,no),e(no,Wh),e(no,va),e(va,Uh),e(no,Kh),e(no,Mr),e(Mr,Rh),e(no,Vh),e(_t,Xh),$(qo,_t,null),e(_t,Jh),$(Co,_t,null),u(o,Ci,f),u(o,so,f),e(so,xo),e(xo,Er),$(Os,Er,null),e(so,Qh),e(so,Gr),e(Gr,Yh),u(o,xi,f),u(o,We,f),$(Is,We,null),e(We,Zh),e(We,zr),e(zr,em),e(We,tm),e(We,Ms),e(Ms,om),e(Ms,ka),e(ka,nm),e(Ms,sm),e(We,am),e(We,Es),e(Es,rm),e(Es,Gs),e(Gs,im),e(Es,lm),e(We,dm),$(jo,We,null),e(We,cm),e(We,Tt),$(zs,Tt,null),e(Tt,pm),e(Tt,ao),e(ao,hm),e(ao,wa),e(wa,mm),e(ao,um),e(ao,Fr),e(Fr,fm),e(ao,gm),e(Tt,_m),$(Do,Tt,null),e(Tt,Tm),$(Ho,Tt,null),u(o,ji,f),u(o,ro,f),e(ro,Lo),e(Lo,qr),$(Fs,qr,null),e(ro,bm),e(ro,Cr),e(Cr,ym),u(o,Di,f),u(o,Ue,f),$(qs,Ue,null),e(Ue,vm),e(Ue,xr),e(xr,km),e(Ue,wm),e(Ue,Cs),e(Cs,$m),e(Cs,$a),e($a,Pm),e(Cs,Am),e(Ue,Om),e(Ue,xs),e(xs,Im),e(xs,js),e(js,Mm),e(xs,Em),e(Ue,Gm),$(So,Ue,null),e(Ue,zm),e(Ue,bt),$(Ds,bt,null),e(bt,Fm),e(bt,io),e(io,qm),e(io,Pa),e(Pa,Cm),e(io,xm),e(io,jr),e(jr,jm),e(io,Dm),e(bt,Hm),$(No,bt,null),e(bt,Lm),$(Bo,bt,null),u(o,Hi,f),u(o,lo,f),e(lo,Wo),e(Wo,Dr),$(Hs,Dr,null),e(lo,Sm),e(lo,Hr),e(Hr,Nm),u(o,Li,f),u(o,ge,f),$(Ls,ge,null),e(ge,Bm),e(ge,Lr),e(Lr,Wm),e(ge,Um),e(ge,Aa),e(Aa,Oa),e(Oa,Km),e(Aa,Rm),e(ge,Vm),e(ge,ht),e(ht,Xm),e(ht,Sr),e(Sr,Jm),e(ht,Qm),e(ht,Nr),e(Nr,Ym),e(ht,Zm),e(ht,Br),e(Br,eu),e(ht,tu),e(ht,Wr),e(Wr,ou),e(ht,nu),e(ge,su),e(ge,Ss),e(Ss,au),e(Ss,Ia),e(Ia,ru),e(Ss,iu),e(ge,lu),e(ge,Ns),e(Ns,du),e(Ns,Bs),e(Bs,cu),e(Ns,pu),e(ge,hu),$(Uo,ge,null),e(ge,mu),e(ge,dt),$(Ws,dt,null),e(dt,uu),e(dt,co),e(co,fu),e(co,Ma),e(Ma,gu),e(co,_u),e(co,Ur),e(Ur,Tu),e(co,bu),e(dt,yu),$(Ko,dt,null),e(dt,vu),$(Ro,dt,null),e(dt,ku),$(Vo,dt,null),Si=!0},p(o,[f]){const Us={};f&2&&(Us.$$scope={dirty:f,ctx:o}),fo.$set(Us);const Kr={};f&2&&(Kr.$$scope={dirty:f,ctx:o}),yo.$set(Kr);const Rr={};f&2&&(Rr.$$scope={dirty:f,ctx:o}),vo.$set(Rr);const Vr={};f&2&&(Vr.$$scope={dirty:f,ctx:o}),wo.$set(Vr);const Ks={};f&2&&(Ks.$$scope={dirty:f,ctx:o}),$o.$set(Ks);const Xr={};f&2&&(Xr.$$scope={dirty:f,ctx:o}),Ao.$set(Xr);const Jr={};f&2&&(Jr.$$scope={dirty:f,ctx:o}),Oo.$set(Jr);const Qr={};f&2&&(Qr.$$scope={dirty:f,ctx:o}),Mo.$set(Qr);const Rs={};f&2&&(Rs.$$scope={dirty:f,ctx:o}),Eo.$set(Rs);const Yr={};f&2&&(Yr.$$scope={dirty:f,ctx:o}),Go.$set(Yr);const Zr={};f&2&&(Zr.$$scope={dirty:f,ctx:o}),Fo.$set(Zr);const ei={};f&2&&(ei.$$scope={dirty:f,ctx:o}),qo.$set(ei);const ti={};f&2&&(ti.$$scope={dirty:f,ctx:o}),Co.$set(ti);const oi={};f&2&&(oi.$$scope={dirty:f,ctx:o}),jo.$set(oi);const Vs={};f&2&&(Vs.$$scope={dirty:f,ctx:o}),Do.$set(Vs);const ni={};f&2&&(ni.$$scope={dirty:f,ctx:o}),Ho.$set(ni);const Xs={};f&2&&(Xs.$$scope={dirty:f,ctx:o}),So.$set(Xs);const si={};f&2&&(si.$$scope={dirty:f,ctx:o}),No.$set(si);const Ea={};f&2&&(Ea.$$scope={dirty:f,ctx:o}),Bo.$set(Ea);const ai={};f&2&&(ai.$$scope={dirty:f,ctx:o}),Uo.$set(ai);const po={};f&2&&(po.$$scope={dirty:f,ctx:o}),Ko.$set(po);const ri={};f&2&&(ri.$$scope={dirty:f,ctx:o}),Ro.$set(ri);const ii={};f&2&&(ii.$$scope={dirty:f,ctx:o}),Vo.$set(ii)},i(o){Si||(P(l.$$.fragment,o),P(v.$$.fragment,o),P(De.$$.fragment,o),P(rn.$$.fragment,o),P(ln.$$.fragment,o),P(pn.$$.fragment,o),P(zn.$$.fragment,o),P(Cn.$$.fragment,o),P(xn.$$.fragment,o),P(fo.$$.fragment,o),P(Dn.$$.fragment,o),P(Hn.$$.fragment,o),P(Nn.$$.fragment,o),P(Bn.$$.fragment,o),P(Wn.$$.fragment,o),P(Vn.$$.fragment,o),P(Xn.$$.fragment,o),P(Jn.$$.fragment,o),P(Qn.$$.fragment,o),P(Yn.$$.fragment,o),P(os.$$.fragment,o),P(yo.$$.fragment,o),P(vo.$$.fragment,o),P(ns.$$.fragment,o),P(ss.$$.fragment,o),P(ls.$$.fragment,o),P(wo.$$.fragment,o),P($o.$$.fragment,o),P(ds.$$.fragment,o),P(cs.$$.fragment,o),P(us.$$.fragment,o),P(Ao.$$.fragment,o),P(Oo.$$.fragment,o),P(fs.$$.fragment,o),P(gs.$$.fragment,o),P(ys.$$.fragment,o),P(Mo.$$.fragment,o),P(Eo.$$.fragment,o),P(Go.$$.fragment,o),P(vs.$$.fragment,o),P(ks.$$.fragment,o),P(Fo.$$.fragment,o),P(As.$$.fragment,o),P(qo.$$.fragment,o),P(Co.$$.fragment,o),P(Os.$$.fragment,o),P(Is.$$.fragment,o),P(jo.$$.fragment,o),P(zs.$$.fragment,o),P(Do.$$.fragment,o),P(Ho.$$.fragment,o),P(Fs.$$.fragment,o),P(qs.$$.fragment,o),P(So.$$.fragment,o),P(Ds.$$.fragment,o),P(No.$$.fragment,o),P(Bo.$$.fragment,o),P(Hs.$$.fragment,o),P(Ls.$$.fragment,o),P(Uo.$$.fragment,o),P(Ws.$$.fragment,o),P(Ko.$$.fragment,o),P(Ro.$$.fragment,o),P(Vo.$$.fragment,o),Si=!0)},o(o){A(l.$$.fragment,o),A(v.$$.fragment,o),A(De.$$.fragment,o),A(rn.$$.fragment,o),A(ln.$$.fragment,o),A(pn.$$.fragment,o),A(zn.$$.fragment,o),A(Cn.$$.fragment,o),A(xn.$$.fragment,o),A(fo.$$.fragment,o),A(Dn.$$.fragment,o),A(Hn.$$.fragment,o),A(Nn.$$.fragment,o),A(Bn.$$.fragment,o),A(Wn.$$.fragment,o),A(Vn.$$.fragment,o),A(Xn.$$.fragment,o),A(Jn.$$.fragment,o),A(Qn.$$.fragment,o),A(Yn.$$.fragment,o),A(os.$$.fragment,o),A(yo.$$.fragment,o),A(vo.$$.fragment,o),A(ns.$$.fragment,o),A(ss.$$.fragment,o),A(ls.$$.fragment,o),A(wo.$$.fragment,o),A($o.$$.fragment,o),A(ds.$$.fragment,o),A(cs.$$.fragment,o),A(us.$$.fragment,o),A(Ao.$$.fragment,o),A(Oo.$$.fragment,o),A(fs.$$.fragment,o),A(gs.$$.fragment,o),A(ys.$$.fragment,o),A(Mo.$$.fragment,o),A(Eo.$$.fragment,o),A(Go.$$.fragment,o),A(vs.$$.fragment,o),A(ks.$$.fragment,o),A(Fo.$$.fragment,o),A(As.$$.fragment,o),A(qo.$$.fragment,o),A(Co.$$.fragment,o),A(Os.$$.fragment,o),A(Is.$$.fragment,o),A(jo.$$.fragment,o),A(zs.$$.fragment,o),A(Do.$$.fragment,o),A(Ho.$$.fragment,o),A(Fs.$$.fragment,o),A(qs.$$.fragment,o),A(So.$$.fragment,o),A(Ds.$$.fragment,o),A(No.$$.fragment,o),A(Bo.$$.fragment,o),A(Hs.$$.fragment,o),A(Ls.$$.fragment,o),A(Uo.$$.fragment,o),A(Ws.$$.fragment,o),A(Ko.$$.fragment,o),A(Ro.$$.fragment,o),A(Vo.$$.fragment,o),Si=!1},d(o){t(d),o&&t(y),o&&t(g),O(l),o&&t(_e),o&&t(j),O(v),o&&t(Te),o&&t(D),o&&t(be),o&&t(W),o&&t(ye),o&&t(U),o&&t(ne),o&&t(G),o&&t(ve),o&&t(H),o&&t(ke),o&&t(ie),o&&t(L),o&&t(Z),o&&t(we),o&&t(T),o&&t(Ke),o&&t(S),o&&t(Re),O(De,o),o&&t(R),o&&t(ee),o&&t(li),o&&t(Lt),O(rn),o&&t(di),o&&t(Ys),o&&t(ci),O(ln,o),o&&t(pi),o&&t(Zs),o&&t(hi),O(pn,o),o&&t(mi),o&&t(se),o&&t(ui),O(zn,o),o&&t(fi),o&&t(na),o&&t(gi),o&&t(St),O(Cn),o&&t(_i),o&&t(ct),O(xn),O(fo),o&&t(Ti),o&&t(Bt),O(Dn),o&&t(bi),o&&t(tt),O(Hn),O(Nn),o&&t(yi),o&&t(Wt),O(Bn),o&&t(vi),o&&t(pt),O(Wn),o&&t(ki),o&&t(Ut),O(Vn),o&&t(wi),o&&t(Kt),O(Xn),o&&t($i),o&&t(Rt),O(Jn),o&&t(Pi),o&&t(Vt),O(Qn),o&&t(Ai),o&&t(ot),O(Yn),O(os),O(yo),O(vo),o&&t(Oi),o&&t(Jt),O(ns),o&&t(Ii),o&&t(nt),O(ss),O(ls),O(wo),O($o),o&&t(Mi),o&&t(Yt),O(ds),o&&t(Ei),o&&t(st),O(cs),O(us),O(Ao),O(Oo),o&&t(Gi),o&&t(eo),O(fs),o&&t(zi),o&&t(at),O(gs),O(ys),O(Mo),O(Eo),O(Go),o&&t(Fi),o&&t(oo),O(vs),o&&t(qi),o&&t(Be),O(ks),O(Fo),O(As),O(qo),O(Co),o&&t(Ci),o&&t(so),O(Os),o&&t(xi),o&&t(We),O(Is),O(jo),O(zs),O(Do),O(Ho),o&&t(ji),o&&t(ro),O(Fs),o&&t(Di),o&&t(Ue),O(qs),O(So),O(Ds),O(No),O(Bo),o&&t(Hi),o&&t(lo),O(Hs),o&&t(Li),o&&t(ge),O(Ls),O(Uo),O(Ws),O(Ko),O(Ro),O(Vo)}}}const I_={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 M_(z){return n_(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class j_ extends Zg{constructor(d){super();e_(this,d,M_,O_,t_,{})}}export{j_ as default,I_ as metadata};
