import{S as DT,i as ST,s as BT,e as r,k as c,w as v,t as n,Y as tn,M as WT,c as a,d as t,m,a as i,x as y,h as s,Z as on,b as u,G as e,g as f,y as T,q as $,o as L,B as x,v as QT,L as tt}from"../../chunks/vendor-hf-doc-builder.js";import{T as Xe}from"../../chunks/Tip-hf-doc-builder.js";import{D as I}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ye}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ze}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as et}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function UT(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function HT(E){let d,k,p,g,b;return g=new Ye({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="language-python"><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LongformerTokenizer</span>
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">tokenizer = LongformerTokenizer.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-base-4096&quot;</span>)</span>
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>)[<span class="hljs-string">&#x27;input_ids&#x27;</span>]</span>
[0, 31414, 232, 328, 2]
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">tokenizer(<span class="hljs-string">&quot; Hello world&quot;</span>)[<span class="hljs-string">&#x27;input_ids&#x27;</span>]</span>
[0, 20920, 232, 2]`}}),{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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"be encoded differently whether it is at the beginning of the sentence (without space) or not:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function KT(E){let d,k,p,g,b;return{c(){d=r("p"),k=n("When used with "),p=r("code"),g=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 h=i(d);k=s(h,"When used with "),p=a(h,"CODE",{});var z=i(p);g=s(z,"is_split_into_words=True"),z.forEach(t),b=s(h,", this tokenizer will add a space before each word (even the first one)."),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function RT(E){let d,k,p,g,b;return g=new Ye({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="language-python"><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LongformerTokenizerFast</span>
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">tokenizer = LongformerTokenizerFast.from_pretrained(<span class="hljs-string">&quot;allenai/longformer-base-4096&quot;</span>)</span>
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>)[<span class="hljs-string">&#x27;input_ids&#x27;</span>]</span>
[0, 31414, 232, 328, 2]
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">tokenizer(<span class="hljs-string">&quot; Hello world&quot;</span>)[<span class="hljs-string">&#x27;input_ids&#x27;</span>]</span>
[0, 20920, 232, 2]`}}),{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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"be encoded differently whether it is at the beginning of the sentence (without space) or not:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function VT(E){let d,k,p,g,b,l,h,z;return{c(){d=r("p"),k=n("When used with "),p=r("code"),g=n("is_split_into_words=True"),b=n(", this tokenizer needs to be instantiated with "),l=r("code"),h=n("add_prefix_space=True"),z=n(".")},l(ie){d=a(ie,"P",{});var Z=i(d);k=s(Z,"When used with "),p=a(Z,"CODE",{});var N=i(p);g=s(N,"is_split_into_words=True"),N.forEach(t),b=s(Z,", this tokenizer needs to be instantiated with "),l=a(Z,"CODE",{});var te=i(l);h=s(te,"add_prefix_space=True"),te.forEach(t),z=s(Z,"."),Z.forEach(t)},m(ie,Z){f(ie,d,Z),e(d,k),e(d,p),e(p,g),e(d,b),e(d,l),e(l,h),e(d,z)},d(ie){ie&&t(d)}}}function GT(E){let d,k,p,g,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"),g=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 h=i(d);k=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(h,"CODE",{});var z=i(p);g=s(z,"Module"),z.forEach(t),b=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function JT(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Examples:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function YT(E){let d,k,p,g,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"),g=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 h=i(d);k=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(h,"CODE",{});var z=i(p);g=s(z,"Module"),z.forEach(t),b=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function XT(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Mask filling example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function ZT(E){let d,k;return d=new Ye({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,g){T(d,p,g),k=!0},p:tt,i(p){k||($(d.$$.fragment,p),k=!0)},o(p){L(d.$$.fragment,p),k=!1},d(p){x(d,p)}}}function e1(E){let d,k,p,g,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"),g=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 h=i(d);k=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(h,"CODE",{});var z=i(p);g=s(z,"Module"),z.forEach(t),b=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function t1(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Example of single-label classification:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function o1(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Example of multi-label classification:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function n1(E){let d,k,p,g,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"),g=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 h=i(d);k=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(h,"CODE",{});var z=i(p);g=s(z,"Module"),z.forEach(t),b=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function s1(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function r1(E){let d,k,p,g,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"),g=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 h=i(d);k=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(h,"CODE",{});var z=i(p);g=s(z,"Module"),z.forEach(t),b=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function a1(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function i1(E){let d,k,p,g,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"),g=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 h=i(d);k=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(h,"CODE",{});var z=i(p);g=s(z,"Module"),z.forEach(t),b=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function l1(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Examples:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function d1(E){let d,k,p,g,b,l,h,z,ie,Z,N,te,oe,F,be,H,ve,ge,S,ye,me,G,Te,ue,W,$e,_e,Q,pe,Le,re,C,O,we,U,ne,xe,K,Fe,Me,j,qe,J,fe,ze,Y,ke,ae,D,he,X,Ee,ee,P,Ce,A,le,ce;return{c(){d=r("p"),k=n("TensorFlow models and layers in "),p=r("code"),g=n("transformers"),b=n(" accept two formats as input:"),l=c(),h=r("ul"),z=r("li"),ie=n("having all inputs as keyword arguments (like PyTorch models), or"),Z=c(),N=r("li"),te=n("having all inputs as a list, tuple or dict in the first positional argument."),oe=c(),F=r("p"),be=n(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),H=r("code"),ve=n("model.fit()"),ge=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r("code"),ye=n("model.fit()"),me=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),G=r("code"),Te=n("fit()"),ue=n(" and "),W=r("code"),$e=n("predict()"),_e=n(`, such as when creating your own layers or models with
the Keras `),Q=r("code"),pe=n("Functional"),Le=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),re=c(),C=r("ul"),O=r("li"),we=n("a single Tensor with "),U=r("code"),ne=n("input_ids"),xe=n(" only and nothing else: "),K=r("code"),Fe=n("model(input_ids)"),Me=c(),j=r("li"),qe=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),J=r("code"),fe=n("model([input_ids, attention_mask])"),ze=n(" or "),Y=r("code"),ke=n("model([input_ids, attention_mask, token_type_ids])"),ae=c(),D=r("li"),he=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})'),ee=c(),P=r("p"),Ce=n(`Note that when creating models and layers with
`),A=r("a"),le=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 q=i(d);k=s(q,"TensorFlow models and layers in "),p=a(q,"CODE",{});var Qe=i(p);g=s(Qe,"transformers"),Qe.forEach(t),b=s(q," accept two formats as input:"),q.forEach(t),l=m(w),h=a(w,"UL",{});var se=i(h);z=a(se,"LI",{});var Ue=i(z);ie=s(Ue,"having all inputs as keyword arguments (like PyTorch models), or"),Ue.forEach(t),Z=m(se),N=a(se,"LI",{});var Ne=i(N);te=s(Ne,"having all inputs as a list, tuple or dict in the first positional argument."),Ne.forEach(t),se.forEach(t),oe=m(w),F=a(w,"P",{});var M=i(F);be=s(M,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),H=a(M,"CODE",{});var He=i(H);ve=s(He,"model.fit()"),He.forEach(t),ge=s(M,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a(M,"CODE",{});var Ie=i(S);ye=s(Ie,"model.fit()"),Ie.forEach(t),me=s(M,` supports! If, however, you want to use the second
format outside of Keras methods like `),G=a(M,"CODE",{});var ot=i(G);Te=s(ot,"fit()"),ot.forEach(t),ue=s(M," and "),W=a(M,"CODE",{});var De=i(W);$e=s(De,"predict()"),De.forEach(t),_e=s(M,`, such as when creating your own layers or models with
the Keras `),Q=a(M,"CODE",{});var Se=i(Q);pe=s(Se,"Functional"),Se.forEach(t),Le=s(M,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),M.forEach(t),re=m(w),C=a(w,"UL",{});var B=i(C);O=a(B,"LI",{});var R=i(O);we=s(R,"a single Tensor with "),U=a(R,"CODE",{});var Be=i(U);ne=s(Be,"input_ids"),Be.forEach(t),xe=s(R," only and nothing else: "),K=a(R,"CODE",{});var nt=i(K);Fe=s(nt,"model(input_ids)"),nt.forEach(t),R.forEach(t),Me=m(B),j=a(B,"LI",{});var V=i(j);qe=s(V,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),J=a(V,"CODE",{});var Pe=i(J);fe=s(Pe,"model([input_ids, attention_mask])"),Pe.forEach(t),ze=s(V," or "),Y=a(V,"CODE",{});var Ke=i(Y);ke=s(Ke,"model([input_ids, attention_mask, token_type_ids])"),Ke.forEach(t),V.forEach(t),ae=m(B),D=a(B,"LI",{});var je=i(D);he=s(je,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),X=a(je,"CODE",{});var Ae=i(X);Ee=s(Ae,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Ae.forEach(t),je.forEach(t),B.forEach(t),ee=m(w),P=a(w,"P",{});var de=i(P);Ce=s(de,`Note that when creating models and layers with
`),A=a(de,"A",{href:!0,rel:!0});var Re=i(A);le=s(Re,"subclassing"),Re.forEach(t),ce=s(de,` 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!`),de.forEach(t),this.h()},h(){u(A,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(A,"rel","nofollow")},m(w,q){f(w,d,q),e(d,k),e(d,p),e(p,g),e(d,b),f(w,l,q),f(w,h,q),e(h,z),e(z,ie),e(h,Z),e(h,N),e(N,te),f(w,oe,q),f(w,F,q),e(F,be),e(F,H),e(H,ve),e(F,ge),e(F,S),e(S,ye),e(F,me),e(F,G),e(G,Te),e(F,ue),e(F,W),e(W,$e),e(F,_e),e(F,Q),e(Q,pe),e(F,Le),f(w,re,q),f(w,C,q),e(C,O),e(O,we),e(O,U),e(U,ne),e(O,xe),e(O,K),e(K,Fe),e(C,Me),e(C,j),e(j,qe),e(j,J),e(J,fe),e(j,ze),e(j,Y),e(Y,ke),e(C,ae),e(C,D),e(D,he),e(D,X),e(X,Ee),f(w,ee,q),f(w,P,q),e(P,Ce),e(P,A),e(A,le),e(P,ce)},d(w){w&&t(d),w&&t(l),w&&t(h),w&&t(oe),w&&t(F),w&&t(re),w&&t(C),w&&t(ee),w&&t(P)}}}function c1(E){let d,k,p,g,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"),g=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 h=i(d);k=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(h,"CODE",{});var z=i(p);g=s(z,"Module"),z.forEach(t),b=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function m1(E){let d,k,p,g,b,l,h,z,ie,Z,N,te,oe,F,be,H,ve,ge,S,ye,me,G,Te,ue,W,$e,_e,Q,pe,Le,re,C,O,we,U,ne,xe,K,Fe,Me,j,qe,J,fe,ze,Y,ke,ae,D,he,X,Ee,ee,P,Ce,A,le,ce;return{c(){d=r("p"),k=n("TensorFlow models and layers in "),p=r("code"),g=n("transformers"),b=n(" accept two formats as input:"),l=c(),h=r("ul"),z=r("li"),ie=n("having all inputs as keyword arguments (like PyTorch models), or"),Z=c(),N=r("li"),te=n("having all inputs as a list, tuple or dict in the first positional argument."),oe=c(),F=r("p"),be=n(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),H=r("code"),ve=n("model.fit()"),ge=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r("code"),ye=n("model.fit()"),me=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),G=r("code"),Te=n("fit()"),ue=n(" and "),W=r("code"),$e=n("predict()"),_e=n(`, such as when creating your own layers or models with
the Keras `),Q=r("code"),pe=n("Functional"),Le=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),re=c(),C=r("ul"),O=r("li"),we=n("a single Tensor with "),U=r("code"),ne=n("input_ids"),xe=n(" only and nothing else: "),K=r("code"),Fe=n("model(input_ids)"),Me=c(),j=r("li"),qe=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),J=r("code"),fe=n("model([input_ids, attention_mask])"),ze=n(" or "),Y=r("code"),ke=n("model([input_ids, attention_mask, token_type_ids])"),ae=c(),D=r("li"),he=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})'),ee=c(),P=r("p"),Ce=n(`Note that when creating models and layers with
`),A=r("a"),le=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 q=i(d);k=s(q,"TensorFlow models and layers in "),p=a(q,"CODE",{});var Qe=i(p);g=s(Qe,"transformers"),Qe.forEach(t),b=s(q," accept two formats as input:"),q.forEach(t),l=m(w),h=a(w,"UL",{});var se=i(h);z=a(se,"LI",{});var Ue=i(z);ie=s(Ue,"having all inputs as keyword arguments (like PyTorch models), or"),Ue.forEach(t),Z=m(se),N=a(se,"LI",{});var Ne=i(N);te=s(Ne,"having all inputs as a list, tuple or dict in the first positional argument."),Ne.forEach(t),se.forEach(t),oe=m(w),F=a(w,"P",{});var M=i(F);be=s(M,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),H=a(M,"CODE",{});var He=i(H);ve=s(He,"model.fit()"),He.forEach(t),ge=s(M,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a(M,"CODE",{});var Ie=i(S);ye=s(Ie,"model.fit()"),Ie.forEach(t),me=s(M,` supports! If, however, you want to use the second
format outside of Keras methods like `),G=a(M,"CODE",{});var ot=i(G);Te=s(ot,"fit()"),ot.forEach(t),ue=s(M," and "),W=a(M,"CODE",{});var De=i(W);$e=s(De,"predict()"),De.forEach(t),_e=s(M,`, such as when creating your own layers or models with
the Keras `),Q=a(M,"CODE",{});var Se=i(Q);pe=s(Se,"Functional"),Se.forEach(t),Le=s(M,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),M.forEach(t),re=m(w),C=a(w,"UL",{});var B=i(C);O=a(B,"LI",{});var R=i(O);we=s(R,"a single Tensor with "),U=a(R,"CODE",{});var Be=i(U);ne=s(Be,"input_ids"),Be.forEach(t),xe=s(R," only and nothing else: "),K=a(R,"CODE",{});var nt=i(K);Fe=s(nt,"model(input_ids)"),nt.forEach(t),R.forEach(t),Me=m(B),j=a(B,"LI",{});var V=i(j);qe=s(V,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),J=a(V,"CODE",{});var Pe=i(J);fe=s(Pe,"model([input_ids, attention_mask])"),Pe.forEach(t),ze=s(V," or "),Y=a(V,"CODE",{});var Ke=i(Y);ke=s(Ke,"model([input_ids, attention_mask, token_type_ids])"),Ke.forEach(t),V.forEach(t),ae=m(B),D=a(B,"LI",{});var je=i(D);he=s(je,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),X=a(je,"CODE",{});var Ae=i(X);Ee=s(Ae,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Ae.forEach(t),je.forEach(t),B.forEach(t),ee=m(w),P=a(w,"P",{});var de=i(P);Ce=s(de,`Note that when creating models and layers with
`),A=a(de,"A",{href:!0,rel:!0});var Re=i(A);le=s(Re,"subclassing"),Re.forEach(t),ce=s(de,` 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!`),de.forEach(t),this.h()},h(){u(A,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(A,"rel","nofollow")},m(w,q){f(w,d,q),e(d,k),e(d,p),e(p,g),e(d,b),f(w,l,q),f(w,h,q),e(h,z),e(z,ie),e(h,Z),e(h,N),e(N,te),f(w,oe,q),f(w,F,q),e(F,be),e(F,H),e(H,ve),e(F,ge),e(F,S),e(S,ye),e(F,me),e(F,G),e(G,Te),e(F,ue),e(F,W),e(W,$e),e(F,_e),e(F,Q),e(Q,pe),e(F,Le),f(w,re,q),f(w,C,q),e(C,O),e(O,we),e(O,U),e(U,ne),e(O,xe),e(O,K),e(K,Fe),e(C,Me),e(C,j),e(j,qe),e(j,J),e(J,fe),e(j,ze),e(j,Y),e(Y,ke),e(C,ae),e(C,D),e(D,he),e(D,X),e(X,Ee),f(w,ee,q),f(w,P,q),e(P,Ce),e(P,A),e(A,le),e(P,ce)},d(w){w&&t(d),w&&t(l),w&&t(h),w&&t(oe),w&&t(F),w&&t(re),w&&t(C),w&&t(ee),w&&t(P)}}}function h1(E){let d,k,p,g,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"),g=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 h=i(d);k=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(h,"CODE",{});var z=i(p);g=s(z,"Module"),z.forEach(t),b=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function p1(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function f1(E){let d,k;return d=new Ye({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,g){T(d,p,g),k=!0},p:tt,i(p){k||($(d.$$.fragment,p),k=!0)},o(p){L(d.$$.fragment,p),k=!1},d(p){x(d,p)}}}function g1(E){let d,k,p,g,b,l,h,z,ie,Z,N,te,oe,F,be,H,ve,ge,S,ye,me,G,Te,ue,W,$e,_e,Q,pe,Le,re,C,O,we,U,ne,xe,K,Fe,Me,j,qe,J,fe,ze,Y,ke,ae,D,he,X,Ee,ee,P,Ce,A,le,ce;return{c(){d=r("p"),k=n("TensorFlow models and layers in "),p=r("code"),g=n("transformers"),b=n(" accept two formats as input:"),l=c(),h=r("ul"),z=r("li"),ie=n("having all inputs as keyword arguments (like PyTorch models), or"),Z=c(),N=r("li"),te=n("having all inputs as a list, tuple or dict in the first positional argument."),oe=c(),F=r("p"),be=n(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),H=r("code"),ve=n("model.fit()"),ge=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r("code"),ye=n("model.fit()"),me=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),G=r("code"),Te=n("fit()"),ue=n(" and "),W=r("code"),$e=n("predict()"),_e=n(`, such as when creating your own layers or models with
the Keras `),Q=r("code"),pe=n("Functional"),Le=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),re=c(),C=r("ul"),O=r("li"),we=n("a single Tensor with "),U=r("code"),ne=n("input_ids"),xe=n(" only and nothing else: "),K=r("code"),Fe=n("model(input_ids)"),Me=c(),j=r("li"),qe=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),J=r("code"),fe=n("model([input_ids, attention_mask])"),ze=n(" or "),Y=r("code"),ke=n("model([input_ids, attention_mask, token_type_ids])"),ae=c(),D=r("li"),he=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})'),ee=c(),P=r("p"),Ce=n(`Note that when creating models and layers with
`),A=r("a"),le=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 q=i(d);k=s(q,"TensorFlow models and layers in "),p=a(q,"CODE",{});var Qe=i(p);g=s(Qe,"transformers"),Qe.forEach(t),b=s(q," accept two formats as input:"),q.forEach(t),l=m(w),h=a(w,"UL",{});var se=i(h);z=a(se,"LI",{});var Ue=i(z);ie=s(Ue,"having all inputs as keyword arguments (like PyTorch models), or"),Ue.forEach(t),Z=m(se),N=a(se,"LI",{});var Ne=i(N);te=s(Ne,"having all inputs as a list, tuple or dict in the first positional argument."),Ne.forEach(t),se.forEach(t),oe=m(w),F=a(w,"P",{});var M=i(F);be=s(M,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),H=a(M,"CODE",{});var He=i(H);ve=s(He,"model.fit()"),He.forEach(t),ge=s(M,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a(M,"CODE",{});var Ie=i(S);ye=s(Ie,"model.fit()"),Ie.forEach(t),me=s(M,` supports! If, however, you want to use the second
format outside of Keras methods like `),G=a(M,"CODE",{});var ot=i(G);Te=s(ot,"fit()"),ot.forEach(t),ue=s(M," and "),W=a(M,"CODE",{});var De=i(W);$e=s(De,"predict()"),De.forEach(t),_e=s(M,`, such as when creating your own layers or models with
the Keras `),Q=a(M,"CODE",{});var Se=i(Q);pe=s(Se,"Functional"),Se.forEach(t),Le=s(M,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),M.forEach(t),re=m(w),C=a(w,"UL",{});var B=i(C);O=a(B,"LI",{});var R=i(O);we=s(R,"a single Tensor with "),U=a(R,"CODE",{});var Be=i(U);ne=s(Be,"input_ids"),Be.forEach(t),xe=s(R," only and nothing else: "),K=a(R,"CODE",{});var nt=i(K);Fe=s(nt,"model(input_ids)"),nt.forEach(t),R.forEach(t),Me=m(B),j=a(B,"LI",{});var V=i(j);qe=s(V,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),J=a(V,"CODE",{});var Pe=i(J);fe=s(Pe,"model([input_ids, attention_mask])"),Pe.forEach(t),ze=s(V," or "),Y=a(V,"CODE",{});var Ke=i(Y);ke=s(Ke,"model([input_ids, attention_mask, token_type_ids])"),Ke.forEach(t),V.forEach(t),ae=m(B),D=a(B,"LI",{});var je=i(D);he=s(je,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),X=a(je,"CODE",{});var Ae=i(X);Ee=s(Ae,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Ae.forEach(t),je.forEach(t),B.forEach(t),ee=m(w),P=a(w,"P",{});var de=i(P);Ce=s(de,`Note that when creating models and layers with
`),A=a(de,"A",{href:!0,rel:!0});var Re=i(A);le=s(Re,"subclassing"),Re.forEach(t),ce=s(de,` 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!`),de.forEach(t),this.h()},h(){u(A,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(A,"rel","nofollow")},m(w,q){f(w,d,q),e(d,k),e(d,p),e(p,g),e(d,b),f(w,l,q),f(w,h,q),e(h,z),e(z,ie),e(h,Z),e(h,N),e(N,te),f(w,oe,q),f(w,F,q),e(F,be),e(F,H),e(H,ve),e(F,ge),e(F,S),e(S,ye),e(F,me),e(F,G),e(G,Te),e(F,ue),e(F,W),e(W,$e),e(F,_e),e(F,Q),e(Q,pe),e(F,Le),f(w,re,q),f(w,C,q),e(C,O),e(O,we),e(O,U),e(U,ne),e(O,xe),e(O,K),e(K,Fe),e(C,Me),e(C,j),e(j,qe),e(j,J),e(J,fe),e(j,ze),e(j,Y),e(Y,ke),e(C,ae),e(C,D),e(D,he),e(D,X),e(X,Ee),f(w,ee,q),f(w,P,q),e(P,Ce),e(P,A),e(A,le),e(P,ce)},d(w){w&&t(d),w&&t(l),w&&t(h),w&&t(oe),w&&t(F),w&&t(re),w&&t(C),w&&t(ee),w&&t(P)}}}function u1(E){let d,k,p,g,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"),g=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 h=i(d);k=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(h,"CODE",{});var z=i(p);g=s(z,"Module"),z.forEach(t),b=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function _1(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function w1(E){let d,k;return d=new Ye({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,g){T(d,p,g),k=!0},p:tt,i(p){k||($(d.$$.fragment,p),k=!0)},o(p){L(d.$$.fragment,p),k=!1},d(p){x(d,p)}}}function k1(E){let d,k,p,g,b,l,h,z,ie,Z,N,te,oe,F,be,H,ve,ge,S,ye,me,G,Te,ue,W,$e,_e,Q,pe,Le,re,C,O,we,U,ne,xe,K,Fe,Me,j,qe,J,fe,ze,Y,ke,ae,D,he,X,Ee,ee,P,Ce,A,le,ce;return{c(){d=r("p"),k=n("TensorFlow models and layers in "),p=r("code"),g=n("transformers"),b=n(" accept two formats as input:"),l=c(),h=r("ul"),z=r("li"),ie=n("having all inputs as keyword arguments (like PyTorch models), or"),Z=c(),N=r("li"),te=n("having all inputs as a list, tuple or dict in the first positional argument."),oe=c(),F=r("p"),be=n(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),H=r("code"),ve=n("model.fit()"),ge=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r("code"),ye=n("model.fit()"),me=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),G=r("code"),Te=n("fit()"),ue=n(" and "),W=r("code"),$e=n("predict()"),_e=n(`, such as when creating your own layers or models with
the Keras `),Q=r("code"),pe=n("Functional"),Le=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),re=c(),C=r("ul"),O=r("li"),we=n("a single Tensor with "),U=r("code"),ne=n("input_ids"),xe=n(" only and nothing else: "),K=r("code"),Fe=n("model(input_ids)"),Me=c(),j=r("li"),qe=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),J=r("code"),fe=n("model([input_ids, attention_mask])"),ze=n(" or "),Y=r("code"),ke=n("model([input_ids, attention_mask, token_type_ids])"),ae=c(),D=r("li"),he=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})'),ee=c(),P=r("p"),Ce=n(`Note that when creating models and layers with
`),A=r("a"),le=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 q=i(d);k=s(q,"TensorFlow models and layers in "),p=a(q,"CODE",{});var Qe=i(p);g=s(Qe,"transformers"),Qe.forEach(t),b=s(q," accept two formats as input:"),q.forEach(t),l=m(w),h=a(w,"UL",{});var se=i(h);z=a(se,"LI",{});var Ue=i(z);ie=s(Ue,"having all inputs as keyword arguments (like PyTorch models), or"),Ue.forEach(t),Z=m(se),N=a(se,"LI",{});var Ne=i(N);te=s(Ne,"having all inputs as a list, tuple or dict in the first positional argument."),Ne.forEach(t),se.forEach(t),oe=m(w),F=a(w,"P",{});var M=i(F);be=s(M,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),H=a(M,"CODE",{});var He=i(H);ve=s(He,"model.fit()"),He.forEach(t),ge=s(M,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a(M,"CODE",{});var Ie=i(S);ye=s(Ie,"model.fit()"),Ie.forEach(t),me=s(M,` supports! If, however, you want to use the second
format outside of Keras methods like `),G=a(M,"CODE",{});var ot=i(G);Te=s(ot,"fit()"),ot.forEach(t),ue=s(M," and "),W=a(M,"CODE",{});var De=i(W);$e=s(De,"predict()"),De.forEach(t),_e=s(M,`, such as when creating your own layers or models with
the Keras `),Q=a(M,"CODE",{});var Se=i(Q);pe=s(Se,"Functional"),Se.forEach(t),Le=s(M,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),M.forEach(t),re=m(w),C=a(w,"UL",{});var B=i(C);O=a(B,"LI",{});var R=i(O);we=s(R,"a single Tensor with "),U=a(R,"CODE",{});var Be=i(U);ne=s(Be,"input_ids"),Be.forEach(t),xe=s(R," only and nothing else: "),K=a(R,"CODE",{});var nt=i(K);Fe=s(nt,"model(input_ids)"),nt.forEach(t),R.forEach(t),Me=m(B),j=a(B,"LI",{});var V=i(j);qe=s(V,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),J=a(V,"CODE",{});var Pe=i(J);fe=s(Pe,"model([input_ids, attention_mask])"),Pe.forEach(t),ze=s(V," or "),Y=a(V,"CODE",{});var Ke=i(Y);ke=s(Ke,"model([input_ids, attention_mask, token_type_ids])"),Ke.forEach(t),V.forEach(t),ae=m(B),D=a(B,"LI",{});var je=i(D);he=s(je,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),X=a(je,"CODE",{});var Ae=i(X);Ee=s(Ae,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Ae.forEach(t),je.forEach(t),B.forEach(t),ee=m(w),P=a(w,"P",{});var de=i(P);Ce=s(de,`Note that when creating models and layers with
`),A=a(de,"A",{href:!0,rel:!0});var Re=i(A);le=s(Re,"subclassing"),Re.forEach(t),ce=s(de,` 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!`),de.forEach(t),this.h()},h(){u(A,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(A,"rel","nofollow")},m(w,q){f(w,d,q),e(d,k),e(d,p),e(p,g),e(d,b),f(w,l,q),f(w,h,q),e(h,z),e(z,ie),e(h,Z),e(h,N),e(N,te),f(w,oe,q),f(w,F,q),e(F,be),e(F,H),e(H,ve),e(F,ge),e(F,S),e(S,ye),e(F,me),e(F,G),e(G,Te),e(F,ue),e(F,W),e(W,$e),e(F,_e),e(F,Q),e(Q,pe),e(F,Le),f(w,re,q),f(w,C,q),e(C,O),e(O,we),e(O,U),e(U,ne),e(O,xe),e(O,K),e(K,Fe),e(C,Me),e(C,j),e(j,qe),e(j,J),e(J,fe),e(j,ze),e(j,Y),e(Y,ke),e(C,ae),e(C,D),e(D,he),e(D,X),e(X,Ee),f(w,ee,q),f(w,P,q),e(P,Ce),e(P,A),e(A,le),e(P,ce)},d(w){w&&t(d),w&&t(l),w&&t(h),w&&t(oe),w&&t(F),w&&t(re),w&&t(C),w&&t(ee),w&&t(P)}}}function b1(E){let d,k,p,g,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"),g=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 h=i(d);k=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(h,"CODE",{});var z=i(p);g=s(z,"Module"),z.forEach(t),b=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function v1(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function y1(E){let d,k;return d=new Ye({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,g){T(d,p,g),k=!0},p:tt,i(p){k||($(d.$$.fragment,p),k=!0)},o(p){L(d.$$.fragment,p),k=!1},d(p){x(d,p)}}}function T1(E){let d,k,p,g,b,l,h,z,ie,Z,N,te,oe,F,be,H,ve,ge,S,ye,me,G,Te,ue,W,$e,_e,Q,pe,Le,re,C,O,we,U,ne,xe,K,Fe,Me,j,qe,J,fe,ze,Y,ke,ae,D,he,X,Ee,ee,P,Ce,A,le,ce;return{c(){d=r("p"),k=n("TensorFlow models and layers in "),p=r("code"),g=n("transformers"),b=n(" accept two formats as input:"),l=c(),h=r("ul"),z=r("li"),ie=n("having all inputs as keyword arguments (like PyTorch models), or"),Z=c(),N=r("li"),te=n("having all inputs as a list, tuple or dict in the first positional argument."),oe=c(),F=r("p"),be=n(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),H=r("code"),ve=n("model.fit()"),ge=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r("code"),ye=n("model.fit()"),me=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),G=r("code"),Te=n("fit()"),ue=n(" and "),W=r("code"),$e=n("predict()"),_e=n(`, such as when creating your own layers or models with
the Keras `),Q=r("code"),pe=n("Functional"),Le=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),re=c(),C=r("ul"),O=r("li"),we=n("a single Tensor with "),U=r("code"),ne=n("input_ids"),xe=n(" only and nothing else: "),K=r("code"),Fe=n("model(input_ids)"),Me=c(),j=r("li"),qe=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),J=r("code"),fe=n("model([input_ids, attention_mask])"),ze=n(" or "),Y=r("code"),ke=n("model([input_ids, attention_mask, token_type_ids])"),ae=c(),D=r("li"),he=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})'),ee=c(),P=r("p"),Ce=n(`Note that when creating models and layers with
`),A=r("a"),le=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 q=i(d);k=s(q,"TensorFlow models and layers in "),p=a(q,"CODE",{});var Qe=i(p);g=s(Qe,"transformers"),Qe.forEach(t),b=s(q," accept two formats as input:"),q.forEach(t),l=m(w),h=a(w,"UL",{});var se=i(h);z=a(se,"LI",{});var Ue=i(z);ie=s(Ue,"having all inputs as keyword arguments (like PyTorch models), or"),Ue.forEach(t),Z=m(se),N=a(se,"LI",{});var Ne=i(N);te=s(Ne,"having all inputs as a list, tuple or dict in the first positional argument."),Ne.forEach(t),se.forEach(t),oe=m(w),F=a(w,"P",{});var M=i(F);be=s(M,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),H=a(M,"CODE",{});var He=i(H);ve=s(He,"model.fit()"),He.forEach(t),ge=s(M,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a(M,"CODE",{});var Ie=i(S);ye=s(Ie,"model.fit()"),Ie.forEach(t),me=s(M,` supports! If, however, you want to use the second
format outside of Keras methods like `),G=a(M,"CODE",{});var ot=i(G);Te=s(ot,"fit()"),ot.forEach(t),ue=s(M," and "),W=a(M,"CODE",{});var De=i(W);$e=s(De,"predict()"),De.forEach(t),_e=s(M,`, such as when creating your own layers or models with
the Keras `),Q=a(M,"CODE",{});var Se=i(Q);pe=s(Se,"Functional"),Se.forEach(t),Le=s(M,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),M.forEach(t),re=m(w),C=a(w,"UL",{});var B=i(C);O=a(B,"LI",{});var R=i(O);we=s(R,"a single Tensor with "),U=a(R,"CODE",{});var Be=i(U);ne=s(Be,"input_ids"),Be.forEach(t),xe=s(R," only and nothing else: "),K=a(R,"CODE",{});var nt=i(K);Fe=s(nt,"model(input_ids)"),nt.forEach(t),R.forEach(t),Me=m(B),j=a(B,"LI",{});var V=i(j);qe=s(V,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),J=a(V,"CODE",{});var Pe=i(J);fe=s(Pe,"model([input_ids, attention_mask])"),Pe.forEach(t),ze=s(V," or "),Y=a(V,"CODE",{});var Ke=i(Y);ke=s(Ke,"model([input_ids, attention_mask, token_type_ids])"),Ke.forEach(t),V.forEach(t),ae=m(B),D=a(B,"LI",{});var je=i(D);he=s(je,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),X=a(je,"CODE",{});var Ae=i(X);Ee=s(Ae,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Ae.forEach(t),je.forEach(t),B.forEach(t),ee=m(w),P=a(w,"P",{});var de=i(P);Ce=s(de,`Note that when creating models and layers with
`),A=a(de,"A",{href:!0,rel:!0});var Re=i(A);le=s(Re,"subclassing"),Re.forEach(t),ce=s(de,` 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!`),de.forEach(t),this.h()},h(){u(A,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(A,"rel","nofollow")},m(w,q){f(w,d,q),e(d,k),e(d,p),e(p,g),e(d,b),f(w,l,q),f(w,h,q),e(h,z),e(z,ie),e(h,Z),e(h,N),e(N,te),f(w,oe,q),f(w,F,q),e(F,be),e(F,H),e(H,ve),e(F,ge),e(F,S),e(S,ye),e(F,me),e(F,G),e(G,Te),e(F,ue),e(F,W),e(W,$e),e(F,_e),e(F,Q),e(Q,pe),e(F,Le),f(w,re,q),f(w,C,q),e(C,O),e(O,we),e(O,U),e(U,ne),e(O,xe),e(O,K),e(K,Fe),e(C,Me),e(C,j),e(j,qe),e(j,J),e(J,fe),e(j,ze),e(j,Y),e(Y,ke),e(C,ae),e(C,D),e(D,he),e(D,X),e(X,Ee),f(w,ee,q),f(w,P,q),e(P,Ce),e(P,A),e(A,le),e(P,ce)},d(w){w&&t(d),w&&t(l),w&&t(h),w&&t(oe),w&&t(F),w&&t(re),w&&t(C),w&&t(ee),w&&t(P)}}}function $1(E){let d,k,p,g,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"),g=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 h=i(d);k=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(h,"CODE",{});var z=i(p);g=s(z,"Module"),z.forEach(t),b=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function L1(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function x1(E){let d,k;return d=new Ye({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,g){T(d,p,g),k=!0},p:tt,i(p){k||($(d.$$.fragment,p),k=!0)},o(p){L(d.$$.fragment,p),k=!1},d(p){x(d,p)}}}function F1(E){let d,k,p,g,b,l,h,z,ie,Z,N,te,oe,F,be,H,ve,ge,S,ye,me,G,Te,ue,W,$e,_e,Q,pe,Le,re,C,O,we,U,ne,xe,K,Fe,Me,j,qe,J,fe,ze,Y,ke,ae,D,he,X,Ee,ee,P,Ce,A,le,ce;return{c(){d=r("p"),k=n("TensorFlow models and layers in "),p=r("code"),g=n("transformers"),b=n(" accept two formats as input:"),l=c(),h=r("ul"),z=r("li"),ie=n("having all inputs as keyword arguments (like PyTorch models), or"),Z=c(),N=r("li"),te=n("having all inputs as a list, tuple or dict in the first positional argument."),oe=c(),F=r("p"),be=n(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),H=r("code"),ve=n("model.fit()"),ge=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r("code"),ye=n("model.fit()"),me=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),G=r("code"),Te=n("fit()"),ue=n(" and "),W=r("code"),$e=n("predict()"),_e=n(`, such as when creating your own layers or models with
the Keras `),Q=r("code"),pe=n("Functional"),Le=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),re=c(),C=r("ul"),O=r("li"),we=n("a single Tensor with "),U=r("code"),ne=n("input_ids"),xe=n(" only and nothing else: "),K=r("code"),Fe=n("model(input_ids)"),Me=c(),j=r("li"),qe=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),J=r("code"),fe=n("model([input_ids, attention_mask])"),ze=n(" or "),Y=r("code"),ke=n("model([input_ids, attention_mask, token_type_ids])"),ae=c(),D=r("li"),he=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})'),ee=c(),P=r("p"),Ce=n(`Note that when creating models and layers with
`),A=r("a"),le=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 q=i(d);k=s(q,"TensorFlow models and layers in "),p=a(q,"CODE",{});var Qe=i(p);g=s(Qe,"transformers"),Qe.forEach(t),b=s(q," accept two formats as input:"),q.forEach(t),l=m(w),h=a(w,"UL",{});var se=i(h);z=a(se,"LI",{});var Ue=i(z);ie=s(Ue,"having all inputs as keyword arguments (like PyTorch models), or"),Ue.forEach(t),Z=m(se),N=a(se,"LI",{});var Ne=i(N);te=s(Ne,"having all inputs as a list, tuple or dict in the first positional argument."),Ne.forEach(t),se.forEach(t),oe=m(w),F=a(w,"P",{});var M=i(F);be=s(M,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),H=a(M,"CODE",{});var He=i(H);ve=s(He,"model.fit()"),He.forEach(t),ge=s(M,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a(M,"CODE",{});var Ie=i(S);ye=s(Ie,"model.fit()"),Ie.forEach(t),me=s(M,` supports! If, however, you want to use the second
format outside of Keras methods like `),G=a(M,"CODE",{});var ot=i(G);Te=s(ot,"fit()"),ot.forEach(t),ue=s(M," and "),W=a(M,"CODE",{});var De=i(W);$e=s(De,"predict()"),De.forEach(t),_e=s(M,`, such as when creating your own layers or models with
the Keras `),Q=a(M,"CODE",{});var Se=i(Q);pe=s(Se,"Functional"),Se.forEach(t),Le=s(M,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),M.forEach(t),re=m(w),C=a(w,"UL",{});var B=i(C);O=a(B,"LI",{});var R=i(O);we=s(R,"a single Tensor with "),U=a(R,"CODE",{});var Be=i(U);ne=s(Be,"input_ids"),Be.forEach(t),xe=s(R," only and nothing else: "),K=a(R,"CODE",{});var nt=i(K);Fe=s(nt,"model(input_ids)"),nt.forEach(t),R.forEach(t),Me=m(B),j=a(B,"LI",{});var V=i(j);qe=s(V,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),J=a(V,"CODE",{});var Pe=i(J);fe=s(Pe,"model([input_ids, attention_mask])"),Pe.forEach(t),ze=s(V," or "),Y=a(V,"CODE",{});var Ke=i(Y);ke=s(Ke,"model([input_ids, attention_mask, token_type_ids])"),Ke.forEach(t),V.forEach(t),ae=m(B),D=a(B,"LI",{});var je=i(D);he=s(je,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),X=a(je,"CODE",{});var Ae=i(X);Ee=s(Ae,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Ae.forEach(t),je.forEach(t),B.forEach(t),ee=m(w),P=a(w,"P",{});var de=i(P);Ce=s(de,`Note that when creating models and layers with
`),A=a(de,"A",{href:!0,rel:!0});var Re=i(A);le=s(Re,"subclassing"),Re.forEach(t),ce=s(de,` 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!`),de.forEach(t),this.h()},h(){u(A,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(A,"rel","nofollow")},m(w,q){f(w,d,q),e(d,k),e(d,p),e(p,g),e(d,b),f(w,l,q),f(w,h,q),e(h,z),e(z,ie),e(h,Z),e(h,N),e(N,te),f(w,oe,q),f(w,F,q),e(F,be),e(F,H),e(H,ve),e(F,ge),e(F,S),e(S,ye),e(F,me),e(F,G),e(G,Te),e(F,ue),e(F,W),e(W,$e),e(F,_e),e(F,Q),e(Q,pe),e(F,Le),f(w,re,q),f(w,C,q),e(C,O),e(O,we),e(O,U),e(U,ne),e(O,xe),e(O,K),e(K,Fe),e(C,Me),e(C,j),e(j,qe),e(j,J),e(J,fe),e(j,ze),e(j,Y),e(Y,ke),e(C,ae),e(C,D),e(D,he),e(D,X),e(X,Ee),f(w,ee,q),f(w,P,q),e(P,Ce),e(P,A),e(A,le),e(P,ce)},d(w){w&&t(d),w&&t(l),w&&t(h),w&&t(oe),w&&t(F),w&&t(re),w&&t(C),w&&t(ee),w&&t(P)}}}function M1(E){let d,k,p,g,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"),g=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 h=i(d);k=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a(h,"CODE",{});var z=i(p);g=s(z,"Module"),z.forEach(t),b=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,k),e(d,p),e(p,g),e(d,b)},d(l){l&&t(d)}}}function q1(E){let d,k,p,g,b;return g=new Ye({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(g.$$.fragment)},l(l){d=a(l,"P",{});var h=i(d);k=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,k),f(l,p,h),T(g,l,h),b=!0},p:tt,i(l){b||($(g.$$.fragment,l),b=!0)},o(l){L(g.$$.fragment,l),b=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function z1(E){let d,k,p,g,b,l,h,z,ie,Z,N,te,oe,F,be,H,ve,ge,S,ye,me,G,Te,ue,W,$e,_e,Q,pe,Le,re,C,O,we,U,ne,xe,K,Fe,Me,j,qe,J,fe,ze,Y,ke,ae,D,he,X,Ee,ee,P,Ce,A,le,ce,w,q,Qe,se,Ue,Ne,M,He,Ie,ot='<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>',De,Se,B='<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>',R,Be,nt='<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>',V,Pe,Ke,je,Ae,de,Re,Ni,Ch,jh,oc,jT='<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>',nc,Ii,Oh,Ph,sc,It,Ah,rc,OT='<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>',ac,Di,Nh,Ih,ic,Dt,Dh,Si,Sh,Bh,Bi,Wh,Qh,lc,nn,Wi,Uh,Hh,Qi,Kh,dc,sn,Rh,Ca,Vh,Gh,cc,kt,Jh,mc,PT='<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>',hc,pc,AT='<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>',fc,gc,NT='<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>',uc,_c,IT='<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,kc,rn,Yh,ks,Xh,Zh,bc,eo,an,Ui,bs,ep,Hi,tp,vc,to,ja,op,np,Oa,sp,rp,yc,vs,Tc,oo,ln,Ki,ys,ap,Ri,ip,$c,pt,Ts,lp,no,dp,Pa,cp,mp,Aa,hp,pp,fp,so,gp,Na,up,_p,$s,wp,kp,bp,ro,vp,Ia,yp,Tp,Da,$p,Lp,xp,dn,Lc,ao,cn,Vi,Ls,Fp,Gi,Mp,xc,Oe,xs,qp,Ji,zp,Ep,Yi,Cp,jp,mn,Op,Fs,Pp,Xi,Ap,Np,Ip,hn,Dp,Ms,Sp,Sa,Bp,Wp,Qp,St,qs,Up,Zi,Hp,Kp,zs,Ba,Rp,el,Vp,Gp,Wa,Jp,tl,Yp,Xp,pn,Es,Zp,ol,ef,tf,fn,Cs,of,nl,nf,sf,gn,js,rf,Os,af,sl,lf,df,Fc,io,un,rl,Ps,cf,al,mf,Mc,Ve,As,hf,Ns,pf,il,ff,gf,uf,ll,_f,wf,_n,kf,Is,bf,dl,vf,yf,Tf,wn,$f,Ds,Lf,Qa,xf,Ff,Mf,kn,Ss,qf,cl,zf,qc,lo,bn,ml,Bs,Ef,hl,Cf,zc,co,Ws,jf,pl,Of,Ec,mo,Qs,Pf,fl,Af,Cc,ho,Us,Nf,gl,If,jc,po,Hs,Df,ul,Sf,Oc,fo,Ks,Bf,_l,Wf,Pc,go,Rs,Qf,wl,Uf,Ac,uo,Vs,Hf,kl,Kf,Nc,_o,Gs,Rf,bl,Vf,Ic,wo,Js,Gf,vl,Jf,Dc,ko,Ys,Yf,yl,Xf,Sc,bo,Xs,Zf,Tl,eg,Bc,vo,Zs,tg,$l,og,Wc,yo,er,ng,Ll,sg,Qc,To,tr,rg,xl,ag,Uc,$o,vn,Fl,or,ig,Ml,lg,Hc,st,nr,dg,ql,cg,mg,sr,hg,Ua,pg,fg,gg,rr,ug,ar,_g,wg,kg,Lo,bg,Ha,vg,yg,ir,Tg,$g,Lg,lr,xg,zl,Fg,Mg,qg,xt,dr,zg,xo,Eg,Ka,Cg,jg,El,Og,Pg,Ag,yn,Ng,Tn,Kc,Fo,$n,Cl,cr,Ig,jl,Dg,Rc,ft,mr,Sg,hr,Bg,Ol,Wg,Qg,Ug,pr,Hg,Ra,Kg,Rg,Vg,fr,Gg,gr,Jg,Yg,Xg,ct,ur,Zg,Mo,eu,Va,tu,ou,Pl,nu,su,ru,Ln,au,xn,iu,Al,lu,du,Fn,Vc,qo,Mn,Nl,_r,cu,Il,mu,Gc,gt,wr,hu,Dl,pu,fu,kr,gu,Ga,uu,_u,wu,br,ku,vr,bu,vu,yu,bt,yr,Tu,zo,$u,Ja,Lu,xu,Sl,Fu,Mu,qu,qn,zu,zn,Eu,En,Jc,Eo,Cn,Bl,Tr,Cu,Wl,ju,Yc,ut,$r,Ou,Ql,Pu,Au,Lr,Nu,Ya,Iu,Du,Su,xr,Bu,Fr,Wu,Qu,Uu,Ft,Mr,Hu,Co,Ku,Xa,Ru,Vu,Ul,Gu,Ju,Yu,jn,Xu,On,Xc,jo,Pn,Hl,qr,Zu,Kl,e_,Zc,_t,zr,t_,Rl,o_,n_,Er,s_,Za,r_,a_,i_,Cr,l_,jr,d_,c_,m_,Mt,Or,h_,Oo,p_,ei,f_,g_,Vl,u_,__,w_,An,k_,Nn,em,Po,In,Gl,Pr,b_,Jl,v_,tm,wt,Ar,y_,Ao,T_,Yl,$_,L_,Xl,x_,F_,M_,Nr,q_,ti,z_,E_,C_,Ir,j_,Dr,O_,P_,A_,qt,Sr,N_,No,I_,oi,D_,S_,Zl,B_,W_,Q_,Dn,U_,Sn,om,Io,Bn,ed,Br,H_,td,K_,nm,Ge,Wr,R_,od,V_,G_,Qr,J_,ni,Y_,X_,Z_,Ur,ew,Hr,tw,ow,nw,Wn,sw,Do,rw,si,aw,iw,Kr,lw,dw,cw,Rr,mw,nd,hw,pw,fw,Bt,Vr,gw,So,uw,ri,_w,ww,sd,kw,bw,vw,Qn,sm,Bo,Un,rd,Gr,yw,ad,Tw,rm,rt,Jr,$w,Yr,Lw,id,xw,Fw,Mw,Xr,qw,ai,zw,Ew,Cw,Zr,jw,ea,Ow,Pw,Aw,Hn,Nw,vt,ta,Iw,Wo,Dw,ii,Sw,Bw,ld,Ww,Qw,Uw,Kn,Hw,Rn,Kw,Vn,am,Qo,Gn,dd,oa,Rw,cd,Vw,im,at,na,Gw,Uo,Jw,md,Yw,Xw,hd,Zw,ek,tk,sa,ok,li,nk,sk,rk,ra,ak,aa,ik,lk,dk,Jn,ck,yt,ia,mk,Ho,hk,di,pk,fk,pd,gk,uk,_k,Yn,wk,Xn,kk,Zn,lm,Ko,es,fd,la,bk,gd,vk,dm,it,da,yk,ud,Tk,$k,ca,Lk,ci,xk,Fk,Mk,ma,qk,ha,zk,Ek,Ck,ts,jk,Tt,pa,Ok,Ro,Pk,mi,Ak,Nk,_d,Ik,Dk,Sk,os,Bk,ns,Wk,ss,cm,Vo,rs,wd,fa,Qk,kd,Uk,mm,lt,ga,Hk,bd,Kk,Rk,ua,Vk,hi,Gk,Jk,Yk,_a,Xk,wa,Zk,eb,tb,as,ob,$t,ka,nb,Go,sb,pi,rb,ab,vd,ib,lb,db,is,cb,ls,mb,ds,hm,Jo,cs,yd,ba,hb,Td,pb,pm,dt,va,fb,$d,gb,ub,ya,_b,fi,wb,kb,bb,Ta,vb,$a,yb,Tb,$b,ms,Lb,zt,La,xb,Yo,Fb,gi,Mb,qb,Ld,zb,Eb,Cb,hs,jb,ps,fm;return l=new Ze({}),F=new Ze({}),q=new Ze({}),bs=new Ze({}),vs=new Ye({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>]`}}),ys=new Ze({}),Ts=new I({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:"classifier_dropout",val:": float = None"},{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/main/en/model_doc/longformer#transformers.LongformerModel">LongformerModel</a> or <a href="/docs/transformers/main/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/main/en/model_doc/longformer#transformers.LongformerModel">LongformerModel</a> or
<a href="/docs/transformers/main/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.classifier_dropout",description:`<strong>classifier_dropout</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The dropout ratio for the classification head.`,name:"classifier_dropout"},{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/main/src/transformers/models/longformer/configuration_longformer.py#L46"}}),dn=new et({props:{anchor:"transformers.LongformerConfig.example",$$slots:{default:[UT]},$$scope:{ctx:E}}}),Ls=new Ze({}),xs=new I({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/main/src/transformers/models/longformer/tokenization_longformer.py#L116"}}),mn=new et({props:{anchor:"transformers.LongformerTokenizer.example",$$slots:{default:[HT]},$$scope:{ctx:E}}}),hn=new Xe({props:{$$slots:{default:[KT]},$$scope:{ctx:E}}}),qs=new I({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/main/src/transformers/models/longformer/tokenization_longformer.py#L353",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>
`}}),Es=new I({props:{name:"convert_tokens_to_string",anchor:"transformers.LongformerTokenizer.convert_tokens_to_string",parameters:[{name:"tokens",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/tokenization_longformer.py#L318"}}),Cs=new I({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/main/src/transformers/models/longformer/tokenization_longformer.py#L405",returnDescription:`
<p>List of zeros.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),js=new I({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/main/src/transformers/models/longformer/tokenization_longformer.py#L378",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>
`}}),Ps=new Ze({}),As=new I({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/main/src/transformers/models/longformer/tokenization_longformer_fast.py#L91"}}),_n=new et({props:{anchor:"transformers.LongformerTokenizerFast.example",$$slots:{default:[RT]},$$scope:{ctx:E}}}),wn=new Xe({props:{$$slots:{default:[VT]},$$scope:{ctx:E}}}),Ss=new I({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/main/src/transformers/models/longformer/tokenization_longformer_fast.py#L301",returnDescription:`
<p>List of zeros.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Bs=new Ze({}),Ws=new I({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/main/src/transformers/models/longformer/modeling_longformer.py#L56"}}),Qs=new I({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/main/src/transformers/models/longformer/modeling_longformer.py#L99"}}),Us=new I({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/main/src/transformers/models/longformer/modeling_longformer.py#L147"}}),Hs=new I({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/main/src/transformers/models/longformer/modeling_longformer.py#L193"}}),Ks=new I({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/main/src/transformers/models/longformer/modeling_longformer.py#L242"}}),Rs=new I({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/main/src/transformers/models/longformer/modeling_longformer.py#L288"}}),Vs=new I({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/main/src/transformers/models/longformer/modeling_longformer.py#L336"}}),Gs=new I({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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L67"}}),Js=new I({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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L110"}}),Ys=new I({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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L158"}}),Xs=new I({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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L204"}}),Zs=new I({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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L253"}}),er=new I({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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L299"}}),tr=new I({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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L347"}}),or=new Ze({}),nr=new I({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/main/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/main/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/main/src/transformers/models/longformer/modeling_longformer.py#L1538"}}),dr=new I({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#L1651",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling"
>transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),yn=new Xe({props:{$$slots:{default:[GT]},$$scope:{ctx:E}}}),Tn=new et({props:{anchor:"transformers.LongformerModel.forward.example",$$slots:{default:[JT]},$$scope:{ctx:E}}}),cr=new Ze({}),mr=new I({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/main/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/main/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/main/src/transformers/models/longformer/modeling_longformer.py#L1775"}}),ur=new I({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/longformer/modeling_longformer.py#L1794",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput"
>transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ln=new Xe({props:{$$slots:{default:[YT]},$$scope:{ctx:E}}}),xn=new et({props:{anchor:"transformers.LongformerForMaskedLM.forward.example",$$slots:{default:[XT]},$$scope:{ctx:E}}}),Fn=new et({props:{anchor:"transformers.LongformerForMaskedLM.forward.example-2",$$slots:{default:[ZT]},$$scope:{ctx:E}}}),_r=new Ze({}),wr=new I({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/main/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/main/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/main/src/transformers/models/longformer/modeling_longformer.py#L1888"}}),yr=new I({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/longformer/modeling_longformer.py#L1903",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput"
>transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),qn=new Xe({props:{$$slots:{default:[e1]},$$scope:{ctx:E}}}),zn=new et({props:{anchor:"transformers.LongformerForSequenceClassification.forward.example",$$slots:{default:[t1]},$$scope:{ctx:E}}}),En=new et({props:{anchor:"transformers.LongformerForSequenceClassification.forward.example-2",$$slots:{default:[o1]},$$scope:{ctx:E}}}),Tr=new Ze({}),$r=new I({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/main/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/main/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/main/src/transformers/models/longformer/modeling_longformer.py#L2245"}}),Mr=new I({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/longformer/modeling_longformer.py#L2256",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput"
>transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),jn=new Xe({props:{$$slots:{default:[n1]},$$scope:{ctx:E}}}),On=new et({props:{anchor:"transformers.LongformerForMultipleChoice.forward.example",$$slots:{default:[s1]},$$scope:{ctx:E}}}),qr=new Ze({}),zr=new I({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/main/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/main/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/main/src/transformers/models/longformer/modeling_longformer.py#L2156"}}),Or=new I({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/longformer/modeling_longformer.py#L2171",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput"
>transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),An=new Xe({props:{$$slots:{default:[r1]},$$scope:{ctx:E}}}),Nn=new et({props:{anchor:"transformers.LongformerForTokenClassification.forward.example",$$slots:{default:[a1]},$$scope:{ctx:E}}}),Pr=new Ze({}),Ar=new I({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/main/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/main/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/main/src/transformers/models/longformer/modeling_longformer.py#L2016"}}),Sr=new I({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/longformer/modeling_longformer.py#L2030",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput"
>transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Dn=new Xe({props:{$$slots:{default:[i1]},$$scope:{ctx:E}}}),Sn=new et({props:{anchor:"transformers.LongformerForQuestionAnswering.forward.example",$$slots:{default:[l1]},$$scope:{ctx:E}}}),Br=new Ze({}),Wr=new I({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/main/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/main/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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2025"}}),Wn=new Xe({props:{$$slots:{default:[d1]},$$scope:{ctx:E}}}),Vr=new I({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2047"}}),Qn=new Xe({props:{$$slots:{default:[c1]},$$scope:{ctx:E}}}),Gr=new Ze({}),Jr=new I({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/main/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/main/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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2098"}}),Hn=new Xe({props:{$$slots:{default:[m1]},$$scope:{ctx:E}}}),ta=new I({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2115",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/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>
`}}),Kn=new Xe({props:{$$slots:{default:[h1]},$$scope:{ctx:E}}}),Rn=new et({props:{anchor:"transformers.TFLongformerForMaskedLM.call.example",$$slots:{default:[p1]},$$scope:{ctx:E}}}),Vn=new et({props:{anchor:"transformers.TFLongformerForMaskedLM.call.example-2",$$slots:{default:[f1]},$$scope:{ctx:E}}}),oa=new Ze({}),na=new I({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/main/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/main/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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2194"}}),Jn=new Xe({props:{$$slots:{default:[g1]},$$scope:{ctx:E}}}),ia=new I({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2209",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/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>
`}}),Yn=new Xe({props:{$$slots:{default:[u1]},$$scope:{ctx:E}}}),Xn=new et({props:{anchor:"transformers.TFLongformerForQuestionAnswering.call.example",$$slots:{default:[_1]},$$scope:{ctx:E}}}),Zn=new et({props:{anchor:"transformers.TFLongformerForQuestionAnswering.call.example-2",$$slots:{default:[w1]},$$scope:{ctx:E}}}),la=new Ze({}),da=new I({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/main/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/main/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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2362"}}),ts=new Xe({props:{$$slots:{default:[k1]},$$scope:{ctx:E}}}),pa=new I({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2374",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/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>
`}}),os=new Xe({props:{$$slots:{default:[b1]},$$scope:{ctx:E}}}),ns=new et({props:{anchor:"transformers.TFLongformerForSequenceClassification.call.example",$$slots:{default:[v1]},$$scope:{ctx:E}}}),ss=new et({props:{anchor:"transformers.TFLongformerForSequenceClassification.call.example-2",$$slots:{default:[y1]},$$scope:{ctx:E}}}),fa=new Ze({}),ga=new I({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/main/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/main/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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2610"}}),as=new Xe({props:{$$slots:{default:[T1]},$$scope:{ctx:E}}}),ka=new I({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2625",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/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>
`}}),is=new Xe({props:{$$slots:{default:[$1]},$$scope:{ctx:E}}}),ls=new et({props:{anchor:"transformers.TFLongformerForTokenClassification.call.example",$$slots:{default:[L1]},$$scope:{ctx:E}}}),ds=new et({props:{anchor:"transformers.TFLongformerForTokenClassification.call.example-2",$$slots:{default:[x1]},$$scope:{ctx:E}}}),ba=new Ze({}),va=new I({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/main/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/main/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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2475"}}),ms=new Xe({props:{$$slots:{default:[F1]},$$scope:{ctx:E}}}),La=new I({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2495",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/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>
`}}),hs=new Xe({props:{$$slots:{default:[M1]},$$scope:{ctx:E}}}),ps=new et({props:{anchor:"transformers.TFLongformerForMultipleChoice.call.example",$$slots:{default:[q1]},$$scope:{ctx:E}}}),{c(){d=r("meta"),k=c(),p=r("h1"),g=r("a"),b=r("span"),v(l.$$.fragment),h=c(),z=r("span"),ie=n("Longformer"),Z=c(),N=r("h2"),te=r("a"),oe=r("span"),v(F.$$.fragment),be=c(),H=r("span"),ve=n("Overview"),ge=c(),S=r("p"),ye=n("The Longformer model was presented in "),me=r("a"),G=n("Longformer: The Long-Document Transformer"),Te=n(" by Iz Beltagy, Matthew E. Peters, Arman Cohan."),ue=c(),W=r("p"),$e=n("The abstract from the paper is the following:"),_e=c(),Q=r("p"),pe=r("em"),Le=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.`),re=c(),C=r("p"),O=n("Tips:"),we=c(),U=r("ul"),ne=r("li"),xe=n("Since the Longformer is based on RoBERTa, it doesn\u2019t have "),K=r("code"),Fe=n("token_type_ids"),Me=n(`. You don\u2019t need to indicate which
token belongs to which segment. Just separate your segments with the separation token `),j=r("code"),qe=n("tokenizer.sep_token"),J=n(` (or
`),fe=r("code"),ze=n("</s>"),Y=n(")."),ke=c(),ae=r("p"),D=n("This model was contributed by "),he=r("a"),X=n("beltagy"),Ee=n(". The Authors\u2019 code can be found "),ee=r("a"),P=n("here"),Ce=n("."),A=c(),le=r("h2"),ce=r("a"),w=r("span"),v(q.$$.fragment),Qe=c(),se=r("span"),Ue=n("Longformer Self Attention"),Ne=c(),M=r("p"),He=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 `),Ie=new tn,De=n(` previous tokens and
`),Se=new tn,R=n(" succeeding tokens with "),Be=new tn,V=n(` being the window length as defined in
`),Pe=r("code"),Ke=n("config.attention_window"),je=n(". Note that "),Ae=r("code"),de=n("config.attention_window"),Re=n(" can be of type "),Ni=r("code"),Ch=n("List"),jh=n(` to define a
different `),oc=new tn,nc=n(` for each layer. A selected few tokens attend \u201Cglobally\u201D to all other tokens, as it is
conventionally done for all tokens in `),Ii=r("code"),Oh=n("BertSelfAttention"),Ph=n("."),sc=c(),It=r("p"),Ah=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 `),rc=new tn,ac=n(`, but also to all \u201Cglobally\u201D
attending tokens so that global attention is `),Di=r("em"),Nh=n("symmetric"),Ih=n("."),ic=c(),Dt=r("p"),Dh=n(`The user can define which tokens attend \u201Clocally\u201D and which tokens attend \u201Cglobally\u201D by setting the tensor
`),Si=r("code"),Sh=n("global_attention_mask"),Bh=n(` at run-time appropriately. All Longformer models employ the following logic for
`),Bi=r("code"),Wh=n("global_attention_mask"),Qh=n(":"),lc=c(),nn=r("ul"),Wi=r("li"),Uh=n("0: the token attends \u201Clocally\u201D,"),Hh=c(),Qi=r("li"),Kh=n("1: the token attends \u201Cglobally\u201D."),dc=c(),sn=r("p"),Rh=n("For more information please also refer to "),Ca=r("a"),Vh=n("forward()"),Gh=n(" method."),cc=c(),kt=r("p"),Jh=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 `),mc=new tn,hc=n(` to
`),pc=new tn,fc=n(", with "),gc=new tn,uc=n(" being the sequence length and "),_c=new tn,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.`),kc=c(),rn=r("p"),Yh=n("For more information, please refer to the official "),ks=r("a"),Xh=n("paper"),Zh=n("."),bc=c(),eo=r("h2"),an=r("a"),Ui=r("span"),v(bs.$$.fragment),ep=c(),Hi=r("span"),tp=n("Training"),vc=c(),to=r("p"),ja=r("a"),op=n("LongformerForMaskedLM"),np=n(" is trained the exact same way "),Oa=r("a"),sp=n("RobertaForMaskedLM"),rp=n(` is
trained and should be used as follows:`),yc=c(),v(vs.$$.fragment),Tc=c(),oo=r("h2"),ln=r("a"),Ki=r("span"),v(ys.$$.fragment),ap=c(),Ri=r("span"),ip=n("LongformerConfig"),$c=c(),pt=r("div"),v(Ts.$$.fragment),lp=c(),no=r("p"),dp=n("This is the configuration class to store the configuration of a "),Pa=r("a"),cp=n("LongformerModel"),mp=n(" or a "),Aa=r("a"),hp=n("TFLongformerModel"),pp=n(`. It
is used to instantiate a Longformer model according to the specified arguments, defining the model architecture.`),fp=c(),so=r("p"),gp=n("This is the configuration class to store the configuration of a "),Na=r("a"),up=n("LongformerModel"),_p=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
`),$s=r("a"),wp=n("allenai/longformer-base-4096"),kp=n(` architecture with a sequence
length 4,096.`),bp=c(),ro=r("p"),vp=n("Configuration objects inherit from "),Ia=r("a"),yp=n("PretrainedConfig"),Tp=n(` and can be used to control the model outputs. Read the
documentation from `),Da=r("a"),$p=n("PretrainedConfig"),Lp=n(" for more information."),xp=c(),v(dn.$$.fragment),Lc=c(),ao=r("h2"),cn=r("a"),Vi=r("span"),v(Ls.$$.fragment),Fp=c(),Gi=r("span"),Mp=n("LongformerTokenizer"),xc=c(),Oe=r("div"),v(xs.$$.fragment),qp=c(),Ji=r("p"),zp=n("Constructs a Longformer tokenizer, derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding."),Ep=c(),Yi=r("p"),Cp=n("This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),jp=c(),v(mn.$$.fragment),Op=c(),Fs=r("p"),Pp=n("You can get around that behavior by passing "),Xi=r("code"),Ap=n("add_prefix_space=True"),Np=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.`),Ip=c(),v(hn.$$.fragment),Dp=c(),Ms=r("p"),Sp=n("This tokenizer inherits from "),Sa=r("a"),Bp=n("PreTrainedTokenizer"),Wp=n(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Qp=c(),St=r("div"),v(qs.$$.fragment),Up=c(),Zi=r("p"),Hp=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:`),Kp=c(),zs=r("ul"),Ba=r("li"),Rp=n("single sequence: "),el=r("code"),Vp=n("<s> X </s>"),Gp=c(),Wa=r("li"),Jp=n("pair of sequences: "),tl=r("code"),Yp=n("<s> A </s></s> B </s>"),Xp=c(),pn=r("div"),v(Es.$$.fragment),Zp=c(),ol=r("p"),ef=n("Converts a sequence of tokens (string) in a single string."),tf=c(),fn=r("div"),v(Cs.$$.fragment),of=c(),nl=r("p"),nf=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.`),sf=c(),gn=r("div"),v(js.$$.fragment),rf=c(),Os=r("p"),af=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 `),sl=r("code"),lf=n("prepare_for_model"),df=n(" method."),Fc=c(),io=r("h2"),un=r("a"),rl=r("span"),v(Ps.$$.fragment),cf=c(),al=r("span"),mf=n("LongformerTokenizerFast"),Mc=c(),Ve=r("div"),v(As.$$.fragment),hf=c(),Ns=r("p"),pf=n("Construct a \u201Cfast\u201D Longformer tokenizer (backed by HuggingFace\u2019s "),il=r("em"),ff=n("tokenizers"),gf=n(` library), derived from the GPT-2
tokenizer, using byte-level Byte-Pair-Encoding.`),uf=c(),ll=r("p"),_f=n("This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),wf=c(),v(_n.$$.fragment),kf=c(),Is=r("p"),bf=n("You can get around that behavior by passing "),dl=r("code"),vf=n("add_prefix_space=True"),yf=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.`),Tf=c(),v(wn.$$.fragment),$f=c(),Ds=r("p"),Lf=n("This tokenizer inherits from "),Qa=r("a"),xf=n("PreTrainedTokenizerFast"),Ff=n(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Mf=c(),kn=r("div"),v(Ss.$$.fragment),qf=c(),cl=r("p"),zf=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.`),qc=c(),lo=r("h2"),bn=r("a"),ml=r("span"),v(Bs.$$.fragment),Ef=c(),hl=r("span"),Cf=n("Longformer specific outputs"),zc=c(),co=r("div"),v(Ws.$$.fragment),jf=c(),pl=r("p"),Of=n("Base class for Longformer\u2019s outputs, with potential hidden states, local and global attentions."),Ec=c(),mo=r("div"),v(Qs.$$.fragment),Pf=c(),fl=r("p"),Af=n("Base class for Longformer\u2019s outputs that also contains a pooling of the last hidden states."),Cc=c(),ho=r("div"),v(Us.$$.fragment),Nf=c(),gl=r("p"),If=n("Base class for masked language models outputs."),jc=c(),po=r("div"),v(Hs.$$.fragment),Df=c(),ul=r("p"),Sf=n("Base class for outputs of question answering Longformer models."),Oc=c(),fo=r("div"),v(Ks.$$.fragment),Bf=c(),_l=r("p"),Wf=n("Base class for outputs of sentence classification models."),Pc=c(),go=r("div"),v(Rs.$$.fragment),Qf=c(),wl=r("p"),Uf=n("Base class for outputs of multiple choice Longformer models."),Ac=c(),uo=r("div"),v(Vs.$$.fragment),Hf=c(),kl=r("p"),Kf=n("Base class for outputs of token classification models."),Nc=c(),_o=r("div"),v(Gs.$$.fragment),Rf=c(),bl=r("p"),Vf=n("Base class for Longformer\u2019s outputs, with potential hidden states, local and global attentions."),Ic=c(),wo=r("div"),v(Js.$$.fragment),Gf=c(),vl=r("p"),Jf=n("Base class for Longformer\u2019s outputs that also contains a pooling of the last hidden states."),Dc=c(),ko=r("div"),v(Ys.$$.fragment),Yf=c(),yl=r("p"),Xf=n("Base class for masked language models outputs."),Sc=c(),bo=r("div"),v(Xs.$$.fragment),Zf=c(),Tl=r("p"),eg=n("Base class for outputs of question answering Longformer models."),Bc=c(),vo=r("div"),v(Zs.$$.fragment),tg=c(),$l=r("p"),og=n("Base class for outputs of sentence classification models."),Wc=c(),yo=r("div"),v(er.$$.fragment),ng=c(),Ll=r("p"),sg=n("Base class for outputs of multiple choice models."),Qc=c(),To=r("div"),v(tr.$$.fragment),rg=c(),xl=r("p"),ag=n("Base class for outputs of token classification models."),Uc=c(),$o=r("h2"),vn=r("a"),Fl=r("span"),v(or.$$.fragment),ig=c(),Ml=r("span"),lg=n("LongformerModel"),Hc=c(),st=r("div"),v(nr.$$.fragment),dg=c(),ql=r("p"),cg=n("The bare Longformer Model outputting raw hidden-states without any specific head on top."),mg=c(),sr=r("p"),hg=n("This model inherits from "),Ua=r("a"),pg=n("PreTrainedModel"),fg=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.)`),gg=c(),rr=r("p"),ug=n("This model is also a PyTorch "),ar=r("a"),_g=n("torch.nn.Module"),wg=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),kg=c(),Lo=r("p"),bg=n("This class copied code from "),Ha=r("a"),vg=n("RobertaModel"),yg=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 `),ir=r("a"),Tg=n(`Longformer:
the Long-Document Transformer`),$g=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.`),Lg=c(),lr=r("p"),xg=n("The self-attention module "),zl=r("code"),Fg=n("LongformerSelfAttention"),Mg=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.`),qg=c(),xt=r("div"),v(dr.$$.fragment),zg=c(),xo=r("p"),Eg=n("The "),Ka=r("a"),Cg=n("LongformerModel"),jg=n(" forward method, overrides the "),El=r("code"),Og=n("__call__"),Pg=n(" special method."),Ag=c(),v(yn.$$.fragment),Ng=c(),v(Tn.$$.fragment),Kc=c(),Fo=r("h2"),$n=r("a"),Cl=r("span"),v(cr.$$.fragment),Ig=c(),jl=r("span"),Dg=n("LongformerForMaskedLM"),Rc=c(),ft=r("div"),v(mr.$$.fragment),Sg=c(),hr=r("p"),Bg=n("Longformer Model with a "),Ol=r("code"),Wg=n("language modeling"),Qg=n(" head on top."),Ug=c(),pr=r("p"),Hg=n("This model inherits from "),Ra=r("a"),Kg=n("PreTrainedModel"),Rg=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.)`),Vg=c(),fr=r("p"),Gg=n("This model is also a PyTorch "),gr=r("a"),Jg=n("torch.nn.Module"),Yg=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Xg=c(),ct=r("div"),v(ur.$$.fragment),Zg=c(),Mo=r("p"),eu=n("The "),Va=r("a"),tu=n("LongformerForMaskedLM"),ou=n(" forward method, overrides the "),Pl=r("code"),nu=n("__call__"),su=n(" special method."),ru=c(),v(Ln.$$.fragment),au=c(),v(xn.$$.fragment),iu=c(),Al=r("p"),lu=n("Let\u2019s try a very long input."),du=c(),v(Fn.$$.fragment),Vc=c(),qo=r("h2"),Mn=r("a"),Nl=r("span"),v(_r.$$.fragment),cu=c(),Il=r("span"),mu=n("LongformerForSequenceClassification"),Gc=c(),gt=r("div"),v(wr.$$.fragment),hu=c(),Dl=r("p"),pu=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.`),fu=c(),kr=r("p"),gu=n("This model inherits from "),Ga=r("a"),uu=n("PreTrainedModel"),_u=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.)`),wu=c(),br=r("p"),ku=n("This model is also a PyTorch "),vr=r("a"),bu=n("torch.nn.Module"),vu=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),yu=c(),bt=r("div"),v(yr.$$.fragment),Tu=c(),zo=r("p"),$u=n("The "),Ja=r("a"),Lu=n("LongformerForSequenceClassification"),xu=n(" forward method, overrides the "),Sl=r("code"),Fu=n("__call__"),Mu=n(" special method."),qu=c(),v(qn.$$.fragment),zu=c(),v(zn.$$.fragment),Eu=c(),v(En.$$.fragment),Jc=c(),Eo=r("h2"),Cn=r("a"),Bl=r("span"),v(Tr.$$.fragment),Cu=c(),Wl=r("span"),ju=n("LongformerForMultipleChoice"),Yc=c(),ut=r("div"),v($r.$$.fragment),Ou=c(),Ql=r("p"),Pu=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.`),Au=c(),Lr=r("p"),Nu=n("This model inherits from "),Ya=r("a"),Iu=n("PreTrainedModel"),Du=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(),xr=r("p"),Bu=n("This model is also a PyTorch "),Fr=r("a"),Wu=n("torch.nn.Module"),Qu=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Uu=c(),Ft=r("div"),v(Mr.$$.fragment),Hu=c(),Co=r("p"),Ku=n("The "),Xa=r("a"),Ru=n("LongformerForMultipleChoice"),Vu=n(" forward method, overrides the "),Ul=r("code"),Gu=n("__call__"),Ju=n(" special method."),Yu=c(),v(jn.$$.fragment),Xu=c(),v(On.$$.fragment),Xc=c(),jo=r("h2"),Pn=r("a"),Hl=r("span"),v(qr.$$.fragment),Zu=c(),Kl=r("span"),e_=n("LongformerForTokenClassification"),Zc=c(),_t=r("div"),v(zr.$$.fragment),t_=c(),Rl=r("p"),o_=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.`),n_=c(),Er=r("p"),s_=n("This model inherits from "),Za=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(),Cr=r("p"),l_=n("This model is also a PyTorch "),jr=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.`),m_=c(),Mt=r("div"),v(Or.$$.fragment),h_=c(),Oo=r("p"),p_=n("The "),ei=r("a"),f_=n("LongformerForTokenClassification"),g_=n(" forward method, overrides the "),Vl=r("code"),u_=n("__call__"),__=n(" special method."),w_=c(),v(An.$$.fragment),k_=c(),v(Nn.$$.fragment),em=c(),Po=r("h2"),In=r("a"),Gl=r("span"),v(Pr.$$.fragment),b_=c(),Jl=r("span"),v_=n("LongformerForQuestionAnswering"),tm=c(),wt=r("div"),v(Ar.$$.fragment),y_=c(),Ao=r("p"),T_=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 `),Yl=r("code"),$_=n("span start logits"),L_=n(" and "),Xl=r("code"),x_=n("span end logits"),F_=n(")."),M_=c(),Nr=r("p"),q_=n("This model inherits from "),ti=r("a"),z_=n("PreTrainedModel"),E_=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.)`),C_=c(),Ir=r("p"),j_=n("This model is also a PyTorch "),Dr=r("a"),O_=n("torch.nn.Module"),P_=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),A_=c(),qt=r("div"),v(Sr.$$.fragment),N_=c(),No=r("p"),I_=n("The "),oi=r("a"),D_=n("LongformerForQuestionAnswering"),S_=n(" forward method, overrides the "),Zl=r("code"),B_=n("__call__"),W_=n(" special method."),Q_=c(),v(Dn.$$.fragment),U_=c(),v(Sn.$$.fragment),om=c(),Io=r("h2"),Bn=r("a"),ed=r("span"),v(Br.$$.fragment),H_=c(),td=r("span"),K_=n("TFLongformerModel"),nm=c(),Ge=r("div"),v(Wr.$$.fragment),R_=c(),od=r("p"),V_=n("The bare Longformer Model outputting raw hidden-states without any specific head on top."),G_=c(),Qr=r("p"),J_=n("This model inherits from "),ni=r("a"),Y_=n("TFPreTrainedModel"),X_=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.)`),Z_=c(),Ur=r("p"),ew=n("This model is also a "),Hr=r("a"),tw=n("tf.keras.Model"),ow=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.`),nw=c(),v(Wn.$$.fragment),sw=c(),Do=r("p"),rw=n("This class copies code from "),si=r("a"),aw=n("TFRobertaModel"),iw=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
`),Kr=r("a"),lw=n("Longformer: the Long-Document Transformer"),dw=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.`),cw=c(),Rr=r("p"),mw=n("The self-attention module "),nd=r("code"),hw=n("TFLongformerSelfAttention"),pw=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.`),fw=c(),Bt=r("div"),v(Vr.$$.fragment),gw=c(),So=r("p"),uw=n("The "),ri=r("a"),_w=n("TFLongformerModel"),ww=n(" forward method, overrides the "),sd=r("code"),kw=n("__call__"),bw=n(" special method."),vw=c(),v(Qn.$$.fragment),sm=c(),Bo=r("h2"),Un=r("a"),rd=r("span"),v(Gr.$$.fragment),yw=c(),ad=r("span"),Tw=n("TFLongformerForMaskedLM"),rm=c(),rt=r("div"),v(Jr.$$.fragment),$w=c(),Yr=r("p"),Lw=n("Longformer Model with a "),id=r("code"),xw=n("language modeling"),Fw=n(" head on top."),Mw=c(),Xr=r("p"),qw=n("This model inherits from "),ai=r("a"),zw=n("TFPreTrainedModel"),Ew=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.)`),Cw=c(),Zr=r("p"),jw=n("This model is also a "),ea=r("a"),Ow=n("tf.keras.Model"),Pw=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.`),Aw=c(),v(Hn.$$.fragment),Nw=c(),vt=r("div"),v(ta.$$.fragment),Iw=c(),Wo=r("p"),Dw=n("The "),ii=r("a"),Sw=n("TFLongformerForMaskedLM"),Bw=n(" forward method, overrides the "),ld=r("code"),Ww=n("__call__"),Qw=n(" special method."),Uw=c(),v(Kn.$$.fragment),Hw=c(),v(Rn.$$.fragment),Kw=c(),v(Vn.$$.fragment),am=c(),Qo=r("h2"),Gn=r("a"),dd=r("span"),v(oa.$$.fragment),Rw=c(),cd=r("span"),Vw=n("TFLongformerForQuestionAnswering"),im=c(),at=r("div"),v(na.$$.fragment),Gw=c(),Uo=r("p"),Jw=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 `),md=r("code"),Yw=n("span start logits"),Xw=n(" and "),hd=r("code"),Zw=n("span end logits"),ek=n(")."),tk=c(),sa=r("p"),ok=n("This model inherits from "),li=r("a"),nk=n("TFPreTrainedModel"),sk=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.)`),rk=c(),ra=r("p"),ak=n("This model is also a "),aa=r("a"),ik=n("tf.keras.Model"),lk=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.`),dk=c(),v(Jn.$$.fragment),ck=c(),yt=r("div"),v(ia.$$.fragment),mk=c(),Ho=r("p"),hk=n("The "),di=r("a"),pk=n("TFLongformerForQuestionAnswering"),fk=n(" forward method, overrides the "),pd=r("code"),gk=n("__call__"),uk=n(" special method."),_k=c(),v(Yn.$$.fragment),wk=c(),v(Xn.$$.fragment),kk=c(),v(Zn.$$.fragment),lm=c(),Ko=r("h2"),es=r("a"),fd=r("span"),v(la.$$.fragment),bk=c(),gd=r("span"),vk=n("TFLongformerForSequenceClassification"),dm=c(),it=r("div"),v(da.$$.fragment),yk=c(),ud=r("p"),Tk=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.`),$k=c(),ca=r("p"),Lk=n("This model inherits from "),ci=r("a"),xk=n("TFPreTrainedModel"),Fk=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.)`),Mk=c(),ma=r("p"),qk=n("This model is also a "),ha=r("a"),zk=n("tf.keras.Model"),Ek=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.`),Ck=c(),v(ts.$$.fragment),jk=c(),Tt=r("div"),v(pa.$$.fragment),Ok=c(),Ro=r("p"),Pk=n("The "),mi=r("a"),Ak=n("TFLongformerForSequenceClassification"),Nk=n(" forward method, overrides the "),_d=r("code"),Ik=n("__call__"),Dk=n(" special method."),Sk=c(),v(os.$$.fragment),Bk=c(),v(ns.$$.fragment),Wk=c(),v(ss.$$.fragment),cm=c(),Vo=r("h2"),rs=r("a"),wd=r("span"),v(fa.$$.fragment),Qk=c(),kd=r("span"),Uk=n("TFLongformerForTokenClassification"),mm=c(),lt=r("div"),v(ga.$$.fragment),Hk=c(),bd=r("p"),Kk=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.`),Rk=c(),ua=r("p"),Vk=n("This model inherits from "),hi=r("a"),Gk=n("TFPreTrainedModel"),Jk=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.)`),Yk=c(),_a=r("p"),Xk=n("This model is also a "),wa=r("a"),Zk=n("tf.keras.Model"),eb=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.`),tb=c(),v(as.$$.fragment),ob=c(),$t=r("div"),v(ka.$$.fragment),nb=c(),Go=r("p"),sb=n("The "),pi=r("a"),rb=n("TFLongformerForTokenClassification"),ab=n(" forward method, overrides the "),vd=r("code"),ib=n("__call__"),lb=n(" special method."),db=c(),v(is.$$.fragment),cb=c(),v(ls.$$.fragment),mb=c(),v(ds.$$.fragment),hm=c(),Jo=r("h2"),cs=r("a"),yd=r("span"),v(ba.$$.fragment),hb=c(),Td=r("span"),pb=n("TFLongformerForMultipleChoice"),pm=c(),dt=r("div"),v(va.$$.fragment),fb=c(),$d=r("p"),gb=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.`),ub=c(),ya=r("p"),_b=n("This model inherits from "),fi=r("a"),wb=n("TFPreTrainedModel"),kb=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.)`),bb=c(),Ta=r("p"),vb=n("This model is also a "),$a=r("a"),yb=n("tf.keras.Model"),Tb=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.`),$b=c(),v(ms.$$.fragment),Lb=c(),zt=r("div"),v(La.$$.fragment),xb=c(),Yo=r("p"),Fb=n("The "),gi=r("a"),Mb=n("TFLongformerForMultipleChoice"),qb=n(" forward method, overrides the "),Ld=r("code"),zb=n("__call__"),Eb=n(" special method."),Cb=c(),v(hs.$$.fragment),jb=c(),v(ps.$$.fragment),this.h()},l(o){const _=WT('[data-svelte="svelte-1phssyn"]',document.head);d=a(_,"META",{name:!0,content:!0}),_.forEach(t),k=m(o),p=a(o,"H1",{class:!0});var xa=i(p);g=a(xa,"A",{id:!0,class:!0,href:!0});var xd=i(g);b=a(xd,"SPAN",{});var Fd=i(b);y(l.$$.fragment,Fd),Fd.forEach(t),xd.forEach(t),h=m(xa),z=a(xa,"SPAN",{});var Md=i(z);ie=s(Md,"Longformer"),Md.forEach(t),xa.forEach(t),Z=m(o),N=a(o,"H2",{class:!0});var Fa=i(N);te=a(Fa,"A",{id:!0,class:!0,href:!0});var qd=i(te);oe=a(qd,"SPAN",{});var zd=i(oe);y(F.$$.fragment,zd),zd.forEach(t),qd.forEach(t),be=m(Fa),H=a(Fa,"SPAN",{});var Ed=i(H);ve=s(Ed,"Overview"),Ed.forEach(t),Fa.forEach(t),ge=m(o),S=a(o,"P",{});var Ma=i(S);ye=s(Ma,"The Longformer model was presented in "),me=a(Ma,"A",{href:!0,rel:!0});var Cd=i(me);G=s(Cd,"Longformer: The Long-Document Transformer"),Cd.forEach(t),Te=s(Ma," by Iz Beltagy, Matthew E. Peters, Arman Cohan."),Ma.forEach(t),ue=m(o),W=a(o,"P",{});var jd=i(W);$e=s(jd,"The abstract from the paper is the following:"),jd.forEach(t),_e=m(o),Q=a(o,"P",{});var Od=i(Q);pe=a(Od,"EM",{});var Pd=i(pe);Le=s(Pd,`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.`),Pd.forEach(t),Od.forEach(t),re=m(o),C=a(o,"P",{});var Ad=i(C);O=s(Ad,"Tips:"),Ad.forEach(t),we=m(o),U=a(o,"UL",{});var Nd=i(U);ne=a(Nd,"LI",{});var Nt=i(ne);xe=s(Nt,"Since the Longformer is based on RoBERTa, it doesn\u2019t have "),K=a(Nt,"CODE",{});var Id=i(K);Fe=s(Id,"token_type_ids"),Id.forEach(t),Me=s(Nt,`. You don\u2019t need to indicate which
token belongs to which segment. Just separate your segments with the separation token `),j=a(Nt,"CODE",{});var Dd=i(j);qe=s(Dd,"tokenizer.sep_token"),Dd.forEach(t),J=s(Nt,` (or
`),fe=a(Nt,"CODE",{});var Sd=i(fe);ze=s(Sd,"</s>"),Sd.forEach(t),Y=s(Nt,")."),Nt.forEach(t),Nd.forEach(t),ke=m(o),ae=a(o,"P",{});var Xo=i(ae);D=s(Xo,"This model was contributed by "),he=a(Xo,"A",{href:!0,rel:!0});var Bd=i(he);X=s(Bd,"beltagy"),Bd.forEach(t),Ee=s(Xo,". The Authors\u2019 code can be found "),ee=a(Xo,"A",{href:!0,rel:!0});var Wd=i(ee);P=s(Wd,"here"),Wd.forEach(t),Ce=s(Xo,"."),Xo.forEach(t),A=m(o),le=a(o,"H2",{class:!0});var qa=i(le);ce=a(qa,"A",{id:!0,class:!0,href:!0});var Qd=i(ce);w=a(Qd,"SPAN",{});var Ud=i(w);y(q.$$.fragment,Ud),Ud.forEach(t),Qd.forEach(t),Qe=m(qa),se=a(qa,"SPAN",{});var Hd=i(se);Ue=s(Hd,"Longformer Self Attention"),Hd.forEach(t),qa.forEach(t),Ne=m(o),M=a(o,"P",{});var Je=i(M);He=s(Je,`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 `),Ie=on(Je),De=s(Je,` previous tokens and
`),Se=on(Je),R=s(Je," succeeding tokens with "),Be=on(Je),V=s(Je,` being the window length as defined in
`),Pe=a(Je,"CODE",{});var Kd=i(Pe);Ke=s(Kd,"config.attention_window"),Kd.forEach(t),je=s(Je,". Note that "),Ae=a(Je,"CODE",{});var Rd=i(Ae);de=s(Rd,"config.attention_window"),Rd.forEach(t),Re=s(Je," can be of type "),Ni=a(Je,"CODE",{});var Vd=i(Ni);Ch=s(Vd,"List"),Vd.forEach(t),jh=s(Je,` to define a
different `),oc=on(Je),nc=s(Je,` for each layer. A selected few tokens attend \u201Cglobally\u201D to all other tokens, as it is
conventionally done for all tokens in `),Ii=a(Je,"CODE",{});var Gd=i(Ii);Oh=s(Gd,"BertSelfAttention"),Gd.forEach(t),Ph=s(Je,"."),Je.forEach(t),sc=m(o),It=a(o,"P",{});var Zo=i(It);Ah=s(Zo,`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 `),rc=on(Zo),ac=s(Zo,`, but also to all \u201Cglobally\u201D
attending tokens so that global attention is `),Di=a(Zo,"EM",{});var Jd=i(Di);Nh=s(Jd,"symmetric"),Jd.forEach(t),Ih=s(Zo,"."),Zo.forEach(t),ic=m(o),Dt=a(o,"P",{});var en=i(Dt);Dh=s(en,`The user can define which tokens attend \u201Clocally\u201D and which tokens attend \u201Cglobally\u201D by setting the tensor
`),Si=a(en,"CODE",{});var Yd=i(Si);Sh=s(Yd,"global_attention_mask"),Yd.forEach(t),Bh=s(en,` at run-time appropriately. All Longformer models employ the following logic for
`),Bi=a(en,"CODE",{});var Xd=i(Bi);Wh=s(Xd,"global_attention_mask"),Xd.forEach(t),Qh=s(en,":"),en.forEach(t),lc=m(o),nn=a(o,"UL",{});var za=i(nn);Wi=a(za,"LI",{});var Zd=i(Wi);Uh=s(Zd,"0: the token attends \u201Clocally\u201D,"),Zd.forEach(t),Hh=m(za),Qi=a(za,"LI",{});var ec=i(Qi);Kh=s(ec,"1: the token attends \u201Cglobally\u201D."),ec.forEach(t),za.forEach(t),dc=m(o),sn=a(o,"P",{});var Ea=i(sn);Rh=s(Ea,"For more information please also refer to "),Ca=a(Ea,"A",{href:!0});var Ab=i(Ca);Vh=s(Ab,"forward()"),Ab.forEach(t),Gh=s(Ea," method."),Ea.forEach(t),cc=m(o),kt=a(o,"P",{});var Wt=i(kt);Jh=s(Wt,`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 `),mc=on(Wt),hc=s(Wt,` to
`),pc=on(Wt),fc=s(Wt,", with "),gc=on(Wt),uc=s(Wt," being the sequence length and "),_c=on(Wt),wc=s(Wt,` 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.`),Wt.forEach(t),kc=m(o),rn=a(o,"P",{});var gm=i(rn);Yh=s(gm,"For more information, please refer to the official "),ks=a(gm,"A",{href:!0,rel:!0});var Nb=i(ks);Xh=s(Nb,"paper"),Nb.forEach(t),Zh=s(gm,"."),gm.forEach(t),bc=m(o),eo=a(o,"H2",{class:!0});var um=i(eo);an=a(um,"A",{id:!0,class:!0,href:!0});var Ib=i(an);Ui=a(Ib,"SPAN",{});var Db=i(Ui);y(bs.$$.fragment,Db),Db.forEach(t),Ib.forEach(t),ep=m(um),Hi=a(um,"SPAN",{});var Sb=i(Hi);tp=s(Sb,"Training"),Sb.forEach(t),um.forEach(t),vc=m(o),to=a(o,"P",{});var tc=i(to);ja=a(tc,"A",{href:!0});var Bb=i(ja);op=s(Bb,"LongformerForMaskedLM"),Bb.forEach(t),np=s(tc," is trained the exact same way "),Oa=a(tc,"A",{href:!0});var Wb=i(Oa);sp=s(Wb,"RobertaForMaskedLM"),Wb.forEach(t),rp=s(tc,` is
trained and should be used as follows:`),tc.forEach(t),yc=m(o),y(vs.$$.fragment,o),Tc=m(o),oo=a(o,"H2",{class:!0});var _m=i(oo);ln=a(_m,"A",{id:!0,class:!0,href:!0});var Qb=i(ln);Ki=a(Qb,"SPAN",{});var Ub=i(Ki);y(ys.$$.fragment,Ub),Ub.forEach(t),Qb.forEach(t),ap=m(_m),Ri=a(_m,"SPAN",{});var Hb=i(Ri);ip=s(Hb,"LongformerConfig"),Hb.forEach(t),_m.forEach(t),$c=m(o),pt=a(o,"DIV",{class:!0});var Qt=i(pt);y(Ts.$$.fragment,Qt),lp=m(Qt),no=a(Qt,"P",{});var ui=i(no);dp=s(ui,"This is the configuration class to store the configuration of a "),Pa=a(ui,"A",{href:!0});var Kb=i(Pa);cp=s(Kb,"LongformerModel"),Kb.forEach(t),mp=s(ui," or a "),Aa=a(ui,"A",{href:!0});var Rb=i(Aa);hp=s(Rb,"TFLongformerModel"),Rb.forEach(t),pp=s(ui,`. It
is used to instantiate a Longformer model according to the specified arguments, defining the model architecture.`),ui.forEach(t),fp=m(Qt),so=a(Qt,"P",{});var _i=i(so);gp=s(_i,"This is the configuration class to store the configuration of a "),Na=a(_i,"A",{href:!0});var Vb=i(Na);up=s(Vb,"LongformerModel"),Vb.forEach(t),_p=s(_i,`. 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
`),$s=a(_i,"A",{href:!0,rel:!0});var Gb=i($s);wp=s(Gb,"allenai/longformer-base-4096"),Gb.forEach(t),kp=s(_i,` architecture with a sequence
length 4,096.`),_i.forEach(t),bp=m(Qt),ro=a(Qt,"P",{});var wi=i(ro);vp=s(wi,"Configuration objects inherit from "),Ia=a(wi,"A",{href:!0});var Jb=i(Ia);yp=s(Jb,"PretrainedConfig"),Jb.forEach(t),Tp=s(wi,` and can be used to control the model outputs. Read the
documentation from `),Da=a(wi,"A",{href:!0});var Yb=i(Da);$p=s(Yb,"PretrainedConfig"),Yb.forEach(t),Lp=s(wi," for more information."),wi.forEach(t),xp=m(Qt),y(dn.$$.fragment,Qt),Qt.forEach(t),Lc=m(o),ao=a(o,"H2",{class:!0});var wm=i(ao);cn=a(wm,"A",{id:!0,class:!0,href:!0});var Xb=i(cn);Vi=a(Xb,"SPAN",{});var Zb=i(Vi);y(Ls.$$.fragment,Zb),Zb.forEach(t),Xb.forEach(t),Fp=m(wm),Gi=a(wm,"SPAN",{});var ev=i(Gi);Mp=s(ev,"LongformerTokenizer"),ev.forEach(t),wm.forEach(t),xc=m(o),Oe=a(o,"DIV",{class:!0});var We=i(Oe);y(xs.$$.fragment,We),qp=m(We),Ji=a(We,"P",{});var tv=i(Ji);zp=s(tv,"Constructs a Longformer tokenizer, derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding."),tv.forEach(t),Ep=m(We),Yi=a(We,"P",{});var ov=i(Yi);Cp=s(ov,"This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),ov.forEach(t),jp=m(We),y(mn.$$.fragment,We),Op=m(We),Fs=a(We,"P",{});var km=i(Fs);Pp=s(km,"You can get around that behavior by passing "),Xi=a(km,"CODE",{});var nv=i(Xi);Ap=s(nv,"add_prefix_space=True"),nv.forEach(t),Np=s(km,` 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.`),km.forEach(t),Ip=m(We),y(hn.$$.fragment,We),Dp=m(We),Ms=a(We,"P",{});var bm=i(Ms);Sp=s(bm,"This tokenizer inherits from "),Sa=a(bm,"A",{href:!0});var sv=i(Sa);Bp=s(sv,"PreTrainedTokenizer"),sv.forEach(t),Wp=s(bm,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),bm.forEach(t),Qp=m(We),St=a(We,"DIV",{class:!0});var ki=i(St);y(qs.$$.fragment,ki),Up=m(ki),Zi=a(ki,"P",{});var rv=i(Zi);Hp=s(rv,`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:`),rv.forEach(t),Kp=m(ki),zs=a(ki,"UL",{});var vm=i(zs);Ba=a(vm,"LI",{});var Ob=i(Ba);Rp=s(Ob,"single sequence: "),el=a(Ob,"CODE",{});var av=i(el);Vp=s(av,"<s> X </s>"),av.forEach(t),Ob.forEach(t),Gp=m(vm),Wa=a(vm,"LI",{});var Pb=i(Wa);Jp=s(Pb,"pair of sequences: "),tl=a(Pb,"CODE",{});var iv=i(tl);Yp=s(iv,"<s> A </s></s> B </s>"),iv.forEach(t),Pb.forEach(t),vm.forEach(t),ki.forEach(t),Xp=m(We),pn=a(We,"DIV",{class:!0});var ym=i(pn);y(Es.$$.fragment,ym),Zp=m(ym),ol=a(ym,"P",{});var lv=i(ol);ef=s(lv,"Converts a sequence of tokens (string) in a single string."),lv.forEach(t),ym.forEach(t),tf=m(We),fn=a(We,"DIV",{class:!0});var Tm=i(fn);y(Cs.$$.fragment,Tm),of=m(Tm),nl=a(Tm,"P",{});var dv=i(nl);nf=s(dv,`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.`),dv.forEach(t),Tm.forEach(t),sf=m(We),gn=a(We,"DIV",{class:!0});var $m=i(gn);y(js.$$.fragment,$m),rf=m($m),Os=a($m,"P",{});var Lm=i(Os);af=s(Lm,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),sl=a(Lm,"CODE",{});var cv=i(sl);lf=s(cv,"prepare_for_model"),cv.forEach(t),df=s(Lm," method."),Lm.forEach(t),$m.forEach(t),We.forEach(t),Fc=m(o),io=a(o,"H2",{class:!0});var xm=i(io);un=a(xm,"A",{id:!0,class:!0,href:!0});var mv=i(un);rl=a(mv,"SPAN",{});var hv=i(rl);y(Ps.$$.fragment,hv),hv.forEach(t),mv.forEach(t),cf=m(xm),al=a(xm,"SPAN",{});var pv=i(al);mf=s(pv,"LongformerTokenizerFast"),pv.forEach(t),xm.forEach(t),Mc=m(o),Ve=a(o,"DIV",{class:!0});var mt=i(Ve);y(As.$$.fragment,mt),hf=m(mt),Ns=a(mt,"P",{});var Fm=i(Ns);pf=s(Fm,"Construct a \u201Cfast\u201D Longformer tokenizer (backed by HuggingFace\u2019s "),il=a(Fm,"EM",{});var fv=i(il);ff=s(fv,"tokenizers"),fv.forEach(t),gf=s(Fm,` library), derived from the GPT-2
tokenizer, using byte-level Byte-Pair-Encoding.`),Fm.forEach(t),uf=m(mt),ll=a(mt,"P",{});var gv=i(ll);_f=s(gv,"This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),gv.forEach(t),wf=m(mt),y(_n.$$.fragment,mt),kf=m(mt),Is=a(mt,"P",{});var Mm=i(Is);bf=s(Mm,"You can get around that behavior by passing "),dl=a(Mm,"CODE",{});var uv=i(dl);vf=s(uv,"add_prefix_space=True"),uv.forEach(t),yf=s(Mm,` 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.`),Mm.forEach(t),Tf=m(mt),y(wn.$$.fragment,mt),$f=m(mt),Ds=a(mt,"P",{});var qm=i(Ds);Lf=s(qm,"This tokenizer inherits from "),Qa=a(qm,"A",{href:!0});var _v=i(Qa);xf=s(_v,"PreTrainedTokenizerFast"),_v.forEach(t),Ff=s(qm,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),qm.forEach(t),Mf=m(mt),kn=a(mt,"DIV",{class:!0});var zm=i(kn);y(Ss.$$.fragment,zm),qf=m(zm),cl=a(zm,"P",{});var wv=i(cl);zf=s(wv,`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.`),wv.forEach(t),zm.forEach(t),mt.forEach(t),qc=m(o),lo=a(o,"H2",{class:!0});var Em=i(lo);bn=a(Em,"A",{id:!0,class:!0,href:!0});var kv=i(bn);ml=a(kv,"SPAN",{});var bv=i(ml);y(Bs.$$.fragment,bv),bv.forEach(t),kv.forEach(t),Ef=m(Em),hl=a(Em,"SPAN",{});var vv=i(hl);Cf=s(vv,"Longformer specific outputs"),vv.forEach(t),Em.forEach(t),zc=m(o),co=a(o,"DIV",{class:!0});var Cm=i(co);y(Ws.$$.fragment,Cm),jf=m(Cm),pl=a(Cm,"P",{});var yv=i(pl);Of=s(yv,"Base class for Longformer\u2019s outputs, with potential hidden states, local and global attentions."),yv.forEach(t),Cm.forEach(t),Ec=m(o),mo=a(o,"DIV",{class:!0});var jm=i(mo);y(Qs.$$.fragment,jm),Pf=m(jm),fl=a(jm,"P",{});var Tv=i(fl);Af=s(Tv,"Base class for Longformer\u2019s outputs that also contains a pooling of the last hidden states."),Tv.forEach(t),jm.forEach(t),Cc=m(o),ho=a(o,"DIV",{class:!0});var Om=i(ho);y(Us.$$.fragment,Om),Nf=m(Om),gl=a(Om,"P",{});var $v=i(gl);If=s($v,"Base class for masked language models outputs."),$v.forEach(t),Om.forEach(t),jc=m(o),po=a(o,"DIV",{class:!0});var Pm=i(po);y(Hs.$$.fragment,Pm),Df=m(Pm),ul=a(Pm,"P",{});var Lv=i(ul);Sf=s(Lv,"Base class for outputs of question answering Longformer models."),Lv.forEach(t),Pm.forEach(t),Oc=m(o),fo=a(o,"DIV",{class:!0});var Am=i(fo);y(Ks.$$.fragment,Am),Bf=m(Am),_l=a(Am,"P",{});var xv=i(_l);Wf=s(xv,"Base class for outputs of sentence classification models."),xv.forEach(t),Am.forEach(t),Pc=m(o),go=a(o,"DIV",{class:!0});var Nm=i(go);y(Rs.$$.fragment,Nm),Qf=m(Nm),wl=a(Nm,"P",{});var Fv=i(wl);Uf=s(Fv,"Base class for outputs of multiple choice Longformer models."),Fv.forEach(t),Nm.forEach(t),Ac=m(o),uo=a(o,"DIV",{class:!0});var Im=i(uo);y(Vs.$$.fragment,Im),Hf=m(Im),kl=a(Im,"P",{});var Mv=i(kl);Kf=s(Mv,"Base class for outputs of token classification models."),Mv.forEach(t),Im.forEach(t),Nc=m(o),_o=a(o,"DIV",{class:!0});var Dm=i(_o);y(Gs.$$.fragment,Dm),Rf=m(Dm),bl=a(Dm,"P",{});var qv=i(bl);Vf=s(qv,"Base class for Longformer\u2019s outputs, with potential hidden states, local and global attentions."),qv.forEach(t),Dm.forEach(t),Ic=m(o),wo=a(o,"DIV",{class:!0});var Sm=i(wo);y(Js.$$.fragment,Sm),Gf=m(Sm),vl=a(Sm,"P",{});var zv=i(vl);Jf=s(zv,"Base class for Longformer\u2019s outputs that also contains a pooling of the last hidden states."),zv.forEach(t),Sm.forEach(t),Dc=m(o),ko=a(o,"DIV",{class:!0});var Bm=i(ko);y(Ys.$$.fragment,Bm),Yf=m(Bm),yl=a(Bm,"P",{});var Ev=i(yl);Xf=s(Ev,"Base class for masked language models outputs."),Ev.forEach(t),Bm.forEach(t),Sc=m(o),bo=a(o,"DIV",{class:!0});var Wm=i(bo);y(Xs.$$.fragment,Wm),Zf=m(Wm),Tl=a(Wm,"P",{});var Cv=i(Tl);eg=s(Cv,"Base class for outputs of question answering Longformer models."),Cv.forEach(t),Wm.forEach(t),Bc=m(o),vo=a(o,"DIV",{class:!0});var Qm=i(vo);y(Zs.$$.fragment,Qm),tg=m(Qm),$l=a(Qm,"P",{});var jv=i($l);og=s(jv,"Base class for outputs of sentence classification models."),jv.forEach(t),Qm.forEach(t),Wc=m(o),yo=a(o,"DIV",{class:!0});var Um=i(yo);y(er.$$.fragment,Um),ng=m(Um),Ll=a(Um,"P",{});var Ov=i(Ll);sg=s(Ov,"Base class for outputs of multiple choice models."),Ov.forEach(t),Um.forEach(t),Qc=m(o),To=a(o,"DIV",{class:!0});var Hm=i(To);y(tr.$$.fragment,Hm),rg=m(Hm),xl=a(Hm,"P",{});var Pv=i(xl);ag=s(Pv,"Base class for outputs of token classification models."),Pv.forEach(t),Hm.forEach(t),Uc=m(o),$o=a(o,"H2",{class:!0});var Km=i($o);vn=a(Km,"A",{id:!0,class:!0,href:!0});var Av=i(vn);Fl=a(Av,"SPAN",{});var Nv=i(Fl);y(or.$$.fragment,Nv),Nv.forEach(t),Av.forEach(t),ig=m(Km),Ml=a(Km,"SPAN",{});var Iv=i(Ml);lg=s(Iv,"LongformerModel"),Iv.forEach(t),Km.forEach(t),Hc=m(o),st=a(o,"DIV",{class:!0});var Lt=i(st);y(nr.$$.fragment,Lt),dg=m(Lt),ql=a(Lt,"P",{});var Dv=i(ql);cg=s(Dv,"The bare Longformer Model outputting raw hidden-states without any specific head on top."),Dv.forEach(t),mg=m(Lt),sr=a(Lt,"P",{});var Rm=i(sr);hg=s(Rm,"This model inherits from "),Ua=a(Rm,"A",{href:!0});var Sv=i(Ua);pg=s(Sv,"PreTrainedModel"),Sv.forEach(t),fg=s(Rm,`. 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.)`),Rm.forEach(t),gg=m(Lt),rr=a(Lt,"P",{});var Vm=i(rr);ug=s(Vm,"This model is also a PyTorch "),ar=a(Vm,"A",{href:!0,rel:!0});var Bv=i(ar);_g=s(Bv,"torch.nn.Module"),Bv.forEach(t),wg=s(Vm,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Vm.forEach(t),kg=m(Lt),Lo=a(Lt,"P",{});var bi=i(Lo);bg=s(bi,"This class copied code from "),Ha=a(bi,"A",{href:!0});var Wv=i(Ha);vg=s(Wv,"RobertaModel"),Wv.forEach(t),yg=s(bi,` and overwrote standard self-attention with longformer self-attention
to provide the ability to process long sequences following the self-attention approach described in `),ir=a(bi,"A",{href:!0,rel:!0});var Qv=i(ir);Tg=s(Qv,`Longformer:
the Long-Document Transformer`),Qv.forEach(t),$g=s(bi,` 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.`),bi.forEach(t),Lg=m(Lt),lr=a(Lt,"P",{});var Gm=i(lr);xg=s(Gm,"The self-attention module "),zl=a(Gm,"CODE",{});var Uv=i(zl);Fg=s(Uv,"LongformerSelfAttention"),Uv.forEach(t),Mg=s(Gm,` 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.`),Gm.forEach(t),qg=m(Lt),xt=a(Lt,"DIV",{class:!0});var fs=i(xt);y(dr.$$.fragment,fs),zg=m(fs),xo=a(fs,"P",{});var vi=i(xo);Eg=s(vi,"The "),Ka=a(vi,"A",{href:!0});var Hv=i(Ka);Cg=s(Hv,"LongformerModel"),Hv.forEach(t),jg=s(vi," forward method, overrides the "),El=a(vi,"CODE",{});var Kv=i(El);Og=s(Kv,"__call__"),Kv.forEach(t),Pg=s(vi," special method."),vi.forEach(t),Ag=m(fs),y(yn.$$.fragment,fs),Ng=m(fs),y(Tn.$$.fragment,fs),fs.forEach(t),Lt.forEach(t),Kc=m(o),Fo=a(o,"H2",{class:!0});var Jm=i(Fo);$n=a(Jm,"A",{id:!0,class:!0,href:!0});var Rv=i($n);Cl=a(Rv,"SPAN",{});var Vv=i(Cl);y(cr.$$.fragment,Vv),Vv.forEach(t),Rv.forEach(t),Ig=m(Jm),jl=a(Jm,"SPAN",{});var Gv=i(jl);Dg=s(Gv,"LongformerForMaskedLM"),Gv.forEach(t),Jm.forEach(t),Rc=m(o),ft=a(o,"DIV",{class:!0});var Ut=i(ft);y(mr.$$.fragment,Ut),Sg=m(Ut),hr=a(Ut,"P",{});var Ym=i(hr);Bg=s(Ym,"Longformer Model with a "),Ol=a(Ym,"CODE",{});var Jv=i(Ol);Wg=s(Jv,"language modeling"),Jv.forEach(t),Qg=s(Ym," head on top."),Ym.forEach(t),Ug=m(Ut),pr=a(Ut,"P",{});var Xm=i(pr);Hg=s(Xm,"This model inherits from "),Ra=a(Xm,"A",{href:!0});var Yv=i(Ra);Kg=s(Yv,"PreTrainedModel"),Yv.forEach(t),Rg=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),Vg=m(Ut),fr=a(Ut,"P",{});var Zm=i(fr);Gg=s(Zm,"This model is also a PyTorch "),gr=a(Zm,"A",{href:!0,rel:!0});var Xv=i(gr);Jg=s(Xv,"torch.nn.Module"),Xv.forEach(t),Yg=s(Zm,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Zm.forEach(t),Xg=m(Ut),ct=a(Ut,"DIV",{class:!0});var Et=i(ct);y(ur.$$.fragment,Et),Zg=m(Et),Mo=a(Et,"P",{});var yi=i(Mo);eu=s(yi,"The "),Va=a(yi,"A",{href:!0});var Zv=i(Va);tu=s(Zv,"LongformerForMaskedLM"),Zv.forEach(t),ou=s(yi," forward method, overrides the "),Pl=a(yi,"CODE",{});var ey=i(Pl);nu=s(ey,"__call__"),ey.forEach(t),su=s(yi," special method."),yi.forEach(t),ru=m(Et),y(Ln.$$.fragment,Et),au=m(Et),y(xn.$$.fragment,Et),iu=m(Et),Al=a(Et,"P",{});var ty=i(Al);lu=s(ty,"Let\u2019s try a very long input."),ty.forEach(t),du=m(Et),y(Fn.$$.fragment,Et),Et.forEach(t),Ut.forEach(t),Vc=m(o),qo=a(o,"H2",{class:!0});var eh=i(qo);Mn=a(eh,"A",{id:!0,class:!0,href:!0});var oy=i(Mn);Nl=a(oy,"SPAN",{});var ny=i(Nl);y(_r.$$.fragment,ny),ny.forEach(t),oy.forEach(t),cu=m(eh),Il=a(eh,"SPAN",{});var sy=i(Il);mu=s(sy,"LongformerForSequenceClassification"),sy.forEach(t),eh.forEach(t),Gc=m(o),gt=a(o,"DIV",{class:!0});var Ht=i(gt);y(wr.$$.fragment,Ht),hu=m(Ht),Dl=a(Ht,"P",{});var ry=i(Dl);pu=s(ry,`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.`),ry.forEach(t),fu=m(Ht),kr=a(Ht,"P",{});var th=i(kr);gu=s(th,"This model inherits from "),Ga=a(th,"A",{href:!0});var ay=i(Ga);uu=s(ay,"PreTrainedModel"),ay.forEach(t),_u=s(th,`. 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.)`),th.forEach(t),wu=m(Ht),br=a(Ht,"P",{});var oh=i(br);ku=s(oh,"This model is also a PyTorch "),vr=a(oh,"A",{href:!0,rel:!0});var iy=i(vr);bu=s(iy,"torch.nn.Module"),iy.forEach(t),vu=s(oh,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),oh.forEach(t),yu=m(Ht),bt=a(Ht,"DIV",{class:!0});var Kt=i(bt);y(yr.$$.fragment,Kt),Tu=m(Kt),zo=a(Kt,"P",{});var Ti=i(zo);$u=s(Ti,"The "),Ja=a(Ti,"A",{href:!0});var ly=i(Ja);Lu=s(ly,"LongformerForSequenceClassification"),ly.forEach(t),xu=s(Ti," forward method, overrides the "),Sl=a(Ti,"CODE",{});var dy=i(Sl);Fu=s(dy,"__call__"),dy.forEach(t),Mu=s(Ti," special method."),Ti.forEach(t),qu=m(Kt),y(qn.$$.fragment,Kt),zu=m(Kt),y(zn.$$.fragment,Kt),Eu=m(Kt),y(En.$$.fragment,Kt),Kt.forEach(t),Ht.forEach(t),Jc=m(o),Eo=a(o,"H2",{class:!0});var nh=i(Eo);Cn=a(nh,"A",{id:!0,class:!0,href:!0});var cy=i(Cn);Bl=a(cy,"SPAN",{});var my=i(Bl);y(Tr.$$.fragment,my),my.forEach(t),cy.forEach(t),Cu=m(nh),Wl=a(nh,"SPAN",{});var hy=i(Wl);ju=s(hy,"LongformerForMultipleChoice"),hy.forEach(t),nh.forEach(t),Yc=m(o),ut=a(o,"DIV",{class:!0});var Rt=i(ut);y($r.$$.fragment,Rt),Ou=m(Rt),Ql=a(Rt,"P",{});var py=i(Ql);Pu=s(py,`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.`),py.forEach(t),Au=m(Rt),Lr=a(Rt,"P",{});var sh=i(Lr);Nu=s(sh,"This model inherits from "),Ya=a(sh,"A",{href:!0});var fy=i(Ya);Iu=s(fy,"PreTrainedModel"),fy.forEach(t),Du=s(sh,`. 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.)`),sh.forEach(t),Su=m(Rt),xr=a(Rt,"P",{});var rh=i(xr);Bu=s(rh,"This model is also a PyTorch "),Fr=a(rh,"A",{href:!0,rel:!0});var gy=i(Fr);Wu=s(gy,"torch.nn.Module"),gy.forEach(t),Qu=s(rh,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),rh.forEach(t),Uu=m(Rt),Ft=a(Rt,"DIV",{class:!0});var gs=i(Ft);y(Mr.$$.fragment,gs),Hu=m(gs),Co=a(gs,"P",{});var $i=i(Co);Ku=s($i,"The "),Xa=a($i,"A",{href:!0});var uy=i(Xa);Ru=s(uy,"LongformerForMultipleChoice"),uy.forEach(t),Vu=s($i," forward method, overrides the "),Ul=a($i,"CODE",{});var _y=i(Ul);Gu=s(_y,"__call__"),_y.forEach(t),Ju=s($i," special method."),$i.forEach(t),Yu=m(gs),y(jn.$$.fragment,gs),Xu=m(gs),y(On.$$.fragment,gs),gs.forEach(t),Rt.forEach(t),Xc=m(o),jo=a(o,"H2",{class:!0});var ah=i(jo);Pn=a(ah,"A",{id:!0,class:!0,href:!0});var wy=i(Pn);Hl=a(wy,"SPAN",{});var ky=i(Hl);y(qr.$$.fragment,ky),ky.forEach(t),wy.forEach(t),Zu=m(ah),Kl=a(ah,"SPAN",{});var by=i(Kl);e_=s(by,"LongformerForTokenClassification"),by.forEach(t),ah.forEach(t),Zc=m(o),_t=a(o,"DIV",{class:!0});var Vt=i(_t);y(zr.$$.fragment,Vt),t_=m(Vt),Rl=a(Vt,"P",{});var vy=i(Rl);o_=s(vy,`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.`),vy.forEach(t),n_=m(Vt),Er=a(Vt,"P",{});var ih=i(Er);s_=s(ih,"This model inherits from "),Za=a(ih,"A",{href:!0});var yy=i(Za);r_=s(yy,"PreTrainedModel"),yy.forEach(t),a_=s(ih,`. 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.)`),ih.forEach(t),i_=m(Vt),Cr=a(Vt,"P",{});var lh=i(Cr);l_=s(lh,"This model is also a PyTorch "),jr=a(lh,"A",{href:!0,rel:!0});var Ty=i(jr);d_=s(Ty,"torch.nn.Module"),Ty.forEach(t),c_=s(lh,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),lh.forEach(t),m_=m(Vt),Mt=a(Vt,"DIV",{class:!0});var us=i(Mt);y(Or.$$.fragment,us),h_=m(us),Oo=a(us,"P",{});var Li=i(Oo);p_=s(Li,"The "),ei=a(Li,"A",{href:!0});var $y=i(ei);f_=s($y,"LongformerForTokenClassification"),$y.forEach(t),g_=s(Li," forward method, overrides the "),Vl=a(Li,"CODE",{});var Ly=i(Vl);u_=s(Ly,"__call__"),Ly.forEach(t),__=s(Li," special method."),Li.forEach(t),w_=m(us),y(An.$$.fragment,us),k_=m(us),y(Nn.$$.fragment,us),us.forEach(t),Vt.forEach(t),em=m(o),Po=a(o,"H2",{class:!0});var dh=i(Po);In=a(dh,"A",{id:!0,class:!0,href:!0});var xy=i(In);Gl=a(xy,"SPAN",{});var Fy=i(Gl);y(Pr.$$.fragment,Fy),Fy.forEach(t),xy.forEach(t),b_=m(dh),Jl=a(dh,"SPAN",{});var My=i(Jl);v_=s(My,"LongformerForQuestionAnswering"),My.forEach(t),dh.forEach(t),tm=m(o),wt=a(o,"DIV",{class:!0});var Gt=i(wt);y(Ar.$$.fragment,Gt),y_=m(Gt),Ao=a(Gt,"P",{});var xi=i(Ao);T_=s(xi,`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 `),Yl=a(xi,"CODE",{});var qy=i(Yl);$_=s(qy,"span start logits"),qy.forEach(t),L_=s(xi," and "),Xl=a(xi,"CODE",{});var zy=i(Xl);x_=s(zy,"span end logits"),zy.forEach(t),F_=s(xi,")."),xi.forEach(t),M_=m(Gt),Nr=a(Gt,"P",{});var ch=i(Nr);q_=s(ch,"This model inherits from "),ti=a(ch,"A",{href:!0});var Ey=i(ti);z_=s(Ey,"PreTrainedModel"),Ey.forEach(t),E_=s(ch,`. 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.)`),ch.forEach(t),C_=m(Gt),Ir=a(Gt,"P",{});var mh=i(Ir);j_=s(mh,"This model is also a PyTorch "),Dr=a(mh,"A",{href:!0,rel:!0});var Cy=i(Dr);O_=s(Cy,"torch.nn.Module"),Cy.forEach(t),P_=s(mh,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),mh.forEach(t),A_=m(Gt),qt=a(Gt,"DIV",{class:!0});var _s=i(qt);y(Sr.$$.fragment,_s),N_=m(_s),No=a(_s,"P",{});var Fi=i(No);I_=s(Fi,"The "),oi=a(Fi,"A",{href:!0});var jy=i(oi);D_=s(jy,"LongformerForQuestionAnswering"),jy.forEach(t),S_=s(Fi," forward method, overrides the "),Zl=a(Fi,"CODE",{});var Oy=i(Zl);B_=s(Oy,"__call__"),Oy.forEach(t),W_=s(Fi," special method."),Fi.forEach(t),Q_=m(_s),y(Dn.$$.fragment,_s),U_=m(_s),y(Sn.$$.fragment,_s),_s.forEach(t),Gt.forEach(t),om=m(o),Io=a(o,"H2",{class:!0});var hh=i(Io);Bn=a(hh,"A",{id:!0,class:!0,href:!0});var Py=i(Bn);ed=a(Py,"SPAN",{});var Ay=i(ed);y(Br.$$.fragment,Ay),Ay.forEach(t),Py.forEach(t),H_=m(hh),td=a(hh,"SPAN",{});var Ny=i(td);K_=s(Ny,"TFLongformerModel"),Ny.forEach(t),hh.forEach(t),nm=m(o),Ge=a(o,"DIV",{class:!0});var ht=i(Ge);y(Wr.$$.fragment,ht),R_=m(ht),od=a(ht,"P",{});var Iy=i(od);V_=s(Iy,"The bare Longformer Model outputting raw hidden-states without any specific head on top."),Iy.forEach(t),G_=m(ht),Qr=a(ht,"P",{});var ph=i(Qr);J_=s(ph,"This model inherits from "),ni=a(ph,"A",{href:!0});var Dy=i(ni);Y_=s(Dy,"TFPreTrainedModel"),Dy.forEach(t),X_=s(ph,`. 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.)`),ph.forEach(t),Z_=m(ht),Ur=a(ht,"P",{});var fh=i(Ur);ew=s(fh,"This model is also a "),Hr=a(fh,"A",{href:!0,rel:!0});var Sy=i(Hr);tw=s(Sy,"tf.keras.Model"),Sy.forEach(t),ow=s(fh,` 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.`),fh.forEach(t),nw=m(ht),y(Wn.$$.fragment,ht),sw=m(ht),Do=a(ht,"P",{});var Mi=i(Do);rw=s(Mi,"This class copies code from "),si=a(Mi,"A",{href:!0});var By=i(si);aw=s(By,"TFRobertaModel"),By.forEach(t),iw=s(Mi,` and overwrites standard self-attention with longformer
self-attention to provide the ability to process long sequences following the self-attention approach described in
`),Kr=a(Mi,"A",{href:!0,rel:!0});var Wy=i(Kr);lw=s(Wy,"Longformer: the Long-Document Transformer"),Wy.forEach(t),dw=s(Mi,` 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.`),Mi.forEach(t),cw=m(ht),Rr=a(ht,"P",{});var gh=i(Rr);mw=s(gh,"The self-attention module "),nd=a(gh,"CODE",{});var Qy=i(nd);hw=s(Qy,"TFLongformerSelfAttention"),Qy.forEach(t),pw=s(gh,` 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.`),gh.forEach(t),fw=m(ht),Bt=a(ht,"DIV",{class:!0});var qi=i(Bt);y(Vr.$$.fragment,qi),gw=m(qi),So=a(qi,"P",{});var zi=i(So);uw=s(zi,"The "),ri=a(zi,"A",{href:!0});var Uy=i(ri);_w=s(Uy,"TFLongformerModel"),Uy.forEach(t),ww=s(zi," forward method, overrides the "),sd=a(zi,"CODE",{});var Hy=i(sd);kw=s(Hy,"__call__"),Hy.forEach(t),bw=s(zi," special method."),zi.forEach(t),vw=m(qi),y(Qn.$$.fragment,qi),qi.forEach(t),ht.forEach(t),sm=m(o),Bo=a(o,"H2",{class:!0});var uh=i(Bo);Un=a(uh,"A",{id:!0,class:!0,href:!0});var Ky=i(Un);rd=a(Ky,"SPAN",{});var Ry=i(rd);y(Gr.$$.fragment,Ry),Ry.forEach(t),Ky.forEach(t),yw=m(uh),ad=a(uh,"SPAN",{});var Vy=i(ad);Tw=s(Vy,"TFLongformerForMaskedLM"),Vy.forEach(t),uh.forEach(t),rm=m(o),rt=a(o,"DIV",{class:!0});var Ct=i(rt);y(Jr.$$.fragment,Ct),$w=m(Ct),Yr=a(Ct,"P",{});var _h=i(Yr);Lw=s(_h,"Longformer Model with a "),id=a(_h,"CODE",{});var Gy=i(id);xw=s(Gy,"language modeling"),Gy.forEach(t),Fw=s(_h," head on top."),_h.forEach(t),Mw=m(Ct),Xr=a(Ct,"P",{});var wh=i(Xr);qw=s(wh,"This model inherits from "),ai=a(wh,"A",{href:!0});var Jy=i(ai);zw=s(Jy,"TFPreTrainedModel"),Jy.forEach(t),Ew=s(wh,`. 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.)`),wh.forEach(t),Cw=m(Ct),Zr=a(Ct,"P",{});var kh=i(Zr);jw=s(kh,"This model is also a "),ea=a(kh,"A",{href:!0,rel:!0});var Yy=i(ea);Ow=s(Yy,"tf.keras.Model"),Yy.forEach(t),Pw=s(kh,` 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.`),kh.forEach(t),Aw=m(Ct),y(Hn.$$.fragment,Ct),Nw=m(Ct),vt=a(Ct,"DIV",{class:!0});var Jt=i(vt);y(ta.$$.fragment,Jt),Iw=m(Jt),Wo=a(Jt,"P",{});var Ei=i(Wo);Dw=s(Ei,"The "),ii=a(Ei,"A",{href:!0});var Xy=i(ii);Sw=s(Xy,"TFLongformerForMaskedLM"),Xy.forEach(t),Bw=s(Ei," forward method, overrides the "),ld=a(Ei,"CODE",{});var Zy=i(ld);Ww=s(Zy,"__call__"),Zy.forEach(t),Qw=s(Ei," special method."),Ei.forEach(t),Uw=m(Jt),y(Kn.$$.fragment,Jt),Hw=m(Jt),y(Rn.$$.fragment,Jt),Kw=m(Jt),y(Vn.$$.fragment,Jt),Jt.forEach(t),Ct.forEach(t),am=m(o),Qo=a(o,"H2",{class:!0});var bh=i(Qo);Gn=a(bh,"A",{id:!0,class:!0,href:!0});var eT=i(Gn);dd=a(eT,"SPAN",{});var tT=i(dd);y(oa.$$.fragment,tT),tT.forEach(t),eT.forEach(t),Rw=m(bh),cd=a(bh,"SPAN",{});var oT=i(cd);Vw=s(oT,"TFLongformerForQuestionAnswering"),oT.forEach(t),bh.forEach(t),im=m(o),at=a(o,"DIV",{class:!0});var jt=i(at);y(na.$$.fragment,jt),Gw=m(jt),Uo=a(jt,"P",{});var Ci=i(Uo);Jw=s(Ci,`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 `),md=a(Ci,"CODE",{});var nT=i(md);Yw=s(nT,"span start logits"),nT.forEach(t),Xw=s(Ci," and "),hd=a(Ci,"CODE",{});var sT=i(hd);Zw=s(sT,"span end logits"),sT.forEach(t),ek=s(Ci,")."),Ci.forEach(t),tk=m(jt),sa=a(jt,"P",{});var vh=i(sa);ok=s(vh,"This model inherits from "),li=a(vh,"A",{href:!0});var rT=i(li);nk=s(rT,"TFPreTrainedModel"),rT.forEach(t),sk=s(vh,`. 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.)`),vh.forEach(t),rk=m(jt),ra=a(jt,"P",{});var yh=i(ra);ak=s(yh,"This model is also a "),aa=a(yh,"A",{href:!0,rel:!0});var aT=i(aa);ik=s(aT,"tf.keras.Model"),aT.forEach(t),lk=s(yh,` 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.`),yh.forEach(t),dk=m(jt),y(Jn.$$.fragment,jt),ck=m(jt),yt=a(jt,"DIV",{class:!0});var Yt=i(yt);y(ia.$$.fragment,Yt),mk=m(Yt),Ho=a(Yt,"P",{});var ji=i(Ho);hk=s(ji,"The "),di=a(ji,"A",{href:!0});var iT=i(di);pk=s(iT,"TFLongformerForQuestionAnswering"),iT.forEach(t),fk=s(ji," forward method, overrides the "),pd=a(ji,"CODE",{});var lT=i(pd);gk=s(lT,"__call__"),lT.forEach(t),uk=s(ji," special method."),ji.forEach(t),_k=m(Yt),y(Yn.$$.fragment,Yt),wk=m(Yt),y(Xn.$$.fragment,Yt),kk=m(Yt),y(Zn.$$.fragment,Yt),Yt.forEach(t),jt.forEach(t),lm=m(o),Ko=a(o,"H2",{class:!0});var Th=i(Ko);es=a(Th,"A",{id:!0,class:!0,href:!0});var dT=i(es);fd=a(dT,"SPAN",{});var cT=i(fd);y(la.$$.fragment,cT),cT.forEach(t),dT.forEach(t),bk=m(Th),gd=a(Th,"SPAN",{});var mT=i(gd);vk=s(mT,"TFLongformerForSequenceClassification"),mT.forEach(t),Th.forEach(t),dm=m(o),it=a(o,"DIV",{class:!0});var Ot=i(it);y(da.$$.fragment,Ot),yk=m(Ot),ud=a(Ot,"P",{});var hT=i(ud);Tk=s(hT,`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.`),hT.forEach(t),$k=m(Ot),ca=a(Ot,"P",{});var $h=i(ca);Lk=s($h,"This model inherits from "),ci=a($h,"A",{href:!0});var pT=i(ci);xk=s(pT,"TFPreTrainedModel"),pT.forEach(t),Fk=s($h,`. 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.)`),$h.forEach(t),Mk=m(Ot),ma=a(Ot,"P",{});var Lh=i(ma);qk=s(Lh,"This model is also a "),ha=a(Lh,"A",{href:!0,rel:!0});var fT=i(ha);zk=s(fT,"tf.keras.Model"),fT.forEach(t),Ek=s(Lh,` 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.`),Lh.forEach(t),Ck=m(Ot),y(ts.$$.fragment,Ot),jk=m(Ot),Tt=a(Ot,"DIV",{class:!0});var Xt=i(Tt);y(pa.$$.fragment,Xt),Ok=m(Xt),Ro=a(Xt,"P",{});var Oi=i(Ro);Pk=s(Oi,"The "),mi=a(Oi,"A",{href:!0});var gT=i(mi);Ak=s(gT,"TFLongformerForSequenceClassification"),gT.forEach(t),Nk=s(Oi," forward method, overrides the "),_d=a(Oi,"CODE",{});var uT=i(_d);Ik=s(uT,"__call__"),uT.forEach(t),Dk=s(Oi," special method."),Oi.forEach(t),Sk=m(Xt),y(os.$$.fragment,Xt),Bk=m(Xt),y(ns.$$.fragment,Xt),Wk=m(Xt),y(ss.$$.fragment,Xt),Xt.forEach(t),Ot.forEach(t),cm=m(o),Vo=a(o,"H2",{class:!0});var xh=i(Vo);rs=a(xh,"A",{id:!0,class:!0,href:!0});var _T=i(rs);wd=a(_T,"SPAN",{});var wT=i(wd);y(fa.$$.fragment,wT),wT.forEach(t),_T.forEach(t),Qk=m(xh),kd=a(xh,"SPAN",{});var kT=i(kd);Uk=s(kT,"TFLongformerForTokenClassification"),kT.forEach(t),xh.forEach(t),mm=m(o),lt=a(o,"DIV",{class:!0});var Pt=i(lt);y(ga.$$.fragment,Pt),Hk=m(Pt),bd=a(Pt,"P",{});var bT=i(bd);Kk=s(bT,`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.`),bT.forEach(t),Rk=m(Pt),ua=a(Pt,"P",{});var Fh=i(ua);Vk=s(Fh,"This model inherits from "),hi=a(Fh,"A",{href:!0});var vT=i(hi);Gk=s(vT,"TFPreTrainedModel"),vT.forEach(t),Jk=s(Fh,`. 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.)`),Fh.forEach(t),Yk=m(Pt),_a=a(Pt,"P",{});var Mh=i(_a);Xk=s(Mh,"This model is also a "),wa=a(Mh,"A",{href:!0,rel:!0});var yT=i(wa);Zk=s(yT,"tf.keras.Model"),yT.forEach(t),eb=s(Mh,` 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.`),Mh.forEach(t),tb=m(Pt),y(as.$$.fragment,Pt),ob=m(Pt),$t=a(Pt,"DIV",{class:!0});var Zt=i($t);y(ka.$$.fragment,Zt),nb=m(Zt),Go=a(Zt,"P",{});var Pi=i(Go);sb=s(Pi,"The "),pi=a(Pi,"A",{href:!0});var TT=i(pi);rb=s(TT,"TFLongformerForTokenClassification"),TT.forEach(t),ab=s(Pi," forward method, overrides the "),vd=a(Pi,"CODE",{});var $T=i(vd);ib=s($T,"__call__"),$T.forEach(t),lb=s(Pi," special method."),Pi.forEach(t),db=m(Zt),y(is.$$.fragment,Zt),cb=m(Zt),y(ls.$$.fragment,Zt),mb=m(Zt),y(ds.$$.fragment,Zt),Zt.forEach(t),Pt.forEach(t),hm=m(o),Jo=a(o,"H2",{class:!0});var qh=i(Jo);cs=a(qh,"A",{id:!0,class:!0,href:!0});var LT=i(cs);yd=a(LT,"SPAN",{});var xT=i(yd);y(ba.$$.fragment,xT),xT.forEach(t),LT.forEach(t),hb=m(qh),Td=a(qh,"SPAN",{});var FT=i(Td);pb=s(FT,"TFLongformerForMultipleChoice"),FT.forEach(t),qh.forEach(t),pm=m(o),dt=a(o,"DIV",{class:!0});var At=i(dt);y(va.$$.fragment,At),fb=m(At),$d=a(At,"P",{});var MT=i($d);gb=s(MT,`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.`),MT.forEach(t),ub=m(At),ya=a(At,"P",{});var zh=i(ya);_b=s(zh,"This model inherits from "),fi=a(zh,"A",{href:!0});var qT=i(fi);wb=s(qT,"TFPreTrainedModel"),qT.forEach(t),kb=s(zh,`. 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.)`),zh.forEach(t),bb=m(At),Ta=a(At,"P",{});var Eh=i(Ta);vb=s(Eh,"This model is also a "),$a=a(Eh,"A",{href:!0,rel:!0});var zT=i($a);yb=s(zT,"tf.keras.Model"),zT.forEach(t),Tb=s(Eh,` 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.`),Eh.forEach(t),$b=m(At),y(ms.$$.fragment,At),Lb=m(At),zt=a(At,"DIV",{class:!0});var ws=i(zt);y(La.$$.fragment,ws),xb=m(ws),Yo=a(ws,"P",{});var Ai=i(Yo);Fb=s(Ai,"The "),gi=a(Ai,"A",{href:!0});var ET=i(gi);Mb=s(ET,"TFLongformerForMultipleChoice"),ET.forEach(t),qb=s(Ai," forward method, overrides the "),Ld=a(Ai,"CODE",{});var CT=i(Ld);zb=s(CT,"__call__"),CT.forEach(t),Eb=s(Ai," special method."),Ai.forEach(t),Cb=m(ws),y(hs.$$.fragment,ws),jb=m(ws),y(ps.$$.fragment,ws),ws.forEach(t),At.forEach(t),this.h()},h(){u(d,"name","hf:doc:metadata"),u(d,"content",JSON.stringify(E1)),u(g,"id","longformer"),u(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(g,"href","#longformer"),u(p,"class","relative group"),u(te,"id","overview"),u(te,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(te,"href","#overview"),u(N,"class","relative group"),u(me,"href","https://arxiv.org/pdf/2004.05150.pdf"),u(me,"rel","nofollow"),u(he,"href","https://huggingface.co/beltagy"),u(he,"rel","nofollow"),u(ee,"href","https://github.com/allenai/longformer"),u(ee,"rel","nofollow"),u(ce,"id","longformer-self-attention"),u(ce,"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"),u(ce,"href","#longformer-self-attention"),u(le,"class","relative group"),Ie.a=De,Se.a=R,Be.a=V,oc.a=nc,rc.a=ac,u(Ca,"href","/docs/transformers/main/en/model_doc/longformer#transformers.LongformerModel.forward"),mc.a=hc,pc.a=fc,gc.a=uc,_c.a=wc,u(ks,"href","https://arxiv.org/pdf/2004.05150.pdf"),u(ks,"rel","nofollow"),u(an,"id","training"),u(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"),u(an,"href","#training"),u(eo,"class","relative group"),u(ja,"href","/docs/transformers/main/en/model_doc/longformer#transformers.LongformerForMaskedLM"),u(Oa,"href","/docs/transformers/main/en/model_doc/roberta#transformers.RobertaForMaskedLM"),u(ln,"id","transformers.LongformerConfig"),u(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"),u(ln,"href","#transformers.LongformerConfig"),u(oo,"class","relative group"),u(Pa,"href","/docs/transformers/main/en/model_doc/longformer#transformers.LongformerModel"),u(Aa,"href","/docs/transformers/main/en/model_doc/longformer#transformers.TFLongformerModel"),u(Na,"href","/docs/transformers/main/en/model_doc/longformer#transformers.LongformerModel"),u($s,"href","https://huggingface.co/allenai/longformer-base-4096"),u($s,"rel","nofollow"),u(Ia,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),u(Da,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),u(pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(cn,"id","transformers.LongformerTokenizer"),u(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"),u(cn,"href","#transformers.LongformerTokenizer"),u(ao,"class","relative group"),u(Sa,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),u(St,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(pn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(fn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(gn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(un,"id","transformers.LongformerTokenizerFast"),u(un,"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"),u(un,"href","#transformers.LongformerTokenizerFast"),u(io,"class","relative group"),u(Qa,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),u(kn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(bn,"id","transformers.models.longformer.modeling_longformer.LongformerBaseModelOutput"),u(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"),u(bn,"href","#transformers.models.longformer.modeling_longformer.LongformerBaseModelOutput"),u(lo,"class","relative group"),u(co,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(mo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ho,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(po,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(fo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(go,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(uo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(_o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(wo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ko,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(bo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(vo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(yo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(To,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(vn,"id","transformers.LongformerModel"),u(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"),u(vn,"href","#transformers.LongformerModel"),u($o,"class","relative group"),u(Ua,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),u(ar,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u(ar,"rel","nofollow"),u(Ha,"href","/docs/transformers/main/en/model_doc/roberta#transformers.RobertaModel"),u(ir,"href","https://arxiv.org/abs/2004.05150"),u(ir,"rel","nofollow"),u(Ka,"href","/docs/transformers/main/en/model_doc/longformer#transformers.LongformerModel"),u(xt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(st,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u($n,"id","transformers.LongformerForMaskedLM"),u($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"),u($n,"href","#transformers.LongformerForMaskedLM"),u(Fo,"class","relative group"),u(Ra,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),u(gr,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u(gr,"rel","nofollow"),u(Va,"href","/docs/transformers/main/en/model_doc/longformer#transformers.LongformerForMaskedLM"),u(ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Mn,"id","transformers.LongformerForSequenceClassification"),u(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"),u(Mn,"href","#transformers.LongformerForSequenceClassification"),u(qo,"class","relative group"),u(Ga,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),u(vr,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u(vr,"rel","nofollow"),u(Ja,"href","/docs/transformers/main/en/model_doc/longformer#transformers.LongformerForSequenceClassification"),u(bt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(gt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Cn,"id","transformers.LongformerForMultipleChoice"),u(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"),u(Cn,"href","#transformers.LongformerForMultipleChoice"),u(Eo,"class","relative group"),u(Ya,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),u(Fr,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u(Fr,"rel","nofollow"),u(Xa,"href","/docs/transformers/main/en/model_doc/longformer#transformers.LongformerForMultipleChoice"),u(Ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Pn,"id","transformers.LongformerForTokenClassification"),u(Pn,"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"),u(Pn,"href","#transformers.LongformerForTokenClassification"),u(jo,"class","relative group"),u(Za,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),u(jr,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u(jr,"rel","nofollow"),u(ei,"href","/docs/transformers/main/en/model_doc/longformer#transformers.LongformerForTokenClassification"),u(Mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(_t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(In,"id","transformers.LongformerForQuestionAnswering"),u(In,"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"),u(In,"href","#transformers.LongformerForQuestionAnswering"),u(Po,"class","relative group"),u(ti,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),u(Dr,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u(Dr,"rel","nofollow"),u(oi,"href","/docs/transformers/main/en/model_doc/longformer#transformers.LongformerForQuestionAnswering"),u(qt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Bn,"id","transformers.TFLongformerModel"),u(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"),u(Bn,"href","#transformers.TFLongformerModel"),u(Io,"class","relative group"),u(ni,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),u(Hr,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u(Hr,"rel","nofollow"),u(si,"href","/docs/transformers/main/en/model_doc/roberta#transformers.TFRobertaModel"),u(Kr,"href","https://arxiv.org/abs/2004.05150"),u(Kr,"rel","nofollow"),u(ri,"href","/docs/transformers/main/en/model_doc/longformer#transformers.TFLongformerModel"),u(Bt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Un,"id","transformers.TFLongformerForMaskedLM"),u(Un,"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"),u(Un,"href","#transformers.TFLongformerForMaskedLM"),u(Bo,"class","relative group"),u(ai,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),u(ea,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u(ea,"rel","nofollow"),u(ii,"href","/docs/transformers/main/en/model_doc/longformer#transformers.TFLongformerForMaskedLM"),u(vt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Gn,"id","transformers.TFLongformerForQuestionAnswering"),u(Gn,"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"),u(Gn,"href","#transformers.TFLongformerForQuestionAnswering"),u(Qo,"class","relative group"),u(li,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),u(aa,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u(aa,"rel","nofollow"),u(di,"href","/docs/transformers/main/en/model_doc/longformer#transformers.TFLongformerForQuestionAnswering"),u(yt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(at,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(es,"id","transformers.TFLongformerForSequenceClassification"),u(es,"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"),u(es,"href","#transformers.TFLongformerForSequenceClassification"),u(Ko,"class","relative group"),u(ci,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),u(ha,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u(ha,"rel","nofollow"),u(mi,"href","/docs/transformers/main/en/model_doc/longformer#transformers.TFLongformerForSequenceClassification"),u(Tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(it,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(rs,"id","transformers.TFLongformerForTokenClassification"),u(rs,"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"),u(rs,"href","#transformers.TFLongformerForTokenClassification"),u(Vo,"class","relative group"),u(hi,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),u(wa,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u(wa,"rel","nofollow"),u(pi,"href","/docs/transformers/main/en/model_doc/longformer#transformers.TFLongformerForTokenClassification"),u($t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(cs,"id","transformers.TFLongformerForMultipleChoice"),u(cs,"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"),u(cs,"href","#transformers.TFLongformerForMultipleChoice"),u(Jo,"class","relative group"),u(fi,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),u($a,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u($a,"rel","nofollow"),u(gi,"href","/docs/transformers/main/en/model_doc/longformer#transformers.TFLongformerForMultipleChoice"),u(zt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(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,g),e(g,b),T(l,b,null),e(p,h),e(p,z),e(z,ie),f(o,Z,_),f(o,N,_),e(N,te),e(te,oe),T(F,oe,null),e(N,be),e(N,H),e(H,ve),f(o,ge,_),f(o,S,_),e(S,ye),e(S,me),e(me,G),e(S,Te),f(o,ue,_),f(o,W,_),e(W,$e),f(o,_e,_),f(o,Q,_),e(Q,pe),e(pe,Le),f(o,re,_),f(o,C,_),e(C,O),f(o,we,_),f(o,U,_),e(U,ne),e(ne,xe),e(ne,K),e(K,Fe),e(ne,Me),e(ne,j),e(j,qe),e(ne,J),e(ne,fe),e(fe,ze),e(ne,Y),f(o,ke,_),f(o,ae,_),e(ae,D),e(ae,he),e(he,X),e(ae,Ee),e(ae,ee),e(ee,P),e(ae,Ce),f(o,A,_),f(o,le,_),e(le,ce),e(ce,w),T(q,w,null),e(le,Qe),e(le,se),e(se,Ue),f(o,Ne,_),f(o,M,_),e(M,He),Ie.m(ot,M),e(M,De),Se.m(B,M),e(M,R),Be.m(nt,M),e(M,V),e(M,Pe),e(Pe,Ke),e(M,je),e(M,Ae),e(Ae,de),e(M,Re),e(M,Ni),e(Ni,Ch),e(M,jh),oc.m(jT,M),e(M,nc),e(M,Ii),e(Ii,Oh),e(M,Ph),f(o,sc,_),f(o,It,_),e(It,Ah),rc.m(OT,It),e(It,ac),e(It,Di),e(Di,Nh),e(It,Ih),f(o,ic,_),f(o,Dt,_),e(Dt,Dh),e(Dt,Si),e(Si,Sh),e(Dt,Bh),e(Dt,Bi),e(Bi,Wh),e(Dt,Qh),f(o,lc,_),f(o,nn,_),e(nn,Wi),e(Wi,Uh),e(nn,Hh),e(nn,Qi),e(Qi,Kh),f(o,dc,_),f(o,sn,_),e(sn,Rh),e(sn,Ca),e(Ca,Vh),e(sn,Gh),f(o,cc,_),f(o,kt,_),e(kt,Jh),mc.m(PT,kt),e(kt,hc),pc.m(AT,kt),e(kt,fc),gc.m(NT,kt),e(kt,uc),_c.m(IT,kt),e(kt,wc),f(o,kc,_),f(o,rn,_),e(rn,Yh),e(rn,ks),e(ks,Xh),e(rn,Zh),f(o,bc,_),f(o,eo,_),e(eo,an),e(an,Ui),T(bs,Ui,null),e(eo,ep),e(eo,Hi),e(Hi,tp),f(o,vc,_),f(o,to,_),e(to,ja),e(ja,op),e(to,np),e(to,Oa),e(Oa,sp),e(to,rp),f(o,yc,_),T(vs,o,_),f(o,Tc,_),f(o,oo,_),e(oo,ln),e(ln,Ki),T(ys,Ki,null),e(oo,ap),e(oo,Ri),e(Ri,ip),f(o,$c,_),f(o,pt,_),T(Ts,pt,null),e(pt,lp),e(pt,no),e(no,dp),e(no,Pa),e(Pa,cp),e(no,mp),e(no,Aa),e(Aa,hp),e(no,pp),e(pt,fp),e(pt,so),e(so,gp),e(so,Na),e(Na,up),e(so,_p),e(so,$s),e($s,wp),e(so,kp),e(pt,bp),e(pt,ro),e(ro,vp),e(ro,Ia),e(Ia,yp),e(ro,Tp),e(ro,Da),e(Da,$p),e(ro,Lp),e(pt,xp),T(dn,pt,null),f(o,Lc,_),f(o,ao,_),e(ao,cn),e(cn,Vi),T(Ls,Vi,null),e(ao,Fp),e(ao,Gi),e(Gi,Mp),f(o,xc,_),f(o,Oe,_),T(xs,Oe,null),e(Oe,qp),e(Oe,Ji),e(Ji,zp),e(Oe,Ep),e(Oe,Yi),e(Yi,Cp),e(Oe,jp),T(mn,Oe,null),e(Oe,Op),e(Oe,Fs),e(Fs,Pp),e(Fs,Xi),e(Xi,Ap),e(Fs,Np),e(Oe,Ip),T(hn,Oe,null),e(Oe,Dp),e(Oe,Ms),e(Ms,Sp),e(Ms,Sa),e(Sa,Bp),e(Ms,Wp),e(Oe,Qp),e(Oe,St),T(qs,St,null),e(St,Up),e(St,Zi),e(Zi,Hp),e(St,Kp),e(St,zs),e(zs,Ba),e(Ba,Rp),e(Ba,el),e(el,Vp),e(zs,Gp),e(zs,Wa),e(Wa,Jp),e(Wa,tl),e(tl,Yp),e(Oe,Xp),e(Oe,pn),T(Es,pn,null),e(pn,Zp),e(pn,ol),e(ol,ef),e(Oe,tf),e(Oe,fn),T(Cs,fn,null),e(fn,of),e(fn,nl),e(nl,nf),e(Oe,sf),e(Oe,gn),T(js,gn,null),e(gn,rf),e(gn,Os),e(Os,af),e(Os,sl),e(sl,lf),e(Os,df),f(o,Fc,_),f(o,io,_),e(io,un),e(un,rl),T(Ps,rl,null),e(io,cf),e(io,al),e(al,mf),f(o,Mc,_),f(o,Ve,_),T(As,Ve,null),e(Ve,hf),e(Ve,Ns),e(Ns,pf),e(Ns,il),e(il,ff),e(Ns,gf),e(Ve,uf),e(Ve,ll),e(ll,_f),e(Ve,wf),T(_n,Ve,null),e(Ve,kf),e(Ve,Is),e(Is,bf),e(Is,dl),e(dl,vf),e(Is,yf),e(Ve,Tf),T(wn,Ve,null),e(Ve,$f),e(Ve,Ds),e(Ds,Lf),e(Ds,Qa),e(Qa,xf),e(Ds,Ff),e(Ve,Mf),e(Ve,kn),T(Ss,kn,null),e(kn,qf),e(kn,cl),e(cl,zf),f(o,qc,_),f(o,lo,_),e(lo,bn),e(bn,ml),T(Bs,ml,null),e(lo,Ef),e(lo,hl),e(hl,Cf),f(o,zc,_),f(o,co,_),T(Ws,co,null),e(co,jf),e(co,pl),e(pl,Of),f(o,Ec,_),f(o,mo,_),T(Qs,mo,null),e(mo,Pf),e(mo,fl),e(fl,Af),f(o,Cc,_),f(o,ho,_),T(Us,ho,null),e(ho,Nf),e(ho,gl),e(gl,If),f(o,jc,_),f(o,po,_),T(Hs,po,null),e(po,Df),e(po,ul),e(ul,Sf),f(o,Oc,_),f(o,fo,_),T(Ks,fo,null),e(fo,Bf),e(fo,_l),e(_l,Wf),f(o,Pc,_),f(o,go,_),T(Rs,go,null),e(go,Qf),e(go,wl),e(wl,Uf),f(o,Ac,_),f(o,uo,_),T(Vs,uo,null),e(uo,Hf),e(uo,kl),e(kl,Kf),f(o,Nc,_),f(o,_o,_),T(Gs,_o,null),e(_o,Rf),e(_o,bl),e(bl,Vf),f(o,Ic,_),f(o,wo,_),T(Js,wo,null),e(wo,Gf),e(wo,vl),e(vl,Jf),f(o,Dc,_),f(o,ko,_),T(Ys,ko,null),e(ko,Yf),e(ko,yl),e(yl,Xf),f(o,Sc,_),f(o,bo,_),T(Xs,bo,null),e(bo,Zf),e(bo,Tl),e(Tl,eg),f(o,Bc,_),f(o,vo,_),T(Zs,vo,null),e(vo,tg),e(vo,$l),e($l,og),f(o,Wc,_),f(o,yo,_),T(er,yo,null),e(yo,ng),e(yo,Ll),e(Ll,sg),f(o,Qc,_),f(o,To,_),T(tr,To,null),e(To,rg),e(To,xl),e(xl,ag),f(o,Uc,_),f(o,$o,_),e($o,vn),e(vn,Fl),T(or,Fl,null),e($o,ig),e($o,Ml),e(Ml,lg),f(o,Hc,_),f(o,st,_),T(nr,st,null),e(st,dg),e(st,ql),e(ql,cg),e(st,mg),e(st,sr),e(sr,hg),e(sr,Ua),e(Ua,pg),e(sr,fg),e(st,gg),e(st,rr),e(rr,ug),e(rr,ar),e(ar,_g),e(rr,wg),e(st,kg),e(st,Lo),e(Lo,bg),e(Lo,Ha),e(Ha,vg),e(Lo,yg),e(Lo,ir),e(ir,Tg),e(Lo,$g),e(st,Lg),e(st,lr),e(lr,xg),e(lr,zl),e(zl,Fg),e(lr,Mg),e(st,qg),e(st,xt),T(dr,xt,null),e(xt,zg),e(xt,xo),e(xo,Eg),e(xo,Ka),e(Ka,Cg),e(xo,jg),e(xo,El),e(El,Og),e(xo,Pg),e(xt,Ag),T(yn,xt,null),e(xt,Ng),T(Tn,xt,null),f(o,Kc,_),f(o,Fo,_),e(Fo,$n),e($n,Cl),T(cr,Cl,null),e(Fo,Ig),e(Fo,jl),e(jl,Dg),f(o,Rc,_),f(o,ft,_),T(mr,ft,null),e(ft,Sg),e(ft,hr),e(hr,Bg),e(hr,Ol),e(Ol,Wg),e(hr,Qg),e(ft,Ug),e(ft,pr),e(pr,Hg),e(pr,Ra),e(Ra,Kg),e(pr,Rg),e(ft,Vg),e(ft,fr),e(fr,Gg),e(fr,gr),e(gr,Jg),e(fr,Yg),e(ft,Xg),e(ft,ct),T(ur,ct,null),e(ct,Zg),e(ct,Mo),e(Mo,eu),e(Mo,Va),e(Va,tu),e(Mo,ou),e(Mo,Pl),e(Pl,nu),e(Mo,su),e(ct,ru),T(Ln,ct,null),e(ct,au),T(xn,ct,null),e(ct,iu),e(ct,Al),e(Al,lu),e(ct,du),T(Fn,ct,null),f(o,Vc,_),f(o,qo,_),e(qo,Mn),e(Mn,Nl),T(_r,Nl,null),e(qo,cu),e(qo,Il),e(Il,mu),f(o,Gc,_),f(o,gt,_),T(wr,gt,null),e(gt,hu),e(gt,Dl),e(Dl,pu),e(gt,fu),e(gt,kr),e(kr,gu),e(kr,Ga),e(Ga,uu),e(kr,_u),e(gt,wu),e(gt,br),e(br,ku),e(br,vr),e(vr,bu),e(br,vu),e(gt,yu),e(gt,bt),T(yr,bt,null),e(bt,Tu),e(bt,zo),e(zo,$u),e(zo,Ja),e(Ja,Lu),e(zo,xu),e(zo,Sl),e(Sl,Fu),e(zo,Mu),e(bt,qu),T(qn,bt,null),e(bt,zu),T(zn,bt,null),e(bt,Eu),T(En,bt,null),f(o,Jc,_),f(o,Eo,_),e(Eo,Cn),e(Cn,Bl),T(Tr,Bl,null),e(Eo,Cu),e(Eo,Wl),e(Wl,ju),f(o,Yc,_),f(o,ut,_),T($r,ut,null),e(ut,Ou),e(ut,Ql),e(Ql,Pu),e(ut,Au),e(ut,Lr),e(Lr,Nu),e(Lr,Ya),e(Ya,Iu),e(Lr,Du),e(ut,Su),e(ut,xr),e(xr,Bu),e(xr,Fr),e(Fr,Wu),e(xr,Qu),e(ut,Uu),e(ut,Ft),T(Mr,Ft,null),e(Ft,Hu),e(Ft,Co),e(Co,Ku),e(Co,Xa),e(Xa,Ru),e(Co,Vu),e(Co,Ul),e(Ul,Gu),e(Co,Ju),e(Ft,Yu),T(jn,Ft,null),e(Ft,Xu),T(On,Ft,null),f(o,Xc,_),f(o,jo,_),e(jo,Pn),e(Pn,Hl),T(qr,Hl,null),e(jo,Zu),e(jo,Kl),e(Kl,e_),f(o,Zc,_),f(o,_t,_),T(zr,_t,null),e(_t,t_),e(_t,Rl),e(Rl,o_),e(_t,n_),e(_t,Er),e(Er,s_),e(Er,Za),e(Za,r_),e(Er,a_),e(_t,i_),e(_t,Cr),e(Cr,l_),e(Cr,jr),e(jr,d_),e(Cr,c_),e(_t,m_),e(_t,Mt),T(Or,Mt,null),e(Mt,h_),e(Mt,Oo),e(Oo,p_),e(Oo,ei),e(ei,f_),e(Oo,g_),e(Oo,Vl),e(Vl,u_),e(Oo,__),e(Mt,w_),T(An,Mt,null),e(Mt,k_),T(Nn,Mt,null),f(o,em,_),f(o,Po,_),e(Po,In),e(In,Gl),T(Pr,Gl,null),e(Po,b_),e(Po,Jl),e(Jl,v_),f(o,tm,_),f(o,wt,_),T(Ar,wt,null),e(wt,y_),e(wt,Ao),e(Ao,T_),e(Ao,Yl),e(Yl,$_),e(Ao,L_),e(Ao,Xl),e(Xl,x_),e(Ao,F_),e(wt,M_),e(wt,Nr),e(Nr,q_),e(Nr,ti),e(ti,z_),e(Nr,E_),e(wt,C_),e(wt,Ir),e(Ir,j_),e(Ir,Dr),e(Dr,O_),e(Ir,P_),e(wt,A_),e(wt,qt),T(Sr,qt,null),e(qt,N_),e(qt,No),e(No,I_),e(No,oi),e(oi,D_),e(No,S_),e(No,Zl),e(Zl,B_),e(No,W_),e(qt,Q_),T(Dn,qt,null),e(qt,U_),T(Sn,qt,null),f(o,om,_),f(o,Io,_),e(Io,Bn),e(Bn,ed),T(Br,ed,null),e(Io,H_),e(Io,td),e(td,K_),f(o,nm,_),f(o,Ge,_),T(Wr,Ge,null),e(Ge,R_),e(Ge,od),e(od,V_),e(Ge,G_),e(Ge,Qr),e(Qr,J_),e(Qr,ni),e(ni,Y_),e(Qr,X_),e(Ge,Z_),e(Ge,Ur),e(Ur,ew),e(Ur,Hr),e(Hr,tw),e(Ur,ow),e(Ge,nw),T(Wn,Ge,null),e(Ge,sw),e(Ge,Do),e(Do,rw),e(Do,si),e(si,aw),e(Do,iw),e(Do,Kr),e(Kr,lw),e(Do,dw),e(Ge,cw),e(Ge,Rr),e(Rr,mw),e(Rr,nd),e(nd,hw),e(Rr,pw),e(Ge,fw),e(Ge,Bt),T(Vr,Bt,null),e(Bt,gw),e(Bt,So),e(So,uw),e(So,ri),e(ri,_w),e(So,ww),e(So,sd),e(sd,kw),e(So,bw),e(Bt,vw),T(Qn,Bt,null),f(o,sm,_),f(o,Bo,_),e(Bo,Un),e(Un,rd),T(Gr,rd,null),e(Bo,yw),e(Bo,ad),e(ad,Tw),f(o,rm,_),f(o,rt,_),T(Jr,rt,null),e(rt,$w),e(rt,Yr),e(Yr,Lw),e(Yr,id),e(id,xw),e(Yr,Fw),e(rt,Mw),e(rt,Xr),e(Xr,qw),e(Xr,ai),e(ai,zw),e(Xr,Ew),e(rt,Cw),e(rt,Zr),e(Zr,jw),e(Zr,ea),e(ea,Ow),e(Zr,Pw),e(rt,Aw),T(Hn,rt,null),e(rt,Nw),e(rt,vt),T(ta,vt,null),e(vt,Iw),e(vt,Wo),e(Wo,Dw),e(Wo,ii),e(ii,Sw),e(Wo,Bw),e(Wo,ld),e(ld,Ww),e(Wo,Qw),e(vt,Uw),T(Kn,vt,null),e(vt,Hw),T(Rn,vt,null),e(vt,Kw),T(Vn,vt,null),f(o,am,_),f(o,Qo,_),e(Qo,Gn),e(Gn,dd),T(oa,dd,null),e(Qo,Rw),e(Qo,cd),e(cd,Vw),f(o,im,_),f(o,at,_),T(na,at,null),e(at,Gw),e(at,Uo),e(Uo,Jw),e(Uo,md),e(md,Yw),e(Uo,Xw),e(Uo,hd),e(hd,Zw),e(Uo,ek),e(at,tk),e(at,sa),e(sa,ok),e(sa,li),e(li,nk),e(sa,sk),e(at,rk),e(at,ra),e(ra,ak),e(ra,aa),e(aa,ik),e(ra,lk),e(at,dk),T(Jn,at,null),e(at,ck),e(at,yt),T(ia,yt,null),e(yt,mk),e(yt,Ho),e(Ho,hk),e(Ho,di),e(di,pk),e(Ho,fk),e(Ho,pd),e(pd,gk),e(Ho,uk),e(yt,_k),T(Yn,yt,null),e(yt,wk),T(Xn,yt,null),e(yt,kk),T(Zn,yt,null),f(o,lm,_),f(o,Ko,_),e(Ko,es),e(es,fd),T(la,fd,null),e(Ko,bk),e(Ko,gd),e(gd,vk),f(o,dm,_),f(o,it,_),T(da,it,null),e(it,yk),e(it,ud),e(ud,Tk),e(it,$k),e(it,ca),e(ca,Lk),e(ca,ci),e(ci,xk),e(ca,Fk),e(it,Mk),e(it,ma),e(ma,qk),e(ma,ha),e(ha,zk),e(ma,Ek),e(it,Ck),T(ts,it,null),e(it,jk),e(it,Tt),T(pa,Tt,null),e(Tt,Ok),e(Tt,Ro),e(Ro,Pk),e(Ro,mi),e(mi,Ak),e(Ro,Nk),e(Ro,_d),e(_d,Ik),e(Ro,Dk),e(Tt,Sk),T(os,Tt,null),e(Tt,Bk),T(ns,Tt,null),e(Tt,Wk),T(ss,Tt,null),f(o,cm,_),f(o,Vo,_),e(Vo,rs),e(rs,wd),T(fa,wd,null),e(Vo,Qk),e(Vo,kd),e(kd,Uk),f(o,mm,_),f(o,lt,_),T(ga,lt,null),e(lt,Hk),e(lt,bd),e(bd,Kk),e(lt,Rk),e(lt,ua),e(ua,Vk),e(ua,hi),e(hi,Gk),e(ua,Jk),e(lt,Yk),e(lt,_a),e(_a,Xk),e(_a,wa),e(wa,Zk),e(_a,eb),e(lt,tb),T(as,lt,null),e(lt,ob),e(lt,$t),T(ka,$t,null),e($t,nb),e($t,Go),e(Go,sb),e(Go,pi),e(pi,rb),e(Go,ab),e(Go,vd),e(vd,ib),e(Go,lb),e($t,db),T(is,$t,null),e($t,cb),T(ls,$t,null),e($t,mb),T(ds,$t,null),f(o,hm,_),f(o,Jo,_),e(Jo,cs),e(cs,yd),T(ba,yd,null),e(Jo,hb),e(Jo,Td),e(Td,pb),f(o,pm,_),f(o,dt,_),T(va,dt,null),e(dt,fb),e(dt,$d),e($d,gb),e(dt,ub),e(dt,ya),e(ya,_b),e(ya,fi),e(fi,wb),e(ya,kb),e(dt,bb),e(dt,Ta),e(Ta,vb),e(Ta,$a),e($a,yb),e(Ta,Tb),e(dt,$b),T(ms,dt,null),e(dt,Lb),e(dt,zt),T(La,zt,null),e(zt,xb),e(zt,Yo),e(Yo,Fb),e(Yo,gi),e(gi,Mb),e(Yo,qb),e(Yo,Ld),e(Ld,zb),e(Yo,Eb),e(zt,Cb),T(hs,zt,null),e(zt,jb),T(ps,zt,null),fm=!0},p(o,[_]){const xa={};_&2&&(xa.$$scope={dirty:_,ctx:o}),dn.$set(xa);const xd={};_&2&&(xd.$$scope={dirty:_,ctx:o}),mn.$set(xd);const Fd={};_&2&&(Fd.$$scope={dirty:_,ctx:o}),hn.$set(Fd);const Md={};_&2&&(Md.$$scope={dirty:_,ctx:o}),_n.$set(Md);const Fa={};_&2&&(Fa.$$scope={dirty:_,ctx:o}),wn.$set(Fa);const qd={};_&2&&(qd.$$scope={dirty:_,ctx:o}),yn.$set(qd);const zd={};_&2&&(zd.$$scope={dirty:_,ctx:o}),Tn.$set(zd);const Ed={};_&2&&(Ed.$$scope={dirty:_,ctx:o}),Ln.$set(Ed);const Ma={};_&2&&(Ma.$$scope={dirty:_,ctx:o}),xn.$set(Ma);const Cd={};_&2&&(Cd.$$scope={dirty:_,ctx:o}),Fn.$set(Cd);const jd={};_&2&&(jd.$$scope={dirty:_,ctx:o}),qn.$set(jd);const Od={};_&2&&(Od.$$scope={dirty:_,ctx:o}),zn.$set(Od);const Pd={};_&2&&(Pd.$$scope={dirty:_,ctx:o}),En.$set(Pd);const Ad={};_&2&&(Ad.$$scope={dirty:_,ctx:o}),jn.$set(Ad);const Nd={};_&2&&(Nd.$$scope={dirty:_,ctx:o}),On.$set(Nd);const Nt={};_&2&&(Nt.$$scope={dirty:_,ctx:o}),An.$set(Nt);const Id={};_&2&&(Id.$$scope={dirty:_,ctx:o}),Nn.$set(Id);const Dd={};_&2&&(Dd.$$scope={dirty:_,ctx:o}),Dn.$set(Dd);const Sd={};_&2&&(Sd.$$scope={dirty:_,ctx:o}),Sn.$set(Sd);const Xo={};_&2&&(Xo.$$scope={dirty:_,ctx:o}),Wn.$set(Xo);const Bd={};_&2&&(Bd.$$scope={dirty:_,ctx:o}),Qn.$set(Bd);const Wd={};_&2&&(Wd.$$scope={dirty:_,ctx:o}),Hn.$set(Wd);const qa={};_&2&&(qa.$$scope={dirty:_,ctx:o}),Kn.$set(qa);const Qd={};_&2&&(Qd.$$scope={dirty:_,ctx:o}),Rn.$set(Qd);const Ud={};_&2&&(Ud.$$scope={dirty:_,ctx:o}),Vn.$set(Ud);const Hd={};_&2&&(Hd.$$scope={dirty:_,ctx:o}),Jn.$set(Hd);const Je={};_&2&&(Je.$$scope={dirty:_,ctx:o}),Yn.$set(Je);const Kd={};_&2&&(Kd.$$scope={dirty:_,ctx:o}),Xn.$set(Kd);const Rd={};_&2&&(Rd.$$scope={dirty:_,ctx:o}),Zn.$set(Rd);const Vd={};_&2&&(Vd.$$scope={dirty:_,ctx:o}),ts.$set(Vd);const Gd={};_&2&&(Gd.$$scope={dirty:_,ctx:o}),os.$set(Gd);const Zo={};_&2&&(Zo.$$scope={dirty:_,ctx:o}),ns.$set(Zo);const Jd={};_&2&&(Jd.$$scope={dirty:_,ctx:o}),ss.$set(Jd);const en={};_&2&&(en.$$scope={dirty:_,ctx:o}),as.$set(en);const Yd={};_&2&&(Yd.$$scope={dirty:_,ctx:o}),is.$set(Yd);const Xd={};_&2&&(Xd.$$scope={dirty:_,ctx:o}),ls.$set(Xd);const za={};_&2&&(za.$$scope={dirty:_,ctx:o}),ds.$set(za);const Zd={};_&2&&(Zd.$$scope={dirty:_,ctx:o}),ms.$set(Zd);const ec={};_&2&&(ec.$$scope={dirty:_,ctx:o}),hs.$set(ec);const Ea={};_&2&&(Ea.$$scope={dirty:_,ctx:o}),ps.$set(Ea)},i(o){fm||($(l.$$.fragment,o),$(F.$$.fragment,o),$(q.$$.fragment,o),$(bs.$$.fragment,o),$(vs.$$.fragment,o),$(ys.$$.fragment,o),$(Ts.$$.fragment,o),$(dn.$$.fragment,o),$(Ls.$$.fragment,o),$(xs.$$.fragment,o),$(mn.$$.fragment,o),$(hn.$$.fragment,o),$(qs.$$.fragment,o),$(Es.$$.fragment,o),$(Cs.$$.fragment,o),$(js.$$.fragment,o),$(Ps.$$.fragment,o),$(As.$$.fragment,o),$(_n.$$.fragment,o),$(wn.$$.fragment,o),$(Ss.$$.fragment,o),$(Bs.$$.fragment,o),$(Ws.$$.fragment,o),$(Qs.$$.fragment,o),$(Us.$$.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),$(dr.$$.fragment,o),$(yn.$$.fragment,o),$(Tn.$$.fragment,o),$(cr.$$.fragment,o),$(mr.$$.fragment,o),$(ur.$$.fragment,o),$(Ln.$$.fragment,o),$(xn.$$.fragment,o),$(Fn.$$.fragment,o),$(_r.$$.fragment,o),$(wr.$$.fragment,o),$(yr.$$.fragment,o),$(qn.$$.fragment,o),$(zn.$$.fragment,o),$(En.$$.fragment,o),$(Tr.$$.fragment,o),$($r.$$.fragment,o),$(Mr.$$.fragment,o),$(jn.$$.fragment,o),$(On.$$.fragment,o),$(qr.$$.fragment,o),$(zr.$$.fragment,o),$(Or.$$.fragment,o),$(An.$$.fragment,o),$(Nn.$$.fragment,o),$(Pr.$$.fragment,o),$(Ar.$$.fragment,o),$(Sr.$$.fragment,o),$(Dn.$$.fragment,o),$(Sn.$$.fragment,o),$(Br.$$.fragment,o),$(Wr.$$.fragment,o),$(Wn.$$.fragment,o),$(Vr.$$.fragment,o),$(Qn.$$.fragment,o),$(Gr.$$.fragment,o),$(Jr.$$.fragment,o),$(Hn.$$.fragment,o),$(ta.$$.fragment,o),$(Kn.$$.fragment,o),$(Rn.$$.fragment,o),$(Vn.$$.fragment,o),$(oa.$$.fragment,o),$(na.$$.fragment,o),$(Jn.$$.fragment,o),$(ia.$$.fragment,o),$(Yn.$$.fragment,o),$(Xn.$$.fragment,o),$(Zn.$$.fragment,o),$(la.$$.fragment,o),$(da.$$.fragment,o),$(ts.$$.fragment,o),$(pa.$$.fragment,o),$(os.$$.fragment,o),$(ns.$$.fragment,o),$(ss.$$.fragment,o),$(fa.$$.fragment,o),$(ga.$$.fragment,o),$(as.$$.fragment,o),$(ka.$$.fragment,o),$(is.$$.fragment,o),$(ls.$$.fragment,o),$(ds.$$.fragment,o),$(ba.$$.fragment,o),$(va.$$.fragment,o),$(ms.$$.fragment,o),$(La.$$.fragment,o),$(hs.$$.fragment,o),$(ps.$$.fragment,o),fm=!0)},o(o){L(l.$$.fragment,o),L(F.$$.fragment,o),L(q.$$.fragment,o),L(bs.$$.fragment,o),L(vs.$$.fragment,o),L(ys.$$.fragment,o),L(Ts.$$.fragment,o),L(dn.$$.fragment,o),L(Ls.$$.fragment,o),L(xs.$$.fragment,o),L(mn.$$.fragment,o),L(hn.$$.fragment,o),L(qs.$$.fragment,o),L(Es.$$.fragment,o),L(Cs.$$.fragment,o),L(js.$$.fragment,o),L(Ps.$$.fragment,o),L(As.$$.fragment,o),L(_n.$$.fragment,o),L(wn.$$.fragment,o),L(Ss.$$.fragment,o),L(Bs.$$.fragment,o),L(Ws.$$.fragment,o),L(Qs.$$.fragment,o),L(Us.$$.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(dr.$$.fragment,o),L(yn.$$.fragment,o),L(Tn.$$.fragment,o),L(cr.$$.fragment,o),L(mr.$$.fragment,o),L(ur.$$.fragment,o),L(Ln.$$.fragment,o),L(xn.$$.fragment,o),L(Fn.$$.fragment,o),L(_r.$$.fragment,o),L(wr.$$.fragment,o),L(yr.$$.fragment,o),L(qn.$$.fragment,o),L(zn.$$.fragment,o),L(En.$$.fragment,o),L(Tr.$$.fragment,o),L($r.$$.fragment,o),L(Mr.$$.fragment,o),L(jn.$$.fragment,o),L(On.$$.fragment,o),L(qr.$$.fragment,o),L(zr.$$.fragment,o),L(Or.$$.fragment,o),L(An.$$.fragment,o),L(Nn.$$.fragment,o),L(Pr.$$.fragment,o),L(Ar.$$.fragment,o),L(Sr.$$.fragment,o),L(Dn.$$.fragment,o),L(Sn.$$.fragment,o),L(Br.$$.fragment,o),L(Wr.$$.fragment,o),L(Wn.$$.fragment,o),L(Vr.$$.fragment,o),L(Qn.$$.fragment,o),L(Gr.$$.fragment,o),L(Jr.$$.fragment,o),L(Hn.$$.fragment,o),L(ta.$$.fragment,o),L(Kn.$$.fragment,o),L(Rn.$$.fragment,o),L(Vn.$$.fragment,o),L(oa.$$.fragment,o),L(na.$$.fragment,o),L(Jn.$$.fragment,o),L(ia.$$.fragment,o),L(Yn.$$.fragment,o),L(Xn.$$.fragment,o),L(Zn.$$.fragment,o),L(la.$$.fragment,o),L(da.$$.fragment,o),L(ts.$$.fragment,o),L(pa.$$.fragment,o),L(os.$$.fragment,o),L(ns.$$.fragment,o),L(ss.$$.fragment,o),L(fa.$$.fragment,o),L(ga.$$.fragment,o),L(as.$$.fragment,o),L(ka.$$.fragment,o),L(is.$$.fragment,o),L(ls.$$.fragment,o),L(ds.$$.fragment,o),L(ba.$$.fragment,o),L(va.$$.fragment,o),L(ms.$$.fragment,o),L(La.$$.fragment,o),L(hs.$$.fragment,o),L(ps.$$.fragment,o),fm=!1},d(o){t(d),o&&t(k),o&&t(p),x(l),o&&t(Z),o&&t(N),x(F),o&&t(ge),o&&t(S),o&&t(ue),o&&t(W),o&&t(_e),o&&t(Q),o&&t(re),o&&t(C),o&&t(we),o&&t(U),o&&t(ke),o&&t(ae),o&&t(A),o&&t(le),x(q),o&&t(Ne),o&&t(M),o&&t(sc),o&&t(It),o&&t(ic),o&&t(Dt),o&&t(lc),o&&t(nn),o&&t(dc),o&&t(sn),o&&t(cc),o&&t(kt),o&&t(kc),o&&t(rn),o&&t(bc),o&&t(eo),x(bs),o&&t(vc),o&&t(to),o&&t(yc),x(vs,o),o&&t(Tc),o&&t(oo),x(ys),o&&t($c),o&&t(pt),x(Ts),x(dn),o&&t(Lc),o&&t(ao),x(Ls),o&&t(xc),o&&t(Oe),x(xs),x(mn),x(hn),x(qs),x(Es),x(Cs),x(js),o&&t(Fc),o&&t(io),x(Ps),o&&t(Mc),o&&t(Ve),x(As),x(_n),x(wn),x(Ss),o&&t(qc),o&&t(lo),x(Bs),o&&t(zc),o&&t(co),x(Ws),o&&t(Ec),o&&t(mo),x(Qs),o&&t(Cc),o&&t(ho),x(Us),o&&t(jc),o&&t(po),x(Hs),o&&t(Oc),o&&t(fo),x(Ks),o&&t(Pc),o&&t(go),x(Rs),o&&t(Ac),o&&t(uo),x(Vs),o&&t(Nc),o&&t(_o),x(Gs),o&&t(Ic),o&&t(wo),x(Js),o&&t(Dc),o&&t(ko),x(Ys),o&&t(Sc),o&&t(bo),x(Xs),o&&t(Bc),o&&t(vo),x(Zs),o&&t(Wc),o&&t(yo),x(er),o&&t(Qc),o&&t(To),x(tr),o&&t(Uc),o&&t($o),x(or),o&&t(Hc),o&&t(st),x(nr),x(dr),x(yn),x(Tn),o&&t(Kc),o&&t(Fo),x(cr),o&&t(Rc),o&&t(ft),x(mr),x(ur),x(Ln),x(xn),x(Fn),o&&t(Vc),o&&t(qo),x(_r),o&&t(Gc),o&&t(gt),x(wr),x(yr),x(qn),x(zn),x(En),o&&t(Jc),o&&t(Eo),x(Tr),o&&t(Yc),o&&t(ut),x($r),x(Mr),x(jn),x(On),o&&t(Xc),o&&t(jo),x(qr),o&&t(Zc),o&&t(_t),x(zr),x(Or),x(An),x(Nn),o&&t(em),o&&t(Po),x(Pr),o&&t(tm),o&&t(wt),x(Ar),x(Sr),x(Dn),x(Sn),o&&t(om),o&&t(Io),x(Br),o&&t(nm),o&&t(Ge),x(Wr),x(Wn),x(Vr),x(Qn),o&&t(sm),o&&t(Bo),x(Gr),o&&t(rm),o&&t(rt),x(Jr),x(Hn),x(ta),x(Kn),x(Rn),x(Vn),o&&t(am),o&&t(Qo),x(oa),o&&t(im),o&&t(at),x(na),x(Jn),x(ia),x(Yn),x(Xn),x(Zn),o&&t(lm),o&&t(Ko),x(la),o&&t(dm),o&&t(it),x(da),x(ts),x(pa),x(os),x(ns),x(ss),o&&t(cm),o&&t(Vo),x(fa),o&&t(mm),o&&t(lt),x(ga),x(as),x(ka),x(is),x(ls),x(ds),o&&t(hm),o&&t(Jo),x(ba),o&&t(pm),o&&t(dt),x(va),x(ms),x(La),x(hs),x(ps)}}}const E1={local:"longformer",sections:[{local:"overview",title:"Overview"},{local:"longformer-self-attention",title:"Longformer Self Attention"},{local:"training",title:"Training"},{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 C1(E){return QT(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class D1 extends DT{constructor(d){super();ST(this,d,C1,z1,BT,{})}}export{D1 as default,E1 as metadata};
