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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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