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