import{S as SM,i as XM,s as PM,e as a,k as c,w as T,t as n,Y as sn,M as QM,c as r,d as t,m,a as i,x as y,h as s,Z as an,b as u,N as NM,G as e,g as f,y as v,q as M,o as $,B as x,v as DM,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 YM(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 h=i(d);b=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 HM(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 h=i(d);b=s(h,"be encoded differently whether it is at the beginning of the sentence (without space) or not:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 KM(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 h=i(d);b=s(h,"When used with "),p=r(h,"CODE",{});var j=i(p);g=s(j,"is_split_into_words=True"),j.forEach(t),k=s(h,", this tokenizer will add a space before each word (even the first one)."),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function e2(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 h=i(d);b=s(h,"be encoded differently whether it is at the beginning of the sentence (without space) or not:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 t2(J){let d,b,p,g,k,l,h,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"),h=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);h=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,h),e(d,j)},d(ae){ae&&t(d)}}}function o2(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 h=i(d);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(h,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function n2(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 h=i(d);b=s(h,"Examples:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 s2(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 h=i(d);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(h,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function a2(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 h=i(d);b=s(h,"Mask filling example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 r2(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){y(d.$$.fragment,p)},m(p,g){v(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 i2(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 h=i(d);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(h,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function l2(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 h=i(d);b=s(h,"Example of single-label classification:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 d2(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 h=i(d);b=s(h,"Example of multi-label classification:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 c2(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 h=i(d);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(h,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function m2(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 h=i(d);b=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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{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 h=i(d);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(h,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function p2(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 h=i(d);b=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 f2(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 h=i(d);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(h,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function u2(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 h=i(d);b=s(h,"Examples:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 g2(J){let d,b,p,g,k,l,h,j,ae,ee,N,re,oe,F,ve,V,fe,qe,X,ie,de,R,me,Me,O,$e,ke,G,xe,he,le,z,I,ue,D,Te,ge,S,Fe,ye,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(),h=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"),ve=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"),me=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"),he=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)"),ye=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=m(w),h=r(w,"UL",{});var te=i(h);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=m(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=m(w),F=r(w,"P",{});var E=i(F);ve=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);me=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),he=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=m(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),ye=m(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=m(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=m(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,h,L),e(h,j),e(j,ae),e(h,ee),e(h,N),e(N,re),f(w,oe,L),f(w,F,L),e(F,ve),e(F,V),e(V,fe),e(F,qe),e(F,X),e(X,ie),e(F,de),e(F,R),e(R,me),e(F,Me),e(F,O),e(O,$e),e(F,ke),e(F,G),e(G,xe),e(F,he),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,ye),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(h),w&&t(oe),w&&t(F),w&&t(le),w&&t(z),w&&t(se),w&&t(U)}}}function _2(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 h=i(d);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(h,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function w2(J){let d,b,p,g,k,l,h,j,ae,ee,N,re,oe,F,ve,V,fe,qe,X,ie,de,R,me,Me,O,$e,ke,G,xe,he,le,z,I,ue,D,Te,ge,S,Fe,ye,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(),h=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"),ve=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"),me=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"),he=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)"),ye=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=m(w),h=r(w,"UL",{});var te=i(h);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=m(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=m(w),F=r(w,"P",{});var E=i(F);ve=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);me=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),he=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=m(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),ye=m(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=m(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=m(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,h,L),e(h,j),e(j,ae),e(h,ee),e(h,N),e(N,re),f(w,oe,L),f(w,F,L),e(F,ve),e(F,V),e(V,fe),e(F,qe),e(F,X),e(X,ie),e(F,de),e(F,R),e(R,me),e(F,Me),e(F,O),e(O,$e),e(F,ke),e(F,G),e(G,xe),e(F,he),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,ye),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(h),w&&t(oe),w&&t(F),w&&t(le),w&&t(z),w&&t(se),w&&t(U)}}}function b2(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 h=i(d);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(h,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function k2(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 h=i(d);b=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 T2(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){y(d.$$.fragment,p)},m(p,g){v(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 y2(J){let d,b,p,g,k,l,h,j,ae,ee,N,re,oe,F,ve,V,fe,qe,X,ie,de,R,me,Me,O,$e,ke,G,xe,he,le,z,I,ue,D,Te,ge,S,Fe,ye,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(),h=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"),ve=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"),me=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"),he=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)"),ye=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=m(w),h=r(w,"UL",{});var te=i(h);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=m(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=m(w),F=r(w,"P",{});var E=i(F);ve=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);me=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),he=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=m(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),ye=m(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=m(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=m(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,h,L),e(h,j),e(j,ae),e(h,ee),e(h,N),e(N,re),f(w,oe,L),f(w,F,L),e(F,ve),e(F,V),e(V,fe),e(F,qe),e(F,X),e(X,ie),e(F,de),e(F,R),e(R,me),e(F,Me),e(F,O),e(O,$e),e(F,ke),e(F,G),e(G,xe),e(F,he),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,ye),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(h),w&&t(oe),w&&t(F),w&&t(le),w&&t(z),w&&t(se),w&&t(U)}}}function v2(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 h=i(d);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(h,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function M2(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 h=i(d);b=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 $2(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){y(d.$$.fragment,p)},m(p,g){v(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 x2(J){let d,b,p,g,k,l,h,j,ae,ee,N,re,oe,F,ve,V,fe,qe,X,ie,de,R,me,Me,O,$e,ke,G,xe,he,le,z,I,ue,D,Te,ge,S,Fe,ye,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(),h=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"),ve=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"),me=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"),he=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)"),ye=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=m(w),h=r(w,"UL",{});var te=i(h);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=m(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=m(w),F=r(w,"P",{});var E=i(F);ve=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);me=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),he=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=m(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),ye=m(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=m(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=m(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,h,L),e(h,j),e(j,ae),e(h,ee),e(h,N),e(N,re),f(w,oe,L),f(w,F,L),e(F,ve),e(F,V),e(V,fe),e(F,qe),e(F,X),e(X,ie),e(F,de),e(F,R),e(R,me),e(F,Me),e(F,O),e(O,$e),e(F,ke),e(F,G),e(G,xe),e(F,he),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,ye),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(h),w&&t(oe),w&&t(F),w&&t(le),w&&t(z),w&&t(se),w&&t(U)}}}function F2(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 h=i(d);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(h,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function L2(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 h=i(d);b=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 E2(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){y(d.$$.fragment,p)},m(p,g){v(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 j2(J){let d,b,p,g,k,l,h,j,ae,ee,N,re,oe,F,ve,V,fe,qe,X,ie,de,R,me,Me,O,$e,ke,G,xe,he,le,z,I,ue,D,Te,ge,S,Fe,ye,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(),h=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"),ve=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"),me=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"),he=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)"),ye=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=m(w),h=r(w,"UL",{});var te=i(h);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=m(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=m(w),F=r(w,"P",{});var E=i(F);ve=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);me=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),he=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=m(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),ye=m(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=m(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=m(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,h,L),e(h,j),e(j,ae),e(h,ee),e(h,N),e(N,re),f(w,oe,L),f(w,F,L),e(F,ve),e(F,V),e(V,fe),e(F,qe),e(F,X),e(X,ie),e(F,de),e(F,R),e(R,me),e(F,Me),e(F,O),e(O,$e),e(F,ke),e(F,G),e(G,xe),e(F,he),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,ye),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(h),w&&t(oe),w&&t(F),w&&t(le),w&&t(z),w&&t(se),w&&t(U)}}}function J2(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 h=i(d);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(h,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function z2(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 h=i(d);b=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 C2(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){y(d.$$.fragment,p)},m(p,g){v(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 I2(J){let d,b,p,g,k,l,h,j,ae,ee,N,re,oe,F,ve,V,fe,qe,X,ie,de,R,me,Me,O,$e,ke,G,xe,he,le,z,I,ue,D,Te,ge,S,Fe,ye,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(),h=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"),ve=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"),me=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"),he=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)"),ye=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=m(w),h=r(w,"UL",{});var te=i(h);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=m(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=m(w),F=r(w,"P",{});var E=i(F);ve=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);me=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),he=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=m(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),ye=m(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=m(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=m(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,h,L),e(h,j),e(j,ae),e(h,ee),e(h,N),e(N,re),f(w,oe,L),f(w,F,L),e(F,ve),e(F,V),e(V,fe),e(F,qe),e(F,X),e(X,ie),e(F,de),e(F,R),e(R,me),e(F,Me),e(F,O),e(O,$e),e(F,ke),e(F,G),e(G,xe),e(F,he),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,ye),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(h),w&&t(oe),w&&t(F),w&&t(le),w&&t(z),w&&t(se),w&&t(U)}}}function U2(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 h=i(d);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),p=r(h,"CODE",{});var j=i(p);g=s(j,"Module"),j.forEach(t),k=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){f(l,d,h),e(d,b),e(d,p),e(p,g),e(d,k)},d(l){l&&t(d)}}}function q2(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 h=i(d);b=s(h,"Example:"),h.forEach(t),p=m(l),y(g.$$.fragment,l)},m(l,h){f(l,d,h),e(d,b),f(l,p,h),v(g,l,h),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 N2(J){let d,b,p,g,k,l,h,j,ae,ee,N,re,oe,F,ve,V,fe,qe,X,ie,de,R,me,Me,O,$e,ke,G,xe,he,le,z,I,ue,D,Te,ge,S,Fe,ye,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,WM='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mn>1</mn><mn>2</mn></mfrac><mi>w</mi></mrow><annotation encoding="application/x-tex">\\frac{1}{2} w</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.1901em;vertical-align:-0.345em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8451em;"><span style="top:-2.655em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span></span></span></span>',yc,vc,ZM='<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,mp,$c,BM='<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,hp,pp,Fc,Zt,fp,Lc,GM='<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,yp,vp,tl,Mp,zc,ln,$p,Nr,xp,Fp,Cc,bt,Lp,Ic,AM='<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,VM='<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,RM='<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,OM='<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,vs,jp,Jp,Vc,oo,cn,ol,Ms,zp,nl,Cp,Rc,no,Wr,Ip,Up,Zr,qp,Np,Oc,$s,Sc,so,mn,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,hn,ml,Fs,Qp,hl,Dp,Qc,pt,Ls,Yp,ro,Hp,Or,Kp,ef,Sr,tf,of,nf,io,sf,Xr,af,rf,Es,lf,df,cf,lo,mf,Pr,hf,pf,Qr,ff,uf,gf,pn,Dc,co,fn,pl,js,_f,fl,wf,Yc,Ue,Js,bf,ul,kf,Tf,gl,yf,vf,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,yl,Xf,Pf,bn,Ws,Qf,Zs,Df,vl,Yf,Hf,Hc,mo,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,mu,hu,yn,pu,Rs,fu,Kr,uu,gu,_u,vn,Os,wu,El,bu,em,ho,Mn,jl,Ss,ku,Jl,Tu,tm,po,Xs,yu,zl,vu,om,fo,Ps,Mu,Cl,$u,nm,uo,Qs,xu,Il,Fu,sm,go,Ds,Lu,Ul,Eu,am,_o,Ys,ju,ql,Ju,rm,wo,Hs,zu,Nl,Cu,im,bo,Ks,Iu,Wl,Uu,lm,ko,ea,qu,Zl,Nu,dm,To,ta,Wu,Bl,Zu,cm,yo,oa,Bu,Gl,Gu,mm,vo,na,Au,Al,Vu,hm,Mo,sa,Ru,Vl,Ou,pm,$o,aa,Su,Rl,Xu,fm,xo,ra,Pu,Ol,Qu,um,Fo,$n,Sl,ia,Du,Xl,Yu,gm,st,la,Hu,Pl,Ku,eg,da,tg,ei,og,ng,sg,ca,ag,ma,rg,ig,lg,Lo,dg,ti,cg,mg,ha,hg,pg,fg,pa,ug,Ql,gg,_g,wg,Ft,fa,bg,Eo,kg,oi,Tg,yg,Dl,vg,Mg,$g,xn,xg,Fn,_m,jo,Ln,Yl,ua,Fg,Hl,Lg,wm,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,bm,zo,zn,od,ya,Kg,nd,e_,km,ut,va,t_,sd,o_,n_,Ma,s_,ai,a_,r_,i_,$a,l_,xa,d_,c_,m_,Tt,Fa,h_,Co,p_,ri,f_,u_,ad,g_,__,w_,Cn,b_,In,k_,Un,Tm,Io,qn,rd,La,T_,id,y_,ym,gt,Ea,v_,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,vm,qo,Zn,cd,Ia,A_,md,V_,Mm,_t,Ua,R_,hd,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,$m,Wo,An,fd,Ba,dw,ud,cw,xm,wt,Ga,mw,Zo,hw,gd,pw,fw,_d,uw,gw,_w,Aa,ww,mi,bw,kw,Tw,Va,yw,Ra,vw,Mw,$w,jt,Oa,xw,Bo,Fw,hi,Lw,Ew,wd,jw,Jw,zw,Vn,Cw,Rn,Fm,Go,On,bd,Sa,Iw,kd,Uw,Lm,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,yd,tb,ob,nb,At,Ka,sb,Vo,ab,ui,rb,ib,vd,lb,db,cb,Xn,Em,Ro,Pn,Md,er,mb,$d,hb,jm,at,tr,pb,or,fb,xd,ub,gb,_b,nr,wb,gi,bb,kb,Tb,sr,yb,ar,vb,Mb,$b,Qn,xb,yt,rr,Fb,Oo,Lb,_i,Eb,jb,Fd,Jb,zb,Cb,Dn,Ib,Yn,Ub,Hn,Jm,So,Kn,Ld,ir,qb,Ed,Nb,zm,rt,lr,Wb,Xo,Zb,jd,Bb,Gb,Jd,Ab,Vb,Rb,dr,Ob,wi,Sb,Xb,Pb,cr,Qb,mr,Db,Yb,Hb,es,Kb,vt,hr,ek,Po,tk,bi,ok,nk,zd,sk,ak,rk,ts,ik,os,lk,ns,Cm,Qo,ss,Cd,pr,dk,Id,ck,Im,it,fr,mk,Ud,hk,pk,ur,fk,ki,uk,gk,_k,gr,wk,_r,bk,kk,Tk,as,yk,Mt,wr,vk,Do,Mk,Ti,$k,xk,qd,Fk,Lk,Ek,rs,jk,is,Jk,ls,Um,Yo,ds,Nd,br,zk,Wd,Ck,qm,lt,kr,Ik,Zd,Uk,qk,Tr,Nk,yi,Wk,Zk,Bk,yr,Gk,vr,Ak,Vk,Rk,cs,Ok,$t,Mr,Sk,Ho,Xk,vi,Pk,Qk,Bd,Dk,Yk,Hk,ms,Kk,hs,eT,ps,Nm,Ko,fs,Gd,$r,tT,Ad,oT,Wm,dt,xr,nT,Vd,sT,aT,Fr,rT,Mi,iT,lT,dT,Lr,cT,Er,mT,hT,pT,us,fT,Jt,jr,uT,en,gT,$i,_T,wT,Rd,bT,kT,TT,gs,yT,_s,Zm;return l=new Ke({}),me=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/main/en/model_doc/longformer#transformers.LongformerModel">LongformerModel</a> or <a href="/docs/transformers/main/en/model_doc/longformer#transformers.TFLongformerModel">TFLongformerModel</a>.`,name:"vocab_size"},{anchor:"transformers.LongformerConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.LongformerConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.LongformerConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.LongformerConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.LongformerConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.LongformerConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.LongformerConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.LongformerConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.LongformerConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/longformer#transformers.LongformerModel">LongformerModel</a> or
<a href="/docs/transformers/main/en/model_doc/longformer#transformers.TFLongformerModel">TFLongformerModel</a>.`,name:"type_vocab_size"},{anchor:"transformers.LongformerConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.LongformerConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.LongformerConfig.attention_window",description:`<strong>attention_window</strong> (<code>int</code> or <code>List[int]</code>, <em>optional</em>, defaults to 512) &#x2014;
Size of an attention window around each token. If an <code>int</code>, use the same size for all layers. To specify a
different window size for each layer, use a <code>List[int]</code> where <code>len(attention_window) == num_hidden_layers</code>.`,name:"attention_window"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/configuration_longformer.py#L46"}}),pn=new ot({props:{anchor:"transformers.LongformerConfig.example",$$slots:{default:[YM]},$$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/main/src/transformers/models/longformer/tokenization_longformer.py#L116"}}),un=new ot({props:{anchor:"transformers.LongformerTokenizer.example",$$slots:{default:[HM]},$$scope:{ctx:J}}}),gn=new tt({props:{$$slots:{default:[KM]},$$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/main/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/main/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/main/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/main/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/main/src/transformers/models/longformer/tokenization_longformer_fast.py#L91"}}),Tn=new ot({props:{anchor:"transformers.LongformerTokenizerFast.example",$$slots:{default:[e2]},$$scope:{ctx:J}}}),yn=new tt({props:{$$slots:{default:[t2]},$$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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</a>) &#x2014; Model configuration class with all the parameters of the
model. Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LongformerModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LongformerModel.forward.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.LongformerModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.LongformerModel.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.LongformerModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LongformerModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LongformerModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LongformerModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LongformerModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.LongformerModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#L1647",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling"
>transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) further processed by a
Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling"
>transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),xn=new tt({props:{$$slots:{default:[o2]},$$scope:{ctx:J}}}),Fn=new ot({props:{anchor:"transformers.LongformerModel.forward.example",$$slots:{default:[n2]},$$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/main/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</a>) &#x2014; Model configuration class with all the parameters of the
model. Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LongformerForMaskedLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LongformerForMaskedLM.forward.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.LongformerForMaskedLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.LongformerForMaskedLM.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.LongformerForMaskedLM.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LongformerForMaskedLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LongformerForMaskedLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LongformerForMaskedLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LongformerForMaskedLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.LongformerForMaskedLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LongformerForMaskedLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked), the
loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"},{anchor:"transformers.LongformerForMaskedLM.forward.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, any]</code>, optional, defaults to <em>{}</em>) &#x2014;
Used to hide legacy arguments that have been deprecated.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#L1790",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput"
>transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Masked language modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput"
>transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),En=new tt({props:{$$slots:{default:[s2]},$$scope:{ctx:J}}}),jn=new ot({props:{anchor:"transformers.LongformerForMaskedLM.forward.example",$$slots:{default:[a2]},$$scope:{ctx:J}}}),Jn=new ot({props:{anchor:"transformers.LongformerForMaskedLM.forward.example-2",$$slots:{default:[r2]},$$scope:{ctx:J}}}),ya=new Ke({}),va=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/main/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</a>) &#x2014; Model configuration class with all the parameters of the
model. Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LongformerForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LongformerForSequenceClassification.forward.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.LongformerForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.LongformerForSequenceClassification.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.LongformerForSequenceClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LongformerForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LongformerForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LongformerForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LongformerForSequenceClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.LongformerForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LongformerForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#L1898",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput"
>transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput"
>transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Cn=new tt({props:{$$slots:{default:[i2]},$$scope:{ctx:J}}}),In=new ot({props:{anchor:"transformers.LongformerForSequenceClassification.forward.example",$$slots:{default:[l2]},$$scope:{ctx:J}}}),Un=new ot({props:{anchor:"transformers.LongformerForSequenceClassification.forward.example-2",$$slots:{default:[d2]},$$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/main/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</a>) &#x2014; Model configuration class with all the parameters of the
model. Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LongformerForMultipleChoice.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LongformerForMultipleChoice.forward.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.LongformerForMultipleChoice.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.LongformerForMultipleChoice.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.LongformerForMultipleChoice.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LongformerForMultipleChoice.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LongformerForMultipleChoice.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LongformerForMultipleChoice.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LongformerForMultipleChoice.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.LongformerForMultipleChoice.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LongformerForMultipleChoice.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the multiple choice classification loss. Indices should be in <code>[0, ..., num_choices-1]</code> where <code>num_choices</code> is the size of the second dimension of the input tensors. (See
<code>input_ids</code> above)`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#L2249",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput"
>transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <em>(1,)</em>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>) \u2014 <em>num_choices</em> is the second dimension of the input tensors. (see <em>input_ids</em> above).</p>
<p>Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput"
>transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Nn=new tt({props:{$$slots:{default:[c2]},$$scope:{ctx:J}}}),Wn=new ot({props:{anchor:"transformers.LongformerForMultipleChoice.forward.example",$$slots:{default:[m2]},$$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/main/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</a>) &#x2014; Model configuration class with all the parameters of the
model. Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LongformerForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LongformerForTokenClassification.forward.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.LongformerForTokenClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.LongformerForTokenClassification.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.LongformerForTokenClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LongformerForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LongformerForTokenClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LongformerForTokenClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LongformerForTokenClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.LongformerForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LongformerForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#L2162",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput"
>transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided)  \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput"
>transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Bn=new tt({props:{$$slots:{default:[h2]},$$scope:{ctx:J}}}),Gn=new ot({props:{anchor:"transformers.LongformerForTokenClassification.forward.example",$$slots:{default:[p2]},$$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/main/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</a>) &#x2014; Model configuration class with all the parameters of the
model. Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LongformerForQuestionAnswering.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.LongformerForQuestionAnswering.forward.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.LongformerForQuestionAnswering.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.LongformerForQuestionAnswering.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.LongformerForQuestionAnswering.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.LongformerForQuestionAnswering.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LongformerForQuestionAnswering.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.LongformerForQuestionAnswering.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.LongformerForQuestionAnswering.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.LongformerForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.LongformerForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.LongformerForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_longformer.py#L2024",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput"
>transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x)</code>,
where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput"
>transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Vn=new tt({props:{$$slots:{default:[f2]},$$scope:{ctx:J}}}),Rn=new ot({props:{anchor:"transformers.LongformerForQuestionAnswering.forward.example",$$slots:{default:[u2]},$$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/main/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_tf_longformer.py#L1993"}}),Sn=new tt({props:{$$slots:{default:[g2]},$$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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLongformerModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLongformerModel.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLongformerModel.call.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.TFLongformerModel.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLongformerModel.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLongformerModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLongformerModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFLongformerModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFLongformerModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFLongformerModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2015"}}),Xn=new tt({props:{$$slots:{default:[_2]},$$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/main/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2052"}}),Qn=new tt({props:{$$slots:{default:[w2]},$$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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLongformerForMaskedLM.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLongformerForMaskedLM.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLongformerForMaskedLM.call.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.TFLongformerForMaskedLM.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLongformerForMaskedLM.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLongformerForMaskedLM.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLongformerForMaskedLM.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFLongformerForMaskedLM.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFLongformerForMaskedLM.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFLongformerForMaskedLM.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFLongformerForMaskedLM.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked), the
loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2069",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Masked language modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerMaskedLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Dn=new tt({props:{$$slots:{default:[b2]},$$scope:{ctx:J}}}),Yn=new ot({props:{anchor:"transformers.TFLongformerForMaskedLM.call.example",$$slots:{default:[k2]},$$scope:{ctx:J}}}),Hn=new ot({props:{anchor:"transformers.TFLongformerForMaskedLM.call.example-2",$$slots:{default:[T2]},$$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/main/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2139"}}),es=new tt({props:{$$slots:{default:[y2]},$$scope:{ctx:J}}}),hr=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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.start_positions",description:`<strong>start_positions</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<em>sequence_length</em>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.TFLongformerForQuestionAnswering.call.end_positions",description:`<strong>end_positions</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<em>sequence_length</em>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2154",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerQuestionAnsweringModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),ts=new tt({props:{$$slots:{default:[v2]},$$scope:{ctx:J}}}),os=new ot({props:{anchor:"transformers.TFLongformerForQuestionAnswering.call.example",$$slots:{default:[M2]},$$scope:{ctx:J}}}),ns=new ot({props:{anchor:"transformers.TFLongformerForQuestionAnswering.call.example-2",$$slots:{default:[$2]},$$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/main/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2294"}}),as=new tt({props:{$$slots:{default:[x2]},$$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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLongformerForSequenceClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLongformerForSequenceClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLongformerForSequenceClassification.call.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.TFLongformerForSequenceClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLongformerForSequenceClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLongformerForSequenceClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLongformerForSequenceClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFLongformerForSequenceClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFLongformerForSequenceClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFLongformerForSequenceClassification.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2306",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),rs=new tt({props:{$$slots:{default:[F2]},$$scope:{ctx:J}}}),is=new ot({props:{anchor:"transformers.TFLongformerForSequenceClassification.call.example",$$slots:{default:[L2]},$$scope:{ctx:J}}}),ls=new ot({props:{anchor:"transformers.TFLongformerForSequenceClassification.call.example-2",$$slots:{default:[E2]},$$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/main/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2511"}}),cs=new tt({props:{$$slots:{default:[j2]},$$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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLongformerForTokenClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLongformerForTokenClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLongformerForTokenClassification.call.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.TFLongformerForTokenClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLongformerForTokenClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLongformerForTokenClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLongformerForTokenClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFLongformerForTokenClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFLongformerForTokenClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFLongformerForTokenClassification.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFLongformerForTokenClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2526",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided)  \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerTokenClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),ms=new tt({props:{$$slots:{default:[J2]},$$scope:{ctx:J}}}),hs=new ot({props:{anchor:"transformers.TFLongformerForTokenClassification.call.example",$$slots:{default:[z2]},$$scope:{ctx:J}}}),ps=new ot({props:{anchor:"transformers.TFLongformerForTokenClassification.call.example-2",$$slots:{default:[C2]},$$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/main/en/model_doc/longformer#transformers.LongformerConfig">LongformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2397"}}),us=new tt({props:{$$slots:{default:[I2]},$$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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFLongformerForMultipleChoice.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFLongformerForMultipleChoice.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFLongformerForMultipleChoice.call.global_attention_mask",description:`<strong>global_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to decide the attention given on each token, local attention or global attention. Tokens with global
attention attends to all other tokens, and all other tokens attend to them. This is important for
task-specific finetuning because it makes the model more flexible at representing the task. For example,
for classification, the <s> token should be given global attention. For QA, all question tokens should also
have global attention. Please refer to the <a href="https://arxiv.org/abs/2004.05150" rel="nofollow">Longformer paper</a> for more
details. Mask values selected in <code>[0, 1]</code>:</s></p>
<ul>
<li>0 for local attention (a sliding window attention),</li>
<li>1 for global attention (tokens that attend to all other tokens, and all other tokens attend to them).</li>
</ul>`,name:"global_attention_mask"},{anchor:"transformers.TFLongformerForMultipleChoice.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFLongformerForMultipleChoice.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFLongformerForMultipleChoice.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFLongformerForMultipleChoice.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFLongformerForMultipleChoice.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFLongformerForMultipleChoice.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFLongformerForMultipleChoice.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFLongformerForMultipleChoice.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the multiple choice classification loss. Indices should be in <code>[0, ..., num_choices]</code>
where <code>num_choices</code> is the size of the second dimension of the input tensors. (See <code>input_ids</code> above)`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/longformer/modeling_tf_longformer.py#L2418",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.LongformerConfig"
>LongformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <em>(1,)</em>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices)</code>) \u2014 <em>num_choices</em> is the second dimension of the input tensors. (see <em>input_ids</em> above).</p>
<p>Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x + attention_window + 1)</code>, where <code>x</code> is the number of tokens with global attention mask.</p>
<p>Local attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token in the sequence to every token with
global attention (first <code>x</code> values) and to every token in the attention window (remaining \`attention_window</p>
<ul>
<li>1<code>values). Note that the first</code>x<code>values refer to tokens with fixed positions in the text, but the remaining</code>attention_window + 1<code>values refer to tokens with relative positions: the attention weight of a token to itself is located at index</code>x + attention_window / 2<code>and the</code>attention_window / 2<code>preceding (succeeding) values are the attention weights to the</code>attention_window / 2<code>preceding (succeeding) tokens. If the attention window contains a token with global attention, the attention weight at the corresponding index is set to 0; the value should be accessed from the first</code>x<code>attention weights. If a token has global attention, the attention weights to all other tokens in</code>attentions<code>is set to 0, the values should be accessed from</code>global_attentions\`.</li>
</ul>
</li>
<li>
<p><strong>global_attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, x)</code>, where <code>x</code>
is the number of tokens with global attention mask.</p>
<p>Global attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads. Those are the attention weights from every token with global attention to every token
in the sequence.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/longformer#transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput"
>transformers.models.longformer.modeling_tf_longformer.TFLongformerMultipleChoiceModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),gs=new tt({props:{$$slots:{default:[U2]},$$scope:{ctx:J}}}),_s=new ot({props:{anchor:"transformers.TFLongformerForMultipleChoice.call.example",$$slots:{default:[q2]},$$scope:{ctx:J}}}),{c(){d=a("meta"),b=c(),p=a("h1"),g=a("a"),k=a("span"),T(l.$$.fragment),h=c(),j=a("span"),ae=n("Longformer"),ee=c(),N=a("div"),re=a("a"),oe=a("img"),ve=c(),V=a("a"),fe=a("img"),X=c(),ie=a("h2"),de=a("a"),R=a("span"),T(me.$$.fragment),Me=c(),O=a("span"),$e=n("Overview"),ke=c(),G=a("p"),xe=n("The Longformer model was presented in "),he=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.`),ye=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,yc=n(" succeeding tokens with "),vc=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"),mp=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"),hp=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"),yp=n("0: the token attends \u201Clocally\u201D,"),vp=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 "),vs=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"),mn=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"),hn=a("a"),ml=a("span"),T(Fs.$$.fragment),Qp=c(),hl=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"),mf=n("Configuration objects inherit from "),Pr=a("a"),hf=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"),yf=n("This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),vf=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(),yl=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 `),vl=a("code"),Yf=n("prepare_for_model"),Hf=n(" method."),Hc=c(),mo=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"),mu=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.`),hu=c(),T(yn.$$.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(),vn=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.`),em=c(),ho=a("h2"),Mn=a("a"),jl=a("span"),T(Ss.$$.fragment),ku=c(),Jl=a("span"),Tu=n("Longformer specific outputs"),tm=c(),po=a("div"),T(Xs.$$.fragment),yu=c(),zl=a("p"),vu=n("Base class for Longformer\u2019s outputs, with potential hidden states, local and global attentions."),om=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."),nm=c(),uo=a("div"),T(Qs.$$.fragment),xu=c(),Il=a("p"),Fu=n("Base class for masked language models outputs."),sm=c(),go=a("div"),T(Ds.$$.fragment),Lu=c(),Ul=a("p"),Eu=n("Base class for outputs of question answering Longformer models."),am=c(),_o=a("div"),T(Ys.$$.fragment),ju=c(),ql=a("p"),Ju=n("Base class for outputs of sentence classification models."),rm=c(),wo=a("div"),T(Hs.$$.fragment),zu=c(),Nl=a("p"),Cu=n("Base class for outputs of multiple choice Longformer models."),im=c(),bo=a("div"),T(Ks.$$.fragment),Iu=c(),Wl=a("p"),Uu=n("Base class for outputs of token classification models."),lm=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."),dm=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."),cm=c(),yo=a("div"),T(oa.$$.fragment),Bu=c(),Gl=a("p"),Gu=n("Base class for masked language models outputs."),mm=c(),vo=a("div"),T(na.$$.fragment),Au=c(),Al=a("p"),Vu=n("Base class for outputs of question answering Longformer models."),hm=c(),Mo=a("div"),T(sa.$$.fragment),Ru=c(),Vl=a("p"),Ou=n("Base class for outputs of sentence classification models."),pm=c(),$o=a("div"),T(aa.$$.fragment),Su=c(),Rl=a("p"),Xu=n("Base class for outputs of multiple choice models."),fm=c(),xo=a("div"),T(ra.$$.fragment),Pu=c(),Ol=a("p"),Qu=n("Base class for outputs of token classification models."),um=c(),Fo=a("h2"),$n=a("a"),Sl=a("span"),T(ia.$$.fragment),Du=c(),Xl=a("span"),Yu=n("LongformerModel"),gm=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 "),ma=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"),mg=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 `),ha=a("a"),hg=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"),yg=n(" forward method, overrides the "),Dl=a("code"),vg=n("__call__"),Mg=n(" special method."),$g=c(),T(xn.$$.fragment),xg=c(),T(Fn.$$.fragment),_m=c(),jo=a("h2"),Ln=a("a"),Yl=a("span"),T(ua.$$.fragment),Fg=c(),Hl=a("span"),Lg=n("LongformerForMaskedLM"),wm=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),bm=c(),zo=a("h2"),zn=a("a"),od=a("span"),T(ya.$$.fragment),Kg=c(),nd=a("span"),e_=n("LongformerForSequenceClassification"),km=c(),ut=a("div"),T(va.$$.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.`),m_=c(),Tt=a("div"),T(Fa.$$.fragment),h_=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),Tm=c(),Io=a("h2"),qn=a("a"),rd=a("span"),T(La.$$.fragment),T_=c(),id=a("span"),y_=n("LongformerForMultipleChoice"),ym=c(),gt=a("div"),T(Ea.$$.fragment),v_=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),vm=c(),qo=a("h2"),Zn=a("a"),cd=a("span"),T(Ia.$$.fragment),A_=c(),md=a("span"),V_=n("LongformerForTokenClassification"),Mm=c(),_t=a("div"),T(Ua.$$.fragment),R_=c(),hd=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),$m=c(),Wo=a("h2"),An=a("a"),fd=a("span"),T(Ba.$$.fragment),dw=c(),ud=a("span"),cw=n("LongformerForQuestionAnswering"),xm=c(),wt=a("div"),T(Ga.$$.fragment),mw=c(),Zo=a("p"),hw=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 "),mi=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"),yw=n("This model is also a PyTorch "),Ra=a("a"),vw=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 "),hi=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),Fm=c(),Go=a("h2"),On=a("a"),bd=a("span"),T(Sa.$$.fragment),Iw=c(),kd=a("span"),Uw=n("TFLongformerModel"),Lm=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 "),yd=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 "),vd=a("code"),lb=n("__call__"),db=n(" special method."),cb=c(),T(Xn.$$.fragment),Em=c(),Ro=a("h2"),Pn=a("a"),Md=a("span"),T(er.$$.fragment),mb=c(),$d=a("span"),hb=n("TFLongformerForMaskedLM"),jm=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"),yb=n("This model is also a "),ar=a("a"),vb=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(),yt=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),Jm=c(),So=a("h2"),Kn=a("a"),Ld=a("span"),T(ir.$$.fragment),qb=c(),Ed=a("span"),Nb=n("TFLongformerForQuestionAnswering"),zm=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 "),mr=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(),vt=a("div"),T(hr.$$.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),Cm=c(),Qo=a("h2"),ss=a("a"),Cd=a("span"),T(pr.$$.fragment),dk=c(),Id=a("span"),ck=n("TFLongformerForSequenceClassification"),Im=c(),it=a("div"),T(fr.$$.fragment),mk=c(),Ud=a("p"),hk=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),yk=c(),Mt=a("div"),T(wr.$$.fragment),vk=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),Um=c(),Yo=a("h2"),ds=a("a"),Nd=a("span"),T(br.$$.fragment),zk=c(),Wd=a("span"),Ck=n("TFLongformerForTokenClassification"),qm=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 "),yi=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(),yr=a("p"),Gk=n("This model is also a "),vr=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 "),vi=a("a"),Pk=n("TFLongformerForTokenClassification"),Qk=n(" forward method, overrides the "),Bd=a("code"),Dk=n("__call__"),Yk=n(" special method."),Hk=c(),T(ms.$$.fragment),Kk=c(),T(hs.$$.fragment),eT=c(),T(ps.$$.fragment),Nm=c(),Ko=a("h2"),fs=a("a"),Gd=a("span"),T($r.$$.fragment),tT=c(),Ad=a("span"),oT=n("TFLongformerForMultipleChoice"),Wm=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"),mT=n("tf.keras.Model"),hT=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),yT=c(),T(_s.$$.fragment),this.h()},l(o){const _=QM('[data-svelte="svelte-1phssyn"]',document.head);d=r(_,"META",{name:!0,content:!0}),_.forEach(t),b=m(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);y(l.$$.fragment,Sd),Sd.forEach(t),Od.forEach(t),h=m(Jr),j=r(Jr,"SPAN",{});var Xd=i(j);ae=s(Xd,"Longformer"),Xd.forEach(t),Jr.forEach(t),ee=m(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),ve=m(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=m(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);y(me.$$.fragment,Yd),Yd.forEach(t),Dd.forEach(t),Me=m(Cr),O=r(Cr,"SPAN",{});var Hd=i(O);$e=s(Hd,"Overview"),Hd.forEach(t),Cr.forEach(t),ke=m(o),G=r(o,"P",{});var Ir=i(G);xe=s(Ir,"The Longformer model was presented in "),he=r(Ir,"A",{href:!0,rel:!0});var Kd=i(he);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=m(o),ue=r(o,"P",{});var ec=i(ue);D=s(ec,"The abstract from the paper is the following:"),ec.forEach(t),Te=m(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),ye=m(o),C=r(o,"P",{});var nc=i(C);Le=s(nc,"Tips:"),nc.forEach(t),P=m(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=m(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=m(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=m(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 mc=i(W);y(A.$$.fragment,mc),mc.forEach(t),cc.forEach(t),Qe=m(qr),We=r(qr,"SPAN",{});var hc=i(We);K=s(hc,"Longformer Self Attention"),hc.forEach(t),qr.forEach(t),Be=m(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),yc=s(He," succeeding tokens with "),vc=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),mp=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);hp=s(gc,"BertSelfAttention"),gc.forEach(t),pp=s(He,"."),He.forEach(t),Fc=m(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=m(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=m(o),rn=r(o,"UL",{});var Bm=i(rn);el=r(Bm,"LI",{});var $T=i(el);yp=s($T,"0: the token attends \u201Clocally\u201D,"),$T.forEach(t),vp=m(Bm),tl=r(Bm,"LI",{});var xT=i(tl);Mp=s(xT,"1: the token attends \u201Cglobally\u201D."),xT.forEach(t),Bm.forEach(t),zc=m(o),ln=r(o,"P",{});var Gm=i(ln);$p=s(Gm,"For more information please also refer to "),Nr=r(Gm,"A",{href:!0});var FT=i(Nr);xp=s(FT,"forward()"),FT.forEach(t),Fp=s(Gm," method."),Gm.forEach(t),Cc=m(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=m(o),dn=r(o,"P",{});var Am=i(dn);Ep=s(Am,"For more information, please refer to the official "),vs=r(Am,"A",{href:!0,rel:!0});var LT=i(vs);jp=s(LT,"paper"),LT.forEach(t),Jp=s(Am,"."),Am.forEach(t),Vc=m(o),oo=r(o,"H2",{class:!0});var Vm=i(oo);cn=r(Vm,"A",{id:!0,class:!0,href:!0});var ET=i(cn);ol=r(ET,"SPAN",{});var jT=i(ol);y(Ms.$$.fragment,jT),jT.forEach(t),ET.forEach(t),zp=m(Vm),nl=r(Vm,"SPAN",{});var JT=i(nl);Cp=s(JT,"Training"),JT.forEach(t),Vm.forEach(t),Rc=m(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=m(o),y($s.$$.fragment,o),Sc=m(o),so=r(o,"H2",{class:!0});var Rm=i(so);mn=r(Rm,"A",{id:!0,class:!0,href:!0});var IT=i(mn);sl=r(IT,"SPAN",{});var UT=i(sl);y(xs.$$.fragment,UT),UT.forEach(t),IT.forEach(t),Wp=m(Rm),al=r(Rm,"SPAN",{});var qT=i(al);Zp=s(qT,"Documentation resources"),qT.forEach(t),Rm.forEach(t),Xc=m(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=m(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=m(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=m(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=m(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=m(o),ao=r(o,"H2",{class:!0});var Om=i(ao);hn=r(Om,"A",{id:!0,class:!0,href:!0});var XT=i(hn);ml=r(XT,"SPAN",{});var PT=i(ml);y(Fs.$$.fragment,PT),PT.forEach(t),XT.forEach(t),Qp=m(Om),hl=r(Om,"SPAN",{});var QT=i(hl);Dp=s(QT,"LongformerConfig"),QT.forEach(t),Om.forEach(t),Qc=m(o),pt=r(o,"DIV",{class:!0});var Ot=i(pt);y(Ls.$$.fragment,Ot),Yp=m(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=m(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=m(Ot),lo=r(Ot,"P",{});var Li=i(lo);mf=s(Li,"Configuration objects inherit from "),Pr=r(Li,"A",{href:!0});var ey=i(Pr);hf=s(ey,"PretrainedConfig"),ey.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 ty=i(Qr);ff=s(ty,"PretrainedConfig"),ty.forEach(t),uf=s(Li," for more information."),Li.forEach(t),gf=m(Ot),y(pn.$$.fragment,Ot),Ot.forEach(t),Dc=m(o),co=r(o,"H2",{class:!0});var Sm=i(co);fn=r(Sm,"A",{id:!0,class:!0,href:!0});var oy=i(fn);pl=r(oy,"SPAN",{});var ny=i(pl);y(js.$$.fragment,ny),ny.forEach(t),oy.forEach(t),_f=m(Sm),fl=r(Sm,"SPAN",{});var sy=i(fl);wf=s(sy,"LongformerTokenizer"),sy.forEach(t),Sm.forEach(t),Yc=m(o),Ue=r(o,"DIV",{class:!0});var Ve=i(Ue);y(Js.$$.fragment,Ve),bf=m(Ve),ul=r(Ve,"P",{});var ay=i(ul);kf=s(ay,"Constructs a Longformer tokenizer, derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding."),ay.forEach(t),Tf=m(Ve),gl=r(Ve,"P",{});var ry=i(gl);yf=s(ry,"This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),ry.forEach(t),vf=m(Ve),y(un.$$.fragment,Ve),Mf=m(Ve),zs=r(Ve,"P",{});var Xm=i(zs);$f=s(Xm,"You can get around that behavior by passing "),_l=r(Xm,"CODE",{});var iy=i(_l);xf=s(iy,"add_prefix_space=True"),iy.forEach(t),Ff=s(Xm,` 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.`),Xm.forEach(t),Lf=m(Ve),y(gn.$$.fragment,Ve),Ef=m(Ve),Cs=r(Ve,"P",{});var Pm=i(Cs);jf=s(Pm,"This tokenizer inherits from "),Dr=r(Pm,"A",{href:!0});var ly=i(Dr);Jf=s(ly,"PreTrainedTokenizer"),ly.forEach(t),zf=s(Pm,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Pm.forEach(t),Cf=m(Ve),Gt=r(Ve,"DIV",{class:!0});var Ei=i(Gt);y(Is.$$.fragment,Ei),If=m(Ei),wl=r(Ei,"P",{});var dy=i(wl);Uf=s(dy,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A Longformer sequence has the following format:`),dy.forEach(t),qf=m(Ei),Us=r(Ei,"UL",{});var Qm=i(Us);Yr=r(Qm,"LI",{});var vT=i(Yr);Nf=s(vT,"single sequence: "),bl=r(vT,"CODE",{});var cy=i(bl);Wf=s(cy,"<s> X </s>"),cy.forEach(t),vT.forEach(t),Zf=m(Qm),Hr=r(Qm,"LI",{});var MT=i(Hr);Bf=s(MT,"pair of sequences: "),kl=r(MT,"CODE",{});var my=i(kl);Gf=s(my,"<s> A </s></s> B </s>"),my.forEach(t),MT.forEach(t),Qm.forEach(t),Ei.forEach(t),Af=m(Ve),_n=r(Ve,"DIV",{class:!0});var Dm=i(_n);y(qs.$$.fragment,Dm),Vf=m(Dm),Tl=r(Dm,"P",{});var hy=i(Tl);Rf=s(hy,"Converts a sequence of tokens (string) in a single string."),hy.forEach(t),Dm.forEach(t),Of=m(Ve),wn=r(Ve,"DIV",{class:!0});var Ym=i(wn);y(Ns.$$.fragment,Ym),Sf=m(Ym),yl=r(Ym,"P",{});var py=i(yl);Xf=s(py,`Create a mask from the two sequences passed to be used in a sequence-pair classification task. Longformer does
not make use of token type ids, therefore a list of zeros is returned.`),py.forEach(t),Ym.forEach(t),Pf=m(Ve),bn=r(Ve,"DIV",{class:!0});var Hm=i(bn);y(Ws.$$.fragment,Hm),Qf=m(Hm),Zs=r(Hm,"P",{});var Km=i(Zs);Df=s(Km,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),vl=r(Km,"CODE",{});var fy=i(vl);Yf=s(fy,"prepare_for_model"),fy.forEach(t),Hf=s(Km," method."),Km.forEach(t),Hm.forEach(t),Ve.forEach(t),Hc=m(o),mo=r(o,"H2",{class:!0});var eh=i(mo);kn=r(eh,"A",{id:!0,class:!0,href:!0});var uy=i(kn);Ml=r(uy,"SPAN",{});var gy=i(Ml);y(Bs.$$.fragment,gy),gy.forEach(t),uy.forEach(t),Kf=m(eh),$l=r(eh,"SPAN",{});var _y=i($l);eu=s(_y,"LongformerTokenizerFast"),_y.forEach(t),eh.forEach(t),Kc=m(o),De=r(o,"DIV",{class:!0});var mt=i(De);y(Gs.$$.fragment,mt),tu=m(mt),As=r(mt,"P",{});var th=i(As);ou=s(th,"Construct a \u201Cfast\u201D Longformer tokenizer (backed by HuggingFace\u2019s "),xl=r(th,"EM",{});var wy=i(xl);nu=s(wy,"tokenizers"),wy.forEach(t),su=s(th,` library), derived from the GPT-2
tokenizer, using byte-level Byte-Pair-Encoding.`),th.forEach(t),au=m(mt),Fl=r(mt,"P",{});var by=i(Fl);ru=s(by,"This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),by.forEach(t),iu=m(mt),y(Tn.$$.fragment,mt),lu=m(mt),Vs=r(mt,"P",{});var oh=i(Vs);du=s(oh,"You can get around that behavior by passing "),Ll=r(oh,"CODE",{});var ky=i(Ll);cu=s(ky,"add_prefix_space=True"),ky.forEach(t),mu=s(oh,` 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.`),oh.forEach(t),hu=m(mt),y(yn.$$.fragment,mt),pu=m(mt),Rs=r(mt,"P",{});var nh=i(Rs);fu=s(nh,"This tokenizer inherits from "),Kr=r(nh,"A",{href:!0});var Ty=i(Kr);uu=s(Ty,"PreTrainedTokenizerFast"),Ty.forEach(t),gu=s(nh,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),nh.forEach(t),_u=m(mt),vn=r(mt,"DIV",{class:!0});var sh=i(vn);y(Os.$$.fragment,sh),wu=m(sh),El=r(sh,"P",{});var yy=i(El);bu=s(yy,`Create a mask from the two sequences passed to be used in a sequence-pair classification task. Longformer does
not make use of token type ids, therefore a list of zeros is returned.`),yy.forEach(t),sh.forEach(t),mt.forEach(t),em=m(o),ho=r(o,"H2",{class:!0});var ah=i(ho);Mn=r(ah,"A",{id:!0,class:!0,href:!0});var vy=i(Mn);jl=r(vy,"SPAN",{});var My=i(jl);y(Ss.$$.fragment,My),My.forEach(t),vy.forEach(t),ku=m(ah),Jl=r(ah,"SPAN",{});var $y=i(Jl);Tu=s($y,"Longformer specific outputs"),$y.forEach(t),ah.forEach(t),tm=m(o),po=r(o,"DIV",{class:!0});var rh=i(po);y(Xs.$$.fragment,rh),yu=m(rh),zl=r(rh,"P",{});var xy=i(zl);vu=s(xy,"Base class for Longformer\u2019s outputs, with potential hidden states, local and global attentions."),xy.forEach(t),rh.forEach(t),om=m(o),fo=r(o,"DIV",{class:!0});var ih=i(fo);y(Ps.$$.fragment,ih),Mu=m(ih),Cl=r(ih,"P",{});var Fy=i(Cl);$u=s(Fy,"Base class for Longformer\u2019s outputs that also contains a pooling of the last hidden states."),Fy.forEach(t),ih.forEach(t),nm=m(o),uo=r(o,"DIV",{class:!0});var lh=i(uo);y(Qs.$$.fragment,lh),xu=m(lh),Il=r(lh,"P",{});var Ly=i(Il);Fu=s(Ly,"Base class for masked language models outputs."),Ly.forEach(t),lh.forEach(t),sm=m(o),go=r(o,"DIV",{class:!0});var dh=i(go);y(Ds.$$.fragment,dh),Lu=m(dh),Ul=r(dh,"P",{});var Ey=i(Ul);Eu=s(Ey,"Base class for outputs of question answering Longformer models."),Ey.forEach(t),dh.forEach(t),am=m(o),_o=r(o,"DIV",{class:!0});var ch=i(_o);y(Ys.$$.fragment,ch),ju=m(ch),ql=r(ch,"P",{});var jy=i(ql);Ju=s(jy,"Base class for outputs of sentence classification models."),jy.forEach(t),ch.forEach(t),rm=m(o),wo=r(o,"DIV",{class:!0});var mh=i(wo);y(Hs.$$.fragment,mh),zu=m(mh),Nl=r(mh,"P",{});var Jy=i(Nl);Cu=s(Jy,"Base class for outputs of multiple choice Longformer models."),Jy.forEach(t),mh.forEach(t),im=m(o),bo=r(o,"DIV",{class:!0});var hh=i(bo);y(Ks.$$.fragment,hh),Iu=m(hh),Wl=r(hh,"P",{});var zy=i(Wl);Uu=s(zy,"Base class for outputs of token classification models."),zy.forEach(t),hh.forEach(t),lm=m(o),ko=r(o,"DIV",{class:!0});var ph=i(ko);y(ea.$$.fragment,ph),qu=m(ph),Zl=r(ph,"P",{});var Cy=i(Zl);Nu=s(Cy,"Base class for Longformer\u2019s outputs, with potential hidden states, local and global attentions."),Cy.forEach(t),ph.forEach(t),dm=m(o),To=r(o,"DIV",{class:!0});var fh=i(To);y(ta.$$.fragment,fh),Wu=m(fh),Bl=r(fh,"P",{});var Iy=i(Bl);Zu=s(Iy,"Base class for Longformer\u2019s outputs that also contains a pooling of the last hidden states."),Iy.forEach(t),fh.forEach(t),cm=m(o),yo=r(o,"DIV",{class:!0});var uh=i(yo);y(oa.$$.fragment,uh),Bu=m(uh),Gl=r(uh,"P",{});var Uy=i(Gl);Gu=s(Uy,"Base class for masked language models outputs."),Uy.forEach(t),uh.forEach(t),mm=m(o),vo=r(o,"DIV",{class:!0});var gh=i(vo);y(na.$$.fragment,gh),Au=m(gh),Al=r(gh,"P",{});var qy=i(Al);Vu=s(qy,"Base class for outputs of question answering Longformer models."),qy.forEach(t),gh.forEach(t),hm=m(o),Mo=r(o,"DIV",{class:!0});var _h=i(Mo);y(sa.$$.fragment,_h),Ru=m(_h),Vl=r(_h,"P",{});var Ny=i(Vl);Ou=s(Ny,"Base class for outputs of sentence classification models."),Ny.forEach(t),_h.forEach(t),pm=m(o),$o=r(o,"DIV",{class:!0});var wh=i($o);y(aa.$$.fragment,wh),Su=m(wh),Rl=r(wh,"P",{});var Wy=i(Rl);Xu=s(Wy,"Base class for outputs of multiple choice models."),Wy.forEach(t),wh.forEach(t),fm=m(o),xo=r(o,"DIV",{class:!0});var bh=i(xo);y(ra.$$.fragment,bh),Pu=m(bh),Ol=r(bh,"P",{});var Zy=i(Ol);Qu=s(Zy,"Base class for outputs of token classification models."),Zy.forEach(t),bh.forEach(t),um=m(o),Fo=r(o,"H2",{class:!0});var kh=i(Fo);$n=r(kh,"A",{id:!0,class:!0,href:!0});var By=i($n);Sl=r(By,"SPAN",{});var Gy=i(Sl);y(ia.$$.fragment,Gy),Gy.forEach(t),By.forEach(t),Du=m(kh),Xl=r(kh,"SPAN",{});var Ay=i(Xl);Yu=s(Ay,"LongformerModel"),Ay.forEach(t),kh.forEach(t),gm=m(o),st=r(o,"DIV",{class:!0});var xt=i(st);y(la.$$.fragment,xt),Hu=m(xt),Pl=r(xt,"P",{});var Vy=i(Pl);Ku=s(Vy,"The bare Longformer Model outputting raw hidden-states without any specific head on top."),Vy.forEach(t),eg=m(xt),da=r(xt,"P",{});var Th=i(da);tg=s(Th,"This model inherits from "),ei=r(Th,"A",{href:!0});var Ry=i(ei);og=s(Ry,"PreTrainedModel"),Ry.forEach(t),ng=s(Th,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Th.forEach(t),sg=m(xt),ca=r(xt,"P",{});var yh=i(ca);ag=s(yh,"This model is also a PyTorch "),ma=r(yh,"A",{href:!0,rel:!0});var Oy=i(ma);rg=s(Oy,"torch.nn.Module"),Oy.forEach(t),ig=s(yh,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),yh.forEach(t),lg=m(xt),Lo=r(xt,"P",{});var ji=i(Lo);dg=s(ji,"This class copied code from "),ti=r(ji,"A",{href:!0});var Sy=i(ti);cg=s(Sy,"RobertaModel"),Sy.forEach(t),mg=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 `),ha=r(ji,"A",{href:!0,rel:!0});var Xy=i(ha);hg=s(Xy,`Longformer:
the Long-Document Transformer`),Xy.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=m(xt),pa=r(xt,"P",{});var vh=i(pa);ug=s(vh,"The self-attention module "),Ql=r(vh,"CODE",{});var Py=i(Ql);gg=s(Py,"LongformerSelfAttention"),Py.forEach(t),_g=s(vh,` 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.`),vh.forEach(t),wg=m(xt),Ft=r(xt,"DIV",{class:!0});var ws=i(Ft);y(fa.$$.fragment,ws),bg=m(ws),Eo=r(ws,"P",{});var Ji=i(Eo);kg=s(Ji,"The "),oi=r(Ji,"A",{href:!0});var Qy=i(oi);Tg=s(Qy,"LongformerModel"),Qy.forEach(t),yg=s(Ji," forward method, overrides the "),Dl=r(Ji,"CODE",{});var Dy=i(Dl);vg=s(Dy,"__call__"),Dy.forEach(t),Mg=s(Ji," special method."),Ji.forEach(t),$g=m(ws),y(xn.$$.fragment,ws),xg=m(ws),y(Fn.$$.fragment,ws),ws.forEach(t),xt.forEach(t),_m=m(o),jo=r(o,"H2",{class:!0});var Mh=i(jo);Ln=r(Mh,"A",{id:!0,class:!0,href:!0});var Yy=i(Ln);Yl=r(Yy,"SPAN",{});var Hy=i(Yl);y(ua.$$.fragment,Hy),Hy.forEach(t),Yy.forEach(t),Fg=m(Mh),Hl=r(Mh,"SPAN",{});var Ky=i(Hl);Lg=s(Ky,"LongformerForMaskedLM"),Ky.forEach(t),Mh.forEach(t),wm=m(o),ft=r(o,"DIV",{class:!0});var St=i(ft);y(ga.$$.fragment,St),Eg=m(St),_a=r(St,"P",{});var $h=i(_a);jg=s($h,"Longformer Model with a "),Kl=r($h,"CODE",{});var ev=i(Kl);Jg=s(ev,"language modeling"),ev.forEach(t),zg=s($h," head on top."),$h.forEach(t),Cg=m(St),wa=r(St,"P",{});var xh=i(wa);Ig=s(xh,"This model inherits from "),ni=r(xh,"A",{href:!0});var tv=i(ni);Ug=s(tv,"PreTrainedModel"),tv.forEach(t),qg=s(xh,`. 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.)`),xh.forEach(t),Ng=m(St),ba=r(St,"P",{});var Fh=i(ba);Wg=s(Fh,"This model is also a PyTorch "),ka=r(Fh,"A",{href:!0,rel:!0});var ov=i(ka);Zg=s(ov,"torch.nn.Module"),ov.forEach(t),Bg=s(Fh,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Fh.forEach(t),Gg=m(St),ct=r(St,"DIV",{class:!0});var zt=i(ct);y(Ta.$$.fragment,zt),Ag=m(zt),Jo=r(zt,"P",{});var zi=i(Jo);Vg=s(zi,"The "),si=r(zi,"A",{href:!0});var nv=i(si);Rg=s(nv,"LongformerForMaskedLM"),nv.forEach(t),Og=s(zi," forward method, overrides the "),ed=r(zi,"CODE",{});var sv=i(ed);Sg=s(sv,"__call__"),sv.forEach(t),Xg=s(zi," special method."),zi.forEach(t),Pg=m(zt),y(En.$$.fragment,zt),Qg=m(zt),y(jn.$$.fragment,zt),Dg=m(zt),td=r(zt,"P",{});var av=i(td);Yg=s(av,"Let\u2019s try a very long input."),av.forEach(t),Hg=m(zt),y(Jn.$$.fragment,zt),zt.forEach(t),St.forEach(t),bm=m(o),zo=r(o,"H2",{class:!0});var Lh=i(zo);zn=r(Lh,"A",{id:!0,class:!0,href:!0});var rv=i(zn);od=r(rv,"SPAN",{});var iv=i(od);y(ya.$$.fragment,iv),iv.forEach(t),rv.forEach(t),Kg=m(Lh),nd=r(Lh,"SPAN",{});var lv=i(nd);e_=s(lv,"LongformerForSequenceClassification"),lv.forEach(t),Lh.forEach(t),km=m(o),ut=r(o,"DIV",{class:!0});var Xt=i(ut);y(va.$$.fragment,Xt),t_=m(Xt),sd=r(Xt,"P",{});var dv=i(sd);o_=s(dv,`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.`),dv.forEach(t),n_=m(Xt),Ma=r(Xt,"P",{});var Eh=i(Ma);s_=s(Eh,"This model inherits from "),ai=r(Eh,"A",{href:!0});var cv=i(ai);a_=s(cv,"PreTrainedModel"),cv.forEach(t),r_=s(Eh,`. 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.)`),Eh.forEach(t),i_=m(Xt),$a=r(Xt,"P",{});var jh=i($a);l_=s(jh,"This model is also a PyTorch "),xa=r(jh,"A",{href:!0,rel:!0});var mv=i(xa);d_=s(mv,"torch.nn.Module"),mv.forEach(t),c_=s(jh,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),jh.forEach(t),m_=m(Xt),Tt=r(Xt,"DIV",{class:!0});var Pt=i(Tt);y(Fa.$$.fragment,Pt),h_=m(Pt),Co=r(Pt,"P",{});var Ci=i(Co);p_=s(Ci,"The "),ri=r(Ci,"A",{href:!0});var hv=i(ri);f_=s(hv,"LongformerForSequenceClassification"),hv.forEach(t),u_=s(Ci," forward method, overrides the "),ad=r(Ci,"CODE",{});var pv=i(ad);g_=s(pv,"__call__"),pv.forEach(t),__=s(Ci," special method."),Ci.forEach(t),w_=m(Pt),y(Cn.$$.fragment,Pt),b_=m(Pt),y(In.$$.fragment,Pt),k_=m(Pt),y(Un.$$.fragment,Pt),Pt.forEach(t),Xt.forEach(t),Tm=m(o),Io=r(o,"H2",{class:!0});var Jh=i(Io);qn=r(Jh,"A",{id:!0,class:!0,href:!0});var fv=i(qn);rd=r(fv,"SPAN",{});var uv=i(rd);y(La.$$.fragment,uv),uv.forEach(t),fv.forEach(t),T_=m(Jh),id=r(Jh,"SPAN",{});var gv=i(id);y_=s(gv,"LongformerForMultipleChoice"),gv.forEach(t),Jh.forEach(t),ym=m(o),gt=r(o,"DIV",{class:!0});var Qt=i(gt);y(Ea.$$.fragment,Qt),v_=m(Qt),ld=r(Qt,"P",{});var _v=i(ld);M_=s(_v,`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.`),_v.forEach(t),$_=m(Qt),ja=r(Qt,"P",{});var zh=i(ja);x_=s(zh,"This model inherits from "),ii=r(zh,"A",{href:!0});var wv=i(ii);F_=s(wv,"PreTrainedModel"),wv.forEach(t),L_=s(zh,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),zh.forEach(t),E_=m(Qt),Ja=r(Qt,"P",{});var Ch=i(Ja);j_=s(Ch,"This model is also a PyTorch "),za=r(Ch,"A",{href:!0,rel:!0});var bv=i(za);J_=s(bv,"torch.nn.Module"),bv.forEach(t),z_=s(Ch,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ch.forEach(t),C_=m(Qt),Lt=r(Qt,"DIV",{class:!0});var bs=i(Lt);y(Ca.$$.fragment,bs),I_=m(bs),Uo=r(bs,"P",{});var Ii=i(Uo);U_=s(Ii,"The "),li=r(Ii,"A",{href:!0});var kv=i(li);q_=s(kv,"LongformerForMultipleChoice"),kv.forEach(t),N_=s(Ii," forward method, overrides the "),dd=r(Ii,"CODE",{});var Tv=i(dd);W_=s(Tv,"__call__"),Tv.forEach(t),Z_=s(Ii," special method."),Ii.forEach(t),B_=m(bs),y(Nn.$$.fragment,bs),G_=m(bs),y(Wn.$$.fragment,bs),bs.forEach(t),Qt.forEach(t),vm=m(o),qo=r(o,"H2",{class:!0});var Ih=i(qo);Zn=r(Ih,"A",{id:!0,class:!0,href:!0});var yv=i(Zn);cd=r(yv,"SPAN",{});var vv=i(cd);y(Ia.$$.fragment,vv),vv.forEach(t),yv.forEach(t),A_=m(Ih),md=r(Ih,"SPAN",{});var Mv=i(md);V_=s(Mv,"LongformerForTokenClassification"),Mv.forEach(t),Ih.forEach(t),Mm=m(o),_t=r(o,"DIV",{class:!0});var Dt=i(_t);y(Ua.$$.fragment,Dt),R_=m(Dt),hd=r(Dt,"P",{});var $v=i(hd);O_=s($v,`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.`),$v.forEach(t),S_=m(Dt),qa=r(Dt,"P",{});var Uh=i(qa);X_=s(Uh,"This model inherits from "),di=r(Uh,"A",{href:!0});var xv=i(di);P_=s(xv,"PreTrainedModel"),xv.forEach(t),Q_=s(Uh,`. 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.)`),Uh.forEach(t),D_=m(Dt),Na=r(Dt,"P",{});var qh=i(Na);Y_=s(qh,"This model is also a PyTorch "),Wa=r(qh,"A",{href:!0,rel:!0});var Fv=i(Wa);H_=s(Fv,"torch.nn.Module"),Fv.forEach(t),K_=s(qh,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),qh.forEach(t),ew=m(Dt),Et=r(Dt,"DIV",{class:!0});var ks=i(Et);y(Za.$$.fragment,ks),tw=m(ks),No=r(ks,"P",{});var Ui=i(No);ow=s(Ui,"The "),ci=r(Ui,"A",{href:!0});var Lv=i(ci);nw=s(Lv,"LongformerForTokenClassification"),Lv.forEach(t),sw=s(Ui," forward method, overrides the "),pd=r(Ui,"CODE",{});var Ev=i(pd);aw=s(Ev,"__call__"),Ev.forEach(t),rw=s(Ui," special method."),Ui.forEach(t),iw=m(ks),y(Bn.$$.fragment,ks),lw=m(ks),y(Gn.$$.fragment,ks),ks.forEach(t),Dt.forEach(t),$m=m(o),Wo=r(o,"H2",{class:!0});var Nh=i(Wo);An=r(Nh,"A",{id:!0,class:!0,href:!0});var jv=i(An);fd=r(jv,"SPAN",{});var Jv=i(fd);y(Ba.$$.fragment,Jv),Jv.forEach(t),jv.forEach(t),dw=m(Nh),ud=r(Nh,"SPAN",{});var zv=i(ud);cw=s(zv,"LongformerForQuestionAnswering"),zv.forEach(t),Nh.forEach(t),xm=m(o),wt=r(o,"DIV",{class:!0});var Yt=i(wt);y(Ga.$$.fragment,Yt),mw=m(Yt),Zo=r(Yt,"P",{});var qi=i(Zo);hw=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 Cv=i(gd);pw=s(Cv,"span start logits"),Cv.forEach(t),fw=s(qi," and "),_d=r(qi,"CODE",{});var Iv=i(_d);uw=s(Iv,"span end logits"),Iv.forEach(t),gw=s(qi,")."),qi.forEach(t),_w=m(Yt),Aa=r(Yt,"P",{});var Wh=i(Aa);ww=s(Wh,"This model inherits from "),mi=r(Wh,"A",{href:!0});var Uv=i(mi);bw=s(Uv,"PreTrainedModel"),Uv.forEach(t),kw=s(Wh,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Wh.forEach(t),Tw=m(Yt),Va=r(Yt,"P",{});var Zh=i(Va);yw=s(Zh,"This model is also a PyTorch "),Ra=r(Zh,"A",{href:!0,rel:!0});var qv=i(Ra);vw=s(qv,"torch.nn.Module"),qv.forEach(t),Mw=s(Zh,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Zh.forEach(t),$w=m(Yt),jt=r(Yt,"DIV",{class:!0});var Ts=i(jt);y(Oa.$$.fragment,Ts),xw=m(Ts),Bo=r(Ts,"P",{});var Ni=i(Bo);Fw=s(Ni,"The "),hi=r(Ni,"A",{href:!0});var Nv=i(hi);Lw=s(Nv,"LongformerForQuestionAnswering"),Nv.forEach(t),Ew=s(Ni," forward method, overrides the "),wd=r(Ni,"CODE",{});var Wv=i(wd);jw=s(Wv,"__call__"),Wv.forEach(t),Jw=s(Ni," special method."),Ni.forEach(t),zw=m(Ts),y(Vn.$$.fragment,Ts),Cw=m(Ts),y(Rn.$$.fragment,Ts),Ts.forEach(t),Yt.forEach(t),Fm=m(o),Go=r(o,"H2",{class:!0});var Bh=i(Go);On=r(Bh,"A",{id:!0,class:!0,href:!0});var Zv=i(On);bd=r(Zv,"SPAN",{});var Bv=i(bd);y(Sa.$$.fragment,Bv),Bv.forEach(t),Zv.forEach(t),Iw=m(Bh),kd=r(Bh,"SPAN",{});var Gv=i(kd);Uw=s(Gv,"TFLongformerModel"),Gv.forEach(t),Bh.forEach(t),Lm=m(o),Ye=r(o,"DIV",{class:!0});var ht=i(Ye);y(Xa.$$.fragment,ht),qw=m(ht),Td=r(ht,"P",{});var Av=i(Td);Nw=s(Av,"The bare Longformer Model outputting raw hidden-states without any specific head on top."),Av.forEach(t),Ww=m(ht),Pa=r(ht,"P",{});var Gh=i(Pa);Zw=s(Gh,"This model inherits from "),pi=r(Gh,"A",{href:!0});var Vv=i(pi);Bw=s(Vv,"TFPreTrainedModel"),Vv.forEach(t),Gw=s(Gh,`. 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.)`),Gh.forEach(t),Aw=m(ht),Qa=r(ht,"P",{});var Ah=i(Qa);Vw=s(Ah,"This model is also a "),Da=r(Ah,"A",{href:!0,rel:!0});var Rv=i(Da);Rw=s(Rv,"tf.keras.Model"),Rv.forEach(t),Ow=s(Ah,` 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.`),Ah.forEach(t),Sw=m(ht),y(Sn.$$.fragment,ht),Xw=m(ht),Ao=r(ht,"P",{});var Wi=i(Ao);Pw=s(Wi,"This class copies code from "),fi=r(Wi,"A",{href:!0});var Ov=i(fi);Qw=s(Ov,"TFRobertaModel"),Ov.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 Sv=i(Ya);Yw=s(Sv,"Longformer: the Long-Document Transformer"),Sv.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=m(ht),Ha=r(ht,"P",{});var Vh=i(Ha);eb=s(Vh,"The self-attention module "),yd=r(Vh,"CODE",{});var Xv=i(yd);tb=s(Xv,"TFLongformerSelfAttention"),Xv.forEach(t),ob=s(Vh,` 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.`),Vh.forEach(t),nb=m(ht),At=r(ht,"DIV",{class:!0});var Zi=i(At);y(Ka.$$.fragment,Zi),sb=m(Zi),Vo=r(Zi,"P",{});var Bi=i(Vo);ab=s(Bi,"The "),ui=r(Bi,"A",{href:!0});var Pv=i(ui);rb=s(Pv,"TFLongformerModel"),Pv.forEach(t),ib=s(Bi," forward method, overrides the "),vd=r(Bi,"CODE",{});var Qv=i(vd);lb=s(Qv,"__call__"),Qv.forEach(t),db=s(Bi," special method."),Bi.forEach(t),cb=m(Zi),y(Xn.$$.fragment,Zi),Zi.forEach(t),ht.forEach(t),Em=m(o),Ro=r(o,"H2",{class:!0});var Rh=i(Ro);Pn=r(Rh,"A",{id:!0,class:!0,href:!0});var Dv=i(Pn);Md=r(Dv,"SPAN",{});var Yv=i(Md);y(er.$$.fragment,Yv),Yv.forEach(t),Dv.forEach(t),mb=m(Rh),$d=r(Rh,"SPAN",{});var Hv=i($d);hb=s(Hv,"TFLongformerForMaskedLM"),Hv.forEach(t),Rh.forEach(t),jm=m(o),at=r(o,"DIV",{class:!0});var Ct=i(at);y(tr.$$.fragment,Ct),pb=m(Ct),or=r(Ct,"P",{});var Oh=i(or);fb=s(Oh,"Longformer Model with a "),xd=r(Oh,"CODE",{});var Kv=i(xd);ub=s(Kv,"language modeling"),Kv.forEach(t),gb=s(Oh," head on top."),Oh.forEach(t),_b=m(Ct),nr=r(Ct,"P",{});var Sh=i(nr);wb=s(Sh,"This model inherits from "),gi=r(Sh,"A",{href:!0});var eM=i(gi);bb=s(eM,"TFPreTrainedModel"),eM.forEach(t),kb=s(Sh,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Sh.forEach(t),Tb=m(Ct),sr=r(Ct,"P",{});var Xh=i(sr);yb=s(Xh,"This model is also a "),ar=r(Xh,"A",{href:!0,rel:!0});var tM=i(ar);vb=s(tM,"tf.keras.Model"),tM.forEach(t),Mb=s(Xh,` 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.`),Xh.forEach(t),$b=m(Ct),y(Qn.$$.fragment,Ct),xb=m(Ct),yt=r(Ct,"DIV",{class:!0});var Ht=i(yt);y(rr.$$.fragment,Ht),Fb=m(Ht),Oo=r(Ht,"P",{});var Gi=i(Oo);Lb=s(Gi,"The "),_i=r(Gi,"A",{href:!0});var oM=i(_i);Eb=s(oM,"TFLongformerForMaskedLM"),oM.forEach(t),jb=s(Gi," forward method, overrides the "),Fd=r(Gi,"CODE",{});var nM=i(Fd);Jb=s(nM,"__call__"),nM.forEach(t),zb=s(Gi," special method."),Gi.forEach(t),Cb=m(Ht),y(Dn.$$.fragment,Ht),Ib=m(Ht),y(Yn.$$.fragment,Ht),Ub=m(Ht),y(Hn.$$.fragment,Ht),Ht.forEach(t),Ct.forEach(t),Jm=m(o),So=r(o,"H2",{class:!0});var Ph=i(So);Kn=r(Ph,"A",{id:!0,class:!0,href:!0});var sM=i(Kn);Ld=r(sM,"SPAN",{});var aM=i(Ld);y(ir.$$.fragment,aM),aM.forEach(t),sM.forEach(t),qb=m(Ph),Ed=r(Ph,"SPAN",{});var rM=i(Ed);Nb=s(rM,"TFLongformerForQuestionAnswering"),rM.forEach(t),Ph.forEach(t),zm=m(o),rt=r(o,"DIV",{class:!0});var It=i(rt);y(lr.$$.fragment,It),Wb=m(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 iM=i(jd);Bb=s(iM,"span start logits"),iM.forEach(t),Gb=s(Ai," and "),Jd=r(Ai,"CODE",{});var lM=i(Jd);Ab=s(lM,"span end logits"),lM.forEach(t),Vb=s(Ai,")."),Ai.forEach(t),Rb=m(It),dr=r(It,"P",{});var Qh=i(dr);Ob=s(Qh,"This model inherits from "),wi=r(Qh,"A",{href:!0});var dM=i(wi);Sb=s(dM,"TFPreTrainedModel"),dM.forEach(t),Xb=s(Qh,`. 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.)`),Qh.forEach(t),Pb=m(It),cr=r(It,"P",{});var Dh=i(cr);Qb=s(Dh,"This model is also a "),mr=r(Dh,"A",{href:!0,rel:!0});var cM=i(mr);Db=s(cM,"tf.keras.Model"),cM.forEach(t),Yb=s(Dh,` 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.`),Dh.forEach(t),Hb=m(It),y(es.$$.fragment,It),Kb=m(It),vt=r(It,"DIV",{class:!0});var Kt=i(vt);y(hr.$$.fragment,Kt),ek=m(Kt),Po=r(Kt,"P",{});var Vi=i(Po);tk=s(Vi,"The "),bi=r(Vi,"A",{href:!0});var mM=i(bi);ok=s(mM,"TFLongformerForQuestionAnswering"),mM.forEach(t),nk=s(Vi," forward method, overrides the "),zd=r(Vi,"CODE",{});var hM=i(zd);sk=s(hM,"__call__"),hM.forEach(t),ak=s(Vi," special method."),Vi.forEach(t),rk=m(Kt),y(ts.$$.fragment,Kt),ik=m(Kt),y(os.$$.fragment,Kt),lk=m(Kt),y(ns.$$.fragment,Kt),Kt.forEach(t),It.forEach(t),Cm=m(o),Qo=r(o,"H2",{class:!0});var Yh=i(Qo);ss=r(Yh,"A",{id:!0,class:!0,href:!0});var pM=i(ss);Cd=r(pM,"SPAN",{});var fM=i(Cd);y(pr.$$.fragment,fM),fM.forEach(t),pM.forEach(t),dk=m(Yh),Id=r(Yh,"SPAN",{});var uM=i(Id);ck=s(uM,"TFLongformerForSequenceClassification"),uM.forEach(t),Yh.forEach(t),Im=m(o),it=r(o,"DIV",{class:!0});var Ut=i(it);y(fr.$$.fragment,Ut),mk=m(Ut),Ud=r(Ut,"P",{});var gM=i(Ud);hk=s(gM,`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.`),gM.forEach(t),pk=m(Ut),ur=r(Ut,"P",{});var Hh=i(ur);fk=s(Hh,"This model inherits from "),ki=r(Hh,"A",{href:!0});var _M=i(ki);uk=s(_M,"TFPreTrainedModel"),_M.forEach(t),gk=s(Hh,`. 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.)`),Hh.forEach(t),_k=m(Ut),gr=r(Ut,"P",{});var Kh=i(gr);wk=s(Kh,"This model is also a "),_r=r(Kh,"A",{href:!0,rel:!0});var wM=i(_r);bk=s(wM,"tf.keras.Model"),wM.forEach(t),kk=s(Kh,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Kh.forEach(t),Tk=m(Ut),y(as.$$.fragment,Ut),yk=m(Ut),Mt=r(Ut,"DIV",{class:!0});var eo=i(Mt);y(wr.$$.fragment,eo),vk=m(eo),Do=r(eo,"P",{});var Ri=i(Do);Mk=s(Ri,"The "),Ti=r(Ri,"A",{href:!0});var bM=i(Ti);$k=s(bM,"TFLongformerForSequenceClassification"),bM.forEach(t),xk=s(Ri," forward method, overrides the "),qd=r(Ri,"CODE",{});var kM=i(qd);Fk=s(kM,"__call__"),kM.forEach(t),Lk=s(Ri," special method."),Ri.forEach(t),Ek=m(eo),y(rs.$$.fragment,eo),jk=m(eo),y(is.$$.fragment,eo),Jk=m(eo),y(ls.$$.fragment,eo),eo.forEach(t),Ut.forEach(t),Um=m(o),Yo=r(o,"H2",{class:!0});var ep=i(Yo);ds=r(ep,"A",{id:!0,class:!0,href:!0});var TM=i(ds);Nd=r(TM,"SPAN",{});var yM=i(Nd);y(br.$$.fragment,yM),yM.forEach(t),TM.forEach(t),zk=m(ep),Wd=r(ep,"SPAN",{});var vM=i(Wd);Ck=s(vM,"TFLongformerForTokenClassification"),vM.forEach(t),ep.forEach(t),qm=m(o),lt=r(o,"DIV",{class:!0});var qt=i(lt);y(kr.$$.fragment,qt),Ik=m(qt),Zd=r(qt,"P",{});var MM=i(Zd);Uk=s(MM,`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.`),MM.forEach(t),qk=m(qt),Tr=r(qt,"P",{});var tp=i(Tr);Nk=s(tp,"This model inherits from "),yi=r(tp,"A",{href:!0});var $M=i(yi);Wk=s($M,"TFPreTrainedModel"),$M.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=m(qt),yr=r(qt,"P",{});var op=i(yr);Gk=s(op,"This model is also a "),vr=r(op,"A",{href:!0,rel:!0});var xM=i(vr);Ak=s(xM,"tf.keras.Model"),xM.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=m(qt),y(cs.$$.fragment,qt),Ok=m(qt),$t=r(qt,"DIV",{class:!0});var to=i($t);y(Mr.$$.fragment,to),Sk=m(to),Ho=r(to,"P",{});var Oi=i(Ho);Xk=s(Oi,"The "),vi=r(Oi,"A",{href:!0});var FM=i(vi);Pk=s(FM,"TFLongformerForTokenClassification"),FM.forEach(t),Qk=s(Oi," forward method, overrides the "),Bd=r(Oi,"CODE",{});var LM=i(Bd);Dk=s(LM,"__call__"),LM.forEach(t),Yk=s(Oi," special method."),Oi.forEach(t),Hk=m(to),y(ms.$$.fragment,to),Kk=m(to),y(hs.$$.fragment,to),eT=m(to),y(ps.$$.fragment,to),to.forEach(t),qt.forEach(t),Nm=m(o),Ko=r(o,"H2",{class:!0});var np=i(Ko);fs=r(np,"A",{id:!0,class:!0,href:!0});var EM=i(fs);Gd=r(EM,"SPAN",{});var jM=i(Gd);y($r.$$.fragment,jM),jM.forEach(t),EM.forEach(t),tT=m(np),Ad=r(np,"SPAN",{});var JM=i(Ad);oT=s(JM,"TFLongformerForMultipleChoice"),JM.forEach(t),np.forEach(t),Wm=m(o),dt=r(o,"DIV",{class:!0});var Nt=i(dt);y(xr.$$.fragment,Nt),nT=m(Nt),Vd=r(Nt,"P",{});var zM=i(Vd);sT=s(zM,`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.`),zM.forEach(t),aT=m(Nt),Fr=r(Nt,"P",{});var sp=i(Fr);rT=s(sp,"This model inherits from "),Mi=r(sp,"A",{href:!0});var CM=i(Mi);iT=s(CM,"TFPreTrainedModel"),CM.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=m(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 IM=i(Er);mT=s(IM,"tf.keras.Model"),IM.forEach(t),hT=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=m(Nt),y(us.$$.fragment,Nt),fT=m(Nt),Jt=r(Nt,"DIV",{class:!0});var ys=i(Jt);y(jr.$$.fragment,ys),uT=m(ys),en=r(ys,"P",{});var Si=i(en);gT=s(Si,"The "),$i=r(Si,"A",{href:!0});var UM=i($i);_T=s(UM,"TFLongformerForMultipleChoice"),UM.forEach(t),wT=s(Si," forward method, overrides the "),Rd=r(Si,"CODE",{});var qM=i(Rd);bT=s(qM,"__call__"),qM.forEach(t),kT=s(Si," special method."),Si.forEach(t),TT=m(ys),y(gs.$$.fragment,ys),yT=m(ys),y(_s.$$.fragment,ys),ys.forEach(t),Nt.forEach(t),this.h()},h(){u(d,"name","hf:doc:metadata"),u(d,"content",JSON.stringify(W2)),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"),NM(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"),NM(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(he,"href","https://arxiv.org/pdf/2004.05150.pdf"),u(he,"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=yc,vc.a=Mc,$c.a=xc,Lc.a=Ec,u(Nr,"href","/docs/transformers/main/en/model_doc/longformer#transformers.LongformerModel.forward"),Ic.a=Uc,qc.a=Nc,Wc.a=Zc,Bc.a=Gc,u(vs,"href","https://arxiv.org/pdf/2004.05150.pdf"),u(vs,"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/main/en/model_doc/longformer#transformers.LongformerForMaskedLM"),u(Zr,"href","/docs/transformers/main/en/model_doc/roberta#transformers.RobertaForMaskedLM"),u(mn,"id","documentation-resources"),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","#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(hn,"id","transformers.LongformerConfig"),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","#transformers.LongformerConfig"),u(ao,"class","relative group"),u(Or,"href","/docs/transformers/main/en/model_doc/longformer#transformers.LongformerModel"),u(Sr,"href","/docs/transformers/main/en/model_doc/longformer#transformers.TFLongformerModel"),u(Xr,"href","/docs/transformers/main/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/main/en/main_classes/configuration#transformers.PretrainedConfig"),u(Qr,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),u(pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(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/main/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(mo,"class","relative group"),u(Kr,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),u(vn,"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(ho,"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(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(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(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/main/en/main_classes/model#transformers.PreTrainedModel"),u(ma,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u(ma,"rel","nofollow"),u(ti,"href","/docs/transformers/main/en/model_doc/roberta#transformers.RobertaModel"),u(ha,"href","https://arxiv.org/abs/2004.05150"),u(ha,"rel","nofollow"),u(oi,"href","/docs/transformers/main/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/main/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/main/en/model_doc/longformer#transformers.LongformerForMaskedLM"),u(ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(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/main/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/main/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/main/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/main/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/main/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/main/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(mi,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),u(Ra,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),u(Ra,"rel","nofollow"),u(hi,"href","/docs/transformers/main/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/main/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/main/en/model_doc/roberta#transformers.TFRobertaModel"),u(Ya,"href","https://arxiv.org/abs/2004.05150"),u(Ya,"rel","nofollow"),u(ui,"href","/docs/transformers/main/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/main/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/main/en/model_doc/longformer#transformers.TFLongformerForMaskedLM"),u(yt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(at,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(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/main/en/main_classes/model#transformers.TFPreTrainedModel"),u(mr,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u(mr,"rel","nofollow"),u(bi,"href","/docs/transformers/main/en/model_doc/longformer#transformers.TFLongformerForQuestionAnswering"),u(vt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(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/main/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/main/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(yi,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),u(vr,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),u(vr,"rel","nofollow"),u(vi,"href","/docs/transformers/main/en/model_doc/longformer#transformers.TFLongformerForTokenClassification"),u($t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(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/main/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/main/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),v(l,k,null),e(p,h),e(p,j),e(j,ae),f(o,ee,_),f(o,N,_),e(N,re),e(re,oe),e(N,ve),e(N,V),e(V,fe),f(o,X,_),f(o,ie,_),e(ie,de),e(de,R),v(me,R,null),e(ie,Me),e(ie,O),e(O,$e),f(o,ke,_),f(o,G,_),e(G,xe),e(G,he),e(he,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,ye,_),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),v(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(WM,Q),e(Q,yc),vc.m(ZM,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,mp),$c.m(BM,Q),e(Q,xc),e(Q,Di),e(Di,hp),e(Q,pp),f(o,Fc,_),f(o,Zt,_),e(Zt,fp),Lc.m(GM,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,yp),e(rn,vp),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(AM,bt),e(bt,Uc),qc.m(VM,bt),e(bt,Nc),Wc.m(RM,bt),e(bt,Zc),Bc.m(OM,bt),e(bt,Gc),f(o,Ac,_),f(o,dn,_),e(dn,Ep),e(dn,vs),e(vs,jp),e(dn,Jp),f(o,Vc,_),f(o,oo,_),e(oo,cn),e(cn,ol),v(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,_),v($s,o,_),f(o,Sc,_),f(o,so,_),e(so,mn),e(mn,sl),v(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,hn),e(hn,ml),v(Fs,ml,null),e(ao,Qp),e(ao,hl),e(hl,Dp),f(o,Qc,_),f(o,pt,_),v(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,mf),e(lo,Pr),e(Pr,hf),e(lo,pf),e(lo,Qr),e(Qr,ff),e(lo,uf),e(pt,gf),v(pn,pt,null),f(o,Dc,_),f(o,co,_),e(co,fn),e(fn,pl),v(js,pl,null),e(co,_f),e(co,fl),e(fl,wf),f(o,Yc,_),f(o,Ue,_),v(Js,Ue,null),e(Ue,bf),e(Ue,ul),e(ul,kf),e(Ue,Tf),e(Ue,gl),e(gl,yf),e(Ue,vf),v(un,Ue,null),e(Ue,Mf),e(Ue,zs),e(zs,$f),e(zs,_l),e(_l,xf),e(zs,Ff),e(Ue,Lf),v(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),v(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),v(qs,_n,null),e(_n,Vf),e(_n,Tl),e(Tl,Rf),e(Ue,Of),e(Ue,wn),v(Ns,wn,null),e(wn,Sf),e(wn,yl),e(yl,Xf),e(Ue,Pf),e(Ue,bn),v(Ws,bn,null),e(bn,Qf),e(bn,Zs),e(Zs,Df),e(Zs,vl),e(vl,Yf),e(Zs,Hf),f(o,Hc,_),f(o,mo,_),e(mo,kn),e(kn,Ml),v(Bs,Ml,null),e(mo,Kf),e(mo,$l),e($l,eu),f(o,Kc,_),f(o,De,_),v(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),v(Tn,De,null),e(De,lu),e(De,Vs),e(Vs,du),e(Vs,Ll),e(Ll,cu),e(Vs,mu),e(De,hu),v(yn,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,vn),v(Os,vn,null),e(vn,wu),e(vn,El),e(El,bu),f(o,em,_),f(o,ho,_),e(ho,Mn),e(Mn,jl),v(Ss,jl,null),e(ho,ku),e(ho,Jl),e(Jl,Tu),f(o,tm,_),f(o,po,_),v(Xs,po,null),e(po,yu),e(po,zl),e(zl,vu),f(o,om,_),f(o,fo,_),v(Ps,fo,null),e(fo,Mu),e(fo,Cl),e(Cl,$u),f(o,nm,_),f(o,uo,_),v(Qs,uo,null),e(uo,xu),e(uo,Il),e(Il,Fu),f(o,sm,_),f(o,go,_),v(Ds,go,null),e(go,Lu),e(go,Ul),e(Ul,Eu),f(o,am,_),f(o,_o,_),v(Ys,_o,null),e(_o,ju),e(_o,ql),e(ql,Ju),f(o,rm,_),f(o,wo,_),v(Hs,wo,null),e(wo,zu),e(wo,Nl),e(Nl,Cu),f(o,im,_),f(o,bo,_),v(Ks,bo,null),e(bo,Iu),e(bo,Wl),e(Wl,Uu),f(o,lm,_),f(o,ko,_),v(ea,ko,null),e(ko,qu),e(ko,Zl),e(Zl,Nu),f(o,dm,_),f(o,To,_),v(ta,To,null),e(To,Wu),e(To,Bl),e(Bl,Zu),f(o,cm,_),f(o,yo,_),v(oa,yo,null),e(yo,Bu),e(yo,Gl),e(Gl,Gu),f(o,mm,_),f(o,vo,_),v(na,vo,null),e(vo,Au),e(vo,Al),e(Al,Vu),f(o,hm,_),f(o,Mo,_),v(sa,Mo,null),e(Mo,Ru),e(Mo,Vl),e(Vl,Ou),f(o,pm,_),f(o,$o,_),v(aa,$o,null),e($o,Su),e($o,Rl),e(Rl,Xu),f(o,fm,_),f(o,xo,_),v(ra,xo,null),e(xo,Pu),e(xo,Ol),e(Ol,Qu),f(o,um,_),f(o,Fo,_),e(Fo,$n),e($n,Sl),v(ia,Sl,null),e(Fo,Du),e(Fo,Xl),e(Xl,Yu),f(o,gm,_),f(o,st,_),v(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,ma),e(ma,rg),e(ca,ig),e(st,lg),e(st,Lo),e(Lo,dg),e(Lo,ti),e(ti,cg),e(Lo,mg),e(Lo,ha),e(ha,hg),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),v(fa,Ft,null),e(Ft,bg),e(Ft,Eo),e(Eo,kg),e(Eo,oi),e(oi,Tg),e(Eo,yg),e(Eo,Dl),e(Dl,vg),e(Eo,Mg),e(Ft,$g),v(xn,Ft,null),e(Ft,xg),v(Fn,Ft,null),f(o,_m,_),f(o,jo,_),e(jo,Ln),e(Ln,Yl),v(ua,Yl,null),e(jo,Fg),e(jo,Hl),e(Hl,Lg),f(o,wm,_),f(o,ft,_),v(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),v(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),v(En,ct,null),e(ct,Qg),v(jn,ct,null),e(ct,Dg),e(ct,td),e(td,Yg),e(ct,Hg),v(Jn,ct,null),f(o,bm,_),f(o,zo,_),e(zo,zn),e(zn,od),v(ya,od,null),e(zo,Kg),e(zo,nd),e(nd,e_),f(o,km,_),f(o,ut,_),v(va,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,m_),e(ut,Tt),v(Fa,Tt,null),e(Tt,h_),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_),v(Cn,Tt,null),e(Tt,b_),v(In,Tt,null),e(Tt,k_),v(Un,Tt,null),f(o,Tm,_),f(o,Io,_),e(Io,qn),e(qn,rd),v(La,rd,null),e(Io,T_),e(Io,id),e(id,y_),f(o,ym,_),f(o,gt,_),v(Ea,gt,null),e(gt,v_),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),v(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_),v(Nn,Lt,null),e(Lt,G_),v(Wn,Lt,null),f(o,vm,_),f(o,qo,_),e(qo,Zn),e(Zn,cd),v(Ia,cd,null),e(qo,A_),e(qo,md),e(md,V_),f(o,Mm,_),f(o,_t,_),v(Ua,_t,null),e(_t,R_),e(_t,hd),e(hd,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),v(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),v(Bn,Et,null),e(Et,lw),v(Gn,Et,null),f(o,$m,_),f(o,Wo,_),e(Wo,An),e(An,fd),v(Ba,fd,null),e(Wo,dw),e(Wo,ud),e(ud,cw),f(o,xm,_),f(o,wt,_),v(Ga,wt,null),e(wt,mw),e(wt,Zo),e(Zo,hw),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,mi),e(mi,bw),e(Aa,kw),e(wt,Tw),e(wt,Va),e(Va,yw),e(Va,Ra),e(Ra,vw),e(Va,Mw),e(wt,$w),e(wt,jt),v(Oa,jt,null),e(jt,xw),e(jt,Bo),e(Bo,Fw),e(Bo,hi),e(hi,Lw),e(Bo,Ew),e(Bo,wd),e(wd,jw),e(Bo,Jw),e(jt,zw),v(Vn,jt,null),e(jt,Cw),v(Rn,jt,null),f(o,Fm,_),f(o,Go,_),e(Go,On),e(On,bd),v(Sa,bd,null),e(Go,Iw),e(Go,kd),e(kd,Uw),f(o,Lm,_),f(o,Ye,_),v(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),v(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,yd),e(yd,tb),e(Ha,ob),e(Ye,nb),e(Ye,At),v(Ka,At,null),e(At,sb),e(At,Vo),e(Vo,ab),e(Vo,ui),e(ui,rb),e(Vo,ib),e(Vo,vd),e(vd,lb),e(Vo,db),e(At,cb),v(Xn,At,null),f(o,Em,_),f(o,Ro,_),e(Ro,Pn),e(Pn,Md),v(er,Md,null),e(Ro,mb),e(Ro,$d),e($d,hb),f(o,jm,_),f(o,at,_),v(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,yb),e(sr,ar),e(ar,vb),e(sr,Mb),e(at,$b),v(Qn,at,null),e(at,xb),e(at,yt),v(rr,yt,null),e(yt,Fb),e(yt,Oo),e(Oo,Lb),e(Oo,_i),e(_i,Eb),e(Oo,jb),e(Oo,Fd),e(Fd,Jb),e(Oo,zb),e(yt,Cb),v(Dn,yt,null),e(yt,Ib),v(Yn,yt,null),e(yt,Ub),v(Hn,yt,null),f(o,Jm,_),f(o,So,_),e(So,Kn),e(Kn,Ld),v(ir,Ld,null),e(So,qb),e(So,Ed),e(Ed,Nb),f(o,zm,_),f(o,rt,_),v(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,mr),e(mr,Db),e(cr,Yb),e(rt,Hb),v(es,rt,null),e(rt,Kb),e(rt,vt),v(hr,vt,null),e(vt,ek),e(vt,Po),e(Po,tk),e(Po,bi),e(bi,ok),e(Po,nk),e(Po,zd),e(zd,sk),e(Po,ak),e(vt,rk),v(ts,vt,null),e(vt,ik),v(os,vt,null),e(vt,lk),v(ns,vt,null),f(o,Cm,_),f(o,Qo,_),e(Qo,ss),e(ss,Cd),v(pr,Cd,null),e(Qo,dk),e(Qo,Id),e(Id,ck),f(o,Im,_),f(o,it,_),v(fr,it,null),e(it,mk),e(it,Ud),e(Ud,hk),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),v(as,it,null),e(it,yk),e(it,Mt),v(wr,Mt,null),e(Mt,vk),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),v(rs,Mt,null),e(Mt,jk),v(is,Mt,null),e(Mt,Jk),v(ls,Mt,null),f(o,Um,_),f(o,Yo,_),e(Yo,ds),e(ds,Nd),v(br,Nd,null),e(Yo,zk),e(Yo,Wd),e(Wd,Ck),f(o,qm,_),f(o,lt,_),v(kr,lt,null),e(lt,Ik),e(lt,Zd),e(Zd,Uk),e(lt,qk),e(lt,Tr),e(Tr,Nk),e(Tr,yi),e(yi,Wk),e(Tr,Zk),e(lt,Bk),e(lt,yr),e(yr,Gk),e(yr,vr),e(vr,Ak),e(yr,Vk),e(lt,Rk),v(cs,lt,null),e(lt,Ok),e(lt,$t),v(Mr,$t,null),e($t,Sk),e($t,Ho),e(Ho,Xk),e(Ho,vi),e(vi,Pk),e(Ho,Qk),e(Ho,Bd),e(Bd,Dk),e(Ho,Yk),e($t,Hk),v(ms,$t,null),e($t,Kk),v(hs,$t,null),e($t,eT),v(ps,$t,null),f(o,Nm,_),f(o,Ko,_),e(Ko,fs),e(fs,Gd),v($r,Gd,null),e(Ko,tT),e(Ko,Ad),e(Ad,oT),f(o,Wm,_),f(o,dt,_),v(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,mT),e(Lr,hT),e(dt,pT),v(us,dt,null),e(dt,fT),e(dt,Jt),v(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),v(gs,Jt,null),e(Jt,yT),v(_s,Jt,null),Zm=!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}),yn.$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 mc={};_&2&&(mc.$$scope={dirty:_,ctx:o}),ns.$set(mc);const hc={};_&2&&(hc.$$scope={dirty:_,ctx:o}),as.$set(hc);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}),ms.$set(gc);const on={};_&2&&(on.$$scope={dirty:_,ctx:o}),hs.$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){Zm||(M(l.$$.fragment,o),M(me.$$.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(yn.$$.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(ya.$$.fragment,o),M(va.$$.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(hr.$$.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(ms.$$.fragment,o),M(hs.$$.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),Zm=!0)},o(o){$(l.$$.fragment,o),$(me.$$.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),$(yn.$$.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),$(ya.$$.fragment,o),$(va.$$.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),$(hr.$$.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),$(ms.$$.fragment,o),$(hs.$$.fragment,o),$(ps.$$.fragment,o),$($r.$$.fragment,o),$(xr.$$.fragment,o),$(us.$$.fragment,o),$(jr.$$.fragment,o),$(gs.$$.fragment,o),$(_s.$$.fragment,o),Zm=!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(me),o&&t(ke),o&&t(G),o&&t(I),o&&t(ue),o&&t(Te),o&&t(ge),o&&t(ye),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(mo),x(Bs),o&&t(Kc),o&&t(De),x(Gs),x(Tn),x(yn),x(Os),o&&t(em),o&&t(ho),x(Ss),o&&t(tm),o&&t(po),x(Xs),o&&t(om),o&&t(fo),x(Ps),o&&t(nm),o&&t(uo),x(Qs),o&&t(sm),o&&t(go),x(Ds),o&&t(am),o&&t(_o),x(Ys),o&&t(rm),o&&t(wo),x(Hs),o&&t(im),o&&t(bo),x(Ks),o&&t(lm),o&&t(ko),x(ea),o&&t(dm),o&&t(To),x(ta),o&&t(cm),o&&t(yo),x(oa),o&&t(mm),o&&t(vo),x(na),o&&t(hm),o&&t(Mo),x(sa),o&&t(pm),o&&t($o),x(aa),o&&t(fm),o&&t(xo),x(ra),o&&t(um),o&&t(Fo),x(ia),o&&t(gm),o&&t(st),x(la),x(fa),x(xn),x(Fn),o&&t(_m),o&&t(jo),x(ua),o&&t(wm),o&&t(ft),x(ga),x(Ta),x(En),x(jn),x(Jn),o&&t(bm),o&&t(zo),x(ya),o&&t(km),o&&t(ut),x(va),x(Fa),x(Cn),x(In),x(Un),o&&t(Tm),o&&t(Io),x(La),o&&t(ym),o&&t(gt),x(Ea),x(Ca),x(Nn),x(Wn),o&&t(vm),o&&t(qo),x(Ia),o&&t(Mm),o&&t(_t),x(Ua),x(Za),x(Bn),x(Gn),o&&t($m),o&&t(Wo),x(Ba),o&&t(xm),o&&t(wt),x(Ga),x(Oa),x(Vn),x(Rn),o&&t(Fm),o&&t(Go),x(Sa),o&&t(Lm),o&&t(Ye),x(Xa),x(Sn),x(Ka),x(Xn),o&&t(Em),o&&t(Ro),x(er),o&&t(jm),o&&t(at),x(tr),x(Qn),x(rr),x(Dn),x(Yn),x(Hn),o&&t(Jm),o&&t(So),x(ir),o&&t(zm),o&&t(rt),x(lr),x(es),x(hr),x(ts),x(os),x(ns),o&&t(Cm),o&&t(Qo),x(pr),o&&t(Im),o&&t(it),x(fr),x(as),x(wr),x(rs),x(is),x(ls),o&&t(Um),o&&t(Yo),x(br),o&&t(qm),o&&t(lt),x(kr),x(cs),x(Mr),x(ms),x(hs),x(ps),o&&t(Nm),o&&t(Ko),x($r),o&&t(Wm),o&&t(dt),x(xr),x(us),x(jr),x(gs),x(_s)}}}const W2={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 Z2(J){return DM(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class S2 extends SM{constructor(d){super();XM(this,d,Z2,N2,PM,{})}}export{S2 as default,W2 as metadata};
