import{S as $_,i as P_,s as G_,e as a,k as c,w,t as n,M as A_,c as r,d as t,m as p,a as i,x as v,h as s,b as h,N as I_,G as e,g as u,y as M,q as k,o as I,B as $,v as E_,L as Et}from"../../chunks/vendor-hf-doc-builder.js";import{T as It}from"../../chunks/Tip-hf-doc-builder.js";import{D as ge}from"../../chunks/Docstring-hf-doc-builder.js";import{C as $t}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as it}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as At}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Ru}from"../../chunks/PipelineTag-hf-doc-builder.js";function O_(O){let d,y,g,_,b;return _=new $t({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME9wZW5BSUdQVENvbmZpZyUyQyUyME9wZW5BSUdQVE1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEdQVCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwT3BlbkFJR1BUQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyME9wZW5BSUdQVE1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> OpenAIGPTConfig, OpenAIGPTModel

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OpenAIGPTModel(configuration)

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){d=a("p"),y=n("Example:"),g=c(),w(_.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);y=s(m,"Example:"),m.forEach(t),g=p(l),v(_.$$.fragment,l)},m(l,m){u(l,d,m),e(d,y),u(l,g,m),M(_,l,m),b=!0},p:Et,i(l){b||(k(_.$$.fragment,l),b=!0)},o(l){I(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(g),$(_,l)}}}function U_(O){let d,y,g,_,b;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),_=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=r(l,"P",{});var m=i(d);y=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(m,"CODE",{});var E=i(g);_=s(E,"Module"),E.forEach(t),b=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){u(l,d,m),e(d,y),e(d,g),e(g,_),e(d,b)},d(l){l&&t(d)}}}function J_(O){let d,y,g,_,b;return _=new $t({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBPcGVuQUlHUFREb3VibGVIZWFkc01vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWktZ3B0JTIyKSUwQW1vZGVsJTIwJTNEJTIwT3BlbkFJR1BURG91YmxlSGVhZHNNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpLWdwdCUyMiklMEF0b2tlbml6ZXIuYWRkX3NwZWNpYWxfdG9rZW5zKCUwQSUyMCUyMCUyMCUyMCU3QiUyMmNsc190b2tlbiUyMiUzQSUyMCUyMiU1QkNMUyU1RCUyMiU3RCUwQSklMjAlMjAlMjMlMjBBZGQlMjBhJTIwJTVCQ0xTJTVEJTIwdG8lMjB0aGUlMjB2b2NhYnVsYXJ5JTIwKHdlJTIwc2hvdWxkJTIwdHJhaW4lMjBpdCUyMGFsc28hKSUwQW1vZGVsLnJlc2l6ZV90b2tlbl9lbWJlZGRpbmdzKGxlbih0b2tlbml6ZXIpKSUwQSUwQWNob2ljZXMlMjAlM0QlMjAlNUIlMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIwJTVCQ0xTJTVEJTIyJTJDJTIwJTIySGVsbG8lMkMlMjBteSUyMGNhdCUyMGlzJTIwY3V0ZSUyMCU1QkNMUyU1RCUyMiU1RCUwQWlucHV0X2lkcyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUJ0b2tlbml6ZXIuZW5jb2RlKHMpJTIwZm9yJTIwcyUyMGluJTIwY2hvaWNlcyU1RCkudW5zcXVlZXplKDApJTIwJTIwJTIzJTIwQmF0Y2glMjBzaXplJTIwMSUyQyUyMDIlMjBjaG9pY2VzJTBBbWNfdG9rZW5faWRzJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QmlucHV0X2lkcy5zaXplKC0xKSUyMC0lMjAxJTJDJTIwaW5wdXRfaWRzLnNpemUoLTEpJTIwLSUyMDElNUQpLnVuc3F1ZWV6ZSgwKSUyMCUyMCUyMyUyMEJhdGNoJTIwc2l6ZSUyMDElMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRfaWRzJTJDJTIwbWNfdG9rZW5faWRzJTNEbWNfdG9rZW5faWRzKSUwQWxtX2xvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRzJTBBbWNfbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5tY19sb2dpdHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, OpenAIGPTDoubleHeadsModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = logits.argmax().item()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OpenAIGPTForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>, num_labels=num_labels)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor([<span class="hljs-number">1</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=a("p"),y=n("Example of single-label classification:"),g=c(),w(_.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);y=s(m,"Example of single-label classification:"),m.forEach(t),g=p(l),v(_.$$.fragment,l)},m(l,m){u(l,d,m),e(d,y),u(l,g,m),M(_,l,m),b=!0},p:Et,i(l){b||(k(_.$$.fragment,l),b=!0)},o(l){I(_.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(g),$(_,l)}}}function W_(O){let d,y,g,_,b;return _=new $t({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyME9wZW5BSUdQVEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWktZ3B0JTIyKSUwQW1vZGVsJTIwJTNEJTIwT3BlbkFJR1BURm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpLWdwdCUyMiUyQyUyMHByb2JsZW1fdHlwZSUzRCUyMm11bHRpX2xhYmVsX2NsYXNzaWZpY2F0aW9uJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZHMlMjAlM0QlMjB0b3JjaC5hcmFuZ2UoMCUyQyUyMGxvZ2l0cy5zaGFwZSU1Qi0xJTVEKSU1QnRvcmNoLnNpZ21vaWQobG9naXRzKS5zcXVlZXplKGRpbSUzRDApJTIwJTNFJTIwMC41JTVEJTBBJTBBJTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwT3BlbkFJR1BURm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyb3BlbmFpLWdwdCUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, OpenAIGPTForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OpenAIGPTForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;openai-gpt&quot;</span>, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_ids = torch.arange(<span class="hljs-number">0</span>, logits.shape[-<span class="hljs-number">1</span>])[torch.sigmoid(logits).squeeze(dim=<span class="hljs-number">0</span>) &gt; <span class="hljs-number">0.5</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OpenAIGPTForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;openai-gpt&quot;</span>, num_labels=num_labels, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>
<span class="hljs-meta">... </span>)

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(inputs)

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

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

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits

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