import{S as Df,i as Yf,s as Qf,e as n,k as c,w as y,t as a,M as Kf,c as s,d as t,m as f,a as l,x as w,h as r,b as h,N as Of,G as e,g as p,y as M,q as $,o as k,B as L,v as eh,L as Bt}from"../../chunks/vendor-hf-doc-builder.js";import{T as Mt}from"../../chunks/Tip-hf-doc-builder.js";import{D as ae}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Rt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as nt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as At}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function th(C){let d,b,u,g,v,i,m,F,B,re;return{c(){d=n("p"),b=a("TransformerXL does "),u=n("strong"),g=a("not"),v=a(" work with "),i=n("em"),m=a("torch.nn.DataParallel"),F=a(" due to a bug in PyTorch, see "),B=n("a"),re=a("issue #36035"),this.h()},l(j){d=s(j,"P",{});var U=l(d);b=r(U,"TransformerXL does "),u=s(U,"STRONG",{});var H=l(u);g=r(H,"not"),H.forEach(t),v=r(U," work with "),i=s(U,"EM",{});var x=l(i);m=r(x,"torch.nn.DataParallel"),x.forEach(t),F=r(U," due to a bug in PyTorch, see "),B=s(U,"A",{href:!0,rel:!0});var he=l(B);re=r(he,"issue #36035"),he.forEach(t),U.forEach(t),this.h()},h(){h(B,"href","https://github.com/pytorch/pytorch/issues/36035"),h(B,"rel","nofollow")},m(j,U){p(j,d,U),e(d,b),e(d,u),e(u,g),e(d,v),e(d,i),e(i,m),e(d,F),e(d,B),e(B,re)},d(j){j&&t(d)}}}function oh(C){let d,b,u,g,v;return g=new Rt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYW5zZm9YTENvbmZpZyUyQyUyMFRyYW5zZm9YTE1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFRyYW5zZm9ybWVyJTIwWEwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMFRyYW5zZm9YTENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBUcmFuc2ZvWExNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TransfoXLConfig, TransfoXLModel

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;transfo-xl-wt103&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TransfoXLLMHeadModel.from_pretrained(<span class="hljs-string">&quot;transfo-xl-wt103&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;transfo-xl-wt103&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TransfoXLForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;transfo-xl-wt103&quot;</span>)

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor([<span class="hljs-number">1</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=n("p"),b=a("Example of single-label classification:"),u=c(),y(g.$$.fragment)},l(i){d=s(i,"P",{});var m=l(d);b=r(m,"Example of single-label classification:"),m.forEach(t),u=f(i),w(g.$$.fragment,i)},m(i,m){p(i,d,m),e(d,b),p(i,u,m),M(g,i,m),v=!0},p:Bt,i(i){v||($(g.$$.fragment,i),v=!0)},o(i){k(g.$$.fragment,i),v=!1},d(i){i&&t(d),i&&t(u),L(g,i)}}}function dh(C){let d,b,u,g,v;return g=new Rt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMFRyYW5zZm9YTEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ0cmFuc2ZvLXhsLXd0MTAzJTIyKSUwQW1vZGVsJTIwJTNEJTIwVHJhbnNmb1hMRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIydHJhbnNmby14bC13dDEwMyUyMiUyQyUyMHByb2JsZW1fdHlwZSUzRCUyMm11bHRpX2xhYmVsX2NsYXNzaWZpY2F0aW9uJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZHMlMjAlM0QlMjB0b3JjaC5hcmFuZ2UoMCUyQyUyMGxvZ2l0cy5zaGFwZSU1Qi0xJTVEKSU1QnRvcmNoLnNpZ21vaWQobG9naXRzKS5zcXVlZXplKGRpbSUzRDApJTIwJTNFJTIwMC41JTVEJTBBJTBBJTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwVHJhbnNmb1hMRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIydHJhbnNmby14bC13dDEwMyUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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, TransfoXLForSequenceClassification

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.<span class="hljs-built_in">sum</span>(
<span class="hljs-meta">... </span>    torch.nn.functional.one_hot(predicted_class_ids[<span class="hljs-literal">None</span>, :].clone(), num_classes=num_labels), dim=<span class="hljs-number">1</span>
<span class="hljs-meta">... </span>).to(torch.<span class="hljs-built_in">float</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=n("p"),b=a("Example of multi-label classification:"),u=c(),y(g.$$.fragment)},l(i){d=s(i,"P",{});var m=l(d);b=r(m,"Example of multi-label classification:"),m.forEach(t),u=f(i),w(g.$$.fragment,i)},m(i,m){p(i,d,m),e(d,b),p(i,u,m),M(g,i,m),v=!0},p:Bt,i(i){v||($(g.$$.fragment,i),v=!0)},o(i){k(g.$$.fragment,i),v=!1},d(i){i&&t(d),i&&t(u),L(g,i)}}}function ch(C){let d,b,u,g,v,i,m,F,B,re,j,U,H,x,he,V,me,Ve,Y,ee,le,R,de,Ce,G,ze,ke,Z,je,ce,pe,z,N,ue,te,Le,ge,O,Je,xe,J,Ie,Q,S,Te,oe,Ne,ve,A,qe,D,Ue,_e,I,We,W,be,Ze;return{c(){d=n("p"),b=a("TensorFlow models and layers in "),u=n("code"),g=a("transformers"),v=a(" accept two formats as input:"),i=c(),m=n("ul"),F=n("li"),B=a("having all inputs as keyword arguments (like PyTorch models), or"),re=c(),j=n("li"),U=a("having all inputs as a list, tuple or dict in the first positional argument."),H=c(),x=n("p"),he=a(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),V=n("code"),me=a("model.fit()"),Ve=a(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),Y=n("code"),ee=a("model.fit()"),le=a(` supports! If, however, you want to use the second
format outside of Keras methods like `),R=n("code"),de=a("fit()"),Ce=a(" and "),G=n("code"),ze=a("predict()"),ke=a(`, such as when creating your own layers or models with
the Keras `),Z=n("code"),je=a("Functional"),ce=a(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),pe=c(),z=n("ul"),N=n("li"),ue=a("a single Tensor with "),te=n("code"),Le=a("input_ids"),ge=a(" only and nothing else: "),O=n("code"),Je=a("model(input_ids)"),xe=c(),J=n("li"),Ie=a(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=n("code"),S=a("model([input_ids, attention_mask])"),Te=a(" or "),oe=n("code"),Ne=a("model([input_ids, attention_mask, token_type_ids])"),ve=c(),A=n("li"),qe=a(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),D=n("code"),Ue=a('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),_e=c(),I=n("p"),We=a(`Note that when creating models and layers with
`),W=n("a"),be=a("subclassing"),Ze=a(` 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=s(T,"P",{});var X=l(d);b=r(X,"TensorFlow models and layers in "),u=s(X,"CODE",{});var st=l(u);g=r(st,"transformers"),st.forEach(t),v=r(X," accept two formats as input:"),X.forEach(t),i=f(T),m=s(T,"UL",{});var K=l(m);F=s(K,"LI",{});var at=l(F);B=r(at,"having all inputs as keyword arguments (like PyTorch models), or"),at.forEach(t),re=f(K),j=s(K,"LI",{});var rt=l(j);U=r(rt,"having all inputs as a list, tuple or dict in the first positional argument."),rt.forEach(t),K.forEach(t),H=f(T),x=s(T,"P",{});var E=l(x);he=r(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 `),V=s(E,"CODE",{});var lt=l(V);me=r(lt,"model.fit()"),lt.forEach(t),Ve=r(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),Y=s(E,"CODE",{});var it=l(Y);ee=r(it,"model.fit()"),it.forEach(t),le=r(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),R=s(E,"CODE",{});var De=l(R);de=r(De,"fit()"),De.forEach(t),Ce=r(E," and "),G=s(E,"CODE",{});var ye=l(G);ze=r(ye,"predict()"),ye.forEach(t),ke=r(E,`, such as when creating your own layers or models with
the Keras `),Z=s(E,"CODE",{});var Ye=l(Z);je=r(Ye,"Functional"),Ye.forEach(t),ce=r(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),pe=f(T),z=s(T,"UL",{});var q=l(z);N=s(q,"LI",{});var P=l(N);ue=r(P,"a single Tensor with "),te=s(P,"CODE",{});var Ae=l(te);Le=r(Ae,"input_ids"),Ae.forEach(t),ge=r(P," only and nothing else: "),O=s(P,"CODE",{});var Xe=l(O);Je=r(Xe,"model(input_ids)"),Xe.forEach(t),P.forEach(t),xe=f(q),J=s(q,"LI",{});var ne=l(J);Ie=r(ne,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=s(ne,"CODE",{});var Be=l(Q);S=r(Be,"model([input_ids, attention_mask])"),Be.forEach(t),Te=r(ne," or "),oe=s(ne,"CODE",{});var dt=l(oe);Ne=r(dt,"model([input_ids, attention_mask, token_type_ids])"),dt.forEach(t),ne.forEach(t),ve=f(q),A=s(q,"LI",{});var Ee=l(A);qe=r(Ee,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),D=s(Ee,"CODE",{});var we=l(D);Ue=r(we,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),we.forEach(t),Ee.forEach(t),q.forEach(t),_e=f(T),I=s(T,"P",{});var ie=l(I);We=r(ie,`Note that when creating models and layers with
`),W=s(ie,"A",{href:!0,rel:!0});var Se=l(W);be=r(Se,"subclassing"),Se.forEach(t),Ze=r(ie,` 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!`),ie.forEach(t),this.h()},h(){h(W,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),h(W,"rel","nofollow")},m(T,X){p(T,d,X),e(d,b),e(d,u),e(u,g),e(d,v),p(T,i,X),p(T,m,X),e(m,F),e(F,B),e(m,re),e(m,j),e(j,U),p(T,H,X),p(T,x,X),e(x,he),e(x,V),e(V,me),e(x,Ve),e(x,Y),e(Y,ee),e(x,le),e(x,R),e(R,de),e(x,Ce),e(x,G),e(G,ze),e(x,ke),e(x,Z),e(Z,je),e(x,ce),p(T,pe,X),p(T,z,X),e(z,N),e(N,ue),e(N,te),e(te,Le),e(N,ge),e(N,O),e(O,Je),e(z,xe),e(z,J),e(J,Ie),e(J,Q),e(Q,S),e(J,Te),e(J,oe),e(oe,Ne),e(z,ve),e(z,A),e(A,qe),e(A,D),e(D,Ue),p(T,_e,X),p(T,I,X),e(I,We),e(I,W),e(W,be),e(I,Ze)},d(T){T&&t(d),T&&t(i),T&&t(m),T&&t(H),T&&t(x),T&&t(pe),T&&t(z),T&&t(_e),T&&t(I)}}}function fh(C){let d,b,u,g,v;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n("code"),g=a("Module"),v=a(`
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=s(i,"P",{});var m=l(d);b=r(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(m,"CODE",{});var F=l(u);g=r(F,"Module"),F.forEach(t),v=r(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(i,m){p(i,d,m),e(d,b),e(d,u),e(u,g),e(d,v)},d(i){i&&t(d)}}}function hh(C){let d,b,u,g,v;return g=new Rt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURlRyYW5zZm9YTE1vZGVsJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ0cmFuc2ZvLXhsLXd0MTAzJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZUcmFuc2ZvWExNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIydHJhbnNmby14bC13dDEwMyUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFTransfoXLModel
<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;transfo-xl-wt103&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFTransfoXLModel.from_pretrained(<span class="hljs-string">&quot;transfo-xl-wt103&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=n("p"),b=a("Example:"),u=c(),y(g.$$.fragment)},l(i){d=s(i,"P",{});var m=l(d);b=r(m,"Example:"),m.forEach(t),u=f(i),w(g.$$.fragment,i)},m(i,m){p(i,d,m),e(d,b),p(i,u,m),M(g,i,m),v=!0},p:Bt,i(i){v||($(g.$$.fragment,i),v=!0)},o(i){k(g.$$.fragment,i),v=!1},d(i){i&&t(d),i&&t(u),L(g,i)}}}function mh(C){let d,b,u,g,v,i,m,F,B,re,j,U,H,x,he,V,me,Ve,Y,ee,le,R,de,Ce,G,ze,ke,Z,je,ce,pe,z,N,ue,te,Le,ge,O,Je,xe,J,Ie,Q,S,Te,oe,Ne,ve,A,qe,D,Ue,_e,I,We,W,be,Ze;return{c(){d=n("p"),b=a("TensorFlow models and layers in "),u=n("code"),g=a("transformers"),v=a(" accept two formats as input:"),i=c(),m=n("ul"),F=n("li"),B=a("having all inputs as keyword arguments (like PyTorch models), or"),re=c(),j=n("li"),U=a("having all inputs as a list, tuple or dict in the first positional argument."),H=c(),x=n("p"),he=a(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),V=n("code"),me=a("model.fit()"),Ve=a(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),Y=n("code"),ee=a("model.fit()"),le=a(` supports! If, however, you want to use the second
format outside of Keras methods like `),R=n("code"),de=a("fit()"),Ce=a(" and "),G=n("code"),ze=a("predict()"),ke=a(`, such as when creating your own layers or models with
the Keras `),Z=n("code"),je=a("Functional"),ce=a(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),pe=c(),z=n("ul"),N=n("li"),ue=a("a single Tensor with "),te=n("code"),Le=a("input_ids"),ge=a(" only and nothing else: "),O=n("code"),Je=a("model(input_ids)"),xe=c(),J=n("li"),Ie=a(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=n("code"),S=a("model([input_ids, attention_mask])"),Te=a(" or "),oe=n("code"),Ne=a("model([input_ids, attention_mask, token_type_ids])"),ve=c(),A=n("li"),qe=a(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),D=n("code"),Ue=a('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),_e=c(),I=n("p"),We=a(`Note that when creating models and layers with
`),W=n("a"),be=a("subclassing"),Ze=a(` 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=s(T,"P",{});var X=l(d);b=r(X,"TensorFlow models and layers in "),u=s(X,"CODE",{});var st=l(u);g=r(st,"transformers"),st.forEach(t),v=r(X," accept two formats as input:"),X.forEach(t),i=f(T),m=s(T,"UL",{});var K=l(m);F=s(K,"LI",{});var at=l(F);B=r(at,"having all inputs as keyword arguments (like PyTorch models), or"),at.forEach(t),re=f(K),j=s(K,"LI",{});var rt=l(j);U=r(rt,"having all inputs as a list, tuple or dict in the first positional argument."),rt.forEach(t),K.forEach(t),H=f(T),x=s(T,"P",{});var E=l(x);he=r(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 `),V=s(E,"CODE",{});var lt=l(V);me=r(lt,"model.fit()"),lt.forEach(t),Ve=r(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),Y=s(E,"CODE",{});var it=l(Y);ee=r(it,"model.fit()"),it.forEach(t),le=r(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),R=s(E,"CODE",{});var De=l(R);de=r(De,"fit()"),De.forEach(t),Ce=r(E," and "),G=s(E,"CODE",{});var ye=l(G);ze=r(ye,"predict()"),ye.forEach(t),ke=r(E,`, such as when creating your own layers or models with
the Keras `),Z=s(E,"CODE",{});var Ye=l(Z);je=r(Ye,"Functional"),Ye.forEach(t),ce=r(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),pe=f(T),z=s(T,"UL",{});var q=l(z);N=s(q,"LI",{});var P=l(N);ue=r(P,"a single Tensor with "),te=s(P,"CODE",{});var Ae=l(te);Le=r(Ae,"input_ids"),Ae.forEach(t),ge=r(P," only and nothing else: "),O=s(P,"CODE",{});var Xe=l(O);Je=r(Xe,"model(input_ids)"),Xe.forEach(t),P.forEach(t),xe=f(q),J=s(q,"LI",{});var ne=l(J);Ie=r(ne,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=s(ne,"CODE",{});var Be=l(Q);S=r(Be,"model([input_ids, attention_mask])"),Be.forEach(t),Te=r(ne," or "),oe=s(ne,"CODE",{});var dt=l(oe);Ne=r(dt,"model([input_ids, attention_mask, token_type_ids])"),dt.forEach(t),ne.forEach(t),ve=f(q),A=s(q,"LI",{});var Ee=l(A);qe=r(Ee,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),D=s(Ee,"CODE",{});var we=l(D);Ue=r(we,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),we.forEach(t),Ee.forEach(t),q.forEach(t),_e=f(T),I=s(T,"P",{});var ie=l(I);We=r(ie,`Note that when creating models and layers with
`),W=s(ie,"A",{href:!0,rel:!0});var Se=l(W);be=r(Se,"subclassing"),Se.forEach(t),Ze=r(ie,` 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!`),ie.forEach(t),this.h()},h(){h(W,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),h(W,"rel","nofollow")},m(T,X){p(T,d,X),e(d,b),e(d,u),e(u,g),e(d,v),p(T,i,X),p(T,m,X),e(m,F),e(F,B),e(m,re),e(m,j),e(j,U),p(T,H,X),p(T,x,X),e(x,he),e(x,V),e(V,me),e(x,Ve),e(x,Y),e(Y,ee),e(x,le),e(x,R),e(R,de),e(x,Ce),e(x,G),e(G,ze),e(x,ke),e(x,Z),e(Z,je),e(x,ce),p(T,pe,X),p(T,z,X),e(z,N),e(N,ue),e(N,te),e(te,Le),e(N,ge),e(N,O),e(O,Je),e(z,xe),e(z,J),e(J,Ie),e(J,Q),e(Q,S),e(J,Te),e(J,oe),e(oe,Ne),e(z,ve),e(z,A),e(A,qe),e(A,D),e(D,Ue),p(T,_e,X),p(T,I,X),e(I,We),e(I,W),e(W,be),e(I,Ze)},d(T){T&&t(d),T&&t(i),T&&t(m),T&&t(H),T&&t(x),T&&t(pe),T&&t(z),T&&t(_e),T&&t(I)}}}function ph(C){let d,b,u,g,v;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n("code"),g=a("Module"),v=a(`
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=s(i,"P",{});var m=l(d);b=r(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(m,"CODE",{});var F=l(u);g=r(F,"Module"),F.forEach(t),v=r(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(i,m){p(i,d,m),e(d,b),e(d,u),e(u,g),e(d,v)},d(i){i&&t(d)}}}function uh(C){let d,b,u,g,v;return g=new Rt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURlRyYW5zZm9YTExNSGVhZE1vZGVsJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ0cmFuc2ZvLXhsLXd0MTAzJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZUcmFuc2ZvWExMTUhlYWRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIydHJhbnNmby14bC13dDEwMyUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0cyklMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFTransfoXLLMHeadModel
<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;transfo-xl-wt103&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFTransfoXLLMHeadModel.from_pretrained(<span class="hljs-string">&quot;transfo-xl-wt103&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=n("p"),b=a("Example:"),u=c(),y(g.$$.fragment)},l(i){d=s(i,"P",{});var m=l(d);b=r(m,"Example:"),m.forEach(t),u=f(i),w(g.$$.fragment,i)},m(i,m){p(i,d,m),e(d,b),p(i,u,m),M(g,i,m),v=!0},p:Bt,i(i){v||($(g.$$.fragment,i),v=!0)},o(i){k(g.$$.fragment,i),v=!1},d(i){i&&t(d),i&&t(u),L(g,i)}}}function gh(C){let d,b,u,g,v,i,m,F,B,re,j,U,H,x,he,V,me,Ve,Y,ee,le,R,de,Ce,G,ze,ke,Z,je,ce,pe,z,N,ue,te,Le,ge,O,Je,xe,J,Ie,Q,S,Te,oe,Ne,ve,A,qe,D,Ue,_e,I,We,W,be,Ze;return{c(){d=n("p"),b=a("TensorFlow models and layers in "),u=n("code"),g=a("transformers"),v=a(" accept two formats as input:"),i=c(),m=n("ul"),F=n("li"),B=a("having all inputs as keyword arguments (like PyTorch models), or"),re=c(),j=n("li"),U=a("having all inputs as a list, tuple or dict in the first positional argument."),H=c(),x=n("p"),he=a(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),V=n("code"),me=a("model.fit()"),Ve=a(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),Y=n("code"),ee=a("model.fit()"),le=a(` supports! If, however, you want to use the second
format outside of Keras methods like `),R=n("code"),de=a("fit()"),Ce=a(" and "),G=n("code"),ze=a("predict()"),ke=a(`, such as when creating your own layers or models with
the Keras `),Z=n("code"),je=a("Functional"),ce=a(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),pe=c(),z=n("ul"),N=n("li"),ue=a("a single Tensor with "),te=n("code"),Le=a("input_ids"),ge=a(" only and nothing else: "),O=n("code"),Je=a("model(input_ids)"),xe=c(),J=n("li"),Ie=a(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=n("code"),S=a("model([input_ids, attention_mask])"),Te=a(" or "),oe=n("code"),Ne=a("model([input_ids, attention_mask, token_type_ids])"),ve=c(),A=n("li"),qe=a(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),D=n("code"),Ue=a('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),_e=c(),I=n("p"),We=a(`Note that when creating models and layers with
`),W=n("a"),be=a("subclassing"),Ze=a(` 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=s(T,"P",{});var X=l(d);b=r(X,"TensorFlow models and layers in "),u=s(X,"CODE",{});var st=l(u);g=r(st,"transformers"),st.forEach(t),v=r(X," accept two formats as input:"),X.forEach(t),i=f(T),m=s(T,"UL",{});var K=l(m);F=s(K,"LI",{});var at=l(F);B=r(at,"having all inputs as keyword arguments (like PyTorch models), or"),at.forEach(t),re=f(K),j=s(K,"LI",{});var rt=l(j);U=r(rt,"having all inputs as a list, tuple or dict in the first positional argument."),rt.forEach(t),K.forEach(t),H=f(T),x=s(T,"P",{});var E=l(x);he=r(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 `),V=s(E,"CODE",{});var lt=l(V);me=r(lt,"model.fit()"),lt.forEach(t),Ve=r(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),Y=s(E,"CODE",{});var it=l(Y);ee=r(it,"model.fit()"),it.forEach(t),le=r(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),R=s(E,"CODE",{});var De=l(R);de=r(De,"fit()"),De.forEach(t),Ce=r(E," and "),G=s(E,"CODE",{});var ye=l(G);ze=r(ye,"predict()"),ye.forEach(t),ke=r(E,`, such as when creating your own layers or models with
the Keras `),Z=s(E,"CODE",{});var Ye=l(Z);je=r(Ye,"Functional"),Ye.forEach(t),ce=r(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),pe=f(T),z=s(T,"UL",{});var q=l(z);N=s(q,"LI",{});var P=l(N);ue=r(P,"a single Tensor with "),te=s(P,"CODE",{});var Ae=l(te);Le=r(Ae,"input_ids"),Ae.forEach(t),ge=r(P," only and nothing else: "),O=s(P,"CODE",{});var Xe=l(O);Je=r(Xe,"model(input_ids)"),Xe.forEach(t),P.forEach(t),xe=f(q),J=s(q,"LI",{});var ne=l(J);Ie=r(ne,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=s(ne,"CODE",{});var Be=l(Q);S=r(Be,"model([input_ids, attention_mask])"),Be.forEach(t),Te=r(ne," or "),oe=s(ne,"CODE",{});var dt=l(oe);Ne=r(dt,"model([input_ids, attention_mask, token_type_ids])"),dt.forEach(t),ne.forEach(t),ve=f(q),A=s(q,"LI",{});var Ee=l(A);qe=r(Ee,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),D=s(Ee,"CODE",{});var we=l(D);Ue=r(we,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),we.forEach(t),Ee.forEach(t),q.forEach(t),_e=f(T),I=s(T,"P",{});var ie=l(I);We=r(ie,`Note that when creating models and layers with
`),W=s(ie,"A",{href:!0,rel:!0});var Se=l(W);be=r(Se,"subclassing"),Se.forEach(t),Ze=r(ie,` 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!`),ie.forEach(t),this.h()},h(){h(W,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),h(W,"rel","nofollow")},m(T,X){p(T,d,X),e(d,b),e(d,u),e(u,g),e(d,v),p(T,i,X),p(T,m,X),e(m,F),e(F,B),e(m,re),e(m,j),e(j,U),p(T,H,X),p(T,x,X),e(x,he),e(x,V),e(V,me),e(x,Ve),e(x,Y),e(Y,ee),e(x,le),e(x,R),e(R,de),e(x,Ce),e(x,G),e(G,ze),e(x,ke),e(x,Z),e(Z,je),e(x,ce),p(T,pe,X),p(T,z,X),e(z,N),e(N,ue),e(N,te),e(te,Le),e(N,ge),e(N,O),e(O,Je),e(z,xe),e(z,J),e(J,Ie),e(J,Q),e(Q,S),e(J,Te),e(J,oe),e(oe,Ne),e(z,ve),e(z,A),e(A,qe),e(A,D),e(D,Ue),p(T,_e,X),p(T,I,X),e(I,We),e(I,W),e(W,be),e(I,Ze)},d(T){T&&t(d),T&&t(i),T&&t(m),T&&t(H),T&&t(x),T&&t(pe),T&&t(z),T&&t(_e),T&&t(I)}}}function _h(C){let d,b,u,g,v;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n("code"),g=a("Module"),v=a(`
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=s(i,"P",{});var m=l(d);b=r(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(m,"CODE",{});var F=l(u);g=r(F,"Module"),F.forEach(t),v=r(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(i,m){p(i,d,m),e(d,b),e(d,u),e(u,g),e(d,v)},d(i){i&&t(d)}}}function Th(C){let d,b,u,g,v;return g=new Rt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURlRyYW5zZm9YTEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0ZW5zb3JmbG93JTIwYXMlMjB0ZiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnRyYW5zZm8teGwtd3QxMDMlMjIpJTBBbW9kZWwlMjAlM0QlMjBURlRyYW5zZm9YTEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMnRyYW5zZm8teGwtd3QxMDMlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQSUwQWxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWQlMjAlM0QlMjBpbnQodGYubWF0aC5hcmdtYXgobG9naXRzJTJDJTIwYXhpcyUzRC0xKSU1QjAlNUQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFTransfoXLForSequenceClassification
<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;transfo-xl-wt103&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFTransfoXLForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;transfo-xl-wt103&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=n("p"),b=a("Example:"),u=c(),y(g.$$.fragment)},l(i){d=s(i,"P",{});var m=l(d);b=r(m,"Example:"),m.forEach(t),u=f(i),w(g.$$.fragment,i)},m(i,m){p(i,d,m),e(d,b),p(i,u,m),M(g,i,m),v=!0},p:Bt,i(i){v||($(g.$$.fragment,i),v=!0)},o(i){k(g.$$.fragment,i),v=!1},d(i){i&&t(d),i&&t(u),L(g,i)}}}function vh(C){let d,b;return d=new Rt({props:{code:"JTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwVEZUcmFuc2ZvWExGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJ0cmFuc2ZvLXhsLXd0MTAzJTIyJTJDJTIwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdGYuY29uc3RhbnQoMSklMEFsb3NzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjBsYWJlbHMlM0RsYWJlbHMpLmxvc3M=",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 = TFTransfoXLForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;transfo-xl-wt103&quot;</span>, num_labels=num_labels)\n\n<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tf.constant(<span class="hljs-number">1</span>)\n<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss'}}),{c(){y(d.$$.fragment)},l(u){w(d.$$.fragment,u)},m(u,g){M(d,u,g),b=!0},p:Bt,i(u){b||($(d.$$.fragment,u),b=!0)},o(u){k(d.$$.fragment,u),b=!1},d(u){L(d,u)}}}function bh(C){let d,b,u,g,v,i,m,F,B,re,j,U,H,x,he,V,me,Ve,Y,ee,le,R,de,Ce,G,ze,ke,Z,je,ce,pe,z,N,ue,te,Le,ge,O,Je,xe,J,Ie,Q,S,Te,oe,Ne,ve,A,qe,D,Ue,_e,I,We,W,be,Ze,T,X,st,K,at,rt,E,lt,it,De,ye,Ye,q,P,Ae,Xe,ne,Be,dt,Ee,we,ie,Se,vr,br,ms,Nn,yr,Ta,$t,Gt,ps,Fo,wr,us,Mr,va,Qe,Co,$r,gt,kr,qn,Lr,xr,Un,Xr,Er,zo,Fr,Cr,zr,kt,jr,Wn,Jr,Ir,Zn,Nr,qr,Ur,Ot,ba,Lt,Dt,gs,jo,Wr,_s,Zr,ya,Ke,Jo,Sr,Io,Pr,No,Hr,Vr,Ar,qo,Br,Sn,Rr,Gr,Or,Pn,Uo,wa,xt,Yt,Ts,Wo,Dr,vs,Yr,Ma,Xt,Zo,Qr,bs,Kr,$a,Et,So,el,ys,tl,ka,Ft,Po,ol,ws,nl,La,Ct,Ho,sl,Ms,al,xa,zt,Qt,$s,Vo,rl,ks,ll,Xa,Pe,Ao,il,Ls,dl,cl,Bo,fl,Hn,hl,ml,pl,Ro,ul,Go,gl,_l,Tl,ct,Oo,vl,jt,bl,Vn,yl,wl,xs,Ml,$l,kl,Kt,Ll,eo,Ea,Jt,to,Xs,Do,xl,Es,Xl,Fa,He,Yo,El,Fs,Fl,Cl,Qo,zl,An,jl,Jl,Il,Ko,Nl,en,ql,Ul,Wl,ft,tn,Zl,It,Sl,Bn,Pl,Hl,Cs,Vl,Al,Bl,oo,Rl,no,Ca,Nt,so,zs,on,Gl,js,Ol,za,fe,nn,Dl,Js,Yl,Ql,Rn,Gn,Kl,ei,ti,et,oi,Is,ni,si,Ns,ai,ri,qs,li,ii,Us,di,ci,fi,sn,hi,On,mi,pi,ui,an,gi,rn,_i,Ti,vi,Re,ln,bi,qt,yi,Dn,wi,Mi,Ws,$i,ki,Li,ao,xi,ro,Xi,lo,ja,Ut,io,Zs,dn,Ei,Ss,Fi,Ja,Me,cn,Ci,Ps,zi,ji,fn,Ji,Yn,Ii,Ni,qi,hn,Ui,mn,Wi,Zi,Si,co,Pi,ht,pn,Hi,Wt,Vi,Qn,Ai,Bi,Hs,Ri,Gi,Oi,fo,Di,ho,Ia,Zt,mo,Vs,un,Yi,As,Qi,Na,$e,gn,Ki,Bs,ed,td,_n,od,Kn,nd,sd,ad,Tn,rd,vn,ld,id,dd,po,cd,mt,bn,fd,St,hd,es,md,pd,Rs,ud,gd,_d,uo,Td,go,qa,Pt,_o,Gs,yn,vd,Os,bd,Ua,se,wn,yd,Ds,wd,Md,ts,os,$d,kd,Ld,tt,xd,Ys,Xd,Ed,Qs,Fd,Cd,Ks,zd,jd,ea,Jd,Id,Nd,Mn,qd,ns,Ud,Wd,Zd,$n,Sd,kn,Pd,Hd,Vd,To,Ad,Ge,Ln,Bd,Ht,Rd,ss,Gd,Od,ta,Dd,Yd,Qd,vo,Kd,bo,ec,yo,Wa,Vt,wo,oa,xn,tc,na,oc,Za,Xn,En,Sa,Fn,Cn,Pa;return i=new nt({}),de=new nt({}),ye=new Mt({props:{warning:!0,$$slots:{default:[th]},$$scope:{ctx:C}}}),Xe=new nt({}),Fo=new nt({}),Co=new ae({props:{name:"class transformers.TransfoXLConfig",anchor:"transformers.TransfoXLConfig",parameters:[{name:"vocab_size",val:" = 267735"},{name:"cutoffs",val:" = [20000, 40000, 200000]"},{name:"d_model",val:" = 1024"},{name:"d_embed",val:" = 1024"},{name:"n_head",val:" = 16"},{name:"d_head",val:" = 64"},{name:"d_inner",val:" = 4096"},{name:"div_val",val:" = 4"},{name:"pre_lnorm",val:" = False"},{name:"n_layer",val:" = 18"},{name:"mem_len",val:" = 1600"},{name:"clamp_len",val:" = 1000"},{name:"same_length",val:" = True"},{name:"proj_share_all_but_first",val:" = True"},{name:"attn_type",val:" = 0"},{name:"sample_softmax",val:" = -1"},{name:"adaptive",val:" = True"},{name:"dropout",val:" = 0.1"},{name:"dropatt",val:" = 0.0"},{name:"untie_r",val:" = True"},{name:"init",val:" = 'normal'"},{name:"init_range",val:" = 0.01"},{name:"proj_init_std",val:" = 0.01"},{name:"init_std",val:" = 0.02"},{name:"layer_norm_epsilon",val:" = 1e-05"},{name:"eos_token_id",val:" = 0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TransfoXLConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 267735) &#x2014;
Vocabulary size of the BERT 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/transfo-xl#transformers.TransfoXLModel">TransfoXLModel</a> or <a href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TFTransfoXLModel">TFTransfoXLModel</a>.`,name:"vocab_size"},{anchor:"transformers.TransfoXLConfig.cutoffs",description:`<strong>cutoffs</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[20000, 40000, 200000]</code>) &#x2014;
Cutoffs for the adaptive softmax.`,name:"cutoffs"},{anchor:"transformers.TransfoXLConfig.d_model",description:`<strong>d_model</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Dimensionality of the model&#x2019;s hidden states.`,name:"d_model"},{anchor:"transformers.TransfoXLConfig.d_embed",description:`<strong>d_embed</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Dimensionality of the embeddings`,name:"d_embed"},{anchor:"transformers.TransfoXLConfig.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.TransfoXLConfig.d_head",description:`<strong>d_head</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Dimensionality of the model&#x2019;s heads.`,name:"d_head"},{anchor:"transformers.TransfoXLConfig.d_inner",description:`<strong>d_inner</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Inner dimension in FF`,name:"d_inner"},{anchor:"transformers.TransfoXLConfig.div_val",description:`<strong>div_val</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Divident value for adapative input and softmax`,name:"div_val"},{anchor:"transformers.TransfoXLConfig.pre_lnorm",description:`<strong>pre_lnorm</strong> (<code>boolean</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to apply LayerNorm to the input instead of the output in the blocks.`,name:"pre_lnorm"},{anchor:"transformers.TransfoXLConfig.n_layer",description:`<strong>n_layer</strong> (<code>int</code>, <em>optional</em>, defaults to 18) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"n_layer"},{anchor:"transformers.TransfoXLConfig.mem_len",description:`<strong>mem_len</strong> (<code>int</code>, <em>optional</em>, defaults to 1600) &#x2014;
Length of the retained previous heads.`,name:"mem_len"},{anchor:"transformers.TransfoXLConfig.clamp_len",description:`<strong>clamp_len</strong> (<code>int</code>, <em>optional</em>, defaults to 1000) &#x2014;
Use the same pos embeddings after clamp_len.`,name:"clamp_len"},{anchor:"transformers.TransfoXLConfig.same_length",description:`<strong>same_length</strong> (<code>boolean</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to use the same attn length for all tokens`,name:"same_length"},{anchor:"transformers.TransfoXLConfig.proj_share_all_but_first",description:`<strong>proj_share_all_but_first</strong> (<code>boolean</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
True to share all but first projs, False not to share.`,name:"proj_share_all_but_first"},{anchor:"transformers.TransfoXLConfig.attn_type",description:`<strong>attn_type</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Attention type. 0 for Transformer-XL, 1 for Shaw et al, 2 for Vaswani et al, 3 for Al Rfou et al.`,name:"attn_type"},{anchor:"transformers.TransfoXLConfig.sample_softmax",description:`<strong>sample_softmax</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
Number of samples in the sampled softmax.`,name:"sample_softmax"},{anchor:"transformers.TransfoXLConfig.adaptive",description:`<strong>adaptive</strong> (<code>boolean</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to use adaptive softmax.`,name:"adaptive"},{anchor:"transformers.TransfoXLConfig.dropout",description:`<strong>dropout</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:"dropout"},{anchor:"transformers.TransfoXLConfig.dropatt",description:`<strong>dropatt</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"dropatt"},{anchor:"transformers.TransfoXLConfig.untie_r",description:`<strong>untie_r</strong> (<code>boolean</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether ot not to untie relative position biases.`,name:"untie_r"},{anchor:"transformers.TransfoXLConfig.init",description:`<strong>init</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;normal&quot;</code>) &#x2014;
Parameter initializer to use.`,name:"init"},{anchor:"transformers.TransfoXLConfig.init_range",description:`<strong>init_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.01) &#x2014;
Parameters initialized by U(-init_range, init_range).`,name:"init_range"},{anchor:"transformers.TransfoXLConfig.proj_init_std",description:`<strong>proj_init_std</strong> (<code>float</code>, <em>optional</em>, defaults to 0.01) &#x2014;
Parameters initialized by N(0, init_std)`,name:"proj_init_std"},{anchor:"transformers.TransfoXLConfig.init_std",description:`<strong>init_std</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
Parameters initialized by N(0, init_std)`,name:"init_std"},{anchor:"transformers.TransfoXLConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon to use in the layer normalization layers`,name:"layer_norm_epsilon"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/transfo_xl/configuration_transfo_xl.py#L29"}}),Ot=new At({props:{anchor:"transformers.TransfoXLConfig.example",$$slots:{default:[oh]},$$scope:{ctx:C}}}),jo=new nt({}),Jo=new ae({props:{name:"class transformers.TransfoXLTokenizer",anchor:"transformers.TransfoXLTokenizer",parameters:[{name:"special",val:" = None"},{name:"min_freq",val:" = 0"},{name:"max_size",val:" = None"},{name:"lower_case",val:" = False"},{name:"delimiter",val:" = None"},{name:"vocab_file",val:" = None"},{name:"pretrained_vocab_file",val:": str = None"},{name:"never_split",val:" = None"},{name:"unk_token",val:" = '<unk>'"},{name:"eos_token",val:" = '<eos>'"},{name:"additional_special_tokens",val:" = ['<formula>']"},{name:"language",val:" = 'en'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TransfoXLTokenizer.special",description:`<strong>special</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of special tokens (to be treated by the original implementation of this tokenizer).`,name:"special"},{anchor:"transformers.TransfoXLTokenizer.min_freq",description:`<strong>min_freq</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The minimum number of times a token has to be present in order to be kept in the vocabulary (otherwise it
will be mapped to <code>unk_token</code>).`,name:"min_freq"},{anchor:"transformers.TransfoXLTokenizer.max_size",description:`<strong>max_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum size of the vocabulary. If left unset, it will default to the size of the vocabulary found
after excluding the tokens according to the <code>min_freq</code> rule.`,name:"max_size"},{anchor:"transformers.TransfoXLTokenizer.lower_case",description:`<strong>lower_case</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to lowercase the input when tokenizing.`,name:"lower_case"},{anchor:"transformers.TransfoXLTokenizer.delimiter",description:`<strong>delimiter</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The delimiter used between tokens.`,name:"delimiter"},{anchor:"transformers.TransfoXLTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
File containing the vocabulary (from the original implementation).`,name:"vocab_file"},{anchor:"transformers.TransfoXLTokenizer.pretrained_vocab_file",description:`<strong>pretrained_vocab_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
File containing the vocabulary as saved with the <code>save_pretrained()</code> method.`,name:"pretrained_vocab_file"},{anchor:"transformers.TransfoXLTokenizer.never_split",description:`<strong>never_split</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
List of tokens that should never be split. If no list is specified, will simply use the existing special
tokens.`,name:"never_split"},{anchor:"transformers.TransfoXLTokenizer.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"},{anchor:"transformers.TransfoXLTokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;eos&gt;&quot;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.TransfoXLTokenizer.additional_special_tokens",description:`<strong>additional_special_tokens</strong> (<code>List[str]</code>, <em>optional</em>, defaults to <code>[&quot;&lt;formula&gt;&quot;]</code>) &#x2014;
A list of additional special tokens (for the HuggingFace functionality).`,name:"additional_special_tokens"},{anchor:"transformers.TransfoXLTokenizer.language",description:`<strong>language</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;en&quot;</code>) &#x2014;
The language of this tokenizer (used for mose preprocessing).`,name:"language"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/transfo_xl/tokenization_transfo_xl.py#L123"}}),Uo=new ae({props:{name:"save_vocabulary",anchor:"transformers.TransfoXLTokenizer.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/transfo_xl/tokenization_transfo_xl.py#L310"}}),Wo=new nt({}),Zo=new ae({props:{name:"class transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput",anchor:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput",parameters:[{name:"last_hidden_state",val:": FloatTensor"},{name:"mems",val:": typing.List[torch.FloatTensor] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput.last_hidden_state",description:`<strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) &#x2014;
Sequence of hidden-states at the output of the last layer of the model.`,name:"last_hidden_state"},{anchor:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput.mems",description:`<strong>mems</strong> (<code>List[torch.FloatTensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks). Can be used (see <code>mems</code>
input) 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:"mems"},{anchor:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput.hidden_states",description:`<strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.`,name:"hidden_states"},{anchor:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput.attentions",description:`<strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/transfo_xl/modeling_transfo_xl.py#L600"}}),So=new ae({props:{name:"class transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput",anchor:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput",parameters:[{name:"losses",val:": typing.Optional[torch.FloatTensor] = None"},{name:"prediction_scores",val:": FloatTensor = None"},{name:"mems",val:": typing.List[torch.FloatTensor] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput.losses",description:`<strong>losses</strong> (<code>torch.FloatTensor</code> of shape <em>(batch_size, sequence_length-1)</em>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Language modeling losses (not reduced).`,name:"losses"},{anchor:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput.prediction_scores",description:`<strong>prediction_scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) &#x2014;
Prediction scores of the language modeling head (scores for each vocabulary token after SoftMax).`,name:"prediction_scores"},{anchor:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput.mems",description:`<strong>mems</strong> (<code>List[torch.FloatTensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks). Can be used (see <code>mems</code>
input) 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:"mems"},{anchor:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput.hidden_states",description:`<strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.`,name:"hidden_states"},{anchor:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput.attentions",description:`<strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.`,name:"attentions"},{anchor:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput.loss",description:`<strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>()</code>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Reduced language modeling loss.`,name:"loss"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/transfo_xl/modeling_transfo_xl.py#L665"}}),Po=new ae({props:{name:"class transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLModelOutput",anchor:"transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLModelOutput",parameters:[{name:"last_hidden_state",val:": tf.Tensor = None"},{name:"mems",val:": List[tf.Tensor] = None"},{name:"hidden_states",val:": Tuple[tf.Tensor] | None = None"},{name:"attentions",val:": Tuple[tf.Tensor] | None = None"}],parametersDescription:[{anchor:"transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLModelOutput.last_hidden_state",description:`<strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) &#x2014;
Sequence of hidden-states at the output of the last layer of the model.`,name:"last_hidden_state"},{anchor:"transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLModelOutput.mems",description:`<strong>mems</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). Can be used (see <code>mems</code>
input) 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:"mems"},{anchor:"transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLModelOutput.hidden_states",description:`<strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.`,name:"hidden_states"},{anchor:"transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLModelOutput.attentions",description:`<strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py#L673"}}),Ho=new ae({props:{name:"class transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLLMHeadModelOutput",anchor:"transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLLMHeadModelOutput",parameters:[{name:"prediction_scores",val:": tf.Tensor = None"},{name:"mems",val:": List[tf.Tensor] = None"},{name:"hidden_states",val:": Tuple[tf.Tensor] | None = None"},{name:"attentions",val:": Tuple[tf.Tensor] | None = None"}],parametersDescription:[{anchor:"transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLLMHeadModelOutput.losses",description:`<strong>losses</strong> (<code>tf.Tensor</code> of shape <em>(batch_size, sequence_length-1)</em>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Language modeling losses (not reduced).`,name:"losses"},{anchor:"transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLLMHeadModelOutput.prediction_scores",description:`<strong>prediction_scores</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) &#x2014;
Prediction scores of the language modeling head (scores for each vocabulary token after SoftMax).`,name:"prediction_scores"},{anchor:"transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLLMHeadModelOutput.mems",description:`<strong>mems</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). Can be used (see <code>mems</code>
input) 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:"mems"},{anchor:"transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLLMHeadModelOutput.hidden_states",description:`<strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.`,name:"hidden_states"},{anchor:"transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLLMHeadModelOutput.attentions",description:`<strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py#L704"}}),Vo=new nt({}),Ao=new ae({props:{name:"class transformers.TransfoXLModel",anchor:"transformers.TransfoXLModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.TransfoXLModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TransfoXLConfig">TransfoXLConfig</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/transfo_xl/modeling_transfo_xl.py#L764"}}),Oo=new ae({props:{name:"forward",anchor:"transformers.TransfoXLModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"mems",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TransfoXLModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TransfoXLModel.forward.mems",description:`<strong>mems</strong> (<code>List[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>mems</code> output below). Can be used to speed up sequential decoding. The token ids which have their mems
given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"mems"},{anchor:"transformers.TransfoXLModel.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.TransfoXLModel.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.TransfoXLModel.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.TransfoXLModel.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.TransfoXLModel.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/transfo_xl/modeling_transfo_xl.py#L867",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput"
>transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput</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/transfo-xl#transformers.TransfoXLConfig"
>TransfoXLConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>mems</strong> (<code>List[torch.FloatTensor]</code> of length <code>config.n_layers</code>) \u2014 Contains pre-computed hidden-states (key and values in the attention blocks). Can be used (see <code>mems</code>
input) 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.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput"
>transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Kt=new Mt({props:{$$slots:{default:[nh]},$$scope:{ctx:C}}}),eo=new At({props:{anchor:"transformers.TransfoXLModel.forward.example",$$slots:{default:[sh]},$$scope:{ctx:C}}}),Do=new nt({}),Yo=new ae({props:{name:"class transformers.TransfoXLLMHeadModel",anchor:"transformers.TransfoXLLMHeadModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.TransfoXLLMHeadModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TransfoXLConfig">TransfoXLConfig</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/transfo_xl/modeling_transfo_xl.py#L1004"}}),tn=new ae({props:{name:"forward",anchor:"transformers.TransfoXLLMHeadModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"mems",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TransfoXLLMHeadModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TransfoXLLMHeadModel.forward.mems",description:`<strong>mems</strong> (<code>List[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>mems</code> output below). Can be used to speed up sequential decoding. The token ids which have their mems
given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"mems"},{anchor:"transformers.TransfoXLLMHeadModel.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.TransfoXLLMHeadModel.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.TransfoXLLMHeadModel.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.TransfoXLLMHeadModel.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.TransfoXLLMHeadModel.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.TransfoXLLMHeadModel.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/transfo_xl/modeling_transfo_xl.py#L1060",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput"
>transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput</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/transfo-xl#transformers.TransfoXLConfig"
>TransfoXLConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>losses</strong> (<code>torch.FloatTensor</code> of shape <em>(batch_size, sequence_length-1)</em>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Language modeling losses (not reduced).</p>
</li>
<li>
<p><strong>prediction_scores</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 after SoftMax).</p>
</li>
<li>
<p><strong>mems</strong> (<code>List[torch.FloatTensor]</code> of length <code>config.n_layers</code>) \u2014 Contains pre-computed hidden-states (key and values in the attention blocks). Can be used (see <code>mems</code>
input) 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.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>()</code>, <em>optional</em>, returned when <code>labels</code> is provided)
Reduced language modeling loss.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput"
>transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),oo=new Mt({props:{$$slots:{default:[ah]},$$scope:{ctx:C}}}),no=new At({props:{anchor:"transformers.TransfoXLLMHeadModel.forward.example",$$slots:{default:[rh]},$$scope:{ctx:C}}}),on=new nt({}),nn=new ae({props:{name:"class transformers.TransfoXLForSequenceClassification",anchor:"transformers.TransfoXLForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.TransfoXLForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TransfoXLConfig">TransfoXLConfig</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/transfo_xl/modeling_transfo_xl.py#L1192"}}),ln=new ae({props:{name:"forward",anchor:"transformers.TransfoXLForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"mems",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TransfoXLForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TransfoXLForSequenceClassification.forward.mems",description:`<strong>mems</strong> (<code>List[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>mems</code> output below). Can be used to speed up sequential decoding. The token ids which have their mems
given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"mems"},{anchor:"transformers.TransfoXLForSequenceClassification.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.TransfoXLForSequenceClassification.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.TransfoXLForSequenceClassification.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.TransfoXLForSequenceClassification.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.TransfoXLForSequenceClassification.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.TransfoXLForSequenceClassification.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/transfo_xl/modeling_transfo_xl.py#L1201",returnDescription:`
<p>A <code>transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLSequenceClassifierOutputWithPast</code> 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/transfo-xl#transformers.TransfoXLConfig"
>TransfoXLConfig</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>mems</strong> (<code>List[torch.FloatTensor]</code> of length <code>config.n_layers</code>) \u2014 Contains pre-computed hidden-states (key and values in the attention blocks). Can be used (see <code>mems</code>
input) 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.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLSequenceClassifierOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ao=new Mt({props:{$$slots:{default:[lh]},$$scope:{ctx:C}}}),ro=new At({props:{anchor:"transformers.TransfoXLForSequenceClassification.forward.example",$$slots:{default:[ih]},$$scope:{ctx:C}}}),lo=new At({props:{anchor:"transformers.TransfoXLForSequenceClassification.forward.example-2",$$slots:{default:[dh]},$$scope:{ctx:C}}}),dn=new nt({}),cn=new ae({props:{name:"class transformers.TFTransfoXLModel",anchor:"transformers.TFTransfoXLModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFTransfoXLModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TransfoXLConfig">TransfoXLConfig</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/transfo_xl/modeling_tf_transfo_xl.py#L855"}}),co=new Mt({props:{$$slots:{default:[ch]},$$scope:{ctx:C}}}),pn=new ae({props:{name:"call",anchor:"transformers.TFTransfoXLModel.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"mems",val:": List[tf.Tensor] | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFTransfoXLModel.call.input_ids",description:`<strong>input_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.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.TFTransfoXLModel.call.mems",description:`<strong>mems</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>mems</code> output below). Can be used to speed up sequential decoding. The token ids which have their mems
given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"mems"},{anchor:"transformers.TFTransfoXLModel.call.head_mask",description:`<strong>head_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFTransfoXLModel.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.TFTransfoXLModel.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.TFTransfoXLModel.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.TFTransfoXLModel.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.TFTransfoXLModel.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/transfo_xl/modeling_tf_transfo_xl.py#L860",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLModelOutput"
>transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLModelOutput</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/transfo-xl#transformers.TransfoXLConfig"
>TransfoXLConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>mems</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) \u2014 Contains pre-computed hidden-states (key and values in the attention blocks). Can be used (see <code>mems</code>
input) 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.</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/model_doc/transfo-xl#transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLModelOutput"
>transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),fo=new Mt({props:{$$slots:{default:[fh]},$$scope:{ctx:C}}}),ho=new At({props:{anchor:"transformers.TFTransfoXLModel.call.example",$$slots:{default:[hh]},$$scope:{ctx:C}}}),un=new nt({}),gn=new ae({props:{name:"class transformers.TFTransfoXLLMHeadModel",anchor:"transformers.TFTransfoXLLMHeadModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFTransfoXLLMHeadModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TransfoXLConfig">TransfoXLConfig</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/transfo_xl/modeling_tf_transfo_xl.py#L899"}}),po=new Mt({props:{$$slots:{default:[mh]},$$scope:{ctx:C}}}),bn=new ae({props:{name:"call",anchor:"transformers.TFTransfoXLLMHeadModel.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"mems",val:": List[tf.Tensor] | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFTransfoXLLMHeadModel.call.input_ids",description:`<strong>input_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.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.TFTransfoXLLMHeadModel.call.mems",description:`<strong>mems</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>mems</code> output below). Can be used to speed up sequential decoding. The token ids which have their mems
given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"mems"},{anchor:"transformers.TFTransfoXLLMHeadModel.call.head_mask",description:`<strong>head_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFTransfoXLLMHeadModel.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.TFTransfoXLLMHeadModel.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.TFTransfoXLLMHeadModel.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.TFTransfoXLLMHeadModel.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.TFTransfoXLLMHeadModel.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/transfo_xl/modeling_tf_transfo_xl.py#L928",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLLMHeadModelOutput"
>transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLLMHeadModelOutput</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/transfo-xl#transformers.TransfoXLConfig"
>TransfoXLConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>losses</strong> (<code>tf.Tensor</code> of shape <em>(batch_size, sequence_length-1)</em>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Language modeling losses (not reduced).</p>
</li>
<li>
<p><strong>prediction_scores</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 after SoftMax).</p>
</li>
<li>
<p><strong>mems</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) \u2014 Contains pre-computed hidden-states (key and values in the attention blocks). Can be used (see <code>mems</code>
input) 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.</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/model_doc/transfo-xl#transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLLMHeadModelOutput"
>transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLLMHeadModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),uo=new Mt({props:{$$slots:{default:[ph]},$$scope:{ctx:C}}}),go=new At({props:{anchor:"transformers.TFTransfoXLLMHeadModel.call.example",$$slots:{default:[uh]},$$scope:{ctx:C}}}),yn=new nt({}),wn=new ae({props:{name:"class transformers.TFTransfoXLForSequenceClassification",anchor:"transformers.TFTransfoXLForSequenceClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFTransfoXLForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TransfoXLConfig">TransfoXLConfig</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/transfo_xl/modeling_tf_transfo_xl.py#L1006"}}),To=new Mt({props:{$$slots:{default:[gh]},$$scope:{ctx:C}}}),Ln=new ae({props:{name:"call",anchor:"transformers.TFTransfoXLForSequenceClassification.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"mems",val:": List[tf.Tensor] | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFTransfoXLForSequenceClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.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.TFTransfoXLForSequenceClassification.call.mems",description:`<strong>mems</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>mems</code> output below). Can be used to speed up sequential decoding. The token ids which have their mems
given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"mems"},{anchor:"transformers.TFTransfoXLForSequenceClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFTransfoXLForSequenceClassification.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.TFTransfoXLForSequenceClassification.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.TFTransfoXLForSequenceClassification.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.TFTransfoXLForSequenceClassification.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.TFTransfoXLForSequenceClassification.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.TFTransfoXLForSequenceClassification.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/transfo_xl/modeling_tf_transfo_xl.py#L1026",returnDescription:`
<p>A <code>transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLSequenceClassifierOutputWithPast</code> 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/transfo-xl#transformers.TransfoXLConfig"
>TransfoXLConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</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>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>mems</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) \u2014 Contains pre-computed hidden-states (key and values in the attention blocks). Can be used (see <code>mems</code>
input) 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.</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><code>transformers.models.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLSequenceClassifierOutputWithPast</code> or <code>tuple(tf.Tensor)</code></p>
`}}),vo=new Mt({props:{$$slots:{default:[_h]},$$scope:{ctx:C}}}),bo=new At({props:{anchor:"transformers.TFTransfoXLForSequenceClassification.call.example",$$slots:{default:[Th]},$$scope:{ctx:C}}}),yo=new At({props:{anchor:"transformers.TFTransfoXLForSequenceClassification.call.example-2",$$slots:{default:[vh]},$$scope:{ctx:C}}}),xn=new nt({}),En=new ae({props:{name:"class transformers.AdaptiveEmbedding",anchor:"transformers.AdaptiveEmbedding",parameters:[{name:"n_token",val:""},{name:"d_embed",val:""},{name:"d_proj",val:""},{name:"cutoffs",val:""},{name:"div_val",val:" = 1"},{name:"sample_softmax",val:" = False"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/transfo_xl/modeling_transfo_xl.py#L399"}}),Cn=new ae({props:{name:"class transformers.TFAdaptiveEmbedding",anchor:"transformers.TFAdaptiveEmbedding",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py#L344"}}),{c(){d=n("meta"),b=c(),u=n("h1"),g=n("a"),v=n("span"),y(i.$$.fragment),m=c(),F=n("span"),B=a("Transformer XL"),re=c(),j=n("div"),U=n("a"),H=n("img"),he=c(),V=n("a"),me=n("img"),Y=c(),ee=n("h2"),le=n("a"),R=n("span"),y(de.$$.fragment),Ce=c(),G=n("span"),ze=a("Overview"),ke=c(),Z=n("p"),je=a("The Transformer-XL model was proposed in "),ce=n("a"),pe=a("Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context"),z=a(` by Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V. Le, Ruslan
Salakhutdinov. It\u2019s a causal (uni-directional) transformer with relative positioning (sinuso\xEFdal) embeddings which can
reuse previously computed hidden-states to attend to longer context (memory). This model also uses adaptive softmax
inputs and outputs (tied).`),N=c(),ue=n("p"),te=a("The abstract from the paper is the following:"),Le=c(),ge=n("p"),O=n("em"),Je=a(`Transformers have a potential of learning longer-term dependency, but are limited by a fixed-length context in the
setting of language modeling. We propose a novel neural architecture Transformer-XL that enables learning dependency
beyond a fixed length without disrupting temporal coherence. It consists of a segment-level recurrence mechanism and a
novel positional encoding scheme. Our method not only enables capturing longer-term dependency, but also resolves the
context fragmentation problem. As a result, Transformer-XL learns dependency that is 80% longer than RNNs and 450%
longer than vanilla Transformers, achieves better performance on both short and long sequences, and is up to 1,800+
times faster than vanilla Transformers during evaluation. Notably, we improve the state-of-the-art results of
bpc/perplexity to 0.99 on enwiki8, 1.08 on text8, 18.3 on WikiText-103, 21.8 on One Billion Word, and 54.5 on Penn
Treebank (without finetuning). When trained only on WikiText-103, Transformer-XL manages to generate reasonably
coherent, novel text articles with thousands of tokens.`),xe=c(),J=n("p"),Ie=a("Tips:"),Q=c(),S=n("ul"),Te=n("li"),oe=a(`Transformer-XL uses relative sinusoidal positional embeddings. Padding can be done on the left or on the right. The
original implementation trains on SQuAD with padding on the left, therefore the padding defaults are set to left.`),Ne=c(),ve=n("li"),A=a("Transformer-XL is one of the few models that has no sequence length limit."),qe=c(),D=n("li"),Ue=a("Same as a regular GPT model, but introduces a recurrence mechanism for two consecutive segments (similar to a regular RNNs with two consecutive inputs). In this context, a segment is a number of consecutive tokens (for instance 512) that may span across multiple documents, and segments are fed in order to the model."),_e=c(),I=n("li"),We=a("Basically, the hidden states of the previous segment are concatenated to the current input to compute the attention scores. This allows the model to pay attention to information that was in the previous segment as well as the current one. By stacking multiple attention layers, the receptive field can be increased to multiple previous segments."),W=c(),be=n("li"),Ze=a("This changes the positional embeddings to positional relative embeddings (as the regular positional embeddings would give the same results in the current input and the current hidden state at a given position) and needs to make some adjustments in the way attention scores are computed."),T=c(),X=n("p"),st=a("This model was contributed by "),K=n("a"),at=a("thomwolf"),rt=a(". The original code can be found "),E=n("a"),lt=a("here"),it=a("."),De=c(),y(ye.$$.fragment),Ye=c(),q=n("h2"),P=n("a"),Ae=n("span"),y(Xe.$$.fragment),ne=c(),Be=n("span"),dt=a("Documentation resources"),Ee=c(),we=n("ul"),ie=n("li"),Se=n("a"),vr=a("Text classification task guide"),br=c(),ms=n("li"),Nn=n("a"),yr=a("Causal language modeling task guide"),Ta=c(),$t=n("h2"),Gt=n("a"),ps=n("span"),y(Fo.$$.fragment),wr=c(),us=n("span"),Mr=a("TransfoXLConfig"),va=c(),Qe=n("div"),y(Co.$$.fragment),$r=c(),gt=n("p"),kr=a("This is the configuration class to store the configuration of a "),qn=n("a"),Lr=a("TransfoXLModel"),xr=a(" or a "),Un=n("a"),Xr=a("TFTransfoXLModel"),Er=a(`. It is
used to instantiate a Transformer-XL 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 TransfoXL
`),zo=n("a"),Fr=a("transfo-xl-wt103"),Cr=a(" architecture."),zr=c(),kt=n("p"),jr=a("Configuration objects inherit from "),Wn=n("a"),Jr=a("PretrainedConfig"),Ir=a(` and can be used to control the model outputs. Read the
documentation from `),Zn=n("a"),Nr=a("PretrainedConfig"),qr=a(" for more information."),Ur=c(),y(Ot.$$.fragment),ba=c(),Lt=n("h2"),Dt=n("a"),gs=n("span"),y(jo.$$.fragment),Wr=c(),_s=n("span"),Zr=a("TransfoXLTokenizer"),ya=c(),Ke=n("div"),y(Jo.$$.fragment),Sr=c(),Io=n("p"),Pr=a("Construct a Transformer-XL tokenizer adapted from Vocab class in "),No=n("a"),Hr=a(`the original
code`),Vr=a(`. The Transformer-XL tokenizer is a word-level tokenizer (no
sub-word tokenization).`),Ar=c(),qo=n("p"),Br=a("This tokenizer inherits from "),Sn=n("a"),Rr=a("PreTrainedTokenizer"),Gr=a(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Or=c(),Pn=n("div"),y(Uo.$$.fragment),wa=c(),xt=n("h2"),Yt=n("a"),Ts=n("span"),y(Wo.$$.fragment),Dr=c(),vs=n("span"),Yr=a("TransfoXL specific outputs"),Ma=c(),Xt=n("div"),y(Zo.$$.fragment),Qr=c(),bs=n("p"),Kr=a("Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),$a=c(),Et=n("div"),y(So.$$.fragment),el=c(),ys=n("p"),tl=a("Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),ka=c(),Ft=n("div"),y(Po.$$.fragment),ol=c(),ws=n("p"),nl=a("Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),La=c(),Ct=n("div"),y(Ho.$$.fragment),sl=c(),Ms=n("p"),al=a("Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),xa=c(),zt=n("h2"),Qt=n("a"),$s=n("span"),y(Vo.$$.fragment),rl=c(),ks=n("span"),ll=a("TransfoXLModel"),Xa=c(),Pe=n("div"),y(Ao.$$.fragment),il=c(),Ls=n("p"),dl=a("The bare Bert Model transformer outputting raw hidden-states without any specific head on top."),cl=c(),Bo=n("p"),fl=a("This model inherits from "),Hn=n("a"),hl=a("PreTrainedModel"),ml=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),pl=c(),Ro=n("p"),ul=a("This model is also a PyTorch "),Go=n("a"),gl=a("torch.nn.Module"),_l=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Tl=c(),ct=n("div"),y(Oo.$$.fragment),vl=c(),jt=n("p"),bl=a("The "),Vn=n("a"),yl=a("TransfoXLModel"),wl=a(" forward method, overrides the "),xs=n("code"),Ml=a("__call__"),$l=a(" special method."),kl=c(),y(Kt.$$.fragment),Ll=c(),y(eo.$$.fragment),Ea=c(),Jt=n("h2"),to=n("a"),Xs=n("span"),y(Do.$$.fragment),xl=c(),Es=n("span"),Xl=a("TransfoXLLMHeadModel"),Fa=c(),He=n("div"),y(Yo.$$.fragment),El=c(),Fs=n("p"),Fl=a(`The Transformer-XL Model with a language modeling head on top (adaptive softmax with weights tied to the adaptive
input embeddings)`),Cl=c(),Qo=n("p"),zl=a("This model inherits from "),An=n("a"),jl=a("PreTrainedModel"),Jl=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Il=c(),Ko=n("p"),Nl=a("This model is also a PyTorch "),en=n("a"),ql=a("torch.nn.Module"),Ul=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Wl=c(),ft=n("div"),y(tn.$$.fragment),Zl=c(),It=n("p"),Sl=a("The "),Bn=n("a"),Pl=a("TransfoXLLMHeadModel"),Hl=a(" forward method, overrides the "),Cs=n("code"),Vl=a("__call__"),Al=a(" special method."),Bl=c(),y(oo.$$.fragment),Rl=c(),y(no.$$.fragment),Ca=c(),Nt=n("h2"),so=n("a"),zs=n("span"),y(on.$$.fragment),Gl=c(),js=n("span"),Ol=a("TransfoXLForSequenceClassification"),za=c(),fe=n("div"),y(nn.$$.fragment),Dl=c(),Js=n("p"),Yl=a("The Transformer-XL Model transformer with a sequence classification head on top (linear layer)."),Ql=c(),Rn=n("p"),Gn=n("a"),Kl=a("TransfoXLForSequenceClassification"),ei=a(` uses the last token in order to do the classification, as other causal
models (e.g. GPT-1) do.`),ti=c(),et=n("p"),oi=a(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Is=n("code"),ni=a("pad_token_id"),si=a(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Ns=n("code"),ai=a("pad_token_id"),ri=a(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),qs=n("code"),li=a("inputs_embeds"),ii=a(" are passed instead of "),Us=n("code"),di=a("input_ids"),ci=a(`, it does the same (take the last value in
each row of the batch).`),fi=c(),sn=n("p"),hi=a("This model inherits from "),On=n("a"),mi=a("PreTrainedModel"),pi=a(`. 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.)`),ui=c(),an=n("p"),gi=a("This model is also a PyTorch "),rn=n("a"),_i=a("torch.nn.Module"),Ti=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),vi=c(),Re=n("div"),y(ln.$$.fragment),bi=c(),qt=n("p"),yi=a("The "),Dn=n("a"),wi=a("TransfoXLForSequenceClassification"),Mi=a(" forward method, overrides the "),Ws=n("code"),$i=a("__call__"),ki=a(" special method."),Li=c(),y(ao.$$.fragment),xi=c(),y(ro.$$.fragment),Xi=c(),y(lo.$$.fragment),ja=c(),Ut=n("h2"),io=n("a"),Zs=n("span"),y(dn.$$.fragment),Ei=c(),Ss=n("span"),Fi=a("TFTransfoXLModel"),Ja=c(),Me=n("div"),y(cn.$$.fragment),Ci=c(),Ps=n("p"),zi=a("The bare Bert Model transformer outputting raw hidden-states without any specific head on top."),ji=c(),fn=n("p"),Ji=a("This model inherits from "),Yn=n("a"),Ii=a("TFPreTrainedModel"),Ni=a(`. 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.)`),qi=c(),hn=n("p"),Ui=a("This model is also a "),mn=n("a"),Wi=a("tf.keras.Model"),Zi=a(` 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.`),Si=c(),y(co.$$.fragment),Pi=c(),ht=n("div"),y(pn.$$.fragment),Hi=c(),Wt=n("p"),Vi=a("The "),Qn=n("a"),Ai=a("TFTransfoXLModel"),Bi=a(" forward method, overrides the "),Hs=n("code"),Ri=a("__call__"),Gi=a(" special method."),Oi=c(),y(fo.$$.fragment),Di=c(),y(ho.$$.fragment),Ia=c(),Zt=n("h2"),mo=n("a"),Vs=n("span"),y(un.$$.fragment),Yi=c(),As=n("span"),Qi=a("TFTransfoXLLMHeadModel"),Na=c(),$e=n("div"),y(gn.$$.fragment),Ki=c(),Bs=n("p"),ed=a(`The Transformer-XL Model with a language modeling head on top (adaptive softmax with weights tied to the adaptive
input embeddings)`),td=c(),_n=n("p"),od=a("This model inherits from "),Kn=n("a"),nd=a("TFPreTrainedModel"),sd=a(`. 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=c(),Tn=n("p"),rd=a("This model is also a "),vn=n("a"),ld=a("tf.keras.Model"),id=a(` 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=c(),y(po.$$.fragment),cd=c(),mt=n("div"),y(bn.$$.fragment),fd=c(),St=n("p"),hd=a("The "),es=n("a"),md=a("TFTransfoXLLMHeadModel"),pd=a(" forward method, overrides the "),Rs=n("code"),ud=a("__call__"),gd=a(" special method."),_d=c(),y(uo.$$.fragment),Td=c(),y(go.$$.fragment),qa=c(),Pt=n("h2"),_o=n("a"),Gs=n("span"),y(yn.$$.fragment),vd=c(),Os=n("span"),bd=a("TFTransfoXLForSequenceClassification"),Ua=c(),se=n("div"),y(wn.$$.fragment),yd=c(),Ds=n("p"),wd=a("The Transfo XL Model transformer with a sequence classification head on top (linear layer)."),Md=c(),ts=n("p"),os=n("a"),$d=a("TFTransfoXLForSequenceClassification"),kd=a(` uses the last token in order to do the classification, as other causal
models (e.g. GPT-1,GPT-2) do.`),Ld=c(),tt=n("p"),xd=a(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Ys=n("code"),Xd=a("pad_token_id"),Ed=a(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Qs=n("code"),Fd=a("pad_token_id"),Cd=a(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ks=n("code"),zd=a("inputs_embeds"),jd=a(" are passed instead of "),ea=n("code"),Jd=a("input_ids"),Id=a(`, it does the same (take the last value in
each row of the batch).`),Nd=c(),Mn=n("p"),qd=a("This model inherits from "),ns=n("a"),Ud=a("TFPreTrainedModel"),Wd=a(`. 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.)`),Zd=c(),$n=n("p"),Sd=a("This model is also a "),kn=n("a"),Pd=a("tf.keras.Model"),Hd=a(` 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.`),Vd=c(),y(To.$$.fragment),Ad=c(),Ge=n("div"),y(Ln.$$.fragment),Bd=c(),Ht=n("p"),Rd=a("The "),ss=n("a"),Gd=a("TFTransfoXLForSequenceClassification"),Od=a(" forward method, overrides the "),ta=n("code"),Dd=a("__call__"),Yd=a(" special method."),Qd=c(),y(vo.$$.fragment),Kd=c(),y(bo.$$.fragment),ec=c(),y(yo.$$.fragment),Wa=c(),Vt=n("h2"),wo=n("a"),oa=n("span"),y(xn.$$.fragment),tc=c(),na=n("span"),oc=a("Internal Layers"),Za=c(),Xn=n("div"),y(En.$$.fragment),Sa=c(),Fn=n("div"),y(Cn.$$.fragment),this.h()},l(o){const _=Kf('[data-svelte="svelte-1phssyn"]',document.head);d=s(_,"META",{name:!0,content:!0}),_.forEach(t),b=f(o),u=s(o,"H1",{class:!0});var zn=l(u);g=s(zn,"A",{id:!0,class:!0,href:!0});var sa=l(g);v=s(sa,"SPAN",{});var aa=l(v);w(i.$$.fragment,aa),aa.forEach(t),sa.forEach(t),m=f(zn),F=s(zn,"SPAN",{});var ra=l(F);B=r(ra,"Transformer XL"),ra.forEach(t),zn.forEach(t),re=f(o),j=s(o,"DIV",{class:!0});var jn=l(j);U=s(jn,"A",{href:!0});var la=l(U);H=s(la,"IMG",{alt:!0,src:!0}),la.forEach(t),he=f(jn),V=s(jn,"A",{href:!0});var ia=l(V);me=s(ia,"IMG",{alt:!0,src:!0}),ia.forEach(t),jn.forEach(t),Y=f(o),ee=s(o,"H2",{class:!0});var Jn=l(ee);le=s(Jn,"A",{id:!0,class:!0,href:!0});var da=l(le);R=s(da,"SPAN",{});var ca=l(R);w(de.$$.fragment,ca),ca.forEach(t),da.forEach(t),Ce=f(Jn),G=s(Jn,"SPAN",{});var fa=l(G);ze=r(fa,"Overview"),fa.forEach(t),Jn.forEach(t),ke=f(o),Z=s(o,"P",{});var In=l(Z);je=r(In,"The Transformer-XL model was proposed in "),ce=s(In,"A",{href:!0,rel:!0});var ha=l(ce);pe=r(ha,"Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context"),ha.forEach(t),z=r(In,` by Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V. Le, Ruslan
Salakhutdinov. It\u2019s a causal (uni-directional) transformer with relative positioning (sinuso\xEFdal) embeddings which can
reuse previously computed hidden-states to attend to longer context (memory). This model also uses adaptive softmax
inputs and outputs (tied).`),In.forEach(t),N=f(o),ue=s(o,"P",{});var ma=l(ue);te=r(ma,"The abstract from the paper is the following:"),ma.forEach(t),Le=f(o),ge=s(o,"P",{});var pa=l(ge);O=s(pa,"EM",{});var ua=l(O);Je=r(ua,`Transformers have a potential of learning longer-term dependency, but are limited by a fixed-length context in the
setting of language modeling. We propose a novel neural architecture Transformer-XL that enables learning dependency
beyond a fixed length without disrupting temporal coherence. It consists of a segment-level recurrence mechanism and a
novel positional encoding scheme. Our method not only enables capturing longer-term dependency, but also resolves the
context fragmentation problem. As a result, Transformer-XL learns dependency that is 80% longer than RNNs and 450%
longer than vanilla Transformers, achieves better performance on both short and long sequences, and is up to 1,800+
times faster than vanilla Transformers during evaluation. Notably, we improve the state-of-the-art results of
bpc/perplexity to 0.99 on enwiki8, 1.08 on text8, 18.3 on WikiText-103, 21.8 on One Billion Word, and 54.5 on Penn
Treebank (without finetuning). When trained only on WikiText-103, Transformer-XL manages to generate reasonably
coherent, novel text articles with thousands of tokens.`),ua.forEach(t),pa.forEach(t),xe=f(o),J=s(o,"P",{});var ga=l(J);Ie=r(ga,"Tips:"),ga.forEach(t),Q=f(o),S=s(o,"UL",{});var ot=l(S);Te=s(ot,"LI",{});var _a=l(Te);oe=r(_a,`Transformer-XL uses relative sinusoidal positional embeddings. Padding can be done on the left or on the right. The
original implementation trains on SQuAD with padding on the left, therefore the padding defaults are set to left.`),_a.forEach(t),Ne=f(ot),ve=s(ot,"LI",{});var ac=l(ve);A=r(ac,"Transformer-XL is one of the few models that has no sequence length limit."),ac.forEach(t),qe=f(ot),D=s(ot,"LI",{});var rc=l(D);Ue=r(rc,"Same as a regular GPT model, but introduces a recurrence mechanism for two consecutive segments (similar to a regular RNNs with two consecutive inputs). In this context, a segment is a number of consecutive tokens (for instance 512) that may span across multiple documents, and segments are fed in order to the model."),rc.forEach(t),_e=f(ot),I=s(ot,"LI",{});var lc=l(I);We=r(lc,"Basically, the hidden states of the previous segment are concatenated to the current input to compute the attention scores. This allows the model to pay attention to information that was in the previous segment as well as the current one. By stacking multiple attention layers, the receptive field can be increased to multiple previous segments."),lc.forEach(t),W=f(ot),be=s(ot,"LI",{});var ic=l(be);Ze=r(ic,"This changes the positional embeddings to positional relative embeddings (as the regular positional embeddings would give the same results in the current input and the current hidden state at a given position) and needs to make some adjustments in the way attention scores are computed."),ic.forEach(t),ot.forEach(t),T=f(o),X=s(o,"P",{});var as=l(X);st=r(as,"This model was contributed by "),K=s(as,"A",{href:!0,rel:!0});var dc=l(K);at=r(dc,"thomwolf"),dc.forEach(t),rt=r(as,". The original code can be found "),E=s(as,"A",{href:!0,rel:!0});var cc=l(E);lt=r(cc,"here"),cc.forEach(t),it=r(as,"."),as.forEach(t),De=f(o),w(ye.$$.fragment,o),Ye=f(o),q=s(o,"H2",{class:!0});var Ha=l(q);P=s(Ha,"A",{id:!0,class:!0,href:!0});var fc=l(P);Ae=s(fc,"SPAN",{});var hc=l(Ae);w(Xe.$$.fragment,hc),hc.forEach(t),fc.forEach(t),ne=f(Ha),Be=s(Ha,"SPAN",{});var mc=l(Be);dt=r(mc,"Documentation resources"),mc.forEach(t),Ha.forEach(t),Ee=f(o),we=s(o,"UL",{});var Va=l(we);ie=s(Va,"LI",{});var pc=l(ie);Se=s(pc,"A",{href:!0});var uc=l(Se);vr=r(uc,"Text classification task guide"),uc.forEach(t),pc.forEach(t),br=f(Va),ms=s(Va,"LI",{});var gc=l(ms);Nn=s(gc,"A",{href:!0});var _c=l(Nn);yr=r(_c,"Causal language modeling task guide"),_c.forEach(t),gc.forEach(t),Va.forEach(t),Ta=f(o),$t=s(o,"H2",{class:!0});var Aa=l($t);Gt=s(Aa,"A",{id:!0,class:!0,href:!0});var Tc=l(Gt);ps=s(Tc,"SPAN",{});var vc=l(ps);w(Fo.$$.fragment,vc),vc.forEach(t),Tc.forEach(t),wr=f(Aa),us=s(Aa,"SPAN",{});var bc=l(us);Mr=r(bc,"TransfoXLConfig"),bc.forEach(t),Aa.forEach(t),va=f(o),Qe=s(o,"DIV",{class:!0});var Mo=l(Qe);w(Co.$$.fragment,Mo),$r=f(Mo),gt=s(Mo,"P",{});var $o=l(gt);kr=r($o,"This is the configuration class to store the configuration of a "),qn=s($o,"A",{href:!0});var yc=l(qn);Lr=r(yc,"TransfoXLModel"),yc.forEach(t),xr=r($o," or a "),Un=s($o,"A",{href:!0});var wc=l(Un);Xr=r(wc,"TFTransfoXLModel"),wc.forEach(t),Er=r($o,`. It is
used to instantiate a Transformer-XL 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 TransfoXL
`),zo=s($o,"A",{href:!0,rel:!0});var Mc=l(zo);Fr=r(Mc,"transfo-xl-wt103"),Mc.forEach(t),Cr=r($o," architecture."),$o.forEach(t),zr=f(Mo),kt=s(Mo,"P",{});var rs=l(kt);jr=r(rs,"Configuration objects inherit from "),Wn=s(rs,"A",{href:!0});var $c=l(Wn);Jr=r($c,"PretrainedConfig"),$c.forEach(t),Ir=r(rs,` and can be used to control the model outputs. Read the
documentation from `),Zn=s(rs,"A",{href:!0});var kc=l(Zn);Nr=r(kc,"PretrainedConfig"),kc.forEach(t),qr=r(rs," for more information."),rs.forEach(t),Ur=f(Mo),w(Ot.$$.fragment,Mo),Mo.forEach(t),ba=f(o),Lt=s(o,"H2",{class:!0});var Ba=l(Lt);Dt=s(Ba,"A",{id:!0,class:!0,href:!0});var Lc=l(Dt);gs=s(Lc,"SPAN",{});var xc=l(gs);w(jo.$$.fragment,xc),xc.forEach(t),Lc.forEach(t),Wr=f(Ba),_s=s(Ba,"SPAN",{});var Xc=l(_s);Zr=r(Xc,"TransfoXLTokenizer"),Xc.forEach(t),Ba.forEach(t),ya=f(o),Ke=s(o,"DIV",{class:!0});var ko=l(Ke);w(Jo.$$.fragment,ko),Sr=f(ko),Io=s(ko,"P",{});var Ra=l(Io);Pr=r(Ra,"Construct a Transformer-XL tokenizer adapted from Vocab class in "),No=s(Ra,"A",{href:!0,rel:!0});var Ec=l(No);Hr=r(Ec,`the original
code`),Ec.forEach(t),Vr=r(Ra,`. The Transformer-XL tokenizer is a word-level tokenizer (no
sub-word tokenization).`),Ra.forEach(t),Ar=f(ko),qo=s(ko,"P",{});var Ga=l(qo);Br=r(Ga,"This tokenizer inherits from "),Sn=s(Ga,"A",{href:!0});var Fc=l(Sn);Rr=r(Fc,"PreTrainedTokenizer"),Fc.forEach(t),Gr=r(Ga,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Ga.forEach(t),Or=f(ko),Pn=s(ko,"DIV",{class:!0});var Cc=l(Pn);w(Uo.$$.fragment,Cc),Cc.forEach(t),ko.forEach(t),wa=f(o),xt=s(o,"H2",{class:!0});var Oa=l(xt);Yt=s(Oa,"A",{id:!0,class:!0,href:!0});var zc=l(Yt);Ts=s(zc,"SPAN",{});var jc=l(Ts);w(Wo.$$.fragment,jc),jc.forEach(t),zc.forEach(t),Dr=f(Oa),vs=s(Oa,"SPAN",{});var Jc=l(vs);Yr=r(Jc,"TransfoXL specific outputs"),Jc.forEach(t),Oa.forEach(t),Ma=f(o),Xt=s(o,"DIV",{class:!0});var Da=l(Xt);w(Zo.$$.fragment,Da),Qr=f(Da),bs=s(Da,"P",{});var Ic=l(bs);Kr=r(Ic,"Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),Ic.forEach(t),Da.forEach(t),$a=f(o),Et=s(o,"DIV",{class:!0});var Ya=l(Et);w(So.$$.fragment,Ya),el=f(Ya),ys=s(Ya,"P",{});var Nc=l(ys);tl=r(Nc,"Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),Nc.forEach(t),Ya.forEach(t),ka=f(o),Ft=s(o,"DIV",{class:!0});var Qa=l(Ft);w(Po.$$.fragment,Qa),ol=f(Qa),ws=s(Qa,"P",{});var qc=l(ws);nl=r(qc,"Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),qc.forEach(t),Qa.forEach(t),La=f(o),Ct=s(o,"DIV",{class:!0});var Ka=l(Ct);w(Ho.$$.fragment,Ka),sl=f(Ka),Ms=s(Ka,"P",{});var Uc=l(Ms);al=r(Uc,"Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),Uc.forEach(t),Ka.forEach(t),xa=f(o),zt=s(o,"H2",{class:!0});var er=l(zt);Qt=s(er,"A",{id:!0,class:!0,href:!0});var Wc=l(Qt);$s=s(Wc,"SPAN",{});var Zc=l($s);w(Vo.$$.fragment,Zc),Zc.forEach(t),Wc.forEach(t),rl=f(er),ks=s(er,"SPAN",{});var Sc=l(ks);ll=r(Sc,"TransfoXLModel"),Sc.forEach(t),er.forEach(t),Xa=f(o),Pe=s(o,"DIV",{class:!0});var _t=l(Pe);w(Ao.$$.fragment,_t),il=f(_t),Ls=s(_t,"P",{});var Pc=l(Ls);dl=r(Pc,"The bare Bert Model transformer outputting raw hidden-states without any specific head on top."),Pc.forEach(t),cl=f(_t),Bo=s(_t,"P",{});var tr=l(Bo);fl=r(tr,"This model inherits from "),Hn=s(tr,"A",{href:!0});var Hc=l(Hn);hl=r(Hc,"PreTrainedModel"),Hc.forEach(t),ml=r(tr,`. 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.)`),tr.forEach(t),pl=f(_t),Ro=s(_t,"P",{});var or=l(Ro);ul=r(or,"This model is also a PyTorch "),Go=s(or,"A",{href:!0,rel:!0});var Vc=l(Go);gl=r(Vc,"torch.nn.Module"),Vc.forEach(t),_l=r(or,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),or.forEach(t),Tl=f(_t),ct=s(_t,"DIV",{class:!0});var Lo=l(ct);w(Oo.$$.fragment,Lo),vl=f(Lo),jt=s(Lo,"P",{});var ls=l(jt);bl=r(ls,"The "),Vn=s(ls,"A",{href:!0});var Ac=l(Vn);yl=r(Ac,"TransfoXLModel"),Ac.forEach(t),wl=r(ls," forward method, overrides the "),xs=s(ls,"CODE",{});var Bc=l(xs);Ml=r(Bc,"__call__"),Bc.forEach(t),$l=r(ls," special method."),ls.forEach(t),kl=f(Lo),w(Kt.$$.fragment,Lo),Ll=f(Lo),w(eo.$$.fragment,Lo),Lo.forEach(t),_t.forEach(t),Ea=f(o),Jt=s(o,"H2",{class:!0});var nr=l(Jt);to=s(nr,"A",{id:!0,class:!0,href:!0});var Rc=l(to);Xs=s(Rc,"SPAN",{});var Gc=l(Xs);w(Do.$$.fragment,Gc),Gc.forEach(t),Rc.forEach(t),xl=f(nr),Es=s(nr,"SPAN",{});var Oc=l(Es);Xl=r(Oc,"TransfoXLLMHeadModel"),Oc.forEach(t),nr.forEach(t),Fa=f(o),He=s(o,"DIV",{class:!0});var Tt=l(He);w(Yo.$$.fragment,Tt),El=f(Tt),Fs=s(Tt,"P",{});var Dc=l(Fs);Fl=r(Dc,`The Transformer-XL Model with a language modeling head on top (adaptive softmax with weights tied to the adaptive
input embeddings)`),Dc.forEach(t),Cl=f(Tt),Qo=s(Tt,"P",{});var sr=l(Qo);zl=r(sr,"This model inherits from "),An=s(sr,"A",{href:!0});var Yc=l(An);jl=r(Yc,"PreTrainedModel"),Yc.forEach(t),Jl=r(sr,`. 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.)`),sr.forEach(t),Il=f(Tt),Ko=s(Tt,"P",{});var ar=l(Ko);Nl=r(ar,"This model is also a PyTorch "),en=s(ar,"A",{href:!0,rel:!0});var Qc=l(en);ql=r(Qc,"torch.nn.Module"),Qc.forEach(t),Ul=r(ar,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ar.forEach(t),Wl=f(Tt),ft=s(Tt,"DIV",{class:!0});var xo=l(ft);w(tn.$$.fragment,xo),Zl=f(xo),It=s(xo,"P",{});var is=l(It);Sl=r(is,"The "),Bn=s(is,"A",{href:!0});var Kc=l(Bn);Pl=r(Kc,"TransfoXLLMHeadModel"),Kc.forEach(t),Hl=r(is," forward method, overrides the "),Cs=s(is,"CODE",{});var ef=l(Cs);Vl=r(ef,"__call__"),ef.forEach(t),Al=r(is," special method."),is.forEach(t),Bl=f(xo),w(oo.$$.fragment,xo),Rl=f(xo),w(no.$$.fragment,xo),xo.forEach(t),Tt.forEach(t),Ca=f(o),Nt=s(o,"H2",{class:!0});var rr=l(Nt);so=s(rr,"A",{id:!0,class:!0,href:!0});var tf=l(so);zs=s(tf,"SPAN",{});var of=l(zs);w(on.$$.fragment,of),of.forEach(t),tf.forEach(t),Gl=f(rr),js=s(rr,"SPAN",{});var nf=l(js);Ol=r(nf,"TransfoXLForSequenceClassification"),nf.forEach(t),rr.forEach(t),za=f(o),fe=s(o,"DIV",{class:!0});var Oe=l(fe);w(nn.$$.fragment,Oe),Dl=f(Oe),Js=s(Oe,"P",{});var sf=l(Js);Yl=r(sf,"The Transformer-XL Model transformer with a sequence classification head on top (linear layer)."),sf.forEach(t),Ql=f(Oe),Rn=s(Oe,"P",{});var nc=l(Rn);Gn=s(nc,"A",{href:!0});var af=l(Gn);Kl=r(af,"TransfoXLForSequenceClassification"),af.forEach(t),ei=r(nc,` uses the last token in order to do the classification, as other causal
models (e.g. GPT-1) do.`),nc.forEach(t),ti=f(Oe),et=s(Oe,"P",{});var vt=l(et);oi=r(vt,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Is=s(vt,"CODE",{});var rf=l(Is);ni=r(rf,"pad_token_id"),rf.forEach(t),si=r(vt,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Ns=s(vt,"CODE",{});var lf=l(Ns);ai=r(lf,"pad_token_id"),lf.forEach(t),ri=r(vt,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),qs=s(vt,"CODE",{});var df=l(qs);li=r(df,"inputs_embeds"),df.forEach(t),ii=r(vt," are passed instead of "),Us=s(vt,"CODE",{});var cf=l(Us);di=r(cf,"input_ids"),cf.forEach(t),ci=r(vt,`, it does the same (take the last value in
each row of the batch).`),vt.forEach(t),fi=f(Oe),sn=s(Oe,"P",{});var lr=l(sn);hi=r(lr,"This model inherits from "),On=s(lr,"A",{href:!0});var ff=l(On);mi=r(ff,"PreTrainedModel"),ff.forEach(t),pi=r(lr,`. 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.)`),lr.forEach(t),ui=f(Oe),an=s(Oe,"P",{});var ir=l(an);gi=r(ir,"This model is also a PyTorch "),rn=s(ir,"A",{href:!0,rel:!0});var hf=l(rn);_i=r(hf,"torch.nn.Module"),hf.forEach(t),Ti=r(ir,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ir.forEach(t),vi=f(Oe),Re=s(Oe,"DIV",{class:!0});var bt=l(Re);w(ln.$$.fragment,bt),bi=f(bt),qt=s(bt,"P",{});var ds=l(qt);yi=r(ds,"The "),Dn=s(ds,"A",{href:!0});var mf=l(Dn);wi=r(mf,"TransfoXLForSequenceClassification"),mf.forEach(t),Mi=r(ds," forward method, overrides the "),Ws=s(ds,"CODE",{});var pf=l(Ws);$i=r(pf,"__call__"),pf.forEach(t),ki=r(ds," special method."),ds.forEach(t),Li=f(bt),w(ao.$$.fragment,bt),xi=f(bt),w(ro.$$.fragment,bt),Xi=f(bt),w(lo.$$.fragment,bt),bt.forEach(t),Oe.forEach(t),ja=f(o),Ut=s(o,"H2",{class:!0});var dr=l(Ut);io=s(dr,"A",{id:!0,class:!0,href:!0});var uf=l(io);Zs=s(uf,"SPAN",{});var gf=l(Zs);w(dn.$$.fragment,gf),gf.forEach(t),uf.forEach(t),Ei=f(dr),Ss=s(dr,"SPAN",{});var _f=l(Ss);Fi=r(_f,"TFTransfoXLModel"),_f.forEach(t),dr.forEach(t),Ja=f(o),Me=s(o,"DIV",{class:!0});var pt=l(Me);w(cn.$$.fragment,pt),Ci=f(pt),Ps=s(pt,"P",{});var Tf=l(Ps);zi=r(Tf,"The bare Bert Model transformer outputting raw hidden-states without any specific head on top."),Tf.forEach(t),ji=f(pt),fn=s(pt,"P",{});var cr=l(fn);Ji=r(cr,"This model inherits from "),Yn=s(cr,"A",{href:!0});var vf=l(Yn);Ii=r(vf,"TFPreTrainedModel"),vf.forEach(t),Ni=r(cr,`. 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.)`),cr.forEach(t),qi=f(pt),hn=s(pt,"P",{});var fr=l(hn);Ui=r(fr,"This model is also a "),mn=s(fr,"A",{href:!0,rel:!0});var bf=l(mn);Wi=r(bf,"tf.keras.Model"),bf.forEach(t),Zi=r(fr,` 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.`),fr.forEach(t),Si=f(pt),w(co.$$.fragment,pt),Pi=f(pt),ht=s(pt,"DIV",{class:!0});var Xo=l(ht);w(pn.$$.fragment,Xo),Hi=f(Xo),Wt=s(Xo,"P",{});var cs=l(Wt);Vi=r(cs,"The "),Qn=s(cs,"A",{href:!0});var yf=l(Qn);Ai=r(yf,"TFTransfoXLModel"),yf.forEach(t),Bi=r(cs," forward method, overrides the "),Hs=s(cs,"CODE",{});var wf=l(Hs);Ri=r(wf,"__call__"),wf.forEach(t),Gi=r(cs," special method."),cs.forEach(t),Oi=f(Xo),w(fo.$$.fragment,Xo),Di=f(Xo),w(ho.$$.fragment,Xo),Xo.forEach(t),pt.forEach(t),Ia=f(o),Zt=s(o,"H2",{class:!0});var hr=l(Zt);mo=s(hr,"A",{id:!0,class:!0,href:!0});var Mf=l(mo);Vs=s(Mf,"SPAN",{});var $f=l(Vs);w(un.$$.fragment,$f),$f.forEach(t),Mf.forEach(t),Yi=f(hr),As=s(hr,"SPAN",{});var kf=l(As);Qi=r(kf,"TFTransfoXLLMHeadModel"),kf.forEach(t),hr.forEach(t),Na=f(o),$e=s(o,"DIV",{class:!0});var ut=l($e);w(gn.$$.fragment,ut),Ki=f(ut),Bs=s(ut,"P",{});var Lf=l(Bs);ed=r(Lf,`The Transformer-XL Model with a language modeling head on top (adaptive softmax with weights tied to the adaptive
input embeddings)`),Lf.forEach(t),td=f(ut),_n=s(ut,"P",{});var mr=l(_n);od=r(mr,"This model inherits from "),Kn=s(mr,"A",{href:!0});var xf=l(Kn);nd=r(xf,"TFPreTrainedModel"),xf.forEach(t),sd=r(mr,`. 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.)`),mr.forEach(t),ad=f(ut),Tn=s(ut,"P",{});var pr=l(Tn);rd=r(pr,"This model is also a "),vn=s(pr,"A",{href:!0,rel:!0});var Xf=l(vn);ld=r(Xf,"tf.keras.Model"),Xf.forEach(t),id=r(pr,` 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.`),pr.forEach(t),dd=f(ut),w(po.$$.fragment,ut),cd=f(ut),mt=s(ut,"DIV",{class:!0});var Eo=l(mt);w(bn.$$.fragment,Eo),fd=f(Eo),St=s(Eo,"P",{});var fs=l(St);hd=r(fs,"The "),es=s(fs,"A",{href:!0});var Ef=l(es);md=r(Ef,"TFTransfoXLLMHeadModel"),Ef.forEach(t),pd=r(fs," forward method, overrides the "),Rs=s(fs,"CODE",{});var Ff=l(Rs);ud=r(Ff,"__call__"),Ff.forEach(t),gd=r(fs," special method."),fs.forEach(t),_d=f(Eo),w(uo.$$.fragment,Eo),Td=f(Eo),w(go.$$.fragment,Eo),Eo.forEach(t),ut.forEach(t),qa=f(o),Pt=s(o,"H2",{class:!0});var ur=l(Pt);_o=s(ur,"A",{id:!0,class:!0,href:!0});var Cf=l(_o);Gs=s(Cf,"SPAN",{});var zf=l(Gs);w(yn.$$.fragment,zf),zf.forEach(t),Cf.forEach(t),vd=f(ur),Os=s(ur,"SPAN",{});var jf=l(Os);bd=r(jf,"TFTransfoXLForSequenceClassification"),jf.forEach(t),ur.forEach(t),Ua=f(o),se=s(o,"DIV",{class:!0});var Fe=l(se);w(wn.$$.fragment,Fe),yd=f(Fe),Ds=s(Fe,"P",{});var Jf=l(Ds);wd=r(Jf,"The Transfo XL Model transformer with a sequence classification head on top (linear layer)."),Jf.forEach(t),Md=f(Fe),ts=s(Fe,"P",{});var sc=l(ts);os=s(sc,"A",{href:!0});var If=l(os);$d=r(If,"TFTransfoXLForSequenceClassification"),If.forEach(t),kd=r(sc,` uses the last token in order to do the classification, as other causal
models (e.g. GPT-1,GPT-2) do.`),sc.forEach(t),Ld=f(Fe),tt=s(Fe,"P",{});var yt=l(tt);xd=r(yt,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Ys=s(yt,"CODE",{});var Nf=l(Ys);Xd=r(Nf,"pad_token_id"),Nf.forEach(t),Ed=r(yt,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Qs=s(yt,"CODE",{});var qf=l(Qs);Fd=r(qf,"pad_token_id"),qf.forEach(t),Cd=r(yt,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ks=s(yt,"CODE",{});var Uf=l(Ks);zd=r(Uf,"inputs_embeds"),Uf.forEach(t),jd=r(yt," are passed instead of "),ea=s(yt,"CODE",{});var Wf=l(ea);Jd=r(Wf,"input_ids"),Wf.forEach(t),Id=r(yt,`, it does the same (take the last value in
each row of the batch).`),yt.forEach(t),Nd=f(Fe),Mn=s(Fe,"P",{});var gr=l(Mn);qd=r(gr,"This model inherits from "),ns=s(gr,"A",{href:!0});var Zf=l(ns);Ud=r(Zf,"TFPreTrainedModel"),Zf.forEach(t),Wd=r(gr,`. 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.)`),gr.forEach(t),Zd=f(Fe),$n=s(Fe,"P",{});var _r=l($n);Sd=r(_r,"This model is also a "),kn=s(_r,"A",{href:!0,rel:!0});var Sf=l(kn);Pd=r(Sf,"tf.keras.Model"),Sf.forEach(t),Hd=r(_r,` 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.`),_r.forEach(t),Vd=f(Fe),w(To.$$.fragment,Fe),Ad=f(Fe),Ge=s(Fe,"DIV",{class:!0});var wt=l(Ge);w(Ln.$$.fragment,wt),Bd=f(wt),Ht=s(wt,"P",{});var hs=l(Ht);Rd=r(hs,"The "),ss=s(hs,"A",{href:!0});var Pf=l(ss);Gd=r(Pf,"TFTransfoXLForSequenceClassification"),Pf.forEach(t),Od=r(hs," forward method, overrides the "),ta=s(hs,"CODE",{});var Hf=l(ta);Dd=r(Hf,"__call__"),Hf.forEach(t),Yd=r(hs," special method."),hs.forEach(t),Qd=f(wt),w(vo.$$.fragment,wt),Kd=f(wt),w(bo.$$.fragment,wt),ec=f(wt),w(yo.$$.fragment,wt),wt.forEach(t),Fe.forEach(t),Wa=f(o),Vt=s(o,"H2",{class:!0});var Tr=l(Vt);wo=s(Tr,"A",{id:!0,class:!0,href:!0});var Vf=l(wo);oa=s(Vf,"SPAN",{});var Af=l(oa);w(xn.$$.fragment,Af),Af.forEach(t),Vf.forEach(t),tc=f(Tr),na=s(Tr,"SPAN",{});var Bf=l(na);oc=r(Bf,"Internal Layers"),Bf.forEach(t),Tr.forEach(t),Za=f(o),Xn=s(o,"DIV",{class:!0});var Rf=l(Xn);w(En.$$.fragment,Rf),Rf.forEach(t),Sa=f(o),Fn=s(o,"DIV",{class:!0});var Gf=l(Fn);w(Cn.$$.fragment,Gf),Gf.forEach(t),this.h()},h(){h(d,"name","hf:doc:metadata"),h(d,"content",JSON.stringify(yh)),h(g,"id","transformer-xl"),h(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(g,"href","#transformer-xl"),h(u,"class","relative group"),h(H,"alt","Models"),Of(H.src,x="https://img.shields.io/badge/All_model_pages-transfo--xl-blueviolet")||h(H,"src",x),h(U,"href","https://huggingface.co/models?filter=transfo-xl"),h(me,"alt","Spaces"),Of(me.src,Ve="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue")||h(me,"src",Ve),h(V,"href","https://huggingface.co/spaces/docs-demos/transfo-xl-wt103"),h(j,"class","flex flex-wrap space-x-1"),h(le,"id","overview"),h(le,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(le,"href","#overview"),h(ee,"class","relative group"),h(ce,"href","https://arxiv.org/abs/1901.02860"),h(ce,"rel","nofollow"),h(K,"href","https://huggingface.co/thomwolf"),h(K,"rel","nofollow"),h(E,"href","https://github.com/kimiyoung/transformer-xl"),h(E,"rel","nofollow"),h(P,"id","documentation-resources"),h(P,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(P,"href","#documentation-resources"),h(q,"class","relative group"),h(Se,"href","../tasks/sequence_classification"),h(Nn,"href","../tasks/language_modeling"),h(Gt,"id","transformers.TransfoXLConfig"),h(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"),h(Gt,"href","#transformers.TransfoXLConfig"),h($t,"class","relative group"),h(qn,"href","/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TransfoXLModel"),h(Un,"href","/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TFTransfoXLModel"),h(zo,"href","https://huggingface.co/transfo-xl-wt103"),h(zo,"rel","nofollow"),h(Wn,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(Zn,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(Qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Dt,"id","transformers.TransfoXLTokenizer"),h(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"),h(Dt,"href","#transformers.TransfoXLTokenizer"),h(Lt,"class","relative group"),h(No,"href","https://github.com/kimiyoung/transformer-xl"),h(No,"rel","nofollow"),h(Sn,"href","/docs/transformers/v4.31.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),h(Pn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Yt,"id","transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput"),h(Yt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Yt,"href","#transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput"),h(xt,"class","relative group"),h(Xt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Qt,"id","transformers.TransfoXLModel"),h(Qt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Qt,"href","#transformers.TransfoXLModel"),h(zt,"class","relative group"),h(Hn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),h(Go,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Go,"rel","nofollow"),h(Vn,"href","/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TransfoXLModel"),h(ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(to,"id","transformers.TransfoXLLMHeadModel"),h(to,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(to,"href","#transformers.TransfoXLLMHeadModel"),h(Jt,"class","relative group"),h(An,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),h(en,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(en,"rel","nofollow"),h(Bn,"href","/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TransfoXLLMHeadModel"),h(ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(He,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(so,"id","transformers.TransfoXLForSequenceClassification"),h(so,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(so,"href","#transformers.TransfoXLForSequenceClassification"),h(Nt,"class","relative group"),h(Gn,"href","/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TransfoXLForSequenceClassification"),h(On,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),h(rn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(rn,"rel","nofollow"),h(Dn,"href","/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TransfoXLForSequenceClassification"),h(Re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(io,"id","transformers.TFTransfoXLModel"),h(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"),h(io,"href","#transformers.TFTransfoXLModel"),h(Ut,"class","relative group"),h(Yn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),h(mn,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(mn,"rel","nofollow"),h(Qn,"href","/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TFTransfoXLModel"),h(ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(mo,"id","transformers.TFTransfoXLLMHeadModel"),h(mo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(mo,"href","#transformers.TFTransfoXLLMHeadModel"),h(Zt,"class","relative group"),h(Kn,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),h(vn,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(vn,"rel","nofollow"),h(es,"href","/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TFTransfoXLLMHeadModel"),h(mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(_o,"id","transformers.TFTransfoXLForSequenceClassification"),h(_o,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(_o,"href","#transformers.TFTransfoXLForSequenceClassification"),h(Pt,"class","relative group"),h(os,"href","/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TFTransfoXLForSequenceClassification"),h(ns,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),h(kn,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(kn,"rel","nofollow"),h(ss,"href","/docs/transformers/v4.31.0/en/model_doc/transfo-xl#transformers.TFTransfoXLForSequenceClassification"),h(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(wo,"id","transformers.AdaptiveEmbedding"),h(wo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(wo,"href","#transformers.AdaptiveEmbedding"),h(Vt,"class","relative group"),h(Xn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Fn,"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),p(o,b,_),p(o,u,_),e(u,g),e(g,v),M(i,v,null),e(u,m),e(u,F),e(F,B),p(o,re,_),p(o,j,_),e(j,U),e(U,H),e(j,he),e(j,V),e(V,me),p(o,Y,_),p(o,ee,_),e(ee,le),e(le,R),M(de,R,null),e(ee,Ce),e(ee,G),e(G,ze),p(o,ke,_),p(o,Z,_),e(Z,je),e(Z,ce),e(ce,pe),e(Z,z),p(o,N,_),p(o,ue,_),e(ue,te),p(o,Le,_),p(o,ge,_),e(ge,O),e(O,Je),p(o,xe,_),p(o,J,_),e(J,Ie),p(o,Q,_),p(o,S,_),e(S,Te),e(Te,oe),e(S,Ne),e(S,ve),e(ve,A),e(S,qe),e(S,D),e(D,Ue),e(S,_e),e(S,I),e(I,We),e(S,W),e(S,be),e(be,Ze),p(o,T,_),p(o,X,_),e(X,st),e(X,K),e(K,at),e(X,rt),e(X,E),e(E,lt),e(X,it),p(o,De,_),M(ye,o,_),p(o,Ye,_),p(o,q,_),e(q,P),e(P,Ae),M(Xe,Ae,null),e(q,ne),e(q,Be),e(Be,dt),p(o,Ee,_),p(o,we,_),e(we,ie),e(ie,Se),e(Se,vr),e(we,br),e(we,ms),e(ms,Nn),e(Nn,yr),p(o,Ta,_),p(o,$t,_),e($t,Gt),e(Gt,ps),M(Fo,ps,null),e($t,wr),e($t,us),e(us,Mr),p(o,va,_),p(o,Qe,_),M(Co,Qe,null),e(Qe,$r),e(Qe,gt),e(gt,kr),e(gt,qn),e(qn,Lr),e(gt,xr),e(gt,Un),e(Un,Xr),e(gt,Er),e(gt,zo),e(zo,Fr),e(gt,Cr),e(Qe,zr),e(Qe,kt),e(kt,jr),e(kt,Wn),e(Wn,Jr),e(kt,Ir),e(kt,Zn),e(Zn,Nr),e(kt,qr),e(Qe,Ur),M(Ot,Qe,null),p(o,ba,_),p(o,Lt,_),e(Lt,Dt),e(Dt,gs),M(jo,gs,null),e(Lt,Wr),e(Lt,_s),e(_s,Zr),p(o,ya,_),p(o,Ke,_),M(Jo,Ke,null),e(Ke,Sr),e(Ke,Io),e(Io,Pr),e(Io,No),e(No,Hr),e(Io,Vr),e(Ke,Ar),e(Ke,qo),e(qo,Br),e(qo,Sn),e(Sn,Rr),e(qo,Gr),e(Ke,Or),e(Ke,Pn),M(Uo,Pn,null),p(o,wa,_),p(o,xt,_),e(xt,Yt),e(Yt,Ts),M(Wo,Ts,null),e(xt,Dr),e(xt,vs),e(vs,Yr),p(o,Ma,_),p(o,Xt,_),M(Zo,Xt,null),e(Xt,Qr),e(Xt,bs),e(bs,Kr),p(o,$a,_),p(o,Et,_),M(So,Et,null),e(Et,el),e(Et,ys),e(ys,tl),p(o,ka,_),p(o,Ft,_),M(Po,Ft,null),e(Ft,ol),e(Ft,ws),e(ws,nl),p(o,La,_),p(o,Ct,_),M(Ho,Ct,null),e(Ct,sl),e(Ct,Ms),e(Ms,al),p(o,xa,_),p(o,zt,_),e(zt,Qt),e(Qt,$s),M(Vo,$s,null),e(zt,rl),e(zt,ks),e(ks,ll),p(o,Xa,_),p(o,Pe,_),M(Ao,Pe,null),e(Pe,il),e(Pe,Ls),e(Ls,dl),e(Pe,cl),e(Pe,Bo),e(Bo,fl),e(Bo,Hn),e(Hn,hl),e(Bo,ml),e(Pe,pl),e(Pe,Ro),e(Ro,ul),e(Ro,Go),e(Go,gl),e(Ro,_l),e(Pe,Tl),e(Pe,ct),M(Oo,ct,null),e(ct,vl),e(ct,jt),e(jt,bl),e(jt,Vn),e(Vn,yl),e(jt,wl),e(jt,xs),e(xs,Ml),e(jt,$l),e(ct,kl),M(Kt,ct,null),e(ct,Ll),M(eo,ct,null),p(o,Ea,_),p(o,Jt,_),e(Jt,to),e(to,Xs),M(Do,Xs,null),e(Jt,xl),e(Jt,Es),e(Es,Xl),p(o,Fa,_),p(o,He,_),M(Yo,He,null),e(He,El),e(He,Fs),e(Fs,Fl),e(He,Cl),e(He,Qo),e(Qo,zl),e(Qo,An),e(An,jl),e(Qo,Jl),e(He,Il),e(He,Ko),e(Ko,Nl),e(Ko,en),e(en,ql),e(Ko,Ul),e(He,Wl),e(He,ft),M(tn,ft,null),e(ft,Zl),e(ft,It),e(It,Sl),e(It,Bn),e(Bn,Pl),e(It,Hl),e(It,Cs),e(Cs,Vl),e(It,Al),e(ft,Bl),M(oo,ft,null),e(ft,Rl),M(no,ft,null),p(o,Ca,_),p(o,Nt,_),e(Nt,so),e(so,zs),M(on,zs,null),e(Nt,Gl),e(Nt,js),e(js,Ol),p(o,za,_),p(o,fe,_),M(nn,fe,null),e(fe,Dl),e(fe,Js),e(Js,Yl),e(fe,Ql),e(fe,Rn),e(Rn,Gn),e(Gn,Kl),e(Rn,ei),e(fe,ti),e(fe,et),e(et,oi),e(et,Is),e(Is,ni),e(et,si),e(et,Ns),e(Ns,ai),e(et,ri),e(et,qs),e(qs,li),e(et,ii),e(et,Us),e(Us,di),e(et,ci),e(fe,fi),e(fe,sn),e(sn,hi),e(sn,On),e(On,mi),e(sn,pi),e(fe,ui),e(fe,an),e(an,gi),e(an,rn),e(rn,_i),e(an,Ti),e(fe,vi),e(fe,Re),M(ln,Re,null),e(Re,bi),e(Re,qt),e(qt,yi),e(qt,Dn),e(Dn,wi),e(qt,Mi),e(qt,Ws),e(Ws,$i),e(qt,ki),e(Re,Li),M(ao,Re,null),e(Re,xi),M(ro,Re,null),e(Re,Xi),M(lo,Re,null),p(o,ja,_),p(o,Ut,_),e(Ut,io),e(io,Zs),M(dn,Zs,null),e(Ut,Ei),e(Ut,Ss),e(Ss,Fi),p(o,Ja,_),p(o,Me,_),M(cn,Me,null),e(Me,Ci),e(Me,Ps),e(Ps,zi),e(Me,ji),e(Me,fn),e(fn,Ji),e(fn,Yn),e(Yn,Ii),e(fn,Ni),e(Me,qi),e(Me,hn),e(hn,Ui),e(hn,mn),e(mn,Wi),e(hn,Zi),e(Me,Si),M(co,Me,null),e(Me,Pi),e(Me,ht),M(pn,ht,null),e(ht,Hi),e(ht,Wt),e(Wt,Vi),e(Wt,Qn),e(Qn,Ai),e(Wt,Bi),e(Wt,Hs),e(Hs,Ri),e(Wt,Gi),e(ht,Oi),M(fo,ht,null),e(ht,Di),M(ho,ht,null),p(o,Ia,_),p(o,Zt,_),e(Zt,mo),e(mo,Vs),M(un,Vs,null),e(Zt,Yi),e(Zt,As),e(As,Qi),p(o,Na,_),p(o,$e,_),M(gn,$e,null),e($e,Ki),e($e,Bs),e(Bs,ed),e($e,td),e($e,_n),e(_n,od),e(_n,Kn),e(Kn,nd),e(_n,sd),e($e,ad),e($e,Tn),e(Tn,rd),e(Tn,vn),e(vn,ld),e(Tn,id),e($e,dd),M(po,$e,null),e($e,cd),e($e,mt),M(bn,mt,null),e(mt,fd),e(mt,St),e(St,hd),e(St,es),e(es,md),e(St,pd),e(St,Rs),e(Rs,ud),e(St,gd),e(mt,_d),M(uo,mt,null),e(mt,Td),M(go,mt,null),p(o,qa,_),p(o,Pt,_),e(Pt,_o),e(_o,Gs),M(yn,Gs,null),e(Pt,vd),e(Pt,Os),e(Os,bd),p(o,Ua,_),p(o,se,_),M(wn,se,null),e(se,yd),e(se,Ds),e(Ds,wd),e(se,Md),e(se,ts),e(ts,os),e(os,$d),e(ts,kd),e(se,Ld),e(se,tt),e(tt,xd),e(tt,Ys),e(Ys,Xd),e(tt,Ed),e(tt,Qs),e(Qs,Fd),e(tt,Cd),e(tt,Ks),e(Ks,zd),e(tt,jd),e(tt,ea),e(ea,Jd),e(tt,Id),e(se,Nd),e(se,Mn),e(Mn,qd),e(Mn,ns),e(ns,Ud),e(Mn,Wd),e(se,Zd),e(se,$n),e($n,Sd),e($n,kn),e(kn,Pd),e($n,Hd),e(se,Vd),M(To,se,null),e(se,Ad),e(se,Ge),M(Ln,Ge,null),e(Ge,Bd),e(Ge,Ht),e(Ht,Rd),e(Ht,ss),e(ss,Gd),e(Ht,Od),e(Ht,ta),e(ta,Dd),e(Ht,Yd),e(Ge,Qd),M(vo,Ge,null),e(Ge,Kd),M(bo,Ge,null),e(Ge,ec),M(yo,Ge,null),p(o,Wa,_),p(o,Vt,_),e(Vt,wo),e(wo,oa),M(xn,oa,null),e(Vt,tc),e(Vt,na),e(na,oc),p(o,Za,_),p(o,Xn,_),M(En,Xn,null),p(o,Sa,_),p(o,Fn,_),M(Cn,Fn,null),Pa=!0},p(o,[_]){const zn={};_&2&&(zn.$$scope={dirty:_,ctx:o}),ye.$set(zn);const sa={};_&2&&(sa.$$scope={dirty:_,ctx:o}),Ot.$set(sa);const aa={};_&2&&(aa.$$scope={dirty:_,ctx:o}),Kt.$set(aa);const ra={};_&2&&(ra.$$scope={dirty:_,ctx:o}),eo.$set(ra);const jn={};_&2&&(jn.$$scope={dirty:_,ctx:o}),oo.$set(jn);const la={};_&2&&(la.$$scope={dirty:_,ctx:o}),no.$set(la);const ia={};_&2&&(ia.$$scope={dirty:_,ctx:o}),ao.$set(ia);const Jn={};_&2&&(Jn.$$scope={dirty:_,ctx:o}),ro.$set(Jn);const da={};_&2&&(da.$$scope={dirty:_,ctx:o}),lo.$set(da);const ca={};_&2&&(ca.$$scope={dirty:_,ctx:o}),co.$set(ca);const fa={};_&2&&(fa.$$scope={dirty:_,ctx:o}),fo.$set(fa);const In={};_&2&&(In.$$scope={dirty:_,ctx:o}),ho.$set(In);const ha={};_&2&&(ha.$$scope={dirty:_,ctx:o}),po.$set(ha);const ma={};_&2&&(ma.$$scope={dirty:_,ctx:o}),uo.$set(ma);const pa={};_&2&&(pa.$$scope={dirty:_,ctx:o}),go.$set(pa);const ua={};_&2&&(ua.$$scope={dirty:_,ctx:o}),To.$set(ua);const ga={};_&2&&(ga.$$scope={dirty:_,ctx:o}),vo.$set(ga);const ot={};_&2&&(ot.$$scope={dirty:_,ctx:o}),bo.$set(ot);const _a={};_&2&&(_a.$$scope={dirty:_,ctx:o}),yo.$set(_a)},i(o){Pa||($(i.$$.fragment,o),$(de.$$.fragment,o),$(ye.$$.fragment,o),$(Xe.$$.fragment,o),$(Fo.$$.fragment,o),$(Co.$$.fragment,o),$(Ot.$$.fragment,o),$(jo.$$.fragment,o),$(Jo.$$.fragment,o),$(Uo.$$.fragment,o),$(Wo.$$.fragment,o),$(Zo.$$.fragment,o),$(So.$$.fragment,o),$(Po.$$.fragment,o),$(Ho.$$.fragment,o),$(Vo.$$.fragment,o),$(Ao.$$.fragment,o),$(Oo.$$.fragment,o),$(Kt.$$.fragment,o),$(eo.$$.fragment,o),$(Do.$$.fragment,o),$(Yo.$$.fragment,o),$(tn.$$.fragment,o),$(oo.$$.fragment,o),$(no.$$.fragment,o),$(on.$$.fragment,o),$(nn.$$.fragment,o),$(ln.$$.fragment,o),$(ao.$$.fragment,o),$(ro.$$.fragment,o),$(lo.$$.fragment,o),$(dn.$$.fragment,o),$(cn.$$.fragment,o),$(co.$$.fragment,o),$(pn.$$.fragment,o),$(fo.$$.fragment,o),$(ho.$$.fragment,o),$(un.$$.fragment,o),$(gn.$$.fragment,o),$(po.$$.fragment,o),$(bn.$$.fragment,o),$(uo.$$.fragment,o),$(go.$$.fragment,o),$(yn.$$.fragment,o),$(wn.$$.fragment,o),$(To.$$.fragment,o),$(Ln.$$.fragment,o),$(vo.$$.fragment,o),$(bo.$$.fragment,o),$(yo.$$.fragment,o),$(xn.$$.fragment,o),$(En.$$.fragment,o),$(Cn.$$.fragment,o),Pa=!0)},o(o){k(i.$$.fragment,o),k(de.$$.fragment,o),k(ye.$$.fragment,o),k(Xe.$$.fragment,o),k(Fo.$$.fragment,o),k(Co.$$.fragment,o),k(Ot.$$.fragment,o),k(jo.$$.fragment,o),k(Jo.$$.fragment,o),k(Uo.$$.fragment,o),k(Wo.$$.fragment,o),k(Zo.$$.fragment,o),k(So.$$.fragment,o),k(Po.$$.fragment,o),k(Ho.$$.fragment,o),k(Vo.$$.fragment,o),k(Ao.$$.fragment,o),k(Oo.$$.fragment,o),k(Kt.$$.fragment,o),k(eo.$$.fragment,o),k(Do.$$.fragment,o),k(Yo.$$.fragment,o),k(tn.$$.fragment,o),k(oo.$$.fragment,o),k(no.$$.fragment,o),k(on.$$.fragment,o),k(nn.$$.fragment,o),k(ln.$$.fragment,o),k(ao.$$.fragment,o),k(ro.$$.fragment,o),k(lo.$$.fragment,o),k(dn.$$.fragment,o),k(cn.$$.fragment,o),k(co.$$.fragment,o),k(pn.$$.fragment,o),k(fo.$$.fragment,o),k(ho.$$.fragment,o),k(un.$$.fragment,o),k(gn.$$.fragment,o),k(po.$$.fragment,o),k(bn.$$.fragment,o),k(uo.$$.fragment,o),k(go.$$.fragment,o),k(yn.$$.fragment,o),k(wn.$$.fragment,o),k(To.$$.fragment,o),k(Ln.$$.fragment,o),k(vo.$$.fragment,o),k(bo.$$.fragment,o),k(yo.$$.fragment,o),k(xn.$$.fragment,o),k(En.$$.fragment,o),k(Cn.$$.fragment,o),Pa=!1},d(o){t(d),o&&t(b),o&&t(u),L(i),o&&t(re),o&&t(j),o&&t(Y),o&&t(ee),L(de),o&&t(ke),o&&t(Z),o&&t(N),o&&t(ue),o&&t(Le),o&&t(ge),o&&t(xe),o&&t(J),o&&t(Q),o&&t(S),o&&t(T),o&&t(X),o&&t(De),L(ye,o),o&&t(Ye),o&&t(q),L(Xe),o&&t(Ee),o&&t(we),o&&t(Ta),o&&t($t),L(Fo),o&&t(va),o&&t(Qe),L(Co),L(Ot),o&&t(ba),o&&t(Lt),L(jo),o&&t(ya),o&&t(Ke),L(Jo),L(Uo),o&&t(wa),o&&t(xt),L(Wo),o&&t(Ma),o&&t(Xt),L(Zo),o&&t($a),o&&t(Et),L(So),o&&t(ka),o&&t(Ft),L(Po),o&&t(La),o&&t(Ct),L(Ho),o&&t(xa),o&&t(zt),L(Vo),o&&t(Xa),o&&t(Pe),L(Ao),L(Oo),L(Kt),L(eo),o&&t(Ea),o&&t(Jt),L(Do),o&&t(Fa),o&&t(He),L(Yo),L(tn),L(oo),L(no),o&&t(Ca),o&&t(Nt),L(on),o&&t(za),o&&t(fe),L(nn),L(ln),L(ao),L(ro),L(lo),o&&t(ja),o&&t(Ut),L(dn),o&&t(Ja),o&&t(Me),L(cn),L(co),L(pn),L(fo),L(ho),o&&t(Ia),o&&t(Zt),L(un),o&&t(Na),o&&t($e),L(gn),L(po),L(bn),L(uo),L(go),o&&t(qa),o&&t(Pt),L(yn),o&&t(Ua),o&&t(se),L(wn),L(To),L(Ln),L(vo),L(bo),L(yo),o&&t(Wa),o&&t(Vt),L(xn),o&&t(Za),o&&t(Xn),L(En),o&&t(Sa),o&&t(Fn),L(Cn)}}}const yh={local:"transformer-xl",sections:[{local:"overview",title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.TransfoXLConfig",title:"TransfoXLConfig"},{local:"transformers.TransfoXLTokenizer",title:"TransfoXLTokenizer"},{local:"transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput",title:"TransfoXL specific outputs"},{local:"transformers.TransfoXLModel",title:"TransfoXLModel"},{local:"transformers.TransfoXLLMHeadModel",title:"TransfoXLLMHeadModel"},{local:"transformers.TransfoXLForSequenceClassification",title:"TransfoXLForSequenceClassification"},{local:"transformers.TFTransfoXLModel",title:"TFTransfoXLModel"},{local:"transformers.TFTransfoXLLMHeadModel",title:"TFTransfoXLLMHeadModel"},{local:"transformers.TFTransfoXLForSequenceClassification",title:"TFTransfoXLForSequenceClassification"},{local:"transformers.AdaptiveEmbedding",title:"Internal Layers"}],title:"Transformer XL"};function wh(C){return eh(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Eh extends Df{constructor(d){super();Yf(this,d,wh,bh,Qf,{})}}export{Eh as default,yh as metadata};
