import{S as K2,i as R2,s as V2,e as r,k as c,w as v,t as n,Y as sn,M as G2,c as a,d as t,m as h,a as i,x as y,h as s,Z as rn,b as g,N as N2,G as e,g as f,y as T,q as $,o as L,B as x,v as J2,L as nt}from"../../chunks/vendor-hf-doc-builder.js";import{T as tt}from"../../chunks/Tip-hf-doc-builder.js";import{D}from"../../chunks/Docstring-hf-doc-builder.js";import{C as et}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ze}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ot}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Y2(z){let d,k,p,u,b;return u=new et({props:{code:`from transformers import LongformerConfig, LongformerModel

# Initializing a Longformer configuration
configuration = LongformerConfig()

# Initializing a model from the configuration
model = LongformerModel(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> LongformerConfig, LongformerModel

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LongformerModel(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=r("p"),k=n("Example:"),p=c(),v(u.$$.fragment)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Example:"),m.forEach(t),p=h(l),y(u.$$.fragment,l)},m(l,m){f(l,d,m),e(d,k),f(l,p,m),T(u,l,m),b=!0},p:nt,i(l){b||($(u.$$.fragment,l),b=!0)},o(l){L(u.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(u,l)}}}function X2(z){let d,k,p,u,b;return u=new et({props:{code:`from transformers import LongformerTokenizer

tokenizer = LongformerTokenizer.from_pretrained("allenai/longformer-base-4096")
tokenizer("Hello world")["input_ids"]

tokenizer(" Hello world")["input_ids"]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LongformerTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = LongformerTokenizer.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-base-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">0</span>, <span class="hljs-number">31414</span>, <span class="hljs-number">232</span>, <span class="hljs-number">2</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot; Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">0</span>, <span class="hljs-number">20920</span>, <span class="hljs-number">232</span>, <span class="hljs-number">2</span>]`}}),{c(){d=r("p"),k=n("be encoded differently whether it is at the beginning of the sentence (without space) or not:"),p=c(),v(u.$$.fragment)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"be encoded differently whether it is at the beginning of the sentence (without space) or not:"),m.forEach(t),p=h(l),y(u.$$.fragment,l)},m(l,m){f(l,d,m),e(d,k),f(l,p,m),T(u,l,m),b=!0},p:nt,i(l){b||($(u.$$.fragment,l),b=!0)},o(l){L(u.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(u,l)}}}function Z2(z){let d,k,p,u,b;return{c(){d=r("p"),k=n("When used with "),p=r("code"),u=n("is_split_into_words=True"),b=n(", this tokenizer will add a space before each word (even the first one).")},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"When used with "),p=a(m,"CODE",{});var E=i(p);u=s(E,"is_split_into_words=True"),E.forEach(t),b=s(m,", this tokenizer will add a space before each word (even the first one)."),m.forEach(t)},m(l,m){f(l,d,m),e(d,k),e(d,p),e(p,u),e(d,b)},d(l){l&&t(d)}}}function e0(z){let d,k,p,u,b;return u=new et({props:{code:`from transformers import LongformerTokenizerFast

tokenizer = LongformerTokenizerFast.from_pretrained("allenai/longformer-base-4096")
tokenizer("Hello world")["input_ids"]

tokenizer(" Hello world")["input_ids"]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LongformerTokenizerFast

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = LongformerTokenizerFast.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-base-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">0</span>, <span class="hljs-number">31414</span>, <span class="hljs-number">232</span>, <span class="hljs-number">2</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot; Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">0</span>, <span class="hljs-number">20920</span>, <span class="hljs-number">232</span>, <span class="hljs-number">2</span>]`}}),{c(){d=r("p"),k=n("be encoded differently whether it is at the beginning of the sentence (without space) or not:"),p=c(),v(u.$$.fragment)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"be encoded differently whether it is at the beginning of the sentence (without space) or not:"),m.forEach(t),p=h(l),y(u.$$.fragment,l)},m(l,m){f(l,d,m),e(d,k),f(l,p,m),T(u,l,m),b=!0},p:nt,i(l){b||($(u.$$.fragment,l),b=!0)},o(l){L(u.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(u,l)}}}function t0(z){let d,k,p,u,b,l,m,E;return{c(){d=r("p"),k=n("When used with "),p=r("code"),u=n("is_split_into_words=True"),b=n(", this tokenizer needs to be instantiated with "),l=r("code"),m=n("add_prefix_space=True"),E=n(".")},l(re){d=a(re,"P",{});var ee=i(d);k=s(ee,"When used with "),p=a(ee,"CODE",{});var N=i(p);u=s(N,"is_split_into_words=True"),N.forEach(t),b=s(ee,", this tokenizer needs to be instantiated with "),l=a(ee,"CODE",{});var ae=i(l);m=s(ae,"add_prefix_space=True"),ae.forEach(t),E=s(ee,"."),ee.forEach(t)},m(re,ee){f(re,d,ee),e(d,k),e(d,p),e(p,u),e(d,b),e(d,l),e(l,m),e(d,E)},d(re){re&&t(d)}}}function o0(z){let d,k,p,u,b;return{c(){d=r("p"),k=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r("code"),u=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(m,"CODE",{});var E=i(p);u=s(E,"Module"),E.forEach(t),b=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,k),e(d,p),e(p,u),e(d,b)},d(l){l&&t(d)}}}function n0(z){let d,k,p,u,b;return u=new et({props:{code:`import torch
from transformers import LongformerModel, AutoTokenizer

model = LongformerModel.from_pretrained("allenai/longformer-base-4096")
tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-base-4096")

SAMPLE_TEXT = " ".join(["Hello world! "] * 1000)  # long input document
input_ids = torch.tensor(tokenizer.encode(SAMPLE_TEXT)).unsqueeze(0)  # batch of size 1

attention_mask = torch.ones(
    input_ids.shape, dtype=torch.long, device=input_ids.device
)  # initialize to local attention
global_attention_mask = torch.zeros(
    input_ids.shape, dtype=torch.long, device=input_ids.device
)  # initialize to global attention to be deactivated for all tokens
global_attention_mask[
    :,
    [
        1,
        4,
        21,
    ],
] = 1  # Set global attention to random tokens for the sake of this example
# Usually, set global attention based on the task. For example,
# classification: the <s> token
# QA: question tokens
# LM: potentially on the beginning of sentences and paragraphs
outputs = model(input_ids, attention_mask=attention_mask, global_attention_mask=global_attention_mask)
sequence_output = outputs.last_hidden_state
pooled_output = outputs.pooler_output`,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> LongformerModel, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = LongformerModel.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-base-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-base-4096&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>SAMPLE_TEXT = <span class="hljs-string">&quot; &quot;</span>.join([<span class="hljs-string">&quot;Hello world! &quot;</span>] * <span class="hljs-number">1000</span>)  <span class="hljs-comment"># long input document</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = torch.tensor(tokenizer.encode(SAMPLE_TEXT)).unsqueeze(<span class="hljs-number">0</span>)  <span class="hljs-comment"># batch of size 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>attention_mask = torch.ones(
<span class="hljs-meta">... </span>    input_ids.shape, dtype=torch.long, device=input_ids.device
<span class="hljs-meta">... </span>)  <span class="hljs-comment"># initialize to local attention</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>global_attention_mask = torch.zeros(
<span class="hljs-meta">... </span>    input_ids.shape, dtype=torch.long, device=input_ids.device
<span class="hljs-meta">... </span>)  <span class="hljs-comment"># initialize to global attention to be deactivated for all tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>global_attention_mask[
<span class="hljs-meta">... </span>    :,
<span class="hljs-meta">... </span>    [
<span class="hljs-meta">... </span>        <span class="hljs-number">1</span>,
<span class="hljs-meta">... </span>        <span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>        <span class="hljs-number">21</span>,
<span class="hljs-meta">... </span>    ],
<span class="hljs-meta">... </span>] = <span class="hljs-number">1</span>  <span class="hljs-comment"># Set global attention to random tokens for the sake of this example</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Usually, set global attention based on the task. For example,</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># classification: the &lt;s&gt; token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># QA: question tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># LM: potentially on the beginning of sentences and paragraphs</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids, attention_mask=attention_mask, global_attention_mask=global_attention_mask)
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_output = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span>pooled_output = outputs.pooler_output`}}),{c(){d=r("p"),k=n("Examples:"),p=c(),v(u.$$.fragment)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Examples:"),m.forEach(t),p=h(l),y(u.$$.fragment,l)},m(l,m){f(l,d,m),e(d,k),f(l,p,m),T(u,l,m),b=!0},p:nt,i(l){b||($(u.$$.fragment,l),b=!0)},o(l){L(u.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(u,l)}}}function s0(z){let d,k,p,u,b;return{c(){d=r("p"),k=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r("code"),u=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(m,"CODE",{});var E=i(p);u=s(E,"Module"),E.forEach(t),b=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,k),e(d,p),e(p,u),e(d,b)},d(l){l&&t(d)}}}function r0(z){let d,k,p,u,b;return u=new et({props:{code:`from transformers import AutoTokenizer, LongformerForMaskedLM

tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-base-4096")
model = LongformerForMaskedLM.from_pretrained("allenai/longformer-base-4096")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, LongformerForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-base-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LongformerForMaskedLM.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-base-4096&quot;</span>)`}}),{c(){d=r("p"),k=n("Mask filling example:"),p=c(),v(u.$$.fragment)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Mask filling example:"),m.forEach(t),p=h(l),y(u.$$.fragment,l)},m(l,m){f(l,d,m),e(d,k),f(l,p,m),T(u,l,m),b=!0},p:nt,i(l){b||($(u.$$.fragment,l),b=!0)},o(l){L(u.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(u,l)}}}function a0(z){let d,k;return d=new et({props:{code:`TXT = (
    "My friends are <mask> but they eat too many carbs."
    + " That's why I decide not to eat with them." * 300
)
input_ids = tokenizer([TXT], return_tensors="pt")["input_ids"]
logits = model(input_ids).logits

masked_index = (input_ids[0] == tokenizer.mask_token_id).nonzero().item()
probs = logits[0, masked_index].softmax(dim=0)
values, predictions = probs.topk(5)

tokenizer.decode(predictions).split()`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>TXT = (
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;My friends are &lt;mask&gt; but they eat too many carbs.&quot;</span>
<span class="hljs-meta">... </span>    + <span class="hljs-string">&quot; That&#x27;s why I decide not to eat with them.&quot;</span> * <span class="hljs-number">300</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer([TXT], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(input_ids).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>masked_index = (input_ids[<span class="hljs-number">0</span>] == tokenizer.mask_token_id).nonzero().item()
<span class="hljs-meta">&gt;&gt;&gt; </span>probs = logits[<span class="hljs-number">0</span>, masked_index].softmax(dim=<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>values, predictions = probs.topk(<span class="hljs-number">5</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.decode(predictions).split()
[<span class="hljs-string">&#x27;healthy&#x27;</span>, <span class="hljs-string">&#x27;skinny&#x27;</span>, <span class="hljs-string">&#x27;thin&#x27;</span>, <span class="hljs-string">&#x27;good&#x27;</span>, <span class="hljs-string">&#x27;vegetarian&#x27;</span>]`}}),{c(){v(d.$$.fragment)},l(p){y(d.$$.fragment,p)},m(p,u){T(d,p,u),k=!0},p:nt,i(p){k||($(d.$$.fragment,p),k=!0)},o(p){L(d.$$.fragment,p),k=!1},d(p){x(d,p)}}}function i0(z){let d,k,p,u,b;return{c(){d=r("p"),k=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r("code"),u=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(m,"CODE",{});var E=i(p);u=s(E,"Module"),E.forEach(t),b=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,k),e(d,p),e(p,u),e(d,b)},d(l){l&&t(d)}}}function l0(z){let d,k,p,u,b;return u=new et({props:{code:`import torch
from transformers import AutoTokenizer, LongformerForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("jpwahle/longformer-base-plagiarism-detection")
model = LongformerForSequenceClassification.from_pretrained("jpwahle/longformer-base-plagiarism-detection")

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

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

predicted_class_id = logits.argmax().item()
model.config.id2label[predicted_class_id]

# 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 = LongformerForSequenceClassification.from_pretrained("jpwahle/longformer-base-plagiarism-detection", num_labels=num_labels)

labels = torch.tensor([1])
loss = model(**inputs, labels=labels).loss
round(loss.item(), 2)`,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, LongformerForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;jpwahle/longformer-base-plagiarism-detection&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LongformerForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;jpwahle/longformer-base-plagiarism-detection&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>model.config.id2label[predicted_class_id]
<span class="hljs-string">&#x27;ORIGINAL&#x27;</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 = LongformerForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;jpwahle/longformer-base-plagiarism-detection&quot;</span>, num_labels=num_labels)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor([<span class="hljs-number">1</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">5.44</span>`}}),{c(){d=r("p"),k=n("Example of single-label classification:"),p=c(),v(u.$$.fragment)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Example of single-label classification:"),m.forEach(t),p=h(l),y(u.$$.fragment,l)},m(l,m){f(l,d,m),e(d,k),f(l,p,m),T(u,l,m),b=!0},p:nt,i(l){b||($(u.$$.fragment,l),b=!0)},o(l){L(u.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(u,l)}}}function d0(z){let d,k,p,u,b;return u=new et({props:{code:`import torch
from transformers import AutoTokenizer, LongformerForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("jpwahle/longformer-base-plagiarism-detection")
model = LongformerForSequenceClassification.from_pretrained("jpwahle/longformer-base-plagiarism-detection", 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 = LongformerForSequenceClassification.from_pretrained(
    "jpwahle/longformer-base-plagiarism-detection", 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, LongformerForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;jpwahle/longformer-base-plagiarism-detection&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LongformerForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;jpwahle/longformer-base-plagiarism-detection&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 = LongformerForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;jpwahle/longformer-base-plagiarism-detection&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=r("p"),k=n("Example of multi-label classification:"),p=c(),v(u.$$.fragment)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Example of multi-label classification:"),m.forEach(t),p=h(l),y(u.$$.fragment,l)},m(l,m){f(l,d,m),e(d,k),f(l,p,m),T(u,l,m),b=!0},p:nt,i(l){b||($(u.$$.fragment,l),b=!0)},o(l){L(u.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(u,l)}}}function c0(z){let d,k,p,u,b;return{c(){d=r("p"),k=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r("code"),u=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(m,"CODE",{});var E=i(p);u=s(E,"Module"),E.forEach(t),b=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,k),e(d,p),e(p,u),e(d,b)},d(l){l&&t(d)}}}function h0(z){let d,k,p,u,b;return u=new et({props:{code:`from transformers import AutoTokenizer, LongformerForMultipleChoice
import torch

tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-base-4096")
model = LongformerForMultipleChoice.from_pretrained("allenai/longformer-base-4096")

prompt = "In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."
choice0 = "It is eaten with a fork and a knife."
choice1 = "It is eaten while held in the hand."
labels = torch.tensor(0).unsqueeze(0)  # choice0 is correct (according to Wikipedia ;)), batch size 1

encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors="pt", padding=True)
outputs = model(**{k: v.unsqueeze(0) for k, v in encoding.items()}, labels=labels)  # batch size is 1

# the linear classifier still needs to be trained
loss = outputs.loss
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, LongformerForMultipleChoice
<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;allenai/longformer-base-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LongformerForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-base-4096&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>choice0 = <span class="hljs-string">&quot;It is eaten with a fork and a knife.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>choice1 = <span class="hljs-string">&quot;It is eaten while held in the hand.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor(<span class="hljs-number">0</span>).unsqueeze(<span class="hljs-number">0</span>)  <span class="hljs-comment"># choice0 is correct (according to Wikipedia ;)), batch size 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**{k: v.unsqueeze(<span class="hljs-number">0</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> encoding.items()}, labels=labels)  <span class="hljs-comment"># batch size is 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># the linear classifier still needs to be trained</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=r("p"),k=n("Example:"),p=c(),v(u.$$.fragment)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Example:"),m.forEach(t),p=h(l),y(u.$$.fragment,l)},m(l,m){f(l,d,m),e(d,k),f(l,p,m),T(u,l,m),b=!0},p:nt,i(l){b||($(u.$$.fragment,l),b=!0)},o(l){L(u.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(u,l)}}}function m0(z){let d,k,p,u,b;return{c(){d=r("p"),k=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r("code"),u=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(m,"CODE",{});var E=i(p);u=s(E,"Module"),E.forEach(t),b=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,k),e(d,p),e(p,u),e(d,b)},d(l){l&&t(d)}}}function p0(z){let d,k,p,u,b;return u=new et({props:{code:`from transformers import AutoTokenizer, LongformerForTokenClassification
import torch

tokenizer = AutoTokenizer.from_pretrained("brad1141/Longformer-finetuned-norm")
model = LongformerForTokenClassification.from_pretrained("brad1141/Longformer-finetuned-norm")

inputs = tokenizer(
    "HuggingFace is a company based in Paris and New York", add_special_tokens=False, return_tensors="pt"
)

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

predicted_token_class_ids = logits.argmax(-1)

# Note that tokens are classified rather then input words which means that
# there might be more predicted token classes than words.
# Multiple token classes might account for the same word
predicted_tokens_classes = [model.config.id2label[t.item()] for t in predicted_token_class_ids[0]]
predicted_tokens_classes

labels = predicted_token_class_ids
loss = model(**inputs, labels=labels).loss
round(loss.item(), 2)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, LongformerForTokenClassification
<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;brad1141/Longformer-finetuned-norm&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LongformerForTokenClassification.from_pretrained(<span class="hljs-string">&quot;brad1141/Longformer-finetuned-norm&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;HuggingFace is a company based in Paris and New York&quot;</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </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_token_class_ids = logits.argmax(-<span class="hljs-number">1</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Note that tokens are classified rather then input words which means that</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># there might be more predicted token classes than words.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Multiple token classes might account for the same word</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_tokens_classes = [model.config.id2label[t.item()] <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> predicted_token_class_ids[<span class="hljs-number">0</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_tokens_classes
[<span class="hljs-string">&#x27;Evidence&#x27;</span>, <span class="hljs-string">&#x27;Evidence&#x27;</span>, <span class="hljs-string">&#x27;Evidence&#x27;</span>, <span class="hljs-string">&#x27;Evidence&#x27;</span>, <span class="hljs-string">&#x27;Evidence&#x27;</span>, <span class="hljs-string">&#x27;Evidence&#x27;</span>, <span class="hljs-string">&#x27;Evidence&#x27;</span>, <span class="hljs-string">&#x27;Evidence&#x27;</span>, <span class="hljs-string">&#x27;Evidence&#x27;</span>, <span class="hljs-string">&#x27;Evidence&#x27;</span>, <span class="hljs-string">&#x27;Evidence&#x27;</span>, <span class="hljs-string">&#x27;Evidence&#x27;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = predicted_token_class_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">0.63</span>`}}),{c(){d=r("p"),k=n("Example:"),p=c(),v(u.$$.fragment)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Example:"),m.forEach(t),p=h(l),y(u.$$.fragment,l)},m(l,m){f(l,d,m),e(d,k),f(l,p,m),T(u,l,m),b=!0},p:nt,i(l){b||($(u.$$.fragment,l),b=!0)},o(l){L(u.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(u,l)}}}function f0(z){let d,k,p,u,b;return{c(){d=r("p"),k=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r("code"),u=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(m,"CODE",{});var E=i(p);u=s(E,"Module"),E.forEach(t),b=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,k),e(d,p),e(p,u),e(d,b)},d(l){l&&t(d)}}}function g0(z){let d,k,p,u,b;return u=new et({props:{code:`from transformers import AutoTokenizer, LongformerForQuestionAnswering
import torch

tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-large-4096-finetuned-triviaqa")
model = LongformerForQuestionAnswering.from_pretrained("allenai/longformer-large-4096-finetuned-triviaqa")

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"
encoding = tokenizer(question, text, return_tensors="pt")
input_ids = encoding["input_ids"]

# default is local attention everywhere
# the forward method will automatically set global attention on question tokens
attention_mask = encoding["attention_mask"]

outputs = model(input_ids, attention_mask=attention_mask)
start_logits = outputs.start_logits
end_logits = outputs.end_logits
all_tokens = tokenizer.convert_ids_to_tokens(input_ids[0].tolist())

answer_tokens = all_tokens[torch.argmax(start_logits) : torch.argmax(end_logits) + 1]
answer = tokenizer.decode(
    tokenizer.convert_tokens_to_ids(answer_tokens)
)  # remove space prepending space token`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, LongformerForQuestionAnswering
<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;allenai/longformer-large-4096-finetuned-triviaqa&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LongformerForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-large-4096-finetuned-triviaqa&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>question, text = <span class="hljs-string">&quot;Who was Jim Henson?&quot;</span>, <span class="hljs-string">&quot;Jim Henson was a nice puppet&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(question, text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = encoding[<span class="hljs-string">&quot;input_ids&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># default is local attention everywhere</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># the forward method will automatically set global attention on question tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>attention_mask = encoding[<span class="hljs-string">&quot;attention_mask&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids, attention_mask=attention_mask)
<span class="hljs-meta">&gt;&gt;&gt; </span>start_logits = outputs.start_logits
<span class="hljs-meta">&gt;&gt;&gt; </span>end_logits = outputs.end_logits
<span class="hljs-meta">&gt;&gt;&gt; </span>all_tokens = tokenizer.convert_ids_to_tokens(input_ids[<span class="hljs-number">0</span>].tolist())

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

tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-base-4096")
model = TFLongformerForMaskedLM.from_pretrained("allenai/longformer-base-4096")

inputs = tokenizer("The capital of France is <mask>.", return_tensors="tf")
logits = model(**inputs).logits

# retrieve index of <mask>
mask_token_index = tf.where((inputs.input_ids == tokenizer.mask_token_id)[0])
selected_logits = tf.gather_nd(logits[0], indices=mask_token_index)

predicted_token_id = tf.math.argmax(selected_logits, axis=-1)
tokenizer.decode(predicted_token_id)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFLongformerForMaskedLM
<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;allenai/longformer-base-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFLongformerForMaskedLM.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-base-4096&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;The capital of France is &lt;mask&gt;.&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><span class="hljs-comment"># retrieve index of &lt;mask&gt;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_index = tf.where((inputs.input_ids == tokenizer.mask_token_id)[<span class="hljs-number">0</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>selected_logits = tf.gather_nd(logits[<span class="hljs-number">0</span>], indices=mask_token_index)

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_id = tf.math.argmax(selected_logits, axis=-<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.decode(predicted_token_id)
<span class="hljs-string">&#x27; Paris&#x27;</span>`}}),{c(){d=r("p"),k=n("Example:"),p=c(),v(u.$$.fragment)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Example:"),m.forEach(t),p=h(l),y(u.$$.fragment,l)},m(l,m){f(l,d,m),e(d,k),f(l,p,m),T(u,l,m),b=!0},p:nt,i(l){b||($(u.$$.fragment,l),b=!0)},o(l){L(u.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(u,l)}}}function v0(z){let d,k;return d=new et({props:{code:`labels = tokenizer("The capital of France is Paris.", return_tensors="tf")["input_ids"]
# mask labels of non-<mask> tokens
labels = tf.where(inputs.input_ids == tokenizer.mask_token_id, labels, -100)

outputs = model(**inputs, labels=labels)
round(float(outputs.loss), 2)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tokenizer(<span class="hljs-string">&quot;The capital of France is Paris.&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># mask labels of non-&lt;mask&gt; tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tf.where(inputs.input_ids == tokenizer.mask_token_id, labels, -<span class="hljs-number">100</span>)

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

tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-large-4096-finetuned-triviaqa")
model = TFLongformerForQuestionAnswering.from_pretrained("allenai/longformer-large-4096-finetuned-triviaqa")

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"

inputs = tokenizer(question, text, return_tensors="tf")
outputs = model(**inputs)

answer_start_index = int(tf.math.argmax(outputs.start_logits, axis=-1)[0])
answer_end_index = int(tf.math.argmax(outputs.end_logits, axis=-1)[0])

predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]
tokenizer.decode(predict_answer_tokens)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFLongformerForQuestionAnswering
<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;allenai/longformer-large-4096-finetuned-triviaqa&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFLongformerForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-large-4096-finetuned-triviaqa&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>question, text = <span class="hljs-string">&quot;Who was Jim Henson?&quot;</span>, <span class="hljs-string">&quot;Jim Henson was a nice puppet&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(question, text, 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>answer_start_index = <span class="hljs-built_in">int</span>(tf.math.argmax(outputs.start_logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_end_index = <span class="hljs-built_in">int</span>(tf.math.argmax(outputs.end_logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>predict_answer_tokens = inputs.input_ids[<span class="hljs-number">0</span>, answer_start_index : answer_end_index + <span class="hljs-number">1</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.decode(predict_answer_tokens)
<span class="hljs-string">&#x27; puppet&#x27;</span>`}}),{c(){d=r("p"),k=n("Example:"),p=c(),v(u.$$.fragment)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Example:"),m.forEach(t),p=h(l),y(u.$$.fragment,l)},m(l,m){f(l,d,m),e(d,k),f(l,p,m),T(u,l,m),b=!0},p:nt,i(l){b||($(u.$$.fragment,l),b=!0)},o(l){L(u.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(u,l)}}}function L0(z){let d,k;return d=new et({props:{code:`# target is "nice puppet"
target_start_index = tf.constant([14])
target_end_index = tf.constant([15])

outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index)
loss = tf.math.reduce_mean(outputs.loss)
round(float(loss), 2)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># target is &quot;nice puppet&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_start_index = tf.constant([<span class="hljs-number">14</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>target_end_index = tf.constant([<span class="hljs-number">15</span>])

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

tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-base-4096")
model = TFLongformerForSequenceClassification.from_pretrained("allenai/longformer-base-4096")

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

tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-base-4096")
model = TFLongformerForTokenClassification.from_pretrained("allenai/longformer-base-4096")

inputs = tokenizer(
    "HuggingFace is a company based in Paris and New York", add_special_tokens=False, return_tensors="tf"
)

logits = model(**inputs).logits
predicted_token_class_ids = tf.math.argmax(logits, axis=-1)

# Note that tokens are classified rather then input words which means that
# there might be more predicted token classes than words.
# Multiple token classes might account for the same word
predicted_tokens_classes = [model.config.id2label[t] for t in predicted_token_class_ids[0].numpy().tolist()]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFLongformerForTokenClassification
<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;allenai/longformer-base-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFLongformerForTokenClassification.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-base-4096&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;HuggingFace is a company based in Paris and New York&quot;</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_class_ids = tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>)

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

tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-base-4096")
model = TFLongformerForMultipleChoice.from_pretrained("allenai/longformer-base-4096")

prompt = "In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."
choice0 = "It is eaten with a fork and a knife."
choice1 = "It is eaten while held in the hand."

encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors="tf", padding=True)
inputs = {k: tf.expand_dims(v, 0) for k, v in encoding.items()}
outputs = model(inputs)  # batch size is 1

# the linear classifier still needs to be trained
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, TFLongformerForMultipleChoice
<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;allenai/longformer-base-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFLongformerForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-base-4096&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>choice0 = <span class="hljs-string">&quot;It is eaten with a fork and a knife.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>choice1 = <span class="hljs-string">&quot;It is eaten while held in the hand.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors=<span class="hljs-string">&quot;tf&quot;</span>, padding=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = {k: tf.expand_dims(v, <span class="hljs-number">0</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> encoding.items()}
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(inputs)  <span class="hljs-comment"># batch size is 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># the linear classifier still needs to be trained</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){d=r("p"),k=n("Example:"),p=c(),v(u.$$.fragment)},l(l){d=a(l,"P",{});var m=i(d);k=s(m,"Example:"),m.forEach(t),p=h(l),y(u.$$.fragment,l)},m(l,m){f(l,d,m),e(d,k),f(l,p,m),T(u,l,m),b=!0},p:nt,i(l){b||($(u.$$.fragment,l),b=!0)},o(l){L(u.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(u,l)}}}function N0(z){let d,k,p,u,b,l,m,E,re,ee,N,ae,oe,F,Te,B,fe,Ae,R,ie,de,U,he,$e,H,Le,be,W,xe,me,le,C,O,ge,J,ve,ue,K,Fe,ye,j,Me,V,ce,ne,Y,_e,qe,S,we,X,Ee,se,P,ze,A,ke,Ce,w,M,Ue,te,He,Ke,q,Re,Ve,De,je,Ne,I,Q,Ge,Ie,Z,Se,G,Oe,We,pe='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mn>1</mn><mn>2</mn></mfrac><mi>w</mi></mrow><annotation encoding="application/x-tex">\\frac{1}{2} w</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.1901em;vertical-align:-0.345em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8451em;"><span style="top:-2.655em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span></span></span></span>',Qe,vc,I2='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mn>1</mn><mn>2</mn></mfrac><mi>w</mi></mrow><annotation encoding="application/x-tex">\\frac{1}{2} w</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.1901em;vertical-align:-0.345em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8451em;"><span style="top:-2.655em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span></span></span></span>',yc,Tc,D2='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>w</mi></mrow><annotation encoding="application/x-tex">w</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span></span></span></span>',$c,Ri,ap,ip,Vi,lp,dp,Gi,cp,hp,Lc,S2='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>w</mi></mrow><annotation encoding="application/x-tex">w</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span></span></span></span>',xc,Ji,mp,pp,Fc,Dt,fp,Mc,W2='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>w</mi></mrow><annotation encoding="application/x-tex">w</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span></span></span></span>',qc,Yi,gp,up,Ec,St,_p,Xi,wp,kp,Zi,bp,vp,zc,an,el,yp,Tp,tl,$p,Cc,ln,Lp,Na,xp,Fp,jc,kt,Mp,Oc,Q2='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">O</mi><mo stretchy="false">(</mo><msub><mi>n</mi><mi>s</mi></msub><mo>\xD7</mo><msub><mi>n</mi><mi>s</mi></msub><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\\mathcal{O}(n_s \\times n_s)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.02778em;">O</span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\xD7</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>',Pc,Ac,B2='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">O</mi><mo stretchy="false">(</mo><msub><mi>n</mi><mi>s</mi></msub><mo>\xD7</mo><mi>w</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\\mathcal{O}(n_s \\times w)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.02778em;">O</span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\xD7</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span><span class="mclose">)</span></span></span></span>',Nc,Ic,U2='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>n</mi><mi>s</mi></msub></mrow><annotation encoding="application/x-tex">n_s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.5806em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span>',Dc,Sc,H2='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>w</mi></mrow><annotation encoding="application/x-tex">w</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span></span></span></span>',Wc,Qc,dn,qp,Ts,Ep,zp,Bc,oo,cn,ol,$s,Cp,nl,jp,Uc,no,Ia,Op,Pp,Da,Ap,Np,Hc,Ls,Kc,so,hn,sl,xs,Ip,rl,Dp,Rc,bt,al,Sa,Sp,Wp,il,Wa,Qp,Bp,ll,Qa,Up,Hp,dl,Ba,Kp,Rp,cl,Ua,Vp,Vc,ro,mn,hl,Fs,Gp,ml,Jp,Gc,pt,Ms,Yp,ao,Xp,Ha,Zp,ef,Ka,tf,of,nf,io,sf,Ra,rf,af,qs,lf,df,cf,lo,hf,Va,mf,pf,Ga,ff,gf,uf,pn,Jc,co,fn,pl,Es,_f,fl,wf,Yc,Pe,zs,kf,gl,bf,vf,ul,yf,Tf,gn,$f,Cs,Lf,_l,xf,Ff,Mf,un,qf,js,Ef,Ja,zf,Cf,jf,Wt,Os,Of,wl,Pf,Af,Ps,Ya,Nf,kl,If,Df,Xa,Sf,bl,Wf,Qf,_n,As,Bf,vl,Uf,Hf,wn,Ns,Kf,yl,Rf,Vf,kn,Is,Gf,Ds,Jf,Tl,Yf,Xf,Xc,ho,bn,$l,Ss,Zf,Ll,eg,Zc,Je,Ws,tg,Qs,og,xl,ng,sg,rg,Fl,ag,ig,vn,lg,Bs,dg,Ml,cg,hg,mg,yn,pg,Us,fg,Za,gg,ug,_g,Tn,Hs,wg,ql,kg,eh,mo,$n,El,Ks,bg,zl,vg,th,po,Rs,yg,Cl,Tg,oh,fo,Vs,$g,jl,Lg,nh,go,Gs,xg,Ol,Fg,sh,uo,Js,Mg,Pl,qg,rh,_o,Ys,Eg,Al,zg,ah,wo,Xs,Cg,Nl,jg,ih,ko,Zs,Og,Il,Pg,lh,bo,er,Ag,Dl,Ng,dh,vo,tr,Ig,Sl,Dg,ch,yo,or,Sg,Wl,Wg,hh,To,nr,Qg,Ql,Bg,mh,$o,sr,Ug,Bl,Hg,ph,Lo,rr,Kg,Ul,Rg,fh,xo,ar,Vg,Hl,Gg,gh,Fo,Ln,Kl,ir,Jg,Rl,Yg,uh,st,lr,Xg,Vl,Zg,eu,dr,tu,ei,ou,nu,su,cr,ru,hr,au,iu,lu,Mo,du,ti,cu,hu,mr,mu,pu,fu,pr,gu,Gl,uu,_u,wu,Ft,fr,ku,qo,bu,oi,vu,yu,Jl,Tu,$u,Lu,xn,xu,Fn,_h,Eo,Mn,Yl,gr,Fu,Xl,Mu,wh,ft,ur,qu,_r,Eu,Zl,zu,Cu,ju,wr,Ou,ni,Pu,Au,Nu,kr,Iu,br,Du,Su,Wu,ct,vr,Qu,zo,Bu,si,Uu,Hu,ed,Ku,Ru,Vu,qn,Gu,En,Ju,td,Yu,Xu,zn,kh,Co,Cn,od,yr,Zu,nd,e_,bh,gt,Tr,t_,sd,o_,n_,$r,s_,ri,r_,a_,i_,Lr,l_,xr,d_,c_,h_,vt,Fr,m_,jo,p_,ai,f_,g_,rd,u_,__,w_,jn,k_,On,b_,Pn,vh,Oo,An,ad,Mr,v_,id,y_,yh,ut,qr,T_,ld,$_,L_,Er,x_,ii,F_,M_,q_,zr,E_,Cr,z_,C_,j_,Mt,jr,O_,Po,P_,li,A_,N_,dd,I_,D_,S_,Nn,W_,In,Th,Ao,Dn,cd,Or,Q_,hd,B_,$h,_t,Pr,U_,md,H_,K_,Ar,R_,di,V_,G_,J_,Nr,Y_,Ir,X_,Z_,ew,qt,Dr,tw,No,ow,ci,nw,sw,pd,rw,aw,iw,Sn,lw,Wn,Lh,Io,Qn,fd,Sr,dw,gd,cw,xh,wt,Wr,hw,Do,mw,ud,pw,fw,_d,gw,uw,_w,Qr,ww,hi,kw,bw,vw,Br,yw,Ur,Tw,$w,Lw,Et,Hr,xw,So,Fw,mi,Mw,qw,wd,Ew,zw,Cw,Bn,jw,Un,Fh,Wo,Hn,kd,Kr,Ow,bd,Pw,Mh,Ye,Rr,Aw,vd,Nw,Iw,Vr,Dw,pi,Sw,Ww,Qw,Gr,Bw,Jr,Uw,Hw,Kw,Kn,Rw,Qo,Vw,fi,Gw,Jw,Yr,Yw,Xw,Zw,Xr,ek,yd,tk,ok,nk,Qt,Zr,sk,Bo,rk,gi,ak,ik,Td,lk,dk,ck,Rn,qh,Uo,Vn,$d,ea,hk,Ld,mk,Eh,rt,ta,pk,oa,fk,xd,gk,uk,_k,na,wk,ui,kk,bk,vk,sa,yk,ra,Tk,$k,Lk,Gn,xk,yt,aa,Fk,Ho,Mk,_i,qk,Ek,Fd,zk,Ck,jk,Jn,Ok,Yn,Pk,Xn,zh,Ko,Zn,Md,ia,Ak,qd,Nk,Ch,at,la,Ik,Ro,Dk,Ed,Sk,Wk,zd,Qk,Bk,Uk,da,Hk,wi,Kk,Rk,Vk,ca,Gk,ha,Jk,Yk,Xk,es,Zk,Tt,ma,eb,Vo,tb,ki,ob,nb,Cd,sb,rb,ab,ts,ib,os,lb,ns,jh,Go,ss,jd,pa,db,Od,cb,Oh,it,fa,hb,Pd,mb,pb,ga,fb,bi,gb,ub,_b,ua,wb,_a,kb,bb,vb,rs,yb,$t,wa,Tb,Jo,$b,vi,Lb,xb,Ad,Fb,Mb,qb,as,Eb,is,zb,ls,Ph,Yo,ds,Nd,ka,Cb,Id,jb,Ah,lt,ba,Ob,Dd,Pb,Ab,va,Nb,yi,Ib,Db,Sb,ya,Wb,Ta,Qb,Bb,Ub,cs,Hb,Lt,$a,Kb,Xo,Rb,Ti,Vb,Gb,Sd,Jb,Yb,Xb,hs,Zb,ms,ev,ps,Nh,Zo,fs,Wd,La,tv,Qd,ov,Ih,dt,xa,nv,Bd,sv,rv,Fa,av,$i,iv,lv,dv,Ma,cv,qa,hv,mv,pv,gs,fv,zt,Ea,gv,en,uv,Li,_v,wv,Ud,kv,bv,vv,us,yv,_s,Dh;return l=new Ze({}),he=new Ze({}),Q=new Ze({}),$s=new Ze({}),Ls=new et({props:{code:`input_ids = tokenizer.encode("This is a sentence from [MASK] training data", return_tensors="pt")
mlm_labels = tokenizer.encode("This is a sentence from the training data", return_tensors="pt")

loss = model(input_ids, labels=input_ids, masked_lm_labels=mlm_labels)[0]`,highlighted:`input_ids = tokenizer.encode(<span class="hljs-string">&quot;This is a sentence from [MASK] training data&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
mlm_labels = tokenizer.encode(<span class="hljs-string">&quot;This is a sentence from the training data&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

loss = model(input_ids, labels=input_ids, masked_lm_labels=mlm_labels)[<span class="hljs-number">0</span>]`}}),xs=new Ze({}),Fs=new Ze({}),Ms=new D({props:{name:"class transformers.LongformerConfig",anchor:"transformers.LongformerConfig",parameters:[{name:"attention_window",val:": typing.Union[typing.List[int], int] = 512"},{name:"sep_token_id",val:": int = 2"},{name:"pad_token_id",val:": int = 1"},{name:"bos_token_id",val:": int = 0"},{name:"eos_token_id",val:": int = 2"},{name:"vocab_size",val:": int = 30522"},{name:"hidden_size",val:": int = 768"},{name:"num_hidden_layers",val:": int = 12"},{name:"num_attention_heads",val:": int = 12"},{name:"intermediate_size",val:": int = 3072"},{name:"hidden_act",val:": str = 'gelu'"},{name:"hidden_dropout_prob",val:": float = 0.1"},{name:"attention_probs_dropout_prob",val:": float = 0.1"},{name:"max_position_embeddings",val:": int = 512"},{name:"type_vocab_size",val:": int = 2"},{name:"initializer_range",val:": float = 0.02"},{name:"layer_norm_eps",val:": float = 1e-12"},{name:"position_embedding_type",val:": str = 'absolute'"},{name:"onnx_export",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LongformerConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the Longformer 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.29.0/en/model_doc/longformer#transformers.LongformerModel">LongformerModel</a> or <a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.TFLongformerModel">TFLongformerModel</a>.`,name:"vocab_size"},{anchor:"transformers.LongformerConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.LongformerConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.LongformerConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.LongformerConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.LongformerConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.LongformerConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</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:"hidden_dropout_prob"},{anchor:"transformers.LongformerConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.LongformerConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.LongformerConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerModel">LongformerModel</a> or
<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.TFLongformerModel">TFLongformerModel</a>.`,name:"type_vocab_size"},{anchor:"transformers.LongformerConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.LongformerConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.LongformerConfig.position_embedding_type",description:`<strong>position_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;absolute&quot;</code>) &#x2014;
Type of position embedding. Choose one of <code>&quot;absolute&quot;</code>, <code>&quot;relative_key&quot;</code>, <code>&quot;relative_key_query&quot;</code>. For
positional embeddings use <code>&quot;absolute&quot;</code>. For more information on <code>&quot;relative_key&quot;</code>, please refer to
<a href="https://arxiv.org/abs/1803.02155" rel="nofollow">Self-Attention with Relative Position Representations (Shaw et al.)</a>.
For more information on <code>&quot;relative_key_query&quot;</code>, please refer to <em>Method 4</em> in <a href="https://arxiv.org/abs/2009.13658" rel="nofollow">Improve Transformer Models
with Better Relative Position Embeddings (Huang et al.)</a>.`,name:"position_embedding_type"},{anchor:"transformers.LongformerConfig.attention_window",description:`<strong>attention_window</strong> (<code>int</code> or <code>List[int]</code>, <em>optional</em>, defaults to 512) &#x2014;
Size of an attention window around each token. If an <code>int</code>, use the same size for all layers. To specify a
different window size for each layer, use a <code>List[int]</code> where <code>len(attention_window) == num_hidden_layers</code>.`,name:"attention_window"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/configuration_longformer.py#L46"}}),pn=new ot({props:{anchor:"transformers.LongformerConfig.example",$$slots:{default:[Y2]},$$scope:{ctx:z}}}),Es=new Ze({}),zs=new D({props:{name:"class transformers.LongformerTokenizer",anchor:"transformers.LongformerTokenizer",parameters:[{name:"vocab_file",val:""},{name:"merges_file",val:""},{name:"errors",val:" = 'replace'"},{name:"bos_token",val:" = '<s>'"},{name:"eos_token",val:" = '</s>'"},{name:"sep_token",val:" = '</s>'"},{name:"cls_token",val:" = '<s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"pad_token",val:" = '<pad>'"},{name:"mask_token",val:" = '<mask>'"},{name:"add_prefix_space",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LongformerTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.LongformerTokenizer.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.LongformerTokenizer.errors",description:`<strong>errors</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;replace&quot;</code>) &#x2014;
Paradigm to follow when decoding bytes to UTF-8. See
<a href="https://docs.python.org/3/library/stdtypes.html#bytes.decode" rel="nofollow">bytes.decode</a> for more information.`,name:"errors"},{anchor:"transformers.LongformerTokenizer.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the beginning of
sequence. The token used is the <code>cls_token</code>.</p>

					</div>`,name:"bos_token"},{anchor:"transformers.LongformerTokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the end of sequence.
The token used is the <code>sep_token</code>.</p>

					</div>`,name:"eos_token"},{anchor:"transformers.LongformerTokenizer.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.`,name:"sep_token"},{anchor:"transformers.LongformerTokenizer.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.`,name:"cls_token"},{anchor:"transformers.LongformerTokenizer.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.LongformerTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.LongformerTokenizer.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;mask&gt;&quot;</code>) &#x2014;
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.`,name:"mask_token"},{anchor:"transformers.LongformerTokenizer.add_prefix_space",description:`<strong>add_prefix_space</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add an initial space to the input. This allows to treat the leading word just as any
other word. (Longformer tokenizer detect beginning of words by the preceding space).`,name:"add_prefix_space"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/tokenization_longformer.py#L116"}}),gn=new ot({props:{anchor:"transformers.LongformerTokenizer.example",$$slots:{default:[X2]},$$scope:{ctx:z}}}),un=new tt({props:{$$slots:{default:[Z2]},$$scope:{ctx:z}}}),Os=new D({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.LongformerTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.LongformerTokenizer.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.LongformerTokenizer.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/tokenization_longformer.py#L355",returnDescription:`
<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),As=new D({props:{name:"convert_tokens_to_string",anchor:"transformers.LongformerTokenizer.convert_tokens_to_string",parameters:[{name:"tokens",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/tokenization_longformer.py#L320"}}),Ns=new D({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.LongformerTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.LongformerTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.LongformerTokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/tokenization_longformer.py#L407",returnDescription:`
<p>List of zeros.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Is=new D({props:{name:"get_special_tokens_mask",anchor:"transformers.LongformerTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.LongformerTokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.LongformerTokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.LongformerTokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/tokenization_longformer.py#L380",returnDescription:`
<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Ss=new Ze({}),Ws=new D({props:{name:"class transformers.LongformerTokenizerFast",anchor:"transformers.LongformerTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"merges_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"errors",val:" = 'replace'"},{name:"bos_token",val:" = '<s>'"},{name:"eos_token",val:" = '</s>'"},{name:"sep_token",val:" = '</s>'"},{name:"cls_token",val:" = '<s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"pad_token",val:" = '<pad>'"},{name:"mask_token",val:" = '<mask>'"},{name:"add_prefix_space",val:" = False"},{name:"trim_offsets",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LongformerTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.LongformerTokenizerFast.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.LongformerTokenizerFast.errors",description:`<strong>errors</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;replace&quot;</code>) &#x2014;
Paradigm to follow when decoding bytes to UTF-8. See
<a href="https://docs.python.org/3/library/stdtypes.html#bytes.decode" rel="nofollow">bytes.decode</a> for more information.`,name:"errors"},{anchor:"transformers.LongformerTokenizerFast.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the beginning of
sequence. The token used is the <code>cls_token</code>.</p>

					</div>`,name:"bos_token"},{anchor:"transformers.LongformerTokenizerFast.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the end of sequence.
The token used is the <code>sep_token</code>.</p>

					</div>`,name:"eos_token"},{anchor:"transformers.LongformerTokenizerFast.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.`,name:"sep_token"},{anchor:"transformers.LongformerTokenizerFast.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.`,name:"cls_token"},{anchor:"transformers.LongformerTokenizerFast.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.LongformerTokenizerFast.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.LongformerTokenizerFast.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;mask&gt;&quot;</code>) &#x2014;
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.`,name:"mask_token"},{anchor:"transformers.LongformerTokenizerFast.add_prefix_space",description:`<strong>add_prefix_space</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add an initial space to the input. This allows to treat the leading word just as any
other word. (Longformer tokenizer detect beginning of words by the preceding space).`,name:"add_prefix_space"},{anchor:"transformers.LongformerTokenizerFast.trim_offsets",description:`<strong>trim_offsets</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the post processing step should trim offsets to avoid including whitespaces.`,name:"trim_offsets"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/tokenization_longformer_fast.py#L91"}}),vn=new ot({props:{anchor:"transformers.LongformerTokenizerFast.example",$$slots:{default:[e0]},$$scope:{ctx:z}}}),yn=new tt({props:{$$slots:{default:[t0]},$$scope:{ctx:z}}}),Hs=new D({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.LongformerTokenizerFast.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.LongformerTokenizerFast.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.LongformerTokenizerFast.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/tokenization_longformer_fast.py#L303",returnDescription:`
<p>List of zeros.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Ks=new Ze({}),Rs=new D({props:{name:"class transformers.models.longformer.modeling_longformer.LongformerBaseModelOutput",anchor:"transformers.models.longformer.modeling_longformer.LongformerBaseModelOutput",parameters:[{name:"last_hidden_state",val:": FloatTensor"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_longformer.LongformerBaseModelOutput.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.longformer.modeling_longformer.LongformerBaseModelOutput.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.longformer.modeling_longformer.LongformerBaseModelOutput.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerBaseModelOutput.global_attentions",description:`<strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L56"}}),Vs=new D({props:{name:"class transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling",anchor:"transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling",parameters:[{name:"last_hidden_state",val:": FloatTensor"},{name:"pooler_output",val:": FloatTensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling.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.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling.pooler_output",description:`<strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) &#x2014;
Last layer hidden-state of the first token of the sequence (classification token) further processed by a
Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
prediction (classification) objective during pretraining.`,name:"pooler_output"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling.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.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling.global_attentions",description:`<strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L99"}}),Gs=new D({props:{name:"class transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput",anchor:"transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"logits",val:": FloatTensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput.loss",description:`<strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Masked language modeling (MLM) loss.`,name:"loss"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput.logits",description:`<strong>logits</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 before SoftMax).`,name:"logits"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput.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.longformer.modeling_longformer.LongformerMaskedLMOutput.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput.global_attentions",description:`<strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L147"}}),Js=new D({props:{name:"class transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput",anchor:"transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_logits",val:": FloatTensor = None"},{name:"end_logits",val:": FloatTensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput.loss",description:`<strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.`,name:"loss"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput.start_logits",description:`<strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Span-start scores (before SoftMax).`,name:"start_logits"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput.end_logits",description:`<strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Span-end scores (before SoftMax).`,name:"end_logits"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput.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.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput.global_attentions",description:`<strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L193"}}),Ys=new D({props:{name:"class transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput",anchor:"transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"logits",val:": FloatTensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput.loss",description:`<strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Classification (or regression if config.num_labels==1) loss.`,name:"loss"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput.logits",description:`<strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) &#x2014;
Classification (or regression if config.num_labels==1) scores (before SoftMax).`,name:"logits"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput.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.longformer.modeling_longformer.LongformerSequenceClassifierOutput.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput.global_attentions",description:`<strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L242"}}),Xs=new D({props:{name:"class transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput",anchor:"transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"logits",val:": FloatTensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput.loss",description:`<strong>loss</strong> (<code>torch.FloatTensor</code> of shape <em>(1,)</em>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Classification loss.`,name:"loss"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput.logits",description:`<strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>) &#x2014;
<em>num_choices</em> is the second dimension of the input tensors. (see <em>input_ids</em> above).</p>
<p>Classification scores (before SoftMax).`,name:"logits"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput.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.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput.global_attentions",description:`<strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L288"}}),Zs=new D({props:{name:"class transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput",anchor:"transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"logits",val:": FloatTensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput.loss",description:`<strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided)  &#x2014;
Classification loss.`,name:"loss"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput.logits",description:`<strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) &#x2014;
Classification scores (before SoftMax).`,name:"logits"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput.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.longformer.modeling_longformer.LongformerTokenClassifierOutput.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput.global_attentions",description:`<strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L336"}}),er=new D({props:{name:"class transformers.models.longformer.modeling_tf_longformer.TFLongformerBaseModelOutput",anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerBaseModelOutput",parameters:[{name:"last_hidden_state",val:": 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"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerBaseModelOutput.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.longformer.modeling_tf_longformer.TFLongformerBaseModelOutput.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.longformer.modeling_tf_longformer.TFLongformerBaseModelOutput.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerBaseModelOutput.global_attentions",description:`<strong>global_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, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L67"}}),tr=new D({props:{name:"class transformers.models.longformer.modeling_tf_longformer.TFLongformerBaseModelOutputWithPooling",anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerBaseModelOutputWithPooling",parameters:[{name:"last_hidden_state",val:": Tensor = None"},{name:"pooler_output",val:": 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"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerBaseModelOutputWithPooling.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.longformer.modeling_tf_longformer.TFLongformerBaseModelOutputWithPooling.pooler_output",description:`<strong>pooler_output</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, hidden_size)</code>) &#x2014;
Last layer hidden-state of the first token of the sequence (classification token) further processed by a
Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
prediction (classification) objective during pretraining.`,name:"pooler_output"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerBaseModelOutputWithPooling.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.longformer.modeling_tf_longformer.TFLongformerBaseModelOutputWithPooling.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerBaseModelOutputWithPooling.global_attentions",description:`<strong>global_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, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L110"}}),or=new D({props:{name:"class transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput",anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput",parameters:[{name:"loss",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"logits",val:": 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"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput.loss",description:`<strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Masked language modeling (MLM) loss.`,name:"loss"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput.logits",description:`<strong>logits</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 before SoftMax).`,name:"logits"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput.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.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput.global_attentions",description:`<strong>global_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, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L158"}}),nr=new D({props:{name:"class transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput",anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput",parameters:[{name:"loss",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"start_logits",val:": Tensor = None"},{name:"end_logits",val:": 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"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput.loss",description:`<strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.`,name:"loss"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput.start_logits",description:`<strong>start_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Span-start scores (before SoftMax).`,name:"start_logits"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput.end_logits",description:`<strong>end_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Span-end scores (before SoftMax).`,name:"end_logits"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput.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.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput.global_attentions",description:`<strong>global_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, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L204"}}),sr=new D({props:{name:"class transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput",anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput",parameters:[{name:"loss",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"logits",val:": 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"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput.loss",description:`<strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Classification (or regression if config.num_labels==1) loss.`,name:"loss"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput.logits",description:`<strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.num_labels)</code>) &#x2014;
Classification (or regression if config.num_labels==1) scores (before SoftMax).`,name:"logits"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput.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.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput.global_attentions",description:`<strong>global_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, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L253"}}),rr=new D({props:{name:"class transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput",anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput",parameters:[{name:"loss",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"logits",val:": 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"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput.loss",description:`<strong>loss</strong> (<code>tf.Tensor</code> of shape <em>(1,)</em>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Classification loss.`,name:"loss"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput.logits",description:`<strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices)</code>) &#x2014;
<em>num_choices</em> is the second dimension of the input tensors. (see <em>input_ids</em> above).</p>
<p>Classification scores (before SoftMax).`,name:"logits"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput.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.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput.global_attentions",description:`<strong>global_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, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L299"}}),ar=new D({props:{name:"class transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput",anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput",parameters:[{name:"loss",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"logits",val:": 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"},{name:"global_attentions",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"}],parametersDescription:[{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput.loss",description:`<strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided)  &#x2014;
Classification loss.`,name:"loss"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput.logits",description:`<strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) &#x2014;
Classification scores (before SoftMax).`,name:"logits"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput.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.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput.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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>`,name:"attentions"},{anchor:"transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput.global_attentions",description:`<strong>global_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, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.`,name:"global_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L347"}}),ir=new Ze({}),lr=new D({props:{name:"class transformers.LongformerModel",anchor:"transformers.LongformerModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"}],parametersDescription:[{anchor:"transformers.LongformerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L1538"}}),fr=new D({props:{name:"forward",anchor:"transformers.LongformerModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"global_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = 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.LongformerModel.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.LongformerModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LongformerModel.forward.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.LongformerModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. 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.LongformerModel.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. 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:"decoder_head_mask"},{anchor:"transformers.LongformerModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LongformerModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LongformerModel.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.LongformerModel.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.LongformerModel.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.LongformerModel.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L1651",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling"
>transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling</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.29.0/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</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>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) further processed by a
Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
prediction (classification) objective during pretraining.</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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling"
>transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),xn=new tt({props:{$$slots:{default:[o0]},$$scope:{ctx:z}}}),Fn=new ot({props:{anchor:"transformers.LongformerModel.forward.example",$$slots:{default:[n0]},$$scope:{ctx:z}}}),gr=new Ze({}),ur=new D({props:{name:"class transformers.LongformerForMaskedLM",anchor:"transformers.LongformerForMaskedLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LongformerForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L1775"}}),vr=new D({props:{name:"forward",anchor:"transformers.LongformerForMaskedLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"global_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = 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.LongformerForMaskedLM.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.LongformerForMaskedLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LongformerForMaskedLM.forward.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.LongformerForMaskedLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. 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.LongformerForMaskedLM.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. 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:"decoder_head_mask"},{anchor:"transformers.LongformerForMaskedLM.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LongformerForMaskedLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LongformerForMaskedLM.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.LongformerForMaskedLM.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.LongformerForMaskedLM.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.LongformerForMaskedLM.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LongformerForMaskedLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked), the
loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"},{anchor:"transformers.LongformerForMaskedLM.forward.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, any]</code>, optional, defaults to <em>{}</em>) &#x2014;
Used to hide legacy arguments that have been deprecated.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L1794",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput"
>transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput</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.29.0/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</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 Masked language modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + 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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput"
>transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),qn=new tt({props:{$$slots:{default:[s0]},$$scope:{ctx:z}}}),En=new ot({props:{anchor:"transformers.LongformerForMaskedLM.forward.example",$$slots:{default:[r0]},$$scope:{ctx:z}}}),zn=new ot({props:{anchor:"transformers.LongformerForMaskedLM.forward.example-2",$$slots:{default:[a0]},$$scope:{ctx:z}}}),yr=new Ze({}),Tr=new D({props:{name:"class transformers.LongformerForSequenceClassification",anchor:"transformers.LongformerForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LongformerForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L1890"}}),Fr=new D({props:{name:"forward",anchor:"transformers.LongformerForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"global_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = 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.LongformerForSequenceClassification.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.LongformerForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LongformerForSequenceClassification.forward.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.LongformerForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. 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.LongformerForSequenceClassification.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. 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:"decoder_head_mask"},{anchor:"transformers.LongformerForSequenceClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LongformerForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LongformerForSequenceClassification.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.LongformerForSequenceClassification.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.LongformerForSequenceClassification.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.LongformerForSequenceClassification.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LongformerForSequenceClassification.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.29.0/src/transformers/models/longformer/modeling_longformer.py#L1904",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput"
>transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput</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.29.0/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + 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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput"
>transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),jn=new tt({props:{$$slots:{default:[i0]},$$scope:{ctx:z}}}),On=new ot({props:{anchor:"transformers.LongformerForSequenceClassification.forward.example",$$slots:{default:[l0]},$$scope:{ctx:z}}}),Pn=new ot({props:{anchor:"transformers.LongformerForSequenceClassification.forward.example-2",$$slots:{default:[d0]},$$scope:{ctx:z}}}),Mr=new Ze({}),qr=new D({props:{name:"class transformers.LongformerForMultipleChoice",anchor:"transformers.LongformerForMultipleChoice",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LongformerForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L2248"}}),jr=new D({props:{name:"forward",anchor:"transformers.LongformerForMultipleChoice.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"global_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = 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.LongformerForMultipleChoice.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.LongformerForMultipleChoice.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LongformerForMultipleChoice.forward.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.LongformerForMultipleChoice.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. 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.LongformerForMultipleChoice.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. 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:"decoder_head_mask"},{anchor:"transformers.LongformerForMultipleChoice.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LongformerForMultipleChoice.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LongformerForMultipleChoice.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, 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.LongformerForMultipleChoice.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.LongformerForMultipleChoice.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.LongformerForMultipleChoice.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LongformerForMultipleChoice.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the multiple choice classification loss. Indices should be in <code>[0, ..., num_choices-1]</code> where <code>num_choices</code> is the size of the second dimension of the input tensors. (See
<code>input_ids</code> above)`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L2259",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput"
>transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput</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.29.0/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <em>(1,)</em>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>) \u2014 <em>num_choices</em> is the second dimension of the input tensors. (see <em>input_ids</em> above).</p>
<p>Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + 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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput"
>transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Nn=new tt({props:{$$slots:{default:[c0]},$$scope:{ctx:z}}}),In=new ot({props:{anchor:"transformers.LongformerForMultipleChoice.forward.example",$$slots:{default:[h0]},$$scope:{ctx:z}}}),Or=new Ze({}),Pr=new D({props:{name:"class transformers.LongformerForTokenClassification",anchor:"transformers.LongformerForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LongformerForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L2158"}}),Dr=new D({props:{name:"forward",anchor:"transformers.LongformerForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"global_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = 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.LongformerForTokenClassification.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.LongformerForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LongformerForTokenClassification.forward.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.LongformerForTokenClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. 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.LongformerForTokenClassification.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. 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:"decoder_head_mask"},{anchor:"transformers.LongformerForTokenClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LongformerForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LongformerForTokenClassification.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.LongformerForTokenClassification.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.LongformerForTokenClassification.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.LongformerForTokenClassification.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LongformerForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L2172",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput"
>transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput</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.29.0/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</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 loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + 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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput"
>transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Sn=new tt({props:{$$slots:{default:[m0]},$$scope:{ctx:z}}}),Wn=new ot({props:{anchor:"transformers.LongformerForTokenClassification.forward.example",$$slots:{default:[p0]},$$scope:{ctx:z}}}),Sr=new Ze({}),Wr=new D({props:{name:"class transformers.LongformerForQuestionAnswering",anchor:"transformers.LongformerForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LongformerForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L2019"}}),Hr=new D({props:{name:"forward",anchor:"transformers.LongformerForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"global_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"start_positions",val:": typing.Optional[torch.Tensor] = None"},{name:"end_positions",val:": typing.Optional[torch.Tensor] = 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.LongformerForQuestionAnswering.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.LongformerForQuestionAnswering.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LongformerForQuestionAnswering.forward.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.LongformerForQuestionAnswering.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. 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.LongformerForQuestionAnswering.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. 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:"decoder_head_mask"},{anchor:"transformers.LongformerForQuestionAnswering.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LongformerForQuestionAnswering.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LongformerForQuestionAnswering.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.LongformerForQuestionAnswering.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.LongformerForQuestionAnswering.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.LongformerForQuestionAnswering.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LongformerForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.LongformerForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_longformer.py#L2032",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput"
>transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput</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.29.0/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</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 Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + 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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_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, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput"
>transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Bn=new tt({props:{$$slots:{default:[f0]},$$scope:{ctx:z}}}),Un=new ot({props:{anchor:"transformers.LongformerForQuestionAnswering.forward.example",$$slots:{default:[g0]},$$scope:{ctx:z}}}),Kr=new Ze({}),Rr=new D({props:{name:"class transformers.TFLongformerModel",anchor:"transformers.TFLongformerModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLongformerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L2024"}}),Kn=new tt({props:{$$slots:{default:[u0]},$$scope:{ctx:z}}}),Zr=new D({props:{name:"call",anchor:"transformers.TFLongformerModel.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:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"global_attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",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:": typing.Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFLongformerModel.call.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLongformerModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLongformerModel.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the 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.TFLongformerModel.call.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.TFLongformerModel.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLongformerModel.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLongformerModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</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.TFLongformerModel.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.TFLongformerModel.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.TFLongformerModel.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFLongformerModel.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.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L2046"}}),Rn=new tt({props:{$$slots:{default:[_0]},$$scope:{ctx:z}}}),ea=new Ze({}),ta=new D({props:{name:"class transformers.TFLongformerForMaskedLM",anchor:"transformers.TFLongformerForMaskedLM",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLongformerForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L2096"}}),Gn=new tt({props:{$$slots:{default:[w0]},$$scope:{ctx:z}}}),aa=new D({props:{name:"call",anchor:"transformers.TFLongformerForMaskedLM.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:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"global_attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",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.TFLongformerForMaskedLM.call.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLongformerForMaskedLM.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLongformerForMaskedLM.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the 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.TFLongformerForMaskedLM.call.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.TFLongformerForMaskedLM.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLongformerForMaskedLM.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLongformerForMaskedLM.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</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.TFLongformerForMaskedLM.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.TFLongformerForMaskedLM.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.TFLongformerForMaskedLM.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFLongformerForMaskedLM.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.TFLongformerForMaskedLM.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 masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked), the
loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L2113",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput</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.29.0/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</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 Masked language modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_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, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Jn=new tt({props:{$$slots:{default:[k0]},$$scope:{ctx:z}}}),Yn=new ot({props:{anchor:"transformers.TFLongformerForMaskedLM.call.example",$$slots:{default:[b0]},$$scope:{ctx:z}}}),Xn=new ot({props:{anchor:"transformers.TFLongformerForMaskedLM.call.example-2",$$slots:{default:[v0]},$$scope:{ctx:z}}}),ia=new Ze({}),la=new D({props:{name:"class transformers.TFLongformerForQuestionAnswering",anchor:"transformers.TFLongformerForQuestionAnswering",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLongformerForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L2192"}}),es=new tt({props:{$$slots:{default:[y0]},$$scope:{ctx:z}}}),ma=new D({props:{name:"call",anchor:"transformers.TFLongformerForQuestionAnswering.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:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"global_attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",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:"start_positions",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"end_positions",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"training",val:": typing.Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFLongformerForQuestionAnswering.call.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the 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.TFLongformerForQuestionAnswering.call.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</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.TFLongformerForQuestionAnswering.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.TFLongformerForQuestionAnswering.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.TFLongformerForQuestionAnswering.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFLongformerForQuestionAnswering.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.TFLongformerForQuestionAnswering.call.start_positions",description:`<strong>start_positions</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<em>sequence_length</em>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.end_positions",description:`<strong>end_positions</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<em>sequence_length</em>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L2207",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput</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.29.0/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</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 Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_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, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),ts=new tt({props:{$$slots:{default:[T0]},$$scope:{ctx:z}}}),os=new ot({props:{anchor:"transformers.TFLongformerForQuestionAnswering.call.example",$$slots:{default:[$0]},$$scope:{ctx:z}}}),ns=new ot({props:{anchor:"transformers.TFLongformerForQuestionAnswering.call.example-2",$$slots:{default:[L0]},$$scope:{ctx:z}}}),pa=new Ze({}),fa=new D({props:{name:"class transformers.TFLongformerForSequenceClassification",anchor:"transformers.TFLongformerForSequenceClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLongformerForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L2360"}}),rs=new tt({props:{$$slots:{default:[x0]},$$scope:{ctx:z}}}),wa=new D({props:{name:"call",anchor:"transformers.TFLongformerForSequenceClassification.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:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"global_attention_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.TFLongformerForSequenceClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLongformerForSequenceClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLongformerForSequenceClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the 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.TFLongformerForSequenceClassification.call.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.TFLongformerForSequenceClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLongformerForSequenceClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLongformerForSequenceClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</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.TFLongformerForSequenceClassification.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.TFLongformerForSequenceClassification.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.TFLongformerForSequenceClassification.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFLongformerForSequenceClassification.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.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L2372",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput</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.29.0/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</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>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, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_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, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),as=new tt({props:{$$slots:{default:[F0]},$$scope:{ctx:z}}}),is=new ot({props:{anchor:"transformers.TFLongformerForSequenceClassification.call.example",$$slots:{default:[M0]},$$scope:{ctx:z}}}),ls=new ot({props:{anchor:"transformers.TFLongformerForSequenceClassification.call.example-2",$$slots:{default:[q0]},$$scope:{ctx:z}}}),ka=new Ze({}),ba=new D({props:{name:"class transformers.TFLongformerForTokenClassification",anchor:"transformers.TFLongformerForTokenClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLongformerForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L2607"}}),cs=new tt({props:{$$slots:{default:[E0]},$$scope:{ctx:z}}}),$a=new D({props:{name:"call",anchor:"transformers.TFLongformerForTokenClassification.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:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"global_attention_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[<built-in function array>, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"training",val:": typing.Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFLongformerForTokenClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLongformerForTokenClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLongformerForTokenClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the 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.TFLongformerForTokenClassification.call.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.TFLongformerForTokenClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLongformerForTokenClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLongformerForTokenClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</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.TFLongformerForTokenClassification.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.TFLongformerForTokenClassification.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.TFLongformerForTokenClassification.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFLongformerForTokenClassification.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.TFLongformerForTokenClassification.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 token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L2622",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput</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.29.0/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</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 loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_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, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),hs=new tt({props:{$$slots:{default:[z0]},$$scope:{ctx:z}}}),ms=new ot({props:{anchor:"transformers.TFLongformerForTokenClassification.call.example",$$slots:{default:[C0]},$$scope:{ctx:z}}}),ps=new ot({props:{anchor:"transformers.TFLongformerForTokenClassification.call.example-2",$$slots:{default:[j0]},$$scope:{ctx:z}}}),La=new Ze({}),xa=new D({props:{name:"class transformers.TFLongformerForMultipleChoice",anchor:"transformers.TFLongformerForMultipleChoice",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLongformerForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L2472"}}),gs=new tt({props:{$$slots:{default:[O0]},$$scope:{ctx:z}}}),Ea=new D({props:{name:"call",anchor:"transformers.TFLongformerForMultipleChoice.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:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"global_attention_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.TFLongformerForMultipleChoice.call.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLongformerForMultipleChoice.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLongformerForMultipleChoice.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the 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.TFLongformerForMultipleChoice.call.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.TFLongformerForMultipleChoice.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLongformerForMultipleChoice.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLongformerForMultipleChoice.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, 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.TFLongformerForMultipleChoice.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.TFLongformerForMultipleChoice.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.TFLongformerForMultipleChoice.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFLongformerForMultipleChoice.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.TFLongformerForMultipleChoice.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the multiple choice classification loss. Indices should be in <code>[0, ..., num_choices]</code>
where <code>num_choices</code> is the size of the second dimension of the input tensors. (See <code>input_ids</code> above)`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/longformer/modeling_tf_longformer.py#L2492",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput</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.29.0/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <em>(1,)</em>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices)</code>) \u2014 <em>num_choices</em> is the second dimension of the input tensors. (see <em>input_ids</em> above).</p>
<p>Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_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, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),us=new tt({props:{$$slots:{default:[P0]},$$scope:{ctx:z}}}),_s=new ot({props:{anchor:"transformers.TFLongformerForMultipleChoice.call.example",$$slots:{default:[A0]},$$scope:{ctx:z}}}),{c(){d=r("meta"),k=c(),p=r("h1"),u=r("a"),b=r("span"),v(l.$$.fragment),m=c(),E=r("span"),re=n("Longformer"),ee=c(),N=r("div"),ae=r("a"),oe=r("img"),Te=c(),B=r("a"),fe=r("img"),R=c(),ie=r("h2"),de=r("a"),U=r("span"),v(he.$$.fragment),$e=c(),H=r("span"),Le=n("Overview"),be=c(),W=r("p"),xe=n("The Longformer model was presented in "),me=r("a"),le=n("Longformer: The Long-Document Transformer"),C=n(" by Iz Beltagy, Matthew E. Peters, Arman Cohan."),O=c(),ge=r("p"),J=n("The abstract from the paper is the following:"),ve=c(),ue=r("p"),K=r("em"),Fe=n(`Transformer-based models are unable to process long sequences due to their self-attention operation, which scales
quadratically with the sequence length. To address this limitation, we introduce the Longformer with an attention
mechanism that scales linearly with sequence length, making it easy to process documents of thousands of tokens or
longer. Longformer\u2019s attention mechanism is a drop-in replacement for the standard self-attention and combines a local
windowed attention with a task motivated global attention. Following prior work on long-sequence transformers, we
evaluate Longformer on character-level language modeling and achieve state-of-the-art results on text8 and enwik8. In
contrast to most prior work, we also pretrain Longformer and finetune it on a variety of downstream tasks. Our
pretrained Longformer consistently outperforms RoBERTa on long document tasks and sets new state-of-the-art results on
WikiHop and TriviaQA.`),ye=c(),j=r("p"),Me=n("Tips:"),V=c(),ce=r("ul"),ne=r("li"),Y=n("Since the Longformer is based on RoBERTa, it doesn\u2019t have "),_e=r("code"),qe=n("token_type_ids"),S=n(`. You don\u2019t need to indicate which
token belongs to which segment. Just separate your segments with the separation token `),we=r("code"),X=n("tokenizer.sep_token"),Ee=n(` (or
`),se=r("code"),P=n("</s>"),ze=n(")."),A=c(),ke=r("li"),Ce=n("A transformer model replacing the attention matrices by sparse matrices to go faster. Often, the local context (e.g., what are the two tokens left and right?) is enough to take action for a given token. Some preselected input tokens are still given global attention, but the attention matrix has way less parameters, resulting in a speed-up. See the local attention section for more information."),w=c(),M=r("p"),Ue=n("This model was contributed by "),te=r("a"),He=n("beltagy"),Ke=n(". The Authors\u2019 code can be found "),q=r("a"),Re=n("here"),Ve=n("."),De=c(),je=r("h2"),Ne=r("a"),I=r("span"),v(Q.$$.fragment),Ge=c(),Ie=r("span"),Z=n("Longformer Self Attention"),Se=c(),G=r("p"),Oe=n(`Longformer self attention employs self attention on both a \u201Clocal\u201D context and a \u201Cglobal\u201D context. Most tokens only
attend \u201Clocally\u201D to each other meaning that each token attends to its `),We=new sn,Qe=n(` previous tokens and
`),vc=new sn,yc=n(" succeeding tokens with "),Tc=new sn,$c=n(` being the window length as defined in
`),Ri=r("code"),ap=n("config.attention_window"),ip=n(". Note that "),Vi=r("code"),lp=n("config.attention_window"),dp=n(" can be of type "),Gi=r("code"),cp=n("List"),hp=n(` to define a
different `),Lc=new sn,xc=n(` for each layer. A selected few tokens attend \u201Cglobally\u201D to all other tokens, as it is
conventionally done for all tokens in `),Ji=r("code"),mp=n("BertSelfAttention"),pp=n("."),Fc=c(),Dt=r("p"),fp=n(`Note that \u201Clocally\u201D and \u201Cglobally\u201D attending tokens are projected by different query, key and value matrices. Also note
that every \u201Clocally\u201D attending token not only attends to tokens within its window `),Mc=new sn,qc=n(`, but also to all \u201Cglobally\u201D
attending tokens so that global attention is `),Yi=r("em"),gp=n("symmetric"),up=n("."),Ec=c(),St=r("p"),_p=n(`The user can define which tokens attend \u201Clocally\u201D and which tokens attend \u201Cglobally\u201D by setting the tensor
`),Xi=r("code"),wp=n("global_attention_mask"),kp=n(` at run-time appropriately. All Longformer models employ the following logic for
`),Zi=r("code"),bp=n("global_attention_mask"),vp=n(":"),zc=c(),an=r("ul"),el=r("li"),yp=n("0: the token attends \u201Clocally\u201D,"),Tp=c(),tl=r("li"),$p=n("1: the token attends \u201Cglobally\u201D."),Cc=c(),ln=r("p"),Lp=n("For more information please also refer to "),Na=r("a"),xp=n("forward()"),Fp=n(" method."),jc=c(),kt=r("p"),Mp=n(`Using Longformer self attention, the memory and time complexity of the query-key matmul operation, which usually
represents the memory and time bottleneck, can be reduced from `),Oc=new sn,Pc=n(` to
`),Ac=new sn,Nc=n(", with "),Ic=new sn,Dc=n(" being the sequence length and "),Sc=new sn,Wc=n(` being the average window
size. It is assumed that the number of \u201Cglobally\u201D attending tokens is insignificant as compared to the number of
\u201Clocally\u201D attending tokens.`),Qc=c(),dn=r("p"),qp=n("For more information, please refer to the official "),Ts=r("a"),Ep=n("paper"),zp=n("."),Bc=c(),oo=r("h2"),cn=r("a"),ol=r("span"),v($s.$$.fragment),Cp=c(),nl=r("span"),jp=n("Training"),Uc=c(),no=r("p"),Ia=r("a"),Op=n("LongformerForMaskedLM"),Pp=n(" is trained the exact same way "),Da=r("a"),Ap=n("RobertaForMaskedLM"),Np=n(` is
trained and should be used as follows:`),Hc=c(),v(Ls.$$.fragment),Kc=c(),so=r("h2"),hn=r("a"),sl=r("span"),v(xs.$$.fragment),Ip=c(),rl=r("span"),Dp=n("Documentation resources"),Rc=c(),bt=r("ul"),al=r("li"),Sa=r("a"),Sp=n("Text classification task guide"),Wp=c(),il=r("li"),Wa=r("a"),Qp=n("Token classification task guide"),Bp=c(),ll=r("li"),Qa=r("a"),Up=n("Question answering task guide"),Hp=c(),dl=r("li"),Ba=r("a"),Kp=n("Masked language modeling task guide"),Rp=c(),cl=r("li"),Ua=r("a"),Vp=n("Multiple choice task guide"),Vc=c(),ro=r("h2"),mn=r("a"),hl=r("span"),v(Fs.$$.fragment),Gp=c(),ml=r("span"),Jp=n("LongformerConfig"),Gc=c(),pt=r("div"),v(Ms.$$.fragment),Yp=c(),ao=r("p"),Xp=n("This is the configuration class to store the configuration of a "),Ha=r("a"),Zp=n("LongformerModel"),ef=n(" or a "),Ka=r("a"),tf=n("TFLongformerModel"),of=n(`. It
is used to instantiate a Longformer model according to the specified arguments, defining the model architecture.`),nf=c(),io=r("p"),sf=n("This is the configuration class to store the configuration of a "),Ra=r("a"),rf=n("LongformerModel"),af=n(`. It is used to instantiate an
Longformer 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 LongFormer
`),qs=r("a"),lf=n("allenai/longformer-base-4096"),df=n(` architecture with a sequence
length 4,096.`),cf=c(),lo=r("p"),hf=n("Configuration objects inherit from "),Va=r("a"),mf=n("PretrainedConfig"),pf=n(` and can be used to control the model outputs. Read the
documentation from `),Ga=r("a"),ff=n("PretrainedConfig"),gf=n(" for more information."),uf=c(),v(pn.$$.fragment),Jc=c(),co=r("h2"),fn=r("a"),pl=r("span"),v(Es.$$.fragment),_f=c(),fl=r("span"),wf=n("LongformerTokenizer"),Yc=c(),Pe=r("div"),v(zs.$$.fragment),kf=c(),gl=r("p"),bf=n("Constructs a Longformer tokenizer, derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding."),vf=c(),ul=r("p"),yf=n("This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),Tf=c(),v(gn.$$.fragment),$f=c(),Cs=r("p"),Lf=n("You can get around that behavior by passing "),_l=r("code"),xf=n("add_prefix_space=True"),Ff=n(` when instantiating this tokenizer or when you
call it on some text, but since the model was not pretrained this way, it might yield a decrease in performance.`),Mf=c(),v(un.$$.fragment),qf=c(),js=r("p"),Ef=n("This tokenizer inherits from "),Ja=r("a"),zf=n("PreTrainedTokenizer"),Cf=n(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),jf=c(),Wt=r("div"),v(Os.$$.fragment),Of=c(),wl=r("p"),Pf=n(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A Longformer sequence has the following format:`),Af=c(),Ps=r("ul"),Ya=r("li"),Nf=n("single sequence: "),kl=r("code"),If=n("<s> X </s>"),Df=c(),Xa=r("li"),Sf=n("pair of sequences: "),bl=r("code"),Wf=n("<s> A </s></s> B </s>"),Qf=c(),_n=r("div"),v(As.$$.fragment),Bf=c(),vl=r("p"),Uf=n("Converts a sequence of tokens (string) in a single string."),Hf=c(),wn=r("div"),v(Ns.$$.fragment),Kf=c(),yl=r("p"),Rf=n(`Create a mask from the two sequences passed to be used in a sequence-pair classification task. Longformer does
not make use of token type ids, therefore a list of zeros is returned.`),Vf=c(),kn=r("div"),v(Is.$$.fragment),Gf=c(),Ds=r("p"),Jf=n(`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),Tl=r("code"),Yf=n("prepare_for_model"),Xf=n(" method."),Xc=c(),ho=r("h2"),bn=r("a"),$l=r("span"),v(Ss.$$.fragment),Zf=c(),Ll=r("span"),eg=n("LongformerTokenizerFast"),Zc=c(),Je=r("div"),v(Ws.$$.fragment),tg=c(),Qs=r("p"),og=n("Construct a \u201Cfast\u201D Longformer tokenizer (backed by HuggingFace\u2019s "),xl=r("em"),ng=n("tokenizers"),sg=n(` library), derived from the GPT-2
tokenizer, using byte-level Byte-Pair-Encoding.`),rg=c(),Fl=r("p"),ag=n("This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),ig=c(),v(vn.$$.fragment),lg=c(),Bs=r("p"),dg=n("You can get around that behavior by passing "),Ml=r("code"),cg=n("add_prefix_space=True"),hg=n(` when instantiating this tokenizer or when you
call it on some text, but since the model was not pretrained this way, it might yield a decrease in performance.`),mg=c(),v(yn.$$.fragment),pg=c(),Us=r("p"),fg=n("This tokenizer inherits from "),Za=r("a"),gg=n("PreTrainedTokenizerFast"),ug=n(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),_g=c(),Tn=r("div"),v(Hs.$$.fragment),wg=c(),ql=r("p"),kg=n(`Create a mask from the two sequences passed to be used in a sequence-pair classification task. Longformer does
not make use of token type ids, therefore a list of zeros is returned.`),eh=c(),mo=r("h2"),$n=r("a"),El=r("span"),v(Ks.$$.fragment),bg=c(),zl=r("span"),vg=n("Longformer specific outputs"),th=c(),po=r("div"),v(Rs.$$.fragment),yg=c(),Cl=r("p"),Tg=n("Base class for Longformer\u2019s outputs, with potential hidden states, local and global attentions."),oh=c(),fo=r("div"),v(Vs.$$.fragment),$g=c(),jl=r("p"),Lg=n("Base class for Longformer\u2019s outputs that also contains a pooling of the last hidden states."),nh=c(),go=r("div"),v(Gs.$$.fragment),xg=c(),Ol=r("p"),Fg=n("Base class for masked language models outputs."),sh=c(),uo=r("div"),v(Js.$$.fragment),Mg=c(),Pl=r("p"),qg=n("Base class for outputs of question answering Longformer models."),rh=c(),_o=r("div"),v(Ys.$$.fragment),Eg=c(),Al=r("p"),zg=n("Base class for outputs of sentence classification models."),ah=c(),wo=r("div"),v(Xs.$$.fragment),Cg=c(),Nl=r("p"),jg=n("Base class for outputs of multiple choice Longformer models."),ih=c(),ko=r("div"),v(Zs.$$.fragment),Og=c(),Il=r("p"),Pg=n("Base class for outputs of token classification models."),lh=c(),bo=r("div"),v(er.$$.fragment),Ag=c(),Dl=r("p"),Ng=n("Base class for Longformer\u2019s outputs, with potential hidden states, local and global attentions."),dh=c(),vo=r("div"),v(tr.$$.fragment),Ig=c(),Sl=r("p"),Dg=n("Base class for Longformer\u2019s outputs that also contains a pooling of the last hidden states."),ch=c(),yo=r("div"),v(or.$$.fragment),Sg=c(),Wl=r("p"),Wg=n("Base class for masked language models outputs."),hh=c(),To=r("div"),v(nr.$$.fragment),Qg=c(),Ql=r("p"),Bg=n("Base class for outputs of question answering Longformer models."),mh=c(),$o=r("div"),v(sr.$$.fragment),Ug=c(),Bl=r("p"),Hg=n("Base class for outputs of sentence classification models."),ph=c(),Lo=r("div"),v(rr.$$.fragment),Kg=c(),Ul=r("p"),Rg=n("Base class for outputs of multiple choice models."),fh=c(),xo=r("div"),v(ar.$$.fragment),Vg=c(),Hl=r("p"),Gg=n("Base class for outputs of token classification models."),gh=c(),Fo=r("h2"),Ln=r("a"),Kl=r("span"),v(ir.$$.fragment),Jg=c(),Rl=r("span"),Yg=n("LongformerModel"),uh=c(),st=r("div"),v(lr.$$.fragment),Xg=c(),Vl=r("p"),Zg=n("The bare Longformer Model outputting raw hidden-states without any specific head on top."),eu=c(),dr=r("p"),tu=n("This model inherits from "),ei=r("a"),ou=n("PreTrainedModel"),nu=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),su=c(),cr=r("p"),ru=n("This model is also a PyTorch "),hr=r("a"),au=n("torch.nn.Module"),iu=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),lu=c(),Mo=r("p"),du=n("This class copied code from "),ti=r("a"),cu=n("RobertaModel"),hu=n(` and overwrote standard self-attention with longformer self-attention
to provide the ability to process long sequences following the self-attention approach described in `),mr=r("a"),mu=n(`Longformer:
the Long-Document Transformer`),pu=n(` by Iz Beltagy, Matthew E. Peters, and Arman Cohan.
Longformer self-attention combines a local (sliding window) and global attention to extend to long documents
without the O(n^2) increase in memory and compute.`),fu=c(),pr=r("p"),gu=n("The self-attention module "),Gl=r("code"),uu=n("LongformerSelfAttention"),_u=n(` implemented here supports the combination of local and global
attention but it lacks support for autoregressive attention and dilated attention. Autoregressive and dilated
attention are more relevant for autoregressive language modeling than finetuning on downstream tasks. Future
release will add support for autoregressive attention, but the support for dilated attention requires a custom CUDA
kernel to be memory and compute efficient.`),wu=c(),Ft=r("div"),v(fr.$$.fragment),ku=c(),qo=r("p"),bu=n("The "),oi=r("a"),vu=n("LongformerModel"),yu=n(" forward method, overrides the "),Jl=r("code"),Tu=n("__call__"),$u=n(" special method."),Lu=c(),v(xn.$$.fragment),xu=c(),v(Fn.$$.fragment),_h=c(),Eo=r("h2"),Mn=r("a"),Yl=r("span"),v(gr.$$.fragment),Fu=c(),Xl=r("span"),Mu=n("LongformerForMaskedLM"),wh=c(),ft=r("div"),v(ur.$$.fragment),qu=c(),_r=r("p"),Eu=n("Longformer Model with a "),Zl=r("code"),zu=n("language modeling"),Cu=n(" head on top."),ju=c(),wr=r("p"),Ou=n("This model inherits from "),ni=r("a"),Pu=n("PreTrainedModel"),Au=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Nu=c(),kr=r("p"),Iu=n("This model is also a PyTorch "),br=r("a"),Du=n("torch.nn.Module"),Su=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Wu=c(),ct=r("div"),v(vr.$$.fragment),Qu=c(),zo=r("p"),Bu=n("The "),si=r("a"),Uu=n("LongformerForMaskedLM"),Hu=n(" forward method, overrides the "),ed=r("code"),Ku=n("__call__"),Ru=n(" special method."),Vu=c(),v(qn.$$.fragment),Gu=c(),v(En.$$.fragment),Ju=c(),td=r("p"),Yu=n("Let\u2019s try a very long input."),Xu=c(),v(zn.$$.fragment),kh=c(),Co=r("h2"),Cn=r("a"),od=r("span"),v(yr.$$.fragment),Zu=c(),nd=r("span"),e_=n("LongformerForSequenceClassification"),bh=c(),gt=r("div"),v(Tr.$$.fragment),t_=c(),sd=r("p"),o_=n(`Longformer Model transformer with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.`),n_=c(),$r=r("p"),s_=n("This model inherits from "),ri=r("a"),r_=n("PreTrainedModel"),a_=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),i_=c(),Lr=r("p"),l_=n("This model is also a PyTorch "),xr=r("a"),d_=n("torch.nn.Module"),c_=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),h_=c(),vt=r("div"),v(Fr.$$.fragment),m_=c(),jo=r("p"),p_=n("The "),ai=r("a"),f_=n("LongformerForSequenceClassification"),g_=n(" forward method, overrides the "),rd=r("code"),u_=n("__call__"),__=n(" special method."),w_=c(),v(jn.$$.fragment),k_=c(),v(On.$$.fragment),b_=c(),v(Pn.$$.fragment),vh=c(),Oo=r("h2"),An=r("a"),ad=r("span"),v(Mr.$$.fragment),v_=c(),id=r("span"),y_=n("LongformerForMultipleChoice"),yh=c(),ut=r("div"),v(qr.$$.fragment),T_=c(),ld=r("p"),$_=n(`Longformer Model with a multiple choice classification head on top (a linear layer on top of the pooled output and
a softmax) e.g. for RocStories/SWAG tasks.`),L_=c(),Er=r("p"),x_=n("This model inherits from "),ii=r("a"),F_=n("PreTrainedModel"),M_=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),q_=c(),zr=r("p"),E_=n("This model is also a PyTorch "),Cr=r("a"),z_=n("torch.nn.Module"),C_=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),j_=c(),Mt=r("div"),v(jr.$$.fragment),O_=c(),Po=r("p"),P_=n("The "),li=r("a"),A_=n("LongformerForMultipleChoice"),N_=n(" forward method, overrides the "),dd=r("code"),I_=n("__call__"),D_=n(" special method."),S_=c(),v(Nn.$$.fragment),W_=c(),v(In.$$.fragment),Th=c(),Ao=r("h2"),Dn=r("a"),cd=r("span"),v(Or.$$.fragment),Q_=c(),hd=r("span"),B_=n("LongformerForTokenClassification"),$h=c(),_t=r("div"),v(Pr.$$.fragment),U_=c(),md=r("p"),H_=n(`Longformer Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g.
for Named-Entity-Recognition (NER) tasks.`),K_=c(),Ar=r("p"),R_=n("This model inherits from "),di=r("a"),V_=n("PreTrainedModel"),G_=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),J_=c(),Nr=r("p"),Y_=n("This model is also a PyTorch "),Ir=r("a"),X_=n("torch.nn.Module"),Z_=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ew=c(),qt=r("div"),v(Dr.$$.fragment),tw=c(),No=r("p"),ow=n("The "),ci=r("a"),nw=n("LongformerForTokenClassification"),sw=n(" forward method, overrides the "),pd=r("code"),rw=n("__call__"),aw=n(" special method."),iw=c(),v(Sn.$$.fragment),lw=c(),v(Wn.$$.fragment),Lh=c(),Io=r("h2"),Qn=r("a"),fd=r("span"),v(Sr.$$.fragment),dw=c(),gd=r("span"),cw=n("LongformerForQuestionAnswering"),xh=c(),wt=r("div"),v(Wr.$$.fragment),hw=c(),Do=r("p"),mw=n(`Longformer Model with a span classification head on top for extractive question-answering tasks like SQuAD /
TriviaQA (a linear layers on top of the hidden-states output to compute `),ud=r("code"),pw=n("span start logits"),fw=n(" and "),_d=r("code"),gw=n("span end logits"),uw=n(")."),_w=c(),Qr=r("p"),ww=n("This model inherits from "),hi=r("a"),kw=n("PreTrainedModel"),bw=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),vw=c(),Br=r("p"),yw=n("This model is also a PyTorch "),Ur=r("a"),Tw=n("torch.nn.Module"),$w=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Lw=c(),Et=r("div"),v(Hr.$$.fragment),xw=c(),So=r("p"),Fw=n("The "),mi=r("a"),Mw=n("LongformerForQuestionAnswering"),qw=n(" forward method, overrides the "),wd=r("code"),Ew=n("__call__"),zw=n(" special method."),Cw=c(),v(Bn.$$.fragment),jw=c(),v(Un.$$.fragment),Fh=c(),Wo=r("h2"),Hn=r("a"),kd=r("span"),v(Kr.$$.fragment),Ow=c(),bd=r("span"),Pw=n("TFLongformerModel"),Mh=c(),Ye=r("div"),v(Rr.$$.fragment),Aw=c(),vd=r("p"),Nw=n("The bare Longformer Model outputting raw hidden-states without any specific head on top."),Iw=c(),Vr=r("p"),Dw=n("This model inherits from "),pi=r("a"),Sw=n("TFPreTrainedModel"),Ww=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Qw=c(),Gr=r("p"),Bw=n("This model is also a "),Jr=r("a"),Uw=n("tf.keras.Model"),Hw=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Kw=c(),v(Kn.$$.fragment),Rw=c(),Qo=r("p"),Vw=n("This class copies code from "),fi=r("a"),Gw=n("TFRobertaModel"),Jw=n(` and overwrites standard self-attention with longformer
self-attention to provide the ability to process long sequences following the self-attention approach described in
`),Yr=r("a"),Yw=n("Longformer: the Long-Document Transformer"),Xw=n(` by Iz Beltagy, Matthew E. Peters, and
Arman Cohan. Longformer self-attention combines a local (sliding window) and global attention to extend to long
documents without the O(n^2) increase in memory and compute.`),Zw=c(),Xr=r("p"),ek=n("The self-attention module "),yd=r("code"),tk=n("TFLongformerSelfAttention"),ok=n(` implemented here supports the combination of local and global
attention but it lacks support for autoregressive attention and dilated attention. Autoregressive and dilated
attention are more relevant for autoregressive language modeling than finetuning on downstream tasks. Future
release will add support for autoregressive attention, but the support for dilated attention requires a custom CUDA
kernel to be memory and compute efficient.`),nk=c(),Qt=r("div"),v(Zr.$$.fragment),sk=c(),Bo=r("p"),rk=n("The "),gi=r("a"),ak=n("TFLongformerModel"),ik=n(" forward method, overrides the "),Td=r("code"),lk=n("__call__"),dk=n(" special method."),ck=c(),v(Rn.$$.fragment),qh=c(),Uo=r("h2"),Vn=r("a"),$d=r("span"),v(ea.$$.fragment),hk=c(),Ld=r("span"),mk=n("TFLongformerForMaskedLM"),Eh=c(),rt=r("div"),v(ta.$$.fragment),pk=c(),oa=r("p"),fk=n("Longformer Model with a "),xd=r("code"),gk=n("language modeling"),uk=n(" head on top."),_k=c(),na=r("p"),wk=n("This model inherits from "),ui=r("a"),kk=n("TFPreTrainedModel"),bk=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),vk=c(),sa=r("p"),yk=n("This model is also a "),ra=r("a"),Tk=n("tf.keras.Model"),$k=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Lk=c(),v(Gn.$$.fragment),xk=c(),yt=r("div"),v(aa.$$.fragment),Fk=c(),Ho=r("p"),Mk=n("The "),_i=r("a"),qk=n("TFLongformerForMaskedLM"),Ek=n(" forward method, overrides the "),Fd=r("code"),zk=n("__call__"),Ck=n(" special method."),jk=c(),v(Jn.$$.fragment),Ok=c(),v(Yn.$$.fragment),Pk=c(),v(Xn.$$.fragment),zh=c(),Ko=r("h2"),Zn=r("a"),Md=r("span"),v(ia.$$.fragment),Ak=c(),qd=r("span"),Nk=n("TFLongformerForQuestionAnswering"),Ch=c(),at=r("div"),v(la.$$.fragment),Ik=c(),Ro=r("p"),Dk=n(`Longformer Model with a span classification head on top for extractive question-answering tasks like SQuAD /
TriviaQA (a linear layer on top of the hidden-states output to compute `),Ed=r("code"),Sk=n("span start logits"),Wk=n(" and "),zd=r("code"),Qk=n("span end logits"),Bk=n(")."),Uk=c(),da=r("p"),Hk=n("This model inherits from "),wi=r("a"),Kk=n("TFPreTrainedModel"),Rk=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Vk=c(),ca=r("p"),Gk=n("This model is also a "),ha=r("a"),Jk=n("tf.keras.Model"),Yk=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Xk=c(),v(es.$$.fragment),Zk=c(),Tt=r("div"),v(ma.$$.fragment),eb=c(),Vo=r("p"),tb=n("The "),ki=r("a"),ob=n("TFLongformerForQuestionAnswering"),nb=n(" forward method, overrides the "),Cd=r("code"),sb=n("__call__"),rb=n(" special method."),ab=c(),v(ts.$$.fragment),ib=c(),v(os.$$.fragment),lb=c(),v(ns.$$.fragment),jh=c(),Go=r("h2"),ss=r("a"),jd=r("span"),v(pa.$$.fragment),db=c(),Od=r("span"),cb=n("TFLongformerForSequenceClassification"),Oh=c(),it=r("div"),v(fa.$$.fragment),hb=c(),Pd=r("p"),mb=n(`Longformer Model transformer with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.`),pb=c(),ga=r("p"),fb=n("This model inherits from "),bi=r("a"),gb=n("TFPreTrainedModel"),ub=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),_b=c(),ua=r("p"),wb=n("This model is also a "),_a=r("a"),kb=n("tf.keras.Model"),bb=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),vb=c(),v(rs.$$.fragment),yb=c(),$t=r("div"),v(wa.$$.fragment),Tb=c(),Jo=r("p"),$b=n("The "),vi=r("a"),Lb=n("TFLongformerForSequenceClassification"),xb=n(" forward method, overrides the "),Ad=r("code"),Fb=n("__call__"),Mb=n(" special method."),qb=c(),v(as.$$.fragment),Eb=c(),v(is.$$.fragment),zb=c(),v(ls.$$.fragment),Ph=c(),Yo=r("h2"),ds=r("a"),Nd=r("span"),v(ka.$$.fragment),Cb=c(),Id=r("span"),jb=n("TFLongformerForTokenClassification"),Ah=c(),lt=r("div"),v(ba.$$.fragment),Ob=c(),Dd=r("p"),Pb=n(`Longformer Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g.
for Named-Entity-Recognition (NER) tasks.`),Ab=c(),va=r("p"),Nb=n("This model inherits from "),yi=r("a"),Ib=n("TFPreTrainedModel"),Db=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Sb=c(),ya=r("p"),Wb=n("This model is also a "),Ta=r("a"),Qb=n("tf.keras.Model"),Bb=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Ub=c(),v(cs.$$.fragment),Hb=c(),Lt=r("div"),v($a.$$.fragment),Kb=c(),Xo=r("p"),Rb=n("The "),Ti=r("a"),Vb=n("TFLongformerForTokenClassification"),Gb=n(" forward method, overrides the "),Sd=r("code"),Jb=n("__call__"),Yb=n(" special method."),Xb=c(),v(hs.$$.fragment),Zb=c(),v(ms.$$.fragment),ev=c(),v(ps.$$.fragment),Nh=c(),Zo=r("h2"),fs=r("a"),Wd=r("span"),v(La.$$.fragment),tv=c(),Qd=r("span"),ov=n("TFLongformerForMultipleChoice"),Ih=c(),dt=r("div"),v(xa.$$.fragment),nv=c(),Bd=r("p"),sv=n(`Longformer Model with a multiple choice classification head on top (a linear layer on top of the pooled output and
a softmax) e.g. for RocStories/SWAG tasks.`),rv=c(),Fa=r("p"),av=n("This model inherits from "),$i=r("a"),iv=n("TFPreTrainedModel"),lv=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),dv=c(),Ma=r("p"),cv=n("This model is also a "),qa=r("a"),hv=n("tf.keras.Model"),mv=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),pv=c(),v(gs.$$.fragment),fv=c(),zt=r("div"),v(Ea.$$.fragment),gv=c(),en=r("p"),uv=n("The "),Li=r("a"),_v=n("TFLongformerForMultipleChoice"),wv=n(" forward method, overrides the "),Ud=r("code"),kv=n("__call__"),bv=n(" special method."),vv=c(),v(us.$$.fragment),yv=c(),v(_s.$$.fragment),this.h()},l(o){const _=G2('[data-svelte="svelte-1phssyn"]',document.head);d=a(_,"META",{name:!0,content:!0}),_.forEach(t),k=h(o),p=a(o,"H1",{class:!0});var za=i(p);u=a(za,"A",{id:!0,class:!0,href:!0});var Hd=i(u);b=a(Hd,"SPAN",{});var Kd=i(b);y(l.$$.fragment,Kd),Kd.forEach(t),Hd.forEach(t),m=h(za),E=a(za,"SPAN",{});var Rd=i(E);re=s(Rd,"Longformer"),Rd.forEach(t),za.forEach(t),ee=h(o),N=a(o,"DIV",{class:!0});var Ca=i(N);ae=a(Ca,"A",{href:!0});var Vd=i(ae);oe=a(Vd,"IMG",{alt:!0,src:!0}),Vd.forEach(t),Te=h(Ca),B=a(Ca,"A",{href:!0});var Gd=i(B);fe=a(Gd,"IMG",{alt:!0,src:!0}),Gd.forEach(t),Ca.forEach(t),R=h(o),ie=a(o,"H2",{class:!0});var ja=i(ie);de=a(ja,"A",{id:!0,class:!0,href:!0});var Jd=i(de);U=a(Jd,"SPAN",{});var Yd=i(U);y(he.$$.fragment,Yd),Yd.forEach(t),Jd.forEach(t),$e=h(ja),H=a(ja,"SPAN",{});var Xd=i(H);Le=s(Xd,"Overview"),Xd.forEach(t),ja.forEach(t),be=h(o),W=a(o,"P",{});var Oa=i(W);xe=s(Oa,"The Longformer model was presented in "),me=a(Oa,"A",{href:!0,rel:!0});var Zd=i(me);le=s(Zd,"Longformer: The Long-Document Transformer"),Zd.forEach(t),C=s(Oa," by Iz Beltagy, Matthew E. Peters, Arman Cohan."),Oa.forEach(t),O=h(o),ge=a(o,"P",{});var ec=i(ge);J=s(ec,"The abstract from the paper is the following:"),ec.forEach(t),ve=h(o),ue=a(o,"P",{});var tc=i(ue);K=a(tc,"EM",{});var oc=i(K);Fe=s(oc,`Transformer-based models are unable to process long sequences due to their self-attention operation, which scales
quadratically with the sequence length. To address this limitation, we introduce the Longformer with an attention
mechanism that scales linearly with sequence length, making it easy to process documents of thousands of tokens or
longer. Longformer\u2019s attention mechanism is a drop-in replacement for the standard self-attention and combines a local
windowed attention with a task motivated global attention. Following prior work on long-sequence transformers, we
evaluate Longformer on character-level language modeling and achieve state-of-the-art results on text8 and enwik8. In
contrast to most prior work, we also pretrain Longformer and finetune it on a variety of downstream tasks. Our
pretrained Longformer consistently outperforms RoBERTa on long document tasks and sets new state-of-the-art results on
WikiHop and TriviaQA.`),oc.forEach(t),tc.forEach(t),ye=h(o),j=a(o,"P",{});var nc=i(j);Me=s(nc,"Tips:"),nc.forEach(t),V=h(o),ce=a(o,"UL",{});var Pa=i(ce);ne=a(Pa,"LI",{});var It=i(ne);Y=s(It,"Since the Longformer is based on RoBERTa, it doesn\u2019t have "),_e=a(It,"CODE",{});var sc=i(_e);qe=s(sc,"token_type_ids"),sc.forEach(t),S=s(It,`. You don\u2019t need to indicate which
token belongs to which segment. Just separate your segments with the separation token `),we=a(It,"CODE",{});var rc=i(we);X=s(rc,"tokenizer.sep_token"),rc.forEach(t),Ee=s(It,` (or
`),se=a(It,"CODE",{});var ac=i(se);P=s(ac,"</s>"),ac.forEach(t),ze=s(It,")."),It.forEach(t),A=h(Pa),ke=a(Pa,"LI",{});var ic=i(ke);Ce=s(ic,"A transformer model replacing the attention matrices by sparse matrices to go faster. Often, the local context (e.g., what are the two tokens left and right?) is enough to take action for a given token. Some preselected input tokens are still given global attention, but the attention matrix has way less parameters, resulting in a speed-up. See the local attention section for more information."),ic.forEach(t),Pa.forEach(t),w=h(o),M=a(o,"P",{});var tn=i(M);Ue=s(tn,"This model was contributed by "),te=a(tn,"A",{href:!0,rel:!0});var lc=i(te);He=s(lc,"beltagy"),lc.forEach(t),Ke=s(tn,". The Authors\u2019 code can be found "),q=a(tn,"A",{href:!0,rel:!0});var dc=i(q);Re=s(dc,"here"),dc.forEach(t),Ve=s(tn,"."),tn.forEach(t),De=h(o),je=a(o,"H2",{class:!0});var Aa=i(je);Ne=a(Aa,"A",{id:!0,class:!0,href:!0});var cc=i(Ne);I=a(cc,"SPAN",{});var hc=i(I);y(Q.$$.fragment,hc),hc.forEach(t),cc.forEach(t),Ge=h(Aa),Ie=a(Aa,"SPAN",{});var mc=i(Ie);Z=s(mc,"Longformer Self Attention"),mc.forEach(t),Aa.forEach(t),Se=h(o),G=a(o,"P",{});var Xe=i(G);Oe=s(Xe,`Longformer self attention employs self attention on both a \u201Clocal\u201D context and a \u201Cglobal\u201D context. Most tokens only
attend \u201Clocally\u201D to each other meaning that each token attends to its `),We=rn(Xe),Qe=s(Xe,` previous tokens and
`),vc=rn(Xe),yc=s(Xe," succeeding tokens with "),Tc=rn(Xe),$c=s(Xe,` being the window length as defined in
`),Ri=a(Xe,"CODE",{});var pc=i(Ri);ap=s(pc,"config.attention_window"),pc.forEach(t),ip=s(Xe,". Note that "),Vi=a(Xe,"CODE",{});var fc=i(Vi);lp=s(fc,"config.attention_window"),fc.forEach(t),dp=s(Xe," can be of type "),Gi=a(Xe,"CODE",{});var gc=i(Gi);cp=s(gc,"List"),gc.forEach(t),hp=s(Xe,` to define a
different `),Lc=rn(Xe),xc=s(Xe,` for each layer. A selected few tokens attend \u201Cglobally\u201D to all other tokens, as it is
conventionally done for all tokens in `),Ji=a(Xe,"CODE",{});var uc=i(Ji);mp=s(uc,"BertSelfAttention"),uc.forEach(t),pp=s(Xe,"."),Xe.forEach(t),Fc=h(o),Dt=a(o,"P",{});var on=i(Dt);fp=s(on,`Note that \u201Clocally\u201D and \u201Cglobally\u201D attending tokens are projected by different query, key and value matrices. Also note
that every \u201Clocally\u201D attending token not only attends to tokens within its window `),Mc=rn(on),qc=s(on,`, but also to all \u201Cglobally\u201D
attending tokens so that global attention is `),Yi=a(on,"EM",{});var _c=i(Yi);gp=s(_c,"symmetric"),_c.forEach(t),up=s(on,"."),on.forEach(t),Ec=h(o),St=a(o,"P",{});var nn=i(St);_p=s(nn,`The user can define which tokens attend \u201Clocally\u201D and which tokens attend \u201Cglobally\u201D by setting the tensor
`),Xi=a(nn,"CODE",{});var wc=i(Xi);wp=s(wc,"global_attention_mask"),wc.forEach(t),kp=s(nn,` at run-time appropriately. All Longformer models employ the following logic for
`),Zi=a(nn,"CODE",{});var kc=i(Zi);bp=s(kc,"global_attention_mask"),kc.forEach(t),vp=s(nn,":"),nn.forEach(t),zc=h(o),an=a(o,"UL",{});var Sh=i(an);el=a(Sh,"LI",{});var Lv=i(el);yp=s(Lv,"0: the token attends \u201Clocally\u201D,"),Lv.forEach(t),Tp=h(Sh),tl=a(Sh,"LI",{});var xv=i(tl);$p=s(xv,"1: the token attends \u201Cglobally\u201D."),xv.forEach(t),Sh.forEach(t),Cc=h(o),ln=a(o,"P",{});var Wh=i(ln);Lp=s(Wh,"For more information please also refer to "),Na=a(Wh,"A",{href:!0});var Fv=i(Na);xp=s(Fv,"forward()"),Fv.forEach(t),Fp=s(Wh," method."),Wh.forEach(t),jc=h(o),kt=a(o,"P",{});var Bt=i(kt);Mp=s(Bt,`Using Longformer self attention, the memory and time complexity of the query-key matmul operation, which usually
represents the memory and time bottleneck, can be reduced from `),Oc=rn(Bt),Pc=s(Bt,` to
`),Ac=rn(Bt),Nc=s(Bt,", with "),Ic=rn(Bt),Dc=s(Bt," being the sequence length and "),Sc=rn(Bt),Wc=s(Bt,` being the average window
size. It is assumed that the number of \u201Cglobally\u201D attending tokens is insignificant as compared to the number of
\u201Clocally\u201D attending tokens.`),Bt.forEach(t),Qc=h(o),dn=a(o,"P",{});var Qh=i(dn);qp=s(Qh,"For more information, please refer to the official "),Ts=a(Qh,"A",{href:!0,rel:!0});var Mv=i(Ts);Ep=s(Mv,"paper"),Mv.forEach(t),zp=s(Qh,"."),Qh.forEach(t),Bc=h(o),oo=a(o,"H2",{class:!0});var Bh=i(oo);cn=a(Bh,"A",{id:!0,class:!0,href:!0});var qv=i(cn);ol=a(qv,"SPAN",{});var Ev=i(ol);y($s.$$.fragment,Ev),Ev.forEach(t),qv.forEach(t),Cp=h(Bh),nl=a(Bh,"SPAN",{});var zv=i(nl);jp=s(zv,"Training"),zv.forEach(t),Bh.forEach(t),Uc=h(o),no=a(o,"P",{});var bc=i(no);Ia=a(bc,"A",{href:!0});var Cv=i(Ia);Op=s(Cv,"LongformerForMaskedLM"),Cv.forEach(t),Pp=s(bc," is trained the exact same way "),Da=a(bc,"A",{href:!0});var jv=i(Da);Ap=s(jv,"RobertaForMaskedLM"),jv.forEach(t),Np=s(bc,` is
trained and should be used as follows:`),bc.forEach(t),Hc=h(o),y(Ls.$$.fragment,o),Kc=h(o),so=a(o,"H2",{class:!0});var Uh=i(so);hn=a(Uh,"A",{id:!0,class:!0,href:!0});var Ov=i(hn);sl=a(Ov,"SPAN",{});var Pv=i(sl);y(xs.$$.fragment,Pv),Pv.forEach(t),Ov.forEach(t),Ip=h(Uh),rl=a(Uh,"SPAN",{});var Av=i(rl);Dp=s(Av,"Documentation resources"),Av.forEach(t),Uh.forEach(t),Rc=h(o),bt=a(o,"UL",{});var Ut=i(bt);al=a(Ut,"LI",{});var Nv=i(al);Sa=a(Nv,"A",{href:!0});var Iv=i(Sa);Sp=s(Iv,"Text classification task guide"),Iv.forEach(t),Nv.forEach(t),Wp=h(Ut),il=a(Ut,"LI",{});var Dv=i(il);Wa=a(Dv,"A",{href:!0});var Sv=i(Wa);Qp=s(Sv,"Token classification task guide"),Sv.forEach(t),Dv.forEach(t),Bp=h(Ut),ll=a(Ut,"LI",{});var Wv=i(ll);Qa=a(Wv,"A",{href:!0});var Qv=i(Qa);Up=s(Qv,"Question answering task guide"),Qv.forEach(t),Wv.forEach(t),Hp=h(Ut),dl=a(Ut,"LI",{});var Bv=i(dl);Ba=a(Bv,"A",{href:!0});var Uv=i(Ba);Kp=s(Uv,"Masked language modeling task guide"),Uv.forEach(t),Bv.forEach(t),Rp=h(Ut),cl=a(Ut,"LI",{});var Hv=i(cl);Ua=a(Hv,"A",{href:!0});var Kv=i(Ua);Vp=s(Kv,"Multiple choice task guide"),Kv.forEach(t),Hv.forEach(t),Ut.forEach(t),Vc=h(o),ro=a(o,"H2",{class:!0});var Hh=i(ro);mn=a(Hh,"A",{id:!0,class:!0,href:!0});var Rv=i(mn);hl=a(Rv,"SPAN",{});var Vv=i(hl);y(Fs.$$.fragment,Vv),Vv.forEach(t),Rv.forEach(t),Gp=h(Hh),ml=a(Hh,"SPAN",{});var Gv=i(ml);Jp=s(Gv,"LongformerConfig"),Gv.forEach(t),Hh.forEach(t),Gc=h(o),pt=a(o,"DIV",{class:!0});var Ht=i(pt);y(Ms.$$.fragment,Ht),Yp=h(Ht),ao=a(Ht,"P",{});var xi=i(ao);Xp=s(xi,"This is the configuration class to store the configuration of a "),Ha=a(xi,"A",{href:!0});var Jv=i(Ha);Zp=s(Jv,"LongformerModel"),Jv.forEach(t),ef=s(xi," or a "),Ka=a(xi,"A",{href:!0});var Yv=i(Ka);tf=s(Yv,"TFLongformerModel"),Yv.forEach(t),of=s(xi,`. It
is used to instantiate a Longformer model according to the specified arguments, defining the model architecture.`),xi.forEach(t),nf=h(Ht),io=a(Ht,"P",{});var Fi=i(io);sf=s(Fi,"This is the configuration class to store the configuration of a "),Ra=a(Fi,"A",{href:!0});var Xv=i(Ra);rf=s(Xv,"LongformerModel"),Xv.forEach(t),af=s(Fi,`. It is used to instantiate an
Longformer 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 LongFormer
`),qs=a(Fi,"A",{href:!0,rel:!0});var Zv=i(qs);lf=s(Zv,"allenai/longformer-base-4096"),Zv.forEach(t),df=s(Fi,` architecture with a sequence
length 4,096.`),Fi.forEach(t),cf=h(Ht),lo=a(Ht,"P",{});var Mi=i(lo);hf=s(Mi,"Configuration objects inherit from "),Va=a(Mi,"A",{href:!0});var ey=i(Va);mf=s(ey,"PretrainedConfig"),ey.forEach(t),pf=s(Mi,` and can be used to control the model outputs. Read the
documentation from `),Ga=a(Mi,"A",{href:!0});var ty=i(Ga);ff=s(ty,"PretrainedConfig"),ty.forEach(t),gf=s(Mi," for more information."),Mi.forEach(t),uf=h(Ht),y(pn.$$.fragment,Ht),Ht.forEach(t),Jc=h(o),co=a(o,"H2",{class:!0});var Kh=i(co);fn=a(Kh,"A",{id:!0,class:!0,href:!0});var oy=i(fn);pl=a(oy,"SPAN",{});var ny=i(pl);y(Es.$$.fragment,ny),ny.forEach(t),oy.forEach(t),_f=h(Kh),fl=a(Kh,"SPAN",{});var sy=i(fl);wf=s(sy,"LongformerTokenizer"),sy.forEach(t),Kh.forEach(t),Yc=h(o),Pe=a(o,"DIV",{class:!0});var Be=i(Pe);y(zs.$$.fragment,Be),kf=h(Be),gl=a(Be,"P",{});var ry=i(gl);bf=s(ry,"Constructs a Longformer tokenizer, derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding."),ry.forEach(t),vf=h(Be),ul=a(Be,"P",{});var ay=i(ul);yf=s(ay,"This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),ay.forEach(t),Tf=h(Be),y(gn.$$.fragment,Be),$f=h(Be),Cs=a(Be,"P",{});var Rh=i(Cs);Lf=s(Rh,"You can get around that behavior by passing "),_l=a(Rh,"CODE",{});var iy=i(_l);xf=s(iy,"add_prefix_space=True"),iy.forEach(t),Ff=s(Rh,` when instantiating this tokenizer or when you
call it on some text, but since the model was not pretrained this way, it might yield a decrease in performance.`),Rh.forEach(t),Mf=h(Be),y(un.$$.fragment,Be),qf=h(Be),js=a(Be,"P",{});var Vh=i(js);Ef=s(Vh,"This tokenizer inherits from "),Ja=a(Vh,"A",{href:!0});var ly=i(Ja);zf=s(ly,"PreTrainedTokenizer"),ly.forEach(t),Cf=s(Vh,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Vh.forEach(t),jf=h(Be),Wt=a(Be,"DIV",{class:!0});var qi=i(Wt);y(Os.$$.fragment,qi),Of=h(qi),wl=a(qi,"P",{});var dy=i(wl);Pf=s(dy,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A Longformer sequence has the following format:`),dy.forEach(t),Af=h(qi),Ps=a(qi,"UL",{});var Gh=i(Ps);Ya=a(Gh,"LI",{});var Tv=i(Ya);Nf=s(Tv,"single sequence: "),kl=a(Tv,"CODE",{});var cy=i(kl);If=s(cy,"<s> X </s>"),cy.forEach(t),Tv.forEach(t),Df=h(Gh),Xa=a(Gh,"LI",{});var $v=i(Xa);Sf=s($v,"pair of sequences: "),bl=a($v,"CODE",{});var hy=i(bl);Wf=s(hy,"<s> A </s></s> B </s>"),hy.forEach(t),$v.forEach(t),Gh.forEach(t),qi.forEach(t),Qf=h(Be),_n=a(Be,"DIV",{class:!0});var Jh=i(_n);y(As.$$.fragment,Jh),Bf=h(Jh),vl=a(Jh,"P",{});var my=i(vl);Uf=s(my,"Converts a sequence of tokens (string) in a single string."),my.forEach(t),Jh.forEach(t),Hf=h(Be),wn=a(Be,"DIV",{class:!0});var Yh=i(wn);y(Ns.$$.fragment,Yh),Kf=h(Yh),yl=a(Yh,"P",{});var py=i(yl);Rf=s(py,`Create a mask from the two sequences passed to be used in a sequence-pair classification task. Longformer does
not make use of token type ids, therefore a list of zeros is returned.`),py.forEach(t),Yh.forEach(t),Vf=h(Be),kn=a(Be,"DIV",{class:!0});var Xh=i(kn);y(Is.$$.fragment,Xh),Gf=h(Xh),Ds=a(Xh,"P",{});var Zh=i(Ds);Jf=s(Zh,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),Tl=a(Zh,"CODE",{});var fy=i(Tl);Yf=s(fy,"prepare_for_model"),fy.forEach(t),Xf=s(Zh," method."),Zh.forEach(t),Xh.forEach(t),Be.forEach(t),Xc=h(o),ho=a(o,"H2",{class:!0});var em=i(ho);bn=a(em,"A",{id:!0,class:!0,href:!0});var gy=i(bn);$l=a(gy,"SPAN",{});var uy=i($l);y(Ss.$$.fragment,uy),uy.forEach(t),gy.forEach(t),Zf=h(em),Ll=a(em,"SPAN",{});var _y=i(Ll);eg=s(_y,"LongformerTokenizerFast"),_y.forEach(t),em.forEach(t),Zc=h(o),Je=a(o,"DIV",{class:!0});var ht=i(Je);y(Ws.$$.fragment,ht),tg=h(ht),Qs=a(ht,"P",{});var tm=i(Qs);og=s(tm,"Construct a \u201Cfast\u201D Longformer tokenizer (backed by HuggingFace\u2019s "),xl=a(tm,"EM",{});var wy=i(xl);ng=s(wy,"tokenizers"),wy.forEach(t),sg=s(tm,` library), derived from the GPT-2
tokenizer, using byte-level Byte-Pair-Encoding.`),tm.forEach(t),rg=h(ht),Fl=a(ht,"P",{});var ky=i(Fl);ag=s(ky,"This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),ky.forEach(t),ig=h(ht),y(vn.$$.fragment,ht),lg=h(ht),Bs=a(ht,"P",{});var om=i(Bs);dg=s(om,"You can get around that behavior by passing "),Ml=a(om,"CODE",{});var by=i(Ml);cg=s(by,"add_prefix_space=True"),by.forEach(t),hg=s(om,` when instantiating this tokenizer or when you
call it on some text, but since the model was not pretrained this way, it might yield a decrease in performance.`),om.forEach(t),mg=h(ht),y(yn.$$.fragment,ht),pg=h(ht),Us=a(ht,"P",{});var nm=i(Us);fg=s(nm,"This tokenizer inherits from "),Za=a(nm,"A",{href:!0});var vy=i(Za);gg=s(vy,"PreTrainedTokenizerFast"),vy.forEach(t),ug=s(nm,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),nm.forEach(t),_g=h(ht),Tn=a(ht,"DIV",{class:!0});var sm=i(Tn);y(Hs.$$.fragment,sm),wg=h(sm),ql=a(sm,"P",{});var yy=i(ql);kg=s(yy,`Create a mask from the two sequences passed to be used in a sequence-pair classification task. Longformer does
not make use of token type ids, therefore a list of zeros is returned.`),yy.forEach(t),sm.forEach(t),ht.forEach(t),eh=h(o),mo=a(o,"H2",{class:!0});var rm=i(mo);$n=a(rm,"A",{id:!0,class:!0,href:!0});var Ty=i($n);El=a(Ty,"SPAN",{});var $y=i(El);y(Ks.$$.fragment,$y),$y.forEach(t),Ty.forEach(t),bg=h(rm),zl=a(rm,"SPAN",{});var Ly=i(zl);vg=s(Ly,"Longformer specific outputs"),Ly.forEach(t),rm.forEach(t),th=h(o),po=a(o,"DIV",{class:!0});var am=i(po);y(Rs.$$.fragment,am),yg=h(am),Cl=a(am,"P",{});var xy=i(Cl);Tg=s(xy,"Base class for Longformer\u2019s outputs, with potential hidden states, local and global attentions."),xy.forEach(t),am.forEach(t),oh=h(o),fo=a(o,"DIV",{class:!0});var im=i(fo);y(Vs.$$.fragment,im),$g=h(im),jl=a(im,"P",{});var Fy=i(jl);Lg=s(Fy,"Base class for Longformer\u2019s outputs that also contains a pooling of the last hidden states."),Fy.forEach(t),im.forEach(t),nh=h(o),go=a(o,"DIV",{class:!0});var lm=i(go);y(Gs.$$.fragment,lm),xg=h(lm),Ol=a(lm,"P",{});var My=i(Ol);Fg=s(My,"Base class for masked language models outputs."),My.forEach(t),lm.forEach(t),sh=h(o),uo=a(o,"DIV",{class:!0});var dm=i(uo);y(Js.$$.fragment,dm),Mg=h(dm),Pl=a(dm,"P",{});var qy=i(Pl);qg=s(qy,"Base class for outputs of question answering Longformer models."),qy.forEach(t),dm.forEach(t),rh=h(o),_o=a(o,"DIV",{class:!0});var cm=i(_o);y(Ys.$$.fragment,cm),Eg=h(cm),Al=a(cm,"P",{});var Ey=i(Al);zg=s(Ey,"Base class for outputs of sentence classification models."),Ey.forEach(t),cm.forEach(t),ah=h(o),wo=a(o,"DIV",{class:!0});var hm=i(wo);y(Xs.$$.fragment,hm),Cg=h(hm),Nl=a(hm,"P",{});var zy=i(Nl);jg=s(zy,"Base class for outputs of multiple choice Longformer models."),zy.forEach(t),hm.forEach(t),ih=h(o),ko=a(o,"DIV",{class:!0});var mm=i(ko);y(Zs.$$.fragment,mm),Og=h(mm),Il=a(mm,"P",{});var Cy=i(Il);Pg=s(Cy,"Base class for outputs of token classification models."),Cy.forEach(t),mm.forEach(t),lh=h(o),bo=a(o,"DIV",{class:!0});var pm=i(bo);y(er.$$.fragment,pm),Ag=h(pm),Dl=a(pm,"P",{});var jy=i(Dl);Ng=s(jy,"Base class for Longformer\u2019s outputs, with potential hidden states, local and global attentions."),jy.forEach(t),pm.forEach(t),dh=h(o),vo=a(o,"DIV",{class:!0});var fm=i(vo);y(tr.$$.fragment,fm),Ig=h(fm),Sl=a(fm,"P",{});var Oy=i(Sl);Dg=s(Oy,"Base class for Longformer\u2019s outputs that also contains a pooling of the last hidden states."),Oy.forEach(t),fm.forEach(t),ch=h(o),yo=a(o,"DIV",{class:!0});var gm=i(yo);y(or.$$.fragment,gm),Sg=h(gm),Wl=a(gm,"P",{});var Py=i(Wl);Wg=s(Py,"Base class for masked language models outputs."),Py.forEach(t),gm.forEach(t),hh=h(o),To=a(o,"DIV",{class:!0});var um=i(To);y(nr.$$.fragment,um),Qg=h(um),Ql=a(um,"P",{});var Ay=i(Ql);Bg=s(Ay,"Base class for outputs of question answering Longformer models."),Ay.forEach(t),um.forEach(t),mh=h(o),$o=a(o,"DIV",{class:!0});var _m=i($o);y(sr.$$.fragment,_m),Ug=h(_m),Bl=a(_m,"P",{});var Ny=i(Bl);Hg=s(Ny,"Base class for outputs of sentence classification models."),Ny.forEach(t),_m.forEach(t),ph=h(o),Lo=a(o,"DIV",{class:!0});var wm=i(Lo);y(rr.$$.fragment,wm),Kg=h(wm),Ul=a(wm,"P",{});var Iy=i(Ul);Rg=s(Iy,"Base class for outputs of multiple choice models."),Iy.forEach(t),wm.forEach(t),fh=h(o),xo=a(o,"DIV",{class:!0});var km=i(xo);y(ar.$$.fragment,km),Vg=h(km),Hl=a(km,"P",{});var Dy=i(Hl);Gg=s(Dy,"Base class for outputs of token classification models."),Dy.forEach(t),km.forEach(t),gh=h(o),Fo=a(o,"H2",{class:!0});var bm=i(Fo);Ln=a(bm,"A",{id:!0,class:!0,href:!0});var Sy=i(Ln);Kl=a(Sy,"SPAN",{});var Wy=i(Kl);y(ir.$$.fragment,Wy),Wy.forEach(t),Sy.forEach(t),Jg=h(bm),Rl=a(bm,"SPAN",{});var Qy=i(Rl);Yg=s(Qy,"LongformerModel"),Qy.forEach(t),bm.forEach(t),uh=h(o),st=a(o,"DIV",{class:!0});var xt=i(st);y(lr.$$.fragment,xt),Xg=h(xt),Vl=a(xt,"P",{});var By=i(Vl);Zg=s(By,"The bare Longformer Model outputting raw hidden-states without any specific head on top."),By.forEach(t),eu=h(xt),dr=a(xt,"P",{});var vm=i(dr);tu=s(vm,"This model inherits from "),ei=a(vm,"A",{href:!0});var Uy=i(ei);ou=s(Uy,"PreTrainedModel"),Uy.forEach(t),nu=s(vm,`. 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.)`),vm.forEach(t),su=h(xt),cr=a(xt,"P",{});var ym=i(cr);ru=s(ym,"This model is also a PyTorch "),hr=a(ym,"A",{href:!0,rel:!0});var Hy=i(hr);au=s(Hy,"torch.nn.Module"),Hy.forEach(t),iu=s(ym,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ym.forEach(t),lu=h(xt),Mo=a(xt,"P",{});var Ei=i(Mo);du=s(Ei,"This class copied code from "),ti=a(Ei,"A",{href:!0});var Ky=i(ti);cu=s(Ky,"RobertaModel"),Ky.forEach(t),hu=s(Ei,` and overwrote standard self-attention with longformer self-attention
to provide the ability to process long sequences following the self-attention approach described in `),mr=a(Ei,"A",{href:!0,rel:!0});var Ry=i(mr);mu=s(Ry,`Longformer:
the Long-Document Transformer`),Ry.forEach(t),pu=s(Ei,` by Iz Beltagy, Matthew E. Peters, and Arman Cohan.
Longformer self-attention combines a local (sliding window) and global attention to extend to long documents
without the O(n^2) increase in memory and compute.`),Ei.forEach(t),fu=h(xt),pr=a(xt,"P",{});var Tm=i(pr);gu=s(Tm,"The self-attention module "),Gl=a(Tm,"CODE",{});var Vy=i(Gl);uu=s(Vy,"LongformerSelfAttention"),Vy.forEach(t),_u=s(Tm,` implemented here supports the combination of local and global
attention but it lacks support for autoregressive attention and dilated attention. Autoregressive and dilated
attention are more relevant for autoregressive language modeling than finetuning on downstream tasks. Future
release will add support for autoregressive attention, but the support for dilated attention requires a custom CUDA
kernel to be memory and compute efficient.`),Tm.forEach(t),wu=h(xt),Ft=a(xt,"DIV",{class:!0});var ws=i(Ft);y(fr.$$.fragment,ws),ku=h(ws),qo=a(ws,"P",{});var zi=i(qo);bu=s(zi,"The "),oi=a(zi,"A",{href:!0});var Gy=i(oi);vu=s(Gy,"LongformerModel"),Gy.forEach(t),yu=s(zi," forward method, overrides the "),Jl=a(zi,"CODE",{});var Jy=i(Jl);Tu=s(Jy,"__call__"),Jy.forEach(t),$u=s(zi," special method."),zi.forEach(t),Lu=h(ws),y(xn.$$.fragment,ws),xu=h(ws),y(Fn.$$.fragment,ws),ws.forEach(t),xt.forEach(t),_h=h(o),Eo=a(o,"H2",{class:!0});var $m=i(Eo);Mn=a($m,"A",{id:!0,class:!0,href:!0});var Yy=i(Mn);Yl=a(Yy,"SPAN",{});var Xy=i(Yl);y(gr.$$.fragment,Xy),Xy.forEach(t),Yy.forEach(t),Fu=h($m),Xl=a($m,"SPAN",{});var Zy=i(Xl);Mu=s(Zy,"LongformerForMaskedLM"),Zy.forEach(t),$m.forEach(t),wh=h(o),ft=a(o,"DIV",{class:!0});var Kt=i(ft);y(ur.$$.fragment,Kt),qu=h(Kt),_r=a(Kt,"P",{});var Lm=i(_r);Eu=s(Lm,"Longformer Model with a "),Zl=a(Lm,"CODE",{});var eT=i(Zl);zu=s(eT,"language modeling"),eT.forEach(t),Cu=s(Lm," head on top."),Lm.forEach(t),ju=h(Kt),wr=a(Kt,"P",{});var xm=i(wr);Ou=s(xm,"This model inherits from "),ni=a(xm,"A",{href:!0});var tT=i(ni);Pu=s(tT,"PreTrainedModel"),tT.forEach(t),Au=s(xm,`. 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.)`),xm.forEach(t),Nu=h(Kt),kr=a(Kt,"P",{});var Fm=i(kr);Iu=s(Fm,"This model is also a PyTorch "),br=a(Fm,"A",{href:!0,rel:!0});var oT=i(br);Du=s(oT,"torch.nn.Module"),oT.forEach(t),Su=s(Fm,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Fm.forEach(t),Wu=h(Kt),ct=a(Kt,"DIV",{class:!0});var Ct=i(ct);y(vr.$$.fragment,Ct),Qu=h(Ct),zo=a(Ct,"P",{});var Ci=i(zo);Bu=s(Ci,"The "),si=a(Ci,"A",{href:!0});var nT=i(si);Uu=s(nT,"LongformerForMaskedLM"),nT.forEach(t),Hu=s(Ci," forward method, overrides the "),ed=a(Ci,"CODE",{});var sT=i(ed);Ku=s(sT,"__call__"),sT.forEach(t),Ru=s(Ci," special method."),Ci.forEach(t),Vu=h(Ct),y(qn.$$.fragment,Ct),Gu=h(Ct),y(En.$$.fragment,Ct),Ju=h(Ct),td=a(Ct,"P",{});var rT=i(td);Yu=s(rT,"Let\u2019s try a very long input."),rT.forEach(t),Xu=h(Ct),y(zn.$$.fragment,Ct),Ct.forEach(t),Kt.forEach(t),kh=h(o),Co=a(o,"H2",{class:!0});var Mm=i(Co);Cn=a(Mm,"A",{id:!0,class:!0,href:!0});var aT=i(Cn);od=a(aT,"SPAN",{});var iT=i(od);y(yr.$$.fragment,iT),iT.forEach(t),aT.forEach(t),Zu=h(Mm),nd=a(Mm,"SPAN",{});var lT=i(nd);e_=s(lT,"LongformerForSequenceClassification"),lT.forEach(t),Mm.forEach(t),bh=h(o),gt=a(o,"DIV",{class:!0});var Rt=i(gt);y(Tr.$$.fragment,Rt),t_=h(Rt),sd=a(Rt,"P",{});var dT=i(sd);o_=s(dT,`Longformer Model transformer with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.`),dT.forEach(t),n_=h(Rt),$r=a(Rt,"P",{});var qm=i($r);s_=s(qm,"This model inherits from "),ri=a(qm,"A",{href:!0});var cT=i(ri);r_=s(cT,"PreTrainedModel"),cT.forEach(t),a_=s(qm,`. 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.)`),qm.forEach(t),i_=h(Rt),Lr=a(Rt,"P",{});var Em=i(Lr);l_=s(Em,"This model is also a PyTorch "),xr=a(Em,"A",{href:!0,rel:!0});var hT=i(xr);d_=s(hT,"torch.nn.Module"),hT.forEach(t),c_=s(Em,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Em.forEach(t),h_=h(Rt),vt=a(Rt,"DIV",{class:!0});var Vt=i(vt);y(Fr.$$.fragment,Vt),m_=h(Vt),jo=a(Vt,"P",{});var ji=i(jo);p_=s(ji,"The "),ai=a(ji,"A",{href:!0});var mT=i(ai);f_=s(mT,"LongformerForSequenceClassification"),mT.forEach(t),g_=s(ji," forward method, overrides the "),rd=a(ji,"CODE",{});var pT=i(rd);u_=s(pT,"__call__"),pT.forEach(t),__=s(ji," special method."),ji.forEach(t),w_=h(Vt),y(jn.$$.fragment,Vt),k_=h(Vt),y(On.$$.fragment,Vt),b_=h(Vt),y(Pn.$$.fragment,Vt),Vt.forEach(t),Rt.forEach(t),vh=h(o),Oo=a(o,"H2",{class:!0});var zm=i(Oo);An=a(zm,"A",{id:!0,class:!0,href:!0});var fT=i(An);ad=a(fT,"SPAN",{});var gT=i(ad);y(Mr.$$.fragment,gT),gT.forEach(t),fT.forEach(t),v_=h(zm),id=a(zm,"SPAN",{});var uT=i(id);y_=s(uT,"LongformerForMultipleChoice"),uT.forEach(t),zm.forEach(t),yh=h(o),ut=a(o,"DIV",{class:!0});var Gt=i(ut);y(qr.$$.fragment,Gt),T_=h(Gt),ld=a(Gt,"P",{});var _T=i(ld);$_=s(_T,`Longformer Model with a multiple choice classification head on top (a linear layer on top of the pooled output and
a softmax) e.g. for RocStories/SWAG tasks.`),_T.forEach(t),L_=h(Gt),Er=a(Gt,"P",{});var Cm=i(Er);x_=s(Cm,"This model inherits from "),ii=a(Cm,"A",{href:!0});var wT=i(ii);F_=s(wT,"PreTrainedModel"),wT.forEach(t),M_=s(Cm,`. 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.)`),Cm.forEach(t),q_=h(Gt),zr=a(Gt,"P",{});var jm=i(zr);E_=s(jm,"This model is also a PyTorch "),Cr=a(jm,"A",{href:!0,rel:!0});var kT=i(Cr);z_=s(kT,"torch.nn.Module"),kT.forEach(t),C_=s(jm,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),jm.forEach(t),j_=h(Gt),Mt=a(Gt,"DIV",{class:!0});var ks=i(Mt);y(jr.$$.fragment,ks),O_=h(ks),Po=a(ks,"P",{});var Oi=i(Po);P_=s(Oi,"The "),li=a(Oi,"A",{href:!0});var bT=i(li);A_=s(bT,"LongformerForMultipleChoice"),bT.forEach(t),N_=s(Oi," forward method, overrides the "),dd=a(Oi,"CODE",{});var vT=i(dd);I_=s(vT,"__call__"),vT.forEach(t),D_=s(Oi," special method."),Oi.forEach(t),S_=h(ks),y(Nn.$$.fragment,ks),W_=h(ks),y(In.$$.fragment,ks),ks.forEach(t),Gt.forEach(t),Th=h(o),Ao=a(o,"H2",{class:!0});var Om=i(Ao);Dn=a(Om,"A",{id:!0,class:!0,href:!0});var yT=i(Dn);cd=a(yT,"SPAN",{});var TT=i(cd);y(Or.$$.fragment,TT),TT.forEach(t),yT.forEach(t),Q_=h(Om),hd=a(Om,"SPAN",{});var $T=i(hd);B_=s($T,"LongformerForTokenClassification"),$T.forEach(t),Om.forEach(t),$h=h(o),_t=a(o,"DIV",{class:!0});var Jt=i(_t);y(Pr.$$.fragment,Jt),U_=h(Jt),md=a(Jt,"P",{});var LT=i(md);H_=s(LT,`Longformer Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g.
for Named-Entity-Recognition (NER) tasks.`),LT.forEach(t),K_=h(Jt),Ar=a(Jt,"P",{});var Pm=i(Ar);R_=s(Pm,"This model inherits from "),di=a(Pm,"A",{href:!0});var xT=i(di);V_=s(xT,"PreTrainedModel"),xT.forEach(t),G_=s(Pm,`. 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.)`),Pm.forEach(t),J_=h(Jt),Nr=a(Jt,"P",{});var Am=i(Nr);Y_=s(Am,"This model is also a PyTorch "),Ir=a(Am,"A",{href:!0,rel:!0});var FT=i(Ir);X_=s(FT,"torch.nn.Module"),FT.forEach(t),Z_=s(Am,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Am.forEach(t),ew=h(Jt),qt=a(Jt,"DIV",{class:!0});var bs=i(qt);y(Dr.$$.fragment,bs),tw=h(bs),No=a(bs,"P",{});var Pi=i(No);ow=s(Pi,"The "),ci=a(Pi,"A",{href:!0});var MT=i(ci);nw=s(MT,"LongformerForTokenClassification"),MT.forEach(t),sw=s(Pi," forward method, overrides the "),pd=a(Pi,"CODE",{});var qT=i(pd);rw=s(qT,"__call__"),qT.forEach(t),aw=s(Pi," special method."),Pi.forEach(t),iw=h(bs),y(Sn.$$.fragment,bs),lw=h(bs),y(Wn.$$.fragment,bs),bs.forEach(t),Jt.forEach(t),Lh=h(o),Io=a(o,"H2",{class:!0});var Nm=i(Io);Qn=a(Nm,"A",{id:!0,class:!0,href:!0});var ET=i(Qn);fd=a(ET,"SPAN",{});var zT=i(fd);y(Sr.$$.fragment,zT),zT.forEach(t),ET.forEach(t),dw=h(Nm),gd=a(Nm,"SPAN",{});var CT=i(gd);cw=s(CT,"LongformerForQuestionAnswering"),CT.forEach(t),Nm.forEach(t),xh=h(o),wt=a(o,"DIV",{class:!0});var Yt=i(wt);y(Wr.$$.fragment,Yt),hw=h(Yt),Do=a(Yt,"P",{});var Ai=i(Do);mw=s(Ai,`Longformer Model with a span classification head on top for extractive question-answering tasks like SQuAD /
TriviaQA (a linear layers on top of the hidden-states output to compute `),ud=a(Ai,"CODE",{});var jT=i(ud);pw=s(jT,"span start logits"),jT.forEach(t),fw=s(Ai," and "),_d=a(Ai,"CODE",{});var OT=i(_d);gw=s(OT,"span end logits"),OT.forEach(t),uw=s(Ai,")."),Ai.forEach(t),_w=h(Yt),Qr=a(Yt,"P",{});var Im=i(Qr);ww=s(Im,"This model inherits from "),hi=a(Im,"A",{href:!0});var PT=i(hi);kw=s(PT,"PreTrainedModel"),PT.forEach(t),bw=s(Im,`. 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.)`),Im.forEach(t),vw=h(Yt),Br=a(Yt,"P",{});var Dm=i(Br);yw=s(Dm,"This model is also a PyTorch "),Ur=a(Dm,"A",{href:!0,rel:!0});var AT=i(Ur);Tw=s(AT,"torch.nn.Module"),AT.forEach(t),$w=s(Dm,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Dm.forEach(t),Lw=h(Yt),Et=a(Yt,"DIV",{class:!0});var vs=i(Et);y(Hr.$$.fragment,vs),xw=h(vs),So=a(vs,"P",{});var Ni=i(So);Fw=s(Ni,"The "),mi=a(Ni,"A",{href:!0});var NT=i(mi);Mw=s(NT,"LongformerForQuestionAnswering"),NT.forEach(t),qw=s(Ni," forward method, overrides the "),wd=a(Ni,"CODE",{});var IT=i(wd);Ew=s(IT,"__call__"),IT.forEach(t),zw=s(Ni," special method."),Ni.forEach(t),Cw=h(vs),y(Bn.$$.fragment,vs),jw=h(vs),y(Un.$$.fragment,vs),vs.forEach(t),Yt.forEach(t),Fh=h(o),Wo=a(o,"H2",{class:!0});var Sm=i(Wo);Hn=a(Sm,"A",{id:!0,class:!0,href:!0});var DT=i(Hn);kd=a(DT,"SPAN",{});var ST=i(kd);y(Kr.$$.fragment,ST),ST.forEach(t),DT.forEach(t),Ow=h(Sm),bd=a(Sm,"SPAN",{});var WT=i(bd);Pw=s(WT,"TFLongformerModel"),WT.forEach(t),Sm.forEach(t),Mh=h(o),Ye=a(o,"DIV",{class:!0});var mt=i(Ye);y(Rr.$$.fragment,mt),Aw=h(mt),vd=a(mt,"P",{});var QT=i(vd);Nw=s(QT,"The bare Longformer Model outputting raw hidden-states without any specific head on top."),QT.forEach(t),Iw=h(mt),Vr=a(mt,"P",{});var Wm=i(Vr);Dw=s(Wm,"This model inherits from "),pi=a(Wm,"A",{href:!0});var BT=i(pi);Sw=s(BT,"TFPreTrainedModel"),BT.forEach(t),Ww=s(Wm,`. 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.)`),Wm.forEach(t),Qw=h(mt),Gr=a(mt,"P",{});var Qm=i(Gr);Bw=s(Qm,"This model is also a "),Jr=a(Qm,"A",{href:!0,rel:!0});var UT=i(Jr);Uw=s(UT,"tf.keras.Model"),UT.forEach(t),Hw=s(Qm,` 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.`),Qm.forEach(t),Kw=h(mt),y(Kn.$$.fragment,mt),Rw=h(mt),Qo=a(mt,"P",{});var Ii=i(Qo);Vw=s(Ii,"This class copies code from "),fi=a(Ii,"A",{href:!0});var HT=i(fi);Gw=s(HT,"TFRobertaModel"),HT.forEach(t),Jw=s(Ii,` and overwrites standard self-attention with longformer
self-attention to provide the ability to process long sequences following the self-attention approach described in
`),Yr=a(Ii,"A",{href:!0,rel:!0});var KT=i(Yr);Yw=s(KT,"Longformer: the Long-Document Transformer"),KT.forEach(t),Xw=s(Ii,` by Iz Beltagy, Matthew E. Peters, and
Arman Cohan. Longformer self-attention combines a local (sliding window) and global attention to extend to long
documents without the O(n^2) increase in memory and compute.`),Ii.forEach(t),Zw=h(mt),Xr=a(mt,"P",{});var Bm=i(Xr);ek=s(Bm,"The self-attention module "),yd=a(Bm,"CODE",{});var RT=i(yd);tk=s(RT,"TFLongformerSelfAttention"),RT.forEach(t),ok=s(Bm,` implemented here supports the combination of local and global
attention but it lacks support for autoregressive attention and dilated attention. Autoregressive and dilated
attention are more relevant for autoregressive language modeling than finetuning on downstream tasks. Future
release will add support for autoregressive attention, but the support for dilated attention requires a custom CUDA
kernel to be memory and compute efficient.`),Bm.forEach(t),nk=h(mt),Qt=a(mt,"DIV",{class:!0});var Di=i(Qt);y(Zr.$$.fragment,Di),sk=h(Di),Bo=a(Di,"P",{});var Si=i(Bo);rk=s(Si,"The "),gi=a(Si,"A",{href:!0});var VT=i(gi);ak=s(VT,"TFLongformerModel"),VT.forEach(t),ik=s(Si," forward method, overrides the "),Td=a(Si,"CODE",{});var GT=i(Td);lk=s(GT,"__call__"),GT.forEach(t),dk=s(Si," special method."),Si.forEach(t),ck=h(Di),y(Rn.$$.fragment,Di),Di.forEach(t),mt.forEach(t),qh=h(o),Uo=a(o,"H2",{class:!0});var Um=i(Uo);Vn=a(Um,"A",{id:!0,class:!0,href:!0});var JT=i(Vn);$d=a(JT,"SPAN",{});var YT=i($d);y(ea.$$.fragment,YT),YT.forEach(t),JT.forEach(t),hk=h(Um),Ld=a(Um,"SPAN",{});var XT=i(Ld);mk=s(XT,"TFLongformerForMaskedLM"),XT.forEach(t),Um.forEach(t),Eh=h(o),rt=a(o,"DIV",{class:!0});var jt=i(rt);y(ta.$$.fragment,jt),pk=h(jt),oa=a(jt,"P",{});var Hm=i(oa);fk=s(Hm,"Longformer Model with a "),xd=a(Hm,"CODE",{});var ZT=i(xd);gk=s(ZT,"language modeling"),ZT.forEach(t),uk=s(Hm," head on top."),Hm.forEach(t),_k=h(jt),na=a(jt,"P",{});var Km=i(na);wk=s(Km,"This model inherits from "),ui=a(Km,"A",{href:!0});var e2=i(ui);kk=s(e2,"TFPreTrainedModel"),e2.forEach(t),bk=s(Km,`. 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.)`),Km.forEach(t),vk=h(jt),sa=a(jt,"P",{});var Rm=i(sa);yk=s(Rm,"This model is also a "),ra=a(Rm,"A",{href:!0,rel:!0});var t2=i(ra);Tk=s(t2,"tf.keras.Model"),t2.forEach(t),$k=s(Rm,` 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.`),Rm.forEach(t),Lk=h(jt),y(Gn.$$.fragment,jt),xk=h(jt),yt=a(jt,"DIV",{class:!0});var Xt=i(yt);y(aa.$$.fragment,Xt),Fk=h(Xt),Ho=a(Xt,"P",{});var Wi=i(Ho);Mk=s(Wi,"The "),_i=a(Wi,"A",{href:!0});var o2=i(_i);qk=s(o2,"TFLongformerForMaskedLM"),o2.forEach(t),Ek=s(Wi," forward method, overrides the "),Fd=a(Wi,"CODE",{});var n2=i(Fd);zk=s(n2,"__call__"),n2.forEach(t),Ck=s(Wi," special method."),Wi.forEach(t),jk=h(Xt),y(Jn.$$.fragment,Xt),Ok=h(Xt),y(Yn.$$.fragment,Xt),Pk=h(Xt),y(Xn.$$.fragment,Xt),Xt.forEach(t),jt.forEach(t),zh=h(o),Ko=a(o,"H2",{class:!0});var Vm=i(Ko);Zn=a(Vm,"A",{id:!0,class:!0,href:!0});var s2=i(Zn);Md=a(s2,"SPAN",{});var r2=i(Md);y(ia.$$.fragment,r2),r2.forEach(t),s2.forEach(t),Ak=h(Vm),qd=a(Vm,"SPAN",{});var a2=i(qd);Nk=s(a2,"TFLongformerForQuestionAnswering"),a2.forEach(t),Vm.forEach(t),Ch=h(o),at=a(o,"DIV",{class:!0});var Ot=i(at);y(la.$$.fragment,Ot),Ik=h(Ot),Ro=a(Ot,"P",{});var Qi=i(Ro);Dk=s(Qi,`Longformer Model with a span classification head on top for extractive question-answering tasks like SQuAD /
TriviaQA (a linear layer on top of the hidden-states output to compute `),Ed=a(Qi,"CODE",{});var i2=i(Ed);Sk=s(i2,"span start logits"),i2.forEach(t),Wk=s(Qi," and "),zd=a(Qi,"CODE",{});var l2=i(zd);Qk=s(l2,"span end logits"),l2.forEach(t),Bk=s(Qi,")."),Qi.forEach(t),Uk=h(Ot),da=a(Ot,"P",{});var Gm=i(da);Hk=s(Gm,"This model inherits from "),wi=a(Gm,"A",{href:!0});var d2=i(wi);Kk=s(d2,"TFPreTrainedModel"),d2.forEach(t),Rk=s(Gm,`. 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.)`),Gm.forEach(t),Vk=h(Ot),ca=a(Ot,"P",{});var Jm=i(ca);Gk=s(Jm,"This model is also a "),ha=a(Jm,"A",{href:!0,rel:!0});var c2=i(ha);Jk=s(c2,"tf.keras.Model"),c2.forEach(t),Yk=s(Jm,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Jm.forEach(t),Xk=h(Ot),y(es.$$.fragment,Ot),Zk=h(Ot),Tt=a(Ot,"DIV",{class:!0});var Zt=i(Tt);y(ma.$$.fragment,Zt),eb=h(Zt),Vo=a(Zt,"P",{});var Bi=i(Vo);tb=s(Bi,"The "),ki=a(Bi,"A",{href:!0});var h2=i(ki);ob=s(h2,"TFLongformerForQuestionAnswering"),h2.forEach(t),nb=s(Bi," forward method, overrides the "),Cd=a(Bi,"CODE",{});var m2=i(Cd);sb=s(m2,"__call__"),m2.forEach(t),rb=s(Bi," special method."),Bi.forEach(t),ab=h(Zt),y(ts.$$.fragment,Zt),ib=h(Zt),y(os.$$.fragment,Zt),lb=h(Zt),y(ns.$$.fragment,Zt),Zt.forEach(t),Ot.forEach(t),jh=h(o),Go=a(o,"H2",{class:!0});var Ym=i(Go);ss=a(Ym,"A",{id:!0,class:!0,href:!0});var p2=i(ss);jd=a(p2,"SPAN",{});var f2=i(jd);y(pa.$$.fragment,f2),f2.forEach(t),p2.forEach(t),db=h(Ym),Od=a(Ym,"SPAN",{});var g2=i(Od);cb=s(g2,"TFLongformerForSequenceClassification"),g2.forEach(t),Ym.forEach(t),Oh=h(o),it=a(o,"DIV",{class:!0});var Pt=i(it);y(fa.$$.fragment,Pt),hb=h(Pt),Pd=a(Pt,"P",{});var u2=i(Pd);mb=s(u2,`Longformer Model transformer with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.`),u2.forEach(t),pb=h(Pt),ga=a(Pt,"P",{});var Xm=i(ga);fb=s(Xm,"This model inherits from "),bi=a(Xm,"A",{href:!0});var _2=i(bi);gb=s(_2,"TFPreTrainedModel"),_2.forEach(t),ub=s(Xm,`. 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.)`),Xm.forEach(t),_b=h(Pt),ua=a(Pt,"P",{});var Zm=i(ua);wb=s(Zm,"This model is also a "),_a=a(Zm,"A",{href:!0,rel:!0});var w2=i(_a);kb=s(w2,"tf.keras.Model"),w2.forEach(t),bb=s(Zm,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Zm.forEach(t),vb=h(Pt),y(rs.$$.fragment,Pt),yb=h(Pt),$t=a(Pt,"DIV",{class:!0});var eo=i($t);y(wa.$$.fragment,eo),Tb=h(eo),Jo=a(eo,"P",{});var Ui=i(Jo);$b=s(Ui,"The "),vi=a(Ui,"A",{href:!0});var k2=i(vi);Lb=s(k2,"TFLongformerForSequenceClassification"),k2.forEach(t),xb=s(Ui," forward method, overrides the "),Ad=a(Ui,"CODE",{});var b2=i(Ad);Fb=s(b2,"__call__"),b2.forEach(t),Mb=s(Ui," special method."),Ui.forEach(t),qb=h(eo),y(as.$$.fragment,eo),Eb=h(eo),y(is.$$.fragment,eo),zb=h(eo),y(ls.$$.fragment,eo),eo.forEach(t),Pt.forEach(t),Ph=h(o),Yo=a(o,"H2",{class:!0});var ep=i(Yo);ds=a(ep,"A",{id:!0,class:!0,href:!0});var v2=i(ds);Nd=a(v2,"SPAN",{});var y2=i(Nd);y(ka.$$.fragment,y2),y2.forEach(t),v2.forEach(t),Cb=h(ep),Id=a(ep,"SPAN",{});var T2=i(Id);jb=s(T2,"TFLongformerForTokenClassification"),T2.forEach(t),ep.forEach(t),Ah=h(o),lt=a(o,"DIV",{class:!0});var At=i(lt);y(ba.$$.fragment,At),Ob=h(At),Dd=a(At,"P",{});var $2=i(Dd);Pb=s($2,`Longformer Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g.
for Named-Entity-Recognition (NER) tasks.`),$2.forEach(t),Ab=h(At),va=a(At,"P",{});var tp=i(va);Nb=s(tp,"This model inherits from "),yi=a(tp,"A",{href:!0});var L2=i(yi);Ib=s(L2,"TFPreTrainedModel"),L2.forEach(t),Db=s(tp,`. 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.)`),tp.forEach(t),Sb=h(At),ya=a(At,"P",{});var op=i(ya);Wb=s(op,"This model is also a "),Ta=a(op,"A",{href:!0,rel:!0});var x2=i(Ta);Qb=s(x2,"tf.keras.Model"),x2.forEach(t),Bb=s(op,` 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.`),op.forEach(t),Ub=h(At),y(cs.$$.fragment,At),Hb=h(At),Lt=a(At,"DIV",{class:!0});var to=i(Lt);y($a.$$.fragment,to),Kb=h(to),Xo=a(to,"P",{});var Hi=i(Xo);Rb=s(Hi,"The "),Ti=a(Hi,"A",{href:!0});var F2=i(Ti);Vb=s(F2,"TFLongformerForTokenClassification"),F2.forEach(t),Gb=s(Hi," forward method, overrides the "),Sd=a(Hi,"CODE",{});var M2=i(Sd);Jb=s(M2,"__call__"),M2.forEach(t),Yb=s(Hi," special method."),Hi.forEach(t),Xb=h(to),y(hs.$$.fragment,to),Zb=h(to),y(ms.$$.fragment,to),ev=h(to),y(ps.$$.fragment,to),to.forEach(t),At.forEach(t),Nh=h(o),Zo=a(o,"H2",{class:!0});var np=i(Zo);fs=a(np,"A",{id:!0,class:!0,href:!0});var q2=i(fs);Wd=a(q2,"SPAN",{});var E2=i(Wd);y(La.$$.fragment,E2),E2.forEach(t),q2.forEach(t),tv=h(np),Qd=a(np,"SPAN",{});var z2=i(Qd);ov=s(z2,"TFLongformerForMultipleChoice"),z2.forEach(t),np.forEach(t),Ih=h(o),dt=a(o,"DIV",{class:!0});var Nt=i(dt);y(xa.$$.fragment,Nt),nv=h(Nt),Bd=a(Nt,"P",{});var C2=i(Bd);sv=s(C2,`Longformer Model with a multiple choice classification head on top (a linear layer on top of the pooled output and
a softmax) e.g. for RocStories/SWAG tasks.`),C2.forEach(t),rv=h(Nt),Fa=a(Nt,"P",{});var sp=i(Fa);av=s(sp,"This model inherits from "),$i=a(sp,"A",{href:!0});var j2=i($i);iv=s(j2,"TFPreTrainedModel"),j2.forEach(t),lv=s(sp,`. 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.)`),sp.forEach(t),dv=h(Nt),Ma=a(Nt,"P",{});var rp=i(Ma);cv=s(rp,"This model is also a "),qa=a(rp,"A",{href:!0,rel:!0});var O2=i(qa);hv=s(O2,"tf.keras.Model"),O2.forEach(t),mv=s(rp,` 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.`),rp.forEach(t),pv=h(Nt),y(gs.$$.fragment,Nt),fv=h(Nt),zt=a(Nt,"DIV",{class:!0});var ys=i(zt);y(Ea.$$.fragment,ys),gv=h(ys),en=a(ys,"P",{});var Ki=i(en);uv=s(Ki,"The "),Li=a(Ki,"A",{href:!0});var P2=i(Li);_v=s(P2,"TFLongformerForMultipleChoice"),P2.forEach(t),wv=s(Ki," forward method, overrides the "),Ud=a(Ki,"CODE",{});var A2=i(Ud);kv=s(A2,"__call__"),A2.forEach(t),bv=s(Ki," special method."),Ki.forEach(t),vv=h(ys),y(us.$$.fragment,ys),yv=h(ys),y(_s.$$.fragment,ys),ys.forEach(t),Nt.forEach(t),this.h()},h(){g(d,"name","hf:doc:metadata"),g(d,"content",JSON.stringify(I0)),g(u,"id","longformer"),g(u,"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"),g(u,"href","#longformer"),g(p,"class","relative group"),g(oe,"alt","Models"),N2(oe.src,F="https://img.shields.io/badge/All_model_pages-longformer-blueviolet")||g(oe,"src",F),g(ae,"href","https://huggingface.co/models?filter=longformer"),g(fe,"alt","Spaces"),N2(fe.src,Ae="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue")||g(fe,"src",Ae),g(B,"href","https://huggingface.co/spaces/docs-demos/longformer-base-4096-finetuned-squadv1"),g(N,"class","flex flex-wrap space-x-1"),g(de,"id","overview"),g(de,"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"),g(de,"href","#overview"),g(ie,"class","relative group"),g(me,"href","https://arxiv.org/pdf/2004.05150.pdf"),g(me,"rel","nofollow"),g(te,"href","https://huggingface.co/beltagy"),g(te,"rel","nofollow"),g(q,"href","https://github.com/allenai/longformer"),g(q,"rel","nofollow"),g(Ne,"id","longformer-self-attention"),g(Ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(Ne,"href","#longformer-self-attention"),g(je,"class","relative group"),We.a=Qe,vc.a=yc,Tc.a=$c,Lc.a=xc,Mc.a=qc,g(Na,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerModel.forward"),Oc.a=Pc,Ac.a=Nc,Ic.a=Dc,Sc.a=Wc,g(Ts,"href","https://arxiv.org/pdf/2004.05150.pdf"),g(Ts,"rel","nofollow"),g(cn,"id","training"),g(cn,"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"),g(cn,"href","#training"),g(oo,"class","relative group"),g(Ia,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerForMaskedLM"),g(Da,"href","/docs/transformers/v4.29.0/en/model_doc/roberta#transformers.RobertaForMaskedLM"),g(hn,"id","documentation-resources"),g(hn,"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"),g(hn,"href","#documentation-resources"),g(so,"class","relative group"),g(Sa,"href","../tasks/sequence_classification"),g(Wa,"href","../tasks/token_classification"),g(Qa,"href","../tasks/question_answering"),g(Ba,"href","../tasks/masked_language_modeling"),g(Ua,"href","../tasks/multiple_choice"),g(mn,"id","transformers.LongformerConfig"),g(mn,"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"),g(mn,"href","#transformers.LongformerConfig"),g(ro,"class","relative group"),g(Ha,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerModel"),g(Ka,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.TFLongformerModel"),g(Ra,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerModel"),g(qs,"href","https://huggingface.co/allenai/longformer-base-4096"),g(qs,"rel","nofollow"),g(Va,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),g(Ga,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),g(pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(fn,"id","transformers.LongformerTokenizer"),g(fn,"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"),g(fn,"href","#transformers.LongformerTokenizer"),g(co,"class","relative group"),g(Ja,"href","/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),g(Wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(_n,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(wn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(kn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(bn,"id","transformers.LongformerTokenizerFast"),g(bn,"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"),g(bn,"href","#transformers.LongformerTokenizerFast"),g(ho,"class","relative group"),g(Za,"href","/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),g(Tn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g($n,"id","transformers.models.longformer.modeling_longformer.LongformerBaseModelOutput"),g($n,"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"),g($n,"href","#transformers.models.longformer.modeling_longformer.LongformerBaseModelOutput"),g(mo,"class","relative group"),g(po,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(fo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(go,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(uo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(_o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(wo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(ko,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(bo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(vo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(yo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(To,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g($o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Lo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(xo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Ln,"id","transformers.LongformerModel"),g(Ln,"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"),g(Ln,"href","#transformers.LongformerModel"),g(Fo,"class","relative group"),g(ei,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),g(hr,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),g(hr,"rel","nofollow"),g(ti,"href","/docs/transformers/v4.29.0/en/model_doc/roberta#transformers.RobertaModel"),g(mr,"href","https://arxiv.org/abs/2004.05150"),g(mr,"rel","nofollow"),g(oi,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerModel"),g(Ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(st,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Mn,"id","transformers.LongformerForMaskedLM"),g(Mn,"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"),g(Mn,"href","#transformers.LongformerForMaskedLM"),g(Eo,"class","relative group"),g(ni,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),g(br,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),g(br,"rel","nofollow"),g(si,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerForMaskedLM"),g(ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Cn,"id","transformers.LongformerForSequenceClassification"),g(Cn,"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"),g(Cn,"href","#transformers.LongformerForSequenceClassification"),g(Co,"class","relative group"),g(ri,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),g(xr,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),g(xr,"rel","nofollow"),g(ai,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerForSequenceClassification"),g(vt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(gt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(An,"id","transformers.LongformerForMultipleChoice"),g(An,"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"),g(An,"href","#transformers.LongformerForMultipleChoice"),g(Oo,"class","relative group"),g(ii,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),g(Cr,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),g(Cr,"rel","nofollow"),g(li,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerForMultipleChoice"),g(Mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Dn,"id","transformers.LongformerForTokenClassification"),g(Dn,"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"),g(Dn,"href","#transformers.LongformerForTokenClassification"),g(Ao,"class","relative group"),g(di,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),g(Ir,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),g(Ir,"rel","nofollow"),g(ci,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerForTokenClassification"),g(qt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(_t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Qn,"id","transformers.LongformerForQuestionAnswering"),g(Qn,"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"),g(Qn,"href","#transformers.LongformerForQuestionAnswering"),g(Io,"class","relative group"),g(hi,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),g(Ur,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),g(Ur,"rel","nofollow"),g(mi,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.LongformerForQuestionAnswering"),g(Et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Hn,"id","transformers.TFLongformerModel"),g(Hn,"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"),g(Hn,"href","#transformers.TFLongformerModel"),g(Wo,"class","relative group"),g(pi,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),g(Jr,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),g(Jr,"rel","nofollow"),g(fi,"href","/docs/transformers/v4.29.0/en/model_doc/roberta#transformers.TFRobertaModel"),g(Yr,"href","https://arxiv.org/abs/2004.05150"),g(Yr,"rel","nofollow"),g(gi,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.TFLongformerModel"),g(Qt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Vn,"id","transformers.TFLongformerForMaskedLM"),g(Vn,"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"),g(Vn,"href","#transformers.TFLongformerForMaskedLM"),g(Uo,"class","relative group"),g(ui,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),g(ra,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),g(ra,"rel","nofollow"),g(_i,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.TFLongformerForMaskedLM"),g(yt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Zn,"id","transformers.TFLongformerForQuestionAnswering"),g(Zn,"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"),g(Zn,"href","#transformers.TFLongformerForQuestionAnswering"),g(Ko,"class","relative group"),g(wi,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),g(ha,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),g(ha,"rel","nofollow"),g(ki,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.TFLongformerForQuestionAnswering"),g(Tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(at,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(ss,"id","transformers.TFLongformerForSequenceClassification"),g(ss,"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"),g(ss,"href","#transformers.TFLongformerForSequenceClassification"),g(Go,"class","relative group"),g(bi,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),g(_a,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),g(_a,"rel","nofollow"),g(vi,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.TFLongformerForSequenceClassification"),g($t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(it,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(ds,"id","transformers.TFLongformerForTokenClassification"),g(ds,"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"),g(ds,"href","#transformers.TFLongformerForTokenClassification"),g(Yo,"class","relative group"),g(yi,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),g(Ta,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),g(Ta,"rel","nofollow"),g(Ti,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.TFLongformerForTokenClassification"),g(Lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(fs,"id","transformers.TFLongformerForMultipleChoice"),g(fs,"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"),g(fs,"href","#transformers.TFLongformerForMultipleChoice"),g(Zo,"class","relative group"),g($i,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),g(qa,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),g(qa,"rel","nofollow"),g(Li,"href","/docs/transformers/v4.29.0/en/model_doc/longformer#transformers.TFLongformerForMultipleChoice"),g(zt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,_){e(document.head,d),f(o,k,_),f(o,p,_),e(p,u),e(u,b),T(l,b,null),e(p,m),e(p,E),e(E,re),f(o,ee,_),f(o,N,_),e(N,ae),e(ae,oe),e(N,Te),e(N,B),e(B,fe),f(o,R,_),f(o,ie,_),e(ie,de),e(de,U),T(he,U,null),e(ie,$e),e(ie,H),e(H,Le),f(o,be,_),f(o,W,_),e(W,xe),e(W,me),e(me,le),e(W,C),f(o,O,_),f(o,ge,_),e(ge,J),f(o,ve,_),f(o,ue,_),e(ue,K),e(K,Fe),f(o,ye,_),f(o,j,_),e(j,Me),f(o,V,_),f(o,ce,_),e(ce,ne),e(ne,Y),e(ne,_e),e(_e,qe),e(ne,S),e(ne,we),e(we,X),e(ne,Ee),e(ne,se),e(se,P),e(ne,ze),e(ce,A),e(ce,ke),e(ke,Ce),f(o,w,_),f(o,M,_),e(M,Ue),e(M,te),e(te,He),e(M,Ke),e(M,q),e(q,Re),e(M,Ve),f(o,De,_),f(o,je,_),e(je,Ne),e(Ne,I),T(Q,I,null),e(je,Ge),e(je,Ie),e(Ie,Z),f(o,Se,_),f(o,G,_),e(G,Oe),We.m(pe,G),e(G,Qe),vc.m(I2,G),e(G,yc),Tc.m(D2,G),e(G,$c),e(G,Ri),e(Ri,ap),e(G,ip),e(G,Vi),e(Vi,lp),e(G,dp),e(G,Gi),e(Gi,cp),e(G,hp),Lc.m(S2,G),e(G,xc),e(G,Ji),e(Ji,mp),e(G,pp),f(o,Fc,_),f(o,Dt,_),e(Dt,fp),Mc.m(W2,Dt),e(Dt,qc),e(Dt,Yi),e(Yi,gp),e(Dt,up),f(o,Ec,_),f(o,St,_),e(St,_p),e(St,Xi),e(Xi,wp),e(St,kp),e(St,Zi),e(Zi,bp),e(St,vp),f(o,zc,_),f(o,an,_),e(an,el),e(el,yp),e(an,Tp),e(an,tl),e(tl,$p),f(o,Cc,_),f(o,ln,_),e(ln,Lp),e(ln,Na),e(Na,xp),e(ln,Fp),f(o,jc,_),f(o,kt,_),e(kt,Mp),Oc.m(Q2,kt),e(kt,Pc),Ac.m(B2,kt),e(kt,Nc),Ic.m(U2,kt),e(kt,Dc),Sc.m(H2,kt),e(kt,Wc),f(o,Qc,_),f(o,dn,_),e(dn,qp),e(dn,Ts),e(Ts,Ep),e(dn,zp),f(o,Bc,_),f(o,oo,_),e(oo,cn),e(cn,ol),T($s,ol,null),e(oo,Cp),e(oo,nl),e(nl,jp),f(o,Uc,_),f(o,no,_),e(no,Ia),e(Ia,Op),e(no,Pp),e(no,Da),e(Da,Ap),e(no,Np),f(o,Hc,_),T(Ls,o,_),f(o,Kc,_),f(o,so,_),e(so,hn),e(hn,sl),T(xs,sl,null),e(so,Ip),e(so,rl),e(rl,Dp),f(o,Rc,_),f(o,bt,_),e(bt,al),e(al,Sa),e(Sa,Sp),e(bt,Wp),e(bt,il),e(il,Wa),e(Wa,Qp),e(bt,Bp),e(bt,ll),e(ll,Qa),e(Qa,Up),e(bt,Hp),e(bt,dl),e(dl,Ba),e(Ba,Kp),e(bt,Rp),e(bt,cl),e(cl,Ua),e(Ua,Vp),f(o,Vc,_),f(o,ro,_),e(ro,mn),e(mn,hl),T(Fs,hl,null),e(ro,Gp),e(ro,ml),e(ml,Jp),f(o,Gc,_),f(o,pt,_),T(Ms,pt,null),e(pt,Yp),e(pt,ao),e(ao,Xp),e(ao,Ha),e(Ha,Zp),e(ao,ef),e(ao,Ka),e(Ka,tf),e(ao,of),e(pt,nf),e(pt,io),e(io,sf),e(io,Ra),e(Ra,rf),e(io,af),e(io,qs),e(qs,lf),e(io,df),e(pt,cf),e(pt,lo),e(lo,hf),e(lo,Va),e(Va,mf),e(lo,pf),e(lo,Ga),e(Ga,ff),e(lo,gf),e(pt,uf),T(pn,pt,null),f(o,Jc,_),f(o,co,_),e(co,fn),e(fn,pl),T(Es,pl,null),e(co,_f),e(co,fl),e(fl,wf),f(o,Yc,_),f(o,Pe,_),T(zs,Pe,null),e(Pe,kf),e(Pe,gl),e(gl,bf),e(Pe,vf),e(Pe,ul),e(ul,yf),e(Pe,Tf),T(gn,Pe,null),e(Pe,$f),e(Pe,Cs),e(Cs,Lf),e(Cs,_l),e(_l,xf),e(Cs,Ff),e(Pe,Mf),T(un,Pe,null),e(Pe,qf),e(Pe,js),e(js,Ef),e(js,Ja),e(Ja,zf),e(js,Cf),e(Pe,jf),e(Pe,Wt),T(Os,Wt,null),e(Wt,Of),e(Wt,wl),e(wl,Pf),e(Wt,Af),e(Wt,Ps),e(Ps,Ya),e(Ya,Nf),e(Ya,kl),e(kl,If),e(Ps,Df),e(Ps,Xa),e(Xa,Sf),e(Xa,bl),e(bl,Wf),e(Pe,Qf),e(Pe,_n),T(As,_n,null),e(_n,Bf),e(_n,vl),e(vl,Uf),e(Pe,Hf),e(Pe,wn),T(Ns,wn,null),e(wn,Kf),e(wn,yl),e(yl,Rf),e(Pe,Vf),e(Pe,kn),T(Is,kn,null),e(kn,Gf),e(kn,Ds),e(Ds,Jf),e(Ds,Tl),e(Tl,Yf),e(Ds,Xf),f(o,Xc,_),f(o,ho,_),e(ho,bn),e(bn,$l),T(Ss,$l,null),e(ho,Zf),e(ho,Ll),e(Ll,eg),f(o,Zc,_),f(o,Je,_),T(Ws,Je,null),e(Je,tg),e(Je,Qs),e(Qs,og),e(Qs,xl),e(xl,ng),e(Qs,sg),e(Je,rg),e(Je,Fl),e(Fl,ag),e(Je,ig),T(vn,Je,null),e(Je,lg),e(Je,Bs),e(Bs,dg),e(Bs,Ml),e(Ml,cg),e(Bs,hg),e(Je,mg),T(yn,Je,null),e(Je,pg),e(Je,Us),e(Us,fg),e(Us,Za),e(Za,gg),e(Us,ug),e(Je,_g),e(Je,Tn),T(Hs,Tn,null),e(Tn,wg),e(Tn,ql),e(ql,kg),f(o,eh,_),f(o,mo,_),e(mo,$n),e($n,El),T(Ks,El,null),e(mo,bg),e(mo,zl),e(zl,vg),f(o,th,_),f(o,po,_),T(Rs,po,null),e(po,yg),e(po,Cl),e(Cl,Tg),f(o,oh,_),f(o,fo,_),T(Vs,fo,null),e(fo,$g),e(fo,jl),e(jl,Lg),f(o,nh,_),f(o,go,_),T(Gs,go,null),e(go,xg),e(go,Ol),e(Ol,Fg),f(o,sh,_),f(o,uo,_),T(Js,uo,null),e(uo,Mg),e(uo,Pl),e(Pl,qg),f(o,rh,_),f(o,_o,_),T(Ys,_o,null),e(_o,Eg),e(_o,Al),e(Al,zg),f(o,ah,_),f(o,wo,_),T(Xs,wo,null),e(wo,Cg),e(wo,Nl),e(Nl,jg),f(o,ih,_),f(o,ko,_),T(Zs,ko,null),e(ko,Og),e(ko,Il),e(Il,Pg),f(o,lh,_),f(o,bo,_),T(er,bo,null),e(bo,Ag),e(bo,Dl),e(Dl,Ng),f(o,dh,_),f(o,vo,_),T(tr,vo,null),e(vo,Ig),e(vo,Sl),e(Sl,Dg),f(o,ch,_),f(o,yo,_),T(or,yo,null),e(yo,Sg),e(yo,Wl),e(Wl,Wg),f(o,hh,_),f(o,To,_),T(nr,To,null),e(To,Qg),e(To,Ql),e(Ql,Bg),f(o,mh,_),f(o,$o,_),T(sr,$o,null),e($o,Ug),e($o,Bl),e(Bl,Hg),f(o,ph,_),f(o,Lo,_),T(rr,Lo,null),e(Lo,Kg),e(Lo,Ul),e(Ul,Rg),f(o,fh,_),f(o,xo,_),T(ar,xo,null),e(xo,Vg),e(xo,Hl),e(Hl,Gg),f(o,gh,_),f(o,Fo,_),e(Fo,Ln),e(Ln,Kl),T(ir,Kl,null),e(Fo,Jg),e(Fo,Rl),e(Rl,Yg),f(o,uh,_),f(o,st,_),T(lr,st,null),e(st,Xg),e(st,Vl),e(Vl,Zg),e(st,eu),e(st,dr),e(dr,tu),e(dr,ei),e(ei,ou),e(dr,nu),e(st,su),e(st,cr),e(cr,ru),e(cr,hr),e(hr,au),e(cr,iu),e(st,lu),e(st,Mo),e(Mo,du),e(Mo,ti),e(ti,cu),e(Mo,hu),e(Mo,mr),e(mr,mu),e(Mo,pu),e(st,fu),e(st,pr),e(pr,gu),e(pr,Gl),e(Gl,uu),e(pr,_u),e(st,wu),e(st,Ft),T(fr,Ft,null),e(Ft,ku),e(Ft,qo),e(qo,bu),e(qo,oi),e(oi,vu),e(qo,yu),e(qo,Jl),e(Jl,Tu),e(qo,$u),e(Ft,Lu),T(xn,Ft,null),e(Ft,xu),T(Fn,Ft,null),f(o,_h,_),f(o,Eo,_),e(Eo,Mn),e(Mn,Yl),T(gr,Yl,null),e(Eo,Fu),e(Eo,Xl),e(Xl,Mu),f(o,wh,_),f(o,ft,_),T(ur,ft,null),e(ft,qu),e(ft,_r),e(_r,Eu),e(_r,Zl),e(Zl,zu),e(_r,Cu),e(ft,ju),e(ft,wr),e(wr,Ou),e(wr,ni),e(ni,Pu),e(wr,Au),e(ft,Nu),e(ft,kr),e(kr,Iu),e(kr,br),e(br,Du),e(kr,Su),e(ft,Wu),e(ft,ct),T(vr,ct,null),e(ct,Qu),e(ct,zo),e(zo,Bu),e(zo,si),e(si,Uu),e(zo,Hu),e(zo,ed),e(ed,Ku),e(zo,Ru),e(ct,Vu),T(qn,ct,null),e(ct,Gu),T(En,ct,null),e(ct,Ju),e(ct,td),e(td,Yu),e(ct,Xu),T(zn,ct,null),f(o,kh,_),f(o,Co,_),e(Co,Cn),e(Cn,od),T(yr,od,null),e(Co,Zu),e(Co,nd),e(nd,e_),f(o,bh,_),f(o,gt,_),T(Tr,gt,null),e(gt,t_),e(gt,sd),e(sd,o_),e(gt,n_),e(gt,$r),e($r,s_),e($r,ri),e(ri,r_),e($r,a_),e(gt,i_),e(gt,Lr),e(Lr,l_),e(Lr,xr),e(xr,d_),e(Lr,c_),e(gt,h_),e(gt,vt),T(Fr,vt,null),e(vt,m_),e(vt,jo),e(jo,p_),e(jo,ai),e(ai,f_),e(jo,g_),e(jo,rd),e(rd,u_),e(jo,__),e(vt,w_),T(jn,vt,null),e(vt,k_),T(On,vt,null),e(vt,b_),T(Pn,vt,null),f(o,vh,_),f(o,Oo,_),e(Oo,An),e(An,ad),T(Mr,ad,null),e(Oo,v_),e(Oo,id),e(id,y_),f(o,yh,_),f(o,ut,_),T(qr,ut,null),e(ut,T_),e(ut,ld),e(ld,$_),e(ut,L_),e(ut,Er),e(Er,x_),e(Er,ii),e(ii,F_),e(Er,M_),e(ut,q_),e(ut,zr),e(zr,E_),e(zr,Cr),e(Cr,z_),e(zr,C_),e(ut,j_),e(ut,Mt),T(jr,Mt,null),e(Mt,O_),e(Mt,Po),e(Po,P_),e(Po,li),e(li,A_),e(Po,N_),e(Po,dd),e(dd,I_),e(Po,D_),e(Mt,S_),T(Nn,Mt,null),e(Mt,W_),T(In,Mt,null),f(o,Th,_),f(o,Ao,_),e(Ao,Dn),e(Dn,cd),T(Or,cd,null),e(Ao,Q_),e(Ao,hd),e(hd,B_),f(o,$h,_),f(o,_t,_),T(Pr,_t,null),e(_t,U_),e(_t,md),e(md,H_),e(_t,K_),e(_t,Ar),e(Ar,R_),e(Ar,di),e(di,V_),e(Ar,G_),e(_t,J_),e(_t,Nr),e(Nr,Y_),e(Nr,Ir),e(Ir,X_),e(Nr,Z_),e(_t,ew),e(_t,qt),T(Dr,qt,null),e(qt,tw),e(qt,No),e(No,ow),e(No,ci),e(ci,nw),e(No,sw),e(No,pd),e(pd,rw),e(No,aw),e(qt,iw),T(Sn,qt,null),e(qt,lw),T(Wn,qt,null),f(o,Lh,_),f(o,Io,_),e(Io,Qn),e(Qn,fd),T(Sr,fd,null),e(Io,dw),e(Io,gd),e(gd,cw),f(o,xh,_),f(o,wt,_),T(Wr,wt,null),e(wt,hw),e(wt,Do),e(Do,mw),e(Do,ud),e(ud,pw),e(Do,fw),e(Do,_d),e(_d,gw),e(Do,uw),e(wt,_w),e(wt,Qr),e(Qr,ww),e(Qr,hi),e(hi,kw),e(Qr,bw),e(wt,vw),e(wt,Br),e(Br,yw),e(Br,Ur),e(Ur,Tw),e(Br,$w),e(wt,Lw),e(wt,Et),T(Hr,Et,null),e(Et,xw),e(Et,So),e(So,Fw),e(So,mi),e(mi,Mw),e(So,qw),e(So,wd),e(wd,Ew),e(So,zw),e(Et,Cw),T(Bn,Et,null),e(Et,jw),T(Un,Et,null),f(o,Fh,_),f(o,Wo,_),e(Wo,Hn),e(Hn,kd),T(Kr,kd,null),e(Wo,Ow),e(Wo,bd),e(bd,Pw),f(o,Mh,_),f(o,Ye,_),T(Rr,Ye,null),e(Ye,Aw),e(Ye,vd),e(vd,Nw),e(Ye,Iw),e(Ye,Vr),e(Vr,Dw),e(Vr,pi),e(pi,Sw),e(Vr,Ww),e(Ye,Qw),e(Ye,Gr),e(Gr,Bw),e(Gr,Jr),e(Jr,Uw),e(Gr,Hw),e(Ye,Kw),T(Kn,Ye,null),e(Ye,Rw),e(Ye,Qo),e(Qo,Vw),e(Qo,fi),e(fi,Gw),e(Qo,Jw),e(Qo,Yr),e(Yr,Yw),e(Qo,Xw),e(Ye,Zw),e(Ye,Xr),e(Xr,ek),e(Xr,yd),e(yd,tk),e(Xr,ok),e(Ye,nk),e(Ye,Qt),T(Zr,Qt,null),e(Qt,sk),e(Qt,Bo),e(Bo,rk),e(Bo,gi),e(gi,ak),e(Bo,ik),e(Bo,Td),e(Td,lk),e(Bo,dk),e(Qt,ck),T(Rn,Qt,null),f(o,qh,_),f(o,Uo,_),e(Uo,Vn),e(Vn,$d),T(ea,$d,null),e(Uo,hk),e(Uo,Ld),e(Ld,mk),f(o,Eh,_),f(o,rt,_),T(ta,rt,null),e(rt,pk),e(rt,oa),e(oa,fk),e(oa,xd),e(xd,gk),e(oa,uk),e(rt,_k),e(rt,na),e(na,wk),e(na,ui),e(ui,kk),e(na,bk),e(rt,vk),e(rt,sa),e(sa,yk),e(sa,ra),e(ra,Tk),e(sa,$k),e(rt,Lk),T(Gn,rt,null),e(rt,xk),e(rt,yt),T(aa,yt,null),e(yt,Fk),e(yt,Ho),e(Ho,Mk),e(Ho,_i),e(_i,qk),e(Ho,Ek),e(Ho,Fd),e(Fd,zk),e(Ho,Ck),e(yt,jk),T(Jn,yt,null),e(yt,Ok),T(Yn,yt,null),e(yt,Pk),T(Xn,yt,null),f(o,zh,_),f(o,Ko,_),e(Ko,Zn),e(Zn,Md),T(ia,Md,null),e(Ko,Ak),e(Ko,qd),e(qd,Nk),f(o,Ch,_),f(o,at,_),T(la,at,null),e(at,Ik),e(at,Ro),e(Ro,Dk),e(Ro,Ed),e(Ed,Sk),e(Ro,Wk),e(Ro,zd),e(zd,Qk),e(Ro,Bk),e(at,Uk),e(at,da),e(da,Hk),e(da,wi),e(wi,Kk),e(da,Rk),e(at,Vk),e(at,ca),e(ca,Gk),e(ca,ha),e(ha,Jk),e(ca,Yk),e(at,Xk),T(es,at,null),e(at,Zk),e(at,Tt),T(ma,Tt,null),e(Tt,eb),e(Tt,Vo),e(Vo,tb),e(Vo,ki),e(ki,ob),e(Vo,nb),e(Vo,Cd),e(Cd,sb),e(Vo,rb),e(Tt,ab),T(ts,Tt,null),e(Tt,ib),T(os,Tt,null),e(Tt,lb),T(ns,Tt,null),f(o,jh,_),f(o,Go,_),e(Go,ss),e(ss,jd),T(pa,jd,null),e(Go,db),e(Go,Od),e(Od,cb),f(o,Oh,_),f(o,it,_),T(fa,it,null),e(it,hb),e(it,Pd),e(Pd,mb),e(it,pb),e(it,ga),e(ga,fb),e(ga,bi),e(bi,gb),e(ga,ub),e(it,_b),e(it,ua),e(ua,wb),e(ua,_a),e(_a,kb),e(ua,bb),e(it,vb),T(rs,it,null),e(it,yb),e(it,$t),T(wa,$t,null),e($t,Tb),e($t,Jo),e(Jo,$b),e(Jo,vi),e(vi,Lb),e(Jo,xb),e(Jo,Ad),e(Ad,Fb),e(Jo,Mb),e($t,qb),T(as,$t,null),e($t,Eb),T(is,$t,null),e($t,zb),T(ls,$t,null),f(o,Ph,_),f(o,Yo,_),e(Yo,ds),e(ds,Nd),T(ka,Nd,null),e(Yo,Cb),e(Yo,Id),e(Id,jb),f(o,Ah,_),f(o,lt,_),T(ba,lt,null),e(lt,Ob),e(lt,Dd),e(Dd,Pb),e(lt,Ab),e(lt,va),e(va,Nb),e(va,yi),e(yi,Ib),e(va,Db),e(lt,Sb),e(lt,ya),e(ya,Wb),e(ya,Ta),e(Ta,Qb),e(ya,Bb),e(lt,Ub),T(cs,lt,null),e(lt,Hb),e(lt,Lt),T($a,Lt,null),e(Lt,Kb),e(Lt,Xo),e(Xo,Rb),e(Xo,Ti),e(Ti,Vb),e(Xo,Gb),e(Xo,Sd),e(Sd,Jb),e(Xo,Yb),e(Lt,Xb),T(hs,Lt,null),e(Lt,Zb),T(ms,Lt,null),e(Lt,ev),T(ps,Lt,null),f(o,Nh,_),f(o,Zo,_),e(Zo,fs),e(fs,Wd),T(La,Wd,null),e(Zo,tv),e(Zo,Qd),e(Qd,ov),f(o,Ih,_),f(o,dt,_),T(xa,dt,null),e(dt,nv),e(dt,Bd),e(Bd,sv),e(dt,rv),e(dt,Fa),e(Fa,av),e(Fa,$i),e($i,iv),e(Fa,lv),e(dt,dv),e(dt,Ma),e(Ma,cv),e(Ma,qa),e(qa,hv),e(Ma,mv),e(dt,pv),T(gs,dt,null),e(dt,fv),e(dt,zt),T(Ea,zt,null),e(zt,gv),e(zt,en),e(en,uv),e(en,Li),e(Li,_v),e(en,wv),e(en,Ud),e(Ud,kv),e(en,bv),e(zt,vv),T(us,zt,null),e(zt,yv),T(_s,zt,null),Dh=!0},p(o,[_]){const za={};_&2&&(za.$$scope={dirty:_,ctx:o}),pn.$set(za);const Hd={};_&2&&(Hd.$$scope={dirty:_,ctx:o}),gn.$set(Hd);const Kd={};_&2&&(Kd.$$scope={dirty:_,ctx:o}),un.$set(Kd);const Rd={};_&2&&(Rd.$$scope={dirty:_,ctx:o}),vn.$set(Rd);const Ca={};_&2&&(Ca.$$scope={dirty:_,ctx:o}),yn.$set(Ca);const Vd={};_&2&&(Vd.$$scope={dirty:_,ctx:o}),xn.$set(Vd);const Gd={};_&2&&(Gd.$$scope={dirty:_,ctx:o}),Fn.$set(Gd);const ja={};_&2&&(ja.$$scope={dirty:_,ctx:o}),qn.$set(ja);const Jd={};_&2&&(Jd.$$scope={dirty:_,ctx:o}),En.$set(Jd);const Yd={};_&2&&(Yd.$$scope={dirty:_,ctx:o}),zn.$set(Yd);const Xd={};_&2&&(Xd.$$scope={dirty:_,ctx:o}),jn.$set(Xd);const Oa={};_&2&&(Oa.$$scope={dirty:_,ctx:o}),On.$set(Oa);const Zd={};_&2&&(Zd.$$scope={dirty:_,ctx:o}),Pn.$set(Zd);const ec={};_&2&&(ec.$$scope={dirty:_,ctx:o}),Nn.$set(ec);const tc={};_&2&&(tc.$$scope={dirty:_,ctx:o}),In.$set(tc);const oc={};_&2&&(oc.$$scope={dirty:_,ctx:o}),Sn.$set(oc);const nc={};_&2&&(nc.$$scope={dirty:_,ctx:o}),Wn.$set(nc);const Pa={};_&2&&(Pa.$$scope={dirty:_,ctx:o}),Bn.$set(Pa);const It={};_&2&&(It.$$scope={dirty:_,ctx:o}),Un.$set(It);const sc={};_&2&&(sc.$$scope={dirty:_,ctx:o}),Kn.$set(sc);const rc={};_&2&&(rc.$$scope={dirty:_,ctx:o}),Rn.$set(rc);const ac={};_&2&&(ac.$$scope={dirty:_,ctx:o}),Gn.$set(ac);const ic={};_&2&&(ic.$$scope={dirty:_,ctx:o}),Jn.$set(ic);const tn={};_&2&&(tn.$$scope={dirty:_,ctx:o}),Yn.$set(tn);const lc={};_&2&&(lc.$$scope={dirty:_,ctx:o}),Xn.$set(lc);const dc={};_&2&&(dc.$$scope={dirty:_,ctx:o}),es.$set(dc);const Aa={};_&2&&(Aa.$$scope={dirty:_,ctx:o}),ts.$set(Aa);const cc={};_&2&&(cc.$$scope={dirty:_,ctx:o}),os.$set(cc);const hc={};_&2&&(hc.$$scope={dirty:_,ctx:o}),ns.$set(hc);const mc={};_&2&&(mc.$$scope={dirty:_,ctx:o}),rs.$set(mc);const Xe={};_&2&&(Xe.$$scope={dirty:_,ctx:o}),as.$set(Xe);const pc={};_&2&&(pc.$$scope={dirty:_,ctx:o}),is.$set(pc);const fc={};_&2&&(fc.$$scope={dirty:_,ctx:o}),ls.$set(fc);const gc={};_&2&&(gc.$$scope={dirty:_,ctx:o}),cs.$set(gc);const uc={};_&2&&(uc.$$scope={dirty:_,ctx:o}),hs.$set(uc);const on={};_&2&&(on.$$scope={dirty:_,ctx:o}),ms.$set(on);const _c={};_&2&&(_c.$$scope={dirty:_,ctx:o}),ps.$set(_c);const nn={};_&2&&(nn.$$scope={dirty:_,ctx:o}),gs.$set(nn);const wc={};_&2&&(wc.$$scope={dirty:_,ctx:o}),us.$set(wc);const kc={};_&2&&(kc.$$scope={dirty:_,ctx:o}),_s.$set(kc)},i(o){Dh||($(l.$$.fragment,o),$(he.$$.fragment,o),$(Q.$$.fragment,o),$($s.$$.fragment,o),$(Ls.$$.fragment,o),$(xs.$$.fragment,o),$(Fs.$$.fragment,o),$(Ms.$$.fragment,o),$(pn.$$.fragment,o),$(Es.$$.fragment,o),$(zs.$$.fragment,o),$(gn.$$.fragment,o),$(un.$$.fragment,o),$(Os.$$.fragment,o),$(As.$$.fragment,o),$(Ns.$$.fragment,o),$(Is.$$.fragment,o),$(Ss.$$.fragment,o),$(Ws.$$.fragment,o),$(vn.$$.fragment,o),$(yn.$$.fragment,o),$(Hs.$$.fragment,o),$(Ks.$$.fragment,o),$(Rs.$$.fragment,o),$(Vs.$$.fragment,o),$(Gs.$$.fragment,o),$(Js.$$.fragment,o),$(Ys.$$.fragment,o),$(Xs.$$.fragment,o),$(Zs.$$.fragment,o),$(er.$$.fragment,o),$(tr.$$.fragment,o),$(or.$$.fragment,o),$(nr.$$.fragment,o),$(sr.$$.fragment,o),$(rr.$$.fragment,o),$(ar.$$.fragment,o),$(ir.$$.fragment,o),$(lr.$$.fragment,o),$(fr.$$.fragment,o),$(xn.$$.fragment,o),$(Fn.$$.fragment,o),$(gr.$$.fragment,o),$(ur.$$.fragment,o),$(vr.$$.fragment,o),$(qn.$$.fragment,o),$(En.$$.fragment,o),$(zn.$$.fragment,o),$(yr.$$.fragment,o),$(Tr.$$.fragment,o),$(Fr.$$.fragment,o),$(jn.$$.fragment,o),$(On.$$.fragment,o),$(Pn.$$.fragment,o),$(Mr.$$.fragment,o),$(qr.$$.fragment,o),$(jr.$$.fragment,o),$(Nn.$$.fragment,o),$(In.$$.fragment,o),$(Or.$$.fragment,o),$(Pr.$$.fragment,o),$(Dr.$$.fragment,o),$(Sn.$$.fragment,o),$(Wn.$$.fragment,o),$(Sr.$$.fragment,o),$(Wr.$$.fragment,o),$(Hr.$$.fragment,o),$(Bn.$$.fragment,o),$(Un.$$.fragment,o),$(Kr.$$.fragment,o),$(Rr.$$.fragment,o),$(Kn.$$.fragment,o),$(Zr.$$.fragment,o),$(Rn.$$.fragment,o),$(ea.$$.fragment,o),$(ta.$$.fragment,o),$(Gn.$$.fragment,o),$(aa.$$.fragment,o),$(Jn.$$.fragment,o),$(Yn.$$.fragment,o),$(Xn.$$.fragment,o),$(ia.$$.fragment,o),$(la.$$.fragment,o),$(es.$$.fragment,o),$(ma.$$.fragment,o),$(ts.$$.fragment,o),$(os.$$.fragment,o),$(ns.$$.fragment,o),$(pa.$$.fragment,o),$(fa.$$.fragment,o),$(rs.$$.fragment,o),$(wa.$$.fragment,o),$(as.$$.fragment,o),$(is.$$.fragment,o),$(ls.$$.fragment,o),$(ka.$$.fragment,o),$(ba.$$.fragment,o),$(cs.$$.fragment,o),$($a.$$.fragment,o),$(hs.$$.fragment,o),$(ms.$$.fragment,o),$(ps.$$.fragment,o),$(La.$$.fragment,o),$(xa.$$.fragment,o),$(gs.$$.fragment,o),$(Ea.$$.fragment,o),$(us.$$.fragment,o),$(_s.$$.fragment,o),Dh=!0)},o(o){L(l.$$.fragment,o),L(he.$$.fragment,o),L(Q.$$.fragment,o),L($s.$$.fragment,o),L(Ls.$$.fragment,o),L(xs.$$.fragment,o),L(Fs.$$.fragment,o),L(Ms.$$.fragment,o),L(pn.$$.fragment,o),L(Es.$$.fragment,o),L(zs.$$.fragment,o),L(gn.$$.fragment,o),L(un.$$.fragment,o),L(Os.$$.fragment,o),L(As.$$.fragment,o),L(Ns.$$.fragment,o),L(Is.$$.fragment,o),L(Ss.$$.fragment,o),L(Ws.$$.fragment,o),L(vn.$$.fragment,o),L(yn.$$.fragment,o),L(Hs.$$.fragment,o),L(Ks.$$.fragment,o),L(Rs.$$.fragment,o),L(Vs.$$.fragment,o),L(Gs.$$.fragment,o),L(Js.$$.fragment,o),L(Ys.$$.fragment,o),L(Xs.$$.fragment,o),L(Zs.$$.fragment,o),L(er.$$.fragment,o),L(tr.$$.fragment,o),L(or.$$.fragment,o),L(nr.$$.fragment,o),L(sr.$$.fragment,o),L(rr.$$.fragment,o),L(ar.$$.fragment,o),L(ir.$$.fragment,o),L(lr.$$.fragment,o),L(fr.$$.fragment,o),L(xn.$$.fragment,o),L(Fn.$$.fragment,o),L(gr.$$.fragment,o),L(ur.$$.fragment,o),L(vr.$$.fragment,o),L(qn.$$.fragment,o),L(En.$$.fragment,o),L(zn.$$.fragment,o),L(yr.$$.fragment,o),L(Tr.$$.fragment,o),L(Fr.$$.fragment,o),L(jn.$$.fragment,o),L(On.$$.fragment,o),L(Pn.$$.fragment,o),L(Mr.$$.fragment,o),L(qr.$$.fragment,o),L(jr.$$.fragment,o),L(Nn.$$.fragment,o),L(In.$$.fragment,o),L(Or.$$.fragment,o),L(Pr.$$.fragment,o),L(Dr.$$.fragment,o),L(Sn.$$.fragment,o),L(Wn.$$.fragment,o),L(Sr.$$.fragment,o),L(Wr.$$.fragment,o),L(Hr.$$.fragment,o),L(Bn.$$.fragment,o),L(Un.$$.fragment,o),L(Kr.$$.fragment,o),L(Rr.$$.fragment,o),L(Kn.$$.fragment,o),L(Zr.$$.fragment,o),L(Rn.$$.fragment,o),L(ea.$$.fragment,o),L(ta.$$.fragment,o),L(Gn.$$.fragment,o),L(aa.$$.fragment,o),L(Jn.$$.fragment,o),L(Yn.$$.fragment,o),L(Xn.$$.fragment,o),L(ia.$$.fragment,o),L(la.$$.fragment,o),L(es.$$.fragment,o),L(ma.$$.fragment,o),L(ts.$$.fragment,o),L(os.$$.fragment,o),L(ns.$$.fragment,o),L(pa.$$.fragment,o),L(fa.$$.fragment,o),L(rs.$$.fragment,o),L(wa.$$.fragment,o),L(as.$$.fragment,o),L(is.$$.fragment,o),L(ls.$$.fragment,o),L(ka.$$.fragment,o),L(ba.$$.fragment,o),L(cs.$$.fragment,o),L($a.$$.fragment,o),L(hs.$$.fragment,o),L(ms.$$.fragment,o),L(ps.$$.fragment,o),L(La.$$.fragment,o),L(xa.$$.fragment,o),L(gs.$$.fragment,o),L(Ea.$$.fragment,o),L(us.$$.fragment,o),L(_s.$$.fragment,o),Dh=!1},d(o){t(d),o&&t(k),o&&t(p),x(l),o&&t(ee),o&&t(N),o&&t(R),o&&t(ie),x(he),o&&t(be),o&&t(W),o&&t(O),o&&t(ge),o&&t(ve),o&&t(ue),o&&t(ye),o&&t(j),o&&t(V),o&&t(ce),o&&t(w),o&&t(M),o&&t(De),o&&t(je),x(Q),o&&t(Se),o&&t(G),o&&t(Fc),o&&t(Dt),o&&t(Ec),o&&t(St),o&&t(zc),o&&t(an),o&&t(Cc),o&&t(ln),o&&t(jc),o&&t(kt),o&&t(Qc),o&&t(dn),o&&t(Bc),o&&t(oo),x($s),o&&t(Uc),o&&t(no),o&&t(Hc),x(Ls,o),o&&t(Kc),o&&t(so),x(xs),o&&t(Rc),o&&t(bt),o&&t(Vc),o&&t(ro),x(Fs),o&&t(Gc),o&&t(pt),x(Ms),x(pn),o&&t(Jc),o&&t(co),x(Es),o&&t(Yc),o&&t(Pe),x(zs),x(gn),x(un),x(Os),x(As),x(Ns),x(Is),o&&t(Xc),o&&t(ho),x(Ss),o&&t(Zc),o&&t(Je),x(Ws),x(vn),x(yn),x(Hs),o&&t(eh),o&&t(mo),x(Ks),o&&t(th),o&&t(po),x(Rs),o&&t(oh),o&&t(fo),x(Vs),o&&t(nh),o&&t(go),x(Gs),o&&t(sh),o&&t(uo),x(Js),o&&t(rh),o&&t(_o),x(Ys),o&&t(ah),o&&t(wo),x(Xs),o&&t(ih),o&&t(ko),x(Zs),o&&t(lh),o&&t(bo),x(er),o&&t(dh),o&&t(vo),x(tr),o&&t(ch),o&&t(yo),x(or),o&&t(hh),o&&t(To),x(nr),o&&t(mh),o&&t($o),x(sr),o&&t(ph),o&&t(Lo),x(rr),o&&t(fh),o&&t(xo),x(ar),o&&t(gh),o&&t(Fo),x(ir),o&&t(uh),o&&t(st),x(lr),x(fr),x(xn),x(Fn),o&&t(_h),o&&t(Eo),x(gr),o&&t(wh),o&&t(ft),x(ur),x(vr),x(qn),x(En),x(zn),o&&t(kh),o&&t(Co),x(yr),o&&t(bh),o&&t(gt),x(Tr),x(Fr),x(jn),x(On),x(Pn),o&&t(vh),o&&t(Oo),x(Mr),o&&t(yh),o&&t(ut),x(qr),x(jr),x(Nn),x(In),o&&t(Th),o&&t(Ao),x(Or),o&&t($h),o&&t(_t),x(Pr),x(Dr),x(Sn),x(Wn),o&&t(Lh),o&&t(Io),x(Sr),o&&t(xh),o&&t(wt),x(Wr),x(Hr),x(Bn),x(Un),o&&t(Fh),o&&t(Wo),x(Kr),o&&t(Mh),o&&t(Ye),x(Rr),x(Kn),x(Zr),x(Rn),o&&t(qh),o&&t(Uo),x(ea),o&&t(Eh),o&&t(rt),x(ta),x(Gn),x(aa),x(Jn),x(Yn),x(Xn),o&&t(zh),o&&t(Ko),x(ia),o&&t(Ch),o&&t(at),x(la),x(es),x(ma),x(ts),x(os),x(ns),o&&t(jh),o&&t(Go),x(pa),o&&t(Oh),o&&t(it),x(fa),x(rs),x(wa),x(as),x(is),x(ls),o&&t(Ph),o&&t(Yo),x(ka),o&&t(Ah),o&&t(lt),x(ba),x(cs),x($a),x(hs),x(ms),x(ps),o&&t(Nh),o&&t(Zo),x(La),o&&t(Ih),o&&t(dt),x(xa),x(gs),x(Ea),x(us),x(_s)}}}const I0={local:"longformer",sections:[{local:"overview",title:"Overview"},{local:"longformer-self-attention",title:"Longformer Self Attention"},{local:"training",title:"Training"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.LongformerConfig",title:"LongformerConfig"},{local:"transformers.LongformerTokenizer",title:"LongformerTokenizer"},{local:"transformers.LongformerTokenizerFast",title:"LongformerTokenizerFast"},{local:"transformers.models.longformer.modeling_longformer.LongformerBaseModelOutput",title:"Longformer specific outputs"},{local:"transformers.LongformerModel",title:"LongformerModel"},{local:"transformers.LongformerForMaskedLM",title:"LongformerForMaskedLM"},{local:"transformers.LongformerForSequenceClassification",title:"LongformerForSequenceClassification"},{local:"transformers.LongformerForMultipleChoice",title:"LongformerForMultipleChoice"},{local:"transformers.LongformerForTokenClassification",title:"LongformerForTokenClassification"},{local:"transformers.LongformerForQuestionAnswering",title:"LongformerForQuestionAnswering"},{local:"transformers.TFLongformerModel",title:"TFLongformerModel"},{local:"transformers.TFLongformerForMaskedLM",title:"TFLongformerForMaskedLM"},{local:"transformers.TFLongformerForQuestionAnswering",title:"TFLongformerForQuestionAnswering"},{local:"transformers.TFLongformerForSequenceClassification",title:"TFLongformerForSequenceClassification"},{local:"transformers.TFLongformerForTokenClassification",title:"TFLongformerForTokenClassification"},{local:"transformers.TFLongformerForMultipleChoice",title:"TFLongformerForMultipleChoice"}],title:"Longformer"};function D0(z){return J2(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class K0 extends K2{constructor(d){super();R2(this,d,D0,N0,V2,{})}}export{K0 as default,I0 as metadata};
