import{S as S2,i as X2,s as P2,e as a,k as c,w as T,t as n,Y as sn,M as Q2,c as r,d as t,m as h,a as i,x as v,h as s,Z as an,b as u,N as N2,G as e,g as f,y,q as M,o as $,B as x,v as D2,L as nt}from"../../chunks/vendor-hf-doc-builder.js";import{T as tt}from"../../chunks/Tip-hf-doc-builder.js";import{D as Z}from"../../chunks/Docstring-hf-doc-builder.js";import{C as et}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ke}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ot}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Y2(J){let d,b,p,g,k;return g=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExvbmdmb3JtZXJDb25maWclMkMlMjBMb25nZm9ybWVyTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwTG9uZ2Zvcm1lciUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwTG9uZ2Zvcm1lckNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwZnJvbSUyMHRoZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMExvbmdmb3JtZXJNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",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=a("p"),b=n("Example:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Example:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function H2(J){let d,b,p,g,k;return g=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExvbmdmb3JtZXJUb2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBMb25nZm9ybWVyVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJhbGxlbmFpJTJGbG9uZ2Zvcm1lci1iYXNlLTQwOTYlMjIpJTBBdG9rZW5pemVyKCUyMkhlbGxvJTIwd29ybGQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTBBdG9rZW5pemVyKCUyMiUyMEhlbGxvJTIwd29ybGQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LongformerTokenizer

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot; Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">0</span>, <span class="hljs-number">20920</span>, <span class="hljs-number">232</span>, <span class="hljs-number">2</span>]`}}),{c(){d=a("p"),b=n("be encoded differently whether it is at the beginning of the sentence (without space) or not:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"be encoded differently whether it is at the beginning of the sentence (without space) or not:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function tM(J){let d,b,p,g,k,l,m,j;return{c(){d=a("p"),b=n("When used with "),p=a("code"),g=n("is_split_into_words=True"),k=n(", this tokenizer needs to be instantiated with "),l=a("code"),m=n("add_prefix_space=True"),j=n(".")},l(ae){d=r(ae,"P",{});var ee=i(d);b=s(ee,"When used with "),p=r(ee,"CODE",{});var N=i(p);g=s(N,"is_split_into_words=True"),N.forEach(t),k=s(ee,", this tokenizer needs to be instantiated with "),l=r(ee,"CODE",{});var re=i(l);m=s(re,"add_prefix_space=True"),re.forEach(t),j=s(ee,"."),ee.forEach(t)},m(ae,ee){f(ae,d,ee),e(d,b),e(d,p),e(p,g),e(d,k),e(d,l),e(l,m),e(d,j)},d(ae){ae&&t(d)}}}function oM(J){let d,b,p,g,k;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),g=n("Module"),k=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=r(l,"P",{});var m=i(d);b=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(m,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function nM(J){let d,b,p,g,k;return g=new et({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwTG9uZ2Zvcm1lck1vZGVsJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsJTIwJTNEJTIwTG9uZ2Zvcm1lck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJhbGxlbmFpJTJGbG9uZ2Zvcm1lci1iYXNlLTQwOTYlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyYWxsZW5haSUyRmxvbmdmb3JtZXItYmFzZS00MDk2JTIyKSUwQSUwQVNBTVBMRV9URVhUJTIwJTNEJTIwJTIyJTIwJTIyLmpvaW4oJTVCJTIySGVsbG8lMjB3b3JsZCElMjAlMjIlNUQlMjAqJTIwMTAwMCklMjAlMjAlMjMlMjBsb25nJTIwaW5wdXQlMjBkb2N1bWVudCUwQWlucHV0X2lkcyUyMCUzRCUyMHRvcmNoLnRlbnNvcih0b2tlbml6ZXIuZW5jb2RlKFNBTVBMRV9URVhUKSkudW5zcXVlZXplKDApJTIwJTIwJTIzJTIwYmF0Y2glMjBvZiUyMHNpemUlMjAxJTBBJTBBYXR0ZW50aW9uX21hc2slMjAlM0QlMjB0b3JjaC5vbmVzKCUwQSUyMCUyMCUyMCUyMGlucHV0X2lkcy5zaGFwZSUyQyUyMGR0eXBlJTNEdG9yY2gubG9uZyUyQyUyMGRldmljZSUzRGlucHV0X2lkcy5kZXZpY2UlMEEpJTIwJTIwJTIzJTIwaW5pdGlhbGl6ZSUyMHRvJTIwbG9jYWwlMjBhdHRlbnRpb24lMEFnbG9iYWxfYXR0ZW50aW9uX21hc2slMjAlM0QlMjB0b3JjaC56ZXJvcyglMEElMjAlMjAlMjAlMjBpbnB1dF9pZHMuc2hhcGUlMkMlMjBkdHlwZSUzRHRvcmNoLmxvbmclMkMlMjBkZXZpY2UlM0RpbnB1dF9pZHMuZGV2aWNlJTBBKSUyMCUyMCUyMyUyMGluaXRpYWxpemUlMjB0byUyMGdsb2JhbCUyMGF0dGVudGlvbiUyMHRvJTIwYmUlMjBkZWFjdGl2YXRlZCUyMGZvciUyMGFsbCUyMHRva2VucyUwQWdsb2JhbF9hdHRlbnRpb25fbWFzayU1QiUwQSUyMCUyMCUyMCUyMCUzQSUyQyUwQSUyMCUyMCUyMCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMDElMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjA0JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwMjElMkMlMEElMjAlMjAlMjAlMjAlNUQlMkMlMEElNUQlMjAlM0QlMjAxJTIwJTIwJTIzJTIwU2V0JTIwZ2xvYmFsJTIwYXR0ZW50aW9uJTIwdG8lMjByYW5kb20lMjB0b2tlbnMlMjBmb3IlMjB0aGUlMjBzYWtlJTIwb2YlMjB0aGlzJTIwZXhhbXBsZSUwQSUyMyUyMFVzdWFsbHklMkMlMjBzZXQlMjBnbG9iYWwlMjBhdHRlbnRpb24lMjBiYXNlZCUyMG9uJTIwdGhlJTIwdGFzay4lMjBGb3IlMjBleGFtcGxlJTJDJTBBJTIzJTIwY2xhc3NpZmljYXRpb24lM0ElMjB0aGUlMjAlM0NzJTNFJTIwdG9rZW4lMEElMjMlMjBRQSUzQSUyMHF1ZXN0aW9uJTIwdG9rZW5zJTBBJTIzJTIwTE0lM0ElMjBwb3RlbnRpYWxseSUyMG9uJTIwdGhlJTIwYmVnaW5uaW5nJTIwb2YlMjBzZW50ZW5jZXMlMjBhbmQlMjBwYXJhZ3JhcGhzJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0X2lkcyUyQyUyMGF0dGVudGlvbl9tYXNrJTNEYXR0ZW50aW9uX21hc2slMkMlMjBnbG9iYWxfYXR0ZW50aW9uX21hc2slM0RnbG9iYWxfYXR0ZW50aW9uX21hc2spJTBBc2VxdWVuY2Vfb3V0cHV0JTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQXBvb2xlZF9vdXRwdXQlMjAlM0QlMjBvdXRwdXRzLnBvb2xlcl9vdXRwdXQ=",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=a("p"),b=n("Examples:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Examples:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function sM(J){let d,b,p,g,k;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),g=n("Module"),k=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=r(l,"P",{});var m=i(d);b=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(m,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function aM(J){let d,b,p,g,k;return g=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMb25nZm9ybWVyRm9yTWFza2VkTE0lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJhbGxlbmFpJTJGbG9uZ2Zvcm1lci1iYXNlLTQwOTYlMjIpJTBBbW9kZWwlMjAlM0QlMjBMb25nZm9ybWVyRm9yTWFza2VkTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmFsbGVuYWklMkZsb25nZm9ybWVyLWJhc2UtNDA5NiUyMik=",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=a("p"),b=n("Mask filling example:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Mask filling example:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function rM(J){let d,b;return d=new et({props:{code:"VFhUJTIwJTNEJTIwKCUwQSUyMCUyMCUyMCUyMCUyMk15JTIwZnJpZW5kcyUyMGFyZSUyMCUzQ21hc2slM0UlMjBidXQlMjB0aGV5JTIwZWF0JTIwdG9vJTIwbWFueSUyMGNhcmJzLiUyMiUwQSUyMCUyMCUyMCUyMCUyQiUyMCUyMiUyMFRoYXQncyUyMHdoeSUyMEklMjBkZWNpZGUlMjBub3QlMjB0byUyMGVhdCUyMHdpdGglMjB0aGVtLiUyMiUyMColMjAzMDAlMEEpJTBBaW5wdXRfaWRzJTIwJTNEJTIwdG9rZW5pemVyKCU1QlRYVCU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBbG9naXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRfaWRzKS5sb2dpdHMlMEElMEFtYXNrZWRfaW5kZXglMjAlM0QlMjAoaW5wdXRfaWRzJTVCMCU1RCUyMCUzRCUzRCUyMHRva2VuaXplci5tYXNrX3Rva2VuX2lkKS5ub256ZXJvKCkuaXRlbSgpJTBBcHJvYnMlMjAlM0QlMjBsb2dpdHMlNUIwJTJDJTIwbWFza2VkX2luZGV4JTVELnNvZnRtYXgoZGltJTNEMCklMEF2YWx1ZXMlMkMlMjBwcmVkaWN0aW9ucyUyMCUzRCUyMHByb2JzLnRvcGsoNSklMEElMEF0b2tlbml6ZXIuZGVjb2RlKHByZWRpY3Rpb25zKS5zcGxpdCgp",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(){T(d.$$.fragment)},l(p){v(d.$$.fragment,p)},m(p,g){y(d,p,g),b=!0},p:nt,i(p){b||(M(d.$$.fragment,p),b=!0)},o(p){$(d.$$.fragment,p),b=!1},d(p){x(d,p)}}}function iM(J){let d,b,p,g,k;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),g=n("Module"),k=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=r(l,"P",{});var m=i(d);b=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(m,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function lM(J){let d,b,p,g,k;return g=new et({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMExvbmdmb3JtZXJGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyanB3YWhsZSUyRmxvbmdmb3JtZXItYmFzZS1wbGFnaWFyaXNtLWRldGVjdGlvbiUyMiklMEFtb2RlbCUyMCUzRCUyMExvbmdmb3JtZXJGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJqcHdhaGxlJTJGbG9uZ2Zvcm1lci1iYXNlLXBsYWdpYXJpc20tZGV0ZWN0aW9uJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZCUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoKS5pdGVtKCklMEFtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfY2xhc3NfaWQlNUQlMEElMEElMjMlMjBUbyUyMHRyYWluJTIwYSUyMG1vZGVsJTIwb24lMjAlNjBudW1fbGFiZWxzJTYwJTIwY2xhc3NlcyUyQyUyMHlvdSUyMGNhbiUyMHBhc3MlMjAlNjBudW1fbGFiZWxzJTNEbnVtX2xhYmVscyU2MCUyMHRvJTIwJTYwLmZyb21fcHJldHJhaW5lZCguLi4pJTYwJTBBbnVtX2xhYmVscyUyMCUzRCUyMGxlbihtb2RlbC5jb25maWcuaWQybGFiZWwpJTBBbW9kZWwlMjAlM0QlMjBMb25nZm9ybWVyRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyanB3YWhsZSUyRmxvbmdmb3JtZXItYmFzZS1wbGFnaWFyaXNtLWRldGVjdGlvbiUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcyUwQXJvdW5kKGxvc3MuaXRlbSgpJTJDJTIwMik=",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=a("p"),b=n("Example of single-label classification:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Example of single-label classification:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function dM(J){let d,b,p,g,k;return g=new et({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMExvbmdmb3JtZXJGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyanB3YWhsZSUyRmxvbmdmb3JtZXItYmFzZS1wbGFnaWFyaXNtLWRldGVjdGlvbiUyMiklMEFtb2RlbCUyMCUzRCUyMExvbmdmb3JtZXJGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJqcHdhaGxlJTJGbG9uZ2Zvcm1lci1iYXNlLXBsYWdpYXJpc20tZGV0ZWN0aW9uJTIyJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkcyUyMCUzRCUyMHRvcmNoLmFyYW5nZSgwJTJDJTIwbG9naXRzLnNoYXBlJTVCLTElNUQpJTVCdG9yY2guc2lnbW9pZChsb2dpdHMpLnNxdWVlemUoZGltJTNEMCklMjAlM0UlMjAwLjUlNUQlMEElMEElMjMlMjBUbyUyMHRyYWluJTIwYSUyMG1vZGVsJTIwb24lMjAlNjBudW1fbGFiZWxzJTYwJTIwY2xhc3NlcyUyQyUyMHlvdSUyMGNhbiUyMHBhc3MlMjAlNjBudW1fbGFiZWxzJTNEbnVtX2xhYmVscyU2MCUyMHRvJTIwJTYwLmZyb21fcHJldHJhaW5lZCguLi4pJTYwJTBBbnVtX2xhYmVscyUyMCUzRCUyMGxlbihtb2RlbC5jb25maWcuaWQybGFiZWwpJTBBbW9kZWwlMjAlM0QlMjBMb25nZm9ybWVyRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyanB3YWhsZSUyRmxvbmdmb3JtZXItYmFzZS1wbGFnaWFyaXNtLWRldGVjdGlvbiUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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=a("p"),b=n("Example of multi-label classification:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Example of multi-label classification:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function cM(J){let d,b,p,g,k;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),g=n("Module"),k=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=r(l,"P",{});var m=i(d);b=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(m,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function hM(J){let d,b,p,g,k;return g=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMb25nZm9ybWVyRm9yTXVsdGlwbGVDaG9pY2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmFsbGVuYWklMkZsb25nZm9ybWVyLWJhc2UtNDA5NiUyMiklMEFtb2RlbCUyMCUzRCUyMExvbmdmb3JtZXJGb3JNdWx0aXBsZUNob2ljZS5mcm9tX3ByZXRyYWluZWQoJTIyYWxsZW5haSUyRmxvbmdmb3JtZXItYmFzZS00MDk2JTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkluJTIwSXRhbHklMkMlMjBwaXp6YSUyMHNlcnZlZCUyMGluJTIwZm9ybWFsJTIwc2V0dGluZ3MlMkMlMjBzdWNoJTIwYXMlMjBhdCUyMGElMjByZXN0YXVyYW50JTJDJTIwaXMlMjBwcmVzZW50ZWQlMjB1bnNsaWNlZC4lMjIlMEFjaG9pY2UwJTIwJTNEJTIwJTIySXQlMjBpcyUyMGVhdGVuJTIwd2l0aCUyMGElMjBmb3JrJTIwYW5kJTIwYSUyMGtuaWZlLiUyMiUwQWNob2ljZTElMjAlM0QlMjAlMjJJdCUyMGlzJTIwZWF0ZW4lMjB3aGlsZSUyMGhlbGQlMjBpbiUyMHRoZSUyMGhhbmQuJTIyJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2gudGVuc29yKDApLnVuc3F1ZWV6ZSgwKSUyMCUyMCUyMyUyMGNob2ljZTAlMjBpcyUyMGNvcnJlY3QlMjAoYWNjb3JkaW5nJTIwdG8lMjBXaWtpcGVkaWElMjAlM0IpKSUyQyUyMGJhdGNoJTIwc2l6ZSUyMDElMEElMEFlbmNvZGluZyUyMCUzRCUyMHRva2VuaXplciglNUJwcm9tcHQlMkMlMjBwcm9tcHQlNUQlMkMlMjAlNUJjaG9pY2UwJTJDJTIwY2hvaWNlMSU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMkMlMjBwYWRkaW5nJTNEVHJ1ZSklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKiolN0JrJTNBJTIwdi51bnNxdWVlemUoMCklMjBmb3IlMjBrJTJDJTIwdiUyMGluJTIwZW5jb2RpbmcuaXRlbXMoKSU3RCUyQyUyMGxhYmVscyUzRGxhYmVscyklMjAlMjAlMjMlMjBiYXRjaCUyMHNpemUlMjBpcyUyMDElMEElMEElMjMlMjB0aGUlMjBsaW5lYXIlMjBjbGFzc2lmaWVyJTIwc3RpbGwlMjBuZWVkcyUyMHRvJTIwYmUlMjB0cmFpbmVkJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcyUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",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=a("p"),b=n("Example:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Example:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function mM(J){let d,b,p,g,k;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),g=n("Module"),k=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=r(l,"P",{});var m=i(d);b=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(m,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function pM(J){let d,b,p,g,k;return g=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMb25nZm9ybWVyRm9yVG9rZW5DbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyYnJhZDExNDElMkZMb25nZm9ybWVyLWZpbmV0dW5lZC1ub3JtJTIyKSUwQW1vZGVsJTIwJTNEJTIwTG9uZ2Zvcm1lckZvclRva2VuQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmJyYWQxMTQxJTJGTG9uZ2Zvcm1lci1maW5ldHVuZWQtbm9ybSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwJTIySHVnZ2luZ0ZhY2UlMjBpcyUyMGElMjBjb21wYW55JTIwYmFzZWQlMjBpbiUyMFBhcmlzJTIwYW5kJTIwTmV3JTIwWW9yayUyMiUyQyUyMGFkZF9zcGVjaWFsX3Rva2VucyUzREZhbHNlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUwQSklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF90b2tlbl9jbGFzc19pZHMlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KC0xKSUwQSUwQSUyMyUyME5vdGUlMjB0aGF0JTIwdG9rZW5zJTIwYXJlJTIwY2xhc3NpZmllZCUyMHJhdGhlciUyMHRoZW4lMjBpbnB1dCUyMHdvcmRzJTIwd2hpY2glMjBtZWFucyUyMHRoYXQlMEElMjMlMjB0aGVyZSUyMG1pZ2h0JTIwYmUlMjBtb3JlJTIwcHJlZGljdGVkJTIwdG9rZW4lMjBjbGFzc2VzJTIwdGhhbiUyMHdvcmRzLiUwQSUyMyUyME11bHRpcGxlJTIwdG9rZW4lMjBjbGFzc2VzJTIwbWlnaHQlMjBhY2NvdW50JTIwZm9yJTIwdGhlJTIwc2FtZSUyMHdvcmQlMEFwcmVkaWN0ZWRfdG9rZW5zX2NsYXNzZXMlMjAlM0QlMjAlNUJtb2RlbC5jb25maWcuaWQybGFiZWwlNUJ0Lml0ZW0oKSU1RCUyMGZvciUyMHQlMjBpbiUyMHByZWRpY3RlZF90b2tlbl9jbGFzc19pZHMlNUIwJTVEJTVEJTBBcHJlZGljdGVkX3Rva2Vuc19jbGFzc2VzJTBBJTBBbGFiZWxzJTIwJTNEJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcyUwQXJvdW5kKGxvc3MuaXRlbSgpJTJDJTIwMik=",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=a("p"),b=n("Example:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Example:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function fM(J){let d,b,p,g,k;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),g=n("Module"),k=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=r(l,"P",{});var m=i(d);b=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(m,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function uM(J){let d,b,p,g,k;return g=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMb25nZm9ybWVyRm9yUXVlc3Rpb25BbnN3ZXJpbmclMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmFsbGVuYWklMkZsb25nZm9ybWVyLWxhcmdlLTQwOTYtZmluZXR1bmVkLXRyaXZpYXFhJTIyKSUwQW1vZGVsJTIwJTNEJTIwTG9uZ2Zvcm1lckZvclF1ZXN0aW9uQW5zd2VyaW5nLmZyb21fcHJldHJhaW5lZCglMjJhbGxlbmFpJTJGbG9uZ2Zvcm1lci1sYXJnZS00MDk2LWZpbmV0dW5lZC10cml2aWFxYSUyMiklMEElMEFxdWVzdGlvbiUyQyUyMHRleHQlMjAlM0QlMjAlMjJXaG8lMjB3YXMlMjBKaW0lMjBIZW5zb24lM0YlMjIlMkMlMjAlMjJKaW0lMjBIZW5zb24lMjB3YXMlMjBhJTIwbmljZSUyMHB1cHBldCUyMiUwQWVuY29kaW5nJTIwJTNEJTIwdG9rZW5pemVyKHF1ZXN0aW9uJTJDJTIwdGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBaW5wdXRfaWRzJTIwJTNEJTIwZW5jb2RpbmclNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEElMEElMjMlMjBkZWZhdWx0JTIwaXMlMjBsb2NhbCUyMGF0dGVudGlvbiUyMGV2ZXJ5d2hlcmUlMEElMjMlMjB0aGUlMjBmb3J3YXJkJTIwbWV0aG9kJTIwd2lsbCUyMGF1dG9tYXRpY2FsbHklMjBzZXQlMjBnbG9iYWwlMjBhdHRlbnRpb24lMjBvbiUyMHF1ZXN0aW9uJTIwdG9rZW5zJTBBYXR0ZW50aW9uX21hc2slMjAlM0QlMjBlbmNvZGluZyU1QiUyMmF0dGVudGlvbl9tYXNrJTIyJTVEJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0X2lkcyUyQyUyMGF0dGVudGlvbl9tYXNrJTNEYXR0ZW50aW9uX21hc2spJTBBc3RhcnRfbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5zdGFydF9sb2dpdHMlMEFlbmRfbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5lbmRfbG9naXRzJTBBYWxsX3Rva2VucyUyMCUzRCUyMHRva2VuaXplci5jb252ZXJ0X2lkc190b190b2tlbnMoaW5wdXRfaWRzJTVCMCU1RC50b2xpc3QoKSklMEElMEFhbnN3ZXJfdG9rZW5zJTIwJTNEJTIwYWxsX3Rva2VucyU1QnRvcmNoLmFyZ21heChzdGFydF9sb2dpdHMpJTIwJTNBJTIwdG9yY2guYXJnbWF4KGVuZF9sb2dpdHMpJTIwJTJCJTIwMSU1RCUwQWFuc3dlciUyMCUzRCUyMHRva2VuaXplci5kZWNvZGUoJTBBJTIwJTIwJTIwJTIwdG9rZW5pemVyLmNvbnZlcnRfdG9rZW5zX3RvX2lkcyhhbnN3ZXJfdG9rZW5zKSUwQSklMjAlMjAlMjMlMjByZW1vdmUlMjBzcGFjZSUyMHByZXBlbmRpbmclMjBzcGFjZSUyMHRva2Vu",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=a("p"),b=n("Examples:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Examples:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function gM(J){let d,b,p,g,k,l,m,j,ae,ee,N,re,oe,F,ye,V,fe,qe,X,ie,de,R,he,Me,O,$e,ke,G,xe,me,le,z,I,ue,D,Te,ge,S,Fe,ve,C,Le,P,ce,ne,Y,_e,Ee,B,we,H,je,se,U,Je,q,be,ze;return{c(){d=a("p"),b=n("TensorFlow models and layers in "),p=a("code"),g=n("transformers"),k=n(" accept two formats as input:"),l=c(),m=a("ul"),j=a("li"),ae=n("having all inputs as keyword arguments (like PyTorch models), or"),ee=c(),N=a("li"),re=n("having all inputs as a list, tuple or dict in the first positional argument."),oe=c(),F=a("p"),ye=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 `),V=a("code"),fe=n("model.fit()"),qe=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),X=a("code"),ie=n("model.fit()"),de=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),R=a("code"),he=n("fit()"),Me=n(" and "),O=a("code"),$e=n("predict()"),ke=n(`, such as when creating your own layers or models with
the Keras `),G=a("code"),xe=n("Functional"),me=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),le=c(),z=a("ul"),I=a("li"),ue=n("a single Tensor with "),D=a("code"),Te=n("input_ids"),ge=n(" only and nothing else: "),S=a("code"),Fe=n("model(input_ids)"),ve=c(),C=a("li"),Le=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),P=a("code"),ce=n("model([input_ids, attention_mask])"),ne=n(" or "),Y=a("code"),_e=n("model([input_ids, attention_mask, token_type_ids])"),Ee=c(),B=a("li"),we=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=a("code"),je=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),se=c(),U=a("p"),Je=n(`Note that when creating models and layers with
`),q=a("a"),be=n("subclassing"),ze=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=r(w,"P",{});var L=i(d);b=s(L,"TensorFlow models and layers in "),p=r(L,"CODE",{});var Re=i(p);g=s(Re,"transformers"),Re.forEach(t),k=s(L," accept two formats as input:"),L.forEach(t),l=h(w),m=r(w,"UL",{});var te=i(m);j=r(te,"LI",{});var Oe=i(j);ae=s(Oe,"having all inputs as keyword arguments (like PyTorch models), or"),Oe.forEach(t),ee=h(te),N=r(te,"LI",{});var Se=i(N);re=s(Se,"having all inputs as a list, tuple or dict in the first positional argument."),Se.forEach(t),te.forEach(t),oe=h(w),F=r(w,"P",{});var E=i(F);ye=s(E,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),V=r(E,"CODE",{});var Xe=i(V);fe=s(Xe,"model.fit()"),Xe.forEach(t),qe=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),X=r(E,"CODE",{});var Pe=i(X);ie=s(Pe,"model.fit()"),Pe.forEach(t),de=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),R=r(E,"CODE",{});var Ze=i(R);he=s(Ze,"fit()"),Ze.forEach(t),Me=s(E," and "),O=r(E,"CODE",{});var Ce=i(O);$e=s(Ce,"predict()"),Ce.forEach(t),ke=s(E,`, such as when creating your own layers or models with
the Keras `),G=r(E,"CODE",{});var Ne=i(G);xe=s(Ne,"Functional"),Ne.forEach(t),me=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),le=h(w),z=r(w,"UL",{});var W=i(z);I=r(W,"LI",{});var A=i(I);ue=s(A,"a single Tensor with "),D=r(A,"CODE",{});var Qe=i(D);Te=s(Qe,"input_ids"),Qe.forEach(t),ge=s(A," only and nothing else: "),S=r(A,"CODE",{});var We=i(S);Fe=s(We,"model(input_ids)"),We.forEach(t),A.forEach(t),ve=h(W),C=r(W,"LI",{});var K=i(C);Le=s(K,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),P=r(K,"CODE",{});var Be=i(P);ce=s(Be,"model([input_ids, attention_mask])"),Be.forEach(t),ne=s(K," or "),Y=r(K,"CODE",{});var Q=i(Y);_e=s(Q,"model([input_ids, attention_mask, token_type_ids])"),Q.forEach(t),K.forEach(t),Ee=h(W),B=r(W,"LI",{});var Ie=i(B);we=s(Ie,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=r(Ie,"CODE",{});var Ge=i(H);je=s(Ge,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Ge.forEach(t),Ie.forEach(t),W.forEach(t),se=h(w),U=r(w,"P",{});var pe=i(U);Je=s(pe,`Note that when creating models and layers with
`),q=r(pe,"A",{href:!0,rel:!0});var Ae=i(q);be=s(Ae,"subclassing"),Ae.forEach(t),ze=s(pe,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),pe.forEach(t),this.h()},h(){u(q,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(q,"rel","nofollow")},m(w,L){f(w,d,L),e(d,b),e(d,p),e(p,g),e(d,k),f(w,l,L),f(w,m,L),e(m,j),e(j,ae),e(m,ee),e(m,N),e(N,re),f(w,oe,L),f(w,F,L),e(F,ye),e(F,V),e(V,fe),e(F,qe),e(F,X),e(X,ie),e(F,de),e(F,R),e(R,he),e(F,Me),e(F,O),e(O,$e),e(F,ke),e(F,G),e(G,xe),e(F,me),f(w,le,L),f(w,z,L),e(z,I),e(I,ue),e(I,D),e(D,Te),e(I,ge),e(I,S),e(S,Fe),e(z,ve),e(z,C),e(C,Le),e(C,P),e(P,ce),e(C,ne),e(C,Y),e(Y,_e),e(z,Ee),e(z,B),e(B,we),e(B,H),e(H,je),f(w,se,L),f(w,U,L),e(U,Je),e(U,q),e(q,be),e(U,ze)},d(w){w&&t(d),w&&t(l),w&&t(m),w&&t(oe),w&&t(F),w&&t(le),w&&t(z),w&&t(se),w&&t(U)}}}function _M(J){let d,b,p,g,k;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),g=n("Module"),k=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=r(l,"P",{});var m=i(d);b=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(m,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function wM(J){let d,b,p,g,k,l,m,j,ae,ee,N,re,oe,F,ye,V,fe,qe,X,ie,de,R,he,Me,O,$e,ke,G,xe,me,le,z,I,ue,D,Te,ge,S,Fe,ve,C,Le,P,ce,ne,Y,_e,Ee,B,we,H,je,se,U,Je,q,be,ze;return{c(){d=a("p"),b=n("TensorFlow models and layers in "),p=a("code"),g=n("transformers"),k=n(" accept two formats as input:"),l=c(),m=a("ul"),j=a("li"),ae=n("having all inputs as keyword arguments (like PyTorch models), or"),ee=c(),N=a("li"),re=n("having all inputs as a list, tuple or dict in the first positional argument."),oe=c(),F=a("p"),ye=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 `),V=a("code"),fe=n("model.fit()"),qe=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),X=a("code"),ie=n("model.fit()"),de=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),R=a("code"),he=n("fit()"),Me=n(" and "),O=a("code"),$e=n("predict()"),ke=n(`, such as when creating your own layers or models with
the Keras `),G=a("code"),xe=n("Functional"),me=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),le=c(),z=a("ul"),I=a("li"),ue=n("a single Tensor with "),D=a("code"),Te=n("input_ids"),ge=n(" only and nothing else: "),S=a("code"),Fe=n("model(input_ids)"),ve=c(),C=a("li"),Le=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),P=a("code"),ce=n("model([input_ids, attention_mask])"),ne=n(" or "),Y=a("code"),_e=n("model([input_ids, attention_mask, token_type_ids])"),Ee=c(),B=a("li"),we=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=a("code"),je=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),se=c(),U=a("p"),Je=n(`Note that when creating models and layers with
`),q=a("a"),be=n("subclassing"),ze=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=r(w,"P",{});var L=i(d);b=s(L,"TensorFlow models and layers in "),p=r(L,"CODE",{});var Re=i(p);g=s(Re,"transformers"),Re.forEach(t),k=s(L," accept two formats as input:"),L.forEach(t),l=h(w),m=r(w,"UL",{});var te=i(m);j=r(te,"LI",{});var Oe=i(j);ae=s(Oe,"having all inputs as keyword arguments (like PyTorch models), or"),Oe.forEach(t),ee=h(te),N=r(te,"LI",{});var Se=i(N);re=s(Se,"having all inputs as a list, tuple or dict in the first positional argument."),Se.forEach(t),te.forEach(t),oe=h(w),F=r(w,"P",{});var E=i(F);ye=s(E,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),V=r(E,"CODE",{});var Xe=i(V);fe=s(Xe,"model.fit()"),Xe.forEach(t),qe=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),X=r(E,"CODE",{});var Pe=i(X);ie=s(Pe,"model.fit()"),Pe.forEach(t),de=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),R=r(E,"CODE",{});var Ze=i(R);he=s(Ze,"fit()"),Ze.forEach(t),Me=s(E," and "),O=r(E,"CODE",{});var Ce=i(O);$e=s(Ce,"predict()"),Ce.forEach(t),ke=s(E,`, such as when creating your own layers or models with
the Keras `),G=r(E,"CODE",{});var Ne=i(G);xe=s(Ne,"Functional"),Ne.forEach(t),me=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),le=h(w),z=r(w,"UL",{});var W=i(z);I=r(W,"LI",{});var A=i(I);ue=s(A,"a single Tensor with "),D=r(A,"CODE",{});var Qe=i(D);Te=s(Qe,"input_ids"),Qe.forEach(t),ge=s(A," only and nothing else: "),S=r(A,"CODE",{});var We=i(S);Fe=s(We,"model(input_ids)"),We.forEach(t),A.forEach(t),ve=h(W),C=r(W,"LI",{});var K=i(C);Le=s(K,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),P=r(K,"CODE",{});var Be=i(P);ce=s(Be,"model([input_ids, attention_mask])"),Be.forEach(t),ne=s(K," or "),Y=r(K,"CODE",{});var Q=i(Y);_e=s(Q,"model([input_ids, attention_mask, token_type_ids])"),Q.forEach(t),K.forEach(t),Ee=h(W),B=r(W,"LI",{});var Ie=i(B);we=s(Ie,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=r(Ie,"CODE",{});var Ge=i(H);je=s(Ge,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Ge.forEach(t),Ie.forEach(t),W.forEach(t),se=h(w),U=r(w,"P",{});var pe=i(U);Je=s(pe,`Note that when creating models and layers with
`),q=r(pe,"A",{href:!0,rel:!0});var Ae=i(q);be=s(Ae,"subclassing"),Ae.forEach(t),ze=s(pe,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),pe.forEach(t),this.h()},h(){u(q,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(q,"rel","nofollow")},m(w,L){f(w,d,L),e(d,b),e(d,p),e(p,g),e(d,k),f(w,l,L),f(w,m,L),e(m,j),e(j,ae),e(m,ee),e(m,N),e(N,re),f(w,oe,L),f(w,F,L),e(F,ye),e(F,V),e(V,fe),e(F,qe),e(F,X),e(X,ie),e(F,de),e(F,R),e(R,he),e(F,Me),e(F,O),e(O,$e),e(F,ke),e(F,G),e(G,xe),e(F,me),f(w,le,L),f(w,z,L),e(z,I),e(I,ue),e(I,D),e(D,Te),e(I,ge),e(I,S),e(S,Fe),e(z,ve),e(z,C),e(C,Le),e(C,P),e(P,ce),e(C,ne),e(C,Y),e(Y,_e),e(z,Ee),e(z,B),e(B,we),e(B,H),e(H,je),f(w,se,L),f(w,U,L),e(U,Je),e(U,q),e(q,be),e(U,ze)},d(w){w&&t(d),w&&t(l),w&&t(m),w&&t(oe),w&&t(F),w&&t(le),w&&t(z),w&&t(se),w&&t(U)}}}function bM(J){let d,b,p,g,k;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),g=n("Module"),k=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=r(l,"P",{});var m=i(d);b=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(m,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function kM(J){let d,b,p,g,k;return g=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkxvbmdmb3JtZXJGb3JNYXNrZWRMTSUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyYWxsZW5haSUyRmxvbmdmb3JtZXItYmFzZS00MDk2JTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZMb25nZm9ybWVyRm9yTWFza2VkTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmFsbGVuYWklMkZsb25nZm9ybWVyLWJhc2UtNDA5NiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIyVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjAlM0NtYXNrJTNFLiUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQSUyMyUyMHJldHJpZXZlJTIwaW5kZXglMjBvZiUyMCUzQ21hc2slM0UlMEFtYXNrX3Rva2VuX2luZGV4JTIwJTNEJTIwdGYud2hlcmUoKGlucHV0cy5pbnB1dF9pZHMlMjAlM0QlM0QlMjB0b2tlbml6ZXIubWFza190b2tlbl9pZCklNUIwJTVEKSUwQXNlbGVjdGVkX2xvZ2l0cyUyMCUzRCUyMHRmLmdhdGhlcl9uZChsb2dpdHMlNUIwJTVEJTJDJTIwaW5kaWNlcyUzRG1hc2tfdG9rZW5faW5kZXgpJTBBJTBBcHJlZGljdGVkX3Rva2VuX2lkJTIwJTNEJTIwdGYubWF0aC5hcmdtYXgoc2VsZWN0ZWRfbG9naXRzJTJDJTIwYXhpcyUzRC0xKSUwQXRva2VuaXplci5kZWNvZGUocHJlZGljdGVkX3Rva2VuX2lkKQ==",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=a("p"),b=n("Example:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Example:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function TM(J){let d,b;return d=new et({props:{code:"bGFiZWxzJTIwJTNEJTIwdG9rZW5pemVyKCUyMlRoZSUyMGNhcGl0YWwlMjBvZiUyMEZyYW5jZSUyMGlzJTIwUGFyaXMuJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEElMjMlMjBtYXNrJTIwbGFiZWxzJTIwb2YlMjBub24tJTNDbWFzayUzRSUyMHRva2VucyUwQWxhYmVscyUyMCUzRCUyMHRmLndoZXJlKGlucHV0cy5pbnB1dF9pZHMlMjAlM0QlM0QlMjB0b2tlbml6ZXIubWFza190b2tlbl9pZCUyQyUyMGxhYmVscyUyQyUyMC0xMDApJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKSUwQXJvdW5kKGZsb2F0KG91dHB1dHMubG9zcyklMkMlMjAyKQ==",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(){T(d.$$.fragment)},l(p){v(d.$$.fragment,p)},m(p,g){y(d,p,g),b=!0},p:nt,i(p){b||(M(d.$$.fragment,p),b=!0)},o(p){$(d.$$.fragment,p),b=!1},d(p){x(d,p)}}}function vM(J){let d,b,p,g,k,l,m,j,ae,ee,N,re,oe,F,ye,V,fe,qe,X,ie,de,R,he,Me,O,$e,ke,G,xe,me,le,z,I,ue,D,Te,ge,S,Fe,ve,C,Le,P,ce,ne,Y,_e,Ee,B,we,H,je,se,U,Je,q,be,ze;return{c(){d=a("p"),b=n("TensorFlow models and layers in "),p=a("code"),g=n("transformers"),k=n(" accept two formats as input:"),l=c(),m=a("ul"),j=a("li"),ae=n("having all inputs as keyword arguments (like PyTorch models), or"),ee=c(),N=a("li"),re=n("having all inputs as a list, tuple or dict in the first positional argument."),oe=c(),F=a("p"),ye=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 `),V=a("code"),fe=n("model.fit()"),qe=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),X=a("code"),ie=n("model.fit()"),de=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),R=a("code"),he=n("fit()"),Me=n(" and "),O=a("code"),$e=n("predict()"),ke=n(`, such as when creating your own layers or models with
the Keras `),G=a("code"),xe=n("Functional"),me=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),le=c(),z=a("ul"),I=a("li"),ue=n("a single Tensor with "),D=a("code"),Te=n("input_ids"),ge=n(" only and nothing else: "),S=a("code"),Fe=n("model(input_ids)"),ve=c(),C=a("li"),Le=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),P=a("code"),ce=n("model([input_ids, attention_mask])"),ne=n(" or "),Y=a("code"),_e=n("model([input_ids, attention_mask, token_type_ids])"),Ee=c(),B=a("li"),we=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=a("code"),je=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),se=c(),U=a("p"),Je=n(`Note that when creating models and layers with
`),q=a("a"),be=n("subclassing"),ze=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=r(w,"P",{});var L=i(d);b=s(L,"TensorFlow models and layers in "),p=r(L,"CODE",{});var Re=i(p);g=s(Re,"transformers"),Re.forEach(t),k=s(L," accept two formats as input:"),L.forEach(t),l=h(w),m=r(w,"UL",{});var te=i(m);j=r(te,"LI",{});var Oe=i(j);ae=s(Oe,"having all inputs as keyword arguments (like PyTorch models), or"),Oe.forEach(t),ee=h(te),N=r(te,"LI",{});var Se=i(N);re=s(Se,"having all inputs as a list, tuple or dict in the first positional argument."),Se.forEach(t),te.forEach(t),oe=h(w),F=r(w,"P",{});var E=i(F);ye=s(E,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),V=r(E,"CODE",{});var Xe=i(V);fe=s(Xe,"model.fit()"),Xe.forEach(t),qe=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),X=r(E,"CODE",{});var Pe=i(X);ie=s(Pe,"model.fit()"),Pe.forEach(t),de=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),R=r(E,"CODE",{});var Ze=i(R);he=s(Ze,"fit()"),Ze.forEach(t),Me=s(E," and "),O=r(E,"CODE",{});var Ce=i(O);$e=s(Ce,"predict()"),Ce.forEach(t),ke=s(E,`, such as when creating your own layers or models with
the Keras `),G=r(E,"CODE",{});var Ne=i(G);xe=s(Ne,"Functional"),Ne.forEach(t),me=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),le=h(w),z=r(w,"UL",{});var W=i(z);I=r(W,"LI",{});var A=i(I);ue=s(A,"a single Tensor with "),D=r(A,"CODE",{});var Qe=i(D);Te=s(Qe,"input_ids"),Qe.forEach(t),ge=s(A," only and nothing else: "),S=r(A,"CODE",{});var We=i(S);Fe=s(We,"model(input_ids)"),We.forEach(t),A.forEach(t),ve=h(W),C=r(W,"LI",{});var K=i(C);Le=s(K,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),P=r(K,"CODE",{});var Be=i(P);ce=s(Be,"model([input_ids, attention_mask])"),Be.forEach(t),ne=s(K," or "),Y=r(K,"CODE",{});var Q=i(Y);_e=s(Q,"model([input_ids, attention_mask, token_type_ids])"),Q.forEach(t),K.forEach(t),Ee=h(W),B=r(W,"LI",{});var Ie=i(B);we=s(Ie,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=r(Ie,"CODE",{});var Ge=i(H);je=s(Ge,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Ge.forEach(t),Ie.forEach(t),W.forEach(t),se=h(w),U=r(w,"P",{});var pe=i(U);Je=s(pe,`Note that when creating models and layers with
`),q=r(pe,"A",{href:!0,rel:!0});var Ae=i(q);be=s(Ae,"subclassing"),Ae.forEach(t),ze=s(pe,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),pe.forEach(t),this.h()},h(){u(q,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(q,"rel","nofollow")},m(w,L){f(w,d,L),e(d,b),e(d,p),e(p,g),e(d,k),f(w,l,L),f(w,m,L),e(m,j),e(j,ae),e(m,ee),e(m,N),e(N,re),f(w,oe,L),f(w,F,L),e(F,ye),e(F,V),e(V,fe),e(F,qe),e(F,X),e(X,ie),e(F,de),e(F,R),e(R,he),e(F,Me),e(F,O),e(O,$e),e(F,ke),e(F,G),e(G,xe),e(F,me),f(w,le,L),f(w,z,L),e(z,I),e(I,ue),e(I,D),e(D,Te),e(I,ge),e(I,S),e(S,Fe),e(z,ve),e(z,C),e(C,Le),e(C,P),e(P,ce),e(C,ne),e(C,Y),e(Y,_e),e(z,Ee),e(z,B),e(B,we),e(B,H),e(H,je),f(w,se,L),f(w,U,L),e(U,Je),e(U,q),e(q,be),e(U,ze)},d(w){w&&t(d),w&&t(l),w&&t(m),w&&t(oe),w&&t(F),w&&t(le),w&&t(z),w&&t(se),w&&t(U)}}}function yM(J){let d,b,p,g,k;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),g=n("Module"),k=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=r(l,"P",{});var m=i(d);b=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(m,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function MM(J){let d,b,p,g,k;return g=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkxvbmdmb3JtZXJGb3JRdWVzdGlvbkFuc3dlcmluZyUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyYWxsZW5haSUyRmxvbmdmb3JtZXItbGFyZ2UtNDA5Ni1maW5ldHVuZWQtdHJpdmlhcWElMjIpJTBBbW9kZWwlMjAlM0QlMjBURkxvbmdmb3JtZXJGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyYWxsZW5haSUyRmxvbmdmb3JtZXItbGFyZ2UtNDA5Ni1maW5ldHVuZWQtdHJpdmlhcWElMjIpJTBBJTBBcXVlc3Rpb24lMkMlMjB0ZXh0JTIwJTNEJTIwJTIyV2hvJTIwd2FzJTIwSmltJTIwSGVuc29uJTNGJTIyJTJDJTIwJTIySmltJTIwSGVuc29uJTIwd2FzJTIwYSUyMG5pY2UlMjBwdXBwZXQlMjIlMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocXVlc3Rpb24lMkMlMjB0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBYW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNEJTIwaW50KHRmLm1hdGguYXJnbWF4KG91dHB1dHMuc3RhcnRfbG9naXRzJTJDJTIwYXhpcyUzRC0xKSU1QjAlNUQpJTBBYW5zd2VyX2VuZF9pbmRleCUyMCUzRCUyMGludCh0Zi5tYXRoLmFyZ21heChvdXRwdXRzLmVuZF9sb2dpdHMlMkMlMjBheGlzJTNELTEpJTVCMCU1RCklMEElMEFwcmVkaWN0X2Fuc3dlcl90b2tlbnMlMjAlM0QlMjBpbnB1dHMuaW5wdXRfaWRzJTVCMCUyQyUyMGFuc3dlcl9zdGFydF9pbmRleCUyMCUzQSUyMGFuc3dlcl9lbmRfaW5kZXglMjAlMkIlMjAxJTVEJTBBdG9rZW5pemVyLmRlY29kZShwcmVkaWN0X2Fuc3dlcl90b2tlbnMp",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=a("p"),b=n("Example:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Example:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function $M(J){let d,b;return d=new et({props:{code:"JTIzJTIwdGFyZ2V0JTIwaXMlMjAlMjJuaWNlJTIwcHVwcGV0JTIyJTBBdGFyZ2V0X3N0YXJ0X2luZGV4JTIwJTNEJTIwdGYuY29uc3RhbnQoJTVCMTQlNUQpJTBBdGFyZ2V0X2VuZF9pbmRleCUyMCUzRCUyMHRmLmNvbnN0YW50KCU1QjE1JTVEKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMHN0YXJ0X3Bvc2l0aW9ucyUzRHRhcmdldF9zdGFydF9pbmRleCUyQyUyMGVuZF9wb3NpdGlvbnMlM0R0YXJnZXRfZW5kX2luZGV4KSUwQWxvc3MlMjAlM0QlMjB0Zi5tYXRoLnJlZHVjZV9tZWFuKG91dHB1dHMubG9zcyklMEFyb3VuZChmbG9hdChsb3NzKSUyQyUyMDIp",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(){T(d.$$.fragment)},l(p){v(d.$$.fragment,p)},m(p,g){y(d,p,g),b=!0},p:nt,i(p){b||(M(d.$$.fragment,p),b=!0)},o(p){$(d.$$.fragment,p),b=!1},d(p){x(d,p)}}}function xM(J){let d,b,p,g,k,l,m,j,ae,ee,N,re,oe,F,ye,V,fe,qe,X,ie,de,R,he,Me,O,$e,ke,G,xe,me,le,z,I,ue,D,Te,ge,S,Fe,ve,C,Le,P,ce,ne,Y,_e,Ee,B,we,H,je,se,U,Je,q,be,ze;return{c(){d=a("p"),b=n("TensorFlow models and layers in "),p=a("code"),g=n("transformers"),k=n(" accept two formats as input:"),l=c(),m=a("ul"),j=a("li"),ae=n("having all inputs as keyword arguments (like PyTorch models), or"),ee=c(),N=a("li"),re=n("having all inputs as a list, tuple or dict in the first positional argument."),oe=c(),F=a("p"),ye=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 `),V=a("code"),fe=n("model.fit()"),qe=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),X=a("code"),ie=n("model.fit()"),de=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),R=a("code"),he=n("fit()"),Me=n(" and "),O=a("code"),$e=n("predict()"),ke=n(`, such as when creating your own layers or models with
the Keras `),G=a("code"),xe=n("Functional"),me=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),le=c(),z=a("ul"),I=a("li"),ue=n("a single Tensor with "),D=a("code"),Te=n("input_ids"),ge=n(" only and nothing else: "),S=a("code"),Fe=n("model(input_ids)"),ve=c(),C=a("li"),Le=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),P=a("code"),ce=n("model([input_ids, attention_mask])"),ne=n(" or "),Y=a("code"),_e=n("model([input_ids, attention_mask, token_type_ids])"),Ee=c(),B=a("li"),we=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=a("code"),je=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),se=c(),U=a("p"),Je=n(`Note that when creating models and layers with
`),q=a("a"),be=n("subclassing"),ze=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=r(w,"P",{});var L=i(d);b=s(L,"TensorFlow models and layers in "),p=r(L,"CODE",{});var Re=i(p);g=s(Re,"transformers"),Re.forEach(t),k=s(L," accept two formats as input:"),L.forEach(t),l=h(w),m=r(w,"UL",{});var te=i(m);j=r(te,"LI",{});var Oe=i(j);ae=s(Oe,"having all inputs as keyword arguments (like PyTorch models), or"),Oe.forEach(t),ee=h(te),N=r(te,"LI",{});var Se=i(N);re=s(Se,"having all inputs as a list, tuple or dict in the first positional argument."),Se.forEach(t),te.forEach(t),oe=h(w),F=r(w,"P",{});var E=i(F);ye=s(E,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),V=r(E,"CODE",{});var Xe=i(V);fe=s(Xe,"model.fit()"),Xe.forEach(t),qe=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),X=r(E,"CODE",{});var Pe=i(X);ie=s(Pe,"model.fit()"),Pe.forEach(t),de=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),R=r(E,"CODE",{});var Ze=i(R);he=s(Ze,"fit()"),Ze.forEach(t),Me=s(E," and "),O=r(E,"CODE",{});var Ce=i(O);$e=s(Ce,"predict()"),Ce.forEach(t),ke=s(E,`, such as when creating your own layers or models with
the Keras `),G=r(E,"CODE",{});var Ne=i(G);xe=s(Ne,"Functional"),Ne.forEach(t),me=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),le=h(w),z=r(w,"UL",{});var W=i(z);I=r(W,"LI",{});var A=i(I);ue=s(A,"a single Tensor with "),D=r(A,"CODE",{});var Qe=i(D);Te=s(Qe,"input_ids"),Qe.forEach(t),ge=s(A," only and nothing else: "),S=r(A,"CODE",{});var We=i(S);Fe=s(We,"model(input_ids)"),We.forEach(t),A.forEach(t),ve=h(W),C=r(W,"LI",{});var K=i(C);Le=s(K,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),P=r(K,"CODE",{});var Be=i(P);ce=s(Be,"model([input_ids, attention_mask])"),Be.forEach(t),ne=s(K," or "),Y=r(K,"CODE",{});var Q=i(Y);_e=s(Q,"model([input_ids, attention_mask, token_type_ids])"),Q.forEach(t),K.forEach(t),Ee=h(W),B=r(W,"LI",{});var Ie=i(B);we=s(Ie,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=r(Ie,"CODE",{});var Ge=i(H);je=s(Ge,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Ge.forEach(t),Ie.forEach(t),W.forEach(t),se=h(w),U=r(w,"P",{});var pe=i(U);Je=s(pe,`Note that when creating models and layers with
`),q=r(pe,"A",{href:!0,rel:!0});var Ae=i(q);be=s(Ae,"subclassing"),Ae.forEach(t),ze=s(pe,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),pe.forEach(t),this.h()},h(){u(q,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(q,"rel","nofollow")},m(w,L){f(w,d,L),e(d,b),e(d,p),e(p,g),e(d,k),f(w,l,L),f(w,m,L),e(m,j),e(j,ae),e(m,ee),e(m,N),e(N,re),f(w,oe,L),f(w,F,L),e(F,ye),e(F,V),e(V,fe),e(F,qe),e(F,X),e(X,ie),e(F,de),e(F,R),e(R,he),e(F,Me),e(F,O),e(O,$e),e(F,ke),e(F,G),e(G,xe),e(F,me),f(w,le,L),f(w,z,L),e(z,I),e(I,ue),e(I,D),e(D,Te),e(I,ge),e(I,S),e(S,Fe),e(z,ve),e(z,C),e(C,Le),e(C,P),e(P,ce),e(C,ne),e(C,Y),e(Y,_e),e(z,Ee),e(z,B),e(B,we),e(B,H),e(H,je),f(w,se,L),f(w,U,L),e(U,Je),e(U,q),e(q,be),e(U,ze)},d(w){w&&t(d),w&&t(l),w&&t(m),w&&t(oe),w&&t(F),w&&t(le),w&&t(z),w&&t(se),w&&t(U)}}}function FM(J){let d,b,p,g,k;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),g=n("Module"),k=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=r(l,"P",{});var m=i(d);b=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(m,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function LM(J){let d,b,p,g,k;return g=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkxvbmdmb3JtZXJGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJhbGxlbmFpJTJGbG9uZ2Zvcm1lci1iYXNlLTQwOTYlMjIpJTBBbW9kZWwlMjAlM0QlMjBURkxvbmdmb3JtZXJGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJhbGxlbmFpJTJGbG9uZ2Zvcm1lci1iYXNlLTQwOTYlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQSUwQWxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWQlMjAlM0QlMjBpbnQodGYubWF0aC5hcmdtYXgobG9naXRzJTJDJTIwYXhpcyUzRC0xKSU1QjAlNUQp",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=a("p"),b=n("Example:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Example:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function EM(J){let d,b;return d=new et({props:{code:"JTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwVEZMb25nZm9ybWVyRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyYWxsZW5haSUyRmxvbmdmb3JtZXItYmFzZS00MDk2JTIyJTJDJTIwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdGYuY29uc3RhbnQoMSklMEFsb3NzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjBsYWJlbHMlM0RsYWJlbHMpLmxvc3M=",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(){T(d.$$.fragment)},l(p){v(d.$$.fragment,p)},m(p,g){y(d,p,g),b=!0},p:nt,i(p){b||(M(d.$$.fragment,p),b=!0)},o(p){$(d.$$.fragment,p),b=!1},d(p){x(d,p)}}}function jM(J){let d,b,p,g,k,l,m,j,ae,ee,N,re,oe,F,ye,V,fe,qe,X,ie,de,R,he,Me,O,$e,ke,G,xe,me,le,z,I,ue,D,Te,ge,S,Fe,ve,C,Le,P,ce,ne,Y,_e,Ee,B,we,H,je,se,U,Je,q,be,ze;return{c(){d=a("p"),b=n("TensorFlow models and layers in "),p=a("code"),g=n("transformers"),k=n(" accept two formats as input:"),l=c(),m=a("ul"),j=a("li"),ae=n("having all inputs as keyword arguments (like PyTorch models), or"),ee=c(),N=a("li"),re=n("having all inputs as a list, tuple or dict in the first positional argument."),oe=c(),F=a("p"),ye=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 `),V=a("code"),fe=n("model.fit()"),qe=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),X=a("code"),ie=n("model.fit()"),de=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),R=a("code"),he=n("fit()"),Me=n(" and "),O=a("code"),$e=n("predict()"),ke=n(`, such as when creating your own layers or models with
the Keras `),G=a("code"),xe=n("Functional"),me=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),le=c(),z=a("ul"),I=a("li"),ue=n("a single Tensor with "),D=a("code"),Te=n("input_ids"),ge=n(" only and nothing else: "),S=a("code"),Fe=n("model(input_ids)"),ve=c(),C=a("li"),Le=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),P=a("code"),ce=n("model([input_ids, attention_mask])"),ne=n(" or "),Y=a("code"),_e=n("model([input_ids, attention_mask, token_type_ids])"),Ee=c(),B=a("li"),we=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=a("code"),je=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),se=c(),U=a("p"),Je=n(`Note that when creating models and layers with
`),q=a("a"),be=n("subclassing"),ze=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=r(w,"P",{});var L=i(d);b=s(L,"TensorFlow models and layers in "),p=r(L,"CODE",{});var Re=i(p);g=s(Re,"transformers"),Re.forEach(t),k=s(L," accept two formats as input:"),L.forEach(t),l=h(w),m=r(w,"UL",{});var te=i(m);j=r(te,"LI",{});var Oe=i(j);ae=s(Oe,"having all inputs as keyword arguments (like PyTorch models), or"),Oe.forEach(t),ee=h(te),N=r(te,"LI",{});var Se=i(N);re=s(Se,"having all inputs as a list, tuple or dict in the first positional argument."),Se.forEach(t),te.forEach(t),oe=h(w),F=r(w,"P",{});var E=i(F);ye=s(E,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),V=r(E,"CODE",{});var Xe=i(V);fe=s(Xe,"model.fit()"),Xe.forEach(t),qe=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),X=r(E,"CODE",{});var Pe=i(X);ie=s(Pe,"model.fit()"),Pe.forEach(t),de=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),R=r(E,"CODE",{});var Ze=i(R);he=s(Ze,"fit()"),Ze.forEach(t),Me=s(E," and "),O=r(E,"CODE",{});var Ce=i(O);$e=s(Ce,"predict()"),Ce.forEach(t),ke=s(E,`, such as when creating your own layers or models with
the Keras `),G=r(E,"CODE",{});var Ne=i(G);xe=s(Ne,"Functional"),Ne.forEach(t),me=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),le=h(w),z=r(w,"UL",{});var W=i(z);I=r(W,"LI",{});var A=i(I);ue=s(A,"a single Tensor with "),D=r(A,"CODE",{});var Qe=i(D);Te=s(Qe,"input_ids"),Qe.forEach(t),ge=s(A," only and nothing else: "),S=r(A,"CODE",{});var We=i(S);Fe=s(We,"model(input_ids)"),We.forEach(t),A.forEach(t),ve=h(W),C=r(W,"LI",{});var K=i(C);Le=s(K,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),P=r(K,"CODE",{});var Be=i(P);ce=s(Be,"model([input_ids, attention_mask])"),Be.forEach(t),ne=s(K," or "),Y=r(K,"CODE",{});var Q=i(Y);_e=s(Q,"model([input_ids, attention_mask, token_type_ids])"),Q.forEach(t),K.forEach(t),Ee=h(W),B=r(W,"LI",{});var Ie=i(B);we=s(Ie,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=r(Ie,"CODE",{});var Ge=i(H);je=s(Ge,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Ge.forEach(t),Ie.forEach(t),W.forEach(t),se=h(w),U=r(w,"P",{});var pe=i(U);Je=s(pe,`Note that when creating models and layers with
`),q=r(pe,"A",{href:!0,rel:!0});var Ae=i(q);be=s(Ae,"subclassing"),Ae.forEach(t),ze=s(pe,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),pe.forEach(t),this.h()},h(){u(q,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(q,"rel","nofollow")},m(w,L){f(w,d,L),e(d,b),e(d,p),e(p,g),e(d,k),f(w,l,L),f(w,m,L),e(m,j),e(j,ae),e(m,ee),e(m,N),e(N,re),f(w,oe,L),f(w,F,L),e(F,ye),e(F,V),e(V,fe),e(F,qe),e(F,X),e(X,ie),e(F,de),e(F,R),e(R,he),e(F,Me),e(F,O),e(O,$e),e(F,ke),e(F,G),e(G,xe),e(F,me),f(w,le,L),f(w,z,L),e(z,I),e(I,ue),e(I,D),e(D,Te),e(I,ge),e(I,S),e(S,Fe),e(z,ve),e(z,C),e(C,Le),e(C,P),e(P,ce),e(C,ne),e(C,Y),e(Y,_e),e(z,Ee),e(z,B),e(B,we),e(B,H),e(H,je),f(w,se,L),f(w,U,L),e(U,Je),e(U,q),e(q,be),e(U,ze)},d(w){w&&t(d),w&&t(l),w&&t(m),w&&t(oe),w&&t(F),w&&t(le),w&&t(z),w&&t(se),w&&t(U)}}}function JM(J){let d,b,p,g,k;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),g=n("Module"),k=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=r(l,"P",{});var m=i(d);b=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(m,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function zM(J){let d,b,p,g,k;return g=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkxvbmdmb3JtZXJGb3JUb2tlbkNsYXNzaWZpY2F0aW9uJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJhbGxlbmFpJTJGbG9uZ2Zvcm1lci1iYXNlLTQwOTYlMjIpJTBBbW9kZWwlMjAlM0QlMjBURkxvbmdmb3JtZXJGb3JUb2tlbkNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJhbGxlbmFpJTJGbG9uZ2Zvcm1lci1iYXNlLTQwOTYlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUwQSUyMCUyMCUyMCUyMCUyMkh1Z2dpbmdGYWNlJTIwaXMlMjBhJTIwY29tcGFueSUyMGJhc2VkJTIwaW4lMjBQYXJpcyUyMGFuZCUyME5ldyUyMFlvcmslMjIlMkMlMjBhZGRfc3BlY2lhbF90b2tlbnMlM0RGYWxzZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIlMEEpJTBBJTBBbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQXByZWRpY3RlZF90b2tlbl9jbGFzc19pZHMlMjAlM0QlMjB0Zi5tYXRoLmFyZ21heChsb2dpdHMlMkMlMjBheGlzJTNELTEpJTBBJTBBJTIzJTIwTm90ZSUyMHRoYXQlMjB0b2tlbnMlMjBhcmUlMjBjbGFzc2lmaWVkJTIwcmF0aGVyJTIwdGhlbiUyMGlucHV0JTIwd29yZHMlMjB3aGljaCUyMG1lYW5zJTIwdGhhdCUwQSUyMyUyMHRoZXJlJTIwbWlnaHQlMjBiZSUyMG1vcmUlMjBwcmVkaWN0ZWQlMjB0b2tlbiUyMGNsYXNzZXMlMjB0aGFuJTIwd29yZHMuJTBBJTIzJTIwTXVsdGlwbGUlMjB0b2tlbiUyMGNsYXNzZXMlMjBtaWdodCUyMGFjY291bnQlMjBmb3IlMjB0aGUlMjBzYW1lJTIwd29yZCUwQXByZWRpY3RlZF90b2tlbnNfY2xhc3NlcyUyMCUzRCUyMCU1Qm1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnQlNUQlMjBmb3IlMjB0JTIwaW4lMjBwcmVkaWN0ZWRfdG9rZW5fY2xhc3NfaWRzJTVCMCU1RC5udW1weSgpLnRvbGlzdCgpJTVE",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=a("p"),b=n("Example:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Example:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function CM(J){let d,b;return d=new et({props:{code:"bGFiZWxzJTIwJTNEJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUwQWxvc3MlMjAlM0QlMjB0Zi5tYXRoLnJlZHVjZV9tZWFuKG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKS5sb3NzKQ==",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(){T(d.$$.fragment)},l(p){v(d.$$.fragment,p)},m(p,g){y(d,p,g),b=!0},p:nt,i(p){b||(M(d.$$.fragment,p),b=!0)},o(p){$(d.$$.fragment,p),b=!1},d(p){x(d,p)}}}function IM(J){let d,b,p,g,k,l,m,j,ae,ee,N,re,oe,F,ye,V,fe,qe,X,ie,de,R,he,Me,O,$e,ke,G,xe,me,le,z,I,ue,D,Te,ge,S,Fe,ve,C,Le,P,ce,ne,Y,_e,Ee,B,we,H,je,se,U,Je,q,be,ze;return{c(){d=a("p"),b=n("TensorFlow models and layers in "),p=a("code"),g=n("transformers"),k=n(" accept two formats as input:"),l=c(),m=a("ul"),j=a("li"),ae=n("having all inputs as keyword arguments (like PyTorch models), or"),ee=c(),N=a("li"),re=n("having all inputs as a list, tuple or dict in the first positional argument."),oe=c(),F=a("p"),ye=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 `),V=a("code"),fe=n("model.fit()"),qe=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),X=a("code"),ie=n("model.fit()"),de=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),R=a("code"),he=n("fit()"),Me=n(" and "),O=a("code"),$e=n("predict()"),ke=n(`, such as when creating your own layers or models with
the Keras `),G=a("code"),xe=n("Functional"),me=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),le=c(),z=a("ul"),I=a("li"),ue=n("a single Tensor with "),D=a("code"),Te=n("input_ids"),ge=n(" only and nothing else: "),S=a("code"),Fe=n("model(input_ids)"),ve=c(),C=a("li"),Le=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),P=a("code"),ce=n("model([input_ids, attention_mask])"),ne=n(" or "),Y=a("code"),_e=n("model([input_ids, attention_mask, token_type_ids])"),Ee=c(),B=a("li"),we=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=a("code"),je=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),se=c(),U=a("p"),Je=n(`Note that when creating models and layers with
`),q=a("a"),be=n("subclassing"),ze=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=r(w,"P",{});var L=i(d);b=s(L,"TensorFlow models and layers in "),p=r(L,"CODE",{});var Re=i(p);g=s(Re,"transformers"),Re.forEach(t),k=s(L," accept two formats as input:"),L.forEach(t),l=h(w),m=r(w,"UL",{});var te=i(m);j=r(te,"LI",{});var Oe=i(j);ae=s(Oe,"having all inputs as keyword arguments (like PyTorch models), or"),Oe.forEach(t),ee=h(te),N=r(te,"LI",{});var Se=i(N);re=s(Se,"having all inputs as a list, tuple or dict in the first positional argument."),Se.forEach(t),te.forEach(t),oe=h(w),F=r(w,"P",{});var E=i(F);ye=s(E,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),V=r(E,"CODE",{});var Xe=i(V);fe=s(Xe,"model.fit()"),Xe.forEach(t),qe=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),X=r(E,"CODE",{});var Pe=i(X);ie=s(Pe,"model.fit()"),Pe.forEach(t),de=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),R=r(E,"CODE",{});var Ze=i(R);he=s(Ze,"fit()"),Ze.forEach(t),Me=s(E," and "),O=r(E,"CODE",{});var Ce=i(O);$e=s(Ce,"predict()"),Ce.forEach(t),ke=s(E,`, such as when creating your own layers or models with
the Keras `),G=r(E,"CODE",{});var Ne=i(G);xe=s(Ne,"Functional"),Ne.forEach(t),me=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),le=h(w),z=r(w,"UL",{});var W=i(z);I=r(W,"LI",{});var A=i(I);ue=s(A,"a single Tensor with "),D=r(A,"CODE",{});var Qe=i(D);Te=s(Qe,"input_ids"),Qe.forEach(t),ge=s(A," only and nothing else: "),S=r(A,"CODE",{});var We=i(S);Fe=s(We,"model(input_ids)"),We.forEach(t),A.forEach(t),ve=h(W),C=r(W,"LI",{});var K=i(C);Le=s(K,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),P=r(K,"CODE",{});var Be=i(P);ce=s(Be,"model([input_ids, attention_mask])"),Be.forEach(t),ne=s(K," or "),Y=r(K,"CODE",{});var Q=i(Y);_e=s(Q,"model([input_ids, attention_mask, token_type_ids])"),Q.forEach(t),K.forEach(t),Ee=h(W),B=r(W,"LI",{});var Ie=i(B);we=s(Ie,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),H=r(Ie,"CODE",{});var Ge=i(H);je=s(Ge,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Ge.forEach(t),Ie.forEach(t),W.forEach(t),se=h(w),U=r(w,"P",{});var pe=i(U);Je=s(pe,`Note that when creating models and layers with
`),q=r(pe,"A",{href:!0,rel:!0});var Ae=i(q);be=s(Ae,"subclassing"),Ae.forEach(t),ze=s(pe,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),pe.forEach(t),this.h()},h(){u(q,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),u(q,"rel","nofollow")},m(w,L){f(w,d,L),e(d,b),e(d,p),e(p,g),e(d,k),f(w,l,L),f(w,m,L),e(m,j),e(j,ae),e(m,ee),e(m,N),e(N,re),f(w,oe,L),f(w,F,L),e(F,ye),e(F,V),e(V,fe),e(F,qe),e(F,X),e(X,ie),e(F,de),e(F,R),e(R,he),e(F,Me),e(F,O),e(O,$e),e(F,ke),e(F,G),e(G,xe),e(F,me),f(w,le,L),f(w,z,L),e(z,I),e(I,ue),e(I,D),e(D,Te),e(I,ge),e(I,S),e(S,Fe),e(z,ve),e(z,C),e(C,Le),e(C,P),e(P,ce),e(C,ne),e(C,Y),e(Y,_e),e(z,Ee),e(z,B),e(B,we),e(B,H),e(H,je),f(w,se,L),f(w,U,L),e(U,Je),e(U,q),e(q,be),e(U,ze)},d(w){w&&t(d),w&&t(l),w&&t(m),w&&t(oe),w&&t(F),w&&t(le),w&&t(z),w&&t(se),w&&t(U)}}}function UM(J){let d,b,p,g,k;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),p=a("code"),g=n("Module"),k=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=r(l,"P",{});var m=i(d);b=s(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(m,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(l,m){f(l,d,m),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function qM(J){let d,b,p,g,k;return g=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkxvbmdmb3JtZXJGb3JNdWx0aXBsZUNob2ljZSUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyYWxsZW5haSUyRmxvbmdmb3JtZXItYmFzZS00MDk2JTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZMb25nZm9ybWVyRm9yTXVsdGlwbGVDaG9pY2UuZnJvbV9wcmV0cmFpbmVkKCUyMmFsbGVuYWklMkZsb25nZm9ybWVyLWJhc2UtNDA5NiUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJJbiUyMEl0YWx5JTJDJTIwcGl6emElMjBzZXJ2ZWQlMjBpbiUyMGZvcm1hbCUyMHNldHRpbmdzJTJDJTIwc3VjaCUyMGFzJTIwYXQlMjBhJTIwcmVzdGF1cmFudCUyQyUyMGlzJTIwcHJlc2VudGVkJTIwdW5zbGljZWQuJTIyJTBBY2hvaWNlMCUyMCUzRCUyMCUyMkl0JTIwaXMlMjBlYXRlbiUyMHdpdGglMjBhJTIwZm9yayUyMGFuZCUyMGElMjBrbmlmZS4lMjIlMEFjaG9pY2UxJTIwJTNEJTIwJTIySXQlMjBpcyUyMGVhdGVuJTIwd2hpbGUlMjBoZWxkJTIwaW4lMjB0aGUlMjBoYW5kLiUyMiUwQSUwQWVuY29kaW5nJTIwJTNEJTIwdG9rZW5pemVyKCU1QnByb21wdCUyQyUyMHByb21wdCU1RCUyQyUyMCU1QmNob2ljZTAlMkMlMjBjaG9pY2UxJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiUyQyUyMHBhZGRpbmclM0RUcnVlKSUwQWlucHV0cyUyMCUzRCUyMCU3QmslM0ElMjB0Zi5leHBhbmRfZGltcyh2JTJDJTIwMCklMjBmb3IlMjBrJTJDJTIwdiUyMGluJTIwZW5jb2RpbmcuaXRlbXMoKSU3RCUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dHMpJTIwJTIwJTIzJTIwYmF0Y2glMjBzaXplJTIwaXMlMjAxJTBBJTBBJTIzJTIwdGhlJTIwbGluZWFyJTIwY2xhc3NpZmllciUyMHN0aWxsJTIwbmVlZHMlMjB0byUyMGJlJTIwdHJhaW5lZCUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",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=a("p"),b=n("Example:"),p=c(),T(g.$$.fragment)},l(l){d=r(l,"P",{});var m=i(d);b=s(m,"Example:"),m.forEach(t),p=h(l),v(g.$$.fragment,l)},m(l,m){f(l,d,m),e(d,b),f(l,p,m),y(g,l,m),k=!0},p:nt,i(l){k||(M(g.$$.fragment,l),k=!0)},o(l){$(g.$$.fragment,l),k=!1},d(l){l&&t(d),l&&t(p),x(g,l)}}}function NM(J){let d,b,p,g,k,l,m,j,ae,ee,N,re,oe,F,ye,V,fe,qe,X,ie,de,R,he,Me,O,$e,ke,G,xe,me,le,z,I,ue,D,Te,ge,S,Fe,ve,C,Le,P,ce,ne,Y,_e,Ee,B,we,H,je,se,U,Je,q,be,ze,w,L,Re,te,Oe,Se,E,Xe,Pe,Ze,Ce,Ne,W,A,Qe,We,K,Be,Q,Ie,Ge,pe='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mn>1</mn><mn>2</mn></mfrac><mi>w</mi></mrow><annotation encoding="application/x-tex">\\frac{1}{2} w</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.1901em;vertical-align:-0.345em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8451em;"><span style="top:-2.655em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span></span></span></span>',Ae,Tc,W2='<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>',vc,yc,Z2='<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>',Mc,Xi,rp,ip,Pi,lp,dp,Qi,cp,hp,$c,B2='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>w</mi></mrow><annotation encoding="application/x-tex">w</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span></span></span></span>',xc,Di,mp,pp,Fc,Zt,fp,Lc,G2='<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>',Ec,Yi,up,gp,jc,Bt,_p,Hi,wp,bp,Ki,kp,Tp,Jc,rn,el,vp,yp,tl,Mp,zc,ln,$p,Nr,xp,Fp,Cc,bt,Lp,Ic,A2='<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>',Uc,qc,V2='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">O</mi><mo stretchy="false">(</mo><msub><mi>n</mi><mi>s</mi></msub><mo>\xD7</mo><mi>w</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\\mathcal{O}(n_s \\times w)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.02778em;">O</span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\xD7</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span><span class="mclose">)</span></span></span></span>',Nc,Wc,R2='<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>',Zc,Bc,O2='<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>',Gc,Ac,dn,Ep,ys,jp,Jp,Vc,oo,cn,ol,Ms,zp,nl,Cp,Rc,no,Wr,Ip,Up,Zr,qp,Np,Oc,$s,Sc,so,hn,sl,xs,Wp,al,Zp,Xc,kt,rl,Br,Bp,Gp,il,Gr,Ap,Vp,ll,Ar,Rp,Op,dl,Vr,Sp,Xp,cl,Rr,Pp,Pc,ao,mn,hl,Fs,Qp,ml,Dp,Qc,pt,Ls,Yp,ro,Hp,Or,Kp,ef,Sr,tf,of,nf,io,sf,Xr,af,rf,Es,lf,df,cf,lo,hf,Pr,mf,pf,Qr,ff,uf,gf,pn,Dc,co,fn,pl,js,_f,fl,wf,Yc,Ue,Js,bf,ul,kf,Tf,gl,vf,yf,un,Mf,zs,$f,_l,xf,Ff,Lf,gn,Ef,Cs,jf,Dr,Jf,zf,Cf,Gt,Is,If,wl,Uf,qf,Us,Yr,Nf,bl,Wf,Zf,Hr,Bf,kl,Gf,Af,_n,qs,Vf,Tl,Rf,Of,wn,Ns,Sf,vl,Xf,Pf,bn,Ws,Qf,Zs,Df,yl,Yf,Hf,Hc,ho,kn,Ml,Bs,Kf,$l,eu,Kc,De,Gs,tu,As,ou,xl,nu,su,au,Fl,ru,iu,Tn,lu,Vs,du,Ll,cu,hu,mu,vn,pu,Rs,fu,Kr,uu,gu,_u,yn,Os,wu,El,bu,eh,mo,Mn,jl,Ss,ku,Jl,Tu,th,po,Xs,vu,zl,yu,oh,fo,Ps,Mu,Cl,$u,nh,uo,Qs,xu,Il,Fu,sh,go,Ds,Lu,Ul,Eu,ah,_o,Ys,ju,ql,Ju,rh,wo,Hs,zu,Nl,Cu,ih,bo,Ks,Iu,Wl,Uu,lh,ko,ea,qu,Zl,Nu,dh,To,ta,Wu,Bl,Zu,ch,vo,oa,Bu,Gl,Gu,hh,yo,na,Au,Al,Vu,mh,Mo,sa,Ru,Vl,Ou,ph,$o,aa,Su,Rl,Xu,fh,xo,ra,Pu,Ol,Qu,uh,Fo,$n,Sl,ia,Du,Xl,Yu,gh,st,la,Hu,Pl,Ku,eg,da,tg,ei,og,ng,sg,ca,ag,ha,rg,ig,lg,Lo,dg,ti,cg,hg,ma,mg,pg,fg,pa,ug,Ql,gg,_g,wg,Ft,fa,bg,Eo,kg,oi,Tg,vg,Dl,yg,Mg,$g,xn,xg,Fn,_h,jo,Ln,Yl,ua,Fg,Hl,Lg,wh,ft,ga,Eg,_a,jg,Kl,Jg,zg,Cg,wa,Ig,ni,Ug,qg,Ng,ba,Wg,ka,Zg,Bg,Gg,ct,Ta,Ag,Jo,Vg,si,Rg,Og,ed,Sg,Xg,Pg,En,Qg,jn,Dg,td,Yg,Hg,Jn,bh,zo,zn,od,va,Kg,nd,e_,kh,ut,ya,t_,sd,o_,n_,Ma,s_,ai,a_,r_,i_,$a,l_,xa,d_,c_,h_,Tt,Fa,m_,Co,p_,ri,f_,u_,ad,g_,__,w_,Cn,b_,In,k_,Un,Th,Io,qn,rd,La,T_,id,v_,vh,gt,Ea,y_,ld,M_,$_,ja,x_,ii,F_,L_,E_,Ja,j_,za,J_,z_,C_,Lt,Ca,I_,Uo,U_,li,q_,N_,dd,W_,Z_,B_,Nn,G_,Wn,yh,qo,Zn,cd,Ia,A_,hd,V_,Mh,_t,Ua,R_,md,O_,S_,qa,X_,di,P_,Q_,D_,Na,Y_,Wa,H_,K_,ew,Et,Za,tw,No,ow,ci,nw,sw,pd,aw,rw,iw,Bn,lw,Gn,$h,Wo,An,fd,Ba,dw,ud,cw,xh,wt,Ga,hw,Zo,mw,gd,pw,fw,_d,uw,gw,_w,Aa,ww,hi,bw,kw,Tw,Va,vw,Ra,yw,Mw,$w,jt,Oa,xw,Bo,Fw,mi,Lw,Ew,wd,jw,Jw,zw,Vn,Cw,Rn,Fh,Go,On,bd,Sa,Iw,kd,Uw,Lh,Ye,Xa,qw,Td,Nw,Ww,Pa,Zw,pi,Bw,Gw,Aw,Qa,Vw,Da,Rw,Ow,Sw,Sn,Xw,Ao,Pw,fi,Qw,Dw,Ya,Yw,Hw,Kw,Ha,eb,vd,tb,ob,nb,At,Ka,sb,Vo,ab,ui,rb,ib,yd,lb,db,cb,Xn,Eh,Ro,Pn,Md,er,hb,$d,mb,jh,at,tr,pb,or,fb,xd,ub,gb,_b,nr,wb,gi,bb,kb,Tb,sr,vb,ar,yb,Mb,$b,Qn,xb,vt,rr,Fb,Oo,Lb,_i,Eb,jb,Fd,Jb,zb,Cb,Dn,Ib,Yn,Ub,Hn,Jh,So,Kn,Ld,ir,qb,Ed,Nb,zh,rt,lr,Wb,Xo,Zb,jd,Bb,Gb,Jd,Ab,Vb,Rb,dr,Ob,wi,Sb,Xb,Pb,cr,Qb,hr,Db,Yb,Hb,es,Kb,yt,mr,ek,Po,tk,bi,ok,nk,zd,sk,ak,rk,ts,ik,os,lk,ns,Ch,Qo,ss,Cd,pr,dk,Id,ck,Ih,it,fr,hk,Ud,mk,pk,ur,fk,ki,uk,gk,_k,gr,wk,_r,bk,kk,Tk,as,vk,Mt,wr,yk,Do,Mk,Ti,$k,xk,qd,Fk,Lk,Ek,rs,jk,is,Jk,ls,Uh,Yo,ds,Nd,br,zk,Wd,Ck,qh,lt,kr,Ik,Zd,Uk,qk,Tr,Nk,vi,Wk,Zk,Bk,vr,Gk,yr,Ak,Vk,Rk,cs,Ok,$t,Mr,Sk,Ho,Xk,yi,Pk,Qk,Bd,Dk,Yk,Hk,hs,Kk,ms,eT,ps,Nh,Ko,fs,Gd,$r,tT,Ad,oT,Wh,dt,xr,nT,Vd,sT,aT,Fr,rT,Mi,iT,lT,dT,Lr,cT,Er,hT,mT,pT,us,fT,Jt,jr,uT,en,gT,$i,_T,wT,Rd,bT,kT,TT,gs,vT,_s,Zh;return l=new Ke({}),he=new Ke({}),A=new Ke({}),Ms=new Ke({}),$s=new et({props:{code:"aW5wdXRfaWRzJTIwJTNEJTIwdG9rZW5pemVyLmVuY29kZSglMjJUaGlzJTIwaXMlMjBhJTIwc2VudGVuY2UlMjBmcm9tJTIwJTVCTUFTSyU1RCUyMHRyYWluaW5nJTIwZGF0YSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBbWxtX2xhYmVscyUyMCUzRCUyMHRva2VuaXplci5lbmNvZGUoJTIyVGhpcyUyMGlzJTIwYSUyMHNlbnRlbmNlJTIwZnJvbSUyMHRoZSUyMHRyYWluaW5nJTIwZGF0YSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBbG9zcyUyMCUzRCUyMG1vZGVsKGlucHV0X2lkcyUyQyUyMGxhYmVscyUzRGlucHV0X2lkcyUyQyUyMG1hc2tlZF9sbV9sYWJlbHMlM0RtbG1fbGFiZWxzKSU1QjAlNUQ=",highlighted:`input_ids = tokenizer.encode(<span class="hljs-string">&quot;This is a sentence from [MASK] training data&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
mlm_labels = tokenizer.encode(<span class="hljs-string">&quot;This is a sentence from the training data&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

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

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

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

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

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