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