import{S as op,i as np,s as sp,e as a,k as p,w as v,t as n,M as ap,c as r,d as t,m as h,a as l,x as w,h as s,b as m,N as tp,G as e,g,y as k,q as M,o as C,B as $,v as rp,L as yt}from"../../chunks/vendor-hf-doc-builder.js";import{T as Pt}from"../../chunks/Tip-hf-doc-builder.js";import{D as Ge}from"../../chunks/Docstring-hf-doc-builder.js";import{C as bt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as _t}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Tt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function lp(j){let d,y,c,f,b;return f=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENUUkxDb25maWclMkMlMjBDVFJMTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQ1RSTCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwQ1RSTENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBDVFJMTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CTRLConfig, CTRLModel

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

<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 = CTRLModel(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:"),c=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Examples:"),u.forEach(t),c=h(i),w(f.$$.fragment,i)},m(i,u){g(i,d,u),e(d,y),g(i,c,u),k(f,i,u),b=!0},p:yt,i(i){b||(M(f.$$.fragment,i),b=!0)},o(i){C(f.$$.fragment,i),b=!1},d(i){i&&t(d),i&&t(c),$(f,i)}}}function ip(j){let d,y,c,f,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 "),c=a("code"),f=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=r(u,"CODE",{});var F=l(c);f=s(F,"Module"),F.forEach(t),b=s(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(i,u){g(i,d,u),e(d,y),e(d,c),e(c,f),e(d,b)},d(i){i&&t(d)}}}function dp(j){let d,y,c,f,b;return f=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDVFJMTW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmN0cmwlMjIpJTBBbW9kZWwlMjAlM0QlMjBDVFJMTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmN0cmwlMjIpJTBBJTBBJTIzJTIwQ1RSTCUyMHdhcyUyMHRyYWluZWQlMjB3aXRoJTIwY29udHJvbCUyMGNvZGVzJTIwYXMlMjB0aGUlMjBmaXJzdCUyMHRva2VuJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMk9waW5pb24lMjBNeSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBYXNzZXJ0JTIwaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTVCMCUyQyUyMDAlNUQuaXRlbSgpJTIwaW4lMjB0b2tlbml6ZXIuY29udHJvbF9jb2Rlcy52YWx1ZXMoKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBbGlzdChsYXN0X2hpZGRlbl9zdGF0ZXMuc2hhcGUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CTRLModel
<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;ctrl&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CTRLModel.from_pretrained(<span class="hljs-string">&quot;ctrl&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># CTRL was trained with control codes as the first token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Opinion 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">assert</span> inputs[<span class="hljs-string">&quot;input_ids&quot;</span>][<span class="hljs-number">0</span>, <span class="hljs-number">0</span>].item() <span class="hljs-keyword">in</span> tokenizer.control_codes.values()

<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
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">5</span>, <span class="hljs-number">1280</span>]`}}),{c(){d=a("p"),y=n("Example:"),c=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Example:"),u.forEach(t),c=h(i),w(f.$$.fragment,i)},m(i,u){g(i,d,u),e(d,y),g(i,c,u),k(f,i,u),b=!0},p:yt,i(i){b||(M(f.$$.fragment,i),b=!0)},o(i){C(f.$$.fragment,i),b=!1},d(i){i&&t(d),i&&t(c),$(f,i)}}}function cp(j){let d,y,c,f,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 "),c=a("code"),f=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=r(u,"CODE",{});var F=l(c);f=s(F,"Module"),F.forEach(t),b=s(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(i,u){g(i,d,u),e(d,y),e(d,c),e(c,f),e(d,b)},d(i){i&&t(d)}}}function pp(j){let d,y,c,f,b;return f=new bt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMENUUkxMTUhlYWRNb2RlbCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmN0cmwlMjIpJTBBbW9kZWwlMjAlM0QlMjBDVFJMTE1IZWFkTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmN0cmwlMjIpJTBBJTBBJTIzJTIwQ1RSTCUyMHdhcyUyMHRyYWluZWQlMjB3aXRoJTIwY29udHJvbCUyMGNvZGVzJTIwYXMlMjB0aGUlMjBmaXJzdCUyMHRva2VuJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMldpa2lwZWRpYSUyMFRoZSUyMGxsYW1hJTIwaXMlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQWFzc2VydCUyMGlucHV0cyU1QiUyMmlucHV0X2lkcyUyMiU1RCU1QjAlMkMlMjAwJTVELml0ZW0oKSUyMGluJTIwdG9rZW5pemVyLmNvbnRyb2xfY29kZXMudmFsdWVzKCklMEElMEFzZXF1ZW5jZV9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShpbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQpJTBBc2VxdWVuY2VzJTIwJTNEJTIwdG9rZW5pemVyLmJhdGNoX2RlY29kZShzZXF1ZW5jZV9pZHMpJTBBc2VxdWVuY2VzJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEKSUwQXJvdW5kKG91dHB1dHMubG9zcy5pdGVtKCklMkMlMjAyKSUwQSUwQWxpc3Qob3V0cHV0cy5sb2dpdHMuc2hhcGUp",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, CTRLLMHeadModel

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># CTRL was trained with control codes as the first token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Wikipedia The llama is&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">assert</span> inputs[<span class="hljs-string">&quot;input_ids&quot;</span>][<span class="hljs-number">0</span>, <span class="hljs-number">0</span>].item() <span class="hljs-keyword">in</span> tokenizer.control_codes.values()

<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_ids = model.generate(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>sequences = tokenizer.batch_decode(sequence_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>sequences
[<span class="hljs-string">&#x27;Wikipedia The llama is a member of the family Bovidae. It is native to the Andes of Peru,&#x27;</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><span class="hljs-built_in">round</span>(outputs.loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">9.21</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(outputs.logits.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">5</span>, <span class="hljs-number">246534</span>]`}}),{c(){d=a("p"),y=n("Example:"),c=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Example:"),u.forEach(t),c=h(i),w(f.$$.fragment,i)},m(i,u){g(i,d,u),e(d,y),g(i,c,u),k(f,i,u),b=!0},p:yt,i(i){b||(M(f.$$.fragment,i),b=!0)},o(i){C(f.$$.fragment,i),b=!1},d(i){i&&t(d),i&&t(c),$(f,i)}}}function hp(j){let d,y,c,f,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 "),c=a("code"),f=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=r(u,"CODE",{});var F=l(c);f=s(F,"Module"),F.forEach(t),b=s(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(i,u){g(i,d,u),e(d,y),e(d,c),e(c,f),e(d,b)},d(i){i&&t(d)}}}function up(j){let d,y,c,f,b;return f=new bt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMENUUkxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyY3RybCUyMiklMEFtb2RlbCUyMCUzRCUyMENUUkxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJjdHJsJTIyKSUwQSUwQSUyMyUyMENUUkwlMjB3YXMlMjB0cmFpbmVkJTIwd2l0aCUyMGNvbnRyb2wlMjBjb2RlcyUyMGFzJTIwdGhlJTIwZmlyc3QlMjB0b2tlbiUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJPcGluaW9uJTIwTXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQWFzc2VydCUyMGlucHV0cyU1QiUyMmlucHV0X2lkcyUyMiU1RCU1QjAlMkMlMjAwJTVELml0ZW0oKSUyMGluJTIwdG9rZW5pemVyLmNvbnRyb2xfY29kZXMudmFsdWVzKCklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZCUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoKS5pdGVtKCklMEFtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfY2xhc3NfaWQlNUQ=",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, CTRLForSequenceClassification

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># CTRL was trained with control codes as the first token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Opinion 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">assert</span> inputs[<span class="hljs-string">&quot;input_ids&quot;</span>][<span class="hljs-number">0</span>, <span class="hljs-number">0</span>].item() <span class="hljs-keyword">in</span> tokenizer.control_codes.values()

<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>model.config.id2label[predicted_class_id]
<span class="hljs-string">&#x27;LABEL_0&#x27;</span>`}}),{c(){d=a("p"),y=n("Example of single-label classification:"),c=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Example of single-label classification:"),u.forEach(t),c=h(i),w(f.$$.fragment,i)},m(i,u){g(i,d,u),e(d,y),g(i,c,u),k(f,i,u),b=!0},p:yt,i(i){b||(M(f.$$.fragment,i),b=!0)},o(i){C(f.$$.fragment,i),b=!1},d(i){i&&t(d),i&&t(c),$(f,i)}}}function mp(j){let d,y;return d=new bt({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEF0b3JjaC5tYW51YWxfc2VlZCg0MiklMEElMjMlMjBUbyUyMHRyYWluJTIwYSUyMG1vZGVsJTIwb24lMjAlNjBudW1fbGFiZWxzJTYwJTIwY2xhc3NlcyUyQyUyMHlvdSUyMGNhbiUyMHBhc3MlMjAlNjBudW1fbGFiZWxzJTNEbnVtX2xhYmVscyU2MCUyMHRvJTIwJTYwLmZyb21fcHJldHJhaW5lZCguLi4pJTYwJTBBbnVtX2xhYmVscyUyMCUzRCUyMGxlbihtb2RlbC5jb25maWcuaWQybGFiZWwpJTBBbW9kZWwlMjAlM0QlMjBDVFJMRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyY3RybCUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvcigxKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcyUwQXJvdW5kKGxvc3MuaXRlbSgpJTJDJTIwMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>torch.manual_seed(<span class="hljs-number">42</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 = CTRLForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;ctrl&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
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">0.35</span>`}}),{c(){v(d.$$.fragment)},l(c){w(d.$$.fragment,c)},m(c,f){k(d,c,f),y=!0},p:yt,i(c){y||(M(d.$$.fragment,c),y=!0)},o(c){C(d.$$.fragment,c),y=!1},d(c){$(d,c)}}}function fp(j){let d,y,c,f,b;return f=new bt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMENUUkxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyY3RybCUyMiklMEFtb2RlbCUyMCUzRCUyMENUUkxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJjdHJsJTIyJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIpJTBBJTBBJTIzJTIwQ1RSTCUyMHdhcyUyMHRyYWluZWQlMjB3aXRoJTIwY29udHJvbCUyMGNvZGVzJTIwYXMlMjB0aGUlMjBmaXJzdCUyMHRva2VuJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMk9waW5pb24lMjBNeSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBYXNzZXJ0JTIwaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTVCMCUyQyUyMDAlNUQuaXRlbSgpJTIwaW4lMjB0b2tlbml6ZXIuY29udHJvbF9jb2Rlcy52YWx1ZXMoKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkJTIwJTNEJTIwbG9naXRzLmFyZ21heCgpLml0ZW0oKSUwQW1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9jbGFzc19pZCU1RA==",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, CTRLForSequenceClassification

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># CTRL was trained with control codes as the first token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Opinion 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">assert</span> inputs[<span class="hljs-string">&quot;input_ids&quot;</span>][<span class="hljs-number">0</span>, <span class="hljs-number">0</span>].item() <span class="hljs-keyword">in</span> tokenizer.control_codes.values()

<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>model.config.id2label[predicted_class_id]
<span class="hljs-string">&#x27;LABEL_0&#x27;</span>`}}),{c(){d=a("p"),y=n("Example of multi-label classification:"),c=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Example of multi-label classification:"),u.forEach(t),c=h(i),w(f.$$.fragment,i)},m(i,u){g(i,d,u),e(d,y),g(i,c,u),k(f,i,u),b=!0},p:yt,i(i){b||(M(f.$$.fragment,i),b=!0)},o(i){C(f.$$.fragment,i),b=!1},d(i){i&&t(d),i&&t(c),$(f,i)}}}function gp(j){let d,y;return d=new bt({props:{code:"JTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwQ1RSTEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmN0cmwlMjIlMkMlMjBudW1fbGFiZWxzJTNEbnVtX2xhYmVscyklMEElMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFsYWJlbHMlMjAlM0QlMjB0b3JjaC5ubi5mdW5jdGlvbmFsLm9uZV9ob3QodG9yY2gudGVuc29yKCU1QnByZWRpY3RlZF9jbGFzc19pZCU1RCklMkMlMjBudW1fY2xhc3NlcyUzRG51bV9sYWJlbHMpLnRvKCUwQSUyMCUyMCUyMCUyMHRvcmNoLmZsb2F0JTBBKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcyUwQWxvc3MuYmFja3dhcmQoKQ==",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>
<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 = CTRLForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;ctrl&quot;</span>, num_labels=num_labels)

<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>labels = torch.nn.functional.one_hot(torch.tensor([predicted_class_id]), num_classes=num_labels).to(
<span class="hljs-meta">... </span>    torch.<span class="hljs-built_in">float</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss
<span class="hljs-meta">&gt;&gt;&gt; </span>loss.backward()`}}),{c(){v(d.$$.fragment)},l(c){w(d.$$.fragment,c)},m(c,f){k(d,c,f),y=!0},p:yt,i(c){y||(M(d.$$.fragment,c),y=!0)},o(c){C(d.$$.fragment,c),y=!1},d(c){$(d,c)}}}function _p(j){let d,y,c,f,b,i,u,F,Ee,we,x,ce,D,R,je,Z,pe,He,H,Y,ne,V,se,Fe,P,Je,ke,W,ze,ae,he,J,z,Ue,Q,Me,ue,K,Ce,me,U,Ie,A,fe,We,X,S,re,B,le,ee,xe,ge,I,qe,q,ie,Ne;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),c=a("code"),f=n("transformers"),b=n(" accept two formats as input:"),i=p(),u=a("ul"),F=a("li"),Ee=n("having all inputs as keyword arguments (like PyTorch models), or"),we=p(),x=a("li"),ce=n("having all inputs as a list, tuple or dict in the first positional argument."),D=p(),R=a("p"),je=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 `),Z=a("code"),pe=n("model.fit()"),He=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),H=a("code"),Y=n("model.fit()"),ne=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),V=a("code"),se=n("fit()"),Fe=n(" and "),P=a("code"),Je=n("predict()"),ke=n(`, such as when creating your own layers or models with
the Keras `),W=a("code"),ze=n("Functional"),ae=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),he=p(),J=a("ul"),z=a("li"),Ue=n("a single Tensor with "),Q=a("code"),Me=n("input_ids"),ue=n(" only and nothing else: "),K=a("code"),Ce=n("model(input_ids)"),me=p(),U=a("li"),Ie=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),A=a("code"),fe=n("model([input_ids, attention_mask])"),We=n(" or "),X=a("code"),S=n("model([input_ids, attention_mask, token_type_ids])"),re=p(),B=a("li"),le=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=a("code"),xe=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ge=p(),I=a("p"),qe=n(`Note that when creating models and layers with
`),q=a("a"),ie=n("subclassing"),Ne=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 L=l(d);y=s(L,"TensorFlow models and layers in "),c=r(L,"CODE",{});var Ke=l(c);f=s(Ke,"transformers"),Ke.forEach(t),b=s(L," accept two formats as input:"),L.forEach(t),i=h(T),u=r(T,"UL",{});var _e=l(u);F=r(_e,"LI",{});var O=l(F);Ee=s(O,"having all inputs as keyword arguments (like PyTorch models), or"),O.forEach(t),we=h(_e),x=r(_e,"LI",{});var et=l(x);ce=s(et,"having all inputs as a list, tuple or dict in the first positional argument."),et.forEach(t),_e.forEach(t),D=h(T),R=r(T,"P",{});var E=l(R);je=s(E,`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 `),Z=r(E,"CODE",{});var tt=l(Z);pe=s(tt,"model.fit()"),tt.forEach(t),He=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),H=r(E,"CODE",{});var ot=l(H);Y=s(ot,"model.fit()"),ot.forEach(t),ne=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),V=r(E,"CODE",{});var Ae=l(V);se=s(Ae,"fit()"),Ae.forEach(t),Fe=s(E," and "),P=r(E,"CODE",{});var nt=l(P);Je=s(nt,"predict()"),nt.forEach(t),ke=s(E,`, such as when creating your own layers or models with
the Keras `),W=r(E,"CODE",{});var st=l(W);ze=s(st,"Functional"),st.forEach(t),ae=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),he=h(T),J=r(T,"UL",{});var N=l(J);z=r(N,"LI",{});var te=l(z);Ue=s(te,"a single Tensor with "),Q=r(te,"CODE",{});var at=l(Q);Me=s(at,"input_ids"),at.forEach(t),ue=s(te," only and nothing else: "),K=r(te,"CODE",{});var Ze=l(K);Ce=s(Ze,"model(input_ids)"),Ze.forEach(t),te.forEach(t),me=h(N),U=r(N,"LI",{});var G=l(U);Ie=s(G,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),A=r(G,"CODE",{});var rt=l(A);fe=s(rt,"model([input_ids, attention_mask])"),rt.forEach(t),We=s(G," or "),X=r(G,"CODE",{});var lt=l(X);S=s(lt,"model([input_ids, attention_mask, token_type_ids])"),lt.forEach(t),G.forEach(t),re=h(N),B=r(N,"LI",{});var $e=l(B);le=s($e,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=r($e,"CODE",{});var de=l(ee);xe=s(de,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),de.forEach(t),$e.forEach(t),N.forEach(t),ge=h(T),I=r(T,"P",{});var Te=l(I);qe=s(Te,`Note that when creating models and layers with
`),q=r(Te,"A",{href:!0,rel:!0});var Re=l(q);ie=s(Re,"subclassing"),Re.forEach(t),Ne=s(Te,` 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!`),Te.forEach(t),this.h()},h(){m(q,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(q,"rel","nofollow")},m(T,L){g(T,d,L),e(d,y),e(d,c),e(c,f),e(d,b),g(T,i,L),g(T,u,L),e(u,F),e(F,Ee),e(u,we),e(u,x),e(x,ce),g(T,D,L),g(T,R,L),e(R,je),e(R,Z),e(Z,pe),e(R,He),e(R,H),e(H,Y),e(R,ne),e(R,V),e(V,se),e(R,Fe),e(R,P),e(P,Je),e(R,ke),e(R,W),e(W,ze),e(R,ae),g(T,he,L),g(T,J,L),e(J,z),e(z,Ue),e(z,Q),e(Q,Me),e(z,ue),e(z,K),e(K,Ce),e(J,me),e(J,U),e(U,Ie),e(U,A),e(A,fe),e(U,We),e(U,X),e(X,S),e(J,re),e(J,B),e(B,le),e(B,ee),e(ee,xe),g(T,ge,L),g(T,I,L),e(I,qe),e(I,q),e(q,ie),e(I,Ne)},d(T){T&&t(d),T&&t(i),T&&t(u),T&&t(D),T&&t(R),T&&t(he),T&&t(J),T&&t(ge),T&&t(I)}}}function Tp(j){let d,y,c,f,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 "),c=a("code"),f=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=r(u,"CODE",{});var F=l(c);f=s(F,"Module"),F.forEach(t),b=s(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(i,u){g(i,d,u),e(d,y),e(d,c),e(c,f),e(d,b)},d(i){i&&t(d)}}}function yp(j){let d,y,c,f,b;return f=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkNUUkxNb2RlbCUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyY3RybCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGQ1RSTE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJjdHJsJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFCTRLModel
<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;ctrl&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFCTRLModel.from_pretrained(<span class="hljs-string">&quot;ctrl&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:"),c=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Example:"),u.forEach(t),c=h(i),w(f.$$.fragment,i)},m(i,u){g(i,d,u),e(d,y),g(i,c,u),k(f,i,u),b=!0},p:yt,i(i){b||(M(f.$$.fragment,i),b=!0)},o(i){C(f.$$.fragment,i),b=!1},d(i){i&&t(d),i&&t(c),$(f,i)}}}function bp(j){let d,y,c,f,b,i,u,F,Ee,we,x,ce,D,R,je,Z,pe,He,H,Y,ne,V,se,Fe,P,Je,ke,W,ze,ae,he,J,z,Ue,Q,Me,ue,K,Ce,me,U,Ie,A,fe,We,X,S,re,B,le,ee,xe,ge,I,qe,q,ie,Ne;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),c=a("code"),f=n("transformers"),b=n(" accept two formats as input:"),i=p(),u=a("ul"),F=a("li"),Ee=n("having all inputs as keyword arguments (like PyTorch models), or"),we=p(),x=a("li"),ce=n("having all inputs as a list, tuple or dict in the first positional argument."),D=p(),R=a("p"),je=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 `),Z=a("code"),pe=n("model.fit()"),He=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),H=a("code"),Y=n("model.fit()"),ne=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),V=a("code"),se=n("fit()"),Fe=n(" and "),P=a("code"),Je=n("predict()"),ke=n(`, such as when creating your own layers or models with
the Keras `),W=a("code"),ze=n("Functional"),ae=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),he=p(),J=a("ul"),z=a("li"),Ue=n("a single Tensor with "),Q=a("code"),Me=n("input_ids"),ue=n(" only and nothing else: "),K=a("code"),Ce=n("model(input_ids)"),me=p(),U=a("li"),Ie=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),A=a("code"),fe=n("model([input_ids, attention_mask])"),We=n(" or "),X=a("code"),S=n("model([input_ids, attention_mask, token_type_ids])"),re=p(),B=a("li"),le=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=a("code"),xe=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ge=p(),I=a("p"),qe=n(`Note that when creating models and layers with
`),q=a("a"),ie=n("subclassing"),Ne=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 L=l(d);y=s(L,"TensorFlow models and layers in "),c=r(L,"CODE",{});var Ke=l(c);f=s(Ke,"transformers"),Ke.forEach(t),b=s(L," accept two formats as input:"),L.forEach(t),i=h(T),u=r(T,"UL",{});var _e=l(u);F=r(_e,"LI",{});var O=l(F);Ee=s(O,"having all inputs as keyword arguments (like PyTorch models), or"),O.forEach(t),we=h(_e),x=r(_e,"LI",{});var et=l(x);ce=s(et,"having all inputs as a list, tuple or dict in the first positional argument."),et.forEach(t),_e.forEach(t),D=h(T),R=r(T,"P",{});var E=l(R);je=s(E,`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 `),Z=r(E,"CODE",{});var tt=l(Z);pe=s(tt,"model.fit()"),tt.forEach(t),He=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),H=r(E,"CODE",{});var ot=l(H);Y=s(ot,"model.fit()"),ot.forEach(t),ne=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),V=r(E,"CODE",{});var Ae=l(V);se=s(Ae,"fit()"),Ae.forEach(t),Fe=s(E," and "),P=r(E,"CODE",{});var nt=l(P);Je=s(nt,"predict()"),nt.forEach(t),ke=s(E,`, such as when creating your own layers or models with
the Keras `),W=r(E,"CODE",{});var st=l(W);ze=s(st,"Functional"),st.forEach(t),ae=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),he=h(T),J=r(T,"UL",{});var N=l(J);z=r(N,"LI",{});var te=l(z);Ue=s(te,"a single Tensor with "),Q=r(te,"CODE",{});var at=l(Q);Me=s(at,"input_ids"),at.forEach(t),ue=s(te," only and nothing else: "),K=r(te,"CODE",{});var Ze=l(K);Ce=s(Ze,"model(input_ids)"),Ze.forEach(t),te.forEach(t),me=h(N),U=r(N,"LI",{});var G=l(U);Ie=s(G,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),A=r(G,"CODE",{});var rt=l(A);fe=s(rt,"model([input_ids, attention_mask])"),rt.forEach(t),We=s(G," or "),X=r(G,"CODE",{});var lt=l(X);S=s(lt,"model([input_ids, attention_mask, token_type_ids])"),lt.forEach(t),G.forEach(t),re=h(N),B=r(N,"LI",{});var $e=l(B);le=s($e,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=r($e,"CODE",{});var de=l(ee);xe=s(de,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),de.forEach(t),$e.forEach(t),N.forEach(t),ge=h(T),I=r(T,"P",{});var Te=l(I);qe=s(Te,`Note that when creating models and layers with
`),q=r(Te,"A",{href:!0,rel:!0});var Re=l(q);ie=s(Re,"subclassing"),Re.forEach(t),Ne=s(Te,` 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!`),Te.forEach(t),this.h()},h(){m(q,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(q,"rel","nofollow")},m(T,L){g(T,d,L),e(d,y),e(d,c),e(c,f),e(d,b),g(T,i,L),g(T,u,L),e(u,F),e(F,Ee),e(u,we),e(u,x),e(x,ce),g(T,D,L),g(T,R,L),e(R,je),e(R,Z),e(Z,pe),e(R,He),e(R,H),e(H,Y),e(R,ne),e(R,V),e(V,se),e(R,Fe),e(R,P),e(P,Je),e(R,ke),e(R,W),e(W,ze),e(R,ae),g(T,he,L),g(T,J,L),e(J,z),e(z,Ue),e(z,Q),e(Q,Me),e(z,ue),e(z,K),e(K,Ce),e(J,me),e(J,U),e(U,Ie),e(U,A),e(A,fe),e(U,We),e(U,X),e(X,S),e(J,re),e(J,B),e(B,le),e(B,ee),e(ee,xe),g(T,ge,L),g(T,I,L),e(I,qe),e(I,q),e(q,ie),e(I,Ne)},d(T){T&&t(d),T&&t(i),T&&t(u),T&&t(D),T&&t(R),T&&t(he),T&&t(J),T&&t(ge),T&&t(I)}}}function vp(j){let d,y,c,f,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 "),c=a("code"),f=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=r(u,"CODE",{});var F=l(c);f=s(F,"Module"),F.forEach(t),b=s(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(i,u){g(i,d,u),e(d,y),e(d,c),e(c,f),e(d,b)},d(i){i&&t(d)}}}function wp(j){let d,y,c,f,b;return f=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkNUUkxMTUhlYWRNb2RlbCUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyY3RybCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGQ1RSTExNSGVhZE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJjdHJsJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRzKSUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFCTRLLMHeadModel
<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;ctrl&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFCTRLLMHeadModel.from_pretrained(<span class="hljs-string">&quot;ctrl&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:"),c=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Example:"),u.forEach(t),c=h(i),w(f.$$.fragment,i)},m(i,u){g(i,d,u),e(d,y),g(i,c,u),k(f,i,u),b=!0},p:yt,i(i){b||(M(f.$$.fragment,i),b=!0)},o(i){C(f.$$.fragment,i),b=!1},d(i){i&&t(d),i&&t(c),$(f,i)}}}function kp(j){let d,y,c,f,b,i,u,F,Ee,we,x,ce,D,R,je,Z,pe,He,H,Y,ne,V,se,Fe,P,Je,ke,W,ze,ae,he,J,z,Ue,Q,Me,ue,K,Ce,me,U,Ie,A,fe,We,X,S,re,B,le,ee,xe,ge,I,qe,q,ie,Ne;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),c=a("code"),f=n("transformers"),b=n(" accept two formats as input:"),i=p(),u=a("ul"),F=a("li"),Ee=n("having all inputs as keyword arguments (like PyTorch models), or"),we=p(),x=a("li"),ce=n("having all inputs as a list, tuple or dict in the first positional argument."),D=p(),R=a("p"),je=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 `),Z=a("code"),pe=n("model.fit()"),He=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),H=a("code"),Y=n("model.fit()"),ne=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),V=a("code"),se=n("fit()"),Fe=n(" and "),P=a("code"),Je=n("predict()"),ke=n(`, such as when creating your own layers or models with
the Keras `),W=a("code"),ze=n("Functional"),ae=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),he=p(),J=a("ul"),z=a("li"),Ue=n("a single Tensor with "),Q=a("code"),Me=n("input_ids"),ue=n(" only and nothing else: "),K=a("code"),Ce=n("model(input_ids)"),me=p(),U=a("li"),Ie=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),A=a("code"),fe=n("model([input_ids, attention_mask])"),We=n(" or "),X=a("code"),S=n("model([input_ids, attention_mask, token_type_ids])"),re=p(),B=a("li"),le=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=a("code"),xe=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ge=p(),I=a("p"),qe=n(`Note that when creating models and layers with
`),q=a("a"),ie=n("subclassing"),Ne=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 L=l(d);y=s(L,"TensorFlow models and layers in "),c=r(L,"CODE",{});var Ke=l(c);f=s(Ke,"transformers"),Ke.forEach(t),b=s(L," accept two formats as input:"),L.forEach(t),i=h(T),u=r(T,"UL",{});var _e=l(u);F=r(_e,"LI",{});var O=l(F);Ee=s(O,"having all inputs as keyword arguments (like PyTorch models), or"),O.forEach(t),we=h(_e),x=r(_e,"LI",{});var et=l(x);ce=s(et,"having all inputs as a list, tuple or dict in the first positional argument."),et.forEach(t),_e.forEach(t),D=h(T),R=r(T,"P",{});var E=l(R);je=s(E,`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 `),Z=r(E,"CODE",{});var tt=l(Z);pe=s(tt,"model.fit()"),tt.forEach(t),He=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),H=r(E,"CODE",{});var ot=l(H);Y=s(ot,"model.fit()"),ot.forEach(t),ne=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),V=r(E,"CODE",{});var Ae=l(V);se=s(Ae,"fit()"),Ae.forEach(t),Fe=s(E," and "),P=r(E,"CODE",{});var nt=l(P);Je=s(nt,"predict()"),nt.forEach(t),ke=s(E,`, such as when creating your own layers or models with
the Keras `),W=r(E,"CODE",{});var st=l(W);ze=s(st,"Functional"),st.forEach(t),ae=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),he=h(T),J=r(T,"UL",{});var N=l(J);z=r(N,"LI",{});var te=l(z);Ue=s(te,"a single Tensor with "),Q=r(te,"CODE",{});var at=l(Q);Me=s(at,"input_ids"),at.forEach(t),ue=s(te," only and nothing else: "),K=r(te,"CODE",{});var Ze=l(K);Ce=s(Ze,"model(input_ids)"),Ze.forEach(t),te.forEach(t),me=h(N),U=r(N,"LI",{});var G=l(U);Ie=s(G,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),A=r(G,"CODE",{});var rt=l(A);fe=s(rt,"model([input_ids, attention_mask])"),rt.forEach(t),We=s(G," or "),X=r(G,"CODE",{});var lt=l(X);S=s(lt,"model([input_ids, attention_mask, token_type_ids])"),lt.forEach(t),G.forEach(t),re=h(N),B=r(N,"LI",{});var $e=l(B);le=s($e,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=r($e,"CODE",{});var de=l(ee);xe=s(de,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),de.forEach(t),$e.forEach(t),N.forEach(t),ge=h(T),I=r(T,"P",{});var Te=l(I);qe=s(Te,`Note that when creating models and layers with
`),q=r(Te,"A",{href:!0,rel:!0});var Re=l(q);ie=s(Re,"subclassing"),Re.forEach(t),Ne=s(Te,` 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!`),Te.forEach(t),this.h()},h(){m(q,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(q,"rel","nofollow")},m(T,L){g(T,d,L),e(d,y),e(d,c),e(c,f),e(d,b),g(T,i,L),g(T,u,L),e(u,F),e(F,Ee),e(u,we),e(u,x),e(x,ce),g(T,D,L),g(T,R,L),e(R,je),e(R,Z),e(Z,pe),e(R,He),e(R,H),e(H,Y),e(R,ne),e(R,V),e(V,se),e(R,Fe),e(R,P),e(P,Je),e(R,ke),e(R,W),e(W,ze),e(R,ae),g(T,he,L),g(T,J,L),e(J,z),e(z,Ue),e(z,Q),e(Q,Me),e(z,ue),e(z,K),e(K,Ce),e(J,me),e(J,U),e(U,Ie),e(U,A),e(A,fe),e(U,We),e(U,X),e(X,S),e(J,re),e(J,B),e(B,le),e(B,ee),e(ee,xe),g(T,ge,L),g(T,I,L),e(I,qe),e(I,q),e(q,ie),e(I,Ne)},d(T){T&&t(d),T&&t(i),T&&t(u),T&&t(D),T&&t(R),T&&t(he),T&&t(J),T&&t(ge),T&&t(I)}}}function Mp(j){let d,y,c,f,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 "),c=a("code"),f=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),c=r(u,"CODE",{});var F=l(c);f=s(F,"Module"),F.forEach(t),b=s(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(i,u){g(i,d,u),e(d,y),e(d,c),e(c,f),e(d,b)},d(i){i&&t(d)}}}function Cp(j){let d,y,c,f,b;return f=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkNUUkxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJjdHJsJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZDVFJMRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyY3RybCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBJTBBbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZCUyMCUzRCUyMGludCh0Zi5tYXRoLmFyZ21heChsb2dpdHMlMkMlMjBheGlzJTNELTEpJTVCMCU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFCTRLForSequenceClassification
<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;ctrl&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFCTRLForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;ctrl&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:"),c=p(),v(f.$$.fragment)},l(i){d=r(i,"P",{});var u=l(d);y=s(u,"Example:"),u.forEach(t),c=h(i),w(f.$$.fragment,i)},m(i,u){g(i,d,u),e(d,y),g(i,c,u),k(f,i,u),b=!0},p:yt,i(i){b||(M(f.$$.fragment,i),b=!0)},o(i){C(f.$$.fragment,i),b=!1},d(i){i&&t(d),i&&t(c),$(f,i)}}}function $p(j){let d,y;return d=new bt({props:{code:"JTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwVEZDVFJMRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyY3RybCUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRmLmNvbnN0YW50KDEpJTBBbG9zcyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKS5sb3Nz",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 = TFCTRLForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;ctrl&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(c){w(d.$$.fragment,c)},m(c,f){k(d,c,f),y=!0},p:yt,i(c){y||(M(d.$$.fragment,c),y=!0)},o(c){C(d.$$.fragment,c),y=!1},d(c){$(d,c)}}}function Rp(j){let d,y,c,f,b,i,u,F,Ee,we,x,ce,D,R,je,Z,pe,He,H,Y,ne,V,se,Fe,P,Je,ke,W,ze,ae,he,J,z,Ue,Q,Me,ue,K,Ce,me,U,Ie,A,fe,We,X,S,re,B,le,ee,xe,ge,I,qe,q,ie,Ne,T,L,Ke,_e,O,et,E,tt,ot,Ae,nt,st,N,te,at,Ze,G,rt,lt,$e,de,Te,Re,Ga,Ha,Eo,Aa,Xa,oa,Rt,Gt,os,jo,Oa,ns,Da,na,Ht,ss,Cn,Ya,Qa,as,$n,Ka,sa,Lt,At,rs,Fo,er,ls,tr,aa,De,Jo,or,ft,nr,Rn,sr,ar,Ln,rr,lr,zo,ir,dr,cr,Et,pr,En,hr,ur,jn,mr,fr,gr,Xt,ra,jt,Ot,is,Uo,_r,ds,Tr,la,Ye,Io,yr,cs,br,vr,Wo,wr,Fn,kr,Mr,Cr,Jn,xo,ia,Ft,Dt,ps,qo,$r,hs,Rr,da,Se,No,Lr,us,Er,jr,Zo,Fr,zn,Jr,zr,Ur,So,Ir,Bo,Wr,xr,qr,it,Vo,Nr,Jt,Zr,Un,Sr,Br,ms,Vr,Pr,Gr,Yt,Hr,Qt,ca,zt,Kt,fs,Po,Ar,gs,Xr,pa,Be,Go,Or,_s,Dr,Yr,Ho,Qr,In,Kr,el,tl,Ao,ol,Xo,nl,sl,al,dt,Oo,rl,Ut,ll,Wn,il,dl,Ts,cl,pl,hl,eo,ul,to,ha,It,oo,ys,Do,ml,bs,fl,ua,Ve,Yo,gl,Pe,_l,xn,Tl,yl,vs,bl,vl,ws,wl,kl,ks,Ml,Cl,Ms,$l,Rl,Ll,Qo,El,qn,jl,Fl,Jl,Ko,zl,en,Ul,Il,Wl,ye,tn,xl,Wt,ql,Nn,Nl,Zl,Cs,Sl,Bl,Vl,no,Pl,so,Gl,ao,Hl,ro,Al,lo,ma,xt,io,$s,on,Xl,Rs,Ol,fa,be,nn,Dl,Ls,Yl,Ql,sn,Kl,Zn,ei,ti,oi,an,ni,rn,si,ai,ri,co,li,ct,ln,ii,qt,di,Sn,ci,pi,Es,hi,ui,mi,po,fi,ho,ga,Nt,uo,js,dn,gi,Fs,_i,_a,ve,cn,Ti,Js,yi,bi,pn,vi,Bn,wi,ki,Mi,hn,Ci,un,$i,Ri,Li,mo,Ei,pt,mn,ji,Zt,Fi,Vn,Ji,zi,zs,Ui,Ii,Wi,fo,xi,go,Ta,St,_o,Us,fn,qi,Is,Ni,ya,oe,gn,Zi,Ws,Si,Bi,Pn,Gn,Vi,Pi,Gi,Qe,Hi,xs,Ai,Xi,qs,Oi,Di,Ns,Yi,Qi,Zs,Ki,ed,td,_n,od,Hn,nd,sd,ad,Tn,rd,yn,ld,id,dd,To,cd,Xe,bn,pd,Bt,hd,An,ud,md,Ss,fd,gd,_d,yo,Td,bo,yd,vo,ba;return i=new _t({}),se=new _t({}),jo=new _t({}),Fo=new _t({}),Jo=new Ge({props:{name:"class transformers.CTRLConfig",anchor:"transformers.CTRLConfig",parameters:[{name:"vocab_size",val:" = 246534"},{name:"n_positions",val:" = 256"},{name:"n_embd",val:" = 1280"},{name:"dff",val:" = 8192"},{name:"n_layer",val:" = 48"},{name:"n_head",val:" = 16"},{name:"resid_pdrop",val:" = 0.1"},{name:"embd_pdrop",val:" = 0.1"},{name:"layer_norm_epsilon",val:" = 1e-06"},{name:"initializer_range",val:" = 0.02"},{name:"use_cache",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CTRLConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 246534) &#x2014;
Vocabulary size of the CTRL 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.31.0/en/model_doc/ctrl#transformers.CTRLModel">CTRLModel</a> or <a href="/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.TFCTRLModel">TFCTRLModel</a>.`,name:"vocab_size"},{anchor:"transformers.CTRLConfig.n_positions",description:`<strong>n_positions</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#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.CTRLConfig.n_embd",description:`<strong>n_embd</strong> (<code>int</code>, <em>optional</em>, defaults to 1280) &#x2014;
Dimensionality of the embeddings and hidden states.`,name:"n_embd"},{anchor:"transformers.CTRLConfig.dff",description:`<strong>dff</strong> (<code>int</code>, <em>optional</em>, defaults to 8192) &#x2014;
Dimensionality of the inner dimension of the feed forward networks (FFN).`,name:"dff"},{anchor:"transformers.CTRLConfig.n_layer",description:`<strong>n_layer</strong> (<code>int</code>, <em>optional</em>, defaults to 48) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"n_layer"},{anchor:"transformers.CTRLConfig.n_head",description:`<strong>n_head</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"n_head"},{anchor:"transformers.CTRLConfig.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.CTRLConfig.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.CTRLConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon to use in the layer normalization layers`,name:"layer_norm_epsilon"},{anchor:"transformers.CTRLConfig.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.CTRLConfig.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.31.0/src/transformers/models/ctrl/configuration_ctrl.py#L26"}}),Xt=new Tt({props:{anchor:"transformers.CTRLConfig.example",$$slots:{default:[lp]},$$scope:{ctx:j}}}),Uo=new _t({}),Io=new Ge({props:{name:"class transformers.CTRLTokenizer",anchor:"transformers.CTRLTokenizer",parameters:[{name:"vocab_file",val:""},{name:"merges_file",val:""},{name:"unk_token",val:" = '<unk>'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CTRLTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.CTRLTokenizer.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.CTRLTokenizer.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.31.0/src/transformers/models/ctrl/tokenization_ctrl.py#L119"}}),xo=new Ge({props:{name:"save_vocabulary",anchor:"transformers.CTRLTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/ctrl/tokenization_ctrl.py#L227"}}),qo=new _t({}),No=new Ge({props:{name:"class transformers.CTRLModel",anchor:"transformers.CTRLModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.CTRLModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.CTRLConfig">CTRLConfig</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.31.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.31.0/src/transformers/models/ctrl/modeling_ctrl.py#L319"}}),Vo=new Ge({props:{name:"forward",anchor:"transformers.CTRLModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = 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:"use_cache",val:": typing.Optional[bool] = 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.CTRLModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else <code>past_key_values[0].shape[-2]</code>
(<code>sequence_length</code> of input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only input IDs that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.31.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.CTRLModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.FloatTensor]]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as input ids as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.CTRLModel.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.CTRLModel.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.CTRLModel.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.CTRLModel.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.CTRLModel.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.CTRLModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.CTRLModel.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.CTRLModel.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.CTRLModel.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.31.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.31.0/src/transformers/models/ctrl/modeling_ctrl.py#L352",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</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.31.0/en/model_doc/ctrl#transformers.CTRLConfig"
>CTRLConfig</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>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
<code>config.is_encoder_decoder=True</code> in the cross-attention blocks) that can be used (see <code>past_key_values</code>
input) to speed up sequential decoding.</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.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Yt=new Pt({props:{$$slots:{default:[ip]},$$scope:{ctx:j}}}),Qt=new Tt({props:{anchor:"transformers.CTRLModel.forward.example",$$slots:{default:[dp]},$$scope:{ctx:j}}}),Po=new _t({}),Go=new Ge({props:{name:"class transformers.CTRLLMHeadModel",anchor:"transformers.CTRLLMHeadModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.CTRLLMHeadModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.CTRLConfig">CTRLConfig</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.31.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.31.0/src/transformers/models/ctrl/modeling_ctrl.py#L511"}}),Oo=new Ge({props:{name:"forward",anchor:"transformers.CTRLLMHeadModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = 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:"use_cache",val:": typing.Optional[bool] = 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.CTRLLMHeadModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else <code>past_key_values[0].shape[-2]</code>
(<code>sequence_length</code> of input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only input IDs that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.31.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.CTRLLMHeadModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.FloatTensor]]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as input ids as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.CTRLLMHeadModel.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.CTRLLMHeadModel.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.CTRLLMHeadModel.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.CTRLLMHeadModel.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.CTRLLMHeadModel.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.CTRLLMHeadModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.CTRLLMHeadModel.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.CTRLLMHeadModel.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.CTRLLMHeadModel.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.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.CTRLLMHeadModel.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.31.0/src/transformers/models/ctrl/modeling_ctrl.py#L535",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</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.31.0/en/model_doc/ctrl#transformers.CTRLConfig"
>CTRLConfig</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>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</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.31.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),eo=new Pt({props:{$$slots:{default:[cp]},$$scope:{ctx:j}}}),to=new Tt({props:{anchor:"transformers.CTRLLMHeadModel.forward.example",$$slots:{default:[pp]},$$scope:{ctx:j}}}),Do=new _t({}),Yo=new Ge({props:{name:"class transformers.CTRLForSequenceClassification",anchor:"transformers.CTRLForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.CTRLForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.CTRLConfig">CTRLConfig</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.31.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.31.0/src/transformers/models/ctrl/modeling_ctrl.py#L653"}}),tn=new Ge({props:{name:"forward",anchor:"transformers.CTRLForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = 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:"use_cache",val:": typing.Optional[bool] = 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.CTRLForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else <code>past_key_values[0].shape[-2]</code>
(<code>sequence_length</code> of input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only input IDs that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.31.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.CTRLForSequenceClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.FloatTensor]]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as input ids as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.CTRLForSequenceClassification.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.CTRLForSequenceClassification.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.CTRLForSequenceClassification.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.CTRLForSequenceClassification.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.CTRLForSequenceClassification.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.CTRLForSequenceClassification.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.CTRLForSequenceClassification.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.CTRLForSequenceClassification.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.CTRLForSequenceClassification.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.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.CTRLForSequenceClassification.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.31.0/src/transformers/models/ctrl/modeling_ctrl.py#L663",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.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.31.0/en/model_doc/ctrl#transformers.CTRLConfig"
>CTRLConfig</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.31.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),no=new Pt({props:{$$slots:{default:[hp]},$$scope:{ctx:j}}}),so=new Tt({props:{anchor:"transformers.CTRLForSequenceClassification.forward.example",$$slots:{default:[up]},$$scope:{ctx:j}}}),ao=new Tt({props:{anchor:"transformers.CTRLForSequenceClassification.forward.example-2",$$slots:{default:[mp]},$$scope:{ctx:j}}}),ro=new Tt({props:{anchor:"transformers.CTRLForSequenceClassification.forward.example-3",$$slots:{default:[fp]},$$scope:{ctx:j}}}),lo=new Tt({props:{anchor:"transformers.CTRLForSequenceClassification.forward.example-4",$$slots:{default:[gp]},$$scope:{ctx:j}}}),on=new _t({}),nn=new Ge({props:{name:"class transformers.TFCTRLModel",anchor:"transformers.TFCTRLModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFCTRLModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.CTRLConfig">CTRLConfig</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.31.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.31.0/src/transformers/models/ctrl/modeling_tf_ctrl.py#L523"}}),co=new Pt({props:{$$slots:{default:[_p]},$$scope:{ctx:j}}}),ln=new Ge({props:{name:"call",anchor:"transformers.TFCTRLModel.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"past_key_values",val:": Optional[Tuple[Tuple[Union[np.ndarray, tf.Tensor]]]] = 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:"use_cache",val:": Optional[bool] = 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.TFCTRLModel.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past</code> is <code>None</code> else <code>past[0].shape[-2]</code> (<code>sequence_length</code> of
input past key value states).</p>
<p>Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past</code> is used, only input IDs that do not have their past calculated should be passed as <code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.31.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.TFCTRLModel.call.past",description:`<strong>past</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past</code> output below). Can be used to speed up sequential decoding. The token ids which have their past
given to this model should not be passed as input ids as they have already been computed.`,name:"past"},{anchor:"transformers.TFCTRLModel.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.TFCTRLModel.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.TFCTRLModel.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.TFCTRLModel.call.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.TFCTRLModel.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.TFCTRLModel.call.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past</code> key value states are returned and can be used to speed up decoding (see <code>past</code>).`,name:"use_cache"},{anchor:"transformers.TFCTRLModel.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.TFCTRLModel.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.TFCTRLModel.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.31.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.TFCTRLModel.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.31.0/src/transformers/models/ctrl/modeling_tf_ctrl.py#L528",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPast"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPast</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.31.0/en/model_doc/ctrl#transformers.CTRLConfig"
>CTRLConfig</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>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>List[tf.Tensor]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 List of <code>tf.Tensor</code> of length <code>config.n_layers</code>, with each tensor of shape <code>(2, batch_size, num_heads, sequence_length, embed_size_per_head)</code>).</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</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.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPast"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPast</a> or <code>tuple(tf.Tensor)</code></p>
`}}),po=new Pt({props:{$$slots:{default:[Tp]},$$scope:{ctx:j}}}),ho=new Tt({props:{anchor:"transformers.TFCTRLModel.call.example",$$slots:{default:[yp]},$$scope:{ctx:j}}}),dn=new _t({}),cn=new Ge({props:{name:"class transformers.TFCTRLLMHeadModel",anchor:"transformers.TFCTRLLMHeadModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFCTRLLMHeadModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.CTRLConfig">CTRLConfig</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.31.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.31.0/src/transformers/models/ctrl/modeling_tf_ctrl.py#L596"}}),mo=new Pt({props:{$$slots:{default:[bp]},$$scope:{ctx:j}}}),mn=new Ge({props:{name:"call",anchor:"transformers.TFCTRLLMHeadModel.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"past_key_values",val:": Optional[Tuple[Tuple[Union[np.ndarray, tf.Tensor]]]] = 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:"use_cache",val:": Optional[bool] = 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.TFCTRLLMHeadModel.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past</code> is <code>None</code> else <code>past[0].shape[-2]</code> (<code>sequence_length</code> of
input past key value states).</p>
<p>Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past</code> is used, only input IDs that do not have their past calculated should be passed as <code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.31.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.TFCTRLLMHeadModel.call.past",description:`<strong>past</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past</code> output below). Can be used to speed up sequential decoding. The token ids which have their past
given to this model should not be passed as input ids as they have already been computed.`,name:"past"},{anchor:"transformers.TFCTRLLMHeadModel.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.TFCTRLLMHeadModel.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.TFCTRLLMHeadModel.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.TFCTRLLMHeadModel.call.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.TFCTRLLMHeadModel.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.TFCTRLLMHeadModel.call.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past</code> key value states are returned and can be used to speed up decoding (see <code>past</code>).`,name:"use_cache"},{anchor:"transformers.TFCTRLLMHeadModel.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.TFCTRLLMHeadModel.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.TFCTRLLMHeadModel.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.31.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.TFCTRLLMHeadModel.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.TFCTRLLMHeadModel.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.31.0/src/transformers/models/ctrl/modeling_tf_ctrl.py#L648",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutputWithPast"
>transformers.modeling_tf_outputs.TFCausalLMOutputWithPast</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.31.0/en/model_doc/ctrl#transformers.CTRLConfig"
>CTRLConfig</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>past_key_values</strong> (<code>List[tf.Tensor]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 List of <code>tf.Tensor</code> of length <code>config.n_layers</code>, with each tensor of shape <code>(2, batch_size, num_heads, sequence_length, embed_size_per_head)</code>).</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</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.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutputWithPast"
>transformers.modeling_tf_outputs.TFCausalLMOutputWithPast</a> or <code>tuple(tf.Tensor)</code></p>
`}}),fo=new Pt({props:{$$slots:{default:[vp]},$$scope:{ctx:j}}}),go=new Tt({props:{anchor:"transformers.TFCTRLLMHeadModel.call.example",$$slots:{default:[wp]},$$scope:{ctx:j}}}),fn=new _t({}),gn=new Ge({props:{name:"class transformers.TFCTRLForSequenceClassification",anchor:"transformers.TFCTRLForSequenceClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFCTRLForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.CTRLConfig">CTRLConfig</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.31.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.31.0/src/transformers/models/ctrl/modeling_tf_ctrl.py#L729"}}),To=new Pt({props:{$$slots:{default:[kp]},$$scope:{ctx:j}}}),bn=new Ge({props:{name:"call",anchor:"transformers.TFCTRLForSequenceClassification.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"past_key_values",val:": Optional[Tuple[Tuple[Union[np.ndarray, tf.Tensor]]]] = 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:"use_cache",val:": Optional[bool] = 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.TFCTRLForSequenceClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past</code> is <code>None</code> else <code>past[0].shape[-2]</code> (<code>sequence_length</code> of
input past key value states).</p>
<p>Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past</code> is used, only input IDs that do not have their past calculated should be passed as <code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.31.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.TFCTRLForSequenceClassification.call.past",description:`<strong>past</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past</code> output below). Can be used to speed up sequential decoding. The token ids which have their past
given to this model should not be passed as input ids as they have already been computed.`,name:"past"},{anchor:"transformers.TFCTRLForSequenceClassification.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.TFCTRLForSequenceClassification.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.TFCTRLForSequenceClassification.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.TFCTRLForSequenceClassification.call.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.TFCTRLForSequenceClassification.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.TFCTRLForSequenceClassification.call.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past</code> key value states are returned and can be used to speed up decoding (see <code>past</code>).`,name:"use_cache"},{anchor:"transformers.TFCTRLForSequenceClassification.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.TFCTRLForSequenceClassification.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.TFCTRLForSequenceClassification.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.31.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.TFCTRLForSequenceClassification.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.TFCTRLForSequenceClassification.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.31.0/src/transformers/models/ctrl/modeling_tf_ctrl.py#L749",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.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.31.0/en/model_doc/ctrl#transformers.CTRLConfig"
>CTRLConfig</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.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),yo=new Pt({props:{$$slots:{default:[Mp]},$$scope:{ctx:j}}}),bo=new Tt({props:{anchor:"transformers.TFCTRLForSequenceClassification.call.example",$$slots:{default:[Cp]},$$scope:{ctx:j}}}),vo=new Tt({props:{anchor:"transformers.TFCTRLForSequenceClassification.call.example-2",$$slots:{default:[$p]},$$scope:{ctx:j}}}),{c(){d=a("meta"),y=p(),c=a("h1"),f=a("a"),b=a("span"),v(i.$$.fragment),u=p(),F=a("span"),Ee=n("CTRL"),we=p(),x=a("div"),ce=a("a"),D=a("img"),je=p(),Z=a("a"),pe=a("img"),H=p(),Y=a("h2"),ne=a("a"),V=a("span"),v(se.$$.fragment),Fe=p(),P=a("span"),Je=n("Overview"),ke=p(),W=a("p"),ze=n("CTRL model was proposed in "),ae=a("a"),he=n("CTRL: A Conditional Transformer Language Model for Controllable Generation"),J=n(" by Nitish Shirish Keskar"),z=a("em"),Ue=n(", Bryan McCann"),Q=n(`, Lav R. Varshney, Caiming Xiong and
Richard Socher. It\u2019s a causal (unidirectional) transformer pre-trained using language modeling on a very large corpus
of ~140 GB of text data with the first token reserved as a control code (such as Links, Books, Wikipedia etc.).`),Me=p(),ue=a("p"),K=n("The abstract from the paper is the following:"),Ce=p(),me=a("p"),U=a("em"),Ie=n(`Large-scale language models show promising text generation capabilities, but users cannot easily control particular
aspects of the generated text. We release CTRL, a 1.63 billion-parameter conditional transformer language model,
trained to condition on control codes that govern style, content, and task-specific behavior. Control codes were
derived from structure that naturally co-occurs with raw text, preserving the advantages of unsupervised learning while
providing more explicit control over text generation. These codes also allow CTRL to predict which parts of the
training data are most likely given a sequence. This provides a potential method for analyzing large amounts of data
via model-based source attribution.`),A=p(),fe=a("p"),We=n("Tips:"),X=p(),S=a("ul"),re=a("li"),B=n(`CTRL makes use of control codes to generate text: it requires generations to be started by certain words, sentences
or links to generate coherent text. Refer to the `),le=a("a"),ee=n("original implementation"),xe=n(` for
more information.`),ge=p(),I=a("li"),qe=n(`CTRL is a model with absolute position embeddings so it\u2019s usually advised to pad the inputs on the right rather than
the left.`),q=p(),ie=a("li"),Ne=n(`CTRL 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 CTRL to generate syntactically coherent text as it can be
observed in the `),T=a("em"),L=n("run_generation.py"),Ke=n(" example script."),_e=p(),O=a("li"),et=n("The PyTorch models can take the "),E=a("code"),tt=n("past_key_values"),ot=n(` as input, which is the previously computed key/value attention pairs.
TensorFlow models accepts `),Ae=a("code"),nt=n("past"),st=n(" as input. Using the "),N=a("code"),te=n("past_key_values"),at=n(` value prevents the model from re-computing
pre-computed values in the context of text generation. See the `),Ze=a("a"),G=a("code"),rt=n("forward"),lt=n(`
method for more information on the usage of this argument.`),$e=p(),de=a("p"),Te=n("This model was contributed by "),Re=a("a"),Ga=n("keskarnitishr"),Ha=n(`. The original code can be found
`),Eo=a("a"),Aa=n("here"),Xa=n("."),oa=p(),Rt=a("h2"),Gt=a("a"),os=a("span"),v(jo.$$.fragment),Oa=p(),ns=a("span"),Da=n("Documentation resources"),na=p(),Ht=a("ul"),ss=a("li"),Cn=a("a"),Ya=n("Text classification task guide"),Qa=p(),as=a("li"),$n=a("a"),Ka=n("Causal language modeling task guide"),sa=p(),Lt=a("h2"),At=a("a"),rs=a("span"),v(Fo.$$.fragment),er=p(),ls=a("span"),tr=n("CTRLConfig"),aa=p(),De=a("div"),v(Jo.$$.fragment),or=p(),ft=a("p"),nr=n("This is the configuration class to store the configuration of a "),Rn=a("a"),sr=n("CTRLModel"),ar=n(" or a "),Ln=a("a"),rr=n("TFCTRLModel"),lr=n(`. It is used to
instantiate a CTRL 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
`),zo=a("a"),ir=n("ctrl"),dr=n(" architecture from SalesForce."),cr=p(),Et=a("p"),pr=n("Configuration objects inherit from "),En=a("a"),hr=n("PretrainedConfig"),ur=n(` and can be used to control the model outputs. Read the
documentation from `),jn=a("a"),mr=n("PretrainedConfig"),fr=n(" for more information."),gr=p(),v(Xt.$$.fragment),ra=p(),jt=a("h2"),Ot=a("a"),is=a("span"),v(Uo.$$.fragment),_r=p(),ds=a("span"),Tr=n("CTRLTokenizer"),la=p(),Ye=a("div"),v(Io.$$.fragment),yr=p(),cs=a("p"),br=n("Construct a CTRL tokenizer. Based on Byte-Pair-Encoding."),vr=p(),Wo=a("p"),wr=n("This tokenizer inherits from "),Fn=a("a"),kr=n("PreTrainedTokenizer"),Mr=n(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Cr=p(),Jn=a("div"),v(xo.$$.fragment),ia=p(),Ft=a("h2"),Dt=a("a"),ps=a("span"),v(qo.$$.fragment),$r=p(),hs=a("span"),Rr=n("CTRLModel"),da=p(),Se=a("div"),v(No.$$.fragment),Lr=p(),us=a("p"),Er=n("The bare CTRL Model transformer outputting raw hidden-states without any specific head on top."),jr=p(),Zo=a("p"),Fr=n("This model inherits from "),zn=a("a"),Jr=n("PreTrainedModel"),zr=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.)`),Ur=p(),So=a("p"),Ir=n("This model is also a PyTorch "),Bo=a("a"),Wr=n("torch.nn.Module"),xr=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),qr=p(),it=a("div"),v(Vo.$$.fragment),Nr=p(),Jt=a("p"),Zr=n("The "),Un=a("a"),Sr=n("CTRLModel"),Br=n(" forward method, overrides the "),ms=a("code"),Vr=n("__call__"),Pr=n(" special method."),Gr=p(),v(Yt.$$.fragment),Hr=p(),v(Qt.$$.fragment),ca=p(),zt=a("h2"),Kt=a("a"),fs=a("span"),v(Po.$$.fragment),Ar=p(),gs=a("span"),Xr=n("CTRLLMHeadModel"),pa=p(),Be=a("div"),v(Go.$$.fragment),Or=p(),_s=a("p"),Dr=n(`The CTRL Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),Yr=p(),Ho=a("p"),Qr=n("This model inherits from "),In=a("a"),Kr=n("PreTrainedModel"),el=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.)`),tl=p(),Ao=a("p"),ol=n("This model is also a PyTorch "),Xo=a("a"),nl=n("torch.nn.Module"),sl=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),al=p(),dt=a("div"),v(Oo.$$.fragment),rl=p(),Ut=a("p"),ll=n("The "),Wn=a("a"),il=n("CTRLLMHeadModel"),dl=n(" forward method, overrides the "),Ts=a("code"),cl=n("__call__"),pl=n(" special method."),hl=p(),v(eo.$$.fragment),ul=p(),v(to.$$.fragment),ha=p(),It=a("h2"),oo=a("a"),ys=a("span"),v(Do.$$.fragment),ml=p(),bs=a("span"),fl=n("CTRLForSequenceClassification"),ua=p(),Ve=a("div"),v(Yo.$$.fragment),gl=p(),Pe=a("p"),_l=n(`The CTRL Model transformer with a sequence classification head on top (linear layer).
`),xn=a("a"),Tl=n("CTRLForSequenceClassification"),yl=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 `),vs=a("code"),bl=n("pad_token_id"),vl=n(` is defined in the configuration, it finds the last token that is not a padding token in
each row. If no `),ws=a("code"),wl=n("pad_token_id"),kl=n(` is defined, it simply takes the last value in each row of the batch. Since it cannot
guess the padding tokens when `),ks=a("code"),Ml=n("inputs_embeds"),Cl=n(" are passed instead of "),Ms=a("code"),$l=n("input_ids"),Rl=n(`, it does the same (take the last
value in each row of the batch).`),Ll=p(),Qo=a("p"),El=n("This model inherits from "),qn=a("a"),jl=n("PreTrainedModel"),Fl=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.)`),Jl=p(),Ko=a("p"),zl=n("This model is also a PyTorch "),en=a("a"),Ul=n("torch.nn.Module"),Il=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Wl=p(),ye=a("div"),v(tn.$$.fragment),xl=p(),Wt=a("p"),ql=n("The "),Nn=a("a"),Nl=n("CTRLForSequenceClassification"),Zl=n(" forward method, overrides the "),Cs=a("code"),Sl=n("__call__"),Bl=n(" special method."),Vl=p(),v(no.$$.fragment),Pl=p(),v(so.$$.fragment),Gl=p(),v(ao.$$.fragment),Hl=p(),v(ro.$$.fragment),Al=p(),v(lo.$$.fragment),ma=p(),xt=a("h2"),io=a("a"),$s=a("span"),v(on.$$.fragment),Xl=p(),Rs=a("span"),Ol=n("TFCTRLModel"),fa=p(),be=a("div"),v(nn.$$.fragment),Dl=p(),Ls=a("p"),Yl=n("The bare CTRL Model transformer outputting raw hidden-states without any specific head on top."),Ql=p(),sn=a("p"),Kl=n("This model inherits from "),Zn=a("a"),ei=n("TFPreTrainedModel"),ti=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.)`),oi=p(),an=a("p"),ni=n("This model is also a "),rn=a("a"),si=n("tf.keras.Model"),ai=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.`),ri=p(),v(co.$$.fragment),li=p(),ct=a("div"),v(ln.$$.fragment),ii=p(),qt=a("p"),di=n("The "),Sn=a("a"),ci=n("TFCTRLModel"),pi=n(" forward method, overrides the "),Es=a("code"),hi=n("__call__"),ui=n(" special method."),mi=p(),v(po.$$.fragment),fi=p(),v(ho.$$.fragment),ga=p(),Nt=a("h2"),uo=a("a"),js=a("span"),v(dn.$$.fragment),gi=p(),Fs=a("span"),_i=n("TFCTRLLMHeadModel"),_a=p(),ve=a("div"),v(cn.$$.fragment),Ti=p(),Js=a("p"),yi=n(`The CTRL Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),bi=p(),pn=a("p"),vi=n("This model inherits from "),Bn=a("a"),wi=n("TFPreTrainedModel"),ki=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.)`),Mi=p(),hn=a("p"),Ci=n("This model is also a "),un=a("a"),$i=n("tf.keras.Model"),Ri=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.`),Li=p(),v(mo.$$.fragment),Ei=p(),pt=a("div"),v(mn.$$.fragment),ji=p(),Zt=a("p"),Fi=n("The "),Vn=a("a"),Ji=n("TFCTRLLMHeadModel"),zi=n(" forward method, overrides the "),zs=a("code"),Ui=n("__call__"),Ii=n(" special method."),Wi=p(),v(fo.$$.fragment),xi=p(),v(go.$$.fragment),Ta=p(),St=a("h2"),_o=a("a"),Us=a("span"),v(fn.$$.fragment),qi=p(),Is=a("span"),Ni=n("TFCTRLForSequenceClassification"),ya=p(),oe=a("div"),v(gn.$$.fragment),Zi=p(),Ws=a("p"),Si=n("The CTRL Model transformer with a sequence classification head on top (linear layer)."),Bi=p(),Pn=a("p"),Gn=a("a"),Vi=n("TFCTRLForSequenceClassification"),Pi=n(` uses the last token in order to do the classification, as other causal models
(e.g. GPT-1, GPT-2) do.`),Gi=p(),Qe=a("p"),Hi=n(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),xs=a("code"),Ai=n("pad_token_id"),Xi=n(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),qs=a("code"),Oi=n("pad_token_id"),Di=n(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ns=a("code"),Yi=n("inputs_embeds"),Qi=n(" are passed instead of "),Zs=a("code"),Ki=n("input_ids"),ed=n(`, it does the same (take the last value in
each row of the batch).`),td=p(),_n=a("p"),od=n("This model inherits from "),Hn=a("a"),nd=n("TFPreTrainedModel"),sd=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.)`),ad=p(),Tn=a("p"),rd=n("This model is also a "),yn=a("a"),ld=n("tf.keras.Model"),id=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.`),dd=p(),v(To.$$.fragment),cd=p(),Xe=a("div"),v(bn.$$.fragment),pd=p(),Bt=a("p"),hd=n("The "),An=a("a"),ud=n("TFCTRLForSequenceClassification"),md=n(" forward method, overrides the "),Ss=a("code"),fd=n("__call__"),gd=n(" special method."),_d=p(),v(yo.$$.fragment),Td=p(),v(bo.$$.fragment),yd=p(),v(vo.$$.fragment),this.h()},l(o){const _=ap('[data-svelte="svelte-1phssyn"]',document.head);d=r(_,"META",{name:!0,content:!0}),_.forEach(t),y=h(o),c=r(o,"H1",{class:!0});var vn=l(c);f=r(vn,"A",{id:!0,class:!0,href:!0});var Bs=l(f);b=r(Bs,"SPAN",{});var Vs=l(b);w(i.$$.fragment,Vs),Vs.forEach(t),Bs.forEach(t),u=h(vn),F=r(vn,"SPAN",{});var Ps=l(F);Ee=s(Ps,"CTRL"),Ps.forEach(t),vn.forEach(t),we=h(o),x=r(o,"DIV",{class:!0});var wn=l(x);ce=r(wn,"A",{href:!0});var Gs=l(ce);D=r(Gs,"IMG",{alt:!0,src:!0}),Gs.forEach(t),je=h(wn),Z=r(wn,"A",{href:!0});var Hs=l(Z);pe=r(Hs,"IMG",{alt:!0,src:!0}),Hs.forEach(t),wn.forEach(t),H=h(o),Y=r(o,"H2",{class:!0});var kn=l(Y);ne=r(kn,"A",{id:!0,class:!0,href:!0});var As=l(ne);V=r(As,"SPAN",{});var Xs=l(V);w(se.$$.fragment,Xs),Xs.forEach(t),As.forEach(t),Fe=h(kn),P=r(kn,"SPAN",{});var Os=l(P);Je=s(Os,"Overview"),Os.forEach(t),kn.forEach(t),ke=h(o),W=r(o,"P",{});var Vt=l(W);ze=s(Vt,"CTRL model was proposed in "),ae=r(Vt,"A",{href:!0,rel:!0});var Ds=l(ae);he=s(Ds,"CTRL: A Conditional Transformer Language Model for Controllable Generation"),Ds.forEach(t),J=s(Vt," by Nitish Shirish Keskar"),z=r(Vt,"EM",{});var Ys=l(z);Ue=s(Ys,", Bryan McCann"),Ys.forEach(t),Q=s(Vt,`, Lav R. Varshney, Caiming Xiong and
Richard Socher. It\u2019s a causal (unidirectional) transformer pre-trained using language modeling on a very large corpus
of ~140 GB of text data with the first token reserved as a control code (such as Links, Books, Wikipedia etc.).`),Vt.forEach(t),Me=h(o),ue=r(o,"P",{});var Qs=l(ue);K=s(Qs,"The abstract from the paper is the following:"),Qs.forEach(t),Ce=h(o),me=r(o,"P",{});var Ks=l(me);U=r(Ks,"EM",{});var ea=l(U);Ie=s(ea,`Large-scale language models show promising text generation capabilities, but users cannot easily control particular
aspects of the generated text. We release CTRL, a 1.63 billion-parameter conditional transformer language model,
trained to condition on control codes that govern style, content, and task-specific behavior. Control codes were
derived from structure that naturally co-occurs with raw text, preserving the advantages of unsupervised learning while
providing more explicit control over text generation. These codes also allow CTRL to predict which parts of the
training data are most likely given a sequence. This provides a potential method for analyzing large amounts of data
via model-based source attribution.`),ea.forEach(t),Ks.forEach(t),A=h(o),fe=r(o,"P",{});var ta=l(fe);We=s(ta,"Tips:"),ta.forEach(t),X=h(o),S=r(o,"UL",{});var gt=l(S);re=r(gt,"LI",{});var Mn=l(re);B=s(Mn,`CTRL makes use of control codes to generate text: it requires generations to be started by certain words, sentences
or links to generate coherent text. Refer to the `),le=r(Mn,"A",{href:!0,rel:!0});var vd=l(le);ee=s(vd,"original implementation"),vd.forEach(t),xe=s(Mn,` for
more information.`),Mn.forEach(t),ge=h(gt),I=r(gt,"LI",{});var wd=l(I);qe=s(wd,`CTRL is a model with absolute position embeddings so it\u2019s usually advised to pad the inputs on the right rather than
the left.`),wd.forEach(t),q=h(gt),ie=r(gt,"LI",{});var va=l(ie);Ne=s(va,`CTRL 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 CTRL to generate syntactically coherent text as it can be
observed in the `),T=r(va,"EM",{});var kd=l(T);L=s(kd,"run_generation.py"),kd.forEach(t),Ke=s(va," example script."),va.forEach(t),_e=h(gt),O=r(gt,"LI",{});var vt=l(O);et=s(vt,"The PyTorch models can take the "),E=r(vt,"CODE",{});var Md=l(E);tt=s(Md,"past_key_values"),Md.forEach(t),ot=s(vt,` as input, which is the previously computed key/value attention pairs.
TensorFlow models accepts `),Ae=r(vt,"CODE",{});var Cd=l(Ae);nt=s(Cd,"past"),Cd.forEach(t),st=s(vt," as input. Using the "),N=r(vt,"CODE",{});var $d=l(N);te=s($d,"past_key_values"),$d.forEach(t),at=s(vt,` value prevents the model from re-computing
pre-computed values in the context of text generation. See the `),Ze=r(vt,"A",{href:!0});var Rd=l(Ze);G=r(Rd,"CODE",{});var Ld=l(G);rt=s(Ld,"forward"),Ld.forEach(t),Rd.forEach(t),lt=s(vt,`
method for more information on the usage of this argument.`),vt.forEach(t),gt.forEach(t),$e=h(o),de=r(o,"P",{});var Xn=l(de);Te=s(Xn,"This model was contributed by "),Re=r(Xn,"A",{href:!0,rel:!0});var Ed=l(Re);Ga=s(Ed,"keskarnitishr"),Ed.forEach(t),Ha=s(Xn,`. The original code can be found
`),Eo=r(Xn,"A",{href:!0,rel:!0});var jd=l(Eo);Aa=s(jd,"here"),jd.forEach(t),Xa=s(Xn,"."),Xn.forEach(t),oa=h(o),Rt=r(o,"H2",{class:!0});var wa=l(Rt);Gt=r(wa,"A",{id:!0,class:!0,href:!0});var Fd=l(Gt);os=r(Fd,"SPAN",{});var Jd=l(os);w(jo.$$.fragment,Jd),Jd.forEach(t),Fd.forEach(t),Oa=h(wa),ns=r(wa,"SPAN",{});var zd=l(ns);Da=s(zd,"Documentation resources"),zd.forEach(t),wa.forEach(t),na=h(o),Ht=r(o,"UL",{});var ka=l(Ht);ss=r(ka,"LI",{});var Ud=l(ss);Cn=r(Ud,"A",{href:!0});var Id=l(Cn);Ya=s(Id,"Text classification task guide"),Id.forEach(t),Ud.forEach(t),Qa=h(ka),as=r(ka,"LI",{});var Wd=l(as);$n=r(Wd,"A",{href:!0});var xd=l($n);Ka=s(xd,"Causal language modeling task guide"),xd.forEach(t),Wd.forEach(t),ka.forEach(t),sa=h(o),Lt=r(o,"H2",{class:!0});var Ma=l(Lt);At=r(Ma,"A",{id:!0,class:!0,href:!0});var qd=l(At);rs=r(qd,"SPAN",{});var Nd=l(rs);w(Fo.$$.fragment,Nd),Nd.forEach(t),qd.forEach(t),er=h(Ma),ls=r(Ma,"SPAN",{});var Zd=l(ls);tr=s(Zd,"CTRLConfig"),Zd.forEach(t),Ma.forEach(t),aa=h(o),De=r(o,"DIV",{class:!0});var wo=l(De);w(Jo.$$.fragment,wo),or=h(wo),ft=r(wo,"P",{});var ko=l(ft);nr=s(ko,"This is the configuration class to store the configuration of a "),Rn=r(ko,"A",{href:!0});var Sd=l(Rn);sr=s(Sd,"CTRLModel"),Sd.forEach(t),ar=s(ko," or a "),Ln=r(ko,"A",{href:!0});var Bd=l(Ln);rr=s(Bd,"TFCTRLModel"),Bd.forEach(t),lr=s(ko,`. It is used to
instantiate a CTRL 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
`),zo=r(ko,"A",{href:!0,rel:!0});var Vd=l(zo);ir=s(Vd,"ctrl"),Vd.forEach(t),dr=s(ko," architecture from SalesForce."),ko.forEach(t),cr=h(wo),Et=r(wo,"P",{});var On=l(Et);pr=s(On,"Configuration objects inherit from "),En=r(On,"A",{href:!0});var Pd=l(En);hr=s(Pd,"PretrainedConfig"),Pd.forEach(t),ur=s(On,` and can be used to control the model outputs. Read the
documentation from `),jn=r(On,"A",{href:!0});var Gd=l(jn);mr=s(Gd,"PretrainedConfig"),Gd.forEach(t),fr=s(On," for more information."),On.forEach(t),gr=h(wo),w(Xt.$$.fragment,wo),wo.forEach(t),ra=h(o),jt=r(o,"H2",{class:!0});var Ca=l(jt);Ot=r(Ca,"A",{id:!0,class:!0,href:!0});var Hd=l(Ot);is=r(Hd,"SPAN",{});var Ad=l(is);w(Uo.$$.fragment,Ad),Ad.forEach(t),Hd.forEach(t),_r=h(Ca),ds=r(Ca,"SPAN",{});var Xd=l(ds);Tr=s(Xd,"CTRLTokenizer"),Xd.forEach(t),Ca.forEach(t),la=h(o),Ye=r(o,"DIV",{class:!0});var Mo=l(Ye);w(Io.$$.fragment,Mo),yr=h(Mo),cs=r(Mo,"P",{});var Od=l(cs);br=s(Od,"Construct a CTRL tokenizer. Based on Byte-Pair-Encoding."),Od.forEach(t),vr=h(Mo),Wo=r(Mo,"P",{});var $a=l(Wo);wr=s($a,"This tokenizer inherits from "),Fn=r($a,"A",{href:!0});var Dd=l(Fn);kr=s(Dd,"PreTrainedTokenizer"),Dd.forEach(t),Mr=s($a,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),$a.forEach(t),Cr=h(Mo),Jn=r(Mo,"DIV",{class:!0});var Yd=l(Jn);w(xo.$$.fragment,Yd),Yd.forEach(t),Mo.forEach(t),ia=h(o),Ft=r(o,"H2",{class:!0});var Ra=l(Ft);Dt=r(Ra,"A",{id:!0,class:!0,href:!0});var Qd=l(Dt);ps=r(Qd,"SPAN",{});var Kd=l(ps);w(qo.$$.fragment,Kd),Kd.forEach(t),Qd.forEach(t),$r=h(Ra),hs=r(Ra,"SPAN",{});var ec=l(hs);Rr=s(ec,"CTRLModel"),ec.forEach(t),Ra.forEach(t),da=h(o),Se=r(o,"DIV",{class:!0});var wt=l(Se);w(No.$$.fragment,wt),Lr=h(wt),us=r(wt,"P",{});var tc=l(us);Er=s(tc,"The bare CTRL Model transformer outputting raw hidden-states without any specific head on top."),tc.forEach(t),jr=h(wt),Zo=r(wt,"P",{});var La=l(Zo);Fr=s(La,"This model inherits from "),zn=r(La,"A",{href:!0});var oc=l(zn);Jr=s(oc,"PreTrainedModel"),oc.forEach(t),zr=s(La,`. 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.)`),La.forEach(t),Ur=h(wt),So=r(wt,"P",{});var Ea=l(So);Ir=s(Ea,"This model is also a PyTorch "),Bo=r(Ea,"A",{href:!0,rel:!0});var nc=l(Bo);Wr=s(nc,"torch.nn.Module"),nc.forEach(t),xr=s(Ea,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ea.forEach(t),qr=h(wt),it=r(wt,"DIV",{class:!0});var Co=l(it);w(Vo.$$.fragment,Co),Nr=h(Co),Jt=r(Co,"P",{});var Dn=l(Jt);Zr=s(Dn,"The "),Un=r(Dn,"A",{href:!0});var sc=l(Un);Sr=s(sc,"CTRLModel"),sc.forEach(t),Br=s(Dn," forward method, overrides the "),ms=r(Dn,"CODE",{});var ac=l(ms);Vr=s(ac,"__call__"),ac.forEach(t),Pr=s(Dn," special method."),Dn.forEach(t),Gr=h(Co),w(Yt.$$.fragment,Co),Hr=h(Co),w(Qt.$$.fragment,Co),Co.forEach(t),wt.forEach(t),ca=h(o),zt=r(o,"H2",{class:!0});var ja=l(zt);Kt=r(ja,"A",{id:!0,class:!0,href:!0});var rc=l(Kt);fs=r(rc,"SPAN",{});var lc=l(fs);w(Po.$$.fragment,lc),lc.forEach(t),rc.forEach(t),Ar=h(ja),gs=r(ja,"SPAN",{});var ic=l(gs);Xr=s(ic,"CTRLLMHeadModel"),ic.forEach(t),ja.forEach(t),pa=h(o),Be=r(o,"DIV",{class:!0});var kt=l(Be);w(Go.$$.fragment,kt),Or=h(kt),_s=r(kt,"P",{});var dc=l(_s);Dr=s(dc,`The CTRL Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),dc.forEach(t),Yr=h(kt),Ho=r(kt,"P",{});var Fa=l(Ho);Qr=s(Fa,"This model inherits from "),In=r(Fa,"A",{href:!0});var cc=l(In);Kr=s(cc,"PreTrainedModel"),cc.forEach(t),el=s(Fa,`. 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.)`),Fa.forEach(t),tl=h(kt),Ao=r(kt,"P",{});var Ja=l(Ao);ol=s(Ja,"This model is also a PyTorch "),Xo=r(Ja,"A",{href:!0,rel:!0});var pc=l(Xo);nl=s(pc,"torch.nn.Module"),pc.forEach(t),sl=s(Ja,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ja.forEach(t),al=h(kt),dt=r(kt,"DIV",{class:!0});var $o=l(dt);w(Oo.$$.fragment,$o),rl=h($o),Ut=r($o,"P",{});var Yn=l(Ut);ll=s(Yn,"The "),Wn=r(Yn,"A",{href:!0});var hc=l(Wn);il=s(hc,"CTRLLMHeadModel"),hc.forEach(t),dl=s(Yn," forward method, overrides the "),Ts=r(Yn,"CODE",{});var uc=l(Ts);cl=s(uc,"__call__"),uc.forEach(t),pl=s(Yn," special method."),Yn.forEach(t),hl=h($o),w(eo.$$.fragment,$o),ul=h($o),w(to.$$.fragment,$o),$o.forEach(t),kt.forEach(t),ha=h(o),It=r(o,"H2",{class:!0});var za=l(It);oo=r(za,"A",{id:!0,class:!0,href:!0});var mc=l(oo);ys=r(mc,"SPAN",{});var fc=l(ys);w(Do.$$.fragment,fc),fc.forEach(t),mc.forEach(t),ml=h(za),bs=r(za,"SPAN",{});var gc=l(bs);fl=s(gc,"CTRLForSequenceClassification"),gc.forEach(t),za.forEach(t),ua=h(o),Ve=r(o,"DIV",{class:!0});var Mt=l(Ve);w(Yo.$$.fragment,Mt),gl=h(Mt),Pe=r(Mt,"P",{});var ht=l(Pe);_l=s(ht,`The CTRL Model transformer with a sequence classification head on top (linear layer).
`),xn=r(ht,"A",{href:!0});var _c=l(xn);Tl=s(_c,"CTRLForSequenceClassification"),_c.forEach(t),yl=s(ht,` 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 `),vs=r(ht,"CODE",{});var Tc=l(vs);bl=s(Tc,"pad_token_id"),Tc.forEach(t),vl=s(ht,` is defined in the configuration, it finds the last token that is not a padding token in
each row. If no `),ws=r(ht,"CODE",{});var yc=l(ws);wl=s(yc,"pad_token_id"),yc.forEach(t),kl=s(ht,` is defined, it simply takes the last value in each row of the batch. Since it cannot
guess the padding tokens when `),ks=r(ht,"CODE",{});var bc=l(ks);Ml=s(bc,"inputs_embeds"),bc.forEach(t),Cl=s(ht," are passed instead of "),Ms=r(ht,"CODE",{});var vc=l(Ms);$l=s(vc,"input_ids"),vc.forEach(t),Rl=s(ht,`, it does the same (take the last
value in each row of the batch).`),ht.forEach(t),Ll=h(Mt),Qo=r(Mt,"P",{});var Ua=l(Qo);El=s(Ua,"This model inherits from "),qn=r(Ua,"A",{href:!0});var wc=l(qn);jl=s(wc,"PreTrainedModel"),wc.forEach(t),Fl=s(Ua,`. 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.)`),Ua.forEach(t),Jl=h(Mt),Ko=r(Mt,"P",{});var Ia=l(Ko);zl=s(Ia,"This model is also a PyTorch "),en=r(Ia,"A",{href:!0,rel:!0});var kc=l(en);Ul=s(kc,"torch.nn.Module"),kc.forEach(t),Il=s(Ia,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ia.forEach(t),Wl=h(Mt),ye=r(Mt,"DIV",{class:!0});var Oe=l(ye);w(tn.$$.fragment,Oe),xl=h(Oe),Wt=r(Oe,"P",{});var Qn=l(Wt);ql=s(Qn,"The "),Nn=r(Qn,"A",{href:!0});var Mc=l(Nn);Nl=s(Mc,"CTRLForSequenceClassification"),Mc.forEach(t),Zl=s(Qn," forward method, overrides the "),Cs=r(Qn,"CODE",{});var Cc=l(Cs);Sl=s(Cc,"__call__"),Cc.forEach(t),Bl=s(Qn," special method."),Qn.forEach(t),Vl=h(Oe),w(no.$$.fragment,Oe),Pl=h(Oe),w(so.$$.fragment,Oe),Gl=h(Oe),w(ao.$$.fragment,Oe),Hl=h(Oe),w(ro.$$.fragment,Oe),Al=h(Oe),w(lo.$$.fragment,Oe),Oe.forEach(t),Mt.forEach(t),ma=h(o),xt=r(o,"H2",{class:!0});var Wa=l(xt);io=r(Wa,"A",{id:!0,class:!0,href:!0});var $c=l(io);$s=r($c,"SPAN",{});var Rc=l($s);w(on.$$.fragment,Rc),Rc.forEach(t),$c.forEach(t),Xl=h(Wa),Rs=r(Wa,"SPAN",{});var Lc=l(Rs);Ol=s(Lc,"TFCTRLModel"),Lc.forEach(t),Wa.forEach(t),fa=h(o),be=r(o,"DIV",{class:!0});var ut=l(be);w(nn.$$.fragment,ut),Dl=h(ut),Ls=r(ut,"P",{});var Ec=l(Ls);Yl=s(Ec,"The bare CTRL Model transformer outputting raw hidden-states without any specific head on top."),Ec.forEach(t),Ql=h(ut),sn=r(ut,"P",{});var xa=l(sn);Kl=s(xa,"This model inherits from "),Zn=r(xa,"A",{href:!0});var jc=l(Zn);ei=s(jc,"TFPreTrainedModel"),jc.forEach(t),ti=s(xa,`. 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.)`),xa.forEach(t),oi=h(ut),an=r(ut,"P",{});var qa=l(an);ni=s(qa,"This model is also a "),rn=r(qa,"A",{href:!0,rel:!0});var Fc=l(rn);si=s(Fc,"tf.keras.Model"),Fc.forEach(t),ai=s(qa,` 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.`),qa.forEach(t),ri=h(ut),w(co.$$.fragment,ut),li=h(ut),ct=r(ut,"DIV",{class:!0});var Ro=l(ct);w(ln.$$.fragment,Ro),ii=h(Ro),qt=r(Ro,"P",{});var Kn=l(qt);di=s(Kn,"The "),Sn=r(Kn,"A",{href:!0});var Jc=l(Sn);ci=s(Jc,"TFCTRLModel"),Jc.forEach(t),pi=s(Kn," forward method, overrides the "),Es=r(Kn,"CODE",{});var zc=l(Es);hi=s(zc,"__call__"),zc.forEach(t),ui=s(Kn," special method."),Kn.forEach(t),mi=h(Ro),w(po.$$.fragment,Ro),fi=h(Ro),w(ho.$$.fragment,Ro),Ro.forEach(t),ut.forEach(t),ga=h(o),Nt=r(o,"H2",{class:!0});var Na=l(Nt);uo=r(Na,"A",{id:!0,class:!0,href:!0});var Uc=l(uo);js=r(Uc,"SPAN",{});var Ic=l(js);w(dn.$$.fragment,Ic),Ic.forEach(t),Uc.forEach(t),gi=h(Na),Fs=r(Na,"SPAN",{});var Wc=l(Fs);_i=s(Wc,"TFCTRLLMHeadModel"),Wc.forEach(t),Na.forEach(t),_a=h(o),ve=r(o,"DIV",{class:!0});var mt=l(ve);w(cn.$$.fragment,mt),Ti=h(mt),Js=r(mt,"P",{});var xc=l(Js);yi=s(xc,`The CTRL Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),xc.forEach(t),bi=h(mt),pn=r(mt,"P",{});var Za=l(pn);vi=s(Za,"This model inherits from "),Bn=r(Za,"A",{href:!0});var qc=l(Bn);wi=s(qc,"TFPreTrainedModel"),qc.forEach(t),ki=s(Za,`. 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.)`),Za.forEach(t),Mi=h(mt),hn=r(mt,"P",{});var Sa=l(hn);Ci=s(Sa,"This model is also a "),un=r(Sa,"A",{href:!0,rel:!0});var Nc=l(un);$i=s(Nc,"tf.keras.Model"),Nc.forEach(t),Ri=s(Sa,` 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.`),Sa.forEach(t),Li=h(mt),w(mo.$$.fragment,mt),Ei=h(mt),pt=r(mt,"DIV",{class:!0});var Lo=l(pt);w(mn.$$.fragment,Lo),ji=h(Lo),Zt=r(Lo,"P",{});var es=l(Zt);Fi=s(es,"The "),Vn=r(es,"A",{href:!0});var Zc=l(Vn);Ji=s(Zc,"TFCTRLLMHeadModel"),Zc.forEach(t),zi=s(es," forward method, overrides the "),zs=r(es,"CODE",{});var Sc=l(zs);Ui=s(Sc,"__call__"),Sc.forEach(t),Ii=s(es," special method."),es.forEach(t),Wi=h(Lo),w(fo.$$.fragment,Lo),xi=h(Lo),w(go.$$.fragment,Lo),Lo.forEach(t),mt.forEach(t),Ta=h(o),St=r(o,"H2",{class:!0});var Ba=l(St);_o=r(Ba,"A",{id:!0,class:!0,href:!0});var Bc=l(_o);Us=r(Bc,"SPAN",{});var Vc=l(Us);w(fn.$$.fragment,Vc),Vc.forEach(t),Bc.forEach(t),qi=h(Ba),Is=r(Ba,"SPAN",{});var Pc=l(Is);Ni=s(Pc,"TFCTRLForSequenceClassification"),Pc.forEach(t),Ba.forEach(t),ya=h(o),oe=r(o,"DIV",{class:!0});var Le=l(oe);w(gn.$$.fragment,Le),Zi=h(Le),Ws=r(Le,"P",{});var Gc=l(Ws);Si=s(Gc,"The CTRL Model transformer with a sequence classification head on top (linear layer)."),Gc.forEach(t),Bi=h(Le),Pn=r(Le,"P",{});var bd=l(Pn);Gn=r(bd,"A",{href:!0});var Hc=l(Gn);Vi=s(Hc,"TFCTRLForSequenceClassification"),Hc.forEach(t),Pi=s(bd,` uses the last token in order to do the classification, as other causal models
(e.g. GPT-1, GPT-2) do.`),bd.forEach(t),Gi=h(Le),Qe=r(Le,"P",{});var Ct=l(Qe);Hi=s(Ct,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),xs=r(Ct,"CODE",{});var Ac=l(xs);Ai=s(Ac,"pad_token_id"),Ac.forEach(t),Xi=s(Ct,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),qs=r(Ct,"CODE",{});var Xc=l(qs);Oi=s(Xc,"pad_token_id"),Xc.forEach(t),Di=s(Ct,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ns=r(Ct,"CODE",{});var Oc=l(Ns);Yi=s(Oc,"inputs_embeds"),Oc.forEach(t),Qi=s(Ct," are passed instead of "),Zs=r(Ct,"CODE",{});var Dc=l(Zs);Ki=s(Dc,"input_ids"),Dc.forEach(t),ed=s(Ct,`, it does the same (take the last value in
each row of the batch).`),Ct.forEach(t),td=h(Le),_n=r(Le,"P",{});var Va=l(_n);od=s(Va,"This model inherits from "),Hn=r(Va,"A",{href:!0});var Yc=l(Hn);nd=s(Yc,"TFPreTrainedModel"),Yc.forEach(t),sd=s(Va,`. 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.)`),Va.forEach(t),ad=h(Le),Tn=r(Le,"P",{});var Pa=l(Tn);rd=s(Pa,"This model is also a "),yn=r(Pa,"A",{href:!0,rel:!0});var Qc=l(yn);ld=s(Qc,"tf.keras.Model"),Qc.forEach(t),id=s(Pa,` 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.`),Pa.forEach(t),dd=h(Le),w(To.$$.fragment,Le),cd=h(Le),Xe=r(Le,"DIV",{class:!0});var $t=l(Xe);w(bn.$$.fragment,$t),pd=h($t),Bt=r($t,"P",{});var ts=l(Bt);hd=s(ts,"The "),An=r(ts,"A",{href:!0});var Kc=l(An);ud=s(Kc,"TFCTRLForSequenceClassification"),Kc.forEach(t),md=s(ts," forward method, overrides the "),Ss=r(ts,"CODE",{});var ep=l(Ss);fd=s(ep,"__call__"),ep.forEach(t),gd=s(ts," special method."),ts.forEach(t),_d=h($t),w(yo.$$.fragment,$t),Td=h($t),w(bo.$$.fragment,$t),yd=h($t),w(vo.$$.fragment,$t),$t.forEach(t),Le.forEach(t),this.h()},h(){m(d,"name","hf:doc:metadata"),m(d,"content",JSON.stringify(Lp)),m(f,"id","ctrl"),m(f,"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"),m(f,"href","#ctrl"),m(c,"class","relative group"),m(D,"alt","Models"),tp(D.src,R="https://img.shields.io/badge/All_model_pages-ctrl-blueviolet")||m(D,"src",R),m(ce,"href","https://huggingface.co/models?filter=ctrl"),m(pe,"alt","Spaces"),tp(pe.src,He="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue")||m(pe,"src",He),m(Z,"href","https://huggingface.co/spaces/docs-demos/tiny-ctrl"),m(x,"class","flex flex-wrap space-x-1"),m(ne,"id","overview"),m(ne,"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"),m(ne,"href","#overview"),m(Y,"class","relative group"),m(ae,"href","https://arxiv.org/abs/1909.05858"),m(ae,"rel","nofollow"),m(le,"href","https://github.com/salesforce/ctrl"),m(le,"rel","nofollow"),m(Ze,"href","model_doc/ctrl#transformers.CTRLModel.forward"),m(Re,"href","https://huggingface.co/keskarnitishr"),m(Re,"rel","nofollow"),m(Eo,"href","https://github.com/salesforce/ctrl"),m(Eo,"rel","nofollow"),m(Gt,"id","documentation-resources"),m(Gt,"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"),m(Gt,"href","#documentation-resources"),m(Rt,"class","relative group"),m(Cn,"href","../tasks/sequence_classification"),m($n,"href","../tasks/language_modeling"),m(At,"id","transformers.CTRLConfig"),m(At,"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"),m(At,"href","#transformers.CTRLConfig"),m(Lt,"class","relative group"),m(Rn,"href","/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.CTRLModel"),m(Ln,"href","/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.TFCTRLModel"),m(zo,"href","https://huggingface.co/ctrl"),m(zo,"rel","nofollow"),m(En,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),m(jn,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),m(De,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ot,"id","transformers.CTRLTokenizer"),m(Ot,"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"),m(Ot,"href","#transformers.CTRLTokenizer"),m(jt,"class","relative group"),m(Fn,"href","/docs/transformers/v4.31.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),m(Jn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Dt,"id","transformers.CTRLModel"),m(Dt,"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"),m(Dt,"href","#transformers.CTRLModel"),m(Ft,"class","relative group"),m(zn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),m(Bo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(Bo,"rel","nofollow"),m(Un,"href","/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.CTRLModel"),m(it,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Kt,"id","transformers.CTRLLMHeadModel"),m(Kt,"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"),m(Kt,"href","#transformers.CTRLLMHeadModel"),m(zt,"class","relative group"),m(In,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),m(Xo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(Xo,"rel","nofollow"),m(Wn,"href","/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.CTRLLMHeadModel"),m(dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(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(oo,"id","transformers.CTRLForSequenceClassification"),m(oo,"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"),m(oo,"href","#transformers.CTRLForSequenceClassification"),m(It,"class","relative group"),m(xn,"href","/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.CTRLForSequenceClassification"),m(qn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),m(en,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(en,"rel","nofollow"),m(Nn,"href","/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.CTRLForSequenceClassification"),m(ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(io,"id","transformers.TFCTRLModel"),m(io,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(io,"href","#transformers.TFCTRLModel"),m(xt,"class","relative group"),m(Zn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(rn,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(rn,"rel","nofollow"),m(Sn,"href","/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.TFCTRLModel"),m(ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(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(uo,"id","transformers.TFCTRLLMHeadModel"),m(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"),m(uo,"href","#transformers.TFCTRLLMHeadModel"),m(Nt,"class","relative group"),m(Bn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(un,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(un,"rel","nofollow"),m(Vn,"href","/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.TFCTRLLMHeadModel"),m(pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(_o,"id","transformers.TFCTRLForSequenceClassification"),m(_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"),m(_o,"href","#transformers.TFCTRLForSequenceClassification"),m(St,"class","relative group"),m(Gn,"href","/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.TFCTRLForSequenceClassification"),m(Hn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(yn,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(yn,"rel","nofollow"),m(An,"href","/docs/transformers/v4.31.0/en/model_doc/ctrl#transformers.TFCTRLForSequenceClassification"),m(Xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(oe,"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,_){e(document.head,d),g(o,y,_),g(o,c,_),e(c,f),e(f,b),k(i,b,null),e(c,u),e(c,F),e(F,Ee),g(o,we,_),g(o,x,_),e(x,ce),e(ce,D),e(x,je),e(x,Z),e(Z,pe),g(o,H,_),g(o,Y,_),e(Y,ne),e(ne,V),k(se,V,null),e(Y,Fe),e(Y,P),e(P,Je),g(o,ke,_),g(o,W,_),e(W,ze),e(W,ae),e(ae,he),e(W,J),e(W,z),e(z,Ue),e(W,Q),g(o,Me,_),g(o,ue,_),e(ue,K),g(o,Ce,_),g(o,me,_),e(me,U),e(U,Ie),g(o,A,_),g(o,fe,_),e(fe,We),g(o,X,_),g(o,S,_),e(S,re),e(re,B),e(re,le),e(le,ee),e(re,xe),e(S,ge),e(S,I),e(I,qe),e(S,q),e(S,ie),e(ie,Ne),e(ie,T),e(T,L),e(ie,Ke),e(S,_e),e(S,O),e(O,et),e(O,E),e(E,tt),e(O,ot),e(O,Ae),e(Ae,nt),e(O,st),e(O,N),e(N,te),e(O,at),e(O,Ze),e(Ze,G),e(G,rt),e(O,lt),g(o,$e,_),g(o,de,_),e(de,Te),e(de,Re),e(Re,Ga),e(de,Ha),e(de,Eo),e(Eo,Aa),e(de,Xa),g(o,oa,_),g(o,Rt,_),e(Rt,Gt),e(Gt,os),k(jo,os,null),e(Rt,Oa),e(Rt,ns),e(ns,Da),g(o,na,_),g(o,Ht,_),e(Ht,ss),e(ss,Cn),e(Cn,Ya),e(Ht,Qa),e(Ht,as),e(as,$n),e($n,Ka),g(o,sa,_),g(o,Lt,_),e(Lt,At),e(At,rs),k(Fo,rs,null),e(Lt,er),e(Lt,ls),e(ls,tr),g(o,aa,_),g(o,De,_),k(Jo,De,null),e(De,or),e(De,ft),e(ft,nr),e(ft,Rn),e(Rn,sr),e(ft,ar),e(ft,Ln),e(Ln,rr),e(ft,lr),e(ft,zo),e(zo,ir),e(ft,dr),e(De,cr),e(De,Et),e(Et,pr),e(Et,En),e(En,hr),e(Et,ur),e(Et,jn),e(jn,mr),e(Et,fr),e(De,gr),k(Xt,De,null),g(o,ra,_),g(o,jt,_),e(jt,Ot),e(Ot,is),k(Uo,is,null),e(jt,_r),e(jt,ds),e(ds,Tr),g(o,la,_),g(o,Ye,_),k(Io,Ye,null),e(Ye,yr),e(Ye,cs),e(cs,br),e(Ye,vr),e(Ye,Wo),e(Wo,wr),e(Wo,Fn),e(Fn,kr),e(Wo,Mr),e(Ye,Cr),e(Ye,Jn),k(xo,Jn,null),g(o,ia,_),g(o,Ft,_),e(Ft,Dt),e(Dt,ps),k(qo,ps,null),e(Ft,$r),e(Ft,hs),e(hs,Rr),g(o,da,_),g(o,Se,_),k(No,Se,null),e(Se,Lr),e(Se,us),e(us,Er),e(Se,jr),e(Se,Zo),e(Zo,Fr),e(Zo,zn),e(zn,Jr),e(Zo,zr),e(Se,Ur),e(Se,So),e(So,Ir),e(So,Bo),e(Bo,Wr),e(So,xr),e(Se,qr),e(Se,it),k(Vo,it,null),e(it,Nr),e(it,Jt),e(Jt,Zr),e(Jt,Un),e(Un,Sr),e(Jt,Br),e(Jt,ms),e(ms,Vr),e(Jt,Pr),e(it,Gr),k(Yt,it,null),e(it,Hr),k(Qt,it,null),g(o,ca,_),g(o,zt,_),e(zt,Kt),e(Kt,fs),k(Po,fs,null),e(zt,Ar),e(zt,gs),e(gs,Xr),g(o,pa,_),g(o,Be,_),k(Go,Be,null),e(Be,Or),e(Be,_s),e(_s,Dr),e(Be,Yr),e(Be,Ho),e(Ho,Qr),e(Ho,In),e(In,Kr),e(Ho,el),e(Be,tl),e(Be,Ao),e(Ao,ol),e(Ao,Xo),e(Xo,nl),e(Ao,sl),e(Be,al),e(Be,dt),k(Oo,dt,null),e(dt,rl),e(dt,Ut),e(Ut,ll),e(Ut,Wn),e(Wn,il),e(Ut,dl),e(Ut,Ts),e(Ts,cl),e(Ut,pl),e(dt,hl),k(eo,dt,null),e(dt,ul),k(to,dt,null),g(o,ha,_),g(o,It,_),e(It,oo),e(oo,ys),k(Do,ys,null),e(It,ml),e(It,bs),e(bs,fl),g(o,ua,_),g(o,Ve,_),k(Yo,Ve,null),e(Ve,gl),e(Ve,Pe),e(Pe,_l),e(Pe,xn),e(xn,Tl),e(Pe,yl),e(Pe,vs),e(vs,bl),e(Pe,vl),e(Pe,ws),e(ws,wl),e(Pe,kl),e(Pe,ks),e(ks,Ml),e(Pe,Cl),e(Pe,Ms),e(Ms,$l),e(Pe,Rl),e(Ve,Ll),e(Ve,Qo),e(Qo,El),e(Qo,qn),e(qn,jl),e(Qo,Fl),e(Ve,Jl),e(Ve,Ko),e(Ko,zl),e(Ko,en),e(en,Ul),e(Ko,Il),e(Ve,Wl),e(Ve,ye),k(tn,ye,null),e(ye,xl),e(ye,Wt),e(Wt,ql),e(Wt,Nn),e(Nn,Nl),e(Wt,Zl),e(Wt,Cs),e(Cs,Sl),e(Wt,Bl),e(ye,Vl),k(no,ye,null),e(ye,Pl),k(so,ye,null),e(ye,Gl),k(ao,ye,null),e(ye,Hl),k(ro,ye,null),e(ye,Al),k(lo,ye,null),g(o,ma,_),g(o,xt,_),e(xt,io),e(io,$s),k(on,$s,null),e(xt,Xl),e(xt,Rs),e(Rs,Ol),g(o,fa,_),g(o,be,_),k(nn,be,null),e(be,Dl),e(be,Ls),e(Ls,Yl),e(be,Ql),e(be,sn),e(sn,Kl),e(sn,Zn),e(Zn,ei),e(sn,ti),e(be,oi),e(be,an),e(an,ni),e(an,rn),e(rn,si),e(an,ai),e(be,ri),k(co,be,null),e(be,li),e(be,ct),k(ln,ct,null),e(ct,ii),e(ct,qt),e(qt,di),e(qt,Sn),e(Sn,ci),e(qt,pi),e(qt,Es),e(Es,hi),e(qt,ui),e(ct,mi),k(po,ct,null),e(ct,fi),k(ho,ct,null),g(o,ga,_),g(o,Nt,_),e(Nt,uo),e(uo,js),k(dn,js,null),e(Nt,gi),e(Nt,Fs),e(Fs,_i),g(o,_a,_),g(o,ve,_),k(cn,ve,null),e(ve,Ti),e(ve,Js),e(Js,yi),e(ve,bi),e(ve,pn),e(pn,vi),e(pn,Bn),e(Bn,wi),e(pn,ki),e(ve,Mi),e(ve,hn),e(hn,Ci),e(hn,un),e(un,$i),e(hn,Ri),e(ve,Li),k(mo,ve,null),e(ve,Ei),e(ve,pt),k(mn,pt,null),e(pt,ji),e(pt,Zt),e(Zt,Fi),e(Zt,Vn),e(Vn,Ji),e(Zt,zi),e(Zt,zs),e(zs,Ui),e(Zt,Ii),e(pt,Wi),k(fo,pt,null),e(pt,xi),k(go,pt,null),g(o,Ta,_),g(o,St,_),e(St,_o),e(_o,Us),k(fn,Us,null),e(St,qi),e(St,Is),e(Is,Ni),g(o,ya,_),g(o,oe,_),k(gn,oe,null),e(oe,Zi),e(oe,Ws),e(Ws,Si),e(oe,Bi),e(oe,Pn),e(Pn,Gn),e(Gn,Vi),e(Pn,Pi),e(oe,Gi),e(oe,Qe),e(Qe,Hi),e(Qe,xs),e(xs,Ai),e(Qe,Xi),e(Qe,qs),e(qs,Oi),e(Qe,Di),e(Qe,Ns),e(Ns,Yi),e(Qe,Qi),e(Qe,Zs),e(Zs,Ki),e(Qe,ed),e(oe,td),e(oe,_n),e(_n,od),e(_n,Hn),e(Hn,nd),e(_n,sd),e(oe,ad),e(oe,Tn),e(Tn,rd),e(Tn,yn),e(yn,ld),e(Tn,id),e(oe,dd),k(To,oe,null),e(oe,cd),e(oe,Xe),k(bn,Xe,null),e(Xe,pd),e(Xe,Bt),e(Bt,hd),e(Bt,An),e(An,ud),e(Bt,md),e(Bt,Ss),e(Ss,fd),e(Bt,gd),e(Xe,_d),k(yo,Xe,null),e(Xe,Td),k(bo,Xe,null),e(Xe,yd),k(vo,Xe,null),ba=!0},p(o,[_]){const vn={};_&2&&(vn.$$scope={dirty:_,ctx:o}),Xt.$set(vn);const Bs={};_&2&&(Bs.$$scope={dirty:_,ctx:o}),Yt.$set(Bs);const Vs={};_&2&&(Vs.$$scope={dirty:_,ctx:o}),Qt.$set(Vs);const Ps={};_&2&&(Ps.$$scope={dirty:_,ctx:o}),eo.$set(Ps);const wn={};_&2&&(wn.$$scope={dirty:_,ctx:o}),to.$set(wn);const Gs={};_&2&&(Gs.$$scope={dirty:_,ctx:o}),no.$set(Gs);const Hs={};_&2&&(Hs.$$scope={dirty:_,ctx:o}),so.$set(Hs);const kn={};_&2&&(kn.$$scope={dirty:_,ctx:o}),ao.$set(kn);const As={};_&2&&(As.$$scope={dirty:_,ctx:o}),ro.$set(As);const Xs={};_&2&&(Xs.$$scope={dirty:_,ctx:o}),lo.$set(Xs);const Os={};_&2&&(Os.$$scope={dirty:_,ctx:o}),co.$set(Os);const Vt={};_&2&&(Vt.$$scope={dirty:_,ctx:o}),po.$set(Vt);const Ds={};_&2&&(Ds.$$scope={dirty:_,ctx:o}),ho.$set(Ds);const Ys={};_&2&&(Ys.$$scope={dirty:_,ctx:o}),mo.$set(Ys);const Qs={};_&2&&(Qs.$$scope={dirty:_,ctx:o}),fo.$set(Qs);const Ks={};_&2&&(Ks.$$scope={dirty:_,ctx:o}),go.$set(Ks);const ea={};_&2&&(ea.$$scope={dirty:_,ctx:o}),To.$set(ea);const ta={};_&2&&(ta.$$scope={dirty:_,ctx:o}),yo.$set(ta);const gt={};_&2&&(gt.$$scope={dirty:_,ctx:o}),bo.$set(gt);const Mn={};_&2&&(Mn.$$scope={dirty:_,ctx:o}),vo.$set(Mn)},i(o){ba||(M(i.$$.fragment,o),M(se.$$.fragment,o),M(jo.$$.fragment,o),M(Fo.$$.fragment,o),M(Jo.$$.fragment,o),M(Xt.$$.fragment,o),M(Uo.$$.fragment,o),M(Io.$$.fragment,o),M(xo.$$.fragment,o),M(qo.$$.fragment,o),M(No.$$.fragment,o),M(Vo.$$.fragment,o),M(Yt.$$.fragment,o),M(Qt.$$.fragment,o),M(Po.$$.fragment,o),M(Go.$$.fragment,o),M(Oo.$$.fragment,o),M(eo.$$.fragment,o),M(to.$$.fragment,o),M(Do.$$.fragment,o),M(Yo.$$.fragment,o),M(tn.$$.fragment,o),M(no.$$.fragment,o),M(so.$$.fragment,o),M(ao.$$.fragment,o),M(ro.$$.fragment,o),M(lo.$$.fragment,o),M(on.$$.fragment,o),M(nn.$$.fragment,o),M(co.$$.fragment,o),M(ln.$$.fragment,o),M(po.$$.fragment,o),M(ho.$$.fragment,o),M(dn.$$.fragment,o),M(cn.$$.fragment,o),M(mo.$$.fragment,o),M(mn.$$.fragment,o),M(fo.$$.fragment,o),M(go.$$.fragment,o),M(fn.$$.fragment,o),M(gn.$$.fragment,o),M(To.$$.fragment,o),M(bn.$$.fragment,o),M(yo.$$.fragment,o),M(bo.$$.fragment,o),M(vo.$$.fragment,o),ba=!0)},o(o){C(i.$$.fragment,o),C(se.$$.fragment,o),C(jo.$$.fragment,o),C(Fo.$$.fragment,o),C(Jo.$$.fragment,o),C(Xt.$$.fragment,o),C(Uo.$$.fragment,o),C(Io.$$.fragment,o),C(xo.$$.fragment,o),C(qo.$$.fragment,o),C(No.$$.fragment,o),C(Vo.$$.fragment,o),C(Yt.$$.fragment,o),C(Qt.$$.fragment,o),C(Po.$$.fragment,o),C(Go.$$.fragment,o),C(Oo.$$.fragment,o),C(eo.$$.fragment,o),C(to.$$.fragment,o),C(Do.$$.fragment,o),C(Yo.$$.fragment,o),C(tn.$$.fragment,o),C(no.$$.fragment,o),C(so.$$.fragment,o),C(ao.$$.fragment,o),C(ro.$$.fragment,o),C(lo.$$.fragment,o),C(on.$$.fragment,o),C(nn.$$.fragment,o),C(co.$$.fragment,o),C(ln.$$.fragment,o),C(po.$$.fragment,o),C(ho.$$.fragment,o),C(dn.$$.fragment,o),C(cn.$$.fragment,o),C(mo.$$.fragment,o),C(mn.$$.fragment,o),C(fo.$$.fragment,o),C(go.$$.fragment,o),C(fn.$$.fragment,o),C(gn.$$.fragment,o),C(To.$$.fragment,o),C(bn.$$.fragment,o),C(yo.$$.fragment,o),C(bo.$$.fragment,o),C(vo.$$.fragment,o),ba=!1},d(o){t(d),o&&t(y),o&&t(c),$(i),o&&t(we),o&&t(x),o&&t(H),o&&t(Y),$(se),o&&t(ke),o&&t(W),o&&t(Me),o&&t(ue),o&&t(Ce),o&&t(me),o&&t(A),o&&t(fe),o&&t(X),o&&t(S),o&&t($e),o&&t(de),o&&t(oa),o&&t(Rt),$(jo),o&&t(na),o&&t(Ht),o&&t(sa),o&&t(Lt),$(Fo),o&&t(aa),o&&t(De),$(Jo),$(Xt),o&&t(ra),o&&t(jt),$(Uo),o&&t(la),o&&t(Ye),$(Io),$(xo),o&&t(ia),o&&t(Ft),$(qo),o&&t(da),o&&t(Se),$(No),$(Vo),$(Yt),$(Qt),o&&t(ca),o&&t(zt),$(Po),o&&t(pa),o&&t(Be),$(Go),$(Oo),$(eo),$(to),o&&t(ha),o&&t(It),$(Do),o&&t(ua),o&&t(Ve),$(Yo),$(tn),$(no),$(so),$(ao),$(ro),$(lo),o&&t(ma),o&&t(xt),$(on),o&&t(fa),o&&t(be),$(nn),$(co),$(ln),$(po),$(ho),o&&t(ga),o&&t(Nt),$(dn),o&&t(_a),o&&t(ve),$(cn),$(mo),$(mn),$(fo),$(go),o&&t(Ta),o&&t(St),$(fn),o&&t(ya),o&&t(oe),$(gn),$(To),$(bn),$(yo),$(bo),$(vo)}}}const Lp={local:"ctrl",sections:[{local:"overview",title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.CTRLConfig",title:"CTRLConfig"},{local:"transformers.CTRLTokenizer",title:"CTRLTokenizer"},{local:"transformers.CTRLModel",title:"CTRLModel"},{local:"transformers.CTRLLMHeadModel",title:"CTRLLMHeadModel"},{local:"transformers.CTRLForSequenceClassification",title:"CTRLForSequenceClassification"},{local:"transformers.TFCTRLModel",title:"TFCTRLModel"},{local:"transformers.TFCTRLLMHeadModel",title:"TFCTRLLMHeadModel"},{local:"transformers.TFCTRLForSequenceClassification",title:"TFCTRLForSequenceClassification"}],title:"CTRL"};function Ep(j){return rp(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Wp extends op{constructor(d){super();np(this,d,Ep,Rp,sp,{})}}export{Wp as default,Lp as metadata};
