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 Pe}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 He}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 He({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:Pe,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 He({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:Pe,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 He({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:Pe,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 He({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:Pe,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 He({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:Pe,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 He({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:Pe,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 He({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:Pe,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 He({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:Pe,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,P,nn,Ke,an,rn,ln,ys,Io,dn,bs,Zo,vt,cn,Ms,No,pn,ws,R,kt,hn,mn,H,un,$t,fn,gn,jt,_n,yn,bn,D,Mn,Yt,wn,Tn,Jt,vn,kn,Ts,_e,Qr,vs,ye,$n,qo,jn,Yn,ks,V,Jn,eo,Un,Cn,oo,Fn,zn,$s,K,be,Ut,to,En,Ct,Wn,js,J,Ft,So,Bn,xn,zt,Go,In,Zn,Et,Ao,Nn,qn,Wt,Ro,Sn,Gn,Bt,Vo,An,Ys,ee,Me,xt,so,Rn,It,Vn,Js,C,no,Xn,oe,On,Xo,Qn,Ln,ao,Pn,Hn,Dn,te,Kn,Oo,ea,oa,Qo,ta,sa,na,we,Us,se,Te,Zt,ro,aa,Nt,ra,Cs,I,io,ia,lo,la,co,da,ca,pa,z,po,ha,ne,ma,Lo,ua,fa,qt,ga,_a,ya,ve,ba,ke,Fs,ae,$e,St,ho,Ma,Gt,wa,zs,Z,mo,Ta,re,va,At,ka,$a,uo,ja,Ya,Ja,E,fo,Ua,ie,Ca,Po,Fa,za,Rt,Ea,Wa,Ba,je,xa,Ye,Es,le,Je,Vt,go,Ia,Xt,Za,Ws,N,_o,Na,yo,qa,bo,Sa,Ga,Aa,U,Mo,Ra,de,Va,Ho,Xa,Oa,Ot,Qa,La,Pa,Ue,Ha,Ce,Da,Fe,Bs,ce,ze,Qt,wo,Ka,Lt,er,xs,q,To,or,vo,tr,ko,sr,nr,ar,W,$o,rr,pe,ir,Do,lr,dr,Pt,cr,pr,hr,Ee,mr,We,Is,he,Be,Ht,jo,ur,Dt,fr,Zs,S,Yo,gr,Jo,_r,Uo,yr,br,Mr,B,Co,wr,me,Tr,Ko,vr,kr,Kt,$r,jr,Yr,xe,Jr,Ie,Ns,ue,Ze,es,Fo,Ur,os,Cr,qs,G,zo,Fr,A,zr,ts,Er,Wr,ss,Br,xr,Eo,Ir,Zr,Nr,x,Wo,qr,fe,Sr,et,Gr,Ar,ns,Rr,Vr,Xr,Ne,Or,qe,Ss;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.33.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.33.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.33.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.33.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.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/yoso/modeling_yoso.py#L741"}}),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.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/yoso/modeling_yoso.py#L766",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.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.33.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.33.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.33.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.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/yoso/modeling_yoso.py#L853"}}),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.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.33.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.33.0/src/transformers/models/yoso/modeling_yoso.py#L871",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/en/model_doc/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.33.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.33.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.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/yoso/modeling_yoso.py#L956"}}),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.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.33.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.33.0/src/transformers/models/yoso/modeling_yoso.py#L966",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/en/model_doc/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.33.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.33.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.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/yoso/modeling_yoso.py#L1047"}}),$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.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.33.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.33.0/src/transformers/models/yoso/modeling_yoso.py#L1058",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput"
>transformers.modeling_outputs.MultipleChoiceModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/en/model_doc/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.33.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.33.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.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/yoso/modeling_yoso.py#L1138"}}),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.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.33.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.33.0/src/transformers/models/yoso/modeling_yoso.py#L1150",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/en/model_doc/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.33.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),xe=new Mt({props:{$$slots:{default:[kl]},$$scope:{ctx:j}}}),Ie=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.33.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.33.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/yoso/modeling_yoso.py#L1223"}}),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.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.33.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.33.0/src/transformers/models/yoso/modeling_yoso.py#L1236",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/en/model_doc/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.33.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}}}),qe=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(),P=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(),Io=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(),H=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 "),qo=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"),So=n("a"),Bn=i("Text classification task guide"),xn=f(),zt=n("li"),Go=n("a"),In=i("Token classification task guide"),Zn=f(),Et=n("li"),Ao=n("a"),Nn=i("Question answering task guide"),qn=f(),Wt=n("li"),Ro=n("a"),Sn=i("Masked language modeling task guide"),Gn=f(),Bt=n("li"),Vo=n("a"),An=i("Multiple choice task guide"),Ys=f(),ee=n("h2"),Me=n("a"),xt=n("span"),M(so.$$.fragment),Rn=f(),It=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"),Pn=i("uw-madison/yoso-4096"),Hn=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(),I=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 "),qt=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"),St=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 "),Po=n("a"),Fa=i("YosoForMaskedLM"),za=i(" forward method, overrides the "),Rt=n("code"),Ea=i("__call__"),Wa=i(" special method."),Ba=f(),M(je.$$.fragment),xa=f(),M(Ye.$$.fragment),Es=f(),le=n("h2"),Je=n("a"),Vt=n("span"),M(go.$$.fragment),Ia=f(),Xt=n("span"),Za=i("YosoForSequenceClassification"),Ws=f(),N=n("div"),M(_o.$$.fragment),Na=f(),yo=n("p"),qa=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"),Sa=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 "),Ho=n("a"),Xa=i("YosoForSequenceClassification"),Oa=i(" forward method, overrides the "),Ot=n("code"),Qa=i("__call__"),La=i(" special method."),Pa=f(),M(Ue.$$.fragment),Ha=f(),M(Ce.$$.fragment),Da=f(),M(Fe.$$.fragment),Bs=f(),ce=n("h2"),ze=n("a"),Qt=n("span"),M(wo.$$.fragment),Ka=f(),Lt=n("span"),er=i("YosoForMultipleChoice"),xs=f(),q=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 "),Pt=n("code"),cr=i("__call__"),pr=i(" special method."),hr=f(),M(Ee.$$.fragment),mr=f(),M(We.$$.fragment),Is=f(),he=n("h2"),Be=n("a"),Ht=n("span"),M(jo.$$.fragment),ur=f(),Dt=n("span"),fr=i("YosoForTokenClassification"),Zs=f(),S=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(),B=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(xe.$$.fragment),Jr=f(),M(Ie.$$.fragment),Ns=f(),ue=n("h2"),Ze=n("a"),es=n("span"),M(Fo.$$.fragment),Ur=f(),os=n("span"),Cr=i("YosoForQuestionAnswering"),qs=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"),Br=i("span end logits"),xr=i(`).
This model is a PyTorch `),Eo=n("a"),Ir=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(),x=n("div"),M(Wo.$$.fragment),qr=f(),fe=n("p"),Sr=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(qe.$$.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 Bo=r(m);p=a(Bo,"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(Bo),Y=a(Bo,"SPAN",{});var is=r(Y);on=l(is,"YOSO"),is.forEach(t),Bo.forEach(t),gs=g(o),L=a(o,"H2",{class:!0});var xo=r(L);ge=a(xo,"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(xo),Tt=a(xo,"SPAN",{});var cs=r(Tt);sn=l(cs,"Overview"),cs.forEach(t),xo.forEach(t),_s=g(o),P=a(o,"P",{});var Se=r(P);nn=l(Se,"The YOSO model was proposed in "),Ke=a(Se,"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(Se,"BR",{}),ln=l(Se,`
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.`),Se.forEach(t),ys=g(o),Io=a(o,"P",{});var hs=r(Io);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),H=a(ot,"LI",{});var tt=r(H);un=l(tt,"The kernels provide a "),$t=a(tt,"CODE",{});var Pr=r($t);fn=l(Pr,"fast_hash"),Pr.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 Hr=r(jt);_n=l(Hr,"lsh_cumulation"),Hr.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 "),qo=a(Gs,"A",{href:!0});var ei=r(qo);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);So=a(ri,"A",{href:!0});var ii=r(So);Bn=l(ii,"Text classification task guide"),ii.forEach(t),ri.forEach(t),xn=g(X),zt=a(X,"LI",{});var li=r(zt);Go=a(li,"A",{href:!0});var di=r(Go);In=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),qn=g(X),Wt=a(X,"LI",{});var hi=r(Wt);Ro=a(hi,"A",{href:!0});var mi=r(Ro);Sn=l(mi,"Masked language modeling task guide"),mi.forEach(t),hi.forEach(t),Gn=g(X),Bt=a(X,"LI",{});var ui=r(Bt);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);xt=a(gi,"SPAN",{});var _i=r(xt);w(so.$$.fragment,_i),_i.forEach(t),gi.forEach(t),Rn=g(Rs),It=a(Rs,"SPAN",{});var yi=r(It);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);Pn=l(Mi,"uw-madison/yoso-4096"),Mi.forEach(t),Hn=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),I=a(o,"DIV",{class:!0});var it=r(I);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 "),qt=a(lt,"CODE",{});var Ji=r(qt);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);St=a(Ui,"SPAN",{});var Ci=r(St);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 "),Po=a(pt,"A",{href:!0});var Wi=r(Po);Fa=l(Wi,"YosoForMaskedLM"),Wi.forEach(t),za=l(pt," forward method, overrides the "),Rt=a(pt,"CODE",{});var Bi=r(Rt);Ea=l(Bi,"__call__"),Bi.forEach(t),Wa=l(pt," special method."),pt.forEach(t),Ba=g(Re),w(je.$$.fragment,Re),xa=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 xi=r(Je);Vt=a(xi,"SPAN",{});var Ii=r(Vt);w(go.$$.fragment,Ii),Ii.forEach(t),xi.forEach(t),Ia=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);qa=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);Sa=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 "),Ho=a(mt,"A",{href:!0});var qi=r(Ho);Xa=l(qi,"YosoForSequenceClassification"),qi.forEach(t),Oa=l(mt," forward method, overrides the "),Ot=a(mt,"CODE",{});var Si=r(Ot);Qa=l(Si,"__call__"),Si.forEach(t),La=l(mt," special method."),mt.forEach(t),Pa=g(O),w(Ue.$$.fragment,O),Ha=g(O),w(Ce.$$.fragment,O),Da=g(O),w(Fe.$$.fragment,O),O.forEach(t),ht.forEach(t),Bs=g(o),ce=a(o,"H2",{class:!0});var Ps=r(ce);ze=a(Ps,"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(Ps),Lt=a(Ps,"SPAN",{});var Ri=r(Lt);er=l(Ri,"YosoForMultipleChoice"),Ri.forEach(t),Ps.forEach(t),xs=g(o),q=a(o,"DIV",{class:!0});var ut=r(q);w(To.$$.fragment,ut),or=g(ut),vo=a(ut,"P",{});var Hs=r(vo);tr=l(Hs,`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(Hs,"A",{href:!0,rel:!0});var Vi=r(ko);sr=l(Vi,"torch.nn.Module"),Vi.forEach(t),nr=l(Hs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Hs.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 "),Pt=a(ft,"CODE",{});var Oi=r(Pt);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),Is=g(o),he=a(o,"H2",{class:!0});var Ds=r(he);Be=a(Ds,"A",{id:!0,class:!0,href:!0});var Qi=r(Be);Ht=a(Qi,"SPAN",{});var Li=r(Ht);w(jo.$$.fragment,Li),Li.forEach(t),Qi.forEach(t),ur=g(Ds),Dt=a(Ds,"SPAN",{});var Pi=r(Dt);fr=l(Pi,"YosoForTokenClassification"),Pi.forEach(t),Ds.forEach(t),Zs=g(o),S=a(o,"DIV",{class:!0});var gt=r(S);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 Hi=r(Uo);yr=l(Hi,"torch.nn.Module"),Hi.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),B=a(gt,"DIV",{class:!0});var Xe=r(B);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(xe.$$.fragment,Xe),Jr=g(Xe),w(Ie.$$.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),qs=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);Br=l(nl,"span end logits"),nl.forEach(t),xr=l(Oe,`).
This model is a PyTorch `),Eo=a(Oe,"A",{href:!0,rel:!0});var al=r(Eo);Ir=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),x=a(yt,"DIV",{class:!0});var Qe=r(x);w(Wo.$$.fragment,Qe),qr=g(Qe),fe=a(Qe,"P",{});var bt=r(fe);Sr=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(qe.$$.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(qo,"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(So,"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.33.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.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(Qo,"href","/docs/transformers/v4.33.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.33.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(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($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(Po,"href","/docs/transformers/v4.33.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(Ho,"href","/docs/transformers/v4.33.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.33.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(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(Be,"id","transformers.YosoForTokenClassification"),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","#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.33.0/en/model_doc/yoso#transformers.YosoForTokenClassification"),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(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(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.33.0/en/model_doc/yoso#transformers.YosoForQuestionAnswering"),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(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,P,u),e(P,nn),e(P,Ke),e(Ke,an),e(P,rn),e(P,ln),_(o,ys,u),_(o,Io,u),e(Io,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,H),e(H,un),e(H,$t),e($t,fn),e(H,gn),e(H,jt),e(jt,_n),e(H,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,qo),e(qo,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,So),e(So,Bn),e(J,xn),e(J,zt),e(zt,Go),e(Go,In),e(J,Zn),e(J,Et),e(Et,Ao),e(Ao,Nn),e(J,qn),e(J,Wt),e(Wt,Ro),e(Ro,Sn),e(J,Gn),e(J,Bt),e(Bt,Vo),e(Vo,An),_(o,Ys,u),_(o,ee,u),e(ee,Me),e(Me,xt),T(so,xt,null),e(ee,Rn),e(ee,It),e(It,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,Pn),e(oe,Hn),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,I,u),T(io,I,null),e(I,ia),e(I,lo),e(lo,la),e(lo,co),e(co,da),e(lo,ca),e(I,pa),e(I,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,qt),e(qt,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,St),T(ho,St,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,Po),e(Po,Fa),e(ie,za),e(ie,Rt),e(Rt,Ea),e(ie,Wa),e(E,Ba),T(je,E,null),e(E,xa),T(Ye,E,null),_(o,Es,u),_(o,le,u),e(le,Je),e(Je,Vt),T(go,Vt,null),e(le,Ia),e(le,Xt),e(Xt,Za),_(o,Ws,u),_(o,N,u),T(_o,N,null),e(N,Na),e(N,yo),e(yo,qa),e(yo,bo),e(bo,Sa),e(yo,Ga),e(N,Aa),e(N,U),T(Mo,U,null),e(U,Ra),e(U,de),e(de,Va),e(de,Ho),e(Ho,Xa),e(de,Oa),e(de,Ot),e(Ot,Qa),e(de,La),e(U,Pa),T(Ue,U,null),e(U,Ha),T(Ce,U,null),e(U,Da),T(Fe,U,null),_(o,Bs,u),_(o,ce,u),e(ce,ze),e(ze,Qt),T(wo,Qt,null),e(ce,Ka),e(ce,Lt),e(Lt,er),_(o,xs,u),_(o,q,u),T(To,q,null),e(q,or),e(q,vo),e(vo,tr),e(vo,ko),e(ko,sr),e(vo,nr),e(q,ar),e(q,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,Pt),e(Pt,cr),e(pe,pr),e(W,hr),T(Ee,W,null),e(W,mr),T(We,W,null),_(o,Is,u),_(o,he,u),e(he,Be),e(Be,Ht),T(jo,Ht,null),e(he,ur),e(he,Dt),e(Dt,fr),_(o,Zs,u),_(o,S,u),T(Yo,S,null),e(S,gr),e(S,Jo),e(Jo,_r),e(Jo,Uo),e(Uo,yr),e(Jo,br),e(S,Mr),e(S,B),T(Co,B,null),e(B,wr),e(B,me),e(me,Tr),e(me,Ko),e(Ko,vr),e(me,kr),e(me,Kt),e(Kt,$r),e(me,jr),e(B,Yr),T(xe,B,null),e(B,Jr),T(Ie,B,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,qs,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,Br),e(A,xr),e(A,Eo),e(Eo,Ir),e(A,Zr),e(G,Nr),e(G,x),T(Wo,x,null),e(x,qr),e(x,fe),e(fe,Sr),e(fe,et),e(et,Gr),e(fe,Ar),e(fe,ns),e(ns,Rr),e(fe,Vr),e(x,Xr),T(Ne,x,null),e(x,Or),T(qe,x,null),Ss=!0},p(o,[u]){const Bo={};u&2&&(Bo.$$scope={dirty:u,ctx:o}),we.$set(Bo);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 xo={};u&2&&(xo.$$scope={dirty:u,ctx:o}),Ye.$set(xo);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 Se={};u&2&&(Se.$$scope={dirty:u,ctx:o}),Ee.$set(Se);const ps={};u&2&&(ps.$$scope={dirty:u,ctx:o}),We.$set(ps);const hs={};u&2&&(hs.$$scope={dirty:u,ctx:o}),xe.$set(hs);const ms={};u&2&&(ms.$$scope={dirty:u,ctx:o}),Ie.$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}),qe.$set(fs)},i(o){Ss||(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(xe.$$.fragment,o),v(Ie.$$.fragment,o),v(Fo.$$.fragment,o),v(zo.$$.fragment,o),v(Wo.$$.fragment,o),v(Ne.$$.fragment,o),v(qe.$$.fragment,o),Ss=!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(xe.$$.fragment,o),k(Ie.$$.fragment,o),k(Fo.$$.fragment,o),k(zo.$$.fragment,o),k(Wo.$$.fragment,o),k(Ne.$$.fragment,o),k(qe.$$.fragment,o),Ss=!1},d(o){t(d),o&&t(b),o&&t(m),$(s),o&&t(gs),o&&t(L),$(De),o&&t(_s),o&&t(P),o&&t(ys),o&&t(Io),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(I),$(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(Bs),o&&t(ce),$(wo),o&&t(xs),o&&t(q),$(To),$($o),$(Ee),$(We),o&&t(Is),o&&t(he),$(jo),o&&t(Zs),o&&t(S),$(Yo),$(Co),$(xe),$(Ie),o&&t(Ns),o&&t(ue),$(Fo),o&&t(qs),o&&t(G),$(zo),$(Wo),$(Ne),$(qe)}}}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 Il extends ll{constructor(d){super();dl(this,d,Cl,Jl,cl,{})}}export{Il as default,Ul as metadata};
