import{S as Yf,i as Qf,s as Zf,e as n,k as c,w as y,t as a,M as Jf,c as s,d as t,m as f,a as i,x as w,h as r,b as p,N as Gf,G as e,g as m,y as k,q as $,o as L,B as x,v as ep,L as Kt}from"../../chunks/vendor-hf-doc-builder.js";import{T as kt}from"../../chunks/Tip-hf-doc-builder.js";import{D as ae}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Vt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as nt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ut}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function tp(q){let d,b,u,g,v,l,h,F,K,re;return{c(){d=n("p"),b=a("TransformerXL does "),u=n("strong"),g=a("not"),v=a(" work with "),l=n("em"),h=a("torch.nn.DataParallel"),F=a(" due to a bug in PyTorch, see "),K=n("a"),re=a("issue #36035"),this.h()},l(z){d=s(z,"P",{});var S=i(d);b=r(S,"TransformerXL does "),u=s(S,"STRONG",{});var B=i(u);g=r(B,"not"),B.forEach(t),v=r(S," work with "),l=s(S,"EM",{});var M=i(l);h=r(M,"torch.nn.DataParallel"),M.forEach(t),F=r(S," due to a bug in PyTorch, see "),K=s(S,"A",{href:!0,rel:!0});var pe=i(K);re=r(pe,"issue #36035"),pe.forEach(t),S.forEach(t),this.h()},h(){p(K,"href","https://github.com/pytorch/pytorch/issues/36035"),p(K,"rel","nofollow")},m(z,S){m(z,d,S),e(d,b),e(d,u),e(u,g),e(d,v),e(d,l),e(l,h),e(d,F),e(d,K),e(K,re)},d(z){z&&t(d)}}}function op(q){let d,b,u,g,v;return g=new Vt({props:{code:`from transformers import TransfoXLConfig, TransfoXLModel

# Initializing a Transformer XL configuration
configuration = TransfoXLConfig()

# Initializing a model (with random weights) from the configuration
model = TransfoXLModel(configuration)

# Accessing the model configuration
configuration = model.config`,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(l){d=s(l,"P",{});var h=i(d);b=r(h,"Examples:"),h.forEach(t),u=f(l),w(g.$$.fragment,l)},m(l,h){m(l,d,h),e(d,b),m(l,u,h),k(g,l,h),v=!0},p:Kt,i(l){v||($(g.$$.fragment,l),v=!0)},o(l){L(g.$$.fragment,l),v=!1},d(l){l&&t(d),l&&t(u),x(g,l)}}}function np(q){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(l){d=s(l,"P",{});var h=i(d);b=r(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(h,"CODE",{});var F=i(u);g=r(F,"Module"),F.forEach(t),v=r(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){m(l,d,h),e(d,b),e(d,u),e(u,g),e(d,v)},d(l){l&&t(d)}}}function sp(q){let d,b,u,g,v;return g=new Vt({props:{code:`from transformers import AutoTokenizer, TransfoXLModel
import torch

tokenizer = AutoTokenizer.from_pretrained("transfo-xl-wt103")
model = TransfoXLModel.from_pretrained("transfo-xl-wt103")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state`,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(l){d=s(l,"P",{});var h=i(d);b=r(h,"Example:"),h.forEach(t),u=f(l),w(g.$$.fragment,l)},m(l,h){m(l,d,h),e(d,b),m(l,u,h),k(g,l,h),v=!0},p:Kt,i(l){v||($(g.$$.fragment,l),v=!0)},o(l){L(g.$$.fragment,l),v=!1},d(l){l&&t(d),l&&t(u),x(g,l)}}}function ap(q){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(l){d=s(l,"P",{});var h=i(d);b=r(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(h,"CODE",{});var F=i(u);g=r(F,"Module"),F.forEach(t),v=r(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){m(l,d,h),e(d,b),e(d,u),e(u,g),e(d,v)},d(l){l&&t(d)}}}function rp(q){let d,b,u,g,v;return g=new Vt({props:{code:`import torch
from transformers import AutoTokenizer, TransfoXLLMHeadModel

tokenizer = AutoTokenizer.from_pretrained("transfo-xl-wt103")
model = TransfoXLLMHeadModel.from_pretrained("transfo-xl-wt103")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs, labels=inputs["input_ids"])
loss = outputs.loss
logits = outputs.logits`,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(l){d=s(l,"P",{});var h=i(d);b=r(h,"Example:"),h.forEach(t),u=f(l),w(g.$$.fragment,l)},m(l,h){m(l,d,h),e(d,b),m(l,u,h),k(g,l,h),v=!0},p:Kt,i(l){v||($(g.$$.fragment,l),v=!0)},o(l){L(g.$$.fragment,l),v=!1},d(l){l&&t(d),l&&t(u),x(g,l)}}}function ip(q){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(l){d=s(l,"P",{});var h=i(d);b=r(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(h,"CODE",{});var F=i(u);g=r(F,"Module"),F.forEach(t),v=r(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){m(l,d,h),e(d,b),e(d,u),e(u,g),e(d,v)},d(l){l&&t(d)}}}function lp(q){let d,b,u,g,v;return g=new Vt({props:{code:`import torch
from transformers import AutoTokenizer, TransfoXLForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("transfo-xl-wt103")
model = TransfoXLForSequenceClassification.from_pretrained("transfo-xl-wt103")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

predicted_class_id = logits.argmax().item()

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = TransfoXLForSequenceClassification.from_pretrained("transfo-xl-wt103", num_labels=num_labels)

labels = torch.tensor([1])
loss = model(**inputs, labels=labels).loss`,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(l){d=s(l,"P",{});var h=i(d);b=r(h,"Example of single-label classification:"),h.forEach(t),u=f(l),w(g.$$.fragment,l)},m(l,h){m(l,d,h),e(d,b),m(l,u,h),k(g,l,h),v=!0},p:Kt,i(l){v||($(g.$$.fragment,l),v=!0)},o(l){L(g.$$.fragment,l),v=!1},d(l){l&&t(d),l&&t(u),x(g,l)}}}function dp(q){let d,b,u,g,v;return g=new Vt({props:{code:`import torch
from transformers import AutoTokenizer, TransfoXLForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("transfo-xl-wt103")
model = TransfoXLForSequenceClassification.from_pretrained("transfo-xl-wt103", problem_type="multi_label_classification")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

predicted_class_ids = torch.arange(0, logits.shape[-1])[torch.sigmoid(logits).squeeze(dim=0) > 0.5]

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = TransfoXLForSequenceClassification.from_pretrained(
    "transfo-xl-wt103", num_labels=num_labels, problem_type="multi_label_classification"
)

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

tokenizer = AutoTokenizer.from_pretrained("transfo-xl-wt103")
model = TFTransfoXLModel.from_pretrained("transfo-xl-wt103")

inputs = tokenizer("Hello, my dog is cute", return_tensors="tf")
outputs = model(inputs)

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

tokenizer = AutoTokenizer.from_pretrained("transfo-xl-wt103")
model = TFTransfoXLLMHeadModel.from_pretrained("transfo-xl-wt103")

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

tokenizer = AutoTokenizer.from_pretrained("transfo-xl-wt103")
model = TFTransfoXLForSequenceClassification.from_pretrained("transfo-xl-wt103")

inputs = tokenizer("Hello, my dog is cute", return_tensors="tf")

logits = model(**inputs).logits

predicted_class_id = int(tf.math.argmax(logits, axis=-1)[0])`,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(l){d=s(l,"P",{});var h=i(d);b=r(h,"Example:"),h.forEach(t),u=f(l),w(g.$$.fragment,l)},m(l,h){m(l,d,h),e(d,b),m(l,u,h),k(g,l,h),v=!0},p:Kt,i(l){v||($(g.$$.fragment,l),v=!0)},o(l){L(g.$$.fragment,l),v=!1},d(l){l&&t(d),l&&t(u),x(g,l)}}}function vp(q){let d,b;return d=new Vt({props:{code:'# To train a model on `num_labels` classes, you can pass `num_labels=num_labels` to `.from_pretrained(...)`\nnum_labels = len(model.config.id2label)\nmodel = TFTransfoXLForSequenceClassification.from_pretrained("transfo-xl-wt103", num_labels=num_labels)\n\nlabels = tf.constant(1)\nloss = model(**inputs, labels=labels).loss',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){k(d,u,g),b=!0},p:Kt,i(u){b||($(d.$$.fragment,u),b=!0)},o(u){L(d.$$.fragment,u),b=!1},d(u){x(d,u)}}}function bp(q){let d,b,u,g,v,l,h,F,K,re,z,S,B,M,pe,W,he,We,Q,ee,ie,V,de,qe,R,Ce,Le,D,ze,ce,me,C,O,ue,te,xe,ge,G,Pe,Me,P,je,Z,I,Te,oe,Oe,ve,U,Ae,Y,Se,_e,j,Ne,N,be,De,T,X,st,J,at,rt,E,it,lt,Ye,ye,Qe,A,H,Ue,Xe,ne,Ke,dt,Ee,we,le,Ie,vr,br,hs,On,yr,Ta,$t,Rt,ms,Fo,wr,us,kr,va,Ze,qo,$r,gt,Lr,An,xr,Mr,Sn,Xr,Er,Co,Fr,qr,Cr,Lt,zr,Nn,Pr,jr,Dn,Or,Ar,Sr,Gt,ba,xt,Yt,gs,zo,Nr,_s,Dr,ya,Je,Po,Ir,jo,Hr,Oo,Br,Wr,Ur,Ao,Kr,In,Vr,Rr,Gr,Hn,So,wa,Mt,Qt,Ts,No,Yr,vs,Qr,ka,Xt,Do,Zr,bs,Jr,$a,Et,Io,ei,ys,ti,La,Ft,Ho,oi,ws,ni,xa,qt,Bo,si,ks,ai,Ma,Ct,Zt,$s,Wo,ri,Ls,ii,Xa,He,Uo,li,xs,di,ci,Ko,fi,Bn,pi,hi,mi,Vo,ui,Ro,gi,_i,Ti,ct,Go,vi,zt,bi,Wn,yi,wi,Ms,ki,$i,Li,Jt,xi,eo,Ea,Pt,to,Xs,Yo,Mi,Es,Xi,Fa,Be,Qo,Ei,Fs,Fi,qi,Zo,Ci,Un,zi,Pi,ji,Jo,Oi,en,Ai,Si,Ni,ft,tn,Di,jt,Ii,Kn,Hi,Bi,qs,Wi,Ui,Ki,oo,Vi,no,qa,Ot,so,Cs,on,Ri,zs,Gi,Ca,fe,nn,Yi,Ps,Qi,Zi,Vn,Rn,Ji,el,tl,et,ol,js,nl,sl,Os,al,rl,As,il,ll,Ss,dl,cl,fl,sn,pl,Gn,hl,ml,ul,an,gl,rn,_l,Tl,vl,Ve,ln,bl,At,yl,Yn,wl,kl,Ns,$l,Ll,xl,ao,Ml,ro,Xl,io,za,St,lo,Ds,dn,El,Is,Fl,Pa,ke,cn,ql,Hs,Cl,zl,fn,Pl,Qn,jl,Ol,Al,pn,Sl,hn,Nl,Dl,Il,co,Hl,pt,mn,Bl,Nt,Wl,Zn,Ul,Kl,Bs,Vl,Rl,Gl,fo,Yl,po,ja,Dt,ho,Ws,un,Ql,Us,Zl,Oa,$e,gn,Jl,Ks,ed,td,_n,od,Jn,nd,sd,ad,Tn,rd,vn,id,ld,dd,mo,cd,ht,bn,fd,It,pd,es,hd,md,Vs,ud,gd,_d,uo,Td,go,Aa,Ht,_o,Rs,yn,vd,Gs,bd,Sa,se,wn,yd,Ys,wd,kd,ts,os,$d,Ld,xd,tt,Md,Qs,Xd,Ed,Zs,Fd,qd,Js,Cd,zd,ea,Pd,jd,Od,kn,Ad,ns,Sd,Nd,Dd,$n,Id,Ln,Hd,Bd,Wd,To,Ud,Re,xn,Kd,Bt,Vd,ss,Rd,Gd,ta,Yd,Qd,Zd,vo,Jd,bo,ec,yo,Na,Wt,wo,oa,Mn,tc,na,oc,Da,Xn,En,Ia,Fn,qn,Ha;return l=new nt({}),de=new nt({}),ye=new kt({props:{warning:!0,$$slots:{default:[tp]},$$scope:{ctx:q}}}),Xe=new nt({}),Fo=new nt({}),qo=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.27.1/en/model_doc/transfo-xl#transformers.TransfoXLModel">TransfoXLModel</a> or <a href="/docs/transformers/v4.27.1/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.27.1/src/transformers/models/transfo_xl/configuration_transfo_xl.py#L29"}}),Gt=new Ut({props:{anchor:"transformers.TransfoXLConfig.example",$$slots:{default:[op]},$$scope:{ctx:q}}}),zo=new nt({}),Po=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.27.1/src/transformers/models/transfo_xl/tokenization_transfo_xl.py#L123"}}),So=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.27.1/src/transformers/models/transfo_xl/tokenization_transfo_xl.py#L310"}}),No=new nt({}),Do=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.27.1/src/transformers/models/transfo_xl/modeling_transfo_xl.py#L600"}}),Io=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.27.1/src/transformers/models/transfo_xl/modeling_transfo_xl.py#L665"}}),Ho=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:": Tensor = None"},{name:"mems",val:": typing.List[tensorflow.python.framework.ops.Tensor] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = 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.27.1/src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py#L699"}}),Bo=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:": Tensor = None"},{name:"mems",val:": typing.List[tensorflow.python.framework.ops.Tensor] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = 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.27.1/src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py#L730"}}),Wo=new nt({}),Uo=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.27.1/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.27.1/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.27.1/src/transformers/models/transfo_xl/modeling_transfo_xl.py#L764"}}),Go=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.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.27.1/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.27.1/src/transformers/models/transfo_xl/modeling_transfo_xl.py#L867",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/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.27.1/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.27.1/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>
`}}),Jt=new kt({props:{$$slots:{default:[np]},$$scope:{ctx:q}}}),eo=new Ut({props:{anchor:"transformers.TransfoXLModel.forward.example",$$slots:{default:[sp]},$$scope:{ctx:q}}}),Yo=new nt({}),Qo=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.27.1/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.27.1/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.27.1/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.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.27.1/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.27.1/src/transformers/models/transfo_xl/modeling_transfo_xl.py#L1060",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/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.27.1/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.27.1/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 kt({props:{$$slots:{default:[ap]},$$scope:{ctx:q}}}),no=new Ut({props:{anchor:"transformers.TransfoXLLMHeadModel.forward.example",$$slots:{default:[rp]},$$scope:{ctx:q}}}),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.27.1/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.27.1/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.27.1/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.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.27.1/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.27.1/src/transformers/models/transfo_xl/modeling_transfo_xl.py#L1203",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.27.1/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 kt({props:{$$slots:{default:[ip]},$$scope:{ctx:q}}}),ro=new Ut({props:{anchor:"transformers.TransfoXLForSequenceClassification.forward.example",$$slots:{default:[lp]},$$scope:{ctx:q}}}),io=new Ut({props:{anchor:"transformers.TransfoXLForSequenceClassification.forward.example-2",$$slots:{default:[dp]},$$scope:{ctx:q}}}),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.27.1/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.27.1/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.27.1/src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py#L881"}}),co=new kt({props:{$$slots:{default:[cp]},$$scope:{ctx:q}}}),mn=new ae({props:{name:"call",anchor:"transformers.TFTransfoXLModel.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"mems",val:": typing.Optional[typing.List[tensorflow.python.framework.ops.Tensor]] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = 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"},{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.27.1/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.27.1/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.27.1/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.27.1/src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py#L886",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/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.27.1/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.27.1/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 kt({props:{$$slots:{default:[fp]},$$scope:{ctx:q}}}),po=new Ut({props:{anchor:"transformers.TFTransfoXLModel.call.example",$$slots:{default:[pp]},$$scope:{ctx:q}}}),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.27.1/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.27.1/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.27.1/src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py#L936"}}),mo=new kt({props:{$$slots:{default:[hp]},$$scope:{ctx:q}}}),bn=new ae({props:{name:"call",anchor:"transformers.TFTransfoXLLMHeadModel.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"mems",val:": typing.Optional[typing.List[tensorflow.python.framework.ops.Tensor]] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = 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"},{name:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = 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.27.1/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.27.1/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.27.1/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.27.1/src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py#L965",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/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.27.1/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.27.1/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 kt({props:{$$slots:{default:[mp]},$$scope:{ctx:q}}}),go=new Ut({props:{anchor:"transformers.TFTransfoXLLMHeadModel.call.example",$$slots:{default:[up]},$$scope:{ctx:q}}}),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.27.1/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.27.1/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.27.1/src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py#L1054"}}),To=new kt({props:{$$slots:{default:[gp]},$$scope:{ctx:q}}}),xn=new ae({props:{name:"call",anchor:"transformers.TFTransfoXLForSequenceClassification.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"mems",val:": typing.Optional[typing.List[tensorflow.python.framework.ops.Tensor]] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = 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"},{name:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"training",val:": typing.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.27.1/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.27.1/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.27.1/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.27.1/src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py#L1069",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.27.1/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 kt({props:{$$slots:{default:[_p]},$$scope:{ctx:q}}}),bo=new Ut({props:{anchor:"transformers.TFTransfoXLForSequenceClassification.call.example",$$slots:{default:[Tp]},$$scope:{ctx:q}}}),yo=new Ut({props:{anchor:"transformers.TFTransfoXLForSequenceClassification.call.example-2",$$slots:{default:[vp]},$$scope:{ctx:q}}}),Mn=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.27.1/src/transformers/models/transfo_xl/modeling_transfo_xl.py#L399"}}),qn=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.27.1/src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py#L342"}}),{c(){d=n("meta"),b=c(),u=n("h1"),g=n("a"),v=n("span"),y(l.$$.fragment),h=c(),F=n("span"),K=a("Transformer XL"),re=c(),z=n("div"),S=n("a"),B=n("img"),pe=c(),W=n("a"),he=n("img"),Q=c(),ee=n("h2"),ie=n("a"),V=n("span"),y(de.$$.fragment),qe=c(),R=n("span"),Ce=a("Overview"),Le=c(),D=n("p"),ze=a("The Transformer-XL model was proposed in "),ce=n("a"),me=a("Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context"),C=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).`),O=c(),ue=n("p"),te=a("The abstract from the paper is the following:"),xe=c(),ge=n("p"),G=n("em"),Pe=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.`),Me=c(),P=n("p"),je=a("Tips:"),Z=c(),I=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.`),Oe=c(),ve=n("li"),U=a("Transformer-XL is one of the few models that has no sequence length limit."),Ae=c(),Y=n("li"),Se=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(),j=n("li"),Ne=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."),N=c(),be=n("li"),De=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 "),J=n("a"),at=a("thomwolf"),rt=a(". The original code can be found "),E=n("a"),it=a("here"),lt=a("."),Ye=c(),y(ye.$$.fragment),Qe=c(),A=n("h2"),H=n("a"),Ue=n("span"),y(Xe.$$.fragment),ne=c(),Ke=n("span"),dt=a("Documentation resources"),Ee=c(),we=n("ul"),le=n("li"),Ie=n("a"),vr=a("Text classification task guide"),br=c(),hs=n("li"),On=n("a"),yr=a("Causal language modeling task guide"),Ta=c(),$t=n("h2"),Rt=n("a"),ms=n("span"),y(Fo.$$.fragment),wr=c(),us=n("span"),kr=a("TransfoXLConfig"),va=c(),Ze=n("div"),y(qo.$$.fragment),$r=c(),gt=n("p"),Lr=a("This is the configuration class to store the configuration of a "),An=n("a"),xr=a("TransfoXLModel"),Mr=a(" or a "),Sn=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
`),Co=n("a"),Fr=a("transfo-xl-wt103"),qr=a(" architecture."),Cr=c(),Lt=n("p"),zr=a("Configuration objects inherit from "),Nn=n("a"),Pr=a("PretrainedConfig"),jr=a(` and can be used to control the model outputs. Read the
documentation from `),Dn=n("a"),Or=a("PretrainedConfig"),Ar=a(" for more information."),Sr=c(),y(Gt.$$.fragment),ba=c(),xt=n("h2"),Yt=n("a"),gs=n("span"),y(zo.$$.fragment),Nr=c(),_s=n("span"),Dr=a("TransfoXLTokenizer"),ya=c(),Je=n("div"),y(Po.$$.fragment),Ir=c(),jo=n("p"),Hr=a("Construct a Transformer-XL tokenizer adapted from Vocab class in "),Oo=n("a"),Br=a(`the original
code`),Wr=a(`. The Transformer-XL tokenizer is a word-level tokenizer (no
sub-word tokenization).`),Ur=c(),Ao=n("p"),Kr=a("This tokenizer inherits from "),In=n("a"),Vr=a("PreTrainedTokenizer"),Rr=a(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Gr=c(),Hn=n("div"),y(So.$$.fragment),wa=c(),Mt=n("h2"),Qt=n("a"),Ts=n("span"),y(No.$$.fragment),Yr=c(),vs=n("span"),Qr=a("TransfoXL specific outputs"),ka=c(),Xt=n("div"),y(Do.$$.fragment),Zr=c(),bs=n("p"),Jr=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(Io.$$.fragment),ei=c(),ys=n("p"),ti=a("Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),La=c(),Ft=n("div"),y(Ho.$$.fragment),oi=c(),ws=n("p"),ni=a("Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),xa=c(),qt=n("div"),y(Bo.$$.fragment),si=c(),ks=n("p"),ai=a("Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),Ma=c(),Ct=n("h2"),Zt=n("a"),$s=n("span"),y(Wo.$$.fragment),ri=c(),Ls=n("span"),ii=a("TransfoXLModel"),Xa=c(),He=n("div"),y(Uo.$$.fragment),li=c(),xs=n("p"),di=a("The bare Bert Model transformer outputting raw hidden-states without any specific head on top."),ci=c(),Ko=n("p"),fi=a("This model inherits from "),Bn=n("a"),pi=a("PreTrainedModel"),hi=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.)`),mi=c(),Vo=n("p"),ui=a("This model is also a PyTorch "),Ro=n("a"),gi=a("torch.nn.Module"),_i=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ti=c(),ct=n("div"),y(Go.$$.fragment),vi=c(),zt=n("p"),bi=a("The "),Wn=n("a"),yi=a("TransfoXLModel"),wi=a(" forward method, overrides the "),Ms=n("code"),ki=a("__call__"),$i=a(" special method."),Li=c(),y(Jt.$$.fragment),xi=c(),y(eo.$$.fragment),Ea=c(),Pt=n("h2"),to=n("a"),Xs=n("span"),y(Yo.$$.fragment),Mi=c(),Es=n("span"),Xi=a("TransfoXLLMHeadModel"),Fa=c(),Be=n("div"),y(Qo.$$.fragment),Ei=c(),Fs=n("p"),Fi=a(`The Transformer-XL Model with a language modeling head on top (adaptive softmax with weights tied to the adaptive
input embeddings)`),qi=c(),Zo=n("p"),Ci=a("This model inherits from "),Un=n("a"),zi=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.)`),ji=c(),Jo=n("p"),Oi=a("This model is also a PyTorch "),en=n("a"),Ai=a("torch.nn.Module"),Si=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ni=c(),ft=n("div"),y(tn.$$.fragment),Di=c(),jt=n("p"),Ii=a("The "),Kn=n("a"),Hi=a("TransfoXLLMHeadModel"),Bi=a(" forward method, overrides the "),qs=n("code"),Wi=a("__call__"),Ui=a(" special method."),Ki=c(),y(oo.$$.fragment),Vi=c(),y(no.$$.fragment),qa=c(),Ot=n("h2"),so=n("a"),Cs=n("span"),y(on.$$.fragment),Ri=c(),zs=n("span"),Gi=a("TransfoXLForSequenceClassification"),Ca=c(),fe=n("div"),y(nn.$$.fragment),Yi=c(),Ps=n("p"),Qi=a("The Transformer-XL Model transformer with a sequence classification head on top (linear layer)."),Zi=c(),Vn=n("p"),Rn=n("a"),Ji=a("TransfoXLForSequenceClassification"),el=a(` uses the last token in order to do the classification, as other causal
models (e.g. GPT-1) do.`),tl=c(),et=n("p"),ol=a(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),js=n("code"),nl=a("pad_token_id"),sl=a(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Os=n("code"),al=a("pad_token_id"),rl=a(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),As=n("code"),il=a("inputs_embeds"),ll=a(" are passed instead of "),Ss=n("code"),dl=a("input_ids"),cl=a(`, it does the same (take the last value in
each row of the batch).`),fl=c(),sn=n("p"),pl=a("This model inherits from "),Gn=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.)`),ul=c(),an=n("p"),gl=a("This model is also a PyTorch "),rn=n("a"),_l=a("torch.nn.Module"),Tl=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),vl=c(),Ve=n("div"),y(ln.$$.fragment),bl=c(),At=n("p"),yl=a("The "),Yn=n("a"),wl=a("TransfoXLForSequenceClassification"),kl=a(" forward method, overrides the "),Ns=n("code"),$l=a("__call__"),Ll=a(" special method."),xl=c(),y(ao.$$.fragment),Ml=c(),y(ro.$$.fragment),Xl=c(),y(io.$$.fragment),za=c(),St=n("h2"),lo=n("a"),Ds=n("span"),y(dn.$$.fragment),El=c(),Is=n("span"),Fl=a("TFTransfoXLModel"),Pa=c(),ke=n("div"),y(cn.$$.fragment),ql=c(),Hs=n("p"),Cl=a("The bare Bert Model transformer outputting raw hidden-states without any specific head on top."),zl=c(),fn=n("p"),Pl=a("This model inherits from "),Qn=n("a"),jl=a("TFPreTrainedModel"),Ol=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.)`),Al=c(),pn=n("p"),Sl=a("This model is also a "),hn=n("a"),Nl=a("tf.keras.Model"),Dl=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.`),Il=c(),y(co.$$.fragment),Hl=c(),pt=n("div"),y(mn.$$.fragment),Bl=c(),Nt=n("p"),Wl=a("The "),Zn=n("a"),Ul=a("TFTransfoXLModel"),Kl=a(" forward method, overrides the "),Bs=n("code"),Vl=a("__call__"),Rl=a(" special method."),Gl=c(),y(fo.$$.fragment),Yl=c(),y(po.$$.fragment),ja=c(),Dt=n("h2"),ho=n("a"),Ws=n("span"),y(un.$$.fragment),Ql=c(),Us=n("span"),Zl=a("TFTransfoXLLMHeadModel"),Oa=c(),$e=n("div"),y(gn.$$.fragment),Jl=c(),Ks=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 "),Jn=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"),id=a("tf.keras.Model"),ld=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(mo.$$.fragment),cd=c(),ht=n("div"),y(bn.$$.fragment),fd=c(),It=n("p"),pd=a("The "),es=n("a"),hd=a("TFTransfoXLLMHeadModel"),md=a(" forward method, overrides the "),Vs=n("code"),ud=a("__call__"),gd=a(" special method."),_d=c(),y(uo.$$.fragment),Td=c(),y(go.$$.fragment),Aa=c(),Ht=n("h2"),_o=n("a"),Rs=n("span"),y(yn.$$.fragment),vd=c(),Gs=n("span"),bd=a("TFTransfoXLForSequenceClassification"),Sa=c(),se=n("div"),y(wn.$$.fragment),yd=c(),Ys=n("p"),wd=a("The Transfo XL Model transformer with a sequence classification head on top (linear layer)."),kd=c(),ts=n("p"),os=n("a"),$d=a("TFTransfoXLForSequenceClassification"),Ld=a(` uses the last token in order to do the classification, as other causal
models (e.g. GPT-1,GPT-2) do.`),xd=c(),tt=n("p"),Md=a(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Qs=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 `),Zs=n("code"),Fd=a("pad_token_id"),qd=a(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Js=n("code"),Cd=a("inputs_embeds"),zd=a(" are passed instead of "),ea=n("code"),Pd=a("input_ids"),jd=a(`, it does the same (take the last value in
each row of the batch).`),Od=c(),kn=n("p"),Ad=a("This model inherits from "),ns=n("a"),Sd=a("TFPreTrainedModel"),Nd=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.)`),Dd=c(),$n=n("p"),Id=a("This model is also a "),Ln=n("a"),Hd=a("tf.keras.Model"),Bd=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.`),Wd=c(),y(To.$$.fragment),Ud=c(),Re=n("div"),y(xn.$$.fragment),Kd=c(),Bt=n("p"),Vd=a("The "),ss=n("a"),Rd=a("TFTransfoXLForSequenceClassification"),Gd=a(" forward method, overrides the "),ta=n("code"),Yd=a("__call__"),Qd=a(" special method."),Zd=c(),y(vo.$$.fragment),Jd=c(),y(bo.$$.fragment),ec=c(),y(yo.$$.fragment),Na=c(),Wt=n("h2"),wo=n("a"),oa=n("span"),y(Mn.$$.fragment),tc=c(),na=n("span"),oc=a("Internal Layers"),Da=c(),Xn=n("div"),y(En.$$.fragment),Ia=c(),Fn=n("div"),y(qn.$$.fragment),this.h()},l(o){const _=Jf('[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 Cn=i(u);g=s(Cn,"A",{id:!0,class:!0,href:!0});var sa=i(g);v=s(sa,"SPAN",{});var aa=i(v);w(l.$$.fragment,aa),aa.forEach(t),sa.forEach(t),h=f(Cn),F=s(Cn,"SPAN",{});var ra=i(F);K=r(ra,"Transformer XL"),ra.forEach(t),Cn.forEach(t),re=f(o),z=s(o,"DIV",{class:!0});var zn=i(z);S=s(zn,"A",{href:!0});var ia=i(S);B=s(ia,"IMG",{alt:!0,src:!0}),ia.forEach(t),pe=f(zn),W=s(zn,"A",{href:!0});var la=i(W);he=s(la,"IMG",{alt:!0,src:!0}),la.forEach(t),zn.forEach(t),Q=f(o),ee=s(o,"H2",{class:!0});var Pn=i(ee);ie=s(Pn,"A",{id:!0,class:!0,href:!0});var da=i(ie);V=s(da,"SPAN",{});var ca=i(V);w(de.$$.fragment,ca),ca.forEach(t),da.forEach(t),qe=f(Pn),R=s(Pn,"SPAN",{});var fa=i(R);Ce=r(fa,"Overview"),fa.forEach(t),Pn.forEach(t),Le=f(o),D=s(o,"P",{});var jn=i(D);ze=r(jn,"The Transformer-XL model was proposed in "),ce=s(jn,"A",{href:!0,rel:!0});var pa=i(ce);me=r(pa,"Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context"),pa.forEach(t),C=r(jn,` 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).`),jn.forEach(t),O=f(o),ue=s(o,"P",{});var ha=i(ue);te=r(ha,"The abstract from the paper is the following:"),ha.forEach(t),xe=f(o),ge=s(o,"P",{});var ma=i(ge);G=s(ma,"EM",{});var ua=i(G);Pe=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),ma.forEach(t),Me=f(o),P=s(o,"P",{});var ga=i(P);je=r(ga,"Tips:"),ga.forEach(t),Z=f(o),I=s(o,"UL",{});var ot=i(I);Te=s(ot,"LI",{});var _a=i(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),Oe=f(ot),ve=s(ot,"LI",{});var ac=i(ve);U=r(ac,"Transformer-XL is one of the few models that has no sequence length limit."),ac.forEach(t),Ae=f(ot),Y=s(ot,"LI",{});var rc=i(Y);Se=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),j=s(ot,"LI",{});var ic=i(j);Ne=r(ic,"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."),ic.forEach(t),N=f(ot),be=s(ot,"LI",{});var lc=i(be);De=r(lc,"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."),lc.forEach(t),ot.forEach(t),T=f(o),X=s(o,"P",{});var as=i(X);st=r(as,"This model was contributed by "),J=s(as,"A",{href:!0,rel:!0});var dc=i(J);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=i(E);it=r(cc,"here"),cc.forEach(t),lt=r(as,"."),as.forEach(t),Ye=f(o),w(ye.$$.fragment,o),Qe=f(o),A=s(o,"H2",{class:!0});var Ba=i(A);H=s(Ba,"A",{id:!0,class:!0,href:!0});var fc=i(H);Ue=s(fc,"SPAN",{});var pc=i(Ue);w(Xe.$$.fragment,pc),pc.forEach(t),fc.forEach(t),ne=f(Ba),Ke=s(Ba,"SPAN",{});var hc=i(Ke);dt=r(hc,"Documentation resources"),hc.forEach(t),Ba.forEach(t),Ee=f(o),we=s(o,"UL",{});var Wa=i(we);le=s(Wa,"LI",{});var mc=i(le);Ie=s(mc,"A",{href:!0});var uc=i(Ie);vr=r(uc,"Text classification task guide"),uc.forEach(t),mc.forEach(t),br=f(Wa),hs=s(Wa,"LI",{});var gc=i(hs);On=s(gc,"A",{href:!0});var _c=i(On);yr=r(_c,"Causal language modeling task guide"),_c.forEach(t),gc.forEach(t),Wa.forEach(t),Ta=f(o),$t=s(o,"H2",{class:!0});var Ua=i($t);Rt=s(Ua,"A",{id:!0,class:!0,href:!0});var Tc=i(Rt);ms=s(Tc,"SPAN",{});var vc=i(ms);w(Fo.$$.fragment,vc),vc.forEach(t),Tc.forEach(t),wr=f(Ua),us=s(Ua,"SPAN",{});var bc=i(us);kr=r(bc,"TransfoXLConfig"),bc.forEach(t),Ua.forEach(t),va=f(o),Ze=s(o,"DIV",{class:!0});var ko=i(Ze);w(qo.$$.fragment,ko),$r=f(ko),gt=s(ko,"P",{});var $o=i(gt);Lr=r($o,"This is the configuration class to store the configuration of a "),An=s($o,"A",{href:!0});var yc=i(An);xr=r(yc,"TransfoXLModel"),yc.forEach(t),Mr=r($o," or a "),Sn=s($o,"A",{href:!0});var wc=i(Sn);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
`),Co=s($o,"A",{href:!0,rel:!0});var kc=i(Co);Fr=r(kc,"transfo-xl-wt103"),kc.forEach(t),qr=r($o," architecture."),$o.forEach(t),Cr=f(ko),Lt=s(ko,"P",{});var rs=i(Lt);zr=r(rs,"Configuration objects inherit from "),Nn=s(rs,"A",{href:!0});var $c=i(Nn);Pr=r($c,"PretrainedConfig"),$c.forEach(t),jr=r(rs,` and can be used to control the model outputs. Read the
documentation from `),Dn=s(rs,"A",{href:!0});var Lc=i(Dn);Or=r(Lc,"PretrainedConfig"),Lc.forEach(t),Ar=r(rs," for more information."),rs.forEach(t),Sr=f(ko),w(Gt.$$.fragment,ko),ko.forEach(t),ba=f(o),xt=s(o,"H2",{class:!0});var Ka=i(xt);Yt=s(Ka,"A",{id:!0,class:!0,href:!0});var xc=i(Yt);gs=s(xc,"SPAN",{});var Mc=i(gs);w(zo.$$.fragment,Mc),Mc.forEach(t),xc.forEach(t),Nr=f(Ka),_s=s(Ka,"SPAN",{});var Xc=i(_s);Dr=r(Xc,"TransfoXLTokenizer"),Xc.forEach(t),Ka.forEach(t),ya=f(o),Je=s(o,"DIV",{class:!0});var Lo=i(Je);w(Po.$$.fragment,Lo),Ir=f(Lo),jo=s(Lo,"P",{});var Va=i(jo);Hr=r(Va,"Construct a Transformer-XL tokenizer adapted from Vocab class in "),Oo=s(Va,"A",{href:!0,rel:!0});var Ec=i(Oo);Br=r(Ec,`the original
code`),Ec.forEach(t),Wr=r(Va,`. The Transformer-XL tokenizer is a word-level tokenizer (no
sub-word tokenization).`),Va.forEach(t),Ur=f(Lo),Ao=s(Lo,"P",{});var Ra=i(Ao);Kr=r(Ra,"This tokenizer inherits from "),In=s(Ra,"A",{href:!0});var Fc=i(In);Vr=r(Fc,"PreTrainedTokenizer"),Fc.forEach(t),Rr=r(Ra,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Ra.forEach(t),Gr=f(Lo),Hn=s(Lo,"DIV",{class:!0});var qc=i(Hn);w(So.$$.fragment,qc),qc.forEach(t),Lo.forEach(t),wa=f(o),Mt=s(o,"H2",{class:!0});var Ga=i(Mt);Qt=s(Ga,"A",{id:!0,class:!0,href:!0});var Cc=i(Qt);Ts=s(Cc,"SPAN",{});var zc=i(Ts);w(No.$$.fragment,zc),zc.forEach(t),Cc.forEach(t),Yr=f(Ga),vs=s(Ga,"SPAN",{});var Pc=i(vs);Qr=r(Pc,"TransfoXL specific outputs"),Pc.forEach(t),Ga.forEach(t),ka=f(o),Xt=s(o,"DIV",{class:!0});var Ya=i(Xt);w(Do.$$.fragment,Ya),Zr=f(Ya),bs=s(Ya,"P",{});var jc=i(bs);Jr=r(jc,"Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),jc.forEach(t),Ya.forEach(t),$a=f(o),Et=s(o,"DIV",{class:!0});var Qa=i(Et);w(Io.$$.fragment,Qa),ei=f(Qa),ys=s(Qa,"P",{});var Oc=i(ys);ti=r(Oc,"Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),Oc.forEach(t),Qa.forEach(t),La=f(o),Ft=s(o,"DIV",{class:!0});var Za=i(Ft);w(Ho.$$.fragment,Za),oi=f(Za),ws=s(Za,"P",{});var Ac=i(ws);ni=r(Ac,"Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),Ac.forEach(t),Za.forEach(t),xa=f(o),qt=s(o,"DIV",{class:!0});var Ja=i(qt);w(Bo.$$.fragment,Ja),si=f(Ja),ks=s(Ja,"P",{});var Sc=i(ks);ai=r(Sc,"Base class for model\u2019s outputs that may also contain a past key/values (to speed up sequential decoding)."),Sc.forEach(t),Ja.forEach(t),Ma=f(o),Ct=s(o,"H2",{class:!0});var er=i(Ct);Zt=s(er,"A",{id:!0,class:!0,href:!0});var Nc=i(Zt);$s=s(Nc,"SPAN",{});var Dc=i($s);w(Wo.$$.fragment,Dc),Dc.forEach(t),Nc.forEach(t),ri=f(er),Ls=s(er,"SPAN",{});var Ic=i(Ls);ii=r(Ic,"TransfoXLModel"),Ic.forEach(t),er.forEach(t),Xa=f(o),He=s(o,"DIV",{class:!0});var _t=i(He);w(Uo.$$.fragment,_t),li=f(_t),xs=s(_t,"P",{});var Hc=i(xs);di=r(Hc,"The bare Bert Model transformer outputting raw hidden-states without any specific head on top."),Hc.forEach(t),ci=f(_t),Ko=s(_t,"P",{});var tr=i(Ko);fi=r(tr,"This model inherits from "),Bn=s(tr,"A",{href:!0});var Bc=i(Bn);pi=r(Bc,"PreTrainedModel"),Bc.forEach(t),hi=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),mi=f(_t),Vo=s(_t,"P",{});var or=i(Vo);ui=r(or,"This model is also a PyTorch "),Ro=s(or,"A",{href:!0,rel:!0});var Wc=i(Ro);gi=r(Wc,"torch.nn.Module"),Wc.forEach(t),_i=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),Ti=f(_t),ct=s(_t,"DIV",{class:!0});var xo=i(ct);w(Go.$$.fragment,xo),vi=f(xo),zt=s(xo,"P",{});var is=i(zt);bi=r(is,"The "),Wn=s(is,"A",{href:!0});var Uc=i(Wn);yi=r(Uc,"TransfoXLModel"),Uc.forEach(t),wi=r(is," forward method, overrides the "),Ms=s(is,"CODE",{});var Kc=i(Ms);ki=r(Kc,"__call__"),Kc.forEach(t),$i=r(is," special method."),is.forEach(t),Li=f(xo),w(Jt.$$.fragment,xo),xi=f(xo),w(eo.$$.fragment,xo),xo.forEach(t),_t.forEach(t),Ea=f(o),Pt=s(o,"H2",{class:!0});var nr=i(Pt);to=s(nr,"A",{id:!0,class:!0,href:!0});var Vc=i(to);Xs=s(Vc,"SPAN",{});var Rc=i(Xs);w(Yo.$$.fragment,Rc),Rc.forEach(t),Vc.forEach(t),Mi=f(nr),Es=s(nr,"SPAN",{});var Gc=i(Es);Xi=r(Gc,"TransfoXLLMHeadModel"),Gc.forEach(t),nr.forEach(t),Fa=f(o),Be=s(o,"DIV",{class:!0});var Tt=i(Be);w(Qo.$$.fragment,Tt),Ei=f(Tt),Fs=s(Tt,"P",{});var Yc=i(Fs);Fi=r(Yc,`The Transformer-XL Model with a language modeling head on top (adaptive softmax with weights tied to the adaptive
input embeddings)`),Yc.forEach(t),qi=f(Tt),Zo=s(Tt,"P",{});var sr=i(Zo);Ci=r(sr,"This model inherits from "),Un=s(sr,"A",{href:!0});var Qc=i(Un);zi=r(Qc,"PreTrainedModel"),Qc.forEach(t),Pi=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),ji=f(Tt),Jo=s(Tt,"P",{});var ar=i(Jo);Oi=r(ar,"This model is also a PyTorch "),en=s(ar,"A",{href:!0,rel:!0});var Zc=i(en);Ai=r(Zc,"torch.nn.Module"),Zc.forEach(t),Si=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),Ni=f(Tt),ft=s(Tt,"DIV",{class:!0});var Mo=i(ft);w(tn.$$.fragment,Mo),Di=f(Mo),jt=s(Mo,"P",{});var ls=i(jt);Ii=r(ls,"The "),Kn=s(ls,"A",{href:!0});var Jc=i(Kn);Hi=r(Jc,"TransfoXLLMHeadModel"),Jc.forEach(t),Bi=r(ls," forward method, overrides the "),qs=s(ls,"CODE",{});var ef=i(qs);Wi=r(ef,"__call__"),ef.forEach(t),Ui=r(ls," special method."),ls.forEach(t),Ki=f(Mo),w(oo.$$.fragment,Mo),Vi=f(Mo),w(no.$$.fragment,Mo),Mo.forEach(t),Tt.forEach(t),qa=f(o),Ot=s(o,"H2",{class:!0});var rr=i(Ot);so=s(rr,"A",{id:!0,class:!0,href:!0});var tf=i(so);Cs=s(tf,"SPAN",{});var of=i(Cs);w(on.$$.fragment,of),of.forEach(t),tf.forEach(t),Ri=f(rr),zs=s(rr,"SPAN",{});var nf=i(zs);Gi=r(nf,"TransfoXLForSequenceClassification"),nf.forEach(t),rr.forEach(t),Ca=f(o),fe=s(o,"DIV",{class:!0});var Ge=i(fe);w(nn.$$.fragment,Ge),Yi=f(Ge),Ps=s(Ge,"P",{});var sf=i(Ps);Qi=r(sf,"The Transformer-XL Model transformer with a sequence classification head on top (linear layer)."),sf.forEach(t),Zi=f(Ge),Vn=s(Ge,"P",{});var nc=i(Vn);Rn=s(nc,"A",{href:!0});var af=i(Rn);Ji=r(af,"TransfoXLForSequenceClassification"),af.forEach(t),el=r(nc,` uses the last token in order to do the classification, as other causal
models (e.g. GPT-1) do.`),nc.forEach(t),tl=f(Ge),et=s(Ge,"P",{});var vt=i(et);ol=r(vt,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),js=s(vt,"CODE",{});var rf=i(js);nl=r(rf,"pad_token_id"),rf.forEach(t),sl=r(vt,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Os=s(vt,"CODE",{});var lf=i(Os);al=r(lf,"pad_token_id"),lf.forEach(t),rl=r(vt,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),As=s(vt,"CODE",{});var df=i(As);il=r(df,"inputs_embeds"),df.forEach(t),ll=r(vt," are passed instead of "),Ss=s(vt,"CODE",{});var cf=i(Ss);dl=r(cf,"input_ids"),cf.forEach(t),cl=r(vt,`, it does the same (take the last value in
each row of the batch).`),vt.forEach(t),fl=f(Ge),sn=s(Ge,"P",{});var ir=i(sn);pl=r(ir,"This model inherits from "),Gn=s(ir,"A",{href:!0});var ff=i(Gn);hl=r(ff,"PreTrainedModel"),ff.forEach(t),ml=r(ir,`. 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.)`),ir.forEach(t),ul=f(Ge),an=s(Ge,"P",{});var lr=i(an);gl=r(lr,"This model is also a PyTorch "),rn=s(lr,"A",{href:!0,rel:!0});var pf=i(rn);_l=r(pf,"torch.nn.Module"),pf.forEach(t),Tl=r(lr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),lr.forEach(t),vl=f(Ge),Ve=s(Ge,"DIV",{class:!0});var bt=i(Ve);w(ln.$$.fragment,bt),bl=f(bt),At=s(bt,"P",{});var ds=i(At);yl=r(ds,"The "),Yn=s(ds,"A",{href:!0});var hf=i(Yn);wl=r(hf,"TransfoXLForSequenceClassification"),hf.forEach(t),kl=r(ds," forward method, overrides the "),Ns=s(ds,"CODE",{});var mf=i(Ns);$l=r(mf,"__call__"),mf.forEach(t),Ll=r(ds," special method."),ds.forEach(t),xl=f(bt),w(ao.$$.fragment,bt),Ml=f(bt),w(ro.$$.fragment,bt),Xl=f(bt),w(io.$$.fragment,bt),bt.forEach(t),Ge.forEach(t),za=f(o),St=s(o,"H2",{class:!0});var dr=i(St);lo=s(dr,"A",{id:!0,class:!0,href:!0});var uf=i(lo);Ds=s(uf,"SPAN",{});var gf=i(Ds);w(dn.$$.fragment,gf),gf.forEach(t),uf.forEach(t),El=f(dr),Is=s(dr,"SPAN",{});var _f=i(Is);Fl=r(_f,"TFTransfoXLModel"),_f.forEach(t),dr.forEach(t),Pa=f(o),ke=s(o,"DIV",{class:!0});var mt=i(ke);w(cn.$$.fragment,mt),ql=f(mt),Hs=s(mt,"P",{});var Tf=i(Hs);Cl=r(Tf,"The bare Bert Model transformer outputting raw hidden-states without any specific head on top."),Tf.forEach(t),zl=f(mt),fn=s(mt,"P",{});var cr=i(fn);Pl=r(cr,"This model inherits from "),Qn=s(cr,"A",{href:!0});var vf=i(Qn);jl=r(vf,"TFPreTrainedModel"),vf.forEach(t),Ol=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),Al=f(mt),pn=s(mt,"P",{});var fr=i(pn);Sl=r(fr,"This model is also a "),hn=s(fr,"A",{href:!0,rel:!0});var bf=i(hn);Nl=r(bf,"tf.keras.Model"),bf.forEach(t),Dl=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),Il=f(mt),w(co.$$.fragment,mt),Hl=f(mt),pt=s(mt,"DIV",{class:!0});var Xo=i(pt);w(mn.$$.fragment,Xo),Bl=f(Xo),Nt=s(Xo,"P",{});var cs=i(Nt);Wl=r(cs,"The "),Zn=s(cs,"A",{href:!0});var yf=i(Zn);Ul=r(yf,"TFTransfoXLModel"),yf.forEach(t),Kl=r(cs," forward method, overrides the "),Bs=s(cs,"CODE",{});var wf=i(Bs);Vl=r(wf,"__call__"),wf.forEach(t),Rl=r(cs," special method."),cs.forEach(t),Gl=f(Xo),w(fo.$$.fragment,Xo),Yl=f(Xo),w(po.$$.fragment,Xo),Xo.forEach(t),mt.forEach(t),ja=f(o),Dt=s(o,"H2",{class:!0});var pr=i(Dt);ho=s(pr,"A",{id:!0,class:!0,href:!0});var kf=i(ho);Ws=s(kf,"SPAN",{});var $f=i(Ws);w(un.$$.fragment,$f),$f.forEach(t),kf.forEach(t),Ql=f(pr),Us=s(pr,"SPAN",{});var Lf=i(Us);Zl=r(Lf,"TFTransfoXLLMHeadModel"),Lf.forEach(t),pr.forEach(t),Oa=f(o),$e=s(o,"DIV",{class:!0});var ut=i($e);w(gn.$$.fragment,ut),Jl=f(ut),Ks=s(ut,"P",{});var xf=i(Ks);ed=r(xf,`The Transformer-XL Model with a language modeling head on top (adaptive softmax with weights tied to the adaptive
input embeddings)`),xf.forEach(t),td=f(ut),_n=s(ut,"P",{});var hr=i(_n);od=r(hr,"This model inherits from "),Jn=s(hr,"A",{href:!0});var Mf=i(Jn);nd=r(Mf,"TFPreTrainedModel"),Mf.forEach(t),sd=r(hr,`. 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.)`),hr.forEach(t),ad=f(ut),Tn=s(ut,"P",{});var mr=i(Tn);rd=r(mr,"This model is also a "),vn=s(mr,"A",{href:!0,rel:!0});var Xf=i(vn);id=r(Xf,"tf.keras.Model"),Xf.forEach(t),ld=r(mr,` 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.`),mr.forEach(t),dd=f(ut),w(mo.$$.fragment,ut),cd=f(ut),ht=s(ut,"DIV",{class:!0});var Eo=i(ht);w(bn.$$.fragment,Eo),fd=f(Eo),It=s(Eo,"P",{});var fs=i(It);pd=r(fs,"The "),es=s(fs,"A",{href:!0});var Ef=i(es);hd=r(Ef,"TFTransfoXLLMHeadModel"),Ef.forEach(t),md=r(fs," forward method, overrides the "),Vs=s(fs,"CODE",{});var Ff=i(Vs);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),Aa=f(o),Ht=s(o,"H2",{class:!0});var ur=i(Ht);_o=s(ur,"A",{id:!0,class:!0,href:!0});var qf=i(_o);Rs=s(qf,"SPAN",{});var Cf=i(Rs);w(yn.$$.fragment,Cf),Cf.forEach(t),qf.forEach(t),vd=f(ur),Gs=s(ur,"SPAN",{});var zf=i(Gs);bd=r(zf,"TFTransfoXLForSequenceClassification"),zf.forEach(t),ur.forEach(t),Sa=f(o),se=s(o,"DIV",{class:!0});var Fe=i(se);w(wn.$$.fragment,Fe),yd=f(Fe),Ys=s(Fe,"P",{});var Pf=i(Ys);wd=r(Pf,"The Transfo XL Model transformer with a sequence classification head on top (linear layer)."),Pf.forEach(t),kd=f(Fe),ts=s(Fe,"P",{});var sc=i(ts);os=s(sc,"A",{href:!0});var jf=i(os);$d=r(jf,"TFTransfoXLForSequenceClassification"),jf.forEach(t),Ld=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),xd=f(Fe),tt=s(Fe,"P",{});var yt=i(tt);Md=r(yt,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Qs=s(yt,"CODE",{});var Of=i(Qs);Xd=r(Of,"pad_token_id"),Of.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 `),Zs=s(yt,"CODE",{});var Af=i(Zs);Fd=r(Af,"pad_token_id"),Af.forEach(t),qd=r(yt,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Js=s(yt,"CODE",{});var Sf=i(Js);Cd=r(Sf,"inputs_embeds"),Sf.forEach(t),zd=r(yt," are passed instead of "),ea=s(yt,"CODE",{});var Nf=i(ea);Pd=r(Nf,"input_ids"),Nf.forEach(t),jd=r(yt,`, it does the same (take the last value in
each row of the batch).`),yt.forEach(t),Od=f(Fe),kn=s(Fe,"P",{});var gr=i(kn);Ad=r(gr,"This model inherits from "),ns=s(gr,"A",{href:!0});var Df=i(ns);Sd=r(Df,"TFPreTrainedModel"),Df.forEach(t),Nd=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),Dd=f(Fe),$n=s(Fe,"P",{});var _r=i($n);Id=r(_r,"This model is also a "),Ln=s(_r,"A",{href:!0,rel:!0});var If=i(Ln);Hd=r(If,"tf.keras.Model"),If.forEach(t),Bd=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),Wd=f(Fe),w(To.$$.fragment,Fe),Ud=f(Fe),Re=s(Fe,"DIV",{class:!0});var wt=i(Re);w(xn.$$.fragment,wt),Kd=f(wt),Bt=s(wt,"P",{});var ps=i(Bt);Vd=r(ps,"The "),ss=s(ps,"A",{href:!0});var Hf=i(ss);Rd=r(Hf,"TFTransfoXLForSequenceClassification"),Hf.forEach(t),Gd=r(ps," forward method, overrides the "),ta=s(ps,"CODE",{});var Bf=i(ta);Yd=r(Bf,"__call__"),Bf.forEach(t),Qd=r(ps," special method."),ps.forEach(t),Zd=f(wt),w(vo.$$.fragment,wt),Jd=f(wt),w(bo.$$.fragment,wt),ec=f(wt),w(yo.$$.fragment,wt),wt.forEach(t),Fe.forEach(t),Na=f(o),Wt=s(o,"H2",{class:!0});var Tr=i(Wt);wo=s(Tr,"A",{id:!0,class:!0,href:!0});var Wf=i(wo);oa=s(Wf,"SPAN",{});var Uf=i(oa);w(Mn.$$.fragment,Uf),Uf.forEach(t),Wf.forEach(t),tc=f(Tr),na=s(Tr,"SPAN",{});var Kf=i(na);oc=r(Kf,"Internal Layers"),Kf.forEach(t),Tr.forEach(t),Da=f(o),Xn=s(o,"DIV",{class:!0});var Vf=i(Xn);w(En.$$.fragment,Vf),Vf.forEach(t),Ia=f(o),Fn=s(o,"DIV",{class:!0});var Rf=i(Fn);w(qn.$$.fragment,Rf),Rf.forEach(t),this.h()},h(){p(d,"name","hf:doc:metadata"),p(d,"content",JSON.stringify(yp)),p(g,"id","transformer-xl"),p(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"),p(g,"href","#transformer-xl"),p(u,"class","relative group"),p(B,"alt","Models"),Gf(B.src,M="https://img.shields.io/badge/All_model_pages-transfo--xl-blueviolet")||p(B,"src",M),p(S,"href","https://huggingface.co/models?filter=transfo-xl"),p(he,"alt","Spaces"),Gf(he.src,We="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue")||p(he,"src",We),p(W,"href","https://huggingface.co/spaces/docs-demos/transfo-xl-wt103"),p(z,"class","flex flex-wrap space-x-1"),p(ie,"id","overview"),p(ie,"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"),p(ie,"href","#overview"),p(ee,"class","relative group"),p(ce,"href","https://arxiv.org/abs/1901.02860"),p(ce,"rel","nofollow"),p(J,"href","https://huggingface.co/thomwolf"),p(J,"rel","nofollow"),p(E,"href","https://github.com/kimiyoung/transformer-xl"),p(E,"rel","nofollow"),p(H,"id","documentation-resources"),p(H,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(H,"href","#documentation-resources"),p(A,"class","relative group"),p(Ie,"href","./tasks/sequence_classification"),p(On,"href","./tasks/language_modeling"),p(Rt,"id","transformers.TransfoXLConfig"),p(Rt,"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"),p(Rt,"href","#transformers.TransfoXLConfig"),p($t,"class","relative group"),p(An,"href","/docs/transformers/v4.27.1/en/model_doc/transfo-xl#transformers.TransfoXLModel"),p(Sn,"href","/docs/transformers/v4.27.1/en/model_doc/transfo-xl#transformers.TFTransfoXLModel"),p(Co,"href","https://huggingface.co/transfo-xl-wt103"),p(Co,"rel","nofollow"),p(Nn,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),p(Dn,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),p(Ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Yt,"id","transformers.TransfoXLTokenizer"),p(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"),p(Yt,"href","#transformers.TransfoXLTokenizer"),p(xt,"class","relative group"),p(Oo,"href","https://github.com/kimiyoung/transformer-xl"),p(Oo,"rel","nofollow"),p(In,"href","/docs/transformers/v4.27.1/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),p(Hn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Qt,"id","transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput"),p(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"),p(Qt,"href","#transformers.models.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput"),p(Mt,"class","relative group"),p(Xt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(qt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Zt,"id","transformers.TransfoXLModel"),p(Zt,"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"),p(Zt,"href","#transformers.TransfoXLModel"),p(Ct,"class","relative group"),p(Bn,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),p(Ro,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(Ro,"rel","nofollow"),p(Wn,"href","/docs/transformers/v4.27.1/en/model_doc/transfo-xl#transformers.TransfoXLModel"),p(ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(He,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(to,"id","transformers.TransfoXLLMHeadModel"),p(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"),p(to,"href","#transformers.TransfoXLLMHeadModel"),p(Pt,"class","relative group"),p(Un,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),p(en,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(en,"rel","nofollow"),p(Kn,"href","/docs/transformers/v4.27.1/en/model_doc/transfo-xl#transformers.TransfoXLLMHeadModel"),p(ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(so,"id","transformers.TransfoXLForSequenceClassification"),p(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"),p(so,"href","#transformers.TransfoXLForSequenceClassification"),p(Ot,"class","relative group"),p(Rn,"href","/docs/transformers/v4.27.1/en/model_doc/transfo-xl#transformers.TransfoXLForSequenceClassification"),p(Gn,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),p(rn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(rn,"rel","nofollow"),p(Yn,"href","/docs/transformers/v4.27.1/en/model_doc/transfo-xl#transformers.TransfoXLForSequenceClassification"),p(Ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(lo,"id","transformers.TFTransfoXLModel"),p(lo,"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"),p(lo,"href","#transformers.TFTransfoXLModel"),p(St,"class","relative group"),p(Qn,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.TFPreTrainedModel"),p(hn,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),p(hn,"rel","nofollow"),p(Zn,"href","/docs/transformers/v4.27.1/en/model_doc/transfo-xl#transformers.TFTransfoXLModel"),p(pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ho,"id","transformers.TFTransfoXLLMHeadModel"),p(ho,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ho,"href","#transformers.TFTransfoXLLMHeadModel"),p(Dt,"class","relative group"),p(Jn,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.TFPreTrainedModel"),p(vn,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),p(vn,"rel","nofollow"),p(es,"href","/docs/transformers/v4.27.1/en/model_doc/transfo-xl#transformers.TFTransfoXLLMHeadModel"),p(ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(_o,"id","transformers.TFTransfoXLForSequenceClassification"),p(_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"),p(_o,"href","#transformers.TFTransfoXLForSequenceClassification"),p(Ht,"class","relative group"),p(os,"href","/docs/transformers/v4.27.1/en/model_doc/transfo-xl#transformers.TFTransfoXLForSequenceClassification"),p(ns,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.TFPreTrainedModel"),p(Ln,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),p(Ln,"rel","nofollow"),p(ss,"href","/docs/transformers/v4.27.1/en/model_doc/transfo-xl#transformers.TFTransfoXLForSequenceClassification"),p(Re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(wo,"id","transformers.AdaptiveEmbedding"),p(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"),p(wo,"href","#transformers.AdaptiveEmbedding"),p(Wt,"class","relative group"),p(Xn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(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),m(o,b,_),m(o,u,_),e(u,g),e(g,v),k(l,v,null),e(u,h),e(u,F),e(F,K),m(o,re,_),m(o,z,_),e(z,S),e(S,B),e(z,pe),e(z,W),e(W,he),m(o,Q,_),m(o,ee,_),e(ee,ie),e(ie,V),k(de,V,null),e(ee,qe),e(ee,R),e(R,Ce),m(o,Le,_),m(o,D,_),e(D,ze),e(D,ce),e(ce,me),e(D,C),m(o,O,_),m(o,ue,_),e(ue,te),m(o,xe,_),m(o,ge,_),e(ge,G),e(G,Pe),m(o,Me,_),m(o,P,_),e(P,je),m(o,Z,_),m(o,I,_),e(I,Te),e(Te,oe),e(I,Oe),e(I,ve),e(ve,U),e(I,Ae),e(I,Y),e(Y,Se),e(I,_e),e(I,j),e(j,Ne),e(I,N),e(I,be),e(be,De),m(o,T,_),m(o,X,_),e(X,st),e(X,J),e(J,at),e(X,rt),e(X,E),e(E,it),e(X,lt),m(o,Ye,_),k(ye,o,_),m(o,Qe,_),m(o,A,_),e(A,H),e(H,Ue),k(Xe,Ue,null),e(A,ne),e(A,Ke),e(Ke,dt),m(o,Ee,_),m(o,we,_),e(we,le),e(le,Ie),e(Ie,vr),e(we,br),e(we,hs),e(hs,On),e(On,yr),m(o,Ta,_),m(o,$t,_),e($t,Rt),e(Rt,ms),k(Fo,ms,null),e($t,wr),e($t,us),e(us,kr),m(o,va,_),m(o,Ze,_),k(qo,Ze,null),e(Ze,$r),e(Ze,gt),e(gt,Lr),e(gt,An),e(An,xr),e(gt,Mr),e(gt,Sn),e(Sn,Xr),e(gt,Er),e(gt,Co),e(Co,Fr),e(gt,qr),e(Ze,Cr),e(Ze,Lt),e(Lt,zr),e(Lt,Nn),e(Nn,Pr),e(Lt,jr),e(Lt,Dn),e(Dn,Or),e(Lt,Ar),e(Ze,Sr),k(Gt,Ze,null),m(o,ba,_),m(o,xt,_),e(xt,Yt),e(Yt,gs),k(zo,gs,null),e(xt,Nr),e(xt,_s),e(_s,Dr),m(o,ya,_),m(o,Je,_),k(Po,Je,null),e(Je,Ir),e(Je,jo),e(jo,Hr),e(jo,Oo),e(Oo,Br),e(jo,Wr),e(Je,Ur),e(Je,Ao),e(Ao,Kr),e(Ao,In),e(In,Vr),e(Ao,Rr),e(Je,Gr),e(Je,Hn),k(So,Hn,null),m(o,wa,_),m(o,Mt,_),e(Mt,Qt),e(Qt,Ts),k(No,Ts,null),e(Mt,Yr),e(Mt,vs),e(vs,Qr),m(o,ka,_),m(o,Xt,_),k(Do,Xt,null),e(Xt,Zr),e(Xt,bs),e(bs,Jr),m(o,$a,_),m(o,Et,_),k(Io,Et,null),e(Et,ei),e(Et,ys),e(ys,ti),m(o,La,_),m(o,Ft,_),k(Ho,Ft,null),e(Ft,oi),e(Ft,ws),e(ws,ni),m(o,xa,_),m(o,qt,_),k(Bo,qt,null),e(qt,si),e(qt,ks),e(ks,ai),m(o,Ma,_),m(o,Ct,_),e(Ct,Zt),e(Zt,$s),k(Wo,$s,null),e(Ct,ri),e(Ct,Ls),e(Ls,ii),m(o,Xa,_),m(o,He,_),k(Uo,He,null),e(He,li),e(He,xs),e(xs,di),e(He,ci),e(He,Ko),e(Ko,fi),e(Ko,Bn),e(Bn,pi),e(Ko,hi),e(He,mi),e(He,Vo),e(Vo,ui),e(Vo,Ro),e(Ro,gi),e(Vo,_i),e(He,Ti),e(He,ct),k(Go,ct,null),e(ct,vi),e(ct,zt),e(zt,bi),e(zt,Wn),e(Wn,yi),e(zt,wi),e(zt,Ms),e(Ms,ki),e(zt,$i),e(ct,Li),k(Jt,ct,null),e(ct,xi),k(eo,ct,null),m(o,Ea,_),m(o,Pt,_),e(Pt,to),e(to,Xs),k(Yo,Xs,null),e(Pt,Mi),e(Pt,Es),e(Es,Xi),m(o,Fa,_),m(o,Be,_),k(Qo,Be,null),e(Be,Ei),e(Be,Fs),e(Fs,Fi),e(Be,qi),e(Be,Zo),e(Zo,Ci),e(Zo,Un),e(Un,zi),e(Zo,Pi),e(Be,ji),e(Be,Jo),e(Jo,Oi),e(Jo,en),e(en,Ai),e(Jo,Si),e(Be,Ni),e(Be,ft),k(tn,ft,null),e(ft,Di),e(ft,jt),e(jt,Ii),e(jt,Kn),e(Kn,Hi),e(jt,Bi),e(jt,qs),e(qs,Wi),e(jt,Ui),e(ft,Ki),k(oo,ft,null),e(ft,Vi),k(no,ft,null),m(o,qa,_),m(o,Ot,_),e(Ot,so),e(so,Cs),k(on,Cs,null),e(Ot,Ri),e(Ot,zs),e(zs,Gi),m(o,Ca,_),m(o,fe,_),k(nn,fe,null),e(fe,Yi),e(fe,Ps),e(Ps,Qi),e(fe,Zi),e(fe,Vn),e(Vn,Rn),e(Rn,Ji),e(Vn,el),e(fe,tl),e(fe,et),e(et,ol),e(et,js),e(js,nl),e(et,sl),e(et,Os),e(Os,al),e(et,rl),e(et,As),e(As,il),e(et,ll),e(et,Ss),e(Ss,dl),e(et,cl),e(fe,fl),e(fe,sn),e(sn,pl),e(sn,Gn),e(Gn,hl),e(sn,ml),e(fe,ul),e(fe,an),e(an,gl),e(an,rn),e(rn,_l),e(an,Tl),e(fe,vl),e(fe,Ve),k(ln,Ve,null),e(Ve,bl),e(Ve,At),e(At,yl),e(At,Yn),e(Yn,wl),e(At,kl),e(At,Ns),e(Ns,$l),e(At,Ll),e(Ve,xl),k(ao,Ve,null),e(Ve,Ml),k(ro,Ve,null),e(Ve,Xl),k(io,Ve,null),m(o,za,_),m(o,St,_),e(St,lo),e(lo,Ds),k(dn,Ds,null),e(St,El),e(St,Is),e(Is,Fl),m(o,Pa,_),m(o,ke,_),k(cn,ke,null),e(ke,ql),e(ke,Hs),e(Hs,Cl),e(ke,zl),e(ke,fn),e(fn,Pl),e(fn,Qn),e(Qn,jl),e(fn,Ol),e(ke,Al),e(ke,pn),e(pn,Sl),e(pn,hn),e(hn,Nl),e(pn,Dl),e(ke,Il),k(co,ke,null),e(ke,Hl),e(ke,pt),k(mn,pt,null),e(pt,Bl),e(pt,Nt),e(Nt,Wl),e(Nt,Zn),e(Zn,Ul),e(Nt,Kl),e(Nt,Bs),e(Bs,Vl),e(Nt,Rl),e(pt,Gl),k(fo,pt,null),e(pt,Yl),k(po,pt,null),m(o,ja,_),m(o,Dt,_),e(Dt,ho),e(ho,Ws),k(un,Ws,null),e(Dt,Ql),e(Dt,Us),e(Us,Zl),m(o,Oa,_),m(o,$e,_),k(gn,$e,null),e($e,Jl),e($e,Ks),e(Ks,ed),e($e,td),e($e,_n),e(_n,od),e(_n,Jn),e(Jn,nd),e(_n,sd),e($e,ad),e($e,Tn),e(Tn,rd),e(Tn,vn),e(vn,id),e(Tn,ld),e($e,dd),k(mo,$e,null),e($e,cd),e($e,ht),k(bn,ht,null),e(ht,fd),e(ht,It),e(It,pd),e(It,es),e(es,hd),e(It,md),e(It,Vs),e(Vs,ud),e(It,gd),e(ht,_d),k(uo,ht,null),e(ht,Td),k(go,ht,null),m(o,Aa,_),m(o,Ht,_),e(Ht,_o),e(_o,Rs),k(yn,Rs,null),e(Ht,vd),e(Ht,Gs),e(Gs,bd),m(o,Sa,_),m(o,se,_),k(wn,se,null),e(se,yd),e(se,Ys),e(Ys,wd),e(se,kd),e(se,ts),e(ts,os),e(os,$d),e(ts,Ld),e(se,xd),e(se,tt),e(tt,Md),e(tt,Qs),e(Qs,Xd),e(tt,Ed),e(tt,Zs),e(Zs,Fd),e(tt,qd),e(tt,Js),e(Js,Cd),e(tt,zd),e(tt,ea),e(ea,Pd),e(tt,jd),e(se,Od),e(se,kn),e(kn,Ad),e(kn,ns),e(ns,Sd),e(kn,Nd),e(se,Dd),e(se,$n),e($n,Id),e($n,Ln),e(Ln,Hd),e($n,Bd),e(se,Wd),k(To,se,null),e(se,Ud),e(se,Re),k(xn,Re,null),e(Re,Kd),e(Re,Bt),e(Bt,Vd),e(Bt,ss),e(ss,Rd),e(Bt,Gd),e(Bt,ta),e(ta,Yd),e(Bt,Qd),e(Re,Zd),k(vo,Re,null),e(Re,Jd),k(bo,Re,null),e(Re,ec),k(yo,Re,null),m(o,Na,_),m(o,Wt,_),e(Wt,wo),e(wo,oa),k(Mn,oa,null),e(Wt,tc),e(Wt,na),e(na,oc),m(o,Da,_),m(o,Xn,_),k(En,Xn,null),m(o,Ia,_),m(o,Fn,_),k(qn,Fn,null),Ha=!0},p(o,[_]){const Cn={};_&2&&(Cn.$$scope={dirty:_,ctx:o}),ye.$set(Cn);const sa={};_&2&&(sa.$$scope={dirty:_,ctx:o}),Gt.$set(sa);const aa={};_&2&&(aa.$$scope={dirty:_,ctx:o}),Jt.$set(aa);const ra={};_&2&&(ra.$$scope={dirty:_,ctx:o}),eo.$set(ra);const zn={};_&2&&(zn.$$scope={dirty:_,ctx:o}),oo.$set(zn);const ia={};_&2&&(ia.$$scope={dirty:_,ctx:o}),no.$set(ia);const la={};_&2&&(la.$$scope={dirty:_,ctx:o}),ao.$set(la);const Pn={};_&2&&(Pn.$$scope={dirty:_,ctx:o}),ro.$set(Pn);const da={};_&2&&(da.$$scope={dirty:_,ctx:o}),io.$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 jn={};_&2&&(jn.$$scope={dirty:_,ctx:o}),po.$set(jn);const pa={};_&2&&(pa.$$scope={dirty:_,ctx:o}),mo.$set(pa);const ha={};_&2&&(ha.$$scope={dirty:_,ctx:o}),uo.$set(ha);const ma={};_&2&&(ma.$$scope={dirty:_,ctx:o}),go.$set(ma);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){Ha||($(l.$$.fragment,o),$(de.$$.fragment,o),$(ye.$$.fragment,o),$(Xe.$$.fragment,o),$(Fo.$$.fragment,o),$(qo.$$.fragment,o),$(Gt.$$.fragment,o),$(zo.$$.fragment,o),$(Po.$$.fragment,o),$(So.$$.fragment,o),$(No.$$.fragment,o),$(Do.$$.fragment,o),$(Io.$$.fragment,o),$(Ho.$$.fragment,o),$(Bo.$$.fragment,o),$(Wo.$$.fragment,o),$(Uo.$$.fragment,o),$(Go.$$.fragment,o),$(Jt.$$.fragment,o),$(eo.$$.fragment,o),$(Yo.$$.fragment,o),$(Qo.$$.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),$(io.$$.fragment,o),$(dn.$$.fragment,o),$(cn.$$.fragment,o),$(co.$$.fragment,o),$(mn.$$.fragment,o),$(fo.$$.fragment,o),$(po.$$.fragment,o),$(un.$$.fragment,o),$(gn.$$.fragment,o),$(mo.$$.fragment,o),$(bn.$$.fragment,o),$(uo.$$.fragment,o),$(go.$$.fragment,o),$(yn.$$.fragment,o),$(wn.$$.fragment,o),$(To.$$.fragment,o),$(xn.$$.fragment,o),$(vo.$$.fragment,o),$(bo.$$.fragment,o),$(yo.$$.fragment,o),$(Mn.$$.fragment,o),$(En.$$.fragment,o),$(qn.$$.fragment,o),Ha=!0)},o(o){L(l.$$.fragment,o),L(de.$$.fragment,o),L(ye.$$.fragment,o),L(Xe.$$.fragment,o),L(Fo.$$.fragment,o),L(qo.$$.fragment,o),L(Gt.$$.fragment,o),L(zo.$$.fragment,o),L(Po.$$.fragment,o),L(So.$$.fragment,o),L(No.$$.fragment,o),L(Do.$$.fragment,o),L(Io.$$.fragment,o),L(Ho.$$.fragment,o),L(Bo.$$.fragment,o),L(Wo.$$.fragment,o),L(Uo.$$.fragment,o),L(Go.$$.fragment,o),L(Jt.$$.fragment,o),L(eo.$$.fragment,o),L(Yo.$$.fragment,o),L(Qo.$$.fragment,o),L(tn.$$.fragment,o),L(oo.$$.fragment,o),L(no.$$.fragment,o),L(on.$$.fragment,o),L(nn.$$.fragment,o),L(ln.$$.fragment,o),L(ao.$$.fragment,o),L(ro.$$.fragment,o),L(io.$$.fragment,o),L(dn.$$.fragment,o),L(cn.$$.fragment,o),L(co.$$.fragment,o),L(mn.$$.fragment,o),L(fo.$$.fragment,o),L(po.$$.fragment,o),L(un.$$.fragment,o),L(gn.$$.fragment,o),L(mo.$$.fragment,o),L(bn.$$.fragment,o),L(uo.$$.fragment,o),L(go.$$.fragment,o),L(yn.$$.fragment,o),L(wn.$$.fragment,o),L(To.$$.fragment,o),L(xn.$$.fragment,o),L(vo.$$.fragment,o),L(bo.$$.fragment,o),L(yo.$$.fragment,o),L(Mn.$$.fragment,o),L(En.$$.fragment,o),L(qn.$$.fragment,o),Ha=!1},d(o){t(d),o&&t(b),o&&t(u),x(l),o&&t(re),o&&t(z),o&&t(Q),o&&t(ee),x(de),o&&t(Le),o&&t(D),o&&t(O),o&&t(ue),o&&t(xe),o&&t(ge),o&&t(Me),o&&t(P),o&&t(Z),o&&t(I),o&&t(T),o&&t(X),o&&t(Ye),x(ye,o),o&&t(Qe),o&&t(A),x(Xe),o&&t(Ee),o&&t(we),o&&t(Ta),o&&t($t),x(Fo),o&&t(va),o&&t(Ze),x(qo),x(Gt),o&&t(ba),o&&t(xt),x(zo),o&&t(ya),o&&t(Je),x(Po),x(So),o&&t(wa),o&&t(Mt),x(No),o&&t(ka),o&&t(Xt),x(Do),o&&t($a),o&&t(Et),x(Io),o&&t(La),o&&t(Ft),x(Ho),o&&t(xa),o&&t(qt),x(Bo),o&&t(Ma),o&&t(Ct),x(Wo),o&&t(Xa),o&&t(He),x(Uo),x(Go),x(Jt),x(eo),o&&t(Ea),o&&t(Pt),x(Yo),o&&t(Fa),o&&t(Be),x(Qo),x(tn),x(oo),x(no),o&&t(qa),o&&t(Ot),x(on),o&&t(Ca),o&&t(fe),x(nn),x(ln),x(ao),x(ro),x(io),o&&t(za),o&&t(St),x(dn),o&&t(Pa),o&&t(ke),x(cn),x(co),x(mn),x(fo),x(po),o&&t(ja),o&&t(Dt),x(un),o&&t(Oa),o&&t($e),x(gn),x(mo),x(bn),x(uo),x(go),o&&t(Aa),o&&t(Ht),x(yn),o&&t(Sa),o&&t(se),x(wn),x(To),x(xn),x(vo),x(bo),x(yo),o&&t(Na),o&&t(Wt),x(Mn),o&&t(Da),o&&t(Xn),x(En),o&&t(Ia),o&&t(Fn),x(qn)}}}const yp={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 wp(q){return ep(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ep extends Yf{constructor(d){super();Qf(this,d,wp,bp,Zf,{})}}export{Ep as default,yp as metadata};
