import{S as ll,i as dl,s as cl,e as n,k as f,w as M,t as i,M as pl,c as a,d as t,m as g,a as r,x as w,h as l,b as h,N as hl,G as e,g as _,y as T,q as v,o as k,B as $,v as ml,L as He}from"../../chunks/vendor-hf-doc-builder.js";import{T as Mt}from"../../chunks/Tip-hf-doc-builder.js";import{D as F}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Pe}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Q}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Le}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ul(j){let d,b,m,p,y;return p=new Pe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFlvc29Db25maWclMkMlMjBZb3NvTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwWU9TTyUyMHV3LW1hZGlzb24lMkZ5b3NvLTQwOTYlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwWW9zb0NvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjB1dy1tYWRpc29uJTJGeW9zby00MDk2JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBZb3NvTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> YosoConfig, YosoModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a YOSO uw-madison/yoso-4096 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = YosoConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the uw-madison/yoso-4096 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = YosoModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){d=n("p"),b=i("Example:"),m=f(),M(p.$$.fragment)},l(s){d=a(s,"P",{});var c=r(d);b=l(c,"Example:"),c.forEach(t),m=g(s),w(p.$$.fragment,s)},m(s,c){_(s,d,c),e(d,b),_(s,m,c),T(p,s,c),y=!0},p:He,i(s){y||(v(p.$$.fragment,s),y=!0)},o(s){k(p.$$.fragment,s),y=!1},d(s){s&&t(d),s&&t(m),$(p,s)}}}function fl(j){let d,b,m,p,y;return{c(){d=n("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),m=n("code"),p=i("Module"),y=i(`
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(s){d=a(s,"P",{});var c=r(d);b=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),m=a(c,"CODE",{});var Y=r(m);p=l(Y,"Module"),Y.forEach(t),y=l(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(s,c){_(s,d,c),e(d,b),e(d,m),e(m,p),e(d,y)},d(s){s&&t(d)}}}function gl(j){let d,b,m,p,y;return p=new Pe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBZb3NvTW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZ5b3NvLTQwOTYlMjIpJTBBbW9kZWwlMjAlM0QlMjBZb3NvTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZ5b3NvLTQwOTYlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, YosoModel
<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/yoso-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = YosoModel.from_pretrained(<span class="hljs-string">&quot;uw-madison/yoso-4096&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;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(){d=n("p"),b=i("Example:"),m=f(),M(p.$$.fragment)},l(s){d=a(s,"P",{});var c=r(d);b=l(c,"Example:"),c.forEach(t),m=g(s),w(p.$$.fragment,s)},m(s,c){_(s,d,c),e(d,b),_(s,m,c),T(p,s,c),y=!0},p:He,i(s){y||(v(p.$$.fragment,s),y=!0)},o(s){k(p.$$.fragment,s),y=!1},d(s){s&&t(d),s&&t(m),$(p,s)}}}function _l(j){let d,b,m,p,y;return{c(){d=n("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),m=n("code"),p=i("Module"),y=i(`
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(s){d=a(s,"P",{});var c=r(d);b=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),m=a(c,"CODE",{});var Y=r(m);p=l(Y,"Module"),Y.forEach(t),y=l(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(s,c){_(s,d,c),e(d,b),e(d,m),e(m,p),e(d,y)},d(s){s&&t(d)}}}function yl(j){let d,b,m,p,y;return p=new Pe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBZb3NvRm9yTWFza2VkTE0lMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZ5b3NvLTQwOTYlMjIpJTBBbW9kZWwlMjAlM0QlMjBZb3NvRm9yTWFza2VkTE0uZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZ5b3NvLTQwOTYlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMlRoZSUyMGNhcGl0YWwlMjBvZiUyMEZyYW5jZSUyMGlzJTIwJTVCTUFTSyU1RC4lMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBJTIzJTIwcmV0cmlldmUlMjBpbmRleCUyMG9mJTIwJTVCTUFTSyU1RCUwQW1hc2tfdG9rZW5faW5kZXglMjAlM0QlMjAoaW5wdXRzLmlucHV0X2lkcyUyMCUzRCUzRCUyMHRva2VuaXplci5tYXNrX3Rva2VuX2lkKSU1QjAlNUQubm9uemVybyhhc190dXBsZSUzRFRydWUpJTVCMCU1RCUwQSUwQXByZWRpY3RlZF90b2tlbl9pZCUyMCUzRCUyMGxvZ2l0cyU1QjAlMkMlMjBtYXNrX3Rva2VuX2luZGV4JTVELmFyZ21heChheGlzJTNELTEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9rZW5pemVyKCUyMlRoZSUyMGNhcGl0YWwlMjBvZiUyMEZyYW5jZSUyMGlzJTIwUGFyaXMuJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEElMjMlMjBtYXNrJTIwbGFiZWxzJTIwb2YlMjBub24tJTVCTUFTSyU1RCUyMHRva2VucyUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLndoZXJlKGlucHV0cy5pbnB1dF9pZHMlMjAlM0QlM0QlMjB0b2tlbml6ZXIubWFza190b2tlbl9pZCUyQyUyMGxhYmVscyUyQyUyMC0xMDApJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, YosoForMaskedLM
<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/yoso-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = YosoForMaskedLM.from_pretrained(<span class="hljs-string">&quot;uw-madison/yoso-4096&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(){d=n("p"),b=i("Example:"),m=f(),M(p.$$.fragment)},l(s){d=a(s,"P",{});var c=r(d);b=l(c,"Example:"),c.forEach(t),m=g(s),w(p.$$.fragment,s)},m(s,c){_(s,d,c),e(d,b),_(s,m,c),T(p,s,c),y=!0},p:He,i(s){y||(v(p.$$.fragment,s),y=!0)},o(s){k(p.$$.fragment,s),y=!1},d(s){s&&t(d),s&&t(m),$(p,s)}}}function bl(j){let d,b,m,p,y;return{c(){d=n("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),m=n("code"),p=i("Module"),y=i(`
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(s){d=a(s,"P",{});var c=r(d);b=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),m=a(c,"CODE",{});var Y=r(m);p=l(Y,"Module"),Y.forEach(t),y=l(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(s,c){_(s,d,c),e(d,b),e(d,m),e(m,p),e(d,y)},d(s){s&&t(d)}}}function Ml(j){let d,b,m,p,y;return p=new Pe({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMFlvc29Gb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIydXctbWFkaXNvbiUyRnlvc28tNDA5NiUyMiklMEFtb2RlbCUyMCUzRCUyMFlvc29Gb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJ1dy1tYWRpc29uJTJGeW9zby00MDk2JTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZCUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoKS5pdGVtKCklMEElMEElMjMlMjBUbyUyMHRyYWluJTIwYSUyMG1vZGVsJTIwb24lMjAlNjBudW1fbGFiZWxzJTYwJTIwY2xhc3NlcyUyQyUyMHlvdSUyMGNhbiUyMHBhc3MlMjAlNjBudW1fbGFiZWxzJTNEbnVtX2xhYmVscyU2MCUyMHRvJTIwJTYwLmZyb21fcHJldHJhaW5lZCguLi4pJTYwJTBBbnVtX2xhYmVscyUyMCUzRCUyMGxlbihtb2RlbC5jb25maWcuaWQybGFiZWwpJTBBbW9kZWwlMjAlM0QlMjBZb3NvRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIydXctbWFkaXNvbiUyRnlvc28tNDA5NiUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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, YosoForSequenceClassification

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;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 = YosoForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;uw-madison/yoso-4096&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(){d=n("p"),b=i("Example of single-label classification:"),m=f(),M(p.$$.fragment)},l(s){d=a(s,"P",{});var c=r(d);b=l(c,"Example of single-label classification:"),c.forEach(t),m=g(s),w(p.$$.fragment,s)},m(s,c){_(s,d,c),e(d,b),_(s,m,c),T(p,s,c),y=!0},p:He,i(s){y||(v(p.$$.fragment,s),y=!0)},o(s){k(p.$$.fragment,s),y=!1},d(s){s&&t(d),s&&t(m),$(p,s)}}}function wl(j){let d,b,m,p,y;return p=new Pe({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMFlvc29Gb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIydXctbWFkaXNvbiUyRnlvc28tNDA5NiUyMiklMEFtb2RlbCUyMCUzRCUyMFlvc29Gb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJ1dy1tYWRpc29uJTJGeW9zby00MDk2JTIyJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkcyUyMCUzRCUyMHRvcmNoLmFyYW5nZSgwJTJDJTIwbG9naXRzLnNoYXBlJTVCLTElNUQpJTVCdG9yY2guc2lnbW9pZChsb2dpdHMpLnNxdWVlemUoZGltJTNEMCklMjAlM0UlMjAwLjUlNUQlMEElMEElMjMlMjBUbyUyMHRyYWluJTIwYSUyMG1vZGVsJTIwb24lMjAlNjBudW1fbGFiZWxzJTYwJTIwY2xhc3NlcyUyQyUyMHlvdSUyMGNhbiUyMHBhc3MlMjAlNjBudW1fbGFiZWxzJTNEbnVtX2xhYmVscyU2MCUyMHRvJTIwJTYwLmZyb21fcHJldHJhaW5lZCguLi4pJTYwJTBBbnVtX2xhYmVscyUyMCUzRCUyMGxlbihtb2RlbC5jb25maWcuaWQybGFiZWwpJTBBbW9kZWwlMjAlM0QlMjBZb3NvRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIydXctbWFkaXNvbiUyRnlvc28tNDA5NiUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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, YosoForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;uw-madison/yoso-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = YosoForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;uw-madison/yoso-4096&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 = YosoForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;uw-madison/yoso-4096&quot;</span>, num_labels=num_labels, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.<span class="hljs-built_in">sum</span>(
<span class="hljs-meta">... </span>    torch.nn.functional.one_hot(predicted_class_ids[<span class="hljs-literal">None</span>, :].clone(), num_classes=num_labels), dim=<span class="hljs-number">1</span>
<span class="hljs-meta">... </span>).to(torch.<span class="hljs-built_in">float</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=n("p"),b=i("Example of multi-label classification:"),m=f(),M(p.$$.fragment)},l(s){d=a(s,"P",{});var c=r(d);b=l(c,"Example of multi-label classification:"),c.forEach(t),m=g(s),w(p.$$.fragment,s)},m(s,c){_(s,d,c),e(d,b),_(s,m,c),T(p,s,c),y=!0},p:He,i(s){y||(v(p.$$.fragment,s),y=!0)},o(s){k(p.$$.fragment,s),y=!1},d(s){s&&t(d),s&&t(m),$(p,s)}}}function Tl(j){let d,b,m,p,y;return{c(){d=n("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),m=n("code"),p=i("Module"),y=i(`
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(s){d=a(s,"P",{});var c=r(d);b=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),m=a(c,"CODE",{});var Y=r(m);p=l(Y,"Module"),Y.forEach(t),y=l(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(s,c){_(s,d,c),e(d,b),e(d,m),e(m,p),e(d,y)},d(s){s&&t(d)}}}function vl(j){let d,b,m,p,y;return p=new Pe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBZb3NvRm9yTXVsdGlwbGVDaG9pY2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZ5b3NvLTQwOTYlMjIpJTBBbW9kZWwlMjAlM0QlMjBZb3NvRm9yTXVsdGlwbGVDaG9pY2UuZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZ5b3NvLTQwOTYlMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIySW4lMjBJdGFseSUyQyUyMHBpenphJTIwc2VydmVkJTIwaW4lMjBmb3JtYWwlMjBzZXR0aW5ncyUyQyUyMHN1Y2glMjBhcyUyMGF0JTIwYSUyMHJlc3RhdXJhbnQlMkMlMjBpcyUyMHByZXNlbnRlZCUyMHVuc2xpY2VkLiUyMiUwQWNob2ljZTAlMjAlM0QlMjAlMjJJdCUyMGlzJTIwZWF0ZW4lMjB3aXRoJTIwYSUyMGZvcmslMjBhbmQlMjBhJTIwa25pZmUuJTIyJTBBY2hvaWNlMSUyMCUzRCUyMCUyMkl0JTIwaXMlMjBlYXRlbiUyMHdoaWxlJTIwaGVsZCUyMGluJTIwdGhlJTIwaGFuZC4lMjIlMEFsYWJlbHMlMjAlM0QlMjB0b3JjaC50ZW5zb3IoMCkudW5zcXVlZXplKDApJTIwJTIwJTIzJTIwY2hvaWNlMCUyMGlzJTIwY29ycmVjdCUyMChhY2NvcmRpbmclMjB0byUyMFdpa2lwZWRpYSUyMCUzQikpJTJDJTIwYmF0Y2glMjBzaXplJTIwMSUwQSUwQWVuY29kaW5nJTIwJTNEJTIwdG9rZW5pemVyKCU1QnByb21wdCUyQyUyMHByb21wdCU1RCUyQyUyMCU1QmNob2ljZTAlMkMlMjBjaG9pY2UxJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUyQyUyMHBhZGRpbmclM0RUcnVlKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKiU3QmslM0ElMjB2LnVuc3F1ZWV6ZSgwKSUyMGZvciUyMGslMkMlMjB2JTIwaW4lMjBlbmNvZGluZy5pdGVtcygpJTdEJTJDJTIwbGFiZWxzJTNEbGFiZWxzKSUyMCUyMCUyMyUyMGJhdGNoJTIwc2l6ZSUyMGlzJTIwMSUwQSUwQSUyMyUyMHRoZSUyMGxpbmVhciUyMGNsYXNzaWZpZXIlMjBzdGlsbCUyMG5lZWRzJTIwdG8lMjBiZSUyMHRyYWluZWQlMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, YosoForMultipleChoice
<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/yoso-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = YosoForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;uw-madison/yoso-4096&quot;</span>)

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># the linear classifier still needs to be trained</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){d=n("p"),b=i("Example:"),m=f(),M(p.$$.fragment)},l(s){d=a(s,"P",{});var c=r(d);b=l(c,"Example:"),c.forEach(t),m=g(s),w(p.$$.fragment,s)},m(s,c){_(s,d,c),e(d,b),_(s,m,c),T(p,s,c),y=!0},p:He,i(s){y||(v(p.$$.fragment,s),y=!0)},o(s){k(p.$$.fragment,s),y=!1},d(s){s&&t(d),s&&t(m),$(p,s)}}}function kl(j){let d,b,m,p,y;return{c(){d=n("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),m=n("code"),p=i("Module"),y=i(`
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(s){d=a(s,"P",{});var c=r(d);b=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),m=a(c,"CODE",{});var Y=r(m);p=l(Y,"Module"),Y.forEach(t),y=l(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(s,c){_(s,d,c),e(d,b),e(d,m),e(m,p),e(d,y)},d(s){s&&t(d)}}}function $l(j){let d,b,m,p,y;return p=new Pe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBZb3NvRm9yVG9rZW5DbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIydXctbWFkaXNvbiUyRnlvc28tNDA5NiUyMiklMEFtb2RlbCUyMCUzRCUyMFlvc29Gb3JUb2tlbkNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJ1dy1tYWRpc29uJTJGeW9zby00MDk2JTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjAlMjJIdWdnaW5nRmFjZSUyMGlzJTIwYSUyMGNvbXBhbnklMjBiYXNlZCUyMGluJTIwUGFyaXMlMjBhbmQlMjBOZXclMjBZb3JrJTIyJTJDJTIwYWRkX3NwZWNpYWxfdG9rZW5zJTNERmFsc2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoLTEpJTBBJTBBJTIzJTIwTm90ZSUyMHRoYXQlMjB0b2tlbnMlMjBhcmUlMjBjbGFzc2lmaWVkJTIwcmF0aGVyJTIwdGhlbiUyMGlucHV0JTIwd29yZHMlMjB3aGljaCUyMG1lYW5zJTIwdGhhdCUwQSUyMyUyMHRoZXJlJTIwbWlnaHQlMjBiZSUyMG1vcmUlMjBwcmVkaWN0ZWQlMjB0b2tlbiUyMGNsYXNzZXMlMjB0aGFuJTIwd29yZHMuJTBBJTIzJTIwTXVsdGlwbGUlMjB0b2tlbiUyMGNsYXNzZXMlMjBtaWdodCUyMGFjY291bnQlMjBmb3IlMjB0aGUlMjBzYW1lJTIwd29yZCUwQXByZWRpY3RlZF90b2tlbnNfY2xhc3NlcyUyMCUzRCUyMCU1Qm1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnQuaXRlbSgpJTVEJTIwZm9yJTIwdCUyMGluJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyU1QjAlNUQlNUQlMEElMEFsYWJlbHMlMjAlM0QlMjBwcmVkaWN0ZWRfdG9rZW5fY2xhc3NfaWRzJTBBbG9zcyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKS5sb3Nz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, YosoForTokenClassification
<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/yoso-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = YosoForTokenClassification.from_pretrained(<span class="hljs-string">&quot;uw-madison/yoso-4096&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;HuggingFace is a company based in Paris and New York&quot;</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;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(){d=n("p"),b=i("Example:"),m=f(),M(p.$$.fragment)},l(s){d=a(s,"P",{});var c=r(d);b=l(c,"Example:"),c.forEach(t),m=g(s),w(p.$$.fragment,s)},m(s,c){_(s,d,c),e(d,b),_(s,m,c),T(p,s,c),y=!0},p:He,i(s){y||(v(p.$$.fragment,s),y=!0)},o(s){k(p.$$.fragment,s),y=!1},d(s){s&&t(d),s&&t(m),$(p,s)}}}function jl(j){let d,b,m,p,y;return{c(){d=n("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),m=n("code"),p=i("Module"),y=i(`
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(s){d=a(s,"P",{});var c=r(d);b=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),m=a(c,"CODE",{});var Y=r(m);p=l(Y,"Module"),Y.forEach(t),y=l(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(s,c){_(s,d,c),e(d,b),e(d,m),e(m,p),e(d,y)},d(s){s&&t(d)}}}function Yl(j){let d,b,m,p,y;return p=new Pe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBZb3NvRm9yUXVlc3Rpb25BbnN3ZXJpbmclMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZ5b3NvLTQwOTYlMjIpJTBBbW9kZWwlMjAlM0QlMjBZb3NvRm9yUXVlc3Rpb25BbnN3ZXJpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMnV3LW1hZGlzb24lMkZ5b3NvLTQwOTYlMjIpJTBBJTBBcXVlc3Rpb24lMkMlMjB0ZXh0JTIwJTNEJTIwJTIyV2hvJTIwd2FzJTIwSmltJTIwSGVuc29uJTNGJTIyJTJDJTIwJTIySmltJTIwSGVuc29uJTIwd2FzJTIwYSUyMG5pY2UlMjBwdXBwZXQlMjIlMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocXVlc3Rpb24lMkMlMjB0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWFuc3dlcl9zdGFydF9pbmRleCUyMCUzRCUyMG91dHB1dHMuc3RhcnRfbG9naXRzLmFyZ21heCgpJTBBYW5zd2VyX2VuZF9pbmRleCUyMCUzRCUyMG91dHB1dHMuZW5kX2xvZ2l0cy5hcmdtYXgoKSUwQSUwQXByZWRpY3RfYW5zd2VyX3Rva2VucyUyMCUzRCUyMGlucHV0cy5pbnB1dF9pZHMlNUIwJTJDJTIwYW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNBJTIwYW5zd2VyX2VuZF9pbmRleCUyMCUyQiUyMDElNUQlMEElMEElMjMlMjB0YXJnZXQlMjBpcyUyMCUyMm5pY2UlMjBwdXBwZXQlMjIlMEF0YXJnZXRfc3RhcnRfaW5kZXglMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCMTQlNUQpJTBBdGFyZ2V0X2VuZF9pbmRleCUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxNSU1RCklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjBzdGFydF9wb3NpdGlvbnMlM0R0YXJnZXRfc3RhcnRfaW5kZXglMkMlMjBlbmRfcG9zaXRpb25zJTNEdGFyZ2V0X2VuZF9pbmRleCklMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3Nz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, YosoForQuestionAnswering
<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/yoso-4096&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = YosoForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;uw-madison/yoso-4096&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(){d=n("p"),b=i("Example:"),m=f(),M(p.$$.fragment)},l(s){d=a(s,"P",{});var c=r(d);b=l(c,"Example:"),c.forEach(t),m=g(s),w(p.$$.fragment,s)},m(s,c){_(s,d,c),e(d,b),_(s,m,c),T(p,s,c),y=!0},p:He,i(s){y||(v(p.$$.fragment,s),y=!0)},o(s){k(p.$$.fragment,s),y=!1},d(s){s&&t(d),s&&t(m),$(p,s)}}}function Jl(j){let d,b,m,p,y,s,c,Y,on,gs,L,ge,wt,De,tn,Tt,sn,_s,H,nn,Ke,an,rn,ln,ys,Bo,dn,bs,Zo,vt,cn,Ms,No,pn,ws,R,kt,hn,mn,P,un,$t,fn,gn,jt,_n,yn,bn,D,Mn,Yt,wn,Tn,Jt,vn,kn,Ts,_e,Qr,vs,ye,$n,So,jn,Yn,ks,V,Jn,eo,Un,Cn,oo,Fn,zn,$s,K,be,Ut,to,En,Ct,Wn,js,J,Ft,qo,xn,In,zt,Go,Bn,Zn,Et,Ao,Nn,Sn,Wt,Ro,qn,Gn,xt,Vo,An,Ys,ee,Me,It,so,Rn,Bt,Vn,Js,C,no,Xn,oe,On,Xo,Qn,Ln,ao,Hn,Pn,Dn,te,Kn,Oo,ea,oa,Qo,ta,sa,na,we,Us,se,Te,Zt,ro,aa,Nt,ra,Cs,B,io,ia,lo,la,co,da,ca,pa,z,po,ha,ne,ma,Lo,ua,fa,St,ga,_a,ya,ve,ba,ke,Fs,ae,$e,qt,ho,Ma,Gt,wa,zs,Z,mo,Ta,re,va,At,ka,$a,uo,ja,Ya,Ja,E,fo,Ua,ie,Ca,Ho,Fa,za,Rt,Ea,Wa,xa,je,Ia,Ye,Es,le,Je,Vt,go,Ba,Xt,Za,Ws,N,_o,Na,yo,Sa,bo,qa,Ga,Aa,U,Mo,Ra,de,Va,Po,Xa,Oa,Ot,Qa,La,Ha,Ue,Pa,Ce,Da,Fe,xs,ce,ze,Qt,wo,Ka,Lt,er,Is,S,To,or,vo,tr,ko,sr,nr,ar,W,$o,rr,pe,ir,Do,lr,dr,Ht,cr,pr,hr,Ee,mr,We,Bs,he,xe,Pt,jo,ur,Dt,fr,Zs,q,Yo,gr,Jo,_r,Uo,yr,br,Mr,x,Co,wr,me,Tr,Ko,vr,kr,Kt,$r,jr,Yr,Ie,Jr,Be,Ns,ue,Ze,es,Fo,Ur,os,Cr,Ss,G,zo,Fr,A,zr,ts,Er,Wr,ss,xr,Ir,Eo,Br,Zr,Nr,I,Wo,Sr,fe,qr,et,Gr,Ar,ns,Rr,Vr,Xr,Ne,Or,Se,qs;return s=new Q({}),De=new Q({}),to=new Q({}),so=new Q({}),no=new F({props:{name:"class transformers.YosoConfig",anchor:"transformers.YosoConfig",parameters:[{name:"vocab_size",val:" = 50265"},{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'"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"max_position_embeddings",val:" = 4096"},{name:"type_vocab_size",val:" = 1"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"position_embedding_type",val:" = 'absolute'"},{name:"use_expectation",val:" = True"},{name:"hash_code_len",val:" = 9"},{name:"num_hash",val:" = 64"},{name:"conv_window",val:" = None"},{name:"use_fast_hash",val:" = True"},{name:"lsh_backward",val:" = True"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.YosoConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50265) &#x2014;
Vocabulary size of the YOSO 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.30.0/en/model_doc/yoso#transformers.YosoModel">YosoModel</a>.`,name:"vocab_size"},{anchor:"transformers.YosoConfig.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.YosoConfig.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.YosoConfig.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.YosoConfig.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.YosoConfig.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.YosoConfig.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.YosoConfig.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.YosoConfig.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.YosoConfig.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.30.0/en/model_doc/yoso#transformers.YosoModel">YosoModel</a>.`,name:"type_vocab_size"},{anchor:"transformers.YosoConfig.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.YosoConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.YosoConfig.position_embedding_type",description:`<strong>position_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;absolute&quot;</code>) &#x2014;
Type of position embedding. Choose one of <code>&quot;absolute&quot;</code>, <code>&quot;relative_key&quot;</code>, <code>&quot;relative_key_query&quot;</code>.`,name:"position_embedding_type"},{anchor:"transformers.YosoConfig.use_expectation",description:`<strong>use_expectation</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to use YOSO Expectation. Overrides any effect of num_hash.`,name:"use_expectation"},{anchor:"transformers.YosoConfig.hash_code_len",description:`<strong>hash_code_len</strong> (<code>int</code>, <em>optional</em>, defaults to 9) &#x2014;
The length of hashes generated by the hash functions.`,name:"hash_code_len"},{anchor:"transformers.YosoConfig.num_hash",description:`<strong>num_hash</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Number of hash functions used in <code>YosoSelfAttention</code>.`,name:"num_hash"},{anchor:"transformers.YosoConfig.conv_window",description:`<strong>conv_window</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Kernel size of depth-wise convolution.`,name:"conv_window"},{anchor:"transformers.YosoConfig.use_fast_hash",description:`<strong>use_fast_hash</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use custom cuda kernels which perform fast random projection via hadamard transform.`,name:"use_fast_hash"},{anchor:"transformers.YosoConfig.lsh_backward",description:`<strong>lsh_backward</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to perform backpropagation using Locality Sensitive Hashing.`,name:"lsh_backward"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/yoso/configuration_yoso.py#L29"}}),we=new Le({props:{anchor:"transformers.YosoConfig.example",$$slots:{default:[ul]},$$scope:{ctx:j}}}),ro=new Q({}),io=new F({props:{name:"class transformers.YosoModel",anchor:"transformers.YosoModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.YosoModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoConfig">YosoConfig</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.30.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.30.0/src/transformers/models/yoso/modeling_yoso.py#L740"}}),po=new F({props:{name:"forward",anchor:"transformers.YosoModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.YosoModel.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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.YosoModel.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.YosoModel.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.YosoModel.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.YosoModel.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.YosoModel.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.YosoModel.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.YosoModel.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.YosoModel.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.30.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.30.0/src/transformers/models/yoso/modeling_yoso.py#L765",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithCrossAttentions</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.30.0/en/model_doc/yoso#transformers.YosoConfig"
>YosoConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>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.30.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ve=new Mt({props:{$$slots:{default:[fl]},$$scope:{ctx:j}}}),ke=new Le({props:{anchor:"transformers.YosoModel.forward.example",$$slots:{default:[gl]},$$scope:{ctx:j}}}),ho=new Q({}),mo=new F({props:{name:"class transformers.YosoForMaskedLM",anchor:"transformers.YosoForMaskedLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.YosoForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoConfig">YosoConfig</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.30.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.30.0/src/transformers/models/yoso/modeling_yoso.py#L851"}}),fo=new F({props:{name:"forward",anchor:"transformers.YosoForMaskedLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.YosoForMaskedLM.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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.YosoForMaskedLM.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.YosoForMaskedLM.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.YosoForMaskedLM.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.YosoForMaskedLM.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.YosoForMaskedLM.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.YosoForMaskedLM.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.YosoForMaskedLM.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.YosoForMaskedLM.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.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.YosoForMaskedLM.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.30.0/src/transformers/models/yoso/modeling_yoso.py#L873",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.0/en/model_doc/yoso#transformers.YosoConfig"
>YosoConfig</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.30.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),je=new Mt({props:{$$slots:{default:[_l]},$$scope:{ctx:j}}}),Ye=new Le({props:{anchor:"transformers.YosoForMaskedLM.forward.example",$$slots:{default:[yl]},$$scope:{ctx:j}}}),go=new Q({}),_o=new F({props:{name:"class transformers.YosoForSequenceClassification",anchor:"transformers.YosoForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.YosoForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoConfig">YosoConfig</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.30.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.30.0/src/transformers/models/yoso/modeling_yoso.py#L958"}}),Mo=new F({props:{name:"forward",anchor:"transformers.YosoForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.YosoForSequenceClassification.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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.YosoForSequenceClassification.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.YosoForSequenceClassification.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.YosoForSequenceClassification.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.YosoForSequenceClassification.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.YosoForSequenceClassification.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.YosoForSequenceClassification.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.YosoForSequenceClassification.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.YosoForSequenceClassification.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.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.YosoForSequenceClassification.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.30.0/src/transformers/models/yoso/modeling_yoso.py#L968",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.0/en/model_doc/yoso#transformers.YosoConfig"
>YosoConfig</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.30.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ue=new Mt({props:{$$slots:{default:[bl]},$$scope:{ctx:j}}}),Ce=new Le({props:{anchor:"transformers.YosoForSequenceClassification.forward.example",$$slots:{default:[Ml]},$$scope:{ctx:j}}}),Fe=new Le({props:{anchor:"transformers.YosoForSequenceClassification.forward.example-2",$$slots:{default:[wl]},$$scope:{ctx:j}}}),wo=new Q({}),To=new F({props:{name:"class transformers.YosoForMultipleChoice",anchor:"transformers.YosoForMultipleChoice",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.YosoForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoConfig">YosoConfig</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.30.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.30.0/src/transformers/models/yoso/modeling_yoso.py#L1049"}}),$o=new F({props:{name:"forward",anchor:"transformers.YosoForMultipleChoice.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.YosoForMultipleChoice.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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.YosoForMultipleChoice.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.YosoForMultipleChoice.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.YosoForMultipleChoice.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.YosoForMultipleChoice.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.YosoForMultipleChoice.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.YosoForMultipleChoice.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.YosoForMultipleChoice.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.YosoForMultipleChoice.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.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.YosoForMultipleChoice.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.30.0/src/transformers/models/yoso/modeling_yoso.py#L1060",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.0/en/model_doc/yoso#transformers.YosoConfig"
>YosoConfig</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.30.0/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput"
>transformers.modeling_outputs.MultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ee=new Mt({props:{$$slots:{default:[Tl]},$$scope:{ctx:j}}}),We=new Le({props:{anchor:"transformers.YosoForMultipleChoice.forward.example",$$slots:{default:[vl]},$$scope:{ctx:j}}}),jo=new Q({}),Yo=new F({props:{name:"class transformers.YosoForTokenClassification",anchor:"transformers.YosoForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.YosoForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoConfig">YosoConfig</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.30.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.30.0/src/transformers/models/yoso/modeling_yoso.py#L1140"}}),Co=new F({props:{name:"forward",anchor:"transformers.YosoForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.YosoForTokenClassification.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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.YosoForTokenClassification.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.YosoForTokenClassification.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.YosoForTokenClassification.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.YosoForTokenClassification.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.YosoForTokenClassification.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.YosoForTokenClassification.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.YosoForTokenClassification.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.YosoForTokenClassification.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.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.YosoForTokenClassification.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.30.0/src/transformers/models/yoso/modeling_yoso.py#L1152",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.0/en/model_doc/yoso#transformers.YosoConfig"
>YosoConfig</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.30.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ie=new Mt({props:{$$slots:{default:[kl]},$$scope:{ctx:j}}}),Be=new Le({props:{anchor:"transformers.YosoForTokenClassification.forward.example",$$slots:{default:[$l]},$$scope:{ctx:j}}}),Fo=new Q({}),zo=new F({props:{name:"class transformers.YosoForQuestionAnswering",anchor:"transformers.YosoForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.YosoForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoConfig">YosoConfig</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.30.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.30.0/src/transformers/models/yoso/modeling_yoso.py#L1225"}}),Wo=new F({props:{name:"forward",anchor:"transformers.YosoForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"start_positions",val:": typing.Optional[torch.Tensor] = None"},{name:"end_positions",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.YosoForQuestionAnswering.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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.YosoForQuestionAnswering.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.YosoForQuestionAnswering.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.YosoForQuestionAnswering.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.YosoForQuestionAnswering.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.YosoForQuestionAnswering.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.YosoForQuestionAnswering.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.YosoForQuestionAnswering.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.YosoForQuestionAnswering.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.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.YosoForQuestionAnswering.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.YosoForQuestionAnswering.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.30.0/src/transformers/models/yoso/modeling_yoso.py#L1238",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.0/en/model_doc/yoso#transformers.YosoConfig"
>YosoConfig</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.30.0/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ne=new Mt({props:{$$slots:{default:[jl]},$$scope:{ctx:j}}}),Se=new Le({props:{anchor:"transformers.YosoForQuestionAnswering.forward.example",$$slots:{default:[Yl]},$$scope:{ctx:j}}}),{c(){d=n("meta"),b=f(),m=n("h1"),p=n("a"),y=n("span"),M(s.$$.fragment),c=f(),Y=n("span"),on=i("YOSO"),gs=f(),L=n("h2"),ge=n("a"),wt=n("span"),M(De.$$.fragment),tn=f(),Tt=n("span"),sn=i("Overview"),_s=f(),H=n("p"),nn=i("The YOSO model was proposed in "),Ke=n("a"),an=i("You Only Sample (Almost) Once: Linear Cost Self-Attention Via Bernoulli Sampling"),rn=n("br"),ln=i(`
by Zhanpeng Zeng, Yunyang Xiong, Sathya N. Ravi, Shailesh Acharya, Glenn Fung, Vikas Singh. YOSO approximates standard softmax self-attention
via a Bernoulli sampling scheme based on Locality Sensitive Hashing (LSH). In principle, all the Bernoulli random variables can be sampled with
a single hash.`),ys=f(),Bo=n("p"),dn=i("The abstract from the paper is the following:"),bs=f(),Zo=n("p"),vt=n("em"),cn=i(`Transformer-based models are widely used in natural language processing (NLP). Central to the transformer model is
the self-attention mechanism, which captures the interactions of token pairs in the input sequences and depends quadratically
on the sequence length. Training such models on longer sequences is expensive. In this paper, we show that a Bernoulli sampling
attention mechanism based on Locality Sensitive Hashing (LSH), decreases the quadratic complexity of such models to linear.
We bypass the quadratic cost by considering self-attention as a sum of individual tokens associated with Bernoulli random
variables that can, in principle, be sampled at once by a single hash (although in practice, this number may be a small constant).
This leads to an efficient sampling scheme to estimate self-attention which relies on specific modifications of
LSH (to enable deployment on GPU architectures). We evaluate our algorithm on the GLUE benchmark with standard 512 sequence
length where we see favorable performance relative to a standard pretrained Transformer. On the Long Range Arena (LRA) benchmark,
for evaluating performance on long sequences, our method achieves results consistent with softmax self-attention but with sizable
speed-ups and memory savings and often outperforms other efficient self-attention methods. Our code is available at this https URL`),Ms=f(),No=n("p"),pn=i("Tips:"),ws=f(),R=n("ul"),kt=n("li"),hn=i(`The YOSO attention algorithm is implemented through custom CUDA kernels, functions written in CUDA C++ that can be executed multiple times
in parallel on a GPU.`),mn=f(),P=n("li"),un=i("The kernels provide a "),$t=n("code"),fn=i("fast_hash"),gn=i(` function, which approximates the random projections of the queries and keys using the Fast Hadamard Transform. Using these
hash codes, the `),jt=n("code"),_n=i("lsh_cumulation"),yn=i(" function approximates self-attention via LSH-based Bernoulli sampling."),bn=f(),D=n("li"),Mn=i("To use the custom kernels, the user should set "),Yt=n("code"),wn=i("config.use_expectation = False"),Tn=i(`. To ensure that the kernels are compiled successfully,
the user must install the correct version of PyTorch and cudatoolkit. By default, `),Jt=n("code"),vn=i("config.use_expectation = True"),kn=i(`, which uses YOSO-E and
does not require compiling CUDA kernels.`),Ts=f(),_e=n("img"),vs=f(),ye=n("small"),$n=i("YOSO Attention Algorithm. Taken from the "),So=n("a"),jn=i("original paper"),Yn=i("."),ks=f(),V=n("p"),Jn=i("This model was contributed by "),eo=n("a"),Un=i("novice03"),Cn=i(". The original code can be found "),oo=n("a"),Fn=i("here"),zn=i("."),$s=f(),K=n("h2"),be=n("a"),Ut=n("span"),M(to.$$.fragment),En=f(),Ct=n("span"),Wn=i("Documentation resources"),js=f(),J=n("ul"),Ft=n("li"),qo=n("a"),xn=i("Text classification task guide"),In=f(),zt=n("li"),Go=n("a"),Bn=i("Token classification task guide"),Zn=f(),Et=n("li"),Ao=n("a"),Nn=i("Question answering task guide"),Sn=f(),Wt=n("li"),Ro=n("a"),qn=i("Masked language modeling task guide"),Gn=f(),xt=n("li"),Vo=n("a"),An=i("Multiple choice task guide"),Ys=f(),ee=n("h2"),Me=n("a"),It=n("span"),M(so.$$.fragment),Rn=f(),Bt=n("span"),Vn=i("YosoConfig"),Js=f(),C=n("div"),M(no.$$.fragment),Xn=f(),oe=n("p"),On=i("This is the configuration class to store the configuration of a "),Xo=n("a"),Qn=i("YosoModel"),Ln=i(`. It is used to instantiate an YOSO
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 YOSO
`),ao=n("a"),Hn=i("uw-madison/yoso-4096"),Pn=i(" architecture."),Dn=f(),te=n("p"),Kn=i("Configuration objects inherit from "),Oo=n("a"),ea=i("PretrainedConfig"),oa=i(` and can be used to control the model outputs. Read the
documentation from `),Qo=n("a"),ta=i("PretrainedConfig"),sa=i(" for more information."),na=f(),M(we.$$.fragment),Us=f(),se=n("h2"),Te=n("a"),Zt=n("span"),M(ro.$$.fragment),aa=f(),Nt=n("span"),ra=i("YosoModel"),Cs=f(),B=n("div"),M(io.$$.fragment),ia=f(),lo=n("p"),la=i(`The bare YOSO Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),co=n("a"),da=i("torch.nn.Module"),ca=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),pa=f(),z=n("div"),M(po.$$.fragment),ha=f(),ne=n("p"),ma=i("The "),Lo=n("a"),ua=i("YosoModel"),fa=i(" forward method, overrides the "),St=n("code"),ga=i("__call__"),_a=i(" special method."),ya=f(),M(ve.$$.fragment),ba=f(),M(ke.$$.fragment),Fs=f(),ae=n("h2"),$e=n("a"),qt=n("span"),M(ho.$$.fragment),Ma=f(),Gt=n("span"),wa=i("YosoForMaskedLM"),zs=f(),Z=n("div"),M(mo.$$.fragment),Ta=f(),re=n("p"),va=i("YOSO Model with a "),At=n("code"),ka=i("language modeling"),$a=i(` head on top.
This model is a PyTorch `),uo=n("a"),ja=i("torch.nn.Module"),Ya=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ja=f(),E=n("div"),M(fo.$$.fragment),Ua=f(),ie=n("p"),Ca=i("The "),Ho=n("a"),Fa=i("YosoForMaskedLM"),za=i(" forward method, overrides the "),Rt=n("code"),Ea=i("__call__"),Wa=i(" special method."),xa=f(),M(je.$$.fragment),Ia=f(),M(Ye.$$.fragment),Es=f(),le=n("h2"),Je=n("a"),Vt=n("span"),M(go.$$.fragment),Ba=f(),Xt=n("span"),Za=i("YosoForSequenceClassification"),Ws=f(),N=n("div"),M(_o.$$.fragment),Na=f(),yo=n("p"),Sa=i(`YOSO Model transformer with a sequence classification/regression head on top (a linear layer on top of
the pooled output) e.g. for GLUE tasks.
This model is a PyTorch `),bo=n("a"),qa=i("torch.nn.Module"),Ga=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Aa=f(),U=n("div"),M(Mo.$$.fragment),Ra=f(),de=n("p"),Va=i("The "),Po=n("a"),Xa=i("YosoForSequenceClassification"),Oa=i(" forward method, overrides the "),Ot=n("code"),Qa=i("__call__"),La=i(" special method."),Ha=f(),M(Ue.$$.fragment),Pa=f(),M(Ce.$$.fragment),Da=f(),M(Fe.$$.fragment),xs=f(),ce=n("h2"),ze=n("a"),Qt=n("span"),M(wo.$$.fragment),Ka=f(),Lt=n("span"),er=i("YosoForMultipleChoice"),Is=f(),S=n("div"),M(To.$$.fragment),or=f(),vo=n("p"),tr=i(`YOSO 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.
This model is a PyTorch `),ko=n("a"),sr=i("torch.nn.Module"),nr=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ar=f(),W=n("div"),M($o.$$.fragment),rr=f(),pe=n("p"),ir=i("The "),Do=n("a"),lr=i("YosoForMultipleChoice"),dr=i(" forward method, overrides the "),Ht=n("code"),cr=i("__call__"),pr=i(" special method."),hr=f(),M(Ee.$$.fragment),mr=f(),M(We.$$.fragment),Bs=f(),he=n("h2"),xe=n("a"),Pt=n("span"),M(jo.$$.fragment),ur=f(),Dt=n("span"),fr=i("YosoForTokenClassification"),Zs=f(),q=n("div"),M(Yo.$$.fragment),gr=f(),Jo=n("p"),_r=i(`YOSO 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.
This model is a PyTorch `),Uo=n("a"),yr=i("torch.nn.Module"),br=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Mr=f(),x=n("div"),M(Co.$$.fragment),wr=f(),me=n("p"),Tr=i("The "),Ko=n("a"),vr=i("YosoForTokenClassification"),kr=i(" forward method, overrides the "),Kt=n("code"),$r=i("__call__"),jr=i(" special method."),Yr=f(),M(Ie.$$.fragment),Jr=f(),M(Be.$$.fragment),Ns=f(),ue=n("h2"),Ze=n("a"),es=n("span"),M(Fo.$$.fragment),Ur=f(),os=n("span"),Cr=i("YosoForQuestionAnswering"),Ss=f(),G=n("div"),M(zo.$$.fragment),Fr=f(),A=n("p"),zr=i(`YOSO 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 `),ts=n("code"),Er=i("span start logits"),Wr=i(" and "),ss=n("code"),xr=i("span end logits"),Ir=i(`).
This model is a PyTorch `),Eo=n("a"),Br=i("torch.nn.Module"),Zr=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Nr=f(),I=n("div"),M(Wo.$$.fragment),Sr=f(),fe=n("p"),qr=i("The "),et=n("a"),Gr=i("YosoForQuestionAnswering"),Ar=i(" forward method, overrides the "),ns=n("code"),Rr=i("__call__"),Vr=i(" special method."),Xr=f(),M(Ne.$$.fragment),Or=f(),M(Se.$$.fragment),this.h()},l(o){const u=pl('[data-svelte="svelte-1phssyn"]',document.head);d=a(u,"META",{name:!0,content:!0}),u.forEach(t),b=g(o),m=a(o,"H1",{class:!0});var xo=r(m);p=a(xo,"A",{id:!0,class:!0,href:!0});var as=r(p);y=a(as,"SPAN",{});var rs=r(y);w(s.$$.fragment,rs),rs.forEach(t),as.forEach(t),c=g(xo),Y=a(xo,"SPAN",{});var is=r(Y);on=l(is,"YOSO"),is.forEach(t),xo.forEach(t),gs=g(o),L=a(o,"H2",{class:!0});var Io=r(L);ge=a(Io,"A",{id:!0,class:!0,href:!0});var ls=r(ge);wt=a(ls,"SPAN",{});var ds=r(wt);w(De.$$.fragment,ds),ds.forEach(t),ls.forEach(t),tn=g(Io),Tt=a(Io,"SPAN",{});var cs=r(Tt);sn=l(cs,"Overview"),cs.forEach(t),Io.forEach(t),_s=g(o),H=a(o,"P",{});var qe=r(H);nn=l(qe,"The YOSO model was proposed in "),Ke=a(qe,"A",{href:!0,rel:!0});var ps=r(Ke);an=l(ps,"You Only Sample (Almost) Once: Linear Cost Self-Attention Via Bernoulli Sampling"),ps.forEach(t),rn=a(qe,"BR",{}),ln=l(qe,`
by Zhanpeng Zeng, Yunyang Xiong, Sathya N. Ravi, Shailesh Acharya, Glenn Fung, Vikas Singh. YOSO approximates standard softmax self-attention
via a Bernoulli sampling scheme based on Locality Sensitive Hashing (LSH). In principle, all the Bernoulli random variables can be sampled with
a single hash.`),qe.forEach(t),ys=g(o),Bo=a(o,"P",{});var hs=r(Bo);dn=l(hs,"The abstract from the paper is the following:"),hs.forEach(t),bs=g(o),Zo=a(o,"P",{});var ms=r(Zo);vt=a(ms,"EM",{});var us=r(vt);cn=l(us,`Transformer-based models are widely used in natural language processing (NLP). Central to the transformer model is
the self-attention mechanism, which captures the interactions of token pairs in the input sequences and depends quadratically
on the sequence length. Training such models on longer sequences is expensive. In this paper, we show that a Bernoulli sampling
attention mechanism based on Locality Sensitive Hashing (LSH), decreases the quadratic complexity of such models to linear.
We bypass the quadratic cost by considering self-attention as a sum of individual tokens associated with Bernoulli random
variables that can, in principle, be sampled at once by a single hash (although in practice, this number may be a small constant).
This leads to an efficient sampling scheme to estimate self-attention which relies on specific modifications of
LSH (to enable deployment on GPU architectures). We evaluate our algorithm on the GLUE benchmark with standard 512 sequence
length where we see favorable performance relative to a standard pretrained Transformer. On the Long Range Arena (LRA) benchmark,
for evaluating performance on long sequences, our method achieves results consistent with softmax self-attention but with sizable
speed-ups and memory savings and often outperforms other efficient self-attention methods. Our code is available at this https URL`),us.forEach(t),ms.forEach(t),Ms=g(o),No=a(o,"P",{});var fs=r(No);pn=l(fs,"Tips:"),fs.forEach(t),ws=g(o),R=a(o,"UL",{});var ot=r(R);kt=a(ot,"LI",{});var Lr=r(kt);hn=l(Lr,`The YOSO attention algorithm is implemented through custom CUDA kernels, functions written in CUDA C++ that can be executed multiple times
in parallel on a GPU.`),Lr.forEach(t),mn=g(ot),P=a(ot,"LI",{});var tt=r(P);un=l(tt,"The kernels provide a "),$t=a(tt,"CODE",{});var Hr=r($t);fn=l(Hr,"fast_hash"),Hr.forEach(t),gn=l(tt,` function, which approximates the random projections of the queries and keys using the Fast Hadamard Transform. Using these
hash codes, the `),jt=a(tt,"CODE",{});var Pr=r(jt);_n=l(Pr,"lsh_cumulation"),Pr.forEach(t),yn=l(tt," function approximates self-attention via LSH-based Bernoulli sampling."),tt.forEach(t),bn=g(ot),D=a(ot,"LI",{});var st=r(D);Mn=l(st,"To use the custom kernels, the user should set "),Yt=a(st,"CODE",{});var Dr=r(Yt);wn=l(Dr,"config.use_expectation = False"),Dr.forEach(t),Tn=l(st,`. To ensure that the kernels are compiled successfully,
the user must install the correct version of PyTorch and cudatoolkit. By default, `),Jt=a(st,"CODE",{});var Kr=r(Jt);vn=l(Kr,"config.use_expectation = True"),Kr.forEach(t),kn=l(st,`, which uses YOSO-E and
does not require compiling CUDA kernels.`),st.forEach(t),ot.forEach(t),Ts=g(o),_e=a(o,"IMG",{src:!0,alt:!0,width:!0}),vs=g(o),ye=a(o,"SMALL",{});var Gs=r(ye);$n=l(Gs,"YOSO Attention Algorithm. Taken from the "),So=a(Gs,"A",{href:!0});var ei=r(So);jn=l(ei,"original paper"),ei.forEach(t),Yn=l(Gs,"."),Gs.forEach(t),ks=g(o),V=a(o,"P",{});var nt=r(V);Jn=l(nt,"This model was contributed by "),eo=a(nt,"A",{href:!0,rel:!0});var oi=r(eo);Un=l(oi,"novice03"),oi.forEach(t),Cn=l(nt,". The original code can be found "),oo=a(nt,"A",{href:!0,rel:!0});var ti=r(oo);Fn=l(ti,"here"),ti.forEach(t),zn=l(nt,"."),nt.forEach(t),$s=g(o),K=a(o,"H2",{class:!0});var As=r(K);be=a(As,"A",{id:!0,class:!0,href:!0});var si=r(be);Ut=a(si,"SPAN",{});var ni=r(Ut);w(to.$$.fragment,ni),ni.forEach(t),si.forEach(t),En=g(As),Ct=a(As,"SPAN",{});var ai=r(Ct);Wn=l(ai,"Documentation resources"),ai.forEach(t),As.forEach(t),js=g(o),J=a(o,"UL",{});var X=r(J);Ft=a(X,"LI",{});var ri=r(Ft);qo=a(ri,"A",{href:!0});var ii=r(qo);xn=l(ii,"Text classification task guide"),ii.forEach(t),ri.forEach(t),In=g(X),zt=a(X,"LI",{});var li=r(zt);Go=a(li,"A",{href:!0});var di=r(Go);Bn=l(di,"Token classification task guide"),di.forEach(t),li.forEach(t),Zn=g(X),Et=a(X,"LI",{});var ci=r(Et);Ao=a(ci,"A",{href:!0});var pi=r(Ao);Nn=l(pi,"Question answering task guide"),pi.forEach(t),ci.forEach(t),Sn=g(X),Wt=a(X,"LI",{});var hi=r(Wt);Ro=a(hi,"A",{href:!0});var mi=r(Ro);qn=l(mi,"Masked language modeling task guide"),mi.forEach(t),hi.forEach(t),Gn=g(X),xt=a(X,"LI",{});var ui=r(xt);Vo=a(ui,"A",{href:!0});var fi=r(Vo);An=l(fi,"Multiple choice task guide"),fi.forEach(t),ui.forEach(t),X.forEach(t),Ys=g(o),ee=a(o,"H2",{class:!0});var Rs=r(ee);Me=a(Rs,"A",{id:!0,class:!0,href:!0});var gi=r(Me);It=a(gi,"SPAN",{});var _i=r(It);w(so.$$.fragment,_i),_i.forEach(t),gi.forEach(t),Rn=g(Rs),Bt=a(Rs,"SPAN",{});var yi=r(Bt);Vn=l(yi,"YosoConfig"),yi.forEach(t),Rs.forEach(t),Js=g(o),C=a(o,"DIV",{class:!0});var Ge=r(C);w(no.$$.fragment,Ge),Xn=g(Ge),oe=a(Ge,"P",{});var at=r(oe);On=l(at,"This is the configuration class to store the configuration of a "),Xo=a(at,"A",{href:!0});var bi=r(Xo);Qn=l(bi,"YosoModel"),bi.forEach(t),Ln=l(at,`. It is used to instantiate an YOSO
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 YOSO
`),ao=a(at,"A",{href:!0,rel:!0});var Mi=r(ao);Hn=l(Mi,"uw-madison/yoso-4096"),Mi.forEach(t),Pn=l(at," architecture."),at.forEach(t),Dn=g(Ge),te=a(Ge,"P",{});var rt=r(te);Kn=l(rt,"Configuration objects inherit from "),Oo=a(rt,"A",{href:!0});var wi=r(Oo);ea=l(wi,"PretrainedConfig"),wi.forEach(t),oa=l(rt,` and can be used to control the model outputs. Read the
documentation from `),Qo=a(rt,"A",{href:!0});var Ti=r(Qo);ta=l(Ti,"PretrainedConfig"),Ti.forEach(t),sa=l(rt," for more information."),rt.forEach(t),na=g(Ge),w(we.$$.fragment,Ge),Ge.forEach(t),Us=g(o),se=a(o,"H2",{class:!0});var Vs=r(se);Te=a(Vs,"A",{id:!0,class:!0,href:!0});var vi=r(Te);Zt=a(vi,"SPAN",{});var ki=r(Zt);w(ro.$$.fragment,ki),ki.forEach(t),vi.forEach(t),aa=g(Vs),Nt=a(Vs,"SPAN",{});var $i=r(Nt);ra=l($i,"YosoModel"),$i.forEach(t),Vs.forEach(t),Cs=g(o),B=a(o,"DIV",{class:!0});var it=r(B);w(io.$$.fragment,it),ia=g(it),lo=a(it,"P",{});var Xs=r(lo);la=l(Xs,`The bare YOSO Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),co=a(Xs,"A",{href:!0,rel:!0});var ji=r(co);da=l(ji,"torch.nn.Module"),ji.forEach(t),ca=l(Xs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Xs.forEach(t),pa=g(it),z=a(it,"DIV",{class:!0});var Ae=r(z);w(po.$$.fragment,Ae),ha=g(Ae),ne=a(Ae,"P",{});var lt=r(ne);ma=l(lt,"The "),Lo=a(lt,"A",{href:!0});var Yi=r(Lo);ua=l(Yi,"YosoModel"),Yi.forEach(t),fa=l(lt," forward method, overrides the "),St=a(lt,"CODE",{});var Ji=r(St);ga=l(Ji,"__call__"),Ji.forEach(t),_a=l(lt," special method."),lt.forEach(t),ya=g(Ae),w(ve.$$.fragment,Ae),ba=g(Ae),w(ke.$$.fragment,Ae),Ae.forEach(t),it.forEach(t),Fs=g(o),ae=a(o,"H2",{class:!0});var Os=r(ae);$e=a(Os,"A",{id:!0,class:!0,href:!0});var Ui=r($e);qt=a(Ui,"SPAN",{});var Ci=r(qt);w(ho.$$.fragment,Ci),Ci.forEach(t),Ui.forEach(t),Ma=g(Os),Gt=a(Os,"SPAN",{});var Fi=r(Gt);wa=l(Fi,"YosoForMaskedLM"),Fi.forEach(t),Os.forEach(t),zs=g(o),Z=a(o,"DIV",{class:!0});var dt=r(Z);w(mo.$$.fragment,dt),Ta=g(dt),re=a(dt,"P",{});var ct=r(re);va=l(ct,"YOSO Model with a "),At=a(ct,"CODE",{});var zi=r(At);ka=l(zi,"language modeling"),zi.forEach(t),$a=l(ct,` head on top.
This model is a PyTorch `),uo=a(ct,"A",{href:!0,rel:!0});var Ei=r(uo);ja=l(Ei,"torch.nn.Module"),Ei.forEach(t),Ya=l(ct,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ct.forEach(t),Ja=g(dt),E=a(dt,"DIV",{class:!0});var Re=r(E);w(fo.$$.fragment,Re),Ua=g(Re),ie=a(Re,"P",{});var pt=r(ie);Ca=l(pt,"The "),Ho=a(pt,"A",{href:!0});var Wi=r(Ho);Fa=l(Wi,"YosoForMaskedLM"),Wi.forEach(t),za=l(pt," forward method, overrides the "),Rt=a(pt,"CODE",{});var xi=r(Rt);Ea=l(xi,"__call__"),xi.forEach(t),Wa=l(pt," special method."),pt.forEach(t),xa=g(Re),w(je.$$.fragment,Re),Ia=g(Re),w(Ye.$$.fragment,Re),Re.forEach(t),dt.forEach(t),Es=g(o),le=a(o,"H2",{class:!0});var Qs=r(le);Je=a(Qs,"A",{id:!0,class:!0,href:!0});var Ii=r(Je);Vt=a(Ii,"SPAN",{});var Bi=r(Vt);w(go.$$.fragment,Bi),Bi.forEach(t),Ii.forEach(t),Ba=g(Qs),Xt=a(Qs,"SPAN",{});var Zi=r(Xt);Za=l(Zi,"YosoForSequenceClassification"),Zi.forEach(t),Qs.forEach(t),Ws=g(o),N=a(o,"DIV",{class:!0});var ht=r(N);w(_o.$$.fragment,ht),Na=g(ht),yo=a(ht,"P",{});var Ls=r(yo);Sa=l(Ls,`YOSO Model transformer with a sequence classification/regression head on top (a linear layer on top of
the pooled output) e.g. for GLUE tasks.
This model is a PyTorch `),bo=a(Ls,"A",{href:!0,rel:!0});var Ni=r(bo);qa=l(Ni,"torch.nn.Module"),Ni.forEach(t),Ga=l(Ls,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ls.forEach(t),Aa=g(ht),U=a(ht,"DIV",{class:!0});var O=r(U);w(Mo.$$.fragment,O),Ra=g(O),de=a(O,"P",{});var mt=r(de);Va=l(mt,"The "),Po=a(mt,"A",{href:!0});var Si=r(Po);Xa=l(Si,"YosoForSequenceClassification"),Si.forEach(t),Oa=l(mt," forward method, overrides the "),Ot=a(mt,"CODE",{});var qi=r(Ot);Qa=l(qi,"__call__"),qi.forEach(t),La=l(mt," special method."),mt.forEach(t),Ha=g(O),w(Ue.$$.fragment,O),Pa=g(O),w(Ce.$$.fragment,O),Da=g(O),w(Fe.$$.fragment,O),O.forEach(t),ht.forEach(t),xs=g(o),ce=a(o,"H2",{class:!0});var Hs=r(ce);ze=a(Hs,"A",{id:!0,class:!0,href:!0});var Gi=r(ze);Qt=a(Gi,"SPAN",{});var Ai=r(Qt);w(wo.$$.fragment,Ai),Ai.forEach(t),Gi.forEach(t),Ka=g(Hs),Lt=a(Hs,"SPAN",{});var Ri=r(Lt);er=l(Ri,"YosoForMultipleChoice"),Ri.forEach(t),Hs.forEach(t),Is=g(o),S=a(o,"DIV",{class:!0});var ut=r(S);w(To.$$.fragment,ut),or=g(ut),vo=a(ut,"P",{});var Ps=r(vo);tr=l(Ps,`YOSO 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.
This model is a PyTorch `),ko=a(Ps,"A",{href:!0,rel:!0});var Vi=r(ko);sr=l(Vi,"torch.nn.Module"),Vi.forEach(t),nr=l(Ps,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ps.forEach(t),ar=g(ut),W=a(ut,"DIV",{class:!0});var Ve=r(W);w($o.$$.fragment,Ve),rr=g(Ve),pe=a(Ve,"P",{});var ft=r(pe);ir=l(ft,"The "),Do=a(ft,"A",{href:!0});var Xi=r(Do);lr=l(Xi,"YosoForMultipleChoice"),Xi.forEach(t),dr=l(ft," forward method, overrides the "),Ht=a(ft,"CODE",{});var Oi=r(Ht);cr=l(Oi,"__call__"),Oi.forEach(t),pr=l(ft," special method."),ft.forEach(t),hr=g(Ve),w(Ee.$$.fragment,Ve),mr=g(Ve),w(We.$$.fragment,Ve),Ve.forEach(t),ut.forEach(t),Bs=g(o),he=a(o,"H2",{class:!0});var Ds=r(he);xe=a(Ds,"A",{id:!0,class:!0,href:!0});var Qi=r(xe);Pt=a(Qi,"SPAN",{});var Li=r(Pt);w(jo.$$.fragment,Li),Li.forEach(t),Qi.forEach(t),ur=g(Ds),Dt=a(Ds,"SPAN",{});var Hi=r(Dt);fr=l(Hi,"YosoForTokenClassification"),Hi.forEach(t),Ds.forEach(t),Zs=g(o),q=a(o,"DIV",{class:!0});var gt=r(q);w(Yo.$$.fragment,gt),gr=g(gt),Jo=a(gt,"P",{});var Ks=r(Jo);_r=l(Ks,`YOSO 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.
This model is a PyTorch `),Uo=a(Ks,"A",{href:!0,rel:!0});var Pi=r(Uo);yr=l(Pi,"torch.nn.Module"),Pi.forEach(t),br=l(Ks,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ks.forEach(t),Mr=g(gt),x=a(gt,"DIV",{class:!0});var Xe=r(x);w(Co.$$.fragment,Xe),wr=g(Xe),me=a(Xe,"P",{});var _t=r(me);Tr=l(_t,"The "),Ko=a(_t,"A",{href:!0});var Di=r(Ko);vr=l(Di,"YosoForTokenClassification"),Di.forEach(t),kr=l(_t," forward method, overrides the "),Kt=a(_t,"CODE",{});var Ki=r(Kt);$r=l(Ki,"__call__"),Ki.forEach(t),jr=l(_t," special method."),_t.forEach(t),Yr=g(Xe),w(Ie.$$.fragment,Xe),Jr=g(Xe),w(Be.$$.fragment,Xe),Xe.forEach(t),gt.forEach(t),Ns=g(o),ue=a(o,"H2",{class:!0});var en=r(ue);Ze=a(en,"A",{id:!0,class:!0,href:!0});var el=r(Ze);es=a(el,"SPAN",{});var ol=r(es);w(Fo.$$.fragment,ol),ol.forEach(t),el.forEach(t),Ur=g(en),os=a(en,"SPAN",{});var tl=r(os);Cr=l(tl,"YosoForQuestionAnswering"),tl.forEach(t),en.forEach(t),Ss=g(o),G=a(o,"DIV",{class:!0});var yt=r(G);w(zo.$$.fragment,yt),Fr=g(yt),A=a(yt,"P",{});var Oe=r(A);zr=l(Oe,`YOSO 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 `),ts=a(Oe,"CODE",{});var sl=r(ts);Er=l(sl,"span start logits"),sl.forEach(t),Wr=l(Oe," and "),ss=a(Oe,"CODE",{});var nl=r(ss);xr=l(nl,"span end logits"),nl.forEach(t),Ir=l(Oe,`).
This model is a PyTorch `),Eo=a(Oe,"A",{href:!0,rel:!0});var al=r(Eo);Br=l(al,"torch.nn.Module"),al.forEach(t),Zr=l(Oe,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Oe.forEach(t),Nr=g(yt),I=a(yt,"DIV",{class:!0});var Qe=r(I);w(Wo.$$.fragment,Qe),Sr=g(Qe),fe=a(Qe,"P",{});var bt=r(fe);qr=l(bt,"The "),et=a(bt,"A",{href:!0});var rl=r(et);Gr=l(rl,"YosoForQuestionAnswering"),rl.forEach(t),Ar=l(bt," forward method, overrides the "),ns=a(bt,"CODE",{});var il=r(ns);Rr=l(il,"__call__"),il.forEach(t),Vr=l(bt," special method."),bt.forEach(t),Xr=g(Qe),w(Ne.$$.fragment,Qe),Or=g(Qe),w(Se.$$.fragment,Qe),Qe.forEach(t),yt.forEach(t),this.h()},h(){h(d,"name","hf:doc:metadata"),h(d,"content",JSON.stringify(Ul)),h(p,"id","yoso"),h(p,"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"),h(p,"href","#yoso"),h(m,"class","relative group"),h(ge,"id","overview"),h(ge,"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"),h(ge,"href","#overview"),h(L,"class","relative group"),h(Ke,"href","https://arxiv.org/abs/2111.09714"),h(Ke,"rel","nofollow"),hl(_e.src,Qr="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/yoso_architecture.jpg")||h(_e,"src",Qr),h(_e,"alt","drawing"),h(_e,"width","600"),h(So,"href","https://arxiv.org/abs/2111.09714"),h(eo,"href","https://huggingface.co/novice03"),h(eo,"rel","nofollow"),h(oo,"href","https://github.com/mlpen/YOSO"),h(oo,"rel","nofollow"),h(be,"id","documentation-resources"),h(be,"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"),h(be,"href","#documentation-resources"),h(K,"class","relative group"),h(qo,"href","../tasks/sequence_classification"),h(Go,"href","../tasks/token_classification"),h(Ao,"href","../tasks/question_answering"),h(Ro,"href","../tasks/masked_language_modeling"),h(Vo,"href","../tasks/multiple_choice"),h(Me,"id","transformers.YosoConfig"),h(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"),h(Me,"href","#transformers.YosoConfig"),h(ee,"class","relative group"),h(Xo,"href","/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoModel"),h(ao,"href","https://huggingface.co/uw-madison/yoso-4096"),h(ao,"rel","nofollow"),h(Oo,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(Qo,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Te,"id","transformers.YosoModel"),h(Te,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Te,"href","#transformers.YosoModel"),h(se,"class","relative group"),h(co,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(co,"rel","nofollow"),h(Lo,"href","/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoModel"),h(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h($e,"id","transformers.YosoForMaskedLM"),h($e,"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"),h($e,"href","#transformers.YosoForMaskedLM"),h(ae,"class","relative group"),h(uo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(uo,"rel","nofollow"),h(Ho,"href","/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoForMaskedLM"),h(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Je,"id","transformers.YosoForSequenceClassification"),h(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"),h(Je,"href","#transformers.YosoForSequenceClassification"),h(le,"class","relative group"),h(bo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(bo,"rel","nofollow"),h(Po,"href","/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoForSequenceClassification"),h(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ze,"id","transformers.YosoForMultipleChoice"),h(ze,"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"),h(ze,"href","#transformers.YosoForMultipleChoice"),h(ce,"class","relative group"),h(ko,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(ko,"rel","nofollow"),h(Do,"href","/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoForMultipleChoice"),h(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(xe,"id","transformers.YosoForTokenClassification"),h(xe,"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"),h(xe,"href","#transformers.YosoForTokenClassification"),h(he,"class","relative group"),h(Uo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Uo,"rel","nofollow"),h(Ko,"href","/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoForTokenClassification"),h(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ze,"id","transformers.YosoForQuestionAnswering"),h(Ze,"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"),h(Ze,"href","#transformers.YosoForQuestionAnswering"),h(ue,"class","relative group"),h(Eo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Eo,"rel","nofollow"),h(et,"href","/docs/transformers/v4.30.0/en/model_doc/yoso#transformers.YosoForQuestionAnswering"),h(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(G,"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,u){e(document.head,d),_(o,b,u),_(o,m,u),e(m,p),e(p,y),T(s,y,null),e(m,c),e(m,Y),e(Y,on),_(o,gs,u),_(o,L,u),e(L,ge),e(ge,wt),T(De,wt,null),e(L,tn),e(L,Tt),e(Tt,sn),_(o,_s,u),_(o,H,u),e(H,nn),e(H,Ke),e(Ke,an),e(H,rn),e(H,ln),_(o,ys,u),_(o,Bo,u),e(Bo,dn),_(o,bs,u),_(o,Zo,u),e(Zo,vt),e(vt,cn),_(o,Ms,u),_(o,No,u),e(No,pn),_(o,ws,u),_(o,R,u),e(R,kt),e(kt,hn),e(R,mn),e(R,P),e(P,un),e(P,$t),e($t,fn),e(P,gn),e(P,jt),e(jt,_n),e(P,yn),e(R,bn),e(R,D),e(D,Mn),e(D,Yt),e(Yt,wn),e(D,Tn),e(D,Jt),e(Jt,vn),e(D,kn),_(o,Ts,u),_(o,_e,u),_(o,vs,u),_(o,ye,u),e(ye,$n),e(ye,So),e(So,jn),e(ye,Yn),_(o,ks,u),_(o,V,u),e(V,Jn),e(V,eo),e(eo,Un),e(V,Cn),e(V,oo),e(oo,Fn),e(V,zn),_(o,$s,u),_(o,K,u),e(K,be),e(be,Ut),T(to,Ut,null),e(K,En),e(K,Ct),e(Ct,Wn),_(o,js,u),_(o,J,u),e(J,Ft),e(Ft,qo),e(qo,xn),e(J,In),e(J,zt),e(zt,Go),e(Go,Bn),e(J,Zn),e(J,Et),e(Et,Ao),e(Ao,Nn),e(J,Sn),e(J,Wt),e(Wt,Ro),e(Ro,qn),e(J,Gn),e(J,xt),e(xt,Vo),e(Vo,An),_(o,Ys,u),_(o,ee,u),e(ee,Me),e(Me,It),T(so,It,null),e(ee,Rn),e(ee,Bt),e(Bt,Vn),_(o,Js,u),_(o,C,u),T(no,C,null),e(C,Xn),e(C,oe),e(oe,On),e(oe,Xo),e(Xo,Qn),e(oe,Ln),e(oe,ao),e(ao,Hn),e(oe,Pn),e(C,Dn),e(C,te),e(te,Kn),e(te,Oo),e(Oo,ea),e(te,oa),e(te,Qo),e(Qo,ta),e(te,sa),e(C,na),T(we,C,null),_(o,Us,u),_(o,se,u),e(se,Te),e(Te,Zt),T(ro,Zt,null),e(se,aa),e(se,Nt),e(Nt,ra),_(o,Cs,u),_(o,B,u),T(io,B,null),e(B,ia),e(B,lo),e(lo,la),e(lo,co),e(co,da),e(lo,ca),e(B,pa),e(B,z),T(po,z,null),e(z,ha),e(z,ne),e(ne,ma),e(ne,Lo),e(Lo,ua),e(ne,fa),e(ne,St),e(St,ga),e(ne,_a),e(z,ya),T(ve,z,null),e(z,ba),T(ke,z,null),_(o,Fs,u),_(o,ae,u),e(ae,$e),e($e,qt),T(ho,qt,null),e(ae,Ma),e(ae,Gt),e(Gt,wa),_(o,zs,u),_(o,Z,u),T(mo,Z,null),e(Z,Ta),e(Z,re),e(re,va),e(re,At),e(At,ka),e(re,$a),e(re,uo),e(uo,ja),e(re,Ya),e(Z,Ja),e(Z,E),T(fo,E,null),e(E,Ua),e(E,ie),e(ie,Ca),e(ie,Ho),e(Ho,Fa),e(ie,za),e(ie,Rt),e(Rt,Ea),e(ie,Wa),e(E,xa),T(je,E,null),e(E,Ia),T(Ye,E,null),_(o,Es,u),_(o,le,u),e(le,Je),e(Je,Vt),T(go,Vt,null),e(le,Ba),e(le,Xt),e(Xt,Za),_(o,Ws,u),_(o,N,u),T(_o,N,null),e(N,Na),e(N,yo),e(yo,Sa),e(yo,bo),e(bo,qa),e(yo,Ga),e(N,Aa),e(N,U),T(Mo,U,null),e(U,Ra),e(U,de),e(de,Va),e(de,Po),e(Po,Xa),e(de,Oa),e(de,Ot),e(Ot,Qa),e(de,La),e(U,Ha),T(Ue,U,null),e(U,Pa),T(Ce,U,null),e(U,Da),T(Fe,U,null),_(o,xs,u),_(o,ce,u),e(ce,ze),e(ze,Qt),T(wo,Qt,null),e(ce,Ka),e(ce,Lt),e(Lt,er),_(o,Is,u),_(o,S,u),T(To,S,null),e(S,or),e(S,vo),e(vo,tr),e(vo,ko),e(ko,sr),e(vo,nr),e(S,ar),e(S,W),T($o,W,null),e(W,rr),e(W,pe),e(pe,ir),e(pe,Do),e(Do,lr),e(pe,dr),e(pe,Ht),e(Ht,cr),e(pe,pr),e(W,hr),T(Ee,W,null),e(W,mr),T(We,W,null),_(o,Bs,u),_(o,he,u),e(he,xe),e(xe,Pt),T(jo,Pt,null),e(he,ur),e(he,Dt),e(Dt,fr),_(o,Zs,u),_(o,q,u),T(Yo,q,null),e(q,gr),e(q,Jo),e(Jo,_r),e(Jo,Uo),e(Uo,yr),e(Jo,br),e(q,Mr),e(q,x),T(Co,x,null),e(x,wr),e(x,me),e(me,Tr),e(me,Ko),e(Ko,vr),e(me,kr),e(me,Kt),e(Kt,$r),e(me,jr),e(x,Yr),T(Ie,x,null),e(x,Jr),T(Be,x,null),_(o,Ns,u),_(o,ue,u),e(ue,Ze),e(Ze,es),T(Fo,es,null),e(ue,Ur),e(ue,os),e(os,Cr),_(o,Ss,u),_(o,G,u),T(zo,G,null),e(G,Fr),e(G,A),e(A,zr),e(A,ts),e(ts,Er),e(A,Wr),e(A,ss),e(ss,xr),e(A,Ir),e(A,Eo),e(Eo,Br),e(A,Zr),e(G,Nr),e(G,I),T(Wo,I,null),e(I,Sr),e(I,fe),e(fe,qr),e(fe,et),e(et,Gr),e(fe,Ar),e(fe,ns),e(ns,Rr),e(fe,Vr),e(I,Xr),T(Ne,I,null),e(I,Or),T(Se,I,null),qs=!0},p(o,[u]){const xo={};u&2&&(xo.$$scope={dirty:u,ctx:o}),we.$set(xo);const as={};u&2&&(as.$$scope={dirty:u,ctx:o}),ve.$set(as);const rs={};u&2&&(rs.$$scope={dirty:u,ctx:o}),ke.$set(rs);const is={};u&2&&(is.$$scope={dirty:u,ctx:o}),je.$set(is);const Io={};u&2&&(Io.$$scope={dirty:u,ctx:o}),Ye.$set(Io);const ls={};u&2&&(ls.$$scope={dirty:u,ctx:o}),Ue.$set(ls);const ds={};u&2&&(ds.$$scope={dirty:u,ctx:o}),Ce.$set(ds);const cs={};u&2&&(cs.$$scope={dirty:u,ctx:o}),Fe.$set(cs);const qe={};u&2&&(qe.$$scope={dirty:u,ctx:o}),Ee.$set(qe);const ps={};u&2&&(ps.$$scope={dirty:u,ctx:o}),We.$set(ps);const hs={};u&2&&(hs.$$scope={dirty:u,ctx:o}),Ie.$set(hs);const ms={};u&2&&(ms.$$scope={dirty:u,ctx:o}),Be.$set(ms);const us={};u&2&&(us.$$scope={dirty:u,ctx:o}),Ne.$set(us);const fs={};u&2&&(fs.$$scope={dirty:u,ctx:o}),Se.$set(fs)},i(o){qs||(v(s.$$.fragment,o),v(De.$$.fragment,o),v(to.$$.fragment,o),v(so.$$.fragment,o),v(no.$$.fragment,o),v(we.$$.fragment,o),v(ro.$$.fragment,o),v(io.$$.fragment,o),v(po.$$.fragment,o),v(ve.$$.fragment,o),v(ke.$$.fragment,o),v(ho.$$.fragment,o),v(mo.$$.fragment,o),v(fo.$$.fragment,o),v(je.$$.fragment,o),v(Ye.$$.fragment,o),v(go.$$.fragment,o),v(_o.$$.fragment,o),v(Mo.$$.fragment,o),v(Ue.$$.fragment,o),v(Ce.$$.fragment,o),v(Fe.$$.fragment,o),v(wo.$$.fragment,o),v(To.$$.fragment,o),v($o.$$.fragment,o),v(Ee.$$.fragment,o),v(We.$$.fragment,o),v(jo.$$.fragment,o),v(Yo.$$.fragment,o),v(Co.$$.fragment,o),v(Ie.$$.fragment,o),v(Be.$$.fragment,o),v(Fo.$$.fragment,o),v(zo.$$.fragment,o),v(Wo.$$.fragment,o),v(Ne.$$.fragment,o),v(Se.$$.fragment,o),qs=!0)},o(o){k(s.$$.fragment,o),k(De.$$.fragment,o),k(to.$$.fragment,o),k(so.$$.fragment,o),k(no.$$.fragment,o),k(we.$$.fragment,o),k(ro.$$.fragment,o),k(io.$$.fragment,o),k(po.$$.fragment,o),k(ve.$$.fragment,o),k(ke.$$.fragment,o),k(ho.$$.fragment,o),k(mo.$$.fragment,o),k(fo.$$.fragment,o),k(je.$$.fragment,o),k(Ye.$$.fragment,o),k(go.$$.fragment,o),k(_o.$$.fragment,o),k(Mo.$$.fragment,o),k(Ue.$$.fragment,o),k(Ce.$$.fragment,o),k(Fe.$$.fragment,o),k(wo.$$.fragment,o),k(To.$$.fragment,o),k($o.$$.fragment,o),k(Ee.$$.fragment,o),k(We.$$.fragment,o),k(jo.$$.fragment,o),k(Yo.$$.fragment,o),k(Co.$$.fragment,o),k(Ie.$$.fragment,o),k(Be.$$.fragment,o),k(Fo.$$.fragment,o),k(zo.$$.fragment,o),k(Wo.$$.fragment,o),k(Ne.$$.fragment,o),k(Se.$$.fragment,o),qs=!1},d(o){t(d),o&&t(b),o&&t(m),$(s),o&&t(gs),o&&t(L),$(De),o&&t(_s),o&&t(H),o&&t(ys),o&&t(Bo),o&&t(bs),o&&t(Zo),o&&t(Ms),o&&t(No),o&&t(ws),o&&t(R),o&&t(Ts),o&&t(_e),o&&t(vs),o&&t(ye),o&&t(ks),o&&t(V),o&&t($s),o&&t(K),$(to),o&&t(js),o&&t(J),o&&t(Ys),o&&t(ee),$(so),o&&t(Js),o&&t(C),$(no),$(we),o&&t(Us),o&&t(se),$(ro),o&&t(Cs),o&&t(B),$(io),$(po),$(ve),$(ke),o&&t(Fs),o&&t(ae),$(ho),o&&t(zs),o&&t(Z),$(mo),$(fo),$(je),$(Ye),o&&t(Es),o&&t(le),$(go),o&&t(Ws),o&&t(N),$(_o),$(Mo),$(Ue),$(Ce),$(Fe),o&&t(xs),o&&t(ce),$(wo),o&&t(Is),o&&t(S),$(To),$($o),$(Ee),$(We),o&&t(Bs),o&&t(he),$(jo),o&&t(Zs),o&&t(q),$(Yo),$(Co),$(Ie),$(Be),o&&t(Ns),o&&t(ue),$(Fo),o&&t(Ss),o&&t(G),$(zo),$(Wo),$(Ne),$(Se)}}}const Ul={local:"yoso",sections:[{local:"overview",title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.YosoConfig",title:"YosoConfig"},{local:"transformers.YosoModel",title:"YosoModel"},{local:"transformers.YosoForMaskedLM",title:"YosoForMaskedLM"},{local:"transformers.YosoForSequenceClassification",title:"YosoForSequenceClassification"},{local:"transformers.YosoForMultipleChoice",title:"YosoForMultipleChoice"},{local:"transformers.YosoForTokenClassification",title:"YosoForTokenClassification"},{local:"transformers.YosoForQuestionAnswering",title:"YosoForQuestionAnswering"}],title:"YOSO"};function Cl(j){return ml(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Bl extends ll{constructor(d){super();dl(this,d,Cl,Jl,cl,{})}}export{Bl as default,Ul as metadata};
