import{S as Wi,i as Zi,s as Ii,e as s,k as f,w as M,t as l,M as xi,c as r,d as t,m as u,a,x as w,h as d,b as p,G as e,g as _,y as T,q as v,o as k,B as N,v as Xi,L as Le}from"../../chunks/vendor-hf-doc-builder.js";import{T as mt}from"../../chunks/Tip-hf-doc-builder.js";import{D as Z}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ye}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Q}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Qe}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Bi($){let i,b,h,m,y;return m=new Ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME55c3Ryb21mb3JtZXJNb2RlbCUyQyUyME55c3Ryb21mb3JtZXJDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwTnlzdHJvbWZvcm1lciUyMHV3LW1hZGlzb24lMkZueXN0cm9tZm9ybWVyLTUxMiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBOeXN0cm9tZm9ybWVyQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjBmcm9tJTIwdGhlJTIwdXctbWFkaXNvbiUyRm55c3Ryb21mb3JtZXItNTEyJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBOeXN0cm9tZm9ybWVyTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> NystromformerModel, NystromformerConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Nystromformer uw-madison/nystromformer-512 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = NystromformerConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the uw-madison/nystromformer-512 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NystromformerModel(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(){i=s("p"),b=l("Example:"),h=f(),M(m.$$.fragment)},l(n){i=r(n,"P",{});var c=a(i);b=d(c,"Example:"),c.forEach(t),h=u(n),w(m.$$.fragment,n)},m(n,c){_(n,i,c),e(i,b),_(n,h,c),T(m,n,c),y=!0},p:Le,i(n){y||(v(m.$$.fragment,n),y=!0)},o(n){k(m.$$.fragment,n),y=!1},d(n){n&&t(i),n&&t(h),N(m,n)}}}function qi($){let i,b,h,m,y;return{c(){i=s("p"),b=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),h=s("code"),m=l("Module"),y=l(`
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(n){i=r(n,"P",{});var c=a(i);b=d(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),h=r(c,"CODE",{});var J=a(h);m=d(J,"Module"),J.forEach(t),y=d(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(n,c){_(n,i,c),e(i,b),e(i,h),e(h,m),e(i,y)},d(n){n&&t(i)}}}function Vi($){let i,b,h,m,y;return m=new Ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBOeXN0cm9tZm9ybWVyTW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZueXN0cm9tZm9ybWVyLTUxMiUyMiklMEFtb2RlbCUyMCUzRCUyME55c3Ryb21mb3JtZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIydXctbWFkaXNvbiUyRm55c3Ryb21mb3JtZXItNTEyJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NystromformerModel
<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;uw-madison/nystromformer-512&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NystromformerModel.from_pretrained(<span class="hljs-string">&quot;uw-madison/nystromformer-512&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){i=s("p"),b=l("Example:"),h=f(),M(m.$$.fragment)},l(n){i=r(n,"P",{});var c=a(i);b=d(c,"Example:"),c.forEach(t),h=u(n),w(m.$$.fragment,n)},m(n,c){_(n,i,c),e(i,b),_(n,h,c),T(m,n,c),y=!0},p:Le,i(n){y||(v(m.$$.fragment,n),y=!0)},o(n){k(m.$$.fragment,n),y=!1},d(n){n&&t(i),n&&t(h),N(m,n)}}}function Ri($){let i,b,h,m,y;return{c(){i=s("p"),b=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),h=s("code"),m=l("Module"),y=l(`
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(n){i=r(n,"P",{});var c=a(i);b=d(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),h=r(c,"CODE",{});var J=a(h);m=d(J,"Module"),J.forEach(t),y=d(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(n,c){_(n,i,c),e(i,b),e(i,h),e(h,m),e(i,y)},d(n){n&&t(i)}}}function Gi($){let i,b,h,m,y;return m=new Ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBOeXN0cm9tZm9ybWVyRm9yTWFza2VkTE0lMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZueXN0cm9tZm9ybWVyLTUxMiUyMiklMEFtb2RlbCUyMCUzRCUyME55c3Ryb21mb3JtZXJGb3JNYXNrZWRMTS5mcm9tX3ByZXRyYWluZWQoJTIydXctbWFkaXNvbiUyRm55c3Ryb21mb3JtZXItNTEyJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJUaGUlMjBjYXBpdGFsJTIwb2YlMjBGcmFuY2UlMjBpcyUyMCU1Qk1BU0slNUQuJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQSUyMyUyMHJldHJpZXZlJTIwaW5kZXglMjBvZiUyMCU1Qk1BU0slNUQlMEFtYXNrX3Rva2VuX2luZGV4JTIwJTNEJTIwKGlucHV0cy5pbnB1dF9pZHMlMjAlM0QlM0QlMjB0b2tlbml6ZXIubWFza190b2tlbl9pZCklNUIwJTVELm5vbnplcm8oYXNfdHVwbGUlM0RUcnVlKSU1QjAlNUQlMEElMEFwcmVkaWN0ZWRfdG9rZW5faWQlMjAlM0QlMjBsb2dpdHMlNUIwJTJDJTIwbWFza190b2tlbl9pbmRleCU1RC5hcmdtYXgoYXhpcyUzRC0xKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRva2VuaXplciglMjJUaGUlMjBjYXBpdGFsJTIwb2YlMjBGcmFuY2UlMjBpcyUyMFBhcmlzLiUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTIzJTIwbWFzayUyMGxhYmVscyUyMG9mJTIwbm9uLSU1Qk1BU0slNUQlMjB0b2tlbnMlMEFsYWJlbHMlMjAlM0QlMjB0b3JjaC53aGVyZShpbnB1dHMuaW5wdXRfaWRzJTIwJTNEJTNEJTIwdG9rZW5pemVyLm1hc2tfdG9rZW5faWQlMkMlMjBsYWJlbHMlMkMlMjAtMTAwKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NystromformerForMaskedLM
<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;uw-madison/nystromformer-512&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NystromformerForMaskedLM.from_pretrained(<span class="hljs-string">&quot;uw-madison/nystromformer-512&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;The capital of France is [MASK].&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><span class="hljs-comment"># retrieve index of [MASK]</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_index = (inputs.input_ids == tokenizer.mask_token_id)[<span class="hljs-number">0</span>].nonzero(as_tuple=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_id = logits[<span class="hljs-number">0</span>, mask_token_index].argmax(axis=-<span class="hljs-number">1</span>)

<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;pt&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-[MASK] tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.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)`}}),{c(){i=s("p"),b=l("Example:"),h=f(),M(m.$$.fragment)},l(n){i=r(n,"P",{});var c=a(i);b=d(c,"Example:"),c.forEach(t),h=u(n),w(m.$$.fragment,n)},m(n,c){_(n,i,c),e(i,b),_(n,h,c),T(m,n,c),y=!0},p:Le,i(n){y||(v(m.$$.fragment,n),y=!0)},o(n){k(m.$$.fragment,n),y=!1},d(n){n&&t(i),n&&t(h),N(m,n)}}}function Ai($){let i,b,h,m,y;return{c(){i=s("p"),b=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),h=s("code"),m=l("Module"),y=l(`
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(n){i=r(n,"P",{});var c=a(i);b=d(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),h=r(c,"CODE",{});var J=a(h);m=d(J,"Module"),J.forEach(t),y=d(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(n,c){_(n,i,c),e(i,b),e(i,h),e(h,m),e(i,y)},d(n){n&&t(i)}}}function Si($){let i,b,h,m,y;return m=new Ye({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyME55c3Ryb21mb3JtZXJGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIydXctbWFkaXNvbiUyRm55c3Ryb21mb3JtZXItNTEyJTIyKSUwQW1vZGVsJTIwJTNEJTIwTnlzdHJvbWZvcm1lckZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZueXN0cm9tZm9ybWVyLTUxMiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWQlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KCkuaXRlbSgpJTBBJTBBJTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwTnlzdHJvbWZvcm1lckZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZueXN0cm9tZm9ybWVyLTUxMiUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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, NystromformerForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;uw-madison/nystromformer-512&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NystromformerForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;uw-madison/nystromformer-512&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = logits.argmax().item()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NystromformerForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;uw-madison/nystromformer-512&quot;</span>, num_labels=num_labels)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor([<span class="hljs-number">1</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){i=s("p"),b=l("Example of single-label classification:"),h=f(),M(m.$$.fragment)},l(n){i=r(n,"P",{});var c=a(i);b=d(c,"Example of single-label classification:"),c.forEach(t),h=u(n),w(m.$$.fragment,n)},m(n,c){_(n,i,c),e(i,b),_(n,h,c),T(m,n,c),y=!0},p:Le,i(n){y||(v(m.$$.fragment,n),y=!0)},o(n){k(m.$$.fragment,n),y=!1},d(n){n&&t(i),n&&t(h),N(m,n)}}}function Qi($){let i,b,h,m,y;return m=new Ye({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyME55c3Ryb21mb3JtZXJGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIydXctbWFkaXNvbiUyRm55c3Ryb21mb3JtZXItNTEyJTIyKSUwQW1vZGVsJTIwJTNEJTIwTnlzdHJvbWZvcm1lckZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZueXN0cm9tZm9ybWVyLTUxMiUyMiUyQyUyMHByb2JsZW1fdHlwZSUzRCUyMm11bHRpX2xhYmVsX2NsYXNzaWZpY2F0aW9uJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZHMlMjAlM0QlMjB0b3JjaC5hcmFuZ2UoMCUyQyUyMGxvZ2l0cy5zaGFwZSU1Qi0xJTVEKSU1QnRvcmNoLnNpZ21vaWQobG9naXRzKS5zcXVlZXplKGRpbSUzRDApJTIwJTNFJTIwMC41JTVEJTBBJTBBJTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwTnlzdHJvbWZvcm1lckZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnV3LW1hZGlzb24lMkZueXN0cm9tZm9ybWVyLTUxMiUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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, NystromformerForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;uw-madison/nystromformer-512&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NystromformerForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;uw-madison/nystromformer-512&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 = NystromformerForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;uw-madison/nystromformer-512&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(){i=s("p"),b=l("Example of multi-label classification:"),h=f(),M(m.$$.fragment)},l(n){i=r(n,"P",{});var c=a(i);b=d(c,"Example of multi-label classification:"),c.forEach(t),h=u(n),w(m.$$.fragment,n)},m(n,c){_(n,i,c),e(i,b),_(n,h,c),T(m,n,c),y=!0},p:Le,i(n){y||(v(m.$$.fragment,n),y=!0)},o(n){k(m.$$.fragment,n),y=!1},d(n){n&&t(i),n&&t(h),N(m,n)}}}function Li($){let i,b,h,m,y;return{c(){i=s("p"),b=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),h=s("code"),m=l("Module"),y=l(`
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(n){i=r(n,"P",{});var c=a(i);b=d(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),h=r(c,"CODE",{});var J=a(h);m=d(J,"Module"),J.forEach(t),y=d(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(n,c){_(n,i,c),e(i,b),e(i,h),e(h,m),e(i,y)},d(n){n&&t(i)}}}function Yi($){let i,b,h,m,y;return m=new Ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBOeXN0cm9tZm9ybWVyRm9yTXVsdGlwbGVDaG9pY2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZueXN0cm9tZm9ybWVyLTUxMiUyMiklMEFtb2RlbCUyMCUzRCUyME55c3Ryb21mb3JtZXJGb3JNdWx0aXBsZUNob2ljZS5mcm9tX3ByZXRyYWluZWQoJTIydXctbWFkaXNvbiUyRm55c3Ryb21mb3JtZXItNTEyJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkluJTIwSXRhbHklMkMlMjBwaXp6YSUyMHNlcnZlZCUyMGluJTIwZm9ybWFsJTIwc2V0dGluZ3MlMkMlMjBzdWNoJTIwYXMlMjBhdCUyMGElMjByZXN0YXVyYW50JTJDJTIwaXMlMjBwcmVzZW50ZWQlMjB1bnNsaWNlZC4lMjIlMEFjaG9pY2UwJTIwJTNEJTIwJTIySXQlMjBpcyUyMGVhdGVuJTIwd2l0aCUyMGElMjBmb3JrJTIwYW5kJTIwYSUyMGtuaWZlLiUyMiUwQWNob2ljZTElMjAlM0QlMjAlMjJJdCUyMGlzJTIwZWF0ZW4lMjB3aGlsZSUyMGhlbGQlMjBpbiUyMHRoZSUyMGhhbmQuJTIyJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2gudGVuc29yKDApLnVuc3F1ZWV6ZSgwKSUyMCUyMCUyMyUyMGNob2ljZTAlMjBpcyUyMGNvcnJlY3QlMjAoYWNjb3JkaW5nJTIwdG8lMjBXaWtpcGVkaWElMjAlM0IpKSUyQyUyMGJhdGNoJTIwc2l6ZSUyMDElMEElMEFlbmNvZGluZyUyMCUzRCUyMHRva2VuaXplciglNUJwcm9tcHQlMkMlMjBwcm9tcHQlNUQlMkMlMjAlNUJjaG9pY2UwJTJDJTIwY2hvaWNlMSU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMkMlMjBwYWRkaW5nJTNEVHJ1ZSklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKiolN0JrJTNBJTIwdi51bnNxdWVlemUoMCklMjBmb3IlMjBrJTJDJTIwdiUyMGluJTIwZW5jb2RpbmcuaXRlbXMoKSU3RCUyQyUyMGxhYmVscyUzRGxhYmVscyklMjAlMjAlMjMlMjBiYXRjaCUyMHNpemUlMjBpcyUyMDElMEElMEElMjMlMjB0aGUlMjBsaW5lYXIlMjBjbGFzc2lmaWVyJTIwc3RpbGwlMjBuZWVkcyUyMHRvJTIwYmUlMjB0cmFpbmVkJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcyUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NystromformerForMultipleChoice
<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;uw-madison/nystromformer-512&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NystromformerForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;uw-madison/nystromformer-512&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(){i=s("p"),b=l("Example:"),h=f(),M(m.$$.fragment)},l(n){i=r(n,"P",{});var c=a(i);b=d(c,"Example:"),c.forEach(t),h=u(n),w(m.$$.fragment,n)},m(n,c){_(n,i,c),e(i,b),_(n,h,c),T(m,n,c),y=!0},p:Le,i(n){y||(v(m.$$.fragment,n),y=!0)},o(n){k(m.$$.fragment,n),y=!1},d(n){n&&t(i),n&&t(h),N(m,n)}}}function Pi($){let i,b,h,m,y;return{c(){i=s("p"),b=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),h=s("code"),m=l("Module"),y=l(`
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(n){i=r(n,"P",{});var c=a(i);b=d(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),h=r(c,"CODE",{});var J=a(h);m=d(J,"Module"),J.forEach(t),y=d(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(n,c){_(n,i,c),e(i,b),e(i,h),e(h,m),e(i,y)},d(n){n&&t(i)}}}function Hi($){let i,b,h,m,y;return m=new Ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBOeXN0cm9tZm9ybWVyRm9yVG9rZW5DbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIydXctbWFkaXNvbiUyRm55c3Ryb21mb3JtZXItNTEyJTIyKSUwQW1vZGVsJTIwJTNEJTIwTnlzdHJvbWZvcm1lckZvclRva2VuQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZueXN0cm9tZm9ybWVyLTUxMiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwJTIySHVnZ2luZ0ZhY2UlMjBpcyUyMGElMjBjb21wYW55JTIwYmFzZWQlMjBpbiUyMFBhcmlzJTIwYW5kJTIwTmV3JTIwWW9yayUyMiUyQyUyMGFkZF9zcGVjaWFsX3Rva2VucyUzREZhbHNlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUwQSklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF90b2tlbl9jbGFzc19pZHMlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KC0xKSUwQSUwQSUyMyUyME5vdGUlMjB0aGF0JTIwdG9rZW5zJTIwYXJlJTIwY2xhc3NpZmllZCUyMHJhdGhlciUyMHRoZW4lMjBpbnB1dCUyMHdvcmRzJTIwd2hpY2glMjBtZWFucyUyMHRoYXQlMEElMjMlMjB0aGVyZSUyMG1pZ2h0JTIwYmUlMjBtb3JlJTIwcHJlZGljdGVkJTIwdG9rZW4lMjBjbGFzc2VzJTIwdGhhbiUyMHdvcmRzLiUwQSUyMyUyME11bHRpcGxlJTIwdG9rZW4lMjBjbGFzc2VzJTIwbWlnaHQlMjBhY2NvdW50JTIwZm9yJTIwdGhlJTIwc2FtZSUyMHdvcmQlMEFwcmVkaWN0ZWRfdG9rZW5zX2NsYXNzZXMlMjAlM0QlMjAlNUJtb2RlbC5jb25maWcuaWQybGFiZWwlNUJ0Lml0ZW0oKSU1RCUyMGZvciUyMHQlMjBpbiUyMHByZWRpY3RlZF90b2tlbl9jbGFzc19pZHMlNUIwJTVEJTVEJTBBJTBBbGFiZWxzJTIwJTNEJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NystromformerForTokenClassification
<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;uw-madison/nystromformer-512&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NystromformerForTokenClassification.from_pretrained(<span class="hljs-string">&quot;uw-madison/nystromformer-512&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>labels = predicted_token_class_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){i=s("p"),b=l("Example:"),h=f(),M(m.$$.fragment)},l(n){i=r(n,"P",{});var c=a(i);b=d(c,"Example:"),c.forEach(t),h=u(n),w(m.$$.fragment,n)},m(n,c){_(n,i,c),e(i,b),_(n,h,c),T(m,n,c),y=!0},p:Le,i(n){y||(v(m.$$.fragment,n),y=!0)},o(n){k(m.$$.fragment,n),y=!1},d(n){n&&t(i),n&&t(h),N(m,n)}}}function Oi($){let i,b,h,m,y;return{c(){i=s("p"),b=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),h=s("code"),m=l("Module"),y=l(`
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(n){i=r(n,"P",{});var c=a(i);b=d(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),h=r(c,"CODE",{});var J=a(h);m=d(J,"Module"),J.forEach(t),y=d(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(n,c){_(n,i,c),e(i,b),e(i,h),e(h,m),e(i,y)},d(n){n&&t(i)}}}function Di($){let i,b,h,m,y;return m=new Ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBOeXN0cm9tZm9ybWVyRm9yUXVlc3Rpb25BbnN3ZXJpbmclMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZueXN0cm9tZm9ybWVyLTUxMiUyMiklMEFtb2RlbCUyMCUzRCUyME55c3Ryb21mb3JtZXJGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIydXctbWFkaXNvbiUyRm55c3Ryb21mb3JtZXItNTEyJTIyKSUwQSUwQXF1ZXN0aW9uJTJDJTIwdGV4dCUyMCUzRCUyMCUyMldobyUyMHdhcyUyMEppbSUyMEhlbnNvbiUzRiUyMiUyQyUyMCUyMkppbSUyMEhlbnNvbiUyMHdhcyUyMGElMjBuaWNlJTIwcHVwcGV0JTIyJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHF1ZXN0aW9uJTJDJTIwdGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFhbnN3ZXJfc3RhcnRfaW5kZXglMjAlM0QlMjBvdXRwdXRzLnN0YXJ0X2xvZ2l0cy5hcmdtYXgoKSUwQWFuc3dlcl9lbmRfaW5kZXglMjAlM0QlMjBvdXRwdXRzLmVuZF9sb2dpdHMuYXJnbWF4KCklMEElMEFwcmVkaWN0X2Fuc3dlcl90b2tlbnMlMjAlM0QlMjBpbnB1dHMuaW5wdXRfaWRzJTVCMCUyQyUyMGFuc3dlcl9zdGFydF9pbmRleCUyMCUzQSUyMGFuc3dlcl9lbmRfaW5kZXglMjAlMkIlMjAxJTVEJTBBJTBBJTIzJTIwdGFyZ2V0JTIwaXMlMjAlMjJuaWNlJTIwcHVwcGV0JTIyJTBBdGFyZ2V0X3N0YXJ0X2luZGV4JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QjE0JTVEKSUwQXRhcmdldF9lbmRfaW5kZXglMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCMTUlNUQpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwc3RhcnRfcG9zaXRpb25zJTNEdGFyZ2V0X3N0YXJ0X2luZGV4JTJDJTIwZW5kX3Bvc2l0aW9ucyUzRHRhcmdldF9lbmRfaW5kZXgpJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NystromformerForQuestionAnswering
<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;uw-madison/nystromformer-512&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NystromformerForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;uw-madison/nystromformer-512&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;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>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>answer_start_index = outputs.start_logits.argmax()
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_end_index = outputs.end_logits.argmax()

<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><span class="hljs-comment"># target is &quot;nice puppet&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_start_index = torch.tensor([<span class="hljs-number">14</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>target_end_index = torch.tensor([<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 = outputs.loss`}}),{c(){i=s("p"),b=l("Example:"),h=f(),M(m.$$.fragment)},l(n){i=r(n,"P",{});var c=a(i);b=d(c,"Example:"),c.forEach(t),h=u(n),w(m.$$.fragment,n)},m(n,c){_(n,i,c),e(i,b),_(n,h,c),T(m,n,c),y=!0},p:Le,i(n){y||(v(m.$$.fragment,n),y=!0)},o(n){k(m.$$.fragment,n),y=!1},d(n){n&&t(i),n&&t(h),N(m,n)}}}function Ki($){let i,b,h,m,y,n,c,J,Rn,an,L,pe,pt,Pe,Gn,ht,An,ln,he,Sn,He,ft,Qn,Ln,dn,Io,Yn,cn,xo,ut,Pn,mn,G,Hn,Oe,On,Dn,De,Kn,es,pn,Y,fe,gt,Ke,os,yt,ts,hn,U,_t,Xo,ns,ss,bt,Bo,rs,as,Mt,qo,is,ls,wt,Vo,ds,cs,Tt,Ro,ms,fn,P,ue,vt,eo,ps,kt,hs,un,F,oo,fs,H,us,Go,gs,ys,to,_s,bs,Ms,O,ws,Ao,Ts,vs,So,ks,Ns,$s,ge,gn,D,ye,Nt,no,Js,$t,Us,yn,V,so,js,ro,Fs,ao,zs,Cs,Es,I,io,Ws,K,Zs,Qo,Is,xs,Jt,Xs,Bs,qs,_e,Vs,be,_n,ee,Me,Ut,lo,Rs,jt,Gs,bn,R,co,As,oe,Ss,Ft,Qs,Ls,mo,Ys,Ps,Hs,x,po,Os,te,Ds,Lo,Ks,er,zt,or,tr,nr,we,sr,Te,Mn,ne,ve,Ct,ho,rr,Et,ar,wn,z,fo,ir,Wt,lr,dr,uo,cr,go,mr,pr,hr,j,yo,fr,se,ur,Yo,gr,yr,Zt,_r,br,Mr,ke,wr,Ne,Tr,$e,Tn,re,Je,It,_o,vr,xt,kr,vn,C,bo,Nr,Xt,$r,Jr,Mo,Ur,wo,jr,Fr,zr,X,To,Cr,ae,Er,Po,Wr,Zr,Bt,Ir,xr,Xr,Ue,Br,je,kn,ie,Fe,qt,vo,qr,Vt,Vr,Nn,E,ko,Rr,Rt,Gr,Ar,No,Sr,$o,Qr,Lr,Yr,B,Jo,Pr,le,Hr,Ho,Or,Dr,Gt,Kr,ea,oa,ze,ta,Ce,$n,de,Ee,At,Uo,na,St,sa,Jn,W,jo,ra,ce,aa,Qt,ia,la,Lt,da,ca,ma,Fo,pa,zo,ha,fa,ua,q,Co,ga,me,ya,Oo,_a,ba,Yt,Ma,wa,Ta,We,va,Ze,Un;return n=new Q({}),Pe=new Q({}),Ke=new Q({}),eo=new Q({}),oo=new Z({props:{name:"class transformers.NystromformerConfig",anchor:"transformers.NystromformerConfig",parameters:[{name:"vocab_size",val:" = 30000"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu_new'"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"max_position_embeddings",val:" = 510"},{name:"type_vocab_size",val:" = 2"},{name:"segment_means_seq_len",val:" = 64"},{name:"num_landmarks",val:" = 64"},{name:"conv_kernel_size",val:" = 65"},{name:"inv_coeff_init_option",val:" = False"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.NystromformerConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30000) &#x2014;
Vocabulary size of the Nystromformer model. Defines the number of different tokens that can be represented
by the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerModel">NystromformerModel</a>.`,name:"vocab_size"},{anchor:"transformers.NystromformerConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimension of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.NystromformerConfig.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.NystromformerConfig.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.NystromformerConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimension of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.NystromformerConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</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;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.NystromformerConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.NystromformerConfig.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.NystromformerConfig.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.NystromformerConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerModel">NystromformerModel</a>.`,name:"type_vocab_size"},{anchor:"transformers.NystromformerConfig.segment_means_seq_len",description:`<strong>segment_means_seq_len</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Sequence length used in segment-means.`,name:"segment_means_seq_len"},{anchor:"transformers.NystromformerConfig.num_landmarks",description:`<strong>num_landmarks</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
The number of landmark (or Nystrom) points to use in Nystrom approximation of the softmax self-attention
matrix.`,name:"num_landmarks"},{anchor:"transformers.NystromformerConfig.conv_kernel_size",description:`<strong>conv_kernel_size</strong> (<code>int</code>, <em>optional</em>, defaults to 65) &#x2014;
The kernel size of depthwise convolution used in Nystrom approximation.`,name:"conv_kernel_size"},{anchor:"transformers.NystromformerConfig.inv_coeff_init_option",description:`<strong>inv_coeff_init_option</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use exact coefficient computation for the initial values for the iterative method of
calculating the Moore-Penrose inverse of a matrix.`,name:"inv_coeff_init_option"},{anchor:"transformers.NystromformerConfig.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.NystromformerConfig.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"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/configuration_nystromformer.py#L29"}}),ge=new Qe({props:{anchor:"transformers.NystromformerConfig.example",$$slots:{default:[Bi]},$$scope:{ctx:$}}}),no=new Q({}),so=new Z({props:{name:"class transformers.NystromformerModel",anchor:"transformers.NystromformerModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NystromformerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerConfig">NystromformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/modeling_nystromformer.py#L550"}}),io=new Z({props:{name:"forward",anchor:"transformers.NystromformerModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.NystromformerModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.NystromformerModel.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.NystromformerModel.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.NystromformerModel.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.NystromformerModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.NystromformerModel.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NystromformerModel.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.NystromformerModel.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.NystromformerModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/modeling_nystromformer.py#L575",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerConfig"
>NystromformerConfig</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>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
<code>config.is_encoder_decoder=True</code> in the cross-attention blocks) that can be used (see <code>past_key_values</code>
input) to speed up sequential decoding.</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, if the model has an embedding layer, +
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 optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> and <code>config.add_cross_attention=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),_e=new mt({props:{$$slots:{default:[qi]},$$scope:{ctx:$}}}),be=new Qe({props:{anchor:"transformers.NystromformerModel.forward.example",$$slots:{default:[Vi]},$$scope:{ctx:$}}}),lo=new Q({}),co=new Z({props:{name:"class transformers.NystromformerForMaskedLM",anchor:"transformers.NystromformerForMaskedLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NystromformerForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerConfig">NystromformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/modeling_nystromformer.py#L662"}}),po=new Z({props:{name:"forward",anchor:"transformers.NystromformerForMaskedLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.NystromformerForMaskedLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.NystromformerForMaskedLM.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.NystromformerForMaskedLM.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.NystromformerForMaskedLM.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.NystromformerForMaskedLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.NystromformerForMaskedLM.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NystromformerForMaskedLM.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.NystromformerForMaskedLM.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.NystromformerForMaskedLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NystromformerForMaskedLM.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"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/modeling_nystromformer.py#L680",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerConfig"
>NystromformerConfig</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, if the model has an embedding layer, +
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 optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),we=new mt({props:{$$slots:{default:[Ri]},$$scope:{ctx:$}}}),Te=new Qe({props:{anchor:"transformers.NystromformerForMaskedLM.forward.example",$$slots:{default:[Gi]},$$scope:{ctx:$}}}),ho=new Q({}),fo=new Z({props:{name:"class transformers.NystromformerForSequenceClassification",anchor:"transformers.NystromformerForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NystromformerForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerConfig">NystromformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/modeling_nystromformer.py#L767"}}),yo=new Z({props:{name:"forward",anchor:"transformers.NystromformerForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.NystromformerForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.NystromformerForSequenceClassification.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.NystromformerForSequenceClassification.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.NystromformerForSequenceClassification.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.NystromformerForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.NystromformerForSequenceClassification.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NystromformerForSequenceClassification.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.NystromformerForSequenceClassification.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.NystromformerForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NystromformerForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/modeling_nystromformer.py#L777",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerConfig"
>NystromformerConfig</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, if the model has an embedding layer, +
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 optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ke=new mt({props:{$$slots:{default:[Ai]},$$scope:{ctx:$}}}),Ne=new Qe({props:{anchor:"transformers.NystromformerForSequenceClassification.forward.example",$$slots:{default:[Si]},$$scope:{ctx:$}}}),$e=new Qe({props:{anchor:"transformers.NystromformerForSequenceClassification.forward.example-2",$$slots:{default:[Qi]},$$scope:{ctx:$}}}),_o=new Q({}),bo=new Z({props:{name:"class transformers.NystromformerForMultipleChoice",anchor:"transformers.NystromformerForMultipleChoice",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NystromformerForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerConfig">NystromformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/modeling_nystromformer.py#L860"}}),To=new Z({props:{name:"forward",anchor:"transformers.NystromformerForMultipleChoice.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.NystromformerForMultipleChoice.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.NystromformerForMultipleChoice.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.NystromformerForMultipleChoice.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.NystromformerForMultipleChoice.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.NystromformerForMultipleChoice.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.NystromformerForMultipleChoice.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NystromformerForMultipleChoice.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.NystromformerForMultipleChoice.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.NystromformerForMultipleChoice.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NystromformerForMultipleChoice.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the multiple choice classification loss. Indices should be in <code>[0, ..., num_choices-1]</code> where <code>num_choices</code> is the size of the second dimension of the input tensors. (See
<code>input_ids</code> above)`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/modeling_nystromformer.py#L871",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput"
>transformers.modeling_outputs.MultipleChoiceModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerConfig"
>NystromformerConfig</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, if the model has an embedding layer, +
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 optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput"
>transformers.modeling_outputs.MultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ue=new mt({props:{$$slots:{default:[Li]},$$scope:{ctx:$}}}),je=new Qe({props:{anchor:"transformers.NystromformerForMultipleChoice.forward.example",$$slots:{default:[Yi]},$$scope:{ctx:$}}}),vo=new Q({}),ko=new Z({props:{name:"class transformers.NystromformerForTokenClassification",anchor:"transformers.NystromformerForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NystromformerForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerConfig">NystromformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/modeling_nystromformer.py#L955"}}),Jo=new Z({props:{name:"forward",anchor:"transformers.NystromformerForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.NystromformerForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.NystromformerForTokenClassification.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.NystromformerForTokenClassification.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.NystromformerForTokenClassification.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.NystromformerForTokenClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.NystromformerForTokenClassification.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NystromformerForTokenClassification.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.NystromformerForTokenClassification.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.NystromformerForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NystromformerForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/modeling_nystromformer.py#L967",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerConfig"
>NystromformerConfig</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, if the model has an embedding layer, +
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 optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ze=new mt({props:{$$slots:{default:[Pi]},$$scope:{ctx:$}}}),Ce=new Qe({props:{anchor:"transformers.NystromformerForTokenClassification.forward.example",$$slots:{default:[Hi]},$$scope:{ctx:$}}}),Uo=new Q({}),jo=new Z({props:{name:"class transformers.NystromformerForQuestionAnswering",anchor:"transformers.NystromformerForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NystromformerForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerConfig">NystromformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/modeling_nystromformer.py#L1033"}}),Co=new Z({props:{name:"forward",anchor:"transformers.NystromformerForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"end_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.NystromformerForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.NystromformerForQuestionAnswering.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.NystromformerForQuestionAnswering.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.NystromformerForQuestionAnswering.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.NystromformerForQuestionAnswering.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.NystromformerForQuestionAnswering.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NystromformerForQuestionAnswering.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.NystromformerForQuestionAnswering.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.NystromformerForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NystromformerForQuestionAnswering.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.NystromformerForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/nystromformer/modeling_nystromformer.py#L1046",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerConfig"
>NystromformerConfig</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, if the model has an embedding layer, +
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 optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),We=new mt({props:{$$slots:{default:[Oi]},$$scope:{ctx:$}}}),Ze=new Qe({props:{anchor:"transformers.NystromformerForQuestionAnswering.forward.example",$$slots:{default:[Di]},$$scope:{ctx:$}}}),{c(){i=s("meta"),b=f(),h=s("h1"),m=s("a"),y=s("span"),M(n.$$.fragment),c=f(),J=s("span"),Rn=l("Nystr\xF6mformer"),an=f(),L=s("h2"),pe=s("a"),pt=s("span"),M(Pe.$$.fragment),Gn=f(),ht=s("span"),An=l("Overview"),ln=f(),he=s("p"),Sn=l("The Nystr\xF6mformer model was proposed in "),He=s("a"),ft=s("em"),Qn=l("Nystr\xF6mformer: A Nystr\xF6m-Based Algorithm for Approximating Self-Attention"),Ln=l(` by Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn
Fung, Yin Li, and Vikas Singh.`),dn=f(),Io=s("p"),Yn=l("The abstract from the paper is the following:"),cn=f(),xo=s("p"),ut=s("em"),Pn=l(`Transformers have emerged as a powerful tool for a broad range of natural language processing tasks. A key component
that drives the impressive performance of Transformers is the self-attention mechanism that encodes the influence or
dependence of other tokens on each specific token. While beneficial, the quadratic complexity of self-attention on the
input sequence length has limited its application to longer sequences \u2014 a topic being actively studied in the
community. To address this limitation, we propose Nystr\xF6mformer \u2014 a model that exhibits favorable scalability as a
function of sequence length. Our idea is based on adapting the Nystr\xF6m method to approximate standard self-attention
with O(n) complexity. The scalability of Nystr\xF6mformer enables application to longer sequences with thousands of
tokens. We perform evaluations on multiple downstream tasks on the GLUE benchmark and IMDB reviews with standard
sequence length, and find that our Nystr\xF6mformer performs comparably, or in a few cases, even slightly better, than
standard self-attention. On longer sequence tasks in the Long Range Arena (LRA) benchmark, Nystr\xF6mformer performs
favorably relative to other efficient self-attention methods. Our code is available at this https URL.`),mn=f(),G=s("p"),Hn=l("This model was contributed by "),Oe=s("a"),On=l("novice03"),Dn=l(". The original code can be found "),De=s("a"),Kn=l("here"),es=l("."),pn=f(),Y=s("h2"),fe=s("a"),gt=s("span"),M(Ke.$$.fragment),os=f(),yt=s("span"),ts=l("Documentation resources"),hn=f(),U=s("ul"),_t=s("li"),Xo=s("a"),ns=l("Text classification task guide"),ss=f(),bt=s("li"),Bo=s("a"),rs=l("Token classification task guide"),as=f(),Mt=s("li"),qo=s("a"),is=l("Question answering task guide"),ls=f(),wt=s("li"),Vo=s("a"),ds=l("Masked language modeling task guide"),cs=f(),Tt=s("li"),Ro=s("a"),ms=l("Multiple choice task guide"),fn=f(),P=s("h2"),ue=s("a"),vt=s("span"),M(eo.$$.fragment),ps=f(),kt=s("span"),hs=l("NystromformerConfig"),un=f(),F=s("div"),M(oo.$$.fragment),fs=f(),H=s("p"),us=l("This is the configuration class to store the configuration of a "),Go=s("a"),gs=l("NystromformerModel"),ys=l(`. It is used to instantiate
an Nystromformer 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 Nystromformer
`),to=s("a"),_s=l("uw-madison/nystromformer-512"),bs=l(" architecture."),Ms=f(),O=s("p"),ws=l("Configuration objects inherit from "),Ao=s("a"),Ts=l("PretrainedConfig"),vs=l(` and can be used to control the model outputs. Read the
documentation from `),So=s("a"),ks=l("PretrainedConfig"),Ns=l(" for more information."),$s=f(),M(ge.$$.fragment),gn=f(),D=s("h2"),ye=s("a"),Nt=s("span"),M(no.$$.fragment),Js=f(),$t=s("span"),Us=l("NystromformerModel"),yn=f(),V=s("div"),M(so.$$.fragment),js=f(),ro=s("p"),Fs=l(`The bare Nystr\xF6mformer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ao=s("a"),zs=l("torch.nn.Module"),Cs=l(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Es=f(),I=s("div"),M(io.$$.fragment),Ws=f(),K=s("p"),Zs=l("The "),Qo=s("a"),Is=l("NystromformerModel"),xs=l(" forward method, overrides the "),Jt=s("code"),Xs=l("__call__"),Bs=l(" special method."),qs=f(),M(_e.$$.fragment),Vs=f(),M(be.$$.fragment),_n=f(),ee=s("h2"),Me=s("a"),Ut=s("span"),M(lo.$$.fragment),Rs=f(),jt=s("span"),Gs=l("NystromformerForMaskedLM"),bn=f(),R=s("div"),M(co.$$.fragment),As=f(),oe=s("p"),Ss=l("Nystr\xF6mformer Model with a "),Ft=s("code"),Qs=l("language modeling"),Ls=l(` head on top.
This model is a PyTorch `),mo=s("a"),Ys=l("torch.nn.Module"),Ps=l(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Hs=f(),x=s("div"),M(po.$$.fragment),Os=f(),te=s("p"),Ds=l("The "),Lo=s("a"),Ks=l("NystromformerForMaskedLM"),er=l(" forward method, overrides the "),zt=s("code"),or=l("__call__"),tr=l(" special method."),nr=f(),M(we.$$.fragment),sr=f(),M(Te.$$.fragment),Mn=f(),ne=s("h2"),ve=s("a"),Ct=s("span"),M(ho.$$.fragment),rr=f(),Et=s("span"),ar=l("NystromformerForSequenceClassification"),wn=f(),z=s("div"),M(fo.$$.fragment),ir=f(),Wt=s("p"),lr=l(`Nystr\xF6mformer Model transformer with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.`),dr=f(),uo=s("p"),cr=l("This model is a PyTorch "),go=s("a"),mr=l("torch.nn.Module"),pr=l(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),hr=f(),j=s("div"),M(yo.$$.fragment),fr=f(),se=s("p"),ur=l("The "),Yo=s("a"),gr=l("NystromformerForSequenceClassification"),yr=l(" forward method, overrides the "),Zt=s("code"),_r=l("__call__"),br=l(" special method."),Mr=f(),M(ke.$$.fragment),wr=f(),M(Ne.$$.fragment),Tr=f(),M($e.$$.fragment),Tn=f(),re=s("h2"),Je=s("a"),It=s("span"),M(_o.$$.fragment),vr=f(),xt=s("span"),kr=l("NystromformerForMultipleChoice"),vn=f(),C=s("div"),M(bo.$$.fragment),Nr=f(),Xt=s("p"),$r=l(`Nystr\xF6mformer 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.`),Jr=f(),Mo=s("p"),Ur=l("This model is a PyTorch "),wo=s("a"),jr=l("torch.nn.Module"),Fr=l(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),zr=f(),X=s("div"),M(To.$$.fragment),Cr=f(),ae=s("p"),Er=l("The "),Po=s("a"),Wr=l("NystromformerForMultipleChoice"),Zr=l(" forward method, overrides the "),Bt=s("code"),Ir=l("__call__"),xr=l(" special method."),Xr=f(),M(Ue.$$.fragment),Br=f(),M(je.$$.fragment),kn=f(),ie=s("h2"),Fe=s("a"),qt=s("span"),M(vo.$$.fragment),qr=f(),Vt=s("span"),Vr=l("NystromformerForTokenClassification"),Nn=f(),E=s("div"),M(ko.$$.fragment),Rr=f(),Rt=s("p"),Gr=l(`Nystr\xF6mformer 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.`),Ar=f(),No=s("p"),Sr=l("This model is a PyTorch "),$o=s("a"),Qr=l("torch.nn.Module"),Lr=l(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Yr=f(),B=s("div"),M(Jo.$$.fragment),Pr=f(),le=s("p"),Hr=l("The "),Ho=s("a"),Or=l("NystromformerForTokenClassification"),Dr=l(" forward method, overrides the "),Gt=s("code"),Kr=l("__call__"),ea=l(" special method."),oa=f(),M(ze.$$.fragment),ta=f(),M(Ce.$$.fragment),$n=f(),de=s("h2"),Ee=s("a"),At=s("span"),M(Uo.$$.fragment),na=f(),St=s("span"),sa=l("NystromformerForQuestionAnswering"),Jn=f(),W=s("div"),M(jo.$$.fragment),ra=f(),ce=s("p"),aa=l(`Nystr\xF6mformer Model with a span classification head on top for extractive question-answering tasks like SQuAD (a
linear layers on top of the hidden-states output to compute `),Qt=s("code"),ia=l("span start logits"),la=l(" and "),Lt=s("code"),da=l("span end logits"),ca=l(")."),ma=f(),Fo=s("p"),pa=l("This model is a PyTorch "),zo=s("a"),ha=l("torch.nn.Module"),fa=l(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ua=f(),q=s("div"),M(Co.$$.fragment),ga=f(),me=s("p"),ya=l("The "),Oo=s("a"),_a=l("NystromformerForQuestionAnswering"),ba=l(" forward method, overrides the "),Yt=s("code"),Ma=l("__call__"),wa=l(" special method."),Ta=f(),M(We.$$.fragment),va=f(),M(Ze.$$.fragment),this.h()},l(o){const g=xi('[data-svelte="svelte-1phssyn"]',document.head);i=r(g,"META",{name:!0,content:!0}),g.forEach(t),b=u(o),h=r(o,"H1",{class:!0});var Eo=a(h);m=r(Eo,"A",{id:!0,class:!0,href:!0});var Pt=a(m);y=r(Pt,"SPAN",{});var Ht=a(y);w(n.$$.fragment,Ht),Ht.forEach(t),Pt.forEach(t),c=u(Eo),J=r(Eo,"SPAN",{});var Ot=a(J);Rn=d(Ot,"Nystr\xF6mformer"),Ot.forEach(t),Eo.forEach(t),an=u(o),L=r(o,"H2",{class:!0});var Wo=a(L);pe=r(Wo,"A",{id:!0,class:!0,href:!0});var Dt=a(pe);pt=r(Dt,"SPAN",{});var Kt=a(pt);w(Pe.$$.fragment,Kt),Kt.forEach(t),Dt.forEach(t),Gn=u(Wo),ht=r(Wo,"SPAN",{});var en=a(ht);An=d(en,"Overview"),en.forEach(t),Wo.forEach(t),ln=u(o),he=r(o,"P",{});var Zo=a(he);Sn=d(Zo,"The Nystr\xF6mformer model was proposed in "),He=r(Zo,"A",{href:!0,rel:!0});var on=a(He);ft=r(on,"EM",{});var tn=a(ft);Qn=d(tn,"Nystr\xF6mformer: A Nystr\xF6m-Based Algorithm for Approximating Self-Attention"),tn.forEach(t),on.forEach(t),Ln=d(Zo,` by Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn
Fung, Yin Li, and Vikas Singh.`),Zo.forEach(t),dn=u(o),Io=r(o,"P",{});var nn=a(Io);Yn=d(nn,"The abstract from the paper is the following:"),nn.forEach(t),cn=u(o),xo=r(o,"P",{});var sn=a(xo);ut=r(sn,"EM",{});var rn=a(ut);Pn=d(rn,`Transformers have emerged as a powerful tool for a broad range of natural language processing tasks. A key component
that drives the impressive performance of Transformers is the self-attention mechanism that encodes the influence or
dependence of other tokens on each specific token. While beneficial, the quadratic complexity of self-attention on the
input sequence length has limited its application to longer sequences \u2014 a topic being actively studied in the
community. To address this limitation, we propose Nystr\xF6mformer \u2014 a model that exhibits favorable scalability as a
function of sequence length. Our idea is based on adapting the Nystr\xF6m method to approximate standard self-attention
with O(n) complexity. The scalability of Nystr\xF6mformer enables application to longer sequences with thousands of
tokens. We perform evaluations on multiple downstream tasks on the GLUE benchmark and IMDB reviews with standard
sequence length, and find that our Nystr\xF6mformer performs comparably, or in a few cases, even slightly better, than
standard self-attention. On longer sequence tasks in the Long Range Arena (LRA) benchmark, Nystr\xF6mformer performs
favorably relative to other efficient self-attention methods. Our code is available at this https URL.`),rn.forEach(t),sn.forEach(t),mn=u(o),G=r(o,"P",{});var Do=a(G);Hn=d(Do,"This model was contributed by "),Oe=r(Do,"A",{href:!0,rel:!0});var ka=a(Oe);On=d(ka,"novice03"),ka.forEach(t),Dn=d(Do,". The original code can be found "),De=r(Do,"A",{href:!0,rel:!0});var Na=a(De);Kn=d(Na,"here"),Na.forEach(t),es=d(Do,"."),Do.forEach(t),pn=u(o),Y=r(o,"H2",{class:!0});var jn=a(Y);fe=r(jn,"A",{id:!0,class:!0,href:!0});var $a=a(fe);gt=r($a,"SPAN",{});var Ja=a(gt);w(Ke.$$.fragment,Ja),Ja.forEach(t),$a.forEach(t),os=u(jn),yt=r(jn,"SPAN",{});var Ua=a(yt);ts=d(Ua,"Documentation resources"),Ua.forEach(t),jn.forEach(t),hn=u(o),U=r(o,"UL",{});var A=a(U);_t=r(A,"LI",{});var ja=a(_t);Xo=r(ja,"A",{href:!0});var Fa=a(Xo);ns=d(Fa,"Text classification task guide"),Fa.forEach(t),ja.forEach(t),ss=u(A),bt=r(A,"LI",{});var za=a(bt);Bo=r(za,"A",{href:!0});var Ca=a(Bo);rs=d(Ca,"Token classification task guide"),Ca.forEach(t),za.forEach(t),as=u(A),Mt=r(A,"LI",{});var Ea=a(Mt);qo=r(Ea,"A",{href:!0});var Wa=a(qo);is=d(Wa,"Question answering task guide"),Wa.forEach(t),Ea.forEach(t),ls=u(A),wt=r(A,"LI",{});var Za=a(wt);Vo=r(Za,"A",{href:!0});var Ia=a(Vo);ds=d(Ia,"Masked language modeling task guide"),Ia.forEach(t),Za.forEach(t),cs=u(A),Tt=r(A,"LI",{});var xa=a(Tt);Ro=r(xa,"A",{href:!0});var Xa=a(Ro);ms=d(Xa,"Multiple choice task guide"),Xa.forEach(t),xa.forEach(t),A.forEach(t),fn=u(o),P=r(o,"H2",{class:!0});var Fn=a(P);ue=r(Fn,"A",{id:!0,class:!0,href:!0});var Ba=a(ue);vt=r(Ba,"SPAN",{});var qa=a(vt);w(eo.$$.fragment,qa),qa.forEach(t),Ba.forEach(t),ps=u(Fn),kt=r(Fn,"SPAN",{});var Va=a(kt);hs=d(Va,"NystromformerConfig"),Va.forEach(t),Fn.forEach(t),un=u(o),F=r(o,"DIV",{class:!0});var Ie=a(F);w(oo.$$.fragment,Ie),fs=u(Ie),H=r(Ie,"P",{});var Ko=a(H);us=d(Ko,"This is the configuration class to store the configuration of a "),Go=r(Ko,"A",{href:!0});var Ra=a(Go);gs=d(Ra,"NystromformerModel"),Ra.forEach(t),ys=d(Ko,`. It is used to instantiate
an Nystromformer 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 Nystromformer
`),to=r(Ko,"A",{href:!0,rel:!0});var Ga=a(to);_s=d(Ga,"uw-madison/nystromformer-512"),Ga.forEach(t),bs=d(Ko," architecture."),Ko.forEach(t),Ms=u(Ie),O=r(Ie,"P",{});var et=a(O);ws=d(et,"Configuration objects inherit from "),Ao=r(et,"A",{href:!0});var Aa=a(Ao);Ts=d(Aa,"PretrainedConfig"),Aa.forEach(t),vs=d(et,` and can be used to control the model outputs. Read the
documentation from `),So=r(et,"A",{href:!0});var Sa=a(So);ks=d(Sa,"PretrainedConfig"),Sa.forEach(t),Ns=d(et," for more information."),et.forEach(t),$s=u(Ie),w(ge.$$.fragment,Ie),Ie.forEach(t),gn=u(o),D=r(o,"H2",{class:!0});var zn=a(D);ye=r(zn,"A",{id:!0,class:!0,href:!0});var Qa=a(ye);Nt=r(Qa,"SPAN",{});var La=a(Nt);w(no.$$.fragment,La),La.forEach(t),Qa.forEach(t),Js=u(zn),$t=r(zn,"SPAN",{});var Ya=a($t);Us=d(Ya,"NystromformerModel"),Ya.forEach(t),zn.forEach(t),yn=u(o),V=r(o,"DIV",{class:!0});var ot=a(V);w(so.$$.fragment,ot),js=u(ot),ro=r(ot,"P",{});var Cn=a(ro);Fs=d(Cn,`The bare Nystr\xF6mformer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ao=r(Cn,"A",{href:!0,rel:!0});var Pa=a(ao);zs=d(Pa,"torch.nn.Module"),Pa.forEach(t),Cs=d(Cn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Cn.forEach(t),Es=u(ot),I=r(ot,"DIV",{class:!0});var xe=a(I);w(io.$$.fragment,xe),Ws=u(xe),K=r(xe,"P",{});var tt=a(K);Zs=d(tt,"The "),Qo=r(tt,"A",{href:!0});var Ha=a(Qo);Is=d(Ha,"NystromformerModel"),Ha.forEach(t),xs=d(tt," forward method, overrides the "),Jt=r(tt,"CODE",{});var Oa=a(Jt);Xs=d(Oa,"__call__"),Oa.forEach(t),Bs=d(tt," special method."),tt.forEach(t),qs=u(xe),w(_e.$$.fragment,xe),Vs=u(xe),w(be.$$.fragment,xe),xe.forEach(t),ot.forEach(t),_n=u(o),ee=r(o,"H2",{class:!0});var En=a(ee);Me=r(En,"A",{id:!0,class:!0,href:!0});var Da=a(Me);Ut=r(Da,"SPAN",{});var Ka=a(Ut);w(lo.$$.fragment,Ka),Ka.forEach(t),Da.forEach(t),Rs=u(En),jt=r(En,"SPAN",{});var ei=a(jt);Gs=d(ei,"NystromformerForMaskedLM"),ei.forEach(t),En.forEach(t),bn=u(o),R=r(o,"DIV",{class:!0});var nt=a(R);w(co.$$.fragment,nt),As=u(nt),oe=r(nt,"P",{});var st=a(oe);Ss=d(st,"Nystr\xF6mformer Model with a "),Ft=r(st,"CODE",{});var oi=a(Ft);Qs=d(oi,"language modeling"),oi.forEach(t),Ls=d(st,` head on top.
This model is a PyTorch `),mo=r(st,"A",{href:!0,rel:!0});var ti=a(mo);Ys=d(ti,"torch.nn.Module"),ti.forEach(t),Ps=d(st,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),st.forEach(t),Hs=u(nt),x=r(nt,"DIV",{class:!0});var Xe=a(x);w(po.$$.fragment,Xe),Os=u(Xe),te=r(Xe,"P",{});var rt=a(te);Ds=d(rt,"The "),Lo=r(rt,"A",{href:!0});var ni=a(Lo);Ks=d(ni,"NystromformerForMaskedLM"),ni.forEach(t),er=d(rt," forward method, overrides the "),zt=r(rt,"CODE",{});var si=a(zt);or=d(si,"__call__"),si.forEach(t),tr=d(rt," special method."),rt.forEach(t),nr=u(Xe),w(we.$$.fragment,Xe),sr=u(Xe),w(Te.$$.fragment,Xe),Xe.forEach(t),nt.forEach(t),Mn=u(o),ne=r(o,"H2",{class:!0});var Wn=a(ne);ve=r(Wn,"A",{id:!0,class:!0,href:!0});var ri=a(ve);Ct=r(ri,"SPAN",{});var ai=a(Ct);w(ho.$$.fragment,ai),ai.forEach(t),ri.forEach(t),rr=u(Wn),Et=r(Wn,"SPAN",{});var ii=a(Et);ar=d(ii,"NystromformerForSequenceClassification"),ii.forEach(t),Wn.forEach(t),wn=u(o),z=r(o,"DIV",{class:!0});var Be=a(z);w(fo.$$.fragment,Be),ir=u(Be),Wt=r(Be,"P",{});var li=a(Wt);lr=d(li,`Nystr\xF6mformer Model transformer with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.`),li.forEach(t),dr=u(Be),uo=r(Be,"P",{});var Zn=a(uo);cr=d(Zn,"This model is a PyTorch "),go=r(Zn,"A",{href:!0,rel:!0});var di=a(go);mr=d(di,"torch.nn.Module"),di.forEach(t),pr=d(Zn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Zn.forEach(t),hr=u(Be),j=r(Be,"DIV",{class:!0});var S=a(j);w(yo.$$.fragment,S),fr=u(S),se=r(S,"P",{});var at=a(se);ur=d(at,"The "),Yo=r(at,"A",{href:!0});var ci=a(Yo);gr=d(ci,"NystromformerForSequenceClassification"),ci.forEach(t),yr=d(at," forward method, overrides the "),Zt=r(at,"CODE",{});var mi=a(Zt);_r=d(mi,"__call__"),mi.forEach(t),br=d(at," special method."),at.forEach(t),Mr=u(S),w(ke.$$.fragment,S),wr=u(S),w(Ne.$$.fragment,S),Tr=u(S),w($e.$$.fragment,S),S.forEach(t),Be.forEach(t),Tn=u(o),re=r(o,"H2",{class:!0});var In=a(re);Je=r(In,"A",{id:!0,class:!0,href:!0});var pi=a(Je);It=r(pi,"SPAN",{});var hi=a(It);w(_o.$$.fragment,hi),hi.forEach(t),pi.forEach(t),vr=u(In),xt=r(In,"SPAN",{});var fi=a(xt);kr=d(fi,"NystromformerForMultipleChoice"),fi.forEach(t),In.forEach(t),vn=u(o),C=r(o,"DIV",{class:!0});var qe=a(C);w(bo.$$.fragment,qe),Nr=u(qe),Xt=r(qe,"P",{});var ui=a(Xt);$r=d(ui,`Nystr\xF6mformer 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.`),ui.forEach(t),Jr=u(qe),Mo=r(qe,"P",{});var xn=a(Mo);Ur=d(xn,"This model is a PyTorch "),wo=r(xn,"A",{href:!0,rel:!0});var gi=a(wo);jr=d(gi,"torch.nn.Module"),gi.forEach(t),Fr=d(xn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),xn.forEach(t),zr=u(qe),X=r(qe,"DIV",{class:!0});var Ve=a(X);w(To.$$.fragment,Ve),Cr=u(Ve),ae=r(Ve,"P",{});var it=a(ae);Er=d(it,"The "),Po=r(it,"A",{href:!0});var yi=a(Po);Wr=d(yi,"NystromformerForMultipleChoice"),yi.forEach(t),Zr=d(it," forward method, overrides the "),Bt=r(it,"CODE",{});var _i=a(Bt);Ir=d(_i,"__call__"),_i.forEach(t),xr=d(it," special method."),it.forEach(t),Xr=u(Ve),w(Ue.$$.fragment,Ve),Br=u(Ve),w(je.$$.fragment,Ve),Ve.forEach(t),qe.forEach(t),kn=u(o),ie=r(o,"H2",{class:!0});var Xn=a(ie);Fe=r(Xn,"A",{id:!0,class:!0,href:!0});var bi=a(Fe);qt=r(bi,"SPAN",{});var Mi=a(qt);w(vo.$$.fragment,Mi),Mi.forEach(t),bi.forEach(t),qr=u(Xn),Vt=r(Xn,"SPAN",{});var wi=a(Vt);Vr=d(wi,"NystromformerForTokenClassification"),wi.forEach(t),Xn.forEach(t),Nn=u(o),E=r(o,"DIV",{class:!0});var Re=a(E);w(ko.$$.fragment,Re),Rr=u(Re),Rt=r(Re,"P",{});var Ti=a(Rt);Gr=d(Ti,`Nystr\xF6mformer 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.`),Ti.forEach(t),Ar=u(Re),No=r(Re,"P",{});var Bn=a(No);Sr=d(Bn,"This model is a PyTorch "),$o=r(Bn,"A",{href:!0,rel:!0});var vi=a($o);Qr=d(vi,"torch.nn.Module"),vi.forEach(t),Lr=d(Bn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Bn.forEach(t),Yr=u(Re),B=r(Re,"DIV",{class:!0});var Ge=a(B);w(Jo.$$.fragment,Ge),Pr=u(Ge),le=r(Ge,"P",{});var lt=a(le);Hr=d(lt,"The "),Ho=r(lt,"A",{href:!0});var ki=a(Ho);Or=d(ki,"NystromformerForTokenClassification"),ki.forEach(t),Dr=d(lt," forward method, overrides the "),Gt=r(lt,"CODE",{});var Ni=a(Gt);Kr=d(Ni,"__call__"),Ni.forEach(t),ea=d(lt," special method."),lt.forEach(t),oa=u(Ge),w(ze.$$.fragment,Ge),ta=u(Ge),w(Ce.$$.fragment,Ge),Ge.forEach(t),Re.forEach(t),$n=u(o),de=r(o,"H2",{class:!0});var qn=a(de);Ee=r(qn,"A",{id:!0,class:!0,href:!0});var $i=a(Ee);At=r($i,"SPAN",{});var Ji=a(At);w(Uo.$$.fragment,Ji),Ji.forEach(t),$i.forEach(t),na=u(qn),St=r(qn,"SPAN",{});var Ui=a(St);sa=d(Ui,"NystromformerForQuestionAnswering"),Ui.forEach(t),qn.forEach(t),Jn=u(o),W=r(o,"DIV",{class:!0});var Ae=a(W);w(jo.$$.fragment,Ae),ra=u(Ae),ce=r(Ae,"P",{});var dt=a(ce);aa=d(dt,`Nystr\xF6mformer Model with a span classification head on top for extractive question-answering tasks like SQuAD (a
linear layers on top of the hidden-states output to compute `),Qt=r(dt,"CODE",{});var ji=a(Qt);ia=d(ji,"span start logits"),ji.forEach(t),la=d(dt," and "),Lt=r(dt,"CODE",{});var Fi=a(Lt);da=d(Fi,"span end logits"),Fi.forEach(t),ca=d(dt,")."),dt.forEach(t),ma=u(Ae),Fo=r(Ae,"P",{});var Vn=a(Fo);pa=d(Vn,"This model is a PyTorch "),zo=r(Vn,"A",{href:!0,rel:!0});var zi=a(zo);ha=d(zi,"torch.nn.Module"),zi.forEach(t),fa=d(Vn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Vn.forEach(t),ua=u(Ae),q=r(Ae,"DIV",{class:!0});var Se=a(q);w(Co.$$.fragment,Se),ga=u(Se),me=r(Se,"P",{});var ct=a(me);ya=d(ct,"The "),Oo=r(ct,"A",{href:!0});var Ci=a(Oo);_a=d(Ci,"NystromformerForQuestionAnswering"),Ci.forEach(t),ba=d(ct," forward method, overrides the "),Yt=r(ct,"CODE",{});var Ei=a(Yt);Ma=d(Ei,"__call__"),Ei.forEach(t),wa=d(ct," special method."),ct.forEach(t),Ta=u(Se),w(We.$$.fragment,Se),va=u(Se),w(Ze.$$.fragment,Se),Se.forEach(t),Ae.forEach(t),this.h()},h(){p(i,"name","hf:doc:metadata"),p(i,"content",JSON.stringify(el)),p(m,"id","nystrmformer"),p(m,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(m,"href","#nystrmformer"),p(h,"class","relative group"),p(pe,"id","overview"),p(pe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(pe,"href","#overview"),p(L,"class","relative group"),p(He,"href","https://arxiv.org/abs/2102.03902"),p(He,"rel","nofollow"),p(Oe,"href","https://huggingface.co/novice03"),p(Oe,"rel","nofollow"),p(De,"href","https://github.com/mlpen/Nystromformer"),p(De,"rel","nofollow"),p(fe,"id","documentation-resources"),p(fe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(fe,"href","#documentation-resources"),p(Y,"class","relative group"),p(Xo,"href","../tasks/sequence_classification"),p(Bo,"href","../tasks/token_classification"),p(qo,"href","../tasks/question_answering"),p(Vo,"href","../tasks/masked_language_modeling"),p(Ro,"href","../tasks/multiple_choice"),p(ue,"id","transformers.NystromformerConfig"),p(ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ue,"href","#transformers.NystromformerConfig"),p(P,"class","relative group"),p(Go,"href","/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerModel"),p(to,"href","https://huggingface.co/uw-madison/nystromformer-512"),p(to,"rel","nofollow"),p(Ao,"href","/docs/transformers/v4.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(So,"href","/docs/transformers/v4.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ye,"id","transformers.NystromformerModel"),p(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ye,"href","#transformers.NystromformerModel"),p(D,"class","relative group"),p(ao,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(ao,"rel","nofollow"),p(Qo,"href","/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerModel"),p(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Me,"id","transformers.NystromformerForMaskedLM"),p(Me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Me,"href","#transformers.NystromformerForMaskedLM"),p(ee,"class","relative group"),p(mo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(mo,"rel","nofollow"),p(Lo,"href","/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerForMaskedLM"),p(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ve,"id","transformers.NystromformerForSequenceClassification"),p(ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ve,"href","#transformers.NystromformerForSequenceClassification"),p(ne,"class","relative group"),p(go,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(go,"rel","nofollow"),p(Yo,"href","/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerForSequenceClassification"),p(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Je,"id","transformers.NystromformerForMultipleChoice"),p(Je,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Je,"href","#transformers.NystromformerForMultipleChoice"),p(re,"class","relative group"),p(wo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(wo,"rel","nofollow"),p(Po,"href","/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerForMultipleChoice"),p(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Fe,"id","transformers.NystromformerForTokenClassification"),p(Fe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Fe,"href","#transformers.NystromformerForTokenClassification"),p(ie,"class","relative group"),p($o,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p($o,"rel","nofollow"),p(Ho,"href","/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerForTokenClassification"),p(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ee,"id","transformers.NystromformerForQuestionAnswering"),p(Ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Ee,"href","#transformers.NystromformerForQuestionAnswering"),p(de,"class","relative group"),p(zo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(zo,"rel","nofollow"),p(Oo,"href","/docs/transformers/v4.33.0/en/model_doc/nystromformer#transformers.NystromformerForQuestionAnswering"),p(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(W,"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,g){e(document.head,i),_(o,b,g),_(o,h,g),e(h,m),e(m,y),T(n,y,null),e(h,c),e(h,J),e(J,Rn),_(o,an,g),_(o,L,g),e(L,pe),e(pe,pt),T(Pe,pt,null),e(L,Gn),e(L,ht),e(ht,An),_(o,ln,g),_(o,he,g),e(he,Sn),e(he,He),e(He,ft),e(ft,Qn),e(he,Ln),_(o,dn,g),_(o,Io,g),e(Io,Yn),_(o,cn,g),_(o,xo,g),e(xo,ut),e(ut,Pn),_(o,mn,g),_(o,G,g),e(G,Hn),e(G,Oe),e(Oe,On),e(G,Dn),e(G,De),e(De,Kn),e(G,es),_(o,pn,g),_(o,Y,g),e(Y,fe),e(fe,gt),T(Ke,gt,null),e(Y,os),e(Y,yt),e(yt,ts),_(o,hn,g),_(o,U,g),e(U,_t),e(_t,Xo),e(Xo,ns),e(U,ss),e(U,bt),e(bt,Bo),e(Bo,rs),e(U,as),e(U,Mt),e(Mt,qo),e(qo,is),e(U,ls),e(U,wt),e(wt,Vo),e(Vo,ds),e(U,cs),e(U,Tt),e(Tt,Ro),e(Ro,ms),_(o,fn,g),_(o,P,g),e(P,ue),e(ue,vt),T(eo,vt,null),e(P,ps),e(P,kt),e(kt,hs),_(o,un,g),_(o,F,g),T(oo,F,null),e(F,fs),e(F,H),e(H,us),e(H,Go),e(Go,gs),e(H,ys),e(H,to),e(to,_s),e(H,bs),e(F,Ms),e(F,O),e(O,ws),e(O,Ao),e(Ao,Ts),e(O,vs),e(O,So),e(So,ks),e(O,Ns),e(F,$s),T(ge,F,null),_(o,gn,g),_(o,D,g),e(D,ye),e(ye,Nt),T(no,Nt,null),e(D,Js),e(D,$t),e($t,Us),_(o,yn,g),_(o,V,g),T(so,V,null),e(V,js),e(V,ro),e(ro,Fs),e(ro,ao),e(ao,zs),e(ro,Cs),e(V,Es),e(V,I),T(io,I,null),e(I,Ws),e(I,K),e(K,Zs),e(K,Qo),e(Qo,Is),e(K,xs),e(K,Jt),e(Jt,Xs),e(K,Bs),e(I,qs),T(_e,I,null),e(I,Vs),T(be,I,null),_(o,_n,g),_(o,ee,g),e(ee,Me),e(Me,Ut),T(lo,Ut,null),e(ee,Rs),e(ee,jt),e(jt,Gs),_(o,bn,g),_(o,R,g),T(co,R,null),e(R,As),e(R,oe),e(oe,Ss),e(oe,Ft),e(Ft,Qs),e(oe,Ls),e(oe,mo),e(mo,Ys),e(oe,Ps),e(R,Hs),e(R,x),T(po,x,null),e(x,Os),e(x,te),e(te,Ds),e(te,Lo),e(Lo,Ks),e(te,er),e(te,zt),e(zt,or),e(te,tr),e(x,nr),T(we,x,null),e(x,sr),T(Te,x,null),_(o,Mn,g),_(o,ne,g),e(ne,ve),e(ve,Ct),T(ho,Ct,null),e(ne,rr),e(ne,Et),e(Et,ar),_(o,wn,g),_(o,z,g),T(fo,z,null),e(z,ir),e(z,Wt),e(Wt,lr),e(z,dr),e(z,uo),e(uo,cr),e(uo,go),e(go,mr),e(uo,pr),e(z,hr),e(z,j),T(yo,j,null),e(j,fr),e(j,se),e(se,ur),e(se,Yo),e(Yo,gr),e(se,yr),e(se,Zt),e(Zt,_r),e(se,br),e(j,Mr),T(ke,j,null),e(j,wr),T(Ne,j,null),e(j,Tr),T($e,j,null),_(o,Tn,g),_(o,re,g),e(re,Je),e(Je,It),T(_o,It,null),e(re,vr),e(re,xt),e(xt,kr),_(o,vn,g),_(o,C,g),T(bo,C,null),e(C,Nr),e(C,Xt),e(Xt,$r),e(C,Jr),e(C,Mo),e(Mo,Ur),e(Mo,wo),e(wo,jr),e(Mo,Fr),e(C,zr),e(C,X),T(To,X,null),e(X,Cr),e(X,ae),e(ae,Er),e(ae,Po),e(Po,Wr),e(ae,Zr),e(ae,Bt),e(Bt,Ir),e(ae,xr),e(X,Xr),T(Ue,X,null),e(X,Br),T(je,X,null),_(o,kn,g),_(o,ie,g),e(ie,Fe),e(Fe,qt),T(vo,qt,null),e(ie,qr),e(ie,Vt),e(Vt,Vr),_(o,Nn,g),_(o,E,g),T(ko,E,null),e(E,Rr),e(E,Rt),e(Rt,Gr),e(E,Ar),e(E,No),e(No,Sr),e(No,$o),e($o,Qr),e(No,Lr),e(E,Yr),e(E,B),T(Jo,B,null),e(B,Pr),e(B,le),e(le,Hr),e(le,Ho),e(Ho,Or),e(le,Dr),e(le,Gt),e(Gt,Kr),e(le,ea),e(B,oa),T(ze,B,null),e(B,ta),T(Ce,B,null),_(o,$n,g),_(o,de,g),e(de,Ee),e(Ee,At),T(Uo,At,null),e(de,na),e(de,St),e(St,sa),_(o,Jn,g),_(o,W,g),T(jo,W,null),e(W,ra),e(W,ce),e(ce,aa),e(ce,Qt),e(Qt,ia),e(ce,la),e(ce,Lt),e(Lt,da),e(ce,ca),e(W,ma),e(W,Fo),e(Fo,pa),e(Fo,zo),e(zo,ha),e(Fo,fa),e(W,ua),e(W,q),T(Co,q,null),e(q,ga),e(q,me),e(me,ya),e(me,Oo),e(Oo,_a),e(me,ba),e(me,Yt),e(Yt,Ma),e(me,wa),e(q,Ta),T(We,q,null),e(q,va),T(Ze,q,null),Un=!0},p(o,[g]){const Eo={};g&2&&(Eo.$$scope={dirty:g,ctx:o}),ge.$set(Eo);const Pt={};g&2&&(Pt.$$scope={dirty:g,ctx:o}),_e.$set(Pt);const Ht={};g&2&&(Ht.$$scope={dirty:g,ctx:o}),be.$set(Ht);const Ot={};g&2&&(Ot.$$scope={dirty:g,ctx:o}),we.$set(Ot);const Wo={};g&2&&(Wo.$$scope={dirty:g,ctx:o}),Te.$set(Wo);const Dt={};g&2&&(Dt.$$scope={dirty:g,ctx:o}),ke.$set(Dt);const Kt={};g&2&&(Kt.$$scope={dirty:g,ctx:o}),Ne.$set(Kt);const en={};g&2&&(en.$$scope={dirty:g,ctx:o}),$e.$set(en);const Zo={};g&2&&(Zo.$$scope={dirty:g,ctx:o}),Ue.$set(Zo);const on={};g&2&&(on.$$scope={dirty:g,ctx:o}),je.$set(on);const tn={};g&2&&(tn.$$scope={dirty:g,ctx:o}),ze.$set(tn);const nn={};g&2&&(nn.$$scope={dirty:g,ctx:o}),Ce.$set(nn);const sn={};g&2&&(sn.$$scope={dirty:g,ctx:o}),We.$set(sn);const rn={};g&2&&(rn.$$scope={dirty:g,ctx:o}),Ze.$set(rn)},i(o){Un||(v(n.$$.fragment,o),v(Pe.$$.fragment,o),v(Ke.$$.fragment,o),v(eo.$$.fragment,o),v(oo.$$.fragment,o),v(ge.$$.fragment,o),v(no.$$.fragment,o),v(so.$$.fragment,o),v(io.$$.fragment,o),v(_e.$$.fragment,o),v(be.$$.fragment,o),v(lo.$$.fragment,o),v(co.$$.fragment,o),v(po.$$.fragment,o),v(we.$$.fragment,o),v(Te.$$.fragment,o),v(ho.$$.fragment,o),v(fo.$$.fragment,o),v(yo.$$.fragment,o),v(ke.$$.fragment,o),v(Ne.$$.fragment,o),v($e.$$.fragment,o),v(_o.$$.fragment,o),v(bo.$$.fragment,o),v(To.$$.fragment,o),v(Ue.$$.fragment,o),v(je.$$.fragment,o),v(vo.$$.fragment,o),v(ko.$$.fragment,o),v(Jo.$$.fragment,o),v(ze.$$.fragment,o),v(Ce.$$.fragment,o),v(Uo.$$.fragment,o),v(jo.$$.fragment,o),v(Co.$$.fragment,o),v(We.$$.fragment,o),v(Ze.$$.fragment,o),Un=!0)},o(o){k(n.$$.fragment,o),k(Pe.$$.fragment,o),k(Ke.$$.fragment,o),k(eo.$$.fragment,o),k(oo.$$.fragment,o),k(ge.$$.fragment,o),k(no.$$.fragment,o),k(so.$$.fragment,o),k(io.$$.fragment,o),k(_e.$$.fragment,o),k(be.$$.fragment,o),k(lo.$$.fragment,o),k(co.$$.fragment,o),k(po.$$.fragment,o),k(we.$$.fragment,o),k(Te.$$.fragment,o),k(ho.$$.fragment,o),k(fo.$$.fragment,o),k(yo.$$.fragment,o),k(ke.$$.fragment,o),k(Ne.$$.fragment,o),k($e.$$.fragment,o),k(_o.$$.fragment,o),k(bo.$$.fragment,o),k(To.$$.fragment,o),k(Ue.$$.fragment,o),k(je.$$.fragment,o),k(vo.$$.fragment,o),k(ko.$$.fragment,o),k(Jo.$$.fragment,o),k(ze.$$.fragment,o),k(Ce.$$.fragment,o),k(Uo.$$.fragment,o),k(jo.$$.fragment,o),k(Co.$$.fragment,o),k(We.$$.fragment,o),k(Ze.$$.fragment,o),Un=!1},d(o){t(i),o&&t(b),o&&t(h),N(n),o&&t(an),o&&t(L),N(Pe),o&&t(ln),o&&t(he),o&&t(dn),o&&t(Io),o&&t(cn),o&&t(xo),o&&t(mn),o&&t(G),o&&t(pn),o&&t(Y),N(Ke),o&&t(hn),o&&t(U),o&&t(fn),o&&t(P),N(eo),o&&t(un),o&&t(F),N(oo),N(ge),o&&t(gn),o&&t(D),N(no),o&&t(yn),o&&t(V),N(so),N(io),N(_e),N(be),o&&t(_n),o&&t(ee),N(lo),o&&t(bn),o&&t(R),N(co),N(po),N(we),N(Te),o&&t(Mn),o&&t(ne),N(ho),o&&t(wn),o&&t(z),N(fo),N(yo),N(ke),N(Ne),N($e),o&&t(Tn),o&&t(re),N(_o),o&&t(vn),o&&t(C),N(bo),N(To),N(Ue),N(je),o&&t(kn),o&&t(ie),N(vo),o&&t(Nn),o&&t(E),N(ko),N(Jo),N(ze),N(Ce),o&&t($n),o&&t(de),N(Uo),o&&t(Jn),o&&t(W),N(jo),N(Co),N(We),N(Ze)}}}const el={local:"nystrmformer",sections:[{local:"overview",title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.NystromformerConfig",title:"NystromformerConfig"},{local:"transformers.NystromformerModel",title:"NystromformerModel"},{local:"transformers.NystromformerForMaskedLM",title:"NystromformerForMaskedLM"},{local:"transformers.NystromformerForSequenceClassification",title:"NystromformerForSequenceClassification"},{local:"transformers.NystromformerForMultipleChoice",title:"NystromformerForMultipleChoice"},{local:"transformers.NystromformerForTokenClassification",title:"NystromformerForTokenClassification"},{local:"transformers.NystromformerForQuestionAnswering",title:"NystromformerForQuestionAnswering"}],title:"Nystr\xF6mformer"};function ol($){return Xi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ll extends Wi{constructor(i){super();Zi(this,i,ol,Ki,Ii,{})}}export{ll as default,el as metadata};
