import{S as Eh,i as Ch,s as xh,e as s,k as m,w as M,t as i,M as Zh,c as a,d as t,m as u,a as r,x as T,h as l,b as p,G as e,g as b,y as w,q as z,o as k,B as v,v as Ih,L as le}from"../../chunks/vendor-hf-doc-builder.js";import{T as bt}from"../../chunks/Tip-hf-doc-builder.js";import{D as U}from"../../chunks/Docstring-hf-doc-builder.js";import{C as de}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as O}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ie}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Wh(N){let d,y,f,h,_;return h=new de({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME5lemhhQ29uZmlnJTJDJTIwTmV6aGFNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGFuJTIwTmV6aGElMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyME5lemhhQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyME5lemhhLWJhc2UlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMjBtb2RlbCUwQW1vZGVsJTIwJTNEJTIwTmV6aGFNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> NezhaConfig, NezhaModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing an Nezha configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = NezhaConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the Nezha-base style configuration model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NezhaModel(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=s("p"),y=i("Example:"),f=m(),M(h.$$.fragment)},l(o){d=a(o,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(o),T(h.$$.fragment,o)},m(o,c){b(o,d,c),e(d,y),b(o,f,c),w(h,o,c),_=!0},p:le,i(o){_||(z(h.$$.fragment,o),_=!0)},o(o){k(h.$$.fragment,o),_=!1},d(o){o&&t(d),o&&t(f),v(h,o)}}}function Gh(N){let d,y,f,h,_;return{c(){d=s("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s("code"),h=i("Module"),_=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(o){d=a(o,"P",{});var c=r(d);y=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(c,"CODE",{});var $=r(f);h=l($,"Module"),$.forEach(t),_=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(o,c){b(o,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(o){o&&t(d)}}}function Sh(N){let d,y,f,h,_;return h=new de({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBOZXpoYU1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzaWp1bmhlJTJGbmV6aGEtY24tYmFzZSUyMiklMEFtb2RlbCUyMCUzRCUyME5lemhhTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMnNpanVuaGUlMkZuZXpoYS1jbi1iYXNlJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NezhaModel
<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;sijunhe/nezha-cn-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NezhaModel.from_pretrained(<span class="hljs-string">&quot;sijunhe/nezha-cn-base&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=s("p"),y=i("Example:"),f=m(),M(h.$$.fragment)},l(o){d=a(o,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(o),T(h.$$.fragment,o)},m(o,c){b(o,d,c),e(d,y),b(o,f,c),w(h,o,c),_=!0},p:le,i(o){_||(z(h.$$.fragment,o),_=!0)},o(o){k(h.$$.fragment,o),_=!1},d(o){o&&t(d),o&&t(f),v(h,o)}}}function Ph(N){let d,y,f,h,_;return{c(){d=s("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s("code"),h=i("Module"),_=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(o){d=a(o,"P",{});var c=r(d);y=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(c,"CODE",{});var $=r(f);h=l($,"Module"),$.forEach(t),_=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(o,c){b(o,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(o){o&&t(d)}}}function Vh(N){let d,y,f,h,_;return h=new de({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBOZXpoYUZvclByZVRyYWluaW5nJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzaWp1bmhlJTJGbmV6aGEtY24tYmFzZSUyMiklMEFtb2RlbCUyMCUzRCUyME5lemhhRm9yUHJlVHJhaW5pbmcuZnJvbV9wcmV0cmFpbmVkKCUyMnNpanVuaGUlMkZuZXpoYS1jbi1iYXNlJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBcHJlZGljdGlvbl9sb2dpdHMlMjAlM0QlMjBvdXRwdXRzLnByZWRpY3Rpb25fbG9naXRzJTBBc2VxX3JlbGF0aW9uc2hpcF9sb2dpdHMlMjAlM0QlMjBvdXRwdXRzLnNlcV9yZWxhdGlvbnNoaXBfbG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NezhaForPreTraining
<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;sijunhe/nezha-cn-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NezhaForPreTraining.from_pretrained(<span class="hljs-string">&quot;sijunhe/nezha-cn-base&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>prediction_logits = outputs.prediction_logits
<span class="hljs-meta">&gt;&gt;&gt; </span>seq_relationship_logits = outputs.seq_relationship_logits`}}),{c(){d=s("p"),y=i("Example:"),f=m(),M(h.$$.fragment)},l(o){d=a(o,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(o),T(h.$$.fragment,o)},m(o,c){b(o,d,c),e(d,y),b(o,f,c),w(h,o,c),_=!0},p:le,i(o){_||(z(h.$$.fragment,o),_=!0)},o(o){k(h.$$.fragment,o),_=!1},d(o){o&&t(d),o&&t(f),v(h,o)}}}function Ah(N){let d,y,f,h,_;return{c(){d=s("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s("code"),h=i("Module"),_=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(o){d=a(o,"P",{});var c=r(d);y=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(c,"CODE",{});var $=r(f);h=l($,"Module"),$.forEach(t),_=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(o,c){b(o,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(o){o&&t(d)}}}function qh(N){let d,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90ZW5zb3JzJTNEJTIycHQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTIzJTIwbWFzayUyMGxhYmVscyUyMG9mJTIwbm9uLSU1Qk1BU0slNUQlMjB0b2tlbnMlMEFsYWJlbHMlMjAlM0QlMjB0b3JjaC53aGVyZShpbnB1dHMuaW5wdXRfaWRzJTIwJTNEJTNEJTIwdG9rZW5pemVyLm1hc2tfdG9rZW5faWQlMkMlMjBsYWJlbHMlMkMlMjAtMTAwKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NezhaForMaskedLM
<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;sijunhe/nezha-cn-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NezhaForMaskedLM.from_pretrained(<span class="hljs-string">&quot;sijunhe/nezha-cn-base&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=s("p"),y=i("Example:"),f=m(),M(h.$$.fragment)},l(o){d=a(o,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(o),T(h.$$.fragment,o)},m(o,c){b(o,d,c),e(d,y),b(o,f,c),w(h,o,c),_=!0},p:le,i(o){_||(z(h.$$.fragment,o),_=!0)},o(o){k(h.$$.fragment,o),_=!1},d(o){o&&t(d),o&&t(f),v(h,o)}}}function Bh(N){let d,y,f,h,_;return{c(){d=s("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s("code"),h=i("Module"),_=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(o){d=a(o,"P",{});var c=r(d);y=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(c,"CODE",{});var $=r(f);h=l($,"Module"),$.forEach(t),_=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(o,c){b(o,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(o){o&&t(d)}}}function Rh(N){let d,y,f,h,_;return h=new de({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBOZXpoYUZvck5leHRTZW50ZW5jZVByZWRpY3Rpb24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hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NezhaForNextSentencePrediction
<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;sijunhe/nezha-cn-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NezhaForNextSentencePrediction.from_pretrained(<span class="hljs-string">&quot;sijunhe/nezha-cn-base&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>next_sentence = <span class="hljs-string">&quot;The sky is blue due to the shorter wavelength of blue light.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(prompt, next_sentence, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding, labels=torch.LongTensor([<span class="hljs-number">1</span>]))
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">assert</span> logits[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>] &lt; logits[<span class="hljs-number">0</span>, <span class="hljs-number">1</span>]  <span class="hljs-comment"># next sentence was random</span>`}}),{c(){d=s("p"),y=i("Example:"),f=m(),M(h.$$.fragment)},l(o){d=a(o,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(o),T(h.$$.fragment,o)},m(o,c){b(o,d,c),e(d,y),b(o,f,c),w(h,o,c),_=!0},p:le,i(o){_||(z(h.$$.fragment,o),_=!0)},o(o){k(h.$$.fragment,o),_=!1},d(o){o&&t(d),o&&t(f),v(h,o)}}}function Xh(N){let d,y,f,h,_;return{c(){d=s("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s("code"),h=i("Module"),_=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(o){d=a(o,"P",{});var c=r(d);y=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(c,"CODE",{});var $=r(f);h=l($,"Module"),$.forEach(t),_=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(o,c){b(o,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(o){o&&t(d)}}}function Qh(N){let d,y,f,h,_;return h=new de({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyME5lemhhRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnNpanVuaGUlMkZuZXpoYS1jbi1iYXNlJTIyKSUwQW1vZGVsJTIwJTNEJTIwTmV6aGFGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJzaWp1bmhlJTJGbmV6aGEtY24tYmFzZSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWQlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KCkuaXRlbSgpJTBBJTBBJTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwTmV6aGFGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJzaWp1bmhlJTJGbmV6aGEtY24tYmFzZSUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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, NezhaForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;sijunhe/nezha-cn-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NezhaForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;sijunhe/nezha-cn-base&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 = NezhaForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;sijunhe/nezha-cn-base&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=s("p"),y=i("Example of single-label classification:"),f=m(),M(h.$$.fragment)},l(o){d=a(o,"P",{});var c=r(d);y=l(c,"Example of single-label classification:"),c.forEach(t),f=u(o),T(h.$$.fragment,o)},m(o,c){b(o,d,c),e(d,y),b(o,f,c),w(h,o,c),_=!0},p:le,i(o){_||(z(h.$$.fragment,o),_=!0)},o(o){k(h.$$.fragment,o),_=!1},d(o){o&&t(d),o&&t(f),v(h,o)}}}function Hh(N){let d,y,f,h,_;return h=new de({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyME5lemhhRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMnNpanVuaGUlMkZuZXpoYS1jbi1iYXNlJTIyKSUwQW1vZGVsJTIwJTNEJTIwTmV6aGFGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJzaWp1bmhlJTJGbmV6aGEtY24tYmFzZSUyMiUyQyUyMHByb2JsZW1fdHlwZSUzRCUyMm11bHRpX2xhYmVsX2NsYXNzaWZpY2F0aW9uJTIyKSUw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fY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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, NezhaForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;sijunhe/nezha-cn-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NezhaForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;sijunhe/nezha-cn-base&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 = NezhaForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;sijunhe/nezha-cn-base&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=s("p"),y=i("Example of multi-label classification:"),f=m(),M(h.$$.fragment)},l(o){d=a(o,"P",{});var c=r(d);y=l(c,"Example of multi-label classification:"),c.forEach(t),f=u(o),T(h.$$.fragment,o)},m(o,c){b(o,d,c),e(d,y),b(o,f,c),w(h,o,c),_=!0},p:le,i(o){_||(z(h.$$.fragment,o),_=!0)},o(o){k(h.$$.fragment,o),_=!1},d(o){o&&t(d),o&&t(f),v(h,o)}}}function Yh(N){let d,y,f,h,_;return{c(){d=s("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s("code"),h=i("Module"),_=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(o){d=a(o,"P",{});var c=r(d);y=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(c,"CODE",{});var $=r(f);h=l($,"Module"),$.forEach(t),_=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(o,c){b(o,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(o){o&&t(d)}}}function Oh(N){let d,y,f,h,_;return h=new de({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlM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klMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKiolN0JrJTNBJTIwdi51bnNxdWVlemUoMCklMjBmb3IlMjBrJTJDJTIwdiUyMGluJTIwZW5jb2RpbmcuaXRlbXMoKSU3RCUyQyUyMGxhYmVscyUzRGxhYmVscyklMjAlMjAlMjMlMjBiYXRjaCUyMHNpemUlMjBpcyUyMDElMEElMEElMjMlMjB0aGUlMjBsaW5lYXIlMjBjbGFzc2lmaWVyJTIwc3RpbGwlMjBuZWVkcyUyMHRvJTIwYmUlMjB0cmFpbmVkJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcyUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NezhaForMultipleChoice
<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;sijunhe/nezha-cn-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NezhaForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;sijunhe/nezha-cn-base&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=s("p"),y=i("Example:"),f=m(),M(h.$$.fragment)},l(o){d=a(o,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(o),T(h.$$.fragment,o)},m(o,c){b(o,d,c),e(d,y),b(o,f,c),w(h,o,c),_=!0},p:le,i(o){_||(z(h.$$.fragment,o),_=!0)},o(o){k(h.$$.fragment,o),_=!1},d(o){o&&t(d),o&&t(f),v(h,o)}}}function Lh(N){let d,y,f,h,_;return{c(){d=s("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s("code"),h=i("Module"),_=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(o){d=a(o,"P",{});var c=r(d);y=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(c,"CODE",{});var $=r(f);h=l($,"Module"),$.forEach(t),_=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(o,c){b(o,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(o){o&&t(d)}}}function Dh(N){let d,y,f,h,_;return h=new de({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBOZXpoYUZvclRva2VuQ2xhc3NpZmljYXRpb24lMEFpbXBvcn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fdG9rZW5zX2NsYXNzZXMlMjAlM0QlMjAlNUJtb2RlbC5jb25maWcuaWQybGFiZWwlNUJ0Lml0ZW0oKSU1RCUyMGZvciUyMHQlMjBpbiUyMHByZWRpY3RlZF90b2tlbl9jbGFzc19pZHMlNUIwJTVEJTVEJTBBJTBBbGFiZWxzJTIwJTNEJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NezhaForTokenClassification
<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;sijunhe/nezha-cn-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NezhaForTokenClassification.from_pretrained(<span class="hljs-string">&quot;sijunhe/nezha-cn-base&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=s("p"),y=i("Example:"),f=m(),M(h.$$.fragment)},l(o){d=a(o,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(o),T(h.$$.fragment,o)},m(o,c){b(o,d,c),e(d,y),b(o,f,c),w(h,o,c),_=!0},p:le,i(o){_||(z(h.$$.fragment,o),_=!0)},o(o){k(h.$$.fragment,o),_=!1},d(o){o&&t(d),o&&t(f),v(h,o)}}}function Kh(N){let d,y,f,h,_;return{c(){d=s("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s("code"),h=i("Module"),_=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(o){d=a(o,"P",{});var c=r(d);y=l(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(c,"CODE",{});var $=r(f);h=l($,"Module"),$.forEach(t),_=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(o,c){b(o,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(o){o&&t(d)}}}function ep(N){let d,y,f,h,_;return h=new de({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBOZXpoYUZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzaWp1bmhlJTJGbmV6aGEtY24tYmF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zJTJDJTIwc3RhcnRfcG9zaXRpb25zJTNEdGFyZ2V0X3N0YXJ0X2luZGV4JTJDJTIwZW5kX3Bvc2l0aW9ucyUzRHRhcmdldF9lbmRfaW5kZXgpJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NezhaForQuestionAnswering
<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;sijunhe/nezha-cn-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NezhaForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;sijunhe/nezha-cn-base&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=s("p"),y=i("Example:"),f=m(),M(h.$$.fragment)},l(o){d=a(o,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(o),T(h.$$.fragment,o)},m(o,c){b(o,d,c),e(d,y),b(o,f,c),w(h,o,c),_=!0},p:le,i(o){_||(z(h.$$.fragment,o),_=!0)},o(o){k(h.$$.fragment,o),_=!1},d(o){o&&t(d),o&&t(f),v(h,o)}}}function tp(N){let d,y,f,h,_,o,c,$,Na,Ns,ce,xe,fo,yt,$a,go,ja,$s,Ze,Ja,Mt,Ua,Fa,js,Un,Ea,Js,Fn,_o,Ca,Us,L,xa,Tt,Za,Ia,wt,Wa,Ga,Fs,he,Ie,bo,zt,Sa,yo,Pa,Es,G,Mo,En,Va,Aa,To,Cn,qa,Ba,wo,xn,Ra,Xa,zo,Zn,Qa,Ha,ko,In,Ya,Cs,pe,We,vo,kt,Oa,No,La,xs,A,vt,Da,me,Ka,Wn,er,tr,Nt,nr,or,sr,ue,ar,Gn,rr,ir,Sn,lr,dr,cr,Ge,Zs,fe,Se,$o,$t,hr,jo,pr,Is,j,jt,mr,Jo,ur,fr,Jt,gr,Pn,_r,br,yr,Ut,Mr,Ft,Tr,wr,zr,Et,kr,Ct,vr,Nr,$r,J,jr,Uo,Jr,Ur,Fo,Fr,Er,Eo,Cr,xr,Co,Zr,Ir,xo,Wr,Gr,Zo,Sr,Pr,Vr,q,xt,Ar,ge,qr,Vn,Br,Rr,Io,Xr,Qr,Hr,Pe,Yr,Ve,Ws,_e,Ae,Wo,Zt,Or,Go,Lr,Gs,F,It,Dr,be,Kr,So,ei,ti,Po,ni,oi,si,Wt,ai,An,ri,ii,li,Gt,di,St,ci,hi,pi,B,Pt,mi,ye,ui,qn,fi,gi,Vo,_i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:" = 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:" = 512"},{name:"max_relative_position",val:" = 64"},{name:"type_vocab_size",val:" = 2"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"classifier_dropout",val:" = 0.1"},{name:"pad_token_id",val:" = 0"},{name:"bos_token_id",val:" = 2"},{name:"eos_token_id",val:" = 3"},{name:"use_cache",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.NezhaConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, optional, defaults to 21128) &#x2014;
Vocabulary size of the NEZHA model. Defines the different tokens that can be represented by the
<em>inputs_ids</em> passed to the forward method of <a href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaModel">NezhaModel</a>.`,name:"vocab_size"},{anchor:"transformers.NezhaConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, optional, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.NezhaConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, optional, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.NezhaConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, optional, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.NezhaConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, optional, defaults to 3072) &#x2014;
The dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.NezhaConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, optional, defaults to &#x201C;gelu&#x201D;) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler.`,name:"hidden_act"},{anchor:"transformers.NezhaConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, optional, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.NezhaConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, optional, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.NezhaConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, optional, defaults to 512) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
(e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.NezhaConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, optional, defaults to 2) &#x2014;
The vocabulary size of the <em>token_type_ids</em> passed into <a href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaModel">NezhaModel</a>.`,name:"type_vocab_size"},{anchor:"transformers.NezhaConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, optional, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.NezhaConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, optional, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.NezhaConfig.classifier_dropout",description:`<strong>classifier_dropout</strong> (<code>float</code>, optional, defaults to 0.1) &#x2014;
The dropout ratio for attached classifiers.`,name:"classifier_dropout"},{anchor:"transformers.NezhaConfig.is_decoder",description:`<strong>is_decoder</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the model is used as a decoder or not. If <code>False</code>, the model is used as an encoder.`,name:"is_decoder"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/configuration_nezha.py#L9"}}),Ge=new ie({props:{anchor:"transformers.NezhaConfig.example",$$slots:{default:[Wh]},$$scope:{ctx:N}}}),$t=new O({}),jt=new U({props:{name:"class transformers.NezhaModel",anchor:"transformers.NezhaModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"}],parametersDescription:[{anchor:"transformers.NezhaModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaConfig">NezhaConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L859"}}),xt=new U({props:{name:"forward",anchor:"transformers.NezhaModel.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:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"use_cache",val:": typing.Optional[bool] = 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.NezhaModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.NezhaModel.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.NezhaModel.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.NezhaModel.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.NezhaModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NezhaModel.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.NezhaModel.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.NezhaModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NezhaModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong>  (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
the model is configured as a decoder.`,name:"encoder_hidden_states"},{anchor:"transformers.NezhaModel.forward.encoder_attention_mask",description:`<strong>encoder_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 the padding token indices of the encoder input. This mask is used in
the cross-attention if the model is configured as a decoder. 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>`,name:"encoder_attention_mask"},{anchor:"transformers.NezhaModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.NezhaModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L898",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaConfig"
>NezhaConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, 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>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
<code>config.is_encoder_decoder=True</code> in the cross-attention blocks) that can be used (see <code>past_key_values</code>
input) to speed up sequential decoding.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Pe=new bt({props:{$$slots:{default:[Gh]},$$scope:{ctx:N}}}),Ve=new ie({props:{anchor:"transformers.NezhaModel.forward.example",$$slots:{default:[Sh]},$$scope:{ctx:N}}}),Zt=new O({}),It=new U({props:{name:"class transformers.NezhaForPreTraining",anchor:"transformers.NezhaForPreTraining",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NezhaForPreTraining.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaConfig">NezhaConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1039"}}),Pt=new U({props:{name:"forward",anchor:"transformers.NezhaForPreTraining.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:"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:"next_sentence_label",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.NezhaForPreTraining.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.NezhaForPreTraining.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.NezhaForPreTraining.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.NezhaForPreTraining.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.NezhaForPreTraining.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NezhaForPreTraining.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.NezhaForPreTraining.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.NezhaForPreTraining.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.</p>
<p>labels (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
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>
next_sentence_label (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>):
Labels for computing the next sequence prediction (classification) loss. Input should be a sequence
pair (see <code>input_ids</code> docstring) Indices should be in <code>[0, 1]</code>:</p>
<ul>
<li>0 indicates sequence B is a continuation of sequence A,</li>
<li>1 indicates sequence B is a random sequence.
kwargs (<code>Dict[str, any]</code>, optional, defaults to <em>{}</em>):
Used to hide legacy arguments that have been deprecated.</li>
</ul>`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1057",returnDescription:`
<p>A <code>transformers.models.nezha.modeling_nezha.NezhaForPreTrainingOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaConfig"
>NezhaConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<em>optional</em>, returned when <code>labels</code> is provided, <code>torch.FloatTensor</code> of shape <code>(1,)</code>) \u2014 Total loss as the sum of the masked language modeling loss and the next sequence prediction
(classification) loss.</p>
</li>
<li>
<p><strong>prediction_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>seq_relationship_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, 2)</code>) \u2014 Prediction scores of the next sequence prediction (classification) head (scores of True/False continuation
before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, 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><code>transformers.models.nezha.modeling_nezha.NezhaForPreTrainingOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),qe=new bt({props:{$$slots:{default:[Ph]},$$scope:{ctx:N}}}),Be=new ie({props:{anchor:"transformers.NezhaForPreTraining.forward.example",$$slots:{default:[Vh]},$$scope:{ctx:N}}}),Vt=new O({}),At=new U({props:{name:"class transformers.NezhaForMaskedLM",anchor:"transformers.NezhaForMaskedLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NezhaForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaConfig">NezhaConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1141"}}),Qt=new U({props:{name:"forward",anchor:"transformers.NezhaForMaskedLM.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:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_attention_mask",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.NezhaForMaskedLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.NezhaForMaskedLM.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.NezhaForMaskedLM.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.NezhaForMaskedLM.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.NezhaForMaskedLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NezhaForMaskedLM.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.NezhaForMaskedLM.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.NezhaForMaskedLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NezhaForMaskedLM.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/main/src/transformers/models/nezha/modeling_nezha.py#L1165",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/nezha#transformers.NezhaConfig"
>NezhaConfig</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/main/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Xe=new bt({props:{$$slots:{default:[Ah]},$$scope:{ctx:N}}}),Qe=new ie({props:{anchor:"transformers.NezhaForMaskedLM.forward.example",$$slots:{default:[qh]},$$scope:{ctx:N}}}),Ht=new O({}),Yt=new U({props:{name:"class transformers.NezhaForNextSentencePrediction",anchor:"transformers.NezhaForNextSentencePrediction",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NezhaForNextSentencePrediction.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaConfig">NezhaConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1247"}}),en=new U({props:{name:"forward",anchor:"transformers.NezhaForNextSentencePrediction.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:"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"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.NezhaForNextSentencePrediction.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.NezhaForNextSentencePrediction.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.NezhaForNextSentencePrediction.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.NezhaForNextSentencePrediction.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.NezhaForNextSentencePrediction.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NezhaForNextSentencePrediction.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.NezhaForNextSentencePrediction.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.NezhaForNextSentencePrediction.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NezhaForNextSentencePrediction.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the next sequence prediction (classification) loss. Input should be a sequence pair
(see <code>input_ids</code> docstring). Indices should be in <code>[0, 1]</code>:</p>
<ul>
<li>0 indicates sequence B is a continuation of sequence A,</li>
<li>1 indicates sequence B is a random sequence.</li>
</ul>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1257",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.NextSentencePredictorOutput"
>transformers.modeling_outputs.NextSentencePredictorOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaConfig"
>NezhaConfig</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>next_sentence_label</code> is provided) \u2014 Next sequence prediction (classification) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, 2)</code>) \u2014 Prediction scores of the next sequence prediction (classification) head (scores of True/False continuation
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/main/en/main_classes/output#transformers.modeling_outputs.NextSentencePredictorOutput"
>transformers.modeling_outputs.NextSentencePredictorOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ye=new bt({props:{$$slots:{default:[Bh]},$$scope:{ctx:N}}}),Oe=new ie({props:{anchor:"transformers.NezhaForNextSentencePrediction.forward.example",$$slots:{default:[Rh]},$$scope:{ctx:N}}}),tn=new O({}),nn=new U({props:{name:"class transformers.NezhaForSequenceClassification",anchor:"transformers.NezhaForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NezhaForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaConfig">NezhaConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1350"}}),rn=new U({props:{name:"forward",anchor:"transformers.NezhaForSequenceClassification.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:"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.NezhaForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.NezhaForSequenceClassification.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.NezhaForSequenceClassification.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.NezhaForSequenceClassification.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.NezhaForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NezhaForSequenceClassification.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.NezhaForSequenceClassification.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.NezhaForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NezhaForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1366",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/nezha#transformers.NezhaConfig"
>NezhaConfig</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/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),De=new bt({props:{$$slots:{default:[Xh]},$$scope:{ctx:N}}}),Ke=new ie({props:{anchor:"transformers.NezhaForSequenceClassification.forward.example",$$slots:{default:[Qh]},$$scope:{ctx:N}}}),et=new ie({props:{anchor:"transformers.NezhaForSequenceClassification.forward.example-2",$$slots:{default:[Hh]},$$scope:{ctx:N}}}),ln=new O({}),dn=new U({props:{name:"class transformers.NezhaForMultipleChoice",anchor:"transformers.NezhaForMultipleChoice",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NezhaForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaConfig">NezhaConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1449"}}),mn=new U({props:{name:"forward",anchor:"transformers.NezhaForMultipleChoice.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:"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.NezhaForMultipleChoice.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.NezhaForMultipleChoice.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.NezhaForMultipleChoice.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.NezhaForMultipleChoice.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.NezhaForMultipleChoice.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NezhaForMultipleChoice.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.NezhaForMultipleChoice.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.NezhaForMultipleChoice.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NezhaForMultipleChoice.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the multiple choice classification loss. Indices should be in <code>[0, ..., num_choices-1]</code> where <code>num_choices</code> is the size of the second dimension of the input tensors. (See
<code>input_ids</code> above)`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1463",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/nezha#transformers.NezhaConfig"
>NezhaConfig</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/main/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput"
>transformers.modeling_outputs.MultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),nt=new bt({props:{$$slots:{default:[Yh]},$$scope:{ctx:N}}}),ot=new ie({props:{anchor:"transformers.NezhaForMultipleChoice.forward.example",$$slots:{default:[Oh]},$$scope:{ctx:N}}}),un=new O({}),fn=new U({props:{name:"class transformers.NezhaForTokenClassification",anchor:"transformers.NezhaForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NezhaForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaConfig">NezhaConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1541"}}),yn=new U({props:{name:"forward",anchor:"transformers.NezhaForTokenClassification.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:"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.NezhaForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.NezhaForTokenClassification.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.NezhaForTokenClassification.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.NezhaForTokenClassification.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.NezhaForTokenClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NezhaForTokenClassification.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.NezhaForTokenClassification.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.NezhaForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NezhaForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1556",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/nezha#transformers.NezhaConfig"
>NezhaConfig</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/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),at=new bt({props:{$$slots:{default:[Lh]},$$scope:{ctx:N}}}),rt=new ie({props:{anchor:"transformers.NezhaForTokenClassification.forward.example",$$slots:{default:[Dh]},$$scope:{ctx:N}}}),Mn=new O({}),Tn=new U({props:{name:"class transformers.NezhaForQuestionAnswering",anchor:"transformers.NezhaForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.NezhaForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/nezha#transformers.NezhaConfig">NezhaConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1620"}}),vn=new U({props:{name:"forward",anchor:"transformers.NezhaForQuestionAnswering.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:"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.NezhaForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.NezhaForQuestionAnswering.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.NezhaForQuestionAnswering.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.NezhaForQuestionAnswering.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.NezhaForQuestionAnswering.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.NezhaForQuestionAnswering.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.NezhaForQuestionAnswering.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.NezhaForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NezhaForQuestionAnswering.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.NezhaForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nezha/modeling_nezha.py#L1631",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/nezha#transformers.NezhaConfig"
>NezhaConfig</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/main/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),lt=new bt({props:{$$slots:{default:[Kh]},$$scope:{ctx:N}}}),dt=new ie({props:{anchor:"transformers.NezhaForQuestionAnswering.forward.example",$$slots:{default:[ep]},$$scope:{ctx:N}}}),{c(){d=s("meta"),y=m(),f=s("h1"),h=s("a"),_=s("span"),M(o.$$.fragment),c=m(),$=s("span"),Na=i("Nezha"),Ns=m(),ce=s("h2"),xe=s("a"),fo=s("span"),M(yt.$$.fragment),$a=m(),go=s("span"),ja=i("Overview"),$s=m(),Ze=s("p"),Ja=i("The Nezha model was proposed in "),Mt=s("a"),Ua=i("NEZHA: Neural Contextualized Representation for Chinese Language Understanding"),Fa=i(" by Junqiu Wei et al."),js=m(),Un=s("p"),Ea=i("The abstract from the paper is the following:"),Js=m(),Fn=s("p"),_o=s("em"),Ca=i(`The pre-trained language models have achieved great successes in various natural language understanding (NLU) tasks
due to its capacity to capture the deep contextualized information in text by pre-training on large-scale corpora.
In this technical report, we present our practice of pre-training language models named NEZHA (NEural contextualiZed
representation for CHinese lAnguage understanding) on Chinese corpora and finetuning for the Chinese NLU tasks.
The current version of NEZHA is based on BERT with a collection of proven improvements, which include Functional
Relative Positional Encoding as an effective positional encoding scheme, Whole Word Masking strategy,
Mixed Precision Training and the LAMB Optimizer in training the models. The experimental results show that NEZHA
achieves the state-of-the-art performances when finetuned on several representative Chinese tasks, including
named entity recognition (People\u2019s Daily NER), sentence matching (LCQMC), Chinese sentiment classification (ChnSenti)
and natural language inference (XNLI).`),Us=m(),L=s("p"),xa=i("This model was contributed by "),Tt=s("a"),Za=i("sijunhe"),Ia=i(". The original code can be found "),wt=s("a"),Wa=i("here"),Ga=i("."),Fs=m(),he=s("h2"),Ie=s("a"),bo=s("span"),M(zt.$$.fragment),Sa=m(),yo=s("span"),Pa=i("Documentation resources"),Es=m(),G=s("ul"),Mo=s("li"),En=s("a"),Va=i("Text classification task guide"),Aa=m(),To=s("li"),Cn=s("a"),qa=i("Token classification task guide"),Ba=m(),wo=s("li"),xn=s("a"),Ra=i("Question answering task guide"),Xa=m(),zo=s("li"),Zn=s("a"),Qa=i("Masked language modeling task guide"),Ha=m(),ko=s("li"),In=s("a"),Ya=i("Multiple choice task guide"),Cs=m(),pe=s("h2"),We=s("a"),vo=s("span"),M(kt.$$.fragment),Oa=m(),No=s("span"),La=i("NezhaConfig"),xs=m(),A=s("div"),M(vt.$$.fragment),Da=m(),me=s("p"),Ka=i("This is the configuration class to store the configuration of an "),Wn=s("a"),er=i("NezhaModel"),tr=i(`. It is used to instantiate an Nezha
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 Nezha
`),Nt=s("a"),nr=i("sijunhe/nezha-cn-base"),or=i(" architecture."),sr=m(),ue=s("p"),ar=i("Configuration objects inherit from "),Gn=s("a"),rr=i("PretrainedConfig"),ir=i(` and can be used to control the model outputs. Read the
documentation from `),Sn=s("a"),lr=i("PretrainedConfig"),dr=i(" for more information."),cr=m(),M(Ge.$$.fragment),Zs=m(),fe=s("h2"),Se=s("a"),$o=s("span"),M($t.$$.fragment),hr=m(),jo=s("span"),pr=i("NezhaModel"),Is=m(),j=s("div"),M(jt.$$.fragment),mr=m(),Jo=s("p"),ur=i("The bare Nezha Model transformer outputting raw hidden-states without any specific head on top."),fr=m(),Jt=s("p"),gr=i("This model inherits from "),Pn=s("a"),_r=i("PreTrainedModel"),br=i(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),yr=m(),Ut=s("p"),Mr=i("This model is also a PyTorch "),Ft=s("a"),Tr=i("torch.nn.Module"),wr=i(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),zr=m(),Et=s("p"),kr=i(`The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in `),Ct=s("a"),vr=i(`Attention is
all you need`),Nr=i(` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),$r=m(),J=s("p"),jr=i("To behave as an decoder the model needs to be initialized with the "),Uo=s("code"),Jr=i("is_decoder"),Ur=i(` argument of the configuration set
to `),Fo=s("code"),Fr=i("True"),Er=i(". To be used in a Seq2Seq model, the model needs to initialized with both "),Eo=s("code"),Cr=i("is_decoder"),xr=i(` argument and
`),Co=s("code"),Zr=i("add_cross_attention"),Ir=i(" set to "),xo=s("code"),Wr=i("True"),Gr=i("; an "),Zo=s("code"),Sr=i("encoder_hidden_states"),Pr=i(" is then expected as an input to the forward pass."),Vr=m(),q=s("div"),M(xt.$$.fragment),Ar=m(),ge=s("p"),qr=i("The "),Vn=s("a"),Br=i("NezhaModel"),Rr=i(" forward method, overrides the "),Io=s("code"),Xr=i("__call__"),Qr=i(" special method."),Hr=m(),M(Pe.$$.fragment),Yr=m(),M(Ve.$$.fragment),Ws=m(),_e=s("h2"),Ae=s("a"),Wo=s("span"),M(Zt.$$.fragment),Or=m(),Go=s("span"),Lr=i("NezhaForPreTraining"),Gs=m(),F=s("div"),M(It.$$.fragment),Dr=m(),be=s("p"),Kr=i("Nezha Model with two heads on top as done during the pretraining: a "),So=s("code"),ei=i("masked language modeling"),ti=i(" head and a "),Po=s("code"),ni=i("next sentence prediction (classification)"),oi=i(" head."),si=m(),Wt=s("p"),ai=i("This model inherits from "),An=s("a"),ri=i("PreTrainedModel"),ii=i(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),li=m(),Gt=s("p"),di=i("This model is also a PyTorch "),St=s("a"),ci=i("torch.nn.Module"),hi=i(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),pi=m(),B=s("div"),M(Pt.$$.fragment),mi=m(),ye=s("p"),ui=i("The "),qn=s("a"),fi=i("NezhaForPreTraining"),gi=i(" forward method, overrides the "),Vo=s("code"),_i=i("__call__"),bi=i(" special method."),yi=m(),M(qe.$$.fragment),Mi=m(),M(Be.$$.fragment),Ss=m(),Me=s("h2"),Re=s("a"),Ao=s("span"),M(Vt.$$.fragment),Ti=m(),qo=s("span"),wi=i("NezhaForMaskedLM"),Ps=m(),E=s("div"),M(At.$$.fragment),zi=m(),qt=s("p"),ki=i("Nezha Model with a "),Bo=s("code"),vi=i("language modeling"),Ni=i(" head on top."),$i=m(),Bt=s("p"),ji=i("This model inherits from "),Bn=s("a"),Ji=i("PreTrainedModel"),Ui=i(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Fi=m(),Rt=s("p"),Ei=i("This model is also a PyTorch "),Xt=s("a"),Ci=i("torch.nn.Module"),xi=i(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Zi=m(),R=s("div"),M(Qt.$$.fragment),Ii=m(),Te=s("p"),Wi=i("The "),Rn=s("a"),Gi=i("NezhaForMaskedLM"),Si=i(" forward method, overrides the "),Ro=s("code"),Pi=i("__call__"),Vi=i(" special method."),Ai=m(),M(Xe.$$.fragment),qi=m(),M(Qe.$$.fragment),Vs=m(),we=s("h2"),He=s("a"),Xo=s("span"),M(Ht.$$.fragment),Bi=m(),Qo=s("span"),Ri=i("NezhaForNextSentencePrediction"),As=m(),C=s("div"),M(Yt.$$.fragment),Xi=m(),Ot=s("p"),Qi=i("Nezha Model with a "),Ho=s("code"),Hi=i("next sentence prediction (classification)"),Yi=i(" head on top."),Oi=m(),Lt=s("p"),Li=i("This model inherits from "),Xn=s("a"),Di=i("PreTrainedModel"),Ki=i(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),el=m(),Dt=s("p"),tl=i("This model is also a PyTorch "),Kt=s("a"),nl=i("torch.nn.Module"),ol=i(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),sl=m(),X=s("div"),M(en.$$.fragment),al=m(),ze=s("p"),rl=i("The "),Qn=s("a"),il=i("NezhaForNextSentencePrediction"),ll=i(" forward method, overrides the "),Yo=s("code"),dl=i("__call__"),cl=i(" special method."),hl=m(),M(Ye.$$.fragment),pl=m(),M(Oe.$$.fragment),qs=m(),ke=s("h2"),Le=s("a"),Oo=s("span"),M(tn.$$.fragment),ml=m(),Lo=s("span"),ul=i("NezhaForSequenceClassification"),Bs=m(),x=s("div"),M(nn.$$.fragment),fl=m(),Do=s("p"),gl=i(`Nezha Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled
output) e.g. for GLUE tasks.`),_l=m(),on=s("p"),bl=i("This model inherits from "),Hn=s("a"),yl=i("PreTrainedModel"),Ml=i(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Tl=m(),sn=s("p"),wl=i("This model is also a PyTorch "),an=s("a"),zl=i("torch.nn.Module"),kl=i(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),vl=m(),S=s("div"),M(rn.$$.fragment),Nl=m(),ve=s("p"),$l=i("The "),Yn=s("a"),jl=i("NezhaForSequenceClassification"),Jl=i(" forward method, overrides the "),Ko=s("code"),Ul=i("__call__"),Fl=i(" special method."),El=m(),M(De.$$.fragment),Cl=m(),M(Ke.$$.fragment),xl=m(),M(et.$$.fragment),Rs=m(),Ne=s("h2"),tt=s("a"),es=s("span"),M(ln.$$.fragment),Zl=m(),ts=s("span"),Il=i("NezhaForMultipleChoice"),Xs=m(),Z=s("div"),M(dn.$$.fragment),Wl=m(),ns=s("p"),Gl=i(`Nezha 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.`),Sl=m(),cn=s("p"),Pl=i("This model inherits from "),On=s("a"),Vl=i("PreTrainedModel"),Al=i(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ql=m(),hn=s("p"),Bl=i("This model is also a PyTorch "),pn=s("a"),Rl=i("torch.nn.Module"),Xl=i(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ql=m(),Q=s("div"),M(mn.$$.fragment),Hl=m(),$e=s("p"),Yl=i("The "),Ln=s("a"),Ol=i("NezhaForMultipleChoice"),Ll=i(" forward method, overrides the "),os=s("code"),Dl=i("__call__"),Kl=i(" special method."),ed=m(),M(nt.$$.fragment),td=m(),M(ot.$$.fragment),Qs=m(),je=s("h2"),st=s("a"),ss=s("span"),M(un.$$.fragment),nd=m(),as=s("span"),od=i("NezhaForTokenClassification"),Hs=m(),I=s("div"),M(fn.$$.fragment),sd=m(),rs=s("p"),ad=i(`Nezha 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.`),rd=m(),gn=s("p"),id=i("This model inherits from "),Dn=s("a"),ld=i("PreTrainedModel"),dd=i(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),cd=m(),_n=s("p"),hd=i("This model is also a PyTorch "),bn=s("a"),pd=i("torch.nn.Module"),md=i(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ud=m(),H=s("div"),M(yn.$$.fragment),fd=m(),Je=s("p"),gd=i("The "),Kn=s("a"),_d=i("NezhaForTokenClassification"),bd=i(" forward method, overrides the "),is=s("code"),yd=i("__call__"),Md=i(" special method."),Td=m(),M(at.$$.fragment),wd=m(),M(rt.$$.fragment),Ys=m(),Ue=s("h2"),it=s("a"),ls=s("span"),M(Mn.$$.fragment),zd=m(),ds=s("span"),kd=i("NezhaForQuestionAnswering"),Os=m(),W=s("div"),M(Tn.$$.fragment),vd=m(),Fe=s("p"),Nd=i(`Nezha 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 `),cs=s("code"),$d=i("span start logits"),jd=i(" and "),hs=s("code"),Jd=i("span end logits"),Ud=i(")."),Fd=m(),wn=s("p"),Ed=i("This model inherits from "),eo=s("a"),Cd=i("PreTrainedModel"),xd=i(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Zd=m(),zn=s("p"),Id=i("This model is also a PyTorch "),kn=s("a"),Wd=i("torch.nn.Module"),Gd=i(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Sd=m(),Y=s("div"),M(vn.$$.fragment),Pd=m(),Ee=s("p"),Vd=i("The "),to=s("a"),Ad=i("NezhaForQuestionAnswering"),qd=i(" forward method, overrides the "),ps=s("code"),Bd=i("__call__"),Rd=i(" special method."),Xd=m(),M(lt.$$.fragment),Qd=m(),M(dt.$$.fragment),this.h()},l(n){const g=Zh('[data-svelte="svelte-1phssyn"]',document.head);d=a(g,"META",{name:!0,content:!0}),g.forEach(t),y=u(n),f=a(n,"H1",{class:!0});var Nn=r(f);h=a(Nn,"A",{id:!0,class:!0,href:!0});var ms=r(h);_=a(ms,"SPAN",{});var us=r(_);T(o.$$.fragment,us),us.forEach(t),ms.forEach(t),c=u(Nn),$=a(Nn,"SPAN",{});var fs=r($);Na=l(fs,"Nezha"),fs.forEach(t),Nn.forEach(t),Ns=u(n),ce=a(n,"H2",{class:!0});var $n=r(ce);xe=a($n,"A",{id:!0,class:!0,href:!0});var gs=r(xe);fo=a(gs,"SPAN",{});var _s=r(fo);T(yt.$$.fragment,_s),_s.forEach(t),gs.forEach(t),$a=u($n),go=a($n,"SPAN",{});var bs=r(go);ja=l(bs,"Overview"),bs.forEach(t),$n.forEach(t),$s=u(n),Ze=a(n,"P",{});var jn=r(Ze);Ja=l(jn,"The Nezha model was proposed in "),Mt=a(jn,"A",{href:!0,rel:!0});var ys=r(Mt);Ua=l(ys,"NEZHA: Neural Contextualized Representation for Chinese Language Understanding"),ys.forEach(t),Fa=l(jn," by Junqiu Wei et al."),jn.forEach(t),js=u(n),Un=a(n,"P",{});var Ms=r(Un);Ea=l(Ms,"The abstract from the paper is the following:"),Ms.forEach(t),Js=u(n),Fn=a(n,"P",{});var Ts=r(Fn);_o=a(Ts,"EM",{});var ws=r(_o);Ca=l(ws,`The pre-trained language models have achieved great successes in various natural language understanding (NLU) tasks
due to its capacity to capture the deep contextualized information in text by pre-training on large-scale corpora.
In this technical report, we present our practice of pre-training language models named NEZHA (NEural contextualiZed
representation for CHinese lAnguage understanding) on Chinese corpora and finetuning for the Chinese NLU tasks.
The current version of NEZHA is based on BERT with a collection of proven improvements, which include Functional
Relative Positional Encoding as an effective positional encoding scheme, Whole Word Masking strategy,
Mixed Precision Training and the LAMB Optimizer in training the models. The experimental results show that NEZHA
achieves the state-of-the-art performances when finetuned on several representative Chinese tasks, including
named entity recognition (People\u2019s Daily NER), sentence matching (LCQMC), Chinese sentiment classification (ChnSenti)
and natural language inference (XNLI).`),ws.forEach(t),Ts.forEach(t),Us=u(n),L=a(n,"P",{});var Ce=r(L);xa=l(Ce,"This model was contributed by "),Tt=a(Ce,"A",{href:!0,rel:!0});var zs=r(Tt);Za=l(zs,"sijunhe"),zs.forEach(t),Ia=l(Ce,". The original code can be found "),wt=a(Ce,"A",{href:!0,rel:!0});var ks=r(wt);Wa=l(ks,"here"),ks.forEach(t),Ga=l(Ce,"."),Ce.forEach(t),Fs=u(n),he=a(n,"H2",{class:!0});var Jn=r(he);Ie=a(Jn,"A",{id:!0,class:!0,href:!0});var vs=r(Ie);bo=a(vs,"SPAN",{});var Hd=r(bo);T(zt.$$.fragment,Hd),Hd.forEach(t),vs.forEach(t),Sa=u(Jn),yo=a(Jn,"SPAN",{});var Yd=r(yo);Pa=l(Yd,"Documentation resources"),Yd.forEach(t),Jn.forEach(t),Es=u(n),G=a(n,"UL",{});var D=r(G);Mo=a(D,"LI",{});var Od=r(Mo);En=a(Od,"A",{href:!0});var Ld=r(En);Va=l(Ld,"Text classification task guide"),Ld.forEach(t),Od.forEach(t),Aa=u(D),To=a(D,"LI",{});var Dd=r(To);Cn=a(Dd,"A",{href:!0});var Kd=r(Cn);qa=l(Kd,"Token classification task guide"),Kd.forEach(t),Dd.forEach(t),Ba=u(D),wo=a(D,"LI",{});var ec=r(wo);xn=a(ec,"A",{href:!0});var tc=r(xn);Ra=l(tc,"Question answering task guide"),tc.forEach(t),ec.forEach(t),Xa=u(D),zo=a(D,"LI",{});var nc=r(zo);Zn=a(nc,"A",{href:!0});var oc=r(Zn);Qa=l(oc,"Masked language modeling task guide"),oc.forEach(t),nc.forEach(t),Ha=u(D),ko=a(D,"LI",{});var sc=r(ko);In=a(sc,"A",{href:!0});var ac=r(In);Ya=l(ac,"Multiple choice task guide"),ac.forEach(t),sc.forEach(t),D.forEach(t),Cs=u(n),pe=a(n,"H2",{class:!0});var Ds=r(pe);We=a(Ds,"A",{id:!0,class:!0,href:!0});var rc=r(We);vo=a(rc,"SPAN",{});var ic=r(vo);T(kt.$$.fragment,ic),ic.forEach(t),rc.forEach(t),Oa=u(Ds),No=a(Ds,"SPAN",{});var lc=r(No);La=l(lc,"NezhaConfig"),lc.forEach(t),Ds.forEach(t),xs=u(n),A=a(n,"DIV",{class:!0});var ct=r(A);T(vt.$$.fragment,ct),Da=u(ct),me=a(ct,"P",{});var no=r(me);Ka=l(no,"This is the configuration class to store the configuration of an "),Wn=a(no,"A",{href:!0});var dc=r(Wn);er=l(dc,"NezhaModel"),dc.forEach(t),tr=l(no,`. It is used to instantiate an Nezha
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 Nezha
`),Nt=a(no,"A",{href:!0,rel:!0});var cc=r(Nt);nr=l(cc,"sijunhe/nezha-cn-base"),cc.forEach(t),or=l(no," architecture."),no.forEach(t),sr=u(ct),ue=a(ct,"P",{});var oo=r(ue);ar=l(oo,"Configuration objects inherit from "),Gn=a(oo,"A",{href:!0});var hc=r(Gn);rr=l(hc,"PretrainedConfig"),hc.forEach(t),ir=l(oo,` and can be used to control the model outputs. Read the
documentation from `),Sn=a(oo,"A",{href:!0});var pc=r(Sn);lr=l(pc,"PretrainedConfig"),pc.forEach(t),dr=l(oo," for more information."),oo.forEach(t),cr=u(ct),T(Ge.$$.fragment,ct),ct.forEach(t),Zs=u(n),fe=a(n,"H2",{class:!0});var Ks=r(fe);Se=a(Ks,"A",{id:!0,class:!0,href:!0});var mc=r(Se);$o=a(mc,"SPAN",{});var uc=r($o);T($t.$$.fragment,uc),uc.forEach(t),mc.forEach(t),hr=u(Ks),jo=a(Ks,"SPAN",{});var fc=r(jo);pr=l(fc,"NezhaModel"),fc.forEach(t),Ks.forEach(t),Is=u(n),j=a(n,"DIV",{class:!0});var P=r(j);T(jt.$$.fragment,P),mr=u(P),Jo=a(P,"P",{});var gc=r(Jo);ur=l(gc,"The bare Nezha Model transformer outputting raw hidden-states without any specific head on top."),gc.forEach(t),fr=u(P),Jt=a(P,"P",{});var ea=r(Jt);gr=l(ea,"This model inherits from "),Pn=a(ea,"A",{href:!0});var _c=r(Pn);_r=l(_c,"PreTrainedModel"),_c.forEach(t),br=l(ea,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ea.forEach(t),yr=u(P),Ut=a(P,"P",{});var ta=r(Ut);Mr=l(ta,"This model is also a PyTorch "),Ft=a(ta,"A",{href:!0,rel:!0});var bc=r(Ft);Tr=l(bc,"torch.nn.Module"),bc.forEach(t),wr=l(ta,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ta.forEach(t),zr=u(P),Et=a(P,"P",{});var na=r(Et);kr=l(na,`The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in `),Ct=a(na,"A",{href:!0,rel:!0});var yc=r(Ct);vr=l(yc,`Attention is
all you need`),yc.forEach(t),Nr=l(na,` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),na.forEach(t),$r=u(P),J=a(P,"P",{});var V=r(J);jr=l(V,"To behave as an decoder the model needs to be initialized with the "),Uo=a(V,"CODE",{});var Mc=r(Uo);Jr=l(Mc,"is_decoder"),Mc.forEach(t),Ur=l(V,` argument of the configuration set
to `),Fo=a(V,"CODE",{});var Tc=r(Fo);Fr=l(Tc,"True"),Tc.forEach(t),Er=l(V,". To be used in a Seq2Seq model, the model needs to initialized with both "),Eo=a(V,"CODE",{});var wc=r(Eo);Cr=l(wc,"is_decoder"),wc.forEach(t),xr=l(V,` argument and
`),Co=a(V,"CODE",{});var zc=r(Co);Zr=l(zc,"add_cross_attention"),zc.forEach(t),Ir=l(V," set to "),xo=a(V,"CODE",{});var kc=r(xo);Wr=l(kc,"True"),kc.forEach(t),Gr=l(V,"; an "),Zo=a(V,"CODE",{});var vc=r(Zo);Sr=l(vc,"encoder_hidden_states"),vc.forEach(t),Pr=l(V," is then expected as an input to the forward pass."),V.forEach(t),Vr=u(P),q=a(P,"DIV",{class:!0});var ht=r(q);T(xt.$$.fragment,ht),Ar=u(ht),ge=a(ht,"P",{});var so=r(ge);qr=l(so,"The "),Vn=a(so,"A",{href:!0});var Nc=r(Vn);Br=l(Nc,"NezhaModel"),Nc.forEach(t),Rr=l(so," forward method, overrides the "),Io=a(so,"CODE",{});var $c=r(Io);Xr=l($c,"__call__"),$c.forEach(t),Qr=l(so," special method."),so.forEach(t),Hr=u(ht),T(Pe.$$.fragment,ht),Yr=u(ht),T(Ve.$$.fragment,ht),ht.forEach(t),P.forEach(t),Ws=u(n),_e=a(n,"H2",{class:!0});var oa=r(_e);Ae=a(oa,"A",{id:!0,class:!0,href:!0});var jc=r(Ae);Wo=a(jc,"SPAN",{});var Jc=r(Wo);T(Zt.$$.fragment,Jc),Jc.forEach(t),jc.forEach(t),Or=u(oa),Go=a(oa,"SPAN",{});var Uc=r(Go);Lr=l(Uc,"NezhaForPreTraining"),Uc.forEach(t),oa.forEach(t),Gs=u(n),F=a(n,"DIV",{class:!0});var K=r(F);T(It.$$.fragment,K),Dr=u(K),be=a(K,"P",{});var ao=r(be);Kr=l(ao,"Nezha Model with two heads on top as done during the pretraining: a "),So=a(ao,"CODE",{});var Fc=r(So);ei=l(Fc,"masked language modeling"),Fc.forEach(t),ti=l(ao," head and a "),Po=a(ao,"CODE",{});var Ec=r(Po);ni=l(Ec,"next sentence prediction (classification)"),Ec.forEach(t),oi=l(ao," head."),ao.forEach(t),si=u(K),Wt=a(K,"P",{});var sa=r(Wt);ai=l(sa,"This model inherits from "),An=a(sa,"A",{href:!0});var Cc=r(An);ri=l(Cc,"PreTrainedModel"),Cc.forEach(t),ii=l(sa,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),sa.forEach(t),li=u(K),Gt=a(K,"P",{});var aa=r(Gt);di=l(aa,"This model is also a PyTorch "),St=a(aa,"A",{href:!0,rel:!0});var xc=r(St);ci=l(xc,"torch.nn.Module"),xc.forEach(t),hi=l(aa,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),aa.forEach(t),pi=u(K),B=a(K,"DIV",{class:!0});var pt=r(B);T(Pt.$$.fragment,pt),mi=u(pt),ye=a(pt,"P",{});var ro=r(ye);ui=l(ro,"The "),qn=a(ro,"A",{href:!0});var Zc=r(qn);fi=l(Zc,"NezhaForPreTraining"),Zc.forEach(t),gi=l(ro," forward method, overrides the "),Vo=a(ro,"CODE",{});var Ic=r(Vo);_i=l(Ic,"__call__"),Ic.forEach(t),bi=l(ro," special method."),ro.forEach(t),yi=u(pt),T(qe.$$.fragment,pt),Mi=u(pt),T(Be.$$.fragment,pt),pt.forEach(t),K.forEach(t),Ss=u(n),Me=a(n,"H2",{class:!0});var ra=r(Me);Re=a(ra,"A",{id:!0,class:!0,href:!0});var Wc=r(Re);Ao=a(Wc,"SPAN",{});var Gc=r(Ao);T(Vt.$$.fragment,Gc),Gc.forEach(t),Wc.forEach(t),Ti=u(ra),qo=a(ra,"SPAN",{});var Sc=r(qo);wi=l(Sc,"NezhaForMaskedLM"),Sc.forEach(t),ra.forEach(t),Ps=u(n),E=a(n,"DIV",{class:!0});var ee=r(E);T(At.$$.fragment,ee),zi=u(ee),qt=a(ee,"P",{});var ia=r(qt);ki=l(ia,"Nezha Model with a "),Bo=a(ia,"CODE",{});var Pc=r(Bo);vi=l(Pc,"language modeling"),Pc.forEach(t),Ni=l(ia," head on top."),ia.forEach(t),$i=u(ee),Bt=a(ee,"P",{});var la=r(Bt);ji=l(la,"This model inherits from "),Bn=a(la,"A",{href:!0});var Vc=r(Bn);Ji=l(Vc,"PreTrainedModel"),Vc.forEach(t),Ui=l(la,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),la.forEach(t),Fi=u(ee),Rt=a(ee,"P",{});var da=r(Rt);Ei=l(da,"This model is also a PyTorch "),Xt=a(da,"A",{href:!0,rel:!0});var Ac=r(Xt);Ci=l(Ac,"torch.nn.Module"),Ac.forEach(t),xi=l(da,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),da.forEach(t),Zi=u(ee),R=a(ee,"DIV",{class:!0});var mt=r(R);T(Qt.$$.fragment,mt),Ii=u(mt),Te=a(mt,"P",{});var io=r(Te);Wi=l(io,"The "),Rn=a(io,"A",{href:!0});var qc=r(Rn);Gi=l(qc,"NezhaForMaskedLM"),qc.forEach(t),Si=l(io," forward method, overrides the "),Ro=a(io,"CODE",{});var Bc=r(Ro);Pi=l(Bc,"__call__"),Bc.forEach(t),Vi=l(io," special method."),io.forEach(t),Ai=u(mt),T(Xe.$$.fragment,mt),qi=u(mt),T(Qe.$$.fragment,mt),mt.forEach(t),ee.forEach(t),Vs=u(n),we=a(n,"H2",{class:!0});var ca=r(we);He=a(ca,"A",{id:!0,class:!0,href:!0});var Rc=r(He);Xo=a(Rc,"SPAN",{});var Xc=r(Xo);T(Ht.$$.fragment,Xc),Xc.forEach(t),Rc.forEach(t),Bi=u(ca),Qo=a(ca,"SPAN",{});var Qc=r(Qo);Ri=l(Qc,"NezhaForNextSentencePrediction"),Qc.forEach(t),ca.forEach(t),As=u(n),C=a(n,"DIV",{class:!0});var te=r(C);T(Yt.$$.fragment,te),Xi=u(te),Ot=a(te,"P",{});var ha=r(Ot);Qi=l(ha,"Nezha Model with a "),Ho=a(ha,"CODE",{});var Hc=r(Ho);Hi=l(Hc,"next sentence prediction (classification)"),Hc.forEach(t),Yi=l(ha," head on top."),ha.forEach(t),Oi=u(te),Lt=a(te,"P",{});var pa=r(Lt);Li=l(pa,"This model inherits from "),Xn=a(pa,"A",{href:!0});var Yc=r(Xn);Di=l(Yc,"PreTrainedModel"),Yc.forEach(t),Ki=l(pa,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),pa.forEach(t),el=u(te),Dt=a(te,"P",{});var ma=r(Dt);tl=l(ma,"This model is also a PyTorch "),Kt=a(ma,"A",{href:!0,rel:!0});var Oc=r(Kt);nl=l(Oc,"torch.nn.Module"),Oc.forEach(t),ol=l(ma,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ma.forEach(t),sl=u(te),X=a(te,"DIV",{class:!0});var ut=r(X);T(en.$$.fragment,ut),al=u(ut),ze=a(ut,"P",{});var lo=r(ze);rl=l(lo,"The "),Qn=a(lo,"A",{href:!0});var Lc=r(Qn);il=l(Lc,"NezhaForNextSentencePrediction"),Lc.forEach(t),ll=l(lo," forward method, overrides the "),Yo=a(lo,"CODE",{});var Dc=r(Yo);dl=l(Dc,"__call__"),Dc.forEach(t),cl=l(lo," special method."),lo.forEach(t),hl=u(ut),T(Ye.$$.fragment,ut),pl=u(ut),T(Oe.$$.fragment,ut),ut.forEach(t),te.forEach(t),qs=u(n),ke=a(n,"H2",{class:!0});var ua=r(ke);Le=a(ua,"A",{id:!0,class:!0,href:!0});var Kc=r(Le);Oo=a(Kc,"SPAN",{});var eh=r(Oo);T(tn.$$.fragment,eh),eh.forEach(t),Kc.forEach(t),ml=u(ua),Lo=a(ua,"SPAN",{});var th=r(Lo);ul=l(th,"NezhaForSequenceClassification"),th.forEach(t),ua.forEach(t),Bs=u(n),x=a(n,"DIV",{class:!0});var ne=r(x);T(nn.$$.fragment,ne),fl=u(ne),Do=a(ne,"P",{});var nh=r(Do);gl=l(nh,`Nezha Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled
output) e.g. for GLUE tasks.`),nh.forEach(t),_l=u(ne),on=a(ne,"P",{});var fa=r(on);bl=l(fa,"This model inherits from "),Hn=a(fa,"A",{href:!0});var oh=r(Hn);yl=l(oh,"PreTrainedModel"),oh.forEach(t),Ml=l(fa,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),fa.forEach(t),Tl=u(ne),sn=a(ne,"P",{});var ga=r(sn);wl=l(ga,"This model is also a PyTorch "),an=a(ga,"A",{href:!0,rel:!0});var sh=r(an);zl=l(sh,"torch.nn.Module"),sh.forEach(t),kl=l(ga,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ga.forEach(t),vl=u(ne),S=a(ne,"DIV",{class:!0});var oe=r(S);T(rn.$$.fragment,oe),Nl=u(oe),ve=a(oe,"P",{});var co=r(ve);$l=l(co,"The "),Yn=a(co,"A",{href:!0});var ah=r(Yn);jl=l(ah,"NezhaForSequenceClassification"),ah.forEach(t),Jl=l(co," forward method, overrides the "),Ko=a(co,"CODE",{});var rh=r(Ko);Ul=l(rh,"__call__"),rh.forEach(t),Fl=l(co," special method."),co.forEach(t),El=u(oe),T(De.$$.fragment,oe),Cl=u(oe),T(Ke.$$.fragment,oe),xl=u(oe),T(et.$$.fragment,oe),oe.forEach(t),ne.forEach(t),Rs=u(n),Ne=a(n,"H2",{class:!0});var _a=r(Ne);tt=a(_a,"A",{id:!0,class:!0,href:!0});var ih=r(tt);es=a(ih,"SPAN",{});var lh=r(es);T(ln.$$.fragment,lh),lh.forEach(t),ih.forEach(t),Zl=u(_a),ts=a(_a,"SPAN",{});var dh=r(ts);Il=l(dh,"NezhaForMultipleChoice"),dh.forEach(t),_a.forEach(t),Xs=u(n),Z=a(n,"DIV",{class:!0});var se=r(Z);T(dn.$$.fragment,se),Wl=u(se),ns=a(se,"P",{});var ch=r(ns);Gl=l(ch,`Nezha 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.`),ch.forEach(t),Sl=u(se),cn=a(se,"P",{});var ba=r(cn);Pl=l(ba,"This model inherits from "),On=a(ba,"A",{href:!0});var hh=r(On);Vl=l(hh,"PreTrainedModel"),hh.forEach(t),Al=l(ba,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ba.forEach(t),ql=u(se),hn=a(se,"P",{});var ya=r(hn);Bl=l(ya,"This model is also a PyTorch "),pn=a(ya,"A",{href:!0,rel:!0});var ph=r(pn);Rl=l(ph,"torch.nn.Module"),ph.forEach(t),Xl=l(ya,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ya.forEach(t),Ql=u(se),Q=a(se,"DIV",{class:!0});var ft=r(Q);T(mn.$$.fragment,ft),Hl=u(ft),$e=a(ft,"P",{});var ho=r($e);Yl=l(ho,"The "),Ln=a(ho,"A",{href:!0});var mh=r(Ln);Ol=l(mh,"NezhaForMultipleChoice"),mh.forEach(t),Ll=l(ho," forward method, overrides the "),os=a(ho,"CODE",{});var uh=r(os);Dl=l(uh,"__call__"),uh.forEach(t),Kl=l(ho," special method."),ho.forEach(t),ed=u(ft),T(nt.$$.fragment,ft),td=u(ft),T(ot.$$.fragment,ft),ft.forEach(t),se.forEach(t),Qs=u(n),je=a(n,"H2",{class:!0});var Ma=r(je);st=a(Ma,"A",{id:!0,class:!0,href:!0});var fh=r(st);ss=a(fh,"SPAN",{});var gh=r(ss);T(un.$$.fragment,gh),gh.forEach(t),fh.forEach(t),nd=u(Ma),as=a(Ma,"SPAN",{});var _h=r(as);od=l(_h,"NezhaForTokenClassification"),_h.forEach(t),Ma.forEach(t),Hs=u(n),I=a(n,"DIV",{class:!0});var ae=r(I);T(fn.$$.fragment,ae),sd=u(ae),rs=a(ae,"P",{});var bh=r(rs);ad=l(bh,`Nezha 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.`),bh.forEach(t),rd=u(ae),gn=a(ae,"P",{});var Ta=r(gn);id=l(Ta,"This model inherits from "),Dn=a(Ta,"A",{href:!0});var yh=r(Dn);ld=l(yh,"PreTrainedModel"),yh.forEach(t),dd=l(Ta,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Ta.forEach(t),cd=u(ae),_n=a(ae,"P",{});var wa=r(_n);hd=l(wa,"This model is also a PyTorch "),bn=a(wa,"A",{href:!0,rel:!0});var Mh=r(bn);pd=l(Mh,"torch.nn.Module"),Mh.forEach(t),md=l(wa,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),wa.forEach(t),ud=u(ae),H=a(ae,"DIV",{class:!0});var gt=r(H);T(yn.$$.fragment,gt),fd=u(gt),Je=a(gt,"P",{});var po=r(Je);gd=l(po,"The "),Kn=a(po,"A",{href:!0});var Th=r(Kn);_d=l(Th,"NezhaForTokenClassification"),Th.forEach(t),bd=l(po," forward method, overrides the "),is=a(po,"CODE",{});var wh=r(is);yd=l(wh,"__call__"),wh.forEach(t),Md=l(po," special method."),po.forEach(t),Td=u(gt),T(at.$$.fragment,gt),wd=u(gt),T(rt.$$.fragment,gt),gt.forEach(t),ae.forEach(t),Ys=u(n),Ue=a(n,"H2",{class:!0});var za=r(Ue);it=a(za,"A",{id:!0,class:!0,href:!0});var zh=r(it);ls=a(zh,"SPAN",{});var kh=r(ls);T(Mn.$$.fragment,kh),kh.forEach(t),zh.forEach(t),zd=u(za),ds=a(za,"SPAN",{});var vh=r(ds);kd=l(vh,"NezhaForQuestionAnswering"),vh.forEach(t),za.forEach(t),Os=u(n),W=a(n,"DIV",{class:!0});var re=r(W);T(Tn.$$.fragment,re),vd=u(re),Fe=a(re,"P",{});var mo=r(Fe);Nd=l(mo,`Nezha 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 `),cs=a(mo,"CODE",{});var Nh=r(cs);$d=l(Nh,"span start logits"),Nh.forEach(t),jd=l(mo," and "),hs=a(mo,"CODE",{});var $h=r(hs);Jd=l($h,"span end logits"),$h.forEach(t),Ud=l(mo,")."),mo.forEach(t),Fd=u(re),wn=a(re,"P",{});var ka=r(wn);Ed=l(ka,"This model inherits from "),eo=a(ka,"A",{href:!0});var jh=r(eo);Cd=l(jh,"PreTrainedModel"),jh.forEach(t),xd=l(ka,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ka.forEach(t),Zd=u(re),zn=a(re,"P",{});var va=r(zn);Id=l(va,"This model is also a PyTorch "),kn=a(va,"A",{href:!0,rel:!0});var Jh=r(kn);Wd=l(Jh,"torch.nn.Module"),Jh.forEach(t),Gd=l(va,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),va.forEach(t),Sd=u(re),Y=a(re,"DIV",{class:!0});var _t=r(Y);T(vn.$$.fragment,_t),Pd=u(_t),Ee=a(_t,"P",{});var uo=r(Ee);Vd=l(uo,"The "),to=a(uo,"A",{href:!0});var Uh=r(to);Ad=l(Uh,"NezhaForQuestionAnswering"),Uh.forEach(t),qd=l(uo," forward method, overrides the "),ps=a(uo,"CODE",{});var Fh=r(ps);Bd=l(Fh,"__call__"),Fh.forEach(t),Rd=l(uo," special method."),uo.forEach(t),Xd=u(_t),T(lt.$$.fragment,_t),Qd=u(_t),T(dt.$$.fragment,_t),_t.forEach(t),re.forEach(t),this.h()},h(){p(d,"name","hf:doc:metadata"),p(d,"content",JSON.stringify(np)),p(h,"id","nezha"),p(h,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(h,"href","#nezha"),p(f,"class","relative group"),p(xe,"id","overview"),p(xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(xe,"href","#overview"),p(ce,"class","relative group"),p(Mt,"href","https://arxiv.org/abs/1909.00204"),p(Mt,"rel","nofollow"),p(Tt,"href","https://huggingface.co/sijunhe"),p(Tt,"rel","nofollow"),p(wt,"href","https://github.com/huawei-noah/Pretrained-Language-Model/tree/master/NEZHA-PyTorch"),p(wt,"rel","nofollow"),p(Ie,"id","documentation-resources"),p(Ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Ie,"href","#documentation-resources"),p(he,"class","relative group"),p(En,"href","../tasks/sequence_classification"),p(Cn,"href","../tasks/token_classification"),p(xn,"href","../tasks/question_answering"),p(Zn,"href","../tasks/masked_language_modeling"),p(In,"href","../tasks/multiple_choice"),p(We,"id","transformers.NezhaConfig"),p(We,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(We,"href","#transformers.NezhaConfig"),p(pe,"class","relative group"),p(Wn,"href","/docs/transformers/main/en/model_doc/nezha#transformers.NezhaModel"),p(Nt,"href","https://huggingface.co/sijunhe/nezha-cn-base"),p(Nt,"rel","nofollow"),p(Gn,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),p(Sn,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),p(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Se,"id","transformers.NezhaModel"),p(Se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Se,"href","#transformers.NezhaModel"),p(fe,"class","relative group"),p(Pn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),p(Ft,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(Ft,"rel","nofollow"),p(Ct,"href","https://arxiv.org/abs/1706.03762"),p(Ct,"rel","nofollow"),p(Vn,"href","/docs/transformers/main/en/model_doc/nezha#transformers.NezhaModel"),p(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ae,"id","transformers.NezhaForPreTraining"),p(Ae,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Ae,"href","#transformers.NezhaForPreTraining"),p(_e,"class","relative group"),p(An,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),p(St,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(St,"rel","nofollow"),p(qn,"href","/docs/transformers/main/en/model_doc/nezha#transformers.NezhaForPreTraining"),p(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Re,"id","transformers.NezhaForMaskedLM"),p(Re,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Re,"href","#transformers.NezhaForMaskedLM"),p(Me,"class","relative group"),p(Bn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),p(Xt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(Xt,"rel","nofollow"),p(Rn,"href","/docs/transformers/main/en/model_doc/nezha#transformers.NezhaForMaskedLM"),p(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(He,"id","transformers.NezhaForNextSentencePrediction"),p(He,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(He,"href","#transformers.NezhaForNextSentencePrediction"),p(we,"class","relative group"),p(Xn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),p(Kt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(Kt,"rel","nofollow"),p(Qn,"href","/docs/transformers/main/en/model_doc/nezha#transformers.NezhaForNextSentencePrediction"),p(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Le,"id","transformers.NezhaForSequenceClassification"),p(Le,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Le,"href","#transformers.NezhaForSequenceClassification"),p(ke,"class","relative group"),p(Hn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),p(an,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(an,"rel","nofollow"),p(Yn,"href","/docs/transformers/main/en/model_doc/nezha#transformers.NezhaForSequenceClassification"),p(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(tt,"id","transformers.NezhaForMultipleChoice"),p(tt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(tt,"href","#transformers.NezhaForMultipleChoice"),p(Ne,"class","relative group"),p(On,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),p(pn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(pn,"rel","nofollow"),p(Ln,"href","/docs/transformers/main/en/model_doc/nezha#transformers.NezhaForMultipleChoice"),p(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(st,"id","transformers.NezhaForTokenClassification"),p(st,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(st,"href","#transformers.NezhaForTokenClassification"),p(je,"class","relative group"),p(Dn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),p(bn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(bn,"rel","nofollow"),p(Kn,"href","/docs/transformers/main/en/model_doc/nezha#transformers.NezhaForTokenClassification"),p(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(it,"id","transformers.NezhaForQuestionAnswering"),p(it,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(it,"href","#transformers.NezhaForQuestionAnswering"),p(Ue,"class","relative group"),p(eo,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),p(kn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(kn,"rel","nofollow"),p(to,"href","/docs/transformers/main/en/model_doc/nezha#transformers.NezhaForQuestionAnswering"),p(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(n,g){e(document.head,d),b(n,y,g),b(n,f,g),e(f,h),e(h,_),w(o,_,null),e(f,c),e(f,$),e($,Na),b(n,Ns,g),b(n,ce,g),e(ce,xe),e(xe,fo),w(yt,fo,null),e(ce,$a),e(ce,go),e(go,ja),b(n,$s,g),b(n,Ze,g),e(Ze,Ja),e(Ze,Mt),e(Mt,Ua),e(Ze,Fa),b(n,js,g),b(n,Un,g),e(Un,Ea),b(n,Js,g),b(n,Fn,g),e(Fn,_o),e(_o,Ca),b(n,Us,g),b(n,L,g),e(L,xa),e(L,Tt),e(Tt,Za),e(L,Ia),e(L,wt),e(wt,Wa),e(L,Ga),b(n,Fs,g),b(n,he,g),e(he,Ie),e(Ie,bo),w(zt,bo,null),e(he,Sa),e(he,yo),e(yo,Pa),b(n,Es,g),b(n,G,g),e(G,Mo),e(Mo,En),e(En,Va),e(G,Aa),e(G,To),e(To,Cn),e(Cn,qa),e(G,Ba),e(G,wo),e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ye,X,null),e(X,pl),w(Oe,X,null),b(n,qs,g),b(n,ke,g),e(ke,Le),e(Le,Oo),w(tn,Oo,null),e(ke,ml),e(ke,Lo),e(Lo,ul),b(n,Bs,g),b(n,x,g),w(nn,x,null),e(x,fl),e(x,Do),e(Do,gl),e(x,_l),e(x,on),e(on,bl),e(on,Hn),e(Hn,yl),e(on,Ml),e(x,Tl),e(x,sn),e(sn,wl),e(sn,an),e(an,zl),e(sn,kl),e(x,vl),e(x,S),w(rn,S,null),e(S,Nl),e(S,ve),e(ve,$l),e(ve,Yn),e(Yn,jl),e(ve,Jl),e(ve,Ko),e(Ko,Ul),e(ve,Fl),e(S,El),w(De,S,null),e(S,Cl),w(Ke,S,null),e(S,xl),w(et,S,null),b(n,Rs,g),b(n,Ne,g),e(Ne,tt),e(tt,es),w(ln,es,null),e(Ne,Zl),e(Ne,ts),e(ts,Il),b(n,Xs,g),b(n,Z,g),w(dn,Z,null),e(Z,Wl),e(Z,ns),e(ns,Gl),e(Z,Sl),e(Z,cn),e(cn,Pl),e(cn,On),e(On,Vl),e(cn,Al),e(Z,ql),e(Z,hn),e(hn,Bl),e(hn,pn),e(pn,Rl),e(hn,Xl),e(Z,Ql),e(Z,Q),w(mn,Q,null),e(Q,Hl),e(Q,$e),e($e,Yl),e($e,Ln),e(Ln,Ol),e($e,Ll),e($e,os),e(os,Dl),e($e,Kl),e(Q,ed),w(nt,Q,null),e(Q,td),w(ot,Q,null),b(n,Qs,g),b(n,je,g),e(je,st),e(st,ss),w(un,ss,null),e(je,nd),e(je,as),e(as,od),b(n,Hs,g),b(n,I,g),w(fn,I,null),e(I,sd),e(I,rs),e(rs,ad),e(I,rd),e(I,gn),e(gn,id),e(gn,Dn),e(Dn,ld),e(gn,dd),e(I,cd),e(I,_n),e(_n,hd),e(_n,bn),e(bn,pd),e(_n,md),e(I,ud),e(I,H),w(yn,H,null),e(H,fd),e(H,Je),e(Je,gd),e(Je,Kn),e(Kn,_d),e(Je,bd),e(Je,is),e(is,yd),e(Je,Md),e(H,Td),w(at,H,null),e(H,wd),w(rt,H,null),b(n,Ys,g),b(n,Ue,g),e(Ue,it),e(it,ls),w(Mn,ls,null),e(Ue,zd),e(Ue,ds),e(ds,kd),b(n,Os,g),b(n,W,g),w(Tn,W,null),e(W,vd),e(W,Fe),e(Fe,Nd),e(Fe,cs),e(cs,$d),e(Fe,jd),e(Fe,hs),e(hs,Jd),e(Fe,Ud),e(W,Fd),e(W,wn),e(wn,Ed),e(wn,eo),e(eo,Cd),e(wn,xd),e(W,Zd),e(W,zn),e(zn,Id),e(zn,kn),e(kn,Wd),e(zn,Gd),e(W,Sd),e(W,Y),w(vn,Y,null),e(Y,Pd),e(Y,Ee),e(Ee,Vd),e(Ee,to),e(to,Ad),e(Ee,qd),e(Ee,ps),e(ps,Bd),e(Ee,Rd),e(Y,Xd),w(lt,Y,null),e(Y,Qd),w(dt,Y,null),Ls=!0},p(n,[g]){const Nn={};g&2&&(Nn.$$scope={dirty:g,ctx:n}),Ge.$set(Nn);const ms={};g&2&&(ms.$$scope={dirty:g,ctx:n}),Pe.$set(ms);const us={};g&2&&(us.$$scope={dirty:g,ctx:n}),Ve.$set(us);const fs={};g&2&&(fs.$$scope={dirty:g,ctx:n}),qe.$set(fs);const $n={};g&2&&($n.$$scope={dirty:g,ctx:n}),Be.$set($n);const gs={};g&2&&(gs.$$scope={dirty:g,ctx:n}),Xe.$set(gs);const _s={};g&2&&(_s.$$scope={dirty:g,ctx:n}),Qe.$set(_s);const bs={};g&2&&(bs.$$scope={dirty:g,ctx:n}),Ye.$set(bs);const jn={};g&2&&(jn.$$scope={dirty:g,ctx:n}),Oe.$set(jn);const ys={};g&2&&(ys.$$scope={dirty:g,ctx:n}),De.$set(ys);const Ms={};g&2&&(Ms.$$scope={dirty:g,ctx:n}),Ke.$set(Ms);const Ts={};g&2&&(Ts.$$scope={dirty:g,ctx:n}),et.$set(Ts);const ws={};g&2&&(ws.$$scope={dirty:g,ctx:n}),nt.$set(ws);const Ce={};g&2&&(Ce.$$scope={dirty:g,ctx:n}),ot.$set(Ce);const zs={};g&2&&(zs.$$scope={dirty:g,ctx:n}),at.$set(zs);const ks={};g&2&&(ks.$$scope={dirty:g,ctx:n}),rt.$set(ks);const Jn={};g&2&&(Jn.$$scope={dirty:g,ctx:n}),lt.$set(Jn);const vs={};g&2&&(vs.$$scope={dirty:g,ctx:n}),dt.$set(vs)},i(n){Ls||(z(o.$$.fragment,n),z(yt.$$.fragment,n),z(zt.$$.fragment,n),z(kt.$$.fragment,n),z(vt.$$.fragment,n),z(Ge.$$.fragment,n),z($t.$$.fragment,n),z(jt.$$.fragment,n),z(xt.$$.fragment,n),z(Pe.$$.fragment,n),z(Ve.$$.fragment,n),z(Zt.$$.fragment,n),z(It.$$.fragment,n),z(Pt.$$.fragment,n),z(qe.$$.fragment,n),z(Be.$$.fragment,n),z(Vt.$$.fragment,n),z(At.$$.fragment,n),z(Qt.$$.fragment,n),z(Xe.$$.fragment,n),z(Qe.$$.fragment,n),z(Ht.$$.fragment,n),z(Yt.$$.fragment,n),z(en.$$.fragment,n),z(Ye.$$.fragment,n),z(Oe.$$.fragment,n),z(tn.$$.fragment,n),z(nn.$$.fragment,n),z(rn.$$.fragment,n),z(De.$$.fragment,n),z(Ke.$$.fragment,n),z(et.$$.fragment,n),z(ln.$$.fragment,n),z(dn.$$.fragment,n),z(mn.$$.fragment,n),z(nt.$$.fragment,n),z(ot.$$.fragment,n),z(un.$$.fragment,n),z(fn.$$.fragment,n),z(yn.$$.fragment,n),z(at.$$.fragment,n),z(rt.$$.fragment,n),z(Mn.$$.fragment,n),z(Tn.$$.fragment,n),z(vn.$$.fragment,n),z(lt.$$.fragment,n),z(dt.$$.fragment,n),Ls=!0)},o(n){k(o.$$.fragment,n),k(yt.$$.fragment,n),k(zt.$$.fragment,n),k(kt.$$.fragment,n),k(vt.$$.fragment,n),k(Ge.$$.fragment,n),k($t.$$.fragment,n),k(jt.$$.fragment,n),k(xt.$$.fragment,n),k(Pe.$$.fragment,n),k(Ve.$$.fragment,n),k(Zt.$$.fragment,n),k(It.$$.fragment,n),k(Pt.$$.fragment,n),k(qe.$$.fragment,n),k(Be.$$.fragment,n),k(Vt.$$.fragment,n),k(At.$$.fragment,n),k(Qt.$$.fragment,n),k(Xe.$$.fragment,n),k(Qe.$$.fragment,n),k(Ht.$$.fragment,n),k(Yt.$$.fragment,n),k(en.$$.fragment,n),k(Ye.$$.fragment,n),k(Oe.$$.fragment,n),k(tn.$$.fragment,n),k(nn.$$.fragment,n),k(rn.$$.fragment,n),k(De.$$.fragment,n),k(Ke.$$.fragment,n),k(et.$$.fragment,n),k(ln.$$.fragment,n),k(dn.$$.fragment,n),k(mn.$$.fragment,n),k(nt.$$.fragment,n),k(ot.$$.fragment,n),k(un.$$.fragment,n),k(fn.$$.fragment,n),k(yn.$$.fragment,n),k(at.$$.fragment,n),k(rt.$$.fragment,n),k(Mn.$$.fragment,n),k(Tn.$$.fragment,n),k(vn.$$.fragment,n),k(lt.$$.fragment,n),k(dt.$$.fragment,n),Ls=!1},d(n){t(d),n&&t(y),n&&t(f),v(o),n&&t(Ns),n&&t(ce),v(yt),n&&t($s),n&&t(Ze),n&&t(js),n&&t(Un),n&&t(Js),n&&t(Fn),n&&t(Us),n&&t(L),n&&t(Fs),n&&t(he),v(zt),n&&t(Es),n&&t(G),n&&t(Cs),n&&t(pe),v(kt),n&&t(xs),n&&t(A),v(vt),v(Ge),n&&t(Zs),n&&t(fe),v($t),n&&t(Is),n&&t(j),v(jt),v(xt),v(Pe),v(Ve),n&&t(Ws),n&&t(_e),v(Zt),n&&t(Gs),n&&t(F),v(It),v(Pt),v(qe),v(Be),n&&t(Ss),n&&t(Me),v(Vt),n&&t(Ps),n&&t(E),v(At),v(Qt),v(Xe),v(Qe),n&&t(Vs),n&&t(we),v(Ht),n&&t(As),n&&t(C),v(Yt),v(en),v(Ye),v(Oe),n&&t(qs),n&&t(ke),v(tn),n&&t(Bs),n&&t(x),v(nn),v(rn),v(De),v(Ke),v(et),n&&t(Rs),n&&t(Ne),v(ln),n&&t(Xs),n&&t(Z),v(dn),v(mn),v(nt),v(ot),n&&t(Qs),n&&t(je),v(un),n&&t(Hs),n&&t(I),v(fn),v(yn),v(at),v(rt),n&&t(Ys),n&&t(Ue),v(Mn),n&&t(Os),n&&t(W),v(Tn),v(vn),v(lt),v(dt)}}}const np={local:"nezha",sections:[{local:"overview",title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.NezhaConfig",title:"NezhaConfig"},{local:"transformers.NezhaModel",title:"NezhaModel"},{local:"transformers.NezhaForPreTraining",title:"NezhaForPreTraining"},{local:"transformers.NezhaForMaskedLM",title:"NezhaForMaskedLM"},{local:"transformers.NezhaForNextSentencePrediction",title:"NezhaForNextSentencePrediction"},{local:"transformers.NezhaForSequenceClassification",title:"NezhaForSequenceClassification"},{local:"transformers.NezhaForMultipleChoice",title:"NezhaForMultipleChoice"},{local:"transformers.NezhaForTokenClassification",title:"NezhaForTokenClassification"},{local:"transformers.NezhaForQuestionAnswering",title:"NezhaForQuestionAnswering"}],title:"Nezha"};function op(N){return Ih(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class cp extends Eh{constructor(d){super();Ch(this,d,op,tp,xh,{})}}export{cp as default,np as metadata};
