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 w,h as l,b as p,G as e,g as b,y as T,q as z,o as v,B as k,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(n){d=a(n,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(n),w(h.$$.fragment,n)},m(n,c){b(n,d,c),e(d,y),b(n,f,c),T(h,n,c),_=!0},p:le,i(n){_||(z(h.$$.fragment,n),_=!0)},o(n){v(h.$$.fragment,n),_=!1},d(n){n&&t(d),n&&t(f),k(h,n)}}}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(n){d=a(n,"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(n,c){b(n,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(n){n&&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(n){d=a(n,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(n),w(h.$$.fragment,n)},m(n,c){b(n,d,c),e(d,y),b(n,f,c),T(h,n,c),_=!0},p:le,i(n){_||(z(h.$$.fragment,n),_=!0)},o(n){v(h.$$.fragment,n),_=!1},d(n){n&&t(d),n&&t(f),k(h,n)}}}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(n){d=a(n,"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(n,c){b(n,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(n){n&&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(n){d=a(n,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(n),w(h.$$.fragment,n)},m(n,c){b(n,d,c),e(d,y),b(n,f,c),T(h,n,c),_=!0},p:le,i(n){_||(z(h.$$.fragment,n),_=!0)},o(n){v(h.$$.fragment,n),_=!1},d(n){n&&t(d),n&&t(f),k(h,n)}}}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(n){d=a(n,"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(n,c){b(n,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(n){n&&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(n){d=a(n,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(n),w(h.$$.fragment,n)},m(n,c){b(n,d,c),e(d,y),b(n,f,c),T(h,n,c),_=!0},p:le,i(n){_||(z(h.$$.fragment,n),_=!0)},o(n){v(h.$$.fragment,n),_=!1},d(n){n&&t(d),n&&t(f),k(h,n)}}}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(n){d=a(n,"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(n,c){b(n,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(n){n&&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(n){d=a(n,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(n),w(h.$$.fragment,n)},m(n,c){b(n,d,c),e(d,y),b(n,f,c),T(h,n,c),_=!0},p:le,i(n){_||(z(h.$$.fragment,n),_=!0)},o(n){v(h.$$.fragment,n),_=!1},d(n){n&&t(d),n&&t(f),k(h,n)}}}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(n){d=a(n,"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(n,c){b(n,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(n){n&&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(n){d=a(n,"P",{});var c=r(d);y=l(c,"Example of single-label classification:"),c.forEach(t),f=u(n),w(h.$$.fragment,n)},m(n,c){b(n,d,c),e(d,y),b(n,f,c),T(h,n,c),_=!0},p:le,i(n){_||(z(h.$$.fragment,n),_=!0)},o(n){v(h.$$.fragment,n),_=!1},d(n){n&&t(d),n&&t(f),k(h,n)}}}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(n){d=a(n,"P",{});var c=r(d);y=l(c,"Example of multi-label classification:"),c.forEach(t),f=u(n),w(h.$$.fragment,n)},m(n,c){b(n,d,c),e(d,y),b(n,f,c),T(h,n,c),_=!0},p:le,i(n){_||(z(h.$$.fragment,n),_=!0)},o(n){v(h.$$.fragment,n),_=!1},d(n){n&&t(d),n&&t(f),k(h,n)}}}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(n){d=a(n,"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(n,c){b(n,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(n){n&&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(n){d=a(n,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(n),w(h.$$.fragment,n)},m(n,c){b(n,d,c),e(d,y),b(n,f,c),T(h,n,c),_=!0},p:le,i(n){_||(z(h.$$.fragment,n),_=!0)},o(n){v(h.$$.fragment,n),_=!1},d(n){n&&t(d),n&&t(f),k(h,n)}}}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(n){d=a(n,"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(n,c){b(n,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(n){n&&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(n){d=a(n,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(n),w(h.$$.fragment,n)},m(n,c){b(n,d,c),e(d,y),b(n,f,c),T(h,n,c),_=!0},p:le,i(n){_||(z(h.$$.fragment,n),_=!0)},o(n){v(h.$$.fragment,n),_=!1},d(n){n&&t(d),n&&t(f),k(h,n)}}}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(n){d=a(n,"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(n,c){b(n,d,c),e(d,y),e(d,f),e(f,h),e(d,_)},d(n){n&&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(n){d=a(n,"P",{});var c=r(d);y=l(c,"Example:"),c.forEach(t),f=u(n),w(h.$$.fragment,n)},m(n,c){b(n,d,c),e(d,y),b(n,f,c),T(h,n,c),_=!0},p:le,i(n){_||(z(h.$$.fragment,n),_=!0)},o(n){v(h.$$.fragment,n),_=!1},d(n){n&&t(d),n&&t(f),k(h,n)}}}function tp(N){let d,y,f,h,_,n,c,$,Na,Ns,ce,xe,fn,yt,$a,gn,ja,$s,Ze,Ja,Mt,Ua,Fa,js,Uo,Ea,Js,Fo,_n,Ca,Us,L,xa,wt,Za,Ia,Tt,Wa,Ga,Fs,he,Ie,bn,zt,Sa,yn,Pa,Es,G,Mn,Eo,Va,Aa,wn,Co,qa,Ba,Tn,xo,Ra,Xa,zn,Zo,Qa,Ha,vn,Io,Ya,Cs,pe,We,kn,vt,Oa,Nn,La,xs,A,kt,Da,me,Ka,Wo,er,tr,Nt,or,nr,sr,ue,ar,Go,rr,ir,So,lr,dr,cr,Ge,Zs,fe,Se,$n,$t,hr,jn,pr,Is,j,jt,mr,Jn,ur,fr,Jt,gr,Po,_r,br,yr,Ut,Mr,Ft,wr,Tr,zr,Et,vr,Ct,kr,Nr,$r,J,jr,Un,Jr,Ur,Fn,Fr,Er,En,Cr,xr,Cn,Zr,Ir,xn,Wr,Gr,Zn,Sr,Pr,Vr,q,xt,Ar,ge,qr,Vo,Br,Rr,In,Xr,Qr,Hr,Pe,Yr,Ve,Ws,_e,Ae,Wn,Zt,Or,Gn,Lr,Gs,F,It,Dr,be,Kr,Sn,ei,ti,Pn,oi,ni,si,Wt,ai,Ao,ri,ii,li,Gt,di,St,ci,hi,pi,B,Pt,mi,ye,ui,qo,fi,gi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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/model_doc/perceiver#transformers.PerceiverTokenizer.__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/model_doc/perceiver#transformers.PerceiverTokenizer.__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/model_doc/perceiver#transformers.PerceiverTokenizer.__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"}}),eo=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/model_doc/perceiver#transformers.PerceiverTokenizer.__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}}}),to=new O({}),oo=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"}}),ro=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/model_doc/perceiver#transformers.PerceiverTokenizer.__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}}}),io=new O({}),lo=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"}}),mo=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/model_doc/perceiver#transformers.PerceiverTokenizer.__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>
`}}),ot=new bt({props:{$$slots:{default:[Yh]},$$scope:{ctx:N}}}),nt=new ie({props:{anchor:"transformers.NezhaForMultipleChoice.forward.example",$$slots:{default:[Oh]},$$scope:{ctx:N}}}),uo=new O({}),fo=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"}}),yo=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/model_doc/perceiver#transformers.PerceiverTokenizer.__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}}}),Mo=new O({}),wo=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"}}),ko=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/model_doc/perceiver#transformers.PerceiverTokenizer.__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(n.$$.fragment),c=m(),$=s("span"),Na=i("Nezha"),Ns=m(),ce=s("h2"),xe=s("a"),fn=s("span"),M(yt.$$.fragment),$a=m(),gn=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(),Uo=s("p"),Ea=i("The abstract from the paper is the following:"),Js=m(),Fo=s("p"),_n=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 "),wt=s("a"),Za=i("sijunhe"),Ia=i(". The original code can be found "),Tt=s("a"),Wa=i("here"),Ga=i("."),Fs=m(),he=s("h2"),Ie=s("a"),bn=s("span"),M(zt.$$.fragment),Sa=m(),yn=s("span"),Pa=i("Documentation resources"),Es=m(),G=s("ul"),Mn=s("li"),Eo=s("a"),Va=i("Text classification task guide"),Aa=m(),wn=s("li"),Co=s("a"),qa=i("Token classification task guide"),Ba=m(),Tn=s("li"),xo=s("a"),Ra=i("Question answering task guide"),Xa=m(),zn=s("li"),Zo=s("a"),Qa=i("Masked language modeling task guide"),Ha=m(),vn=s("li"),Io=s("a"),Ya=i("Multiple choice task guide"),Cs=m(),pe=s("h2"),We=s("a"),kn=s("span"),M(vt.$$.fragment),Oa=m(),Nn=s("span"),La=i("NezhaConfig"),xs=m(),A=s("div"),M(kt.$$.fragment),Da=m(),me=s("p"),Ka=i("This is the configuration class to store the configuration of an "),Wo=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"),or=i("sijunhe/nezha-cn-base"),nr=i(" architecture."),sr=m(),ue=s("p"),ar=i("Configuration objects inherit from "),Go=s("a"),rr=i("PretrainedConfig"),ir=i(` and can be used to control the model outputs. Read the
documentation from `),So=s("a"),lr=i("PretrainedConfig"),dr=i(" for more information."),cr=m(),M(Ge.$$.fragment),Zs=m(),fe=s("h2"),Se=s("a"),$n=s("span"),M($t.$$.fragment),hr=m(),jn=s("span"),pr=i("NezhaModel"),Is=m(),j=s("div"),M(jt.$$.fragment),mr=m(),Jn=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 "),Po=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"),wr=i("torch.nn.Module"),Tr=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"),vr=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"),kr=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 "),Un=s("code"),Jr=i("is_decoder"),Ur=i(` argument of the configuration set
to `),Fn=s("code"),Fr=i("True"),Er=i(". To be used in a Seq2Seq model, the model needs to initialized with both "),En=s("code"),Cr=i("is_decoder"),xr=i(` argument and
`),Cn=s("code"),Zr=i("add_cross_attention"),Ir=i(" set to "),xn=s("code"),Wr=i("True"),Gr=i("; an "),Zn=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 "),Vo=s("a"),Br=i("NezhaModel"),Rr=i(" forward method, overrides the "),In=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"),Wn=s("span"),M(Zt.$$.fragment),Or=m(),Gn=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 "),Sn=s("code"),ei=i("masked language modeling"),ti=i(" head and a "),Pn=s("code"),oi=i("next sentence prediction (classification)"),ni=i(" head."),si=m(),Wt=s("p"),ai=i("This model inherits from "),Ao=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 "),qo=s("a"),fi=i("NezhaForPreTraining"),gi=i(" forward method, overrides the "),Vn=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"),An=s("span"),M(Vt.$$.fragment),wi=m(),qn=s("span"),Ti=i("NezhaForMaskedLM"),Ps=m(),E=s("div"),M(At.$$.fragment),zi=m(),qt=s("p"),vi=i("Nezha Model with a "),Bn=s("code"),ki=i("language modeling"),Ni=i(" head on top."),$i=m(),Bt=s("p"),ji=i("This model inherits from "),Bo=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(),we=s("p"),Wi=i("The "),Ro=s("a"),Gi=i("NezhaForMaskedLM"),Si=i(" forward method, overrides the "),Rn=s("code"),Pi=i("__call__"),Vi=i(" special method."),Ai=m(),M(Xe.$$.fragment),qi=m(),M(Qe.$$.fragment),Vs=m(),Te=s("h2"),He=s("a"),Xn=s("span"),M(Ht.$$.fragment),Bi=m(),Qn=s("span"),Ri=i("NezhaForNextSentencePrediction"),As=m(),C=s("div"),M(Yt.$$.fragment),Xi=m(),Ot=s("p"),Qi=i("Nezha Model with a "),Hn=s("code"),Hi=i("next sentence prediction (classification)"),Yi=i(" head on top."),Oi=m(),Lt=s("p"),Li=i("This model inherits from "),Xo=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"),ol=i("torch.nn.Module"),nl=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(eo.$$.fragment),al=m(),ze=s("p"),rl=i("The "),Qo=s("a"),il=i("NezhaForNextSentencePrediction"),ll=i(" forward method, overrides the "),Yn=s("code"),dl=i("__call__"),cl=i(" special method."),hl=m(),M(Ye.$$.fragment),pl=m(),M(Oe.$$.fragment),qs=m(),ve=s("h2"),Le=s("a"),On=s("span"),M(to.$$.fragment),ml=m(),Ln=s("span"),ul=i("NezhaForSequenceClassification"),Bs=m(),x=s("div"),M(oo.$$.fragment),fl=m(),Dn=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(),no=s("p"),bl=i("This model inherits from "),Ho=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.)`),wl=m(),so=s("p"),Tl=i("This model is also a PyTorch "),ao=s("a"),zl=i("torch.nn.Module"),vl=i(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),kl=m(),S=s("div"),M(ro.$$.fragment),Nl=m(),ke=s("p"),$l=i("The "),Yo=s("a"),jl=i("NezhaForSequenceClassification"),Jl=i(" forward method, overrides the "),Kn=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(io.$$.fragment),Zl=m(),ts=s("span"),Il=i("NezhaForMultipleChoice"),Xs=m(),Z=s("div"),M(lo.$$.fragment),Wl=m(),os=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(),co=s("p"),Pl=i("This model inherits from "),Oo=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(),ho=s("p"),Bl=i("This model is also a PyTorch "),po=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(mo.$$.fragment),Hl=m(),$e=s("p"),Yl=i("The "),Lo=s("a"),Ol=i("NezhaForMultipleChoice"),Ll=i(" forward method, overrides the "),ns=s("code"),Dl=i("__call__"),Kl=i(" special method."),ed=m(),M(ot.$$.fragment),td=m(),M(nt.$$.fragment),Qs=m(),je=s("h2"),st=s("a"),ss=s("span"),M(uo.$$.fragment),od=m(),as=s("span"),nd=i("NezhaForTokenClassification"),Hs=m(),I=s("div"),M(fo.$$.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(),go=s("p"),id=i("This model inherits from "),Do=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(),_o=s("p"),hd=i("This model is also a PyTorch "),bo=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(yo.$$.fragment),fd=m(),Je=s("p"),gd=i("The "),Ko=s("a"),_d=i("NezhaForTokenClassification"),bd=i(" forward method, overrides the "),is=s("code"),yd=i("__call__"),Md=i(" special method."),wd=m(),M(at.$$.fragment),Td=m(),M(rt.$$.fragment),Ys=m(),Ue=s("h2"),it=s("a"),ls=s("span"),M(Mo.$$.fragment),zd=m(),ds=s("span"),vd=i("NezhaForQuestionAnswering"),Os=m(),W=s("div"),M(wo.$$.fragment),kd=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(),To=s("p"),Ed=i("This model inherits from "),en=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(),zo=s("p"),Id=i("This model is also a PyTorch "),vo=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(ko.$$.fragment),Pd=m(),Ee=s("p"),Vd=i("The "),tn=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(o){const g=Zh('[data-svelte="svelte-1phssyn"]',document.head);d=a(g,"META",{name:!0,content:!0}),g.forEach(t),y=u(o),f=a(o,"H1",{class:!0});var No=r(f);h=a(No,"A",{id:!0,class:!0,href:!0});var ms=r(h);_=a(ms,"SPAN",{});var us=r(_);w(n.$$.fragment,us),us.forEach(t),ms.forEach(t),c=u(No),$=a(No,"SPAN",{});var fs=r($);Na=l(fs,"Nezha"),fs.forEach(t),No.forEach(t),Ns=u(o),ce=a(o,"H2",{class:!0});var $o=r(ce);xe=a($o,"A",{id:!0,class:!0,href:!0});var gs=r(xe);fn=a(gs,"SPAN",{});var _s=r(fn);w(yt.$$.fragment,_s),_s.forEach(t),gs.forEach(t),$a=u($o),gn=a($o,"SPAN",{});var bs=r(gn);ja=l(bs,"Overview"),bs.forEach(t),$o.forEach(t),$s=u(o),Ze=a(o,"P",{});var jo=r(Ze);Ja=l(jo,"The Nezha model was proposed in "),Mt=a(jo,"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(jo," by Junqiu Wei et al."),jo.forEach(t),js=u(o),Uo=a(o,"P",{});var Ms=r(Uo);Ea=l(Ms,"The abstract from the paper is the following:"),Ms.forEach(t),Js=u(o),Fo=a(o,"P",{});var ws=r(Fo);_n=a(ws,"EM",{});var Ts=r(_n);Ca=l(Ts,`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).`),Ts.forEach(t),ws.forEach(t),Us=u(o),L=a(o,"P",{});var Ce=r(L);xa=l(Ce,"This model was contributed by "),wt=a(Ce,"A",{href:!0,rel:!0});var zs=r(wt);Za=l(zs,"sijunhe"),zs.forEach(t),Ia=l(Ce,". The original code can be found "),Tt=a(Ce,"A",{href:!0,rel:!0});var vs=r(Tt);Wa=l(vs,"here"),vs.forEach(t),Ga=l(Ce,"."),Ce.forEach(t),Fs=u(o),he=a(o,"H2",{class:!0});var Jo=r(he);Ie=a(Jo,"A",{id:!0,class:!0,href:!0});var ks=r(Ie);bn=a(ks,"SPAN",{});var Hd=r(bn);w(zt.$$.fragment,Hd),Hd.forEach(t),ks.forEach(t),Sa=u(Jo),yn=a(Jo,"SPAN",{});var Yd=r(yn);Pa=l(Yd,"Documentation resources"),Yd.forEach(t),Jo.forEach(t),Es=u(o),G=a(o,"UL",{});var D=r(G);Mn=a(D,"LI",{});var Od=r(Mn);Eo=a(Od,"A",{href:!0});var Ld=r(Eo);Va=l(Ld,"Text classification task guide"),Ld.forEach(t),Od.forEach(t),Aa=u(D),wn=a(D,"LI",{});var Dd=r(wn);Co=a(Dd,"A",{href:!0});var Kd=r(Co);qa=l(Kd,"Token classification task guide"),Kd.forEach(t),Dd.forEach(t),Ba=u(D),Tn=a(D,"LI",{});var ec=r(Tn);xo=a(ec,"A",{href:!0});var tc=r(xo);Ra=l(tc,"Question answering task guide"),tc.forEach(t),ec.forEach(t),Xa=u(D),zn=a(D,"LI",{});var oc=r(zn);Zo=a(oc,"A",{href:!0});var nc=r(Zo);Qa=l(nc,"Masked language modeling task guide"),nc.forEach(t),oc.forEach(t),Ha=u(D),vn=a(D,"LI",{});var sc=r(vn);Io=a(sc,"A",{href:!0});var ac=r(Io);Ya=l(ac,"Multiple choice task guide"),ac.forEach(t),sc.forEach(t),D.forEach(t),Cs=u(o),pe=a(o,"H2",{class:!0});var Ds=r(pe);We=a(Ds,"A",{id:!0,class:!0,href:!0});var rc=r(We);kn=a(rc,"SPAN",{});var ic=r(kn);w(vt.$$.fragment,ic),ic.forEach(t),rc.forEach(t),Oa=u(Ds),Nn=a(Ds,"SPAN",{});var lc=r(Nn);La=l(lc,"NezhaConfig"),lc.forEach(t),Ds.forEach(t),xs=u(o),A=a(o,"DIV",{class:!0});var ct=r(A);w(kt.$$.fragment,ct),Da=u(ct),me=a(ct,"P",{});var on=r(me);Ka=l(on,"This is the configuration class to store the configuration of an "),Wo=a(on,"A",{href:!0});var dc=r(Wo);er=l(dc,"NezhaModel"),dc.forEach(t),tr=l(on,`. 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(on,"A",{href:!0,rel:!0});var cc=r(Nt);or=l(cc,"sijunhe/nezha-cn-base"),cc.forEach(t),nr=l(on," architecture."),on.forEach(t),sr=u(ct),ue=a(ct,"P",{});var nn=r(ue);ar=l(nn,"Configuration objects inherit from "),Go=a(nn,"A",{href:!0});var hc=r(Go);rr=l(hc,"PretrainedConfig"),hc.forEach(t),ir=l(nn,` and can be used to control the model outputs. Read the
documentation from `),So=a(nn,"A",{href:!0});var pc=r(So);lr=l(pc,"PretrainedConfig"),pc.forEach(t),dr=l(nn," for more information."),nn.forEach(t),cr=u(ct),w(Ge.$$.fragment,ct),ct.forEach(t),Zs=u(o),fe=a(o,"H2",{class:!0});var Ks=r(fe);Se=a(Ks,"A",{id:!0,class:!0,href:!0});var mc=r(Se);$n=a(mc,"SPAN",{});var uc=r($n);w($t.$$.fragment,uc),uc.forEach(t),mc.forEach(t),hr=u(Ks),jn=a(Ks,"SPAN",{});var fc=r(jn);pr=l(fc,"NezhaModel"),fc.forEach(t),Ks.forEach(t),Is=u(o),j=a(o,"DIV",{class:!0});var P=r(j);w(jt.$$.fragment,P),mr=u(P),Jn=a(P,"P",{});var gc=r(Jn);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 "),Po=a(ea,"A",{href:!0});var _c=r(Po);_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);wr=l(bc,"torch.nn.Module"),bc.forEach(t),Tr=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 oa=r(Et);vr=l(oa,`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(oa,"A",{href:!0,rel:!0});var yc=r(Ct);kr=l(yc,`Attention is
all you need`),yc.forEach(t),Nr=l(oa,` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),oa.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 "),Un=a(V,"CODE",{});var Mc=r(Un);Jr=l(Mc,"is_decoder"),Mc.forEach(t),Ur=l(V,` argument of the configuration set
to `),Fn=a(V,"CODE",{});var wc=r(Fn);Fr=l(wc,"True"),wc.forEach(t),Er=l(V,". To be used in a Seq2Seq model, the model needs to initialized with both "),En=a(V,"CODE",{});var Tc=r(En);Cr=l(Tc,"is_decoder"),Tc.forEach(t),xr=l(V,` argument and
`),Cn=a(V,"CODE",{});var zc=r(Cn);Zr=l(zc,"add_cross_attention"),zc.forEach(t),Ir=l(V," set to "),xn=a(V,"CODE",{});var vc=r(xn);Wr=l(vc,"True"),vc.forEach(t),Gr=l(V,"; an "),Zn=a(V,"CODE",{});var kc=r(Zn);Sr=l(kc,"encoder_hidden_states"),kc.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);w(xt.$$.fragment,ht),Ar=u(ht),ge=a(ht,"P",{});var sn=r(ge);qr=l(sn,"The "),Vo=a(sn,"A",{href:!0});var Nc=r(Vo);Br=l(Nc,"NezhaModel"),Nc.forEach(t),Rr=l(sn," forward method, overrides the "),In=a(sn,"CODE",{});var $c=r(In);Xr=l($c,"__call__"),$c.forEach(t),Qr=l(sn," special method."),sn.forEach(t),Hr=u(ht),w(Pe.$$.fragment,ht),Yr=u(ht),w(Ve.$$.fragment,ht),ht.forEach(t),P.forEach(t),Ws=u(o),_e=a(o,"H2",{class:!0});var na=r(_e);Ae=a(na,"A",{id:!0,class:!0,href:!0});var jc=r(Ae);Wn=a(jc,"SPAN",{});var Jc=r(Wn);w(Zt.$$.fragment,Jc),Jc.forEach(t),jc.forEach(t),Or=u(na),Gn=a(na,"SPAN",{});var Uc=r(Gn);Lr=l(Uc,"NezhaForPreTraining"),Uc.forEach(t),na.forEach(t),Gs=u(o),F=a(o,"DIV",{class:!0});var K=r(F);w(It.$$.fragment,K),Dr=u(K),be=a(K,"P",{});var an=r(be);Kr=l(an,"Nezha Model with two heads on top as done during the pretraining: a "),Sn=a(an,"CODE",{});var Fc=r(Sn);ei=l(Fc,"masked language modeling"),Fc.forEach(t),ti=l(an," head and a "),Pn=a(an,"CODE",{});var Ec=r(Pn);oi=l(Ec,"next sentence prediction (classification)"),Ec.forEach(t),ni=l(an," head."),an.forEach(t),si=u(K),Wt=a(K,"P",{});var sa=r(Wt);ai=l(sa,"This model inherits from "),Ao=a(sa,"A",{href:!0});var Cc=r(Ao);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);w(Pt.$$.fragment,pt),mi=u(pt),ye=a(pt,"P",{});var rn=r(ye);ui=l(rn,"The "),qo=a(rn,"A",{href:!0});var Zc=r(qo);fi=l(Zc,"NezhaForPreTraining"),Zc.forEach(t),gi=l(rn," forward method, overrides the "),Vn=a(rn,"CODE",{});var Ic=r(Vn);_i=l(Ic,"__call__"),Ic.forEach(t),bi=l(rn," special method."),rn.forEach(t),yi=u(pt),w(qe.$$.fragment,pt),Mi=u(pt),w(Be.$$.fragment,pt),pt.forEach(t),K.forEach(t),Ss=u(o),Me=a(o,"H2",{class:!0});var ra=r(Me);Re=a(ra,"A",{id:!0,class:!0,href:!0});var Wc=r(Re);An=a(Wc,"SPAN",{});var Gc=r(An);w(Vt.$$.fragment,Gc),Gc.forEach(t),Wc.forEach(t),wi=u(ra),qn=a(ra,"SPAN",{});var Sc=r(qn);Ti=l(Sc,"NezhaForMaskedLM"),Sc.forEach(t),ra.forEach(t),Ps=u(o),E=a(o,"DIV",{class:!0});var ee=r(E);w(At.$$.fragment,ee),zi=u(ee),qt=a(ee,"P",{});var ia=r(qt);vi=l(ia,"Nezha Model with a "),Bn=a(ia,"CODE",{});var Pc=r(Bn);ki=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 "),Bo=a(la,"A",{href:!0});var Vc=r(Bo);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);w(Qt.$$.fragment,mt),Ii=u(mt),we=a(mt,"P",{});var ln=r(we);Wi=l(ln,"The "),Ro=a(ln,"A",{href:!0});var qc=r(Ro);Gi=l(qc,"NezhaForMaskedLM"),qc.forEach(t),Si=l(ln," forward method, overrides the "),Rn=a(ln,"CODE",{});var Bc=r(Rn);Pi=l(Bc,"__call__"),Bc.forEach(t),Vi=l(ln," special method."),ln.forEach(t),Ai=u(mt),w(Xe.$$.fragment,mt),qi=u(mt),w(Qe.$$.fragment,mt),mt.forEach(t),ee.forEach(t),Vs=u(o),Te=a(o,"H2",{class:!0});var ca=r(Te);He=a(ca,"A",{id:!0,class:!0,href:!0});var Rc=r(He);Xn=a(Rc,"SPAN",{});var Xc=r(Xn);w(Ht.$$.fragment,Xc),Xc.forEach(t),Rc.forEach(t),Bi=u(ca),Qn=a(ca,"SPAN",{});var Qc=r(Qn);Ri=l(Qc,"NezhaForNextSentencePrediction"),Qc.forEach(t),ca.forEach(t),As=u(o),C=a(o,"DIV",{class:!0});var te=r(C);w(Yt.$$.fragment,te),Xi=u(te),Ot=a(te,"P",{});var ha=r(Ot);Qi=l(ha,"Nezha Model with a "),Hn=a(ha,"CODE",{});var Hc=r(Hn);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 "),Xo=a(pa,"A",{href:!0});var Yc=r(Xo);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);ol=l(Oc,"torch.nn.Module"),Oc.forEach(t),nl=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);w(eo.$$.fragment,ut),al=u(ut),ze=a(ut,"P",{});var dn=r(ze);rl=l(dn,"The "),Qo=a(dn,"A",{href:!0});var Lc=r(Qo);il=l(Lc,"NezhaForNextSentencePrediction"),Lc.forEach(t),ll=l(dn," forward method, overrides the "),Yn=a(dn,"CODE",{});var Dc=r(Yn);dl=l(Dc,"__call__"),Dc.forEach(t),cl=l(dn," special method."),dn.forEach(t),hl=u(ut),w(Ye.$$.fragment,ut),pl=u(ut),w(Oe.$$.fragment,ut),ut.forEach(t),te.forEach(t),qs=u(o),ve=a(o,"H2",{class:!0});var ua=r(ve);Le=a(ua,"A",{id:!0,class:!0,href:!0});var Kc=r(Le);On=a(Kc,"SPAN",{});var eh=r(On);w(to.$$.fragment,eh),eh.forEach(t),Kc.forEach(t),ml=u(ua),Ln=a(ua,"SPAN",{});var th=r(Ln);ul=l(th,"NezhaForSequenceClassification"),th.forEach(t),ua.forEach(t),Bs=u(o),x=a(o,"DIV",{class:!0});var oe=r(x);w(oo.$$.fragment,oe),fl=u(oe),Dn=a(oe,"P",{});var oh=r(Dn);gl=l(oh,`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.`),oh.forEach(t),_l=u(oe),no=a(oe,"P",{});var fa=r(no);bl=l(fa,"This model inherits from "),Ho=a(fa,"A",{href:!0});var nh=r(Ho);yl=l(nh,"PreTrainedModel"),nh.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),wl=u(oe),so=a(oe,"P",{});var ga=r(so);Tl=l(ga,"This model is also a PyTorch "),ao=a(ga,"A",{href:!0,rel:!0});var sh=r(ao);zl=l(sh,"torch.nn.Module"),sh.forEach(t),vl=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),kl=u(oe),S=a(oe,"DIV",{class:!0});var ne=r(S);w(ro.$$.fragment,ne),Nl=u(ne),ke=a(ne,"P",{});var cn=r(ke);$l=l(cn,"The "),Yo=a(cn,"A",{href:!0});var ah=r(Yo);jl=l(ah,"NezhaForSequenceClassification"),ah.forEach(t),Jl=l(cn," forward method, overrides the "),Kn=a(cn,"CODE",{});var rh=r(Kn);Ul=l(rh,"__call__"),rh.forEach(t),Fl=l(cn," special method."),cn.forEach(t),El=u(ne),w(De.$$.fragment,ne),Cl=u(ne),w(Ke.$$.fragment,ne),xl=u(ne),w(et.$$.fragment,ne),ne.forEach(t),oe.forEach(t),Rs=u(o),Ne=a(o,"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);w(io.$$.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(o),Z=a(o,"DIV",{class:!0});var se=r(Z);w(lo.$$.fragment,se),Wl=u(se),os=a(se,"P",{});var ch=r(os);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),co=a(se,"P",{});var ba=r(co);Pl=l(ba,"This model inherits from "),Oo=a(ba,"A",{href:!0});var hh=r(Oo);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),ho=a(se,"P",{});var ya=r(ho);Bl=l(ya,"This model is also a PyTorch "),po=a(ya,"A",{href:!0,rel:!0});var ph=r(po);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);w(mo.$$.fragment,ft),Hl=u(ft),$e=a(ft,"P",{});var hn=r($e);Yl=l(hn,"The "),Lo=a(hn,"A",{href:!0});var mh=r(Lo);Ol=l(mh,"NezhaForMultipleChoice"),mh.forEach(t),Ll=l(hn," forward method, overrides the "),ns=a(hn,"CODE",{});var uh=r(ns);Dl=l(uh,"__call__"),uh.forEach(t),Kl=l(hn," special method."),hn.forEach(t),ed=u(ft),w(ot.$$.fragment,ft),td=u(ft),w(nt.$$.fragment,ft),ft.forEach(t),se.forEach(t),Qs=u(o),je=a(o,"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);w(uo.$$.fragment,gh),gh.forEach(t),fh.forEach(t),od=u(Ma),as=a(Ma,"SPAN",{});var _h=r(as);nd=l(_h,"NezhaForTokenClassification"),_h.forEach(t),Ma.forEach(t),Hs=u(o),I=a(o,"DIV",{class:!0});var ae=r(I);w(fo.$$.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),go=a(ae,"P",{});var wa=r(go);id=l(wa,"This model inherits from "),Do=a(wa,"A",{href:!0});var yh=r(Do);ld=l(yh,"PreTrainedModel"),yh.forEach(t),dd=l(wa,`. 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.)`),wa.forEach(t),cd=u(ae),_o=a(ae,"P",{});var Ta=r(_o);hd=l(Ta,"This model is also a PyTorch "),bo=a(Ta,"A",{href:!0,rel:!0});var Mh=r(bo);pd=l(Mh,"torch.nn.Module"),Mh.forEach(t),md=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),ud=u(ae),H=a(ae,"DIV",{class:!0});var gt=r(H);w(yo.$$.fragment,gt),fd=u(gt),Je=a(gt,"P",{});var pn=r(Je);gd=l(pn,"The "),Ko=a(pn,"A",{href:!0});var wh=r(Ko);_d=l(wh,"NezhaForTokenClassification"),wh.forEach(t),bd=l(pn," forward method, overrides the "),is=a(pn,"CODE",{});var Th=r(is);yd=l(Th,"__call__"),Th.forEach(t),Md=l(pn," special method."),pn.forEach(t),wd=u(gt),w(at.$$.fragment,gt),Td=u(gt),w(rt.$$.fragment,gt),gt.forEach(t),ae.forEach(t),Ys=u(o),Ue=a(o,"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 vh=r(ls);w(Mo.$$.fragment,vh),vh.forEach(t),zh.forEach(t),zd=u(za),ds=a(za,"SPAN",{});var kh=r(ds);vd=l(kh,"NezhaForQuestionAnswering"),kh.forEach(t),za.forEach(t),Os=u(o),W=a(o,"DIV",{class:!0});var re=r(W);w(wo.$$.fragment,re),kd=u(re),Fe=a(re,"P",{});var mn=r(Fe);Nd=l(mn,`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(mn,"CODE",{});var Nh=r(cs);$d=l(Nh,"span start logits"),Nh.forEach(t),jd=l(mn," and "),hs=a(mn,"CODE",{});var $h=r(hs);Jd=l($h,"span end logits"),$h.forEach(t),Ud=l(mn,")."),mn.forEach(t),Fd=u(re),To=a(re,"P",{});var va=r(To);Ed=l(va,"This model inherits from "),en=a(va,"A",{href:!0});var jh=r(en);Cd=l(jh,"PreTrainedModel"),jh.forEach(t),xd=l(va,`. 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.)`),va.forEach(t),Zd=u(re),zo=a(re,"P",{});var ka=r(zo);Id=l(ka,"This model is also a PyTorch "),vo=a(ka,"A",{href:!0,rel:!0});var Jh=r(vo);Wd=l(Jh,"torch.nn.Module"),Jh.forEach(t),Gd=l(ka,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ka.forEach(t),Sd=u(re),Y=a(re,"DIV",{class:!0});var _t=r(Y);w(ko.$$.fragment,_t),Pd=u(_t),Ee=a(_t,"P",{});var un=r(Ee);Vd=l(un,"The "),tn=a(un,"A",{href:!0});var Uh=r(tn);Ad=l(Uh,"NezhaForQuestionAnswering"),Uh.forEach(t),qd=l(un," forward method, overrides the "),ps=a(un,"CODE",{});var Fh=r(ps);Bd=l(Fh,"__call__"),Fh.forEach(t),Rd=l(un," special method."),un.forEach(t),Xd=u(_t),w(lt.$$.fragment,_t),Qd=u(_t),w(dt.$$.fragment,_t),_t.forEach(t),re.forEach(t),this.h()},h(){p(d,"name","hf:doc:metadata"),p(d,"content",JSON.stringify(op)),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(wt,"href","https://huggingface.co/sijunhe"),p(wt,"rel","nofollow"),p(Tt,"href","https://github.com/huawei-noah/Pretrained-Language-Model/tree/master/NEZHA-PyTorch"),p(Tt,"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(Eo,"href","../tasks/sequence_classification"),p(Co,"href","../tasks/token_classification"),p(xo,"href","../tasks/question_answering"),p(Zo,"href","../tasks/masked_language_modeling"),p(Io,"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(Wo,"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(Go,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),p(So,"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(Po,"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(Vo,"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(Ao,"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(qo,"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(Bo,"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(Ro,"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(Te,"class","relative group"),p(Xo,"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(Qo,"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(ve,"class","relative group"),p(Ho,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),p(ao,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(ao,"rel","nofollow"),p(Yo,"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(Oo,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),p(po,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(po,"rel","nofollow"),p(Lo,"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(Do,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),p(bo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(bo,"rel","nofollow"),p(Ko,"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(en,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),p(vo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),p(vo,"rel","nofollow"),p(tn,"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(o,g){e(document.head,d),b(o,y,g),b(o,f,g),e(f,h),e(h,_),T(n,_,null),e(f,c),e(f,$),e($,Na),b(o,Ns,g),b(o,ce,g),e(ce,xe),e(xe,fn),T(yt,fn,null),e(ce,$a),e(ce,gn),e(gn,ja),b(o,$s,g),b(o,Ze,g),e(Ze,Ja),e(Ze,Mt),e(Mt,Ua),e(Ze,Fa),b(o,js,g),b(o,Uo,g),e(Uo,Ea),b(o,Js,g),b(o,Fo,g),e(Fo,_n),e(_n,Ca),b(o,Us,g),b(o,L,g),e(L,xa),e(L,wt),e(wt,Za),e(L,Ia),e(L,Tt),e(Tt,Wa),e(L,Ga),b(o,Fs,g),b(o,he,g),e(he,Ie),e(Ie,bn),T(zt,bn,null),e(he,Sa),e(he,yn),e(yn,Pa),b(o,Es,g),b(o,G,g),e(G,Mn),e(Mn,Eo),e(Eo,Va),e(G,Aa),e(G,wn),e(wn,Co),e(Co,qa),e(G,Ba),e(G,Tn),e(Tn,xo),e(xo,Ra),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e,X,null),b(o,qs,g),b(o,ve,g),e(ve,Le),e(Le,On),T(to,On,null),e(ve,ml),e(ve,Ln),e(Ln,ul),b(o,Bs,g),b(o,x,g),T(oo,x,null),e(x,fl),e(x,Dn),e(Dn,gl),e(x,_l),e(x,no),e(no,bl),e(no,Ho),e(Ho,yl),e(no,Ml),e(x,wl),e(x,so),e(so,Tl),e(so,ao),e(ao,zl),e(so,vl),e(x,kl),e(x,S),T(ro,S,null),e(S,Nl),e(S,ke),e(ke,$l),e(ke,Yo),e(Yo,jl),e(ke,Jl),e(ke,Kn),e(Kn,Ul),e(ke,Fl),e(S,El),T(De,S,null),e(S,Cl),T(Ke,S,null),e(S,xl),T(et,S,null),b(o,Rs,g),b(o,Ne,g),e(Ne,tt),e(tt,es),T(io,es,null),e(Ne,Zl),e(Ne,ts),e(ts,Il),b(o,Xs,g),b(o,Z,g),T(lo,Z,null),e(Z,Wl),e(Z,os),e(os,Gl),e(Z,Sl),e(Z,co),e(co,Pl),e(co,Oo),e(Oo,Vl),e(co,Al),e(Z,ql),e(Z,ho),e(ho,Bl),e(ho,po),e(po,Rl),e(ho,Xl),e(Z,Ql),e(Z,Q),T(mo,Q,null),e(Q,Hl),e(Q,$e),e($e,Yl),e($e,Lo),e(Lo,Ol),e($e,Ll),e($e,ns),e(ns,Dl),e($e,Kl),e(Q,ed),T(ot,Q,null),e(Q,td),T(nt,Q,null),b(o,Qs,g),b(o,je,g),e(je,st),e(st,ss),T(uo,ss,null),e(je,od),e(je,as),e(as,nd),b(o,Hs,g),b(o,I,g),T(fo,I,null),e(I,sd),e(I,rs),e(rs,ad),e(I,rd),e(I,go),e(go,id),e(go,Do),e(Do,ld),e(go,dd),e(I,cd),e(I,_o),e(_o,hd),e(_o,bo),e(bo,pd),e(_o,md),e(I,ud),e(I,H),T(yo,H,null),e(H,fd),e(H,Je),e(Je,gd),e(Je,Ko),e(Ko,_d),e(Je,bd),e(Je,is),e(is,yd),e(Je,Md),e(H,wd),T(at,H,null),e(H,Td),T(rt,H,null),b(o,Ys,g),b(o,Ue,g),e(Ue,it),e(it,ls),T(Mo,ls,null),e(Ue,zd),e(Ue,ds),e(ds,vd),b(o,Os,g),b(o,W,g),T(wo,W,null),e(W,kd),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,To),e(To,Ed),e(To,en),e(en,Cd),e(To,xd),e(W,Zd),e(W,zo),e(zo,Id),e(zo,vo),e(vo,Wd),e(zo,Gd),e(W,Sd),e(W,Y),T(ko,Y,null),e(Y,Pd),e(Y,Ee),e(Ee,Vd),e(Ee,tn),e(tn,Ad),e(Ee,qd),e(Ee,ps),e(ps,Bd),e(Ee,Rd),e(Y,Xd),T(lt,Y,null),e(Y,Qd),T(dt,Y,null),Ls=!0},p(o,[g]){const No={};g&2&&(No.$$scope={dirty:g,ctx:o}),Ge.$set(No);const ms={};g&2&&(ms.$$scope={dirty:g,ctx:o}),Pe.$set(ms);const us={};g&2&&(us.$$scope={dirty:g,ctx:o}),Ve.$set(us);const fs={};g&2&&(fs.$$scope={dirty:g,ctx:o}),qe.$set(fs);const $o={};g&2&&($o.$$scope={dirty:g,ctx:o}),Be.$set($o);const gs={};g&2&&(gs.$$scope={dirty:g,ctx:o}),Xe.$set(gs);const _s={};g&2&&(_s.$$scope={dirty:g,ctx:o}),Qe.$set(_s);const bs={};g&2&&(bs.$$scope={dirty:g,ctx:o}),Ye.$set(bs);const jo={};g&2&&(jo.$$scope={dirty:g,ctx:o}),Oe.$set(jo);const ys={};g&2&&(ys.$$scope={dirty:g,ctx:o}),De.$set(ys);const Ms={};g&2&&(Ms.$$scope={dirty:g,ctx:o}),Ke.$set(Ms);const ws={};g&2&&(ws.$$scope={dirty:g,ctx:o}),et.$set(ws);const Ts={};g&2&&(Ts.$$scope={dirty:g,ctx:o}),ot.$set(Ts);const Ce={};g&2&&(Ce.$$scope={dirty:g,ctx:o}),nt.$set(Ce);const zs={};g&2&&(zs.$$scope={dirty:g,ctx:o}),at.$set(zs);const vs={};g&2&&(vs.$$scope={dirty:g,ctx:o}),rt.$set(vs);const Jo={};g&2&&(Jo.$$scope={dirty:g,ctx:o}),lt.$set(Jo);const ks={};g&2&&(ks.$$scope={dirty:g,ctx:o}),dt.$set(ks)},i(o){Ls||(z(n.$$.fragment,o),z(yt.$$.fragment,o),z(zt.$$.fragment,o),z(vt.$$.fragment,o),z(kt.$$.fragment,o),z(Ge.$$.fragment,o),z($t.$$.fragment,o),z(jt.$$.fragment,o),z(xt.$$.fragment,o),z(Pe.$$.fragment,o),z(Ve.$$.fragment,o),z(Zt.$$.fragment,o),z(It.$$.fragment,o),z(Pt.$$.fragment,o),z(qe.$$.fragment,o),z(Be.$$.fragment,o),z(Vt.$$.fragment,o),z(At.$$.fragment,o),z(Qt.$$.fragment,o),z(Xe.$$.fragment,o),z(Qe.$$.fragment,o),z(Ht.$$.fragment,o),z(Yt.$$.fragment,o),z(eo.$$.fragment,o),z(Ye.$$.fragment,o),z(Oe.$$.fragment,o),z(to.$$.fragment,o),z(oo.$$.fragment,o),z(ro.$$.fragment,o),z(De.$$.fragment,o),z(Ke.$$.fragment,o),z(et.$$.fragment,o),z(io.$$.fragment,o),z(lo.$$.fragment,o),z(mo.$$.fragment,o),z(ot.$$.fragment,o),z(nt.$$.fragment,o),z(uo.$$.fragment,o),z(fo.$$.fragment,o),z(yo.$$.fragment,o),z(at.$$.fragment,o),z(rt.$$.fragment,o),z(Mo.$$.fragment,o),z(wo.$$.fragment,o),z(ko.$$.fragment,o),z(lt.$$.fragment,o),z(dt.$$.fragment,o),Ls=!0)},o(o){v(n.$$.fragment,o),v(yt.$$.fragment,o),v(zt.$$.fragment,o),v(vt.$$.fragment,o),v(kt.$$.fragment,o),v(Ge.$$.fragment,o),v($t.$$.fragment,o),v(jt.$$.fragment,o),v(xt.$$.fragment,o),v(Pe.$$.fragment,o),v(Ve.$$.fragment,o),v(Zt.$$.fragment,o),v(It.$$.fragment,o),v(Pt.$$.fragment,o),v(qe.$$.fragment,o),v(Be.$$.fragment,o),v(Vt.$$.fragment,o),v(At.$$.fragment,o),v(Qt.$$.fragment,o),v(Xe.$$.fragment,o),v(Qe.$$.fragment,o),v(Ht.$$.fragment,o),v(Yt.$$.fragment,o),v(eo.$$.fragment,o),v(Ye.$$.fragment,o),v(Oe.$$.fragment,o),v(to.$$.fragment,o),v(oo.$$.fragment,o),v(ro.$$.fragment,o),v(De.$$.fragment,o),v(Ke.$$.fragment,o),v(et.$$.fragment,o),v(io.$$.fragment,o),v(lo.$$.fragment,o),v(mo.$$.fragment,o),v(ot.$$.fragment,o),v(nt.$$.fragment,o),v(uo.$$.fragment,o),v(fo.$$.fragment,o),v(yo.$$.fragment,o),v(at.$$.fragment,o),v(rt.$$.fragment,o),v(Mo.$$.fragment,o),v(wo.$$.fragment,o),v(ko.$$.fragment,o),v(lt.$$.fragment,o),v(dt.$$.fragment,o),Ls=!1},d(o){t(d),o&&t(y),o&&t(f),k(n),o&&t(Ns),o&&t(ce),k(yt),o&&t($s),o&&t(Ze),o&&t(js),o&&t(Uo),o&&t(Js),o&&t(Fo),o&&t(Us),o&&t(L),o&&t(Fs),o&&t(he),k(zt),o&&t(Es),o&&t(G),o&&t(Cs),o&&t(pe),k(vt),o&&t(xs),o&&t(A),k(kt),k(Ge),o&&t(Zs),o&&t(fe),k($t),o&&t(Is),o&&t(j),k(jt),k(xt),k(Pe),k(Ve),o&&t(Ws),o&&t(_e),k(Zt),o&&t(Gs),o&&t(F),k(It),k(Pt),k(qe),k(Be),o&&t(Ss),o&&t(Me),k(Vt),o&&t(Ps),o&&t(E),k(At),k(Qt),k(Xe),k(Qe),o&&t(Vs),o&&t(Te),k(Ht),o&&t(As),o&&t(C),k(Yt),k(eo),k(Ye),k(Oe),o&&t(qs),o&&t(ve),k(to),o&&t(Bs),o&&t(x),k(oo),k(ro),k(De),k(Ke),k(et),o&&t(Rs),o&&t(Ne),k(io),o&&t(Xs),o&&t(Z),k(lo),k(mo),k(ot),k(nt),o&&t(Qs),o&&t(je),k(uo),o&&t(Hs),o&&t(I),k(fo),k(yo),k(at),k(rt),o&&t(Ys),o&&t(Ue),k(Mo),o&&t(Os),o&&t(W),k(wo),k(ko),k(lt),k(dt)}}}const op={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 np(N){return Ih(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class cp extends Eh{constructor(d){super();Ch(this,d,np,tp,xh,{})}}export{cp as default,op as metadata};
