import{S as Sf,i as If,s as jf,e as n,k as c,w as v,t as a,M as Df,c as r,d as t,m as h,a as s,x as y,h as i,b as l,G as e,g as _,y as T,q as E,o as w,B as $,v as Wf,L as hn}from"../../chunks/vendor-hf-doc-builder.js";import{T as Je}from"../../chunks/Tip-hf-doc-builder.js";import{D as P}from"../../chunks/Docstring-hf-doc-builder.js";import{C as St}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as W}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as cn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Hf(z){let p,b,f,u,k;return u=new St({props:{code:`from transformers import ErnieConfig, ErnieModel

# Initializing a ERNIE nghuyong/ernie-3.0-base-zh style configuration
configuration = ErnieConfig()

# Initializing a model (with random weights) from the nghuyong/ernie-3.0-base-zh style configuration
model = ErnieModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ErnieConfig, ErnieModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ERNIE nghuyong/ernie-3.0-base-zh style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = ErnieConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the nghuyong/ernie-3.0-base-zh style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieModel(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(){p=n("p"),b=a("Examples:"),f=c(),v(u.$$.fragment)},l(d){p=r(d,"P",{});var m=s(p);b=i(m,"Examples:"),m.forEach(t),f=h(d),y(u.$$.fragment,d)},m(d,m){_(d,p,m),e(p,b),_(d,f,m),T(u,d,m),k=!0},p:hn,i(d){k||(E(u.$$.fragment,d),k=!0)},o(d){w(u.$$.fragment,d),k=!1},d(d){d&&t(p),d&&t(f),$(u,d)}}}function Rf(z){let p,b,f,u,k;return{c(){p=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),k=a(`
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(d){p=r(d,"P",{});var m=s(p);b=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(m,"CODE",{});var M=s(f);u=i(M,"Module"),M.forEach(t),k=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(d,m){_(d,p,m),e(p,b),e(p,f),e(f,u),e(p,k)},d(d){d&&t(p)}}}function Bf(z){let p,b,f,u,k;return u=new St({props:{code:`from transformers import AutoTokenizer, ErnieModel
import torch

tokenizer = AutoTokenizer.from_pretrained("nghuyong/ernie-1.0-base-zh")
model = ErnieModel.from_pretrained("nghuyong/ernie-1.0-base-zh")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

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

tokenizer = AutoTokenizer.from_pretrained("nghuyong/ernie-1.0-base-zh")
model = ErnieForPreTraining.from_pretrained("nghuyong/ernie-1.0-base-zh")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

prediction_logits = outputs.prediction_logits
seq_relationship_logits = outputs.seq_relationship_logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ErnieForPreTraining
<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;nghuyong/ernie-1.0-base-zh&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieForPreTraining.from_pretrained(<span class="hljs-string">&quot;nghuyong/ernie-1.0-base-zh&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(){p=n("p"),b=a("Example:"),f=c(),v(u.$$.fragment)},l(d){p=r(d,"P",{});var m=s(p);b=i(m,"Example:"),m.forEach(t),f=h(d),y(u.$$.fragment,d)},m(d,m){_(d,p,m),e(p,b),_(d,f,m),T(u,d,m),k=!0},p:hn,i(d){k||(E(u.$$.fragment,d),k=!0)},o(d){w(u.$$.fragment,d),k=!1},d(d){d&&t(p),d&&t(f),$(u,d)}}}function Vf(z){let p,b,f,u,k;return{c(){p=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),k=a(`
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(d){p=r(d,"P",{});var m=s(p);b=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(m,"CODE",{});var M=s(f);u=i(M,"Module"),M.forEach(t),k=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(d,m){_(d,p,m),e(p,b),e(p,f),e(f,u),e(p,k)},d(d){d&&t(p)}}}function Gf(z){let p,b,f,u,k;return u=new St({props:{code:`import torch
from transformers import AutoTokenizer, ErnieForCausalLM

tokenizer = AutoTokenizer.from_pretrained("nghuyong/ernie-1.0-base-zh")
model = ErnieForCausalLM.from_pretrained("nghuyong/ernie-1.0-base-zh")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs, labels=inputs["input_ids"])
loss = outputs.loss
logits = outputs.logits`,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, ErnieForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;nghuyong/ernie-1.0-base-zh&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieForCausalLM.from_pretrained(<span class="hljs-string">&quot;nghuyong/ernie-1.0-base-zh&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, labels=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){p=n("p"),b=a("Example:"),f=c(),v(u.$$.fragment)},l(d){p=r(d,"P",{});var m=s(p);b=i(m,"Example:"),m.forEach(t),f=h(d),y(u.$$.fragment,d)},m(d,m){_(d,p,m),e(p,b),_(d,f,m),T(u,d,m),k=!0},p:hn,i(d){k||(E(u.$$.fragment,d),k=!0)},o(d){w(u.$$.fragment,d),k=!1},d(d){d&&t(p),d&&t(f),$(u,d)}}}function Kf(z){let p,b,f,u,k;return{c(){p=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),k=a(`
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(d){p=r(d,"P",{});var m=s(p);b=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(m,"CODE",{});var M=s(f);u=i(M,"Module"),M.forEach(t),k=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(d,m){_(d,p,m),e(p,b),e(p,f),e(f,u),e(p,k)},d(d){d&&t(p)}}}function Jf(z){let p,b,f,u,k;return u=new St({props:{code:`from transformers import AutoTokenizer, ErnieForMaskedLM
import torch

tokenizer = AutoTokenizer.from_pretrained("nghuyong/ernie-1.0-base-zh")
model = ErnieForMaskedLM.from_pretrained("nghuyong/ernie-1.0-base-zh")

inputs = tokenizer("The capital of France is [MASK].", return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

# retrieve index of [MASK]
mask_token_index = (inputs.input_ids == tokenizer.mask_token_id)[0].nonzero(as_tuple=True)[0]

predicted_token_id = logits[0, mask_token_index].argmax(axis=-1)
tokenizer.decode(predicted_token_id)

labels = tokenizer("The capital of France is Paris.", return_tensors="pt")["input_ids"]
# mask labels of non-[MASK] tokens
labels = torch.where(inputs.input_ids == tokenizer.mask_token_id, labels, -100)

outputs = model(**inputs, labels=labels)
round(outputs.loss.item(), 2)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ErnieForMaskedLM
<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;nghuyong/ernie-1.0-base-zh&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieForMaskedLM.from_pretrained(<span class="hljs-string">&quot;nghuyong/ernie-1.0-base-zh&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>tokenizer.decode(predicted_token_id)
<span class="hljs-string">&#x27;paris&#x27;</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)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(outputs.loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">0.88</span>`}}),{c(){p=n("p"),b=a("Example:"),f=c(),v(u.$$.fragment)},l(d){p=r(d,"P",{});var m=s(p);b=i(m,"Example:"),m.forEach(t),f=h(d),y(u.$$.fragment,d)},m(d,m){_(d,p,m),e(p,b),_(d,f,m),T(u,d,m),k=!0},p:hn,i(d){k||(E(u.$$.fragment,d),k=!0)},o(d){w(u.$$.fragment,d),k=!1},d(d){d&&t(p),d&&t(f),$(u,d)}}}function Yf(z){let p,b,f,u,k;return{c(){p=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),k=a(`
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(d){p=r(d,"P",{});var m=s(p);b=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(m,"CODE",{});var M=s(f);u=i(M,"Module"),M.forEach(t),k=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(d,m){_(d,p,m),e(p,b),e(p,f),e(f,u),e(p,k)},d(d){d&&t(p)}}}function Xf(z){let p,b,f,u,k;return u=new St({props:{code:`from transformers import AutoTokenizer, ErnieForNextSentencePrediction
import torch

tokenizer = AutoTokenizer.from_pretrained("nghuyong/ernie-1.0-base-zh")
model = ErnieForNextSentencePrediction.from_pretrained("nghuyong/ernie-1.0-base-zh")

prompt = "In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."
next_sentence = "The sky is blue due to the shorter wavelength of blue light."
encoding = tokenizer(prompt, next_sentence, return_tensors="pt")

outputs = model(**encoding, labels=torch.LongTensor([1]))
logits = outputs.logits
assert logits[0, 0] < logits[0, 1]  # next sentence was random`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ErnieForNextSentencePrediction
<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;nghuyong/ernie-1.0-base-zh&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieForNextSentencePrediction.from_pretrained(<span class="hljs-string">&quot;nghuyong/ernie-1.0-base-zh&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(){p=n("p"),b=a("Example:"),f=c(),v(u.$$.fragment)},l(d){p=r(d,"P",{});var m=s(p);b=i(m,"Example:"),m.forEach(t),f=h(d),y(u.$$.fragment,d)},m(d,m){_(d,p,m),e(p,b),_(d,f,m),T(u,d,m),k=!0},p:hn,i(d){k||(E(u.$$.fragment,d),k=!0)},o(d){w(u.$$.fragment,d),k=!1},d(d){d&&t(p),d&&t(f),$(u,d)}}}function Zf(z){let p,b,f,u,k;return{c(){p=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),k=a(`
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(d){p=r(d,"P",{});var m=s(p);b=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(m,"CODE",{});var M=s(f);u=i(M,"Module"),M.forEach(t),k=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(d,m){_(d,p,m),e(p,b),e(p,f),e(f,u),e(p,k)},d(d){d&&t(p)}}}function eg(z){let p,b,f,u,k;return{c(){p=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),k=a(`
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(d){p=r(d,"P",{});var m=s(p);b=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(m,"CODE",{});var M=s(f);u=i(M,"Module"),M.forEach(t),k=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(d,m){_(d,p,m),e(p,b),e(p,f),e(f,u),e(p,k)},d(d){d&&t(p)}}}function tg(z){let p,b,f,u,k;return u=new St({props:{code:`from transformers import AutoTokenizer, ErnieForMultipleChoice
import torch

tokenizer = AutoTokenizer.from_pretrained("nghuyong/ernie-1.0-base-zh")
model = ErnieForMultipleChoice.from_pretrained("nghuyong/ernie-1.0-base-zh")

prompt = "In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."
choice0 = "It is eaten with a fork and a knife."
choice1 = "It is eaten while held in the hand."
labels = torch.tensor(0).unsqueeze(0)  # choice0 is correct (according to Wikipedia ;)), batch size 1

encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors="pt", padding=True)
outputs = model(**{k: v.unsqueeze(0) for k, v in encoding.items()}, labels=labels)  # batch size is 1

# the linear classifier still needs to be trained
loss = outputs.loss
logits = outputs.logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ErnieForMultipleChoice
<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;nghuyong/ernie-1.0-base-zh&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;nghuyong/ernie-1.0-base-zh&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(){p=n("p"),b=a("Example:"),f=c(),v(u.$$.fragment)},l(d){p=r(d,"P",{});var m=s(p);b=i(m,"Example:"),m.forEach(t),f=h(d),y(u.$$.fragment,d)},m(d,m){_(d,p,m),e(p,b),_(d,f,m),T(u,d,m),k=!0},p:hn,i(d){k||(E(u.$$.fragment,d),k=!0)},o(d){w(u.$$.fragment,d),k=!1},d(d){d&&t(p),d&&t(f),$(u,d)}}}function og(z){let p,b,f,u,k;return{c(){p=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),k=a(`
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(d){p=r(d,"P",{});var m=s(p);b=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(m,"CODE",{});var M=s(f);u=i(M,"Module"),M.forEach(t),k=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(d,m){_(d,p,m),e(p,b),e(p,f),e(f,u),e(p,k)},d(d){d&&t(p)}}}function ng(z){let p,b,f,u,k;return{c(){p=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),k=a(`
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(d){p=r(d,"P",{});var m=s(p);b=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(m,"CODE",{});var M=s(f);u=i(M,"Module"),M.forEach(t),k=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(t)},m(d,m){_(d,p,m),e(p,b),e(p,f),e(f,u),e(p,k)},d(d){d&&t(p)}}}function rg(z){let p,b,f,u,k,d,m,M,ci,Xs,he,Ye,jr,It,hi,Dr,pi,Zs,Z,mi,jt,ui,fi,Dt,gi,_i,ea,pe,Xe,Wr,Wt,ki,Hr,bi,ta,Ht,oa,me,Ze,Rr,Rt,vi,Br,yi,na,et,Qr,ue,pn,Ti,Ei,mn,wi,$i,un,zi,Mi,F,fe,fn,Fi,xi,gn,Pi,Ci,_n,qi,Ai,ge,kn,Ni,Oi,bn,Li,Si,vn,Ii,ji,_e,yn,Di,Wi,Tn,Hi,Ri,En,Bi,Qi,ke,wn,Ui,Vi,$n,Gi,Ki,zn,Ji,Yi,be,Mn,Xi,Zi,Fn,ed,td,xn,od,nd,ve,Pn,rd,sd,Cn,ad,id,qn,dd,ld,ye,An,cd,hd,Nn,pd,md,On,ud,fd,Te,Ln,gd,_d,Sn,kd,bd,In,vd,yd,Ee,jn,Td,Ed,Dn,wd,$d,Wn,zd,Md,we,Hn,Fd,xd,Rn,Pd,Cd,Bn,qd,ra,Q,Ad,Bt,Nd,Od,Qt,Ld,Sd,Ut,Id,jd,sa,$e,tt,Ur,Vt,Dd,Vr,Wd,aa,B,Gt,Hd,X,Rd,Qn,Bd,Qd,Gr,Ud,Vd,Kt,Gd,Kd,Jd,ze,Yd,Un,Xd,Zd,Vn,el,tl,ol,ot,ia,Me,nt,Kr,Jt,nl,Jr,rl,da,Fe,Yt,sl,Xt,al,Gn,il,dl,la,xe,rt,Yr,Zt,ll,Xr,cl,ca,C,eo,hl,Zr,pl,ml,to,ul,Kn,fl,gl,_l,oo,kl,no,bl,vl,yl,ro,Tl,so,El,wl,$l,q,zl,es,Ml,Fl,ts,xl,Pl,os,Cl,ql,ns,Al,Nl,rs,Ol,Ll,ss,Sl,Il,jl,U,ao,Dl,Pe,Wl,Jn,Hl,Rl,as,Bl,Ql,Ul,st,Vl,at,ha,Ce,it,is,io,Gl,ds,Kl,pa,A,lo,Jl,qe,Yl,ls,Xl,Zl,cs,ec,tc,oc,co,nc,Yn,rc,sc,ac,ho,ic,po,dc,lc,cc,V,mo,hc,Ae,pc,Xn,mc,uc,hs,fc,gc,_c,dt,kc,lt,ma,Ne,ct,ps,uo,bc,ms,vc,ua,N,fo,yc,go,Tc,us,Ec,wc,$c,_o,zc,Zn,Mc,Fc,xc,ko,Pc,bo,Cc,qc,Ac,G,vo,Nc,Oe,Oc,er,Lc,Sc,fs,Ic,jc,Dc,ht,Wc,pt,fa,Le,mt,gs,yo,Hc,_s,Rc,ga,O,To,Bc,Eo,Qc,ks,Uc,Vc,Gc,wo,Kc,tr,Jc,Yc,Xc,$o,Zc,zo,eh,th,oh,K,Mo,nh,Se,rh,or,sh,ah,bs,ih,dh,lh,ut,ch,ft,_a,Ie,gt,vs,Fo,hh,ys,ph,ka,L,xo,mh,Po,uh,Ts,fh,gh,_h,Co,kh,nr,bh,vh,yh,qo,Th,Ao,Eh,wh,$h,J,No,zh,je,Mh,rr,Fh,xh,Es,Ph,Ch,qh,_t,Ah,kt,ba,De,bt,ws,Oo,Nh,$s,Oh,va,S,Lo,Lh,zs,Sh,Ih,So,jh,sr,Dh,Wh,Hh,Io,Rh,jo,Bh,Qh,Uh,ee,Do,Vh,We,Gh,ar,Kh,Jh,Ms,Yh,Xh,Zh,vt,ya,He,yt,Fs,Wo,ep,xs,tp,Ta,I,Ho,op,Ps,np,rp,Ro,sp,ir,ap,ip,dp,Bo,lp,Qo,cp,hp,pp,Y,Uo,mp,Re,up,dr,fp,gp,Cs,_p,kp,bp,Tt,vp,Et,Ea,Be,wt,qs,Vo,yp,As,Tp,wa,j,Go,Ep,Ns,wp,$p,Ko,zp,lr,Mp,Fp,xp,Jo,Pp,Yo,Cp,qp,Ap,te,Xo,Np,Qe,Op,cr,Lp,Sp,Os,Ip,jp,Dp,$t,$a,Ue,zt,Ls,Zo,Wp,Ss,Hp,za,D,en,Rp,Ve,Bp,Is,Qp,Up,js,Vp,Gp,Kp,tn,Jp,hr,Yp,Xp,Zp,on,em,nn,tm,om,nm,oe,rn,rm,Ge,sm,pr,am,im,Ds,dm,lm,cm,Mt,Ma;return d=new W({}),It=new W({}),Wt=new W({}),Ht=new St({props:{code:`from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("nghuyong/ernie-1.0-base-zh")
model = AutoModel.from_pretrained("nghuyong/ernie-1.0-base-zh")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;nghuyong/ernie-1.0-base-zh&quot;</span>)
model = AutoModel.from_pretrained(<span class="hljs-string">&quot;nghuyong/ernie-1.0-base-zh&quot;</span>)`}}),Rt=new W({}),Vt=new W({}),Gt=new P({props:{name:"class transformers.ErnieConfig",anchor:"transformers.ErnieConfig",parameters:[{name:"vocab_size",val:" = 30522"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"max_position_embeddings",val:" = 512"},{name:"type_vocab_size",val:" = 2"},{name:"task_type_vocab_size",val:" = 3"},{name:"use_task_id",val:" = False"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"pad_token_id",val:" = 0"},{name:"position_embedding_type",val:" = 'absolute'"},{name:"use_cache",val:" = True"},{name:"classifier_dropout",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ErnieConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the ERNIE model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/ernie#transformers.ErnieModel">ErnieModel</a> or <code>TFErnieModel</code>.`,name:"vocab_size"},{anchor:"transformers.ErnieConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.ErnieConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.ErnieConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.ErnieConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.ErnieConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.ErnieConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, 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.ErnieConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.ErnieConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.ErnieConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/ernie#transformers.ErnieModel">ErnieModel</a> or <code>TFErnieModel</code>.`,name:"type_vocab_size"},{anchor:"transformers.ErnieConfig.task_type_vocab_size",description:`<strong>task_type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The vocabulary size of the <code>task_type_ids</code> for ERNIE2.0/ERNIE3.0 model`,name:"task_type_vocab_size"},{anchor:"transformers.ErnieConfig.use_task_id",description:`<strong>use_task_id</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the model support <code>task_type_ids</code>`,name:"use_task_id"},{anchor:"transformers.ErnieConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.ErnieConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.ErnieConfig.position_embedding_type",description:`<strong>position_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;absolute&quot;</code>) &#x2014;
Type of position embedding. Choose one of <code>&quot;absolute&quot;</code>, <code>&quot;relative_key&quot;</code>, <code>&quot;relative_key_query&quot;</code>. For
positional embeddings use <code>&quot;absolute&quot;</code>. For more information on <code>&quot;relative_key&quot;</code>, please refer to
<a href="https://arxiv.org/abs/1803.02155" rel="nofollow">Self-Attention with Relative Position Representations (Shaw et al.)</a>.
For more information on <code>&quot;relative_key_query&quot;</code>, please refer to <em>Method 4</em> in <a href="https://arxiv.org/abs/2009.13658" rel="nofollow">Improve Transformer Models
with Better Relative Position Embeddings (Huang et al.)</a>.`,name:"position_embedding_type"},{anchor:"transformers.ErnieConfig.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"},{anchor:"transformers.ErnieConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if <code>config.is_decoder=True</code>.`,name:"use_cache"},{anchor:"transformers.ErnieConfig.classifier_dropout",description:`<strong>classifier_dropout</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The dropout ratio for the classification head.`,name:"classifier_dropout"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/ernie/configuration_ernie.py#L41"}}),ot=new cn({props:{anchor:"transformers.ErnieConfig.example",$$slots:{default:[Hf]},$$scope:{ctx:z}}}),Jt=new W({}),Yt=new P({props:{name:"class transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput",anchor:"transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"prediction_logits",val:": FloatTensor = None"},{name:"seq_relationship_logits",val:": FloatTensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput.loss",description:`<strong>loss</strong> (<em>optional</em>, returned when <code>labels</code> is provided, <code>torch.FloatTensor</code> of shape <code>(1,)</code>) &#x2014;
Total loss as the sum of the masked language modeling loss and the next sequence prediction
(classification) loss.`,name:"loss"},{anchor:"transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput.prediction_logits",description:`<strong>prediction_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) &#x2014;
Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).`,name:"prediction_logits"},{anchor:"transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput.seq_relationship_logits",description:`<strong>seq_relationship_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, 2)</code>) &#x2014;
Prediction scores of the next sequence prediction (classification) head (scores of True/False continuation
before SoftMax).`,name:"seq_relationship_logits"},{anchor:"transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput.hidden_states",description:`<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>) &#x2014;
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.`,name:"hidden_states"},{anchor:"transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput.attentions",description:`<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>) &#x2014;
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.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/ernie/modeling_ernie.py#L688"}}),Zt=new W({}),eo=new P({props:{name:"class transformers.ErnieModel",anchor:"transformers.ErnieModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"}],parametersDescription:[{anchor:"transformers.ErnieModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/ernie#transformers.ErnieConfig">ErnieConfig</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/ernie/modeling_ernie.py#L796"}}),ao=new P({props:{name:"forward",anchor:"transformers.ErnieModel.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:"task_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"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.ErnieModel.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ErnieModel.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.ErnieModel.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.ErnieModel.forward.task_type_ids",description:`<strong>task_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Task type embedding is a special embedding to represent the characteristic of different tasks, such as
word-aware pre-training task, structure-aware pre-training task and semantic-aware pre-training task. We
assign a <code>task_type_id</code> to each task and the <code>task_type_id</code> is in the range \`[0,
config.task_type_vocab_size-1]`,name:"task_type_ids"},{anchor:"transformers.ErnieModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ErnieModel.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.ErnieModel.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.ErnieModel.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.ErnieModel.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.ErnieModel.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.ErnieModel.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.ErnieModel.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.ErnieModel.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.ErnieModel.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/ernie/modeling_ernie.py#L839",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/ernie#transformers.ErnieConfig"
>ErnieConfig</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>
`}}),st=new Je({props:{$$slots:{default:[Rf]},$$scope:{ctx:z}}}),at=new cn({props:{anchor:"transformers.ErnieModel.forward.example",$$slots:{default:[Bf]},$$scope:{ctx:z}}}),io=new W({}),lo=new P({props:{name:"class transformers.ErnieForPreTraining",anchor:"transformers.ErnieForPreTraining",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieForPreTraining.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/ernie#transformers.ErnieConfig">ErnieConfig</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/ernie/modeling_ernie.py#L984"}}),mo=new P({props:{name:"forward",anchor:"transformers.ErnieForPreTraining.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:"task_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"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.ErnieForPreTraining.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ErnieForPreTraining.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.ErnieForPreTraining.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.ErnieForPreTraining.forward.task_type_ids",description:`<strong>task_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Task type embedding is a special embedding to represent the characteristic of different tasks, such as
word-aware pre-training task, structure-aware pre-training task and semantic-aware pre-training task. We
assign a <code>task_type_id</code> to each task and the <code>task_type_id</code> is in the range \`[0,
config.task_type_vocab_size-1]`,name:"task_type_ids"},{anchor:"transformers.ErnieForPreTraining.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ErnieForPreTraining.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.ErnieForPreTraining.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.ErnieForPreTraining.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.ErnieForPreTraining.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.ErnieForPreTraining.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/ernie/modeling_ernie.py#L1005",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/ernie#transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput"
>transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput</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/ernie#transformers.ErnieConfig"
>ErnieConfig</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><a
  href="/docs/transformers/main/en/model_doc/ernie#transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput"
>transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),dt=new Je({props:{$$slots:{default:[Qf]},$$scope:{ctx:z}}}),lt=new cn({props:{anchor:"transformers.ErnieForPreTraining.forward.example",$$slots:{default:[Uf]},$$scope:{ctx:z}}}),uo=new W({}),fo=new P({props:{name:"class transformers.ErnieForCausalLM",anchor:"transformers.ErnieForCausalLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/ernie#transformers.ErnieConfig">ErnieConfig</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/ernie/modeling_ernie.py#L1095"}}),vo=new P({props:{name:"forward",anchor:"transformers.ErnieForCausalLM.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:"task_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"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:"past_key_values",val:": typing.Optional[typing.List[torch.Tensor]] = 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.ErnieForCausalLM.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ErnieForCausalLM.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.ErnieForCausalLM.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.ErnieForCausalLM.forward.task_type_ids",description:`<strong>task_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Task type embedding is a special embedding to represent the characteristic of different tasks, such as
word-aware pre-training task, structure-aware pre-training task and semantic-aware pre-training task. We
assign a <code>task_type_id</code> to each task and the <code>task_type_id</code> is in the range \`[0,
config.task_type_vocab_size-1]`,name:"task_type_ids"},{anchor:"transformers.ErnieForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ErnieForCausalLM.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.ErnieForCausalLM.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.ErnieForCausalLM.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.ErnieForCausalLM.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.ErnieForCausalLM.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.ErnieForCausalLM.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.ErnieForCausalLM.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.ErnieForCausalLM.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 left-to-right language modeling loss (next word prediction). 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 n <code>[0, ..., config.vocab_size]</code>`,name:"labels"},{anchor:"transformers.ErnieForCausalLM.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.ErnieForCausalLM.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/ernie/modeling_ernie.py#L1120",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</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/ernie#transformers.ErnieConfig"
>ErnieConfig</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 Language modeling loss (for next-token prediction).</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>
<li>
<p><strong>cross_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>Cross attentions weights 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>torch.FloatTensor</code> tuples of length <code>config.n_layers</code>, with each tuple containing the cached key,
value states of the self-attention and the cross-attention layers if model is used in encoder-decoder
setting. Only relevant if <code>config.is_decoder = True</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the 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.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ht=new Je({props:{$$slots:{default:[Vf]},$$scope:{ctx:z}}}),pt=new cn({props:{anchor:"transformers.ErnieForCausalLM.forward.example",$$slots:{default:[Gf]},$$scope:{ctx:z}}}),yo=new W({}),To=new P({props:{name:"class transformers.ErnieForMaskedLM",anchor:"transformers.ErnieForMaskedLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/ernie#transformers.ErnieConfig">ErnieConfig</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/ernie/modeling_ernie.py#L1242"}}),Mo=new P({props:{name:"forward",anchor:"transformers.ErnieForMaskedLM.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:"task_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"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.ErnieForMaskedLM.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ErnieForMaskedLM.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.ErnieForMaskedLM.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.ErnieForMaskedLM.forward.task_type_ids",description:`<strong>task_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Task type embedding is a special embedding to represent the characteristic of different tasks, such as
word-aware pre-training task, structure-aware pre-training task and semantic-aware pre-training task. We
assign a <code>task_type_id</code> to each task and the <code>task_type_id</code> is in the range \`[0,
config.task_type_vocab_size-1]`,name:"task_type_ids"},{anchor:"transformers.ErnieForMaskedLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ErnieForMaskedLM.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.ErnieForMaskedLM.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.ErnieForMaskedLM.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.ErnieForMaskedLM.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.ErnieForMaskedLM.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.ErnieForMaskedLM.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/ernie/modeling_ernie.py#L1270",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/ernie#transformers.ErnieConfig"
>ErnieConfig</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>
`}}),ut=new Je({props:{$$slots:{default:[Kf]},$$scope:{ctx:z}}}),ft=new cn({props:{anchor:"transformers.ErnieForMaskedLM.forward.example",$$slots:{default:[Jf]},$$scope:{ctx:z}}}),Fo=new W({}),xo=new P({props:{name:"class transformers.ErnieForNextSentencePrediction",anchor:"transformers.ErnieForNextSentencePrediction",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieForNextSentencePrediction.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/ernie#transformers.ErnieConfig">ErnieConfig</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/ernie/modeling_ernie.py#L1359"}}),No=new P({props:{name:"forward",anchor:"transformers.ErnieForNextSentencePrediction.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:"task_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ErnieForNextSentencePrediction.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ErnieForNextSentencePrediction.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.ErnieForNextSentencePrediction.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.ErnieForNextSentencePrediction.forward.task_type_ids",description:`<strong>task_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Task type embedding is a special embedding to represent the characteristic of different tasks, such as
word-aware pre-training task, structure-aware pre-training task and semantic-aware pre-training task. We
assign a <code>task_type_id</code> to each task and the <code>task_type_id</code> is in the range \`[0,
config.task_type_vocab_size-1]`,name:"task_type_ids"},{anchor:"transformers.ErnieForNextSentencePrediction.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ErnieForNextSentencePrediction.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.ErnieForNextSentencePrediction.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.ErnieForNextSentencePrediction.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.ErnieForNextSentencePrediction.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.ErnieForNextSentencePrediction.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.ErnieForNextSentencePrediction.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/ernie/modeling_ernie.py#L1370",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/ernie#transformers.ErnieConfig"
>ErnieConfig</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>
`}}),_t=new Je({props:{$$slots:{default:[Yf]},$$scope:{ctx:z}}}),kt=new cn({props:{anchor:"transformers.ErnieForNextSentencePrediction.forward.example",$$slots:{default:[Xf]},$$scope:{ctx:z}}}),Oo=new W({}),Lo=new P({props:{name:"class transformers.ErnieForSequenceClassification",anchor:"transformers.ErnieForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/ernie#transformers.ErnieConfig">ErnieConfig</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/ernie/modeling_ernie.py#L1467"}}),Do=new P({props:{name:"forward",anchor:"transformers.ErnieForSequenceClassification.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:"task_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ErnieForSequenceClassification.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ErnieForSequenceClassification.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.ErnieForSequenceClassification.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.ErnieForSequenceClassification.forward.task_type_ids",description:`<strong>task_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Task type embedding is a special embedding to represent the characteristic of different tasks, such as
word-aware pre-training task, structure-aware pre-training task and semantic-aware pre-training task. We
assign a <code>task_type_id</code> to each task and the <code>task_type_id</code> is in the range \`[0,
config.task_type_vocab_size-1]`,name:"task_type_ids"},{anchor:"transformers.ErnieForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ErnieForSequenceClassification.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.ErnieForSequenceClassification.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.ErnieForSequenceClassification.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.ErnieForSequenceClassification.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.ErnieForSequenceClassification.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.ErnieForSequenceClassification.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/ernie/modeling_ernie.py#L1484"}}),vt=new Je({props:{$$slots:{default:[Zf]},$$scope:{ctx:z}}}),Wo=new W({}),Ho=new P({props:{name:"class transformers.ErnieForMultipleChoice",anchor:"transformers.ErnieForMultipleChoice",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/ernie#transformers.ErnieConfig">ErnieConfig</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/ernie/modeling_ernie.py#L1566"}}),Uo=new P({props:{name:"forward",anchor:"transformers.ErnieForMultipleChoice.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:"task_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ErnieForMultipleChoice.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ErnieForMultipleChoice.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.ErnieForMultipleChoice.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.ErnieForMultipleChoice.forward.task_type_ids",description:`<strong>task_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Task type embedding is a special embedding to represent the characteristic of different tasks, such as
word-aware pre-training task, structure-aware pre-training task and semantic-aware pre-training task. We
assign a <code>task_type_id</code> to each task and the <code>task_type_id</code> is in the range \`[0,
config.task_type_vocab_size-1]`,name:"task_type_ids"},{anchor:"transformers.ErnieForMultipleChoice.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ErnieForMultipleChoice.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.ErnieForMultipleChoice.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.ErnieForMultipleChoice.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.ErnieForMultipleChoice.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.ErnieForMultipleChoice.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.ErnieForMultipleChoice.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/ernie/modeling_ernie.py#L1581",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/ernie#transformers.ErnieConfig"
>ErnieConfig</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>
`}}),Tt=new Je({props:{$$slots:{default:[eg]},$$scope:{ctx:z}}}),Et=new cn({props:{anchor:"transformers.ErnieForMultipleChoice.forward.example",$$slots:{default:[tg]},$$scope:{ctx:z}}}),Vo=new W({}),Go=new P({props:{name:"class transformers.ErnieForTokenClassification",anchor:"transformers.ErnieForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/ernie#transformers.ErnieConfig">ErnieConfig</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/ernie/modeling_ernie.py#L1663"}}),Xo=new P({props:{name:"forward",anchor:"transformers.ErnieForTokenClassification.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:"task_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ErnieForTokenClassification.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ErnieForTokenClassification.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.ErnieForTokenClassification.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.ErnieForTokenClassification.forward.task_type_ids",description:`<strong>task_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Task type embedding is a special embedding to represent the characteristic of different tasks, such as
word-aware pre-training task, structure-aware pre-training task and semantic-aware pre-training task. We
assign a <code>task_type_id</code> to each task and the <code>task_type_id</code> is in the range \`[0,
config.task_type_vocab_size-1]`,name:"task_type_ids"},{anchor:"transformers.ErnieForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ErnieForTokenClassification.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.ErnieForTokenClassification.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.ErnieForTokenClassification.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.ErnieForTokenClassification.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.ErnieForTokenClassification.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.ErnieForTokenClassification.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/ernie/modeling_ernie.py#L1681"}}),$t=new Je({props:{$$slots:{default:[og]},$$scope:{ctx:z}}}),Zo=new W({}),en=new P({props:{name:"class transformers.ErnieForQuestionAnswering",anchor:"transformers.ErnieForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/ernie#transformers.ErnieConfig">ErnieConfig</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/ernie/modeling_ernie.py#L1744"}}),rn=new P({props:{name:"forward",anchor:"transformers.ErnieForQuestionAnswering.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:"task_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"start_positions",val:": typing.Optional[torch.Tensor] = None"},{name:"end_positions",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ErnieForQuestionAnswering.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ErnieForQuestionAnswering.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.ErnieForQuestionAnswering.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.ErnieForQuestionAnswering.forward.task_type_ids",description:`<strong>task_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Task type embedding is a special embedding to represent the characteristic of different tasks, such as
word-aware pre-training task, structure-aware pre-training task and semantic-aware pre-training task. We
assign a <code>task_type_id</code> to each task and the <code>task_type_id</code> is in the range \`[0,
config.task_type_vocab_size-1]`,name:"task_type_ids"},{anchor:"transformers.ErnieForQuestionAnswering.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ErnieForQuestionAnswering.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.ErnieForQuestionAnswering.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.ErnieForQuestionAnswering.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.ErnieForQuestionAnswering.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.ErnieForQuestionAnswering.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.ErnieForQuestionAnswering.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.ErnieForQuestionAnswering.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/ernie/modeling_ernie.py#L1758"}}),Mt=new Je({props:{$$slots:{default:[ng]},$$scope:{ctx:z}}}),{c(){p=n("meta"),b=c(),f=n("h1"),u=n("a"),k=n("span"),v(d.$$.fragment),m=c(),M=n("span"),ci=a("ERNIE"),Xs=c(),he=n("h2"),Ye=n("a"),jr=n("span"),v(It.$$.fragment),hi=c(),Dr=n("span"),pi=a("Overview"),Zs=a(`

ERNIE is a series of powerful models proposed by baidu, especially in Chinese tasks,
including [ERNIE1.0](https://arxiv.org/abs/1904.09223), [ERNIE2.0](https://ojs.aaai.org/index.php/AAAI/article/view/6428),
[ERNIE3.0](https://arxiv.org/abs/2107.02137), [ERNIE-Gram](https://arxiv.org/abs/2010.12148), [ERNIE-health](https://arxiv.org/abs/2110.07244), etc.
`),Z=n("p"),mi=a("These models are contributed by "),jt=n("a"),ui=a("nghuyong"),fi=a(" and the official code can be found in "),Dt=n("a"),gi=a("PaddleNLP"),_i=a(" (in PaddlePaddle)."),ea=c(),pe=n("h3"),Xe=n("a"),Wr=n("span"),v(Wt.$$.fragment),ki=c(),Hr=n("span"),bi=a("How to use"),ta=a(`

Take \`ernie-1.0-base-zh\` as an example:

	`),v(Ht.$$.fragment),oa=c(),me=n("h3"),Ze=n("a"),Rr=n("span"),v(Rt.$$.fragment),vi=c(),Br=n("span"),yi=a("Supported Models"),na=c(),et=n("table"),Qr=n("thead"),ue=n("tr"),pn=n("th"),Ti=a("Model Name"),Ei=c(),mn=n("th"),wi=a("Language"),$i=c(),un=n("th"),zi=a("Description"),Mi=c(),F=n("tbody"),fe=n("tr"),fn=n("td"),Fi=a("ernie-1.0-base-zh"),xi=c(),gn=n("td"),Pi=a("Chinese"),Ci=c(),_n=n("td"),qi=a("Layer:12, Heads:12, Hidden:768"),Ai=c(),ge=n("tr"),kn=n("td"),Ni=a("ernie-2.0-base-en"),Oi=c(),bn=n("td"),Li=a("English"),Si=c(),vn=n("td"),Ii=a("Layer:12, Heads:12, Hidden:768"),ji=c(),_e=n("tr"),yn=n("td"),Di=a("ernie-2.0-large-en"),Wi=c(),Tn=n("td"),Hi=a("English"),Ri=c(),En=n("td"),Bi=a("Layer:24, Heads:16, Hidden:1024"),Qi=c(),ke=n("tr"),wn=n("td"),Ui=a("ernie-3.0-base-zh"),Vi=c(),$n=n("td"),Gi=a("Chinese"),Ki=c(),zn=n("td"),Ji=a("Layer:12, Heads:12, Hidden:768"),Yi=c(),be=n("tr"),Mn=n("td"),Xi=a("ernie-3.0-medium-zh"),Zi=c(),Fn=n("td"),ed=a("Chinese"),td=c(),xn=n("td"),od=a("Layer:6, Heads:12, Hidden:768"),nd=c(),ve=n("tr"),Pn=n("td"),rd=a("ernie-3.0-mini-zh"),sd=c(),Cn=n("td"),ad=a("Chinese"),id=c(),qn=n("td"),dd=a("Layer:6, Heads:12, Hidden:384"),ld=c(),ye=n("tr"),An=n("td"),cd=a("ernie-3.0-micro-zh"),hd=c(),Nn=n("td"),pd=a("Chinese"),md=c(),On=n("td"),ud=a("Layer:4, Heads:12, Hidden:384"),fd=c(),Te=n("tr"),Ln=n("td"),gd=a("ernie-3.0-nano-zh"),_d=c(),Sn=n("td"),kd=a("Chinese"),bd=c(),In=n("td"),vd=a("Layer:4, Heads:12, Hidden:312"),yd=c(),Ee=n("tr"),jn=n("td"),Td=a("ernie-health-zh"),Ed=c(),Dn=n("td"),wd=a("Chinese"),$d=c(),Wn=n("td"),zd=a("Layer:12, Heads:12, Hidden:768"),Md=c(),we=n("tr"),Hn=n("td"),Fd=a("ernie-gram-zh"),xd=c(),Rn=n("td"),Pd=a("Chinese"),Cd=c(),Bn=n("td"),qd=a("Layer:12, Heads:12, Hidden:768"),ra=c(),Q=n("p"),Ad=a("You can find all the supported models from huggingface\u2019s model hub: "),Bt=n("a"),Nd=a("huggingface.co/nghuyong"),Od=a(`, and model details from paddle\u2019s official
repo: `),Qt=n("a"),Ld=a("PaddleNLP"),Sd=a(`
and `),Ut=n("a"),Id=a("ERNIE"),jd=a("."),sa=c(),$e=n("h2"),tt=n("a"),Ur=n("span"),v(Vt.$$.fragment),Dd=c(),Vr=n("span"),Wd=a("ErnieConfig"),aa=c(),B=n("div"),v(Gt.$$.fragment),Hd=c(),X=n("p"),Rd=a("This is the configuration class to store the configuration of a "),Qn=n("a"),Bd=a("ErnieModel"),Qd=a(" or a "),Gr=n("code"),Ud=a("TFErnieModel"),Vd=a(`. It is used to
instantiate a ERNIE 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 ERNIE
`),Kt=n("a"),Gd=a("nghuyong/ernie-3.0-base-zh"),Kd=a(" architecture."),Jd=c(),ze=n("p"),Yd=a("Configuration objects inherit from "),Un=n("a"),Xd=a("PretrainedConfig"),Zd=a(` and can be used to control the model outputs. Read the
documentation from `),Vn=n("a"),el=a("PretrainedConfig"),tl=a(" for more information."),ol=c(),v(ot.$$.fragment),ia=c(),Me=n("h2"),nt=n("a"),Kr=n("span"),v(Jt.$$.fragment),nl=c(),Jr=n("span"),rl=a("Ernie specific outputs"),da=c(),Fe=n("div"),v(Yt.$$.fragment),sl=c(),Xt=n("p"),al=a("Output type of "),Gn=n("a"),il=a("ErnieForPreTraining"),dl=a("."),la=c(),xe=n("h2"),rt=n("a"),Yr=n("span"),v(Zt.$$.fragment),ll=c(),Xr=n("span"),cl=a("ErnieModel"),ca=c(),C=n("div"),v(eo.$$.fragment),hl=c(),Zr=n("p"),pl=a("The bare Ernie Model transformer outputting raw hidden-states without any specific head on top."),ml=c(),to=n("p"),ul=a("This model inherits from "),Kn=n("a"),fl=a("PreTrainedModel"),gl=a(`. 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.)`),_l=c(),oo=n("p"),kl=a("This model is also a PyTorch "),no=n("a"),bl=a("torch.nn.Module"),vl=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),yl=c(),ro=n("p"),Tl=a(`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 `),so=n("a"),El=a(`Attention is
all you need`),wl=a(` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),$l=c(),q=n("p"),zl=a("To behave as an decoder the model needs to be initialized with the "),es=n("code"),Ml=a("is_decoder"),Fl=a(` argument of the configuration set
to `),ts=n("code"),xl=a("True"),Pl=a(". To be used in a Seq2Seq model, the model needs to initialized with both "),os=n("code"),Cl=a("is_decoder"),ql=a(` argument and
`),ns=n("code"),Al=a("add_cross_attention"),Nl=a(" set to "),rs=n("code"),Ol=a("True"),Ll=a("; an "),ss=n("code"),Sl=a("encoder_hidden_states"),Il=a(" is then expected as an input to the forward pass."),jl=c(),U=n("div"),v(ao.$$.fragment),Dl=c(),Pe=n("p"),Wl=a("The "),Jn=n("a"),Hl=a("ErnieModel"),Rl=a(" forward method, overrides the "),as=n("code"),Bl=a("__call__"),Ql=a(" special method."),Ul=c(),v(st.$$.fragment),Vl=c(),v(at.$$.fragment),ha=c(),Ce=n("h2"),it=n("a"),is=n("span"),v(io.$$.fragment),Gl=c(),ds=n("span"),Kl=a("ErnieForPreTraining"),pa=c(),A=n("div"),v(lo.$$.fragment),Jl=c(),qe=n("p"),Yl=a("Ernie Model with two heads on top as done during the pretraining: a "),ls=n("code"),Xl=a("masked language modeling"),Zl=a(" head and a "),cs=n("code"),ec=a("next sentence prediction (classification)"),tc=a(" head."),oc=c(),co=n("p"),nc=a("This model inherits from "),Yn=n("a"),rc=a("PreTrainedModel"),sc=a(`. 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.)`),ac=c(),ho=n("p"),ic=a("This model is also a PyTorch "),po=n("a"),dc=a("torch.nn.Module"),lc=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),cc=c(),V=n("div"),v(mo.$$.fragment),hc=c(),Ae=n("p"),pc=a("The "),Xn=n("a"),mc=a("ErnieForPreTraining"),uc=a(" forward method, overrides the "),hs=n("code"),fc=a("__call__"),gc=a(" special method."),_c=c(),v(dt.$$.fragment),kc=c(),v(lt.$$.fragment),ma=c(),Ne=n("h2"),ct=n("a"),ps=n("span"),v(uo.$$.fragment),bc=c(),ms=n("span"),vc=a("ErnieForCausalLM"),ua=c(),N=n("div"),v(fo.$$.fragment),yc=c(),go=n("p"),Tc=a("Ernie Model with a "),us=n("code"),Ec=a("language modeling"),wc=a(" head on top for CLM fine-tuning."),$c=c(),_o=n("p"),zc=a("This model inherits from "),Zn=n("a"),Mc=a("PreTrainedModel"),Fc=a(`. 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.)`),xc=c(),ko=n("p"),Pc=a("This model is also a PyTorch "),bo=n("a"),Cc=a("torch.nn.Module"),qc=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ac=c(),G=n("div"),v(vo.$$.fragment),Nc=c(),Oe=n("p"),Oc=a("The "),er=n("a"),Lc=a("ErnieForCausalLM"),Sc=a(" forward method, overrides the "),fs=n("code"),Ic=a("__call__"),jc=a(" special method."),Dc=c(),v(ht.$$.fragment),Wc=c(),v(pt.$$.fragment),fa=c(),Le=n("h2"),mt=n("a"),gs=n("span"),v(yo.$$.fragment),Hc=c(),_s=n("span"),Rc=a("ErnieForMaskedLM"),ga=c(),O=n("div"),v(To.$$.fragment),Bc=c(),Eo=n("p"),Qc=a("Ernie Model with a "),ks=n("code"),Uc=a("language modeling"),Vc=a(" head on top."),Gc=c(),wo=n("p"),Kc=a("This model inherits from "),tr=n("a"),Jc=a("PreTrainedModel"),Yc=a(`. 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.)`),Xc=c(),$o=n("p"),Zc=a("This model is also a PyTorch "),zo=n("a"),eh=a("torch.nn.Module"),th=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),oh=c(),K=n("div"),v(Mo.$$.fragment),nh=c(),Se=n("p"),rh=a("The "),or=n("a"),sh=a("ErnieForMaskedLM"),ah=a(" forward method, overrides the "),bs=n("code"),ih=a("__call__"),dh=a(" special method."),lh=c(),v(ut.$$.fragment),ch=c(),v(ft.$$.fragment),_a=c(),Ie=n("h2"),gt=n("a"),vs=n("span"),v(Fo.$$.fragment),hh=c(),ys=n("span"),ph=a("ErnieForNextSentencePrediction"),ka=c(),L=n("div"),v(xo.$$.fragment),mh=c(),Po=n("p"),uh=a("Ernie Model with a "),Ts=n("code"),fh=a("next sentence prediction (classification)"),gh=a(" head on top."),_h=c(),Co=n("p"),kh=a("This model inherits from "),nr=n("a"),bh=a("PreTrainedModel"),vh=a(`. 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.)`),yh=c(),qo=n("p"),Th=a("This model is also a PyTorch "),Ao=n("a"),Eh=a("torch.nn.Module"),wh=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),$h=c(),J=n("div"),v(No.$$.fragment),zh=c(),je=n("p"),Mh=a("The "),rr=n("a"),Fh=a("ErnieForNextSentencePrediction"),xh=a(" forward method, overrides the "),Es=n("code"),Ph=a("__call__"),Ch=a(" special method."),qh=c(),v(_t.$$.fragment),Ah=c(),v(kt.$$.fragment),ba=c(),De=n("h2"),bt=n("a"),ws=n("span"),v(Oo.$$.fragment),Nh=c(),$s=n("span"),Oh=a("ErnieForSequenceClassification"),va=c(),S=n("div"),v(Lo.$$.fragment),Lh=c(),zs=n("p"),Sh=a(`Ernie Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled
output) e.g. for GLUE tasks.`),Ih=c(),So=n("p"),jh=a("This model inherits from "),sr=n("a"),Dh=a("PreTrainedModel"),Wh=a(`. 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.)`),Hh=c(),Io=n("p"),Rh=a("This model is also a PyTorch "),jo=n("a"),Bh=a("torch.nn.Module"),Qh=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Uh=c(),ee=n("div"),v(Do.$$.fragment),Vh=c(),We=n("p"),Gh=a("The "),ar=n("a"),Kh=a("ErnieForSequenceClassification"),Jh=a(" forward method, overrides the "),Ms=n("code"),Yh=a("__call__"),Xh=a(" special method."),Zh=c(),v(vt.$$.fragment),ya=c(),He=n("h2"),yt=n("a"),Fs=n("span"),v(Wo.$$.fragment),ep=c(),xs=n("span"),tp=a("ErnieForMultipleChoice"),Ta=c(),I=n("div"),v(Ho.$$.fragment),op=c(),Ps=n("p"),np=a(`Ernie 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.`),rp=c(),Ro=n("p"),sp=a("This model inherits from "),ir=n("a"),ap=a("PreTrainedModel"),ip=a(`. 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.)`),dp=c(),Bo=n("p"),lp=a("This model is also a PyTorch "),Qo=n("a"),cp=a("torch.nn.Module"),hp=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),pp=c(),Y=n("div"),v(Uo.$$.fragment),mp=c(),Re=n("p"),up=a("The "),dr=n("a"),fp=a("ErnieForMultipleChoice"),gp=a(" forward method, overrides the "),Cs=n("code"),_p=a("__call__"),kp=a(" special method."),bp=c(),v(Tt.$$.fragment),vp=c(),v(Et.$$.fragment),Ea=c(),Be=n("h2"),wt=n("a"),qs=n("span"),v(Vo.$$.fragment),yp=c(),As=n("span"),Tp=a("ErnieForTokenClassification"),wa=c(),j=n("div"),v(Go.$$.fragment),Ep=c(),Ns=n("p"),wp=a(`Ernie 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.`),$p=c(),Ko=n("p"),zp=a("This model inherits from "),lr=n("a"),Mp=a("PreTrainedModel"),Fp=a(`. 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.)`),xp=c(),Jo=n("p"),Pp=a("This model is also a PyTorch "),Yo=n("a"),Cp=a("torch.nn.Module"),qp=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ap=c(),te=n("div"),v(Xo.$$.fragment),Np=c(),Qe=n("p"),Op=a("The "),cr=n("a"),Lp=a("ErnieForTokenClassification"),Sp=a(" forward method, overrides the "),Os=n("code"),Ip=a("__call__"),jp=a(" special method."),Dp=c(),v($t.$$.fragment),$a=c(),Ue=n("h2"),zt=n("a"),Ls=n("span"),v(Zo.$$.fragment),Wp=c(),Ss=n("span"),Hp=a("ErnieForQuestionAnswering"),za=c(),D=n("div"),v(en.$$.fragment),Rp=c(),Ve=n("p"),Bp=a(`Ernie 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 `),Is=n("code"),Qp=a("span start logits"),Up=a(" and "),js=n("code"),Vp=a("span end logits"),Gp=a(")."),Kp=c(),tn=n("p"),Jp=a("This model inherits from "),hr=n("a"),Yp=a("PreTrainedModel"),Xp=a(`. 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.)`),Zp=c(),on=n("p"),em=a("This model is also a PyTorch "),nn=n("a"),tm=a("torch.nn.Module"),om=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),nm=c(),oe=n("div"),v(rn.$$.fragment),rm=c(),Ge=n("p"),sm=a("The "),pr=n("a"),am=a("ErnieForQuestionAnswering"),im=a(" forward method, overrides the "),Ds=n("code"),dm=a("__call__"),lm=a(" special method."),cm=c(),v(Mt.$$.fragment),this.h()},l(o){const g=Df('[data-svelte="svelte-1phssyn"]',document.head);p=r(g,"META",{name:!0,content:!0}),g.forEach(t),b=h(o),f=r(o,"H1",{class:!0});var sn=s(f);u=r(sn,"A",{id:!0,class:!0,href:!0});var Ws=s(u);k=r(Ws,"SPAN",{});var Hs=s(k);y(d.$$.fragment,Hs),Hs.forEach(t),Ws.forEach(t),m=h(sn),M=r(sn,"SPAN",{});var Rs=s(M);ci=i(Rs,"ERNIE"),Rs.forEach(t),sn.forEach(t),Xs=h(o),he=r(o,"H2",{class:!0});var an=s(he);Ye=r(an,"A",{id:!0,class:!0,href:!0});var Bs=s(Ye);jr=r(Bs,"SPAN",{});var Qs=s(jr);y(It.$$.fragment,Qs),Qs.forEach(t),Bs.forEach(t),hi=h(an),Dr=r(an,"SPAN",{});var Us=s(Dr);pi=i(Us,"Overview"),Us.forEach(t),an.forEach(t),Zs=i(o,`

ERNIE is a series of powerful models proposed by baidu, especially in Chinese tasks,
including [ERNIE1.0](https://arxiv.org/abs/1904.09223), [ERNIE2.0](https://ojs.aaai.org/index.php/AAAI/article/view/6428),
[ERNIE3.0](https://arxiv.org/abs/2107.02137), [ERNIE-Gram](https://arxiv.org/abs/2010.12148), [ERNIE-health](https://arxiv.org/abs/2110.07244), etc.
`),Z=r(o,"P",{});var Ke=s(Z);mi=i(Ke,"These models are contributed by "),jt=r(Ke,"A",{href:!0,rel:!0});var Vs=s(jt);ui=i(Vs,"nghuyong"),Vs.forEach(t),fi=i(Ke," and the official code can be found in "),Dt=r(Ke,"A",{href:!0,rel:!0});var Gs=s(Dt);gi=i(Gs,"PaddleNLP"),Gs.forEach(t),_i=i(Ke," (in PaddlePaddle)."),Ke.forEach(t),ea=h(o),pe=r(o,"H3",{class:!0});var dn=s(pe);Xe=r(dn,"A",{id:!0,class:!0,href:!0});var Ks=s(Xe);Wr=r(Ks,"SPAN",{});var Js=s(Wr);y(Wt.$$.fragment,Js),Js.forEach(t),Ks.forEach(t),ki=h(dn),Hr=r(dn,"SPAN",{});var Ys=s(Hr);bi=i(Ys,"How to use"),Ys.forEach(t),dn.forEach(t),ta=i(o,`

Take \`ernie-1.0-base-zh\` as an example:

	`),y(Ht.$$.fragment,o),oa=h(o),me=r(o,"H3",{class:!0});var ln=s(me);Ze=r(ln,"A",{id:!0,class:!0,href:!0});var hm=s(Ze);Rr=r(hm,"SPAN",{});var pm=s(Rr);y(Rt.$$.fragment,pm),pm.forEach(t),hm.forEach(t),vi=h(ln),Br=r(ln,"SPAN",{});var mm=s(Br);yi=i(mm,"Supported Models"),mm.forEach(t),ln.forEach(t),na=h(o),et=r(o,"TABLE",{});var Fa=s(et);Qr=r(Fa,"THEAD",{});var um=s(Qr);ue=r(um,"TR",{});var mr=s(ue);pn=r(mr,"TH",{align:!0});var fm=s(pn);Ti=i(fm,"Model Name"),fm.forEach(t),Ei=h(mr),mn=r(mr,"TH",{align:!0});var gm=s(mn);wi=i(gm,"Language"),gm.forEach(t),$i=h(mr),un=r(mr,"TH",{align:!0});var _m=s(un);zi=i(_m,"Description"),_m.forEach(t),mr.forEach(t),um.forEach(t),Mi=h(Fa),F=r(Fa,"TBODY",{});var x=s(F);fe=r(x,"TR",{});var ur=s(fe);fn=r(ur,"TD",{align:!0});var km=s(fn);Fi=i(km,"ernie-1.0-base-zh"),km.forEach(t),xi=h(ur),gn=r(ur,"TD",{align:!0});var bm=s(gn);Pi=i(bm,"Chinese"),bm.forEach(t),Ci=h(ur),_n=r(ur,"TD",{align:!0});var vm=s(_n);qi=i(vm,"Layer:12, Heads:12, Hidden:768"),vm.forEach(t),ur.forEach(t),Ai=h(x),ge=r(x,"TR",{});var fr=s(ge);kn=r(fr,"TD",{align:!0});var ym=s(kn);Ni=i(ym,"ernie-2.0-base-en"),ym.forEach(t),Oi=h(fr),bn=r(fr,"TD",{align:!0});var Tm=s(bn);Li=i(Tm,"English"),Tm.forEach(t),Si=h(fr),vn=r(fr,"TD",{align:!0});var Em=s(vn);Ii=i(Em,"Layer:12, Heads:12, Hidden:768"),Em.forEach(t),fr.forEach(t),ji=h(x),_e=r(x,"TR",{});var gr=s(_e);yn=r(gr,"TD",{align:!0});var wm=s(yn);Di=i(wm,"ernie-2.0-large-en"),wm.forEach(t),Wi=h(gr),Tn=r(gr,"TD",{align:!0});var $m=s(Tn);Hi=i($m,"English"),$m.forEach(t),Ri=h(gr),En=r(gr,"TD",{align:!0});var zm=s(En);Bi=i(zm,"Layer:24, Heads:16, Hidden:1024"),zm.forEach(t),gr.forEach(t),Qi=h(x),ke=r(x,"TR",{});var _r=s(ke);wn=r(_r,"TD",{align:!0});var Mm=s(wn);Ui=i(Mm,"ernie-3.0-base-zh"),Mm.forEach(t),Vi=h(_r),$n=r(_r,"TD",{align:!0});var Fm=s($n);Gi=i(Fm,"Chinese"),Fm.forEach(t),Ki=h(_r),zn=r(_r,"TD",{align:!0});var xm=s(zn);Ji=i(xm,"Layer:12, Heads:12, Hidden:768"),xm.forEach(t),_r.forEach(t),Yi=h(x),be=r(x,"TR",{});var kr=s(be);Mn=r(kr,"TD",{align:!0});var Pm=s(Mn);Xi=i(Pm,"ernie-3.0-medium-zh"),Pm.forEach(t),Zi=h(kr),Fn=r(kr,"TD",{align:!0});var Cm=s(Fn);ed=i(Cm,"Chinese"),Cm.forEach(t),td=h(kr),xn=r(kr,"TD",{align:!0});var qm=s(xn);od=i(qm,"Layer:6, Heads:12, Hidden:768"),qm.forEach(t),kr.forEach(t),nd=h(x),ve=r(x,"TR",{});var br=s(ve);Pn=r(br,"TD",{align:!0});var Am=s(Pn);rd=i(Am,"ernie-3.0-mini-zh"),Am.forEach(t),sd=h(br),Cn=r(br,"TD",{align:!0});var Nm=s(Cn);ad=i(Nm,"Chinese"),Nm.forEach(t),id=h(br),qn=r(br,"TD",{align:!0});var Om=s(qn);dd=i(Om,"Layer:6, Heads:12, Hidden:384"),Om.forEach(t),br.forEach(t),ld=h(x),ye=r(x,"TR",{});var vr=s(ye);An=r(vr,"TD",{align:!0});var Lm=s(An);cd=i(Lm,"ernie-3.0-micro-zh"),Lm.forEach(t),hd=h(vr),Nn=r(vr,"TD",{align:!0});var Sm=s(Nn);pd=i(Sm,"Chinese"),Sm.forEach(t),md=h(vr),On=r(vr,"TD",{align:!0});var Im=s(On);ud=i(Im,"Layer:4, Heads:12, Hidden:384"),Im.forEach(t),vr.forEach(t),fd=h(x),Te=r(x,"TR",{});var yr=s(Te);Ln=r(yr,"TD",{align:!0});var jm=s(Ln);gd=i(jm,"ernie-3.0-nano-zh"),jm.forEach(t),_d=h(yr),Sn=r(yr,"TD",{align:!0});var Dm=s(Sn);kd=i(Dm,"Chinese"),Dm.forEach(t),bd=h(yr),In=r(yr,"TD",{align:!0});var Wm=s(In);vd=i(Wm,"Layer:4, Heads:12, Hidden:312"),Wm.forEach(t),yr.forEach(t),yd=h(x),Ee=r(x,"TR",{});var Tr=s(Ee);jn=r(Tr,"TD",{align:!0});var Hm=s(jn);Td=i(Hm,"ernie-health-zh"),Hm.forEach(t),Ed=h(Tr),Dn=r(Tr,"TD",{align:!0});var Rm=s(Dn);wd=i(Rm,"Chinese"),Rm.forEach(t),$d=h(Tr),Wn=r(Tr,"TD",{align:!0});var Bm=s(Wn);zd=i(Bm,"Layer:12, Heads:12, Hidden:768"),Bm.forEach(t),Tr.forEach(t),Md=h(x),we=r(x,"TR",{});var Er=s(we);Hn=r(Er,"TD",{align:!0});var Qm=s(Hn);Fd=i(Qm,"ernie-gram-zh"),Qm.forEach(t),xd=h(Er),Rn=r(Er,"TD",{align:!0});var Um=s(Rn);Pd=i(Um,"Chinese"),Um.forEach(t),Cd=h(Er),Bn=r(Er,"TD",{align:!0});var Vm=s(Bn);qd=i(Vm,"Layer:12, Heads:12, Hidden:768"),Vm.forEach(t),Er.forEach(t),x.forEach(t),Fa.forEach(t),ra=h(o),Q=r(o,"P",{});var Ft=s(Q);Ad=i(Ft,"You can find all the supported models from huggingface\u2019s model hub: "),Bt=r(Ft,"A",{href:!0,rel:!0});var Gm=s(Bt);Nd=i(Gm,"huggingface.co/nghuyong"),Gm.forEach(t),Od=i(Ft,`, and model details from paddle\u2019s official
repo: `),Qt=r(Ft,"A",{href:!0,rel:!0});var Km=s(Qt);Ld=i(Km,"PaddleNLP"),Km.forEach(t),Sd=i(Ft,`
and `),Ut=r(Ft,"A",{href:!0,rel:!0});var Jm=s(Ut);Id=i(Jm,"ERNIE"),Jm.forEach(t),jd=i(Ft,"."),Ft.forEach(t),sa=h(o),$e=r(o,"H2",{class:!0});var xa=s($e);tt=r(xa,"A",{id:!0,class:!0,href:!0});var Ym=s(tt);Ur=r(Ym,"SPAN",{});var Xm=s(Ur);y(Vt.$$.fragment,Xm),Xm.forEach(t),Ym.forEach(t),Dd=h(xa),Vr=r(xa,"SPAN",{});var Zm=s(Vr);Wd=i(Zm,"ErnieConfig"),Zm.forEach(t),xa.forEach(t),aa=h(o),B=r(o,"DIV",{class:!0});var xt=s(B);y(Gt.$$.fragment,xt),Hd=h(xt),X=r(xt,"P",{});var Pt=s(X);Rd=i(Pt,"This is the configuration class to store the configuration of a "),Qn=r(Pt,"A",{href:!0});var eu=s(Qn);Bd=i(eu,"ErnieModel"),eu.forEach(t),Qd=i(Pt," or a "),Gr=r(Pt,"CODE",{});var tu=s(Gr);Ud=i(tu,"TFErnieModel"),tu.forEach(t),Vd=i(Pt,`. It is used to
instantiate a ERNIE 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 ERNIE
`),Kt=r(Pt,"A",{href:!0,rel:!0});var ou=s(Kt);Gd=i(ou,"nghuyong/ernie-3.0-base-zh"),ou.forEach(t),Kd=i(Pt," architecture."),Pt.forEach(t),Jd=h(xt),ze=r(xt,"P",{});var wr=s(ze);Yd=i(wr,"Configuration objects inherit from "),Un=r(wr,"A",{href:!0});var nu=s(Un);Xd=i(nu,"PretrainedConfig"),nu.forEach(t),Zd=i(wr,` and can be used to control the model outputs. Read the
documentation from `),Vn=r(wr,"A",{href:!0});var ru=s(Vn);el=i(ru,"PretrainedConfig"),ru.forEach(t),tl=i(wr," for more information."),wr.forEach(t),ol=h(xt),y(ot.$$.fragment,xt),xt.forEach(t),ia=h(o),Me=r(o,"H2",{class:!0});var Pa=s(Me);nt=r(Pa,"A",{id:!0,class:!0,href:!0});var su=s(nt);Kr=r(su,"SPAN",{});var au=s(Kr);y(Jt.$$.fragment,au),au.forEach(t),su.forEach(t),nl=h(Pa),Jr=r(Pa,"SPAN",{});var iu=s(Jr);rl=i(iu,"Ernie specific outputs"),iu.forEach(t),Pa.forEach(t),da=h(o),Fe=r(o,"DIV",{class:!0});var Ca=s(Fe);y(Yt.$$.fragment,Ca),sl=h(Ca),Xt=r(Ca,"P",{});var qa=s(Xt);al=i(qa,"Output type of "),Gn=r(qa,"A",{href:!0});var du=s(Gn);il=i(du,"ErnieForPreTraining"),du.forEach(t),dl=i(qa,"."),qa.forEach(t),Ca.forEach(t),la=h(o),xe=r(o,"H2",{class:!0});var Aa=s(xe);rt=r(Aa,"A",{id:!0,class:!0,href:!0});var lu=s(rt);Yr=r(lu,"SPAN",{});var cu=s(Yr);y(Zt.$$.fragment,cu),cu.forEach(t),lu.forEach(t),ll=h(Aa),Xr=r(Aa,"SPAN",{});var hu=s(Xr);cl=i(hu,"ErnieModel"),hu.forEach(t),Aa.forEach(t),ca=h(o),C=r(o,"DIV",{class:!0});var H=s(C);y(eo.$$.fragment,H),hl=h(H),Zr=r(H,"P",{});var pu=s(Zr);pl=i(pu,"The bare Ernie Model transformer outputting raw hidden-states without any specific head on top."),pu.forEach(t),ml=h(H),to=r(H,"P",{});var Na=s(to);ul=i(Na,"This model inherits from "),Kn=r(Na,"A",{href:!0});var mu=s(Kn);fl=i(mu,"PreTrainedModel"),mu.forEach(t),gl=i(Na,`. 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.)`),Na.forEach(t),_l=h(H),oo=r(H,"P",{});var Oa=s(oo);kl=i(Oa,"This model is also a PyTorch "),no=r(Oa,"A",{href:!0,rel:!0});var uu=s(no);bl=i(uu,"torch.nn.Module"),uu.forEach(t),vl=i(Oa,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Oa.forEach(t),yl=h(H),ro=r(H,"P",{});var La=s(ro);Tl=i(La,`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 `),so=r(La,"A",{href:!0,rel:!0});var fu=s(so);El=i(fu,`Attention is
all you need`),fu.forEach(t),wl=i(La,` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),La.forEach(t),$l=h(H),q=r(H,"P",{});var R=s(q);zl=i(R,"To behave as an decoder the model needs to be initialized with the "),es=r(R,"CODE",{});var gu=s(es);Ml=i(gu,"is_decoder"),gu.forEach(t),Fl=i(R,` argument of the configuration set
to `),ts=r(R,"CODE",{});var _u=s(ts);xl=i(_u,"True"),_u.forEach(t),Pl=i(R,". To be used in a Seq2Seq model, the model needs to initialized with both "),os=r(R,"CODE",{});var ku=s(os);Cl=i(ku,"is_decoder"),ku.forEach(t),ql=i(R,` argument and
`),ns=r(R,"CODE",{});var bu=s(ns);Al=i(bu,"add_cross_attention"),bu.forEach(t),Nl=i(R," set to "),rs=r(R,"CODE",{});var vu=s(rs);Ol=i(vu,"True"),vu.forEach(t),Ll=i(R,"; an "),ss=r(R,"CODE",{});var yu=s(ss);Sl=i(yu,"encoder_hidden_states"),yu.forEach(t),Il=i(R," is then expected as an input to the forward pass."),R.forEach(t),jl=h(H),U=r(H,"DIV",{class:!0});var Ct=s(U);y(ao.$$.fragment,Ct),Dl=h(Ct),Pe=r(Ct,"P",{});var $r=s(Pe);Wl=i($r,"The "),Jn=r($r,"A",{href:!0});var Tu=s(Jn);Hl=i(Tu,"ErnieModel"),Tu.forEach(t),Rl=i($r," forward method, overrides the "),as=r($r,"CODE",{});var Eu=s(as);Bl=i(Eu,"__call__"),Eu.forEach(t),Ql=i($r," special method."),$r.forEach(t),Ul=h(Ct),y(st.$$.fragment,Ct),Vl=h(Ct),y(at.$$.fragment,Ct),Ct.forEach(t),H.forEach(t),ha=h(o),Ce=r(o,"H2",{class:!0});var Sa=s(Ce);it=r(Sa,"A",{id:!0,class:!0,href:!0});var wu=s(it);is=r(wu,"SPAN",{});var $u=s(is);y(io.$$.fragment,$u),$u.forEach(t),wu.forEach(t),Gl=h(Sa),ds=r(Sa,"SPAN",{});var zu=s(ds);Kl=i(zu,"ErnieForPreTraining"),zu.forEach(t),Sa.forEach(t),pa=h(o),A=r(o,"DIV",{class:!0});var ne=s(A);y(lo.$$.fragment,ne),Jl=h(ne),qe=r(ne,"P",{});var zr=s(qe);Yl=i(zr,"Ernie Model with two heads on top as done during the pretraining: a "),ls=r(zr,"CODE",{});var Mu=s(ls);Xl=i(Mu,"masked language modeling"),Mu.forEach(t),Zl=i(zr," head and a "),cs=r(zr,"CODE",{});var Fu=s(cs);ec=i(Fu,"next sentence prediction (classification)"),Fu.forEach(t),tc=i(zr," head."),zr.forEach(t),oc=h(ne),co=r(ne,"P",{});var Ia=s(co);nc=i(Ia,"This model inherits from "),Yn=r(Ia,"A",{href:!0});var xu=s(Yn);rc=i(xu,"PreTrainedModel"),xu.forEach(t),sc=i(Ia,`. 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.)`),Ia.forEach(t),ac=h(ne),ho=r(ne,"P",{});var ja=s(ho);ic=i(ja,"This model is also a PyTorch "),po=r(ja,"A",{href:!0,rel:!0});var Pu=s(po);dc=i(Pu,"torch.nn.Module"),Pu.forEach(t),lc=i(ja,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ja.forEach(t),cc=h(ne),V=r(ne,"DIV",{class:!0});var qt=s(V);y(mo.$$.fragment,qt),hc=h(qt),Ae=r(qt,"P",{});var Mr=s(Ae);pc=i(Mr,"The "),Xn=r(Mr,"A",{href:!0});var Cu=s(Xn);mc=i(Cu,"ErnieForPreTraining"),Cu.forEach(t),uc=i(Mr," forward method, overrides the "),hs=r(Mr,"CODE",{});var qu=s(hs);fc=i(qu,"__call__"),qu.forEach(t),gc=i(Mr," special method."),Mr.forEach(t),_c=h(qt),y(dt.$$.fragment,qt),kc=h(qt),y(lt.$$.fragment,qt),qt.forEach(t),ne.forEach(t),ma=h(o),Ne=r(o,"H2",{class:!0});var Da=s(Ne);ct=r(Da,"A",{id:!0,class:!0,href:!0});var Au=s(ct);ps=r(Au,"SPAN",{});var Nu=s(ps);y(uo.$$.fragment,Nu),Nu.forEach(t),Au.forEach(t),bc=h(Da),ms=r(Da,"SPAN",{});var Ou=s(ms);vc=i(Ou,"ErnieForCausalLM"),Ou.forEach(t),Da.forEach(t),ua=h(o),N=r(o,"DIV",{class:!0});var re=s(N);y(fo.$$.fragment,re),yc=h(re),go=r(re,"P",{});var Wa=s(go);Tc=i(Wa,"Ernie Model with a "),us=r(Wa,"CODE",{});var Lu=s(us);Ec=i(Lu,"language modeling"),Lu.forEach(t),wc=i(Wa," head on top for CLM fine-tuning."),Wa.forEach(t),$c=h(re),_o=r(re,"P",{});var Ha=s(_o);zc=i(Ha,"This model inherits from "),Zn=r(Ha,"A",{href:!0});var Su=s(Zn);Mc=i(Su,"PreTrainedModel"),Su.forEach(t),Fc=i(Ha,`. 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.)`),Ha.forEach(t),xc=h(re),ko=r(re,"P",{});var Ra=s(ko);Pc=i(Ra,"This model is also a PyTorch "),bo=r(Ra,"A",{href:!0,rel:!0});var Iu=s(bo);Cc=i(Iu,"torch.nn.Module"),Iu.forEach(t),qc=i(Ra,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ra.forEach(t),Ac=h(re),G=r(re,"DIV",{class:!0});var At=s(G);y(vo.$$.fragment,At),Nc=h(At),Oe=r(At,"P",{});var Fr=s(Oe);Oc=i(Fr,"The "),er=r(Fr,"A",{href:!0});var ju=s(er);Lc=i(ju,"ErnieForCausalLM"),ju.forEach(t),Sc=i(Fr," forward method, overrides the "),fs=r(Fr,"CODE",{});var Du=s(fs);Ic=i(Du,"__call__"),Du.forEach(t),jc=i(Fr," special method."),Fr.forEach(t),Dc=h(At),y(ht.$$.fragment,At),Wc=h(At),y(pt.$$.fragment,At),At.forEach(t),re.forEach(t),fa=h(o),Le=r(o,"H2",{class:!0});var Ba=s(Le);mt=r(Ba,"A",{id:!0,class:!0,href:!0});var Wu=s(mt);gs=r(Wu,"SPAN",{});var Hu=s(gs);y(yo.$$.fragment,Hu),Hu.forEach(t),Wu.forEach(t),Hc=h(Ba),_s=r(Ba,"SPAN",{});var Ru=s(_s);Rc=i(Ru,"ErnieForMaskedLM"),Ru.forEach(t),Ba.forEach(t),ga=h(o),O=r(o,"DIV",{class:!0});var se=s(O);y(To.$$.fragment,se),Bc=h(se),Eo=r(se,"P",{});var Qa=s(Eo);Qc=i(Qa,"Ernie Model with a "),ks=r(Qa,"CODE",{});var Bu=s(ks);Uc=i(Bu,"language modeling"),Bu.forEach(t),Vc=i(Qa," head on top."),Qa.forEach(t),Gc=h(se),wo=r(se,"P",{});var Ua=s(wo);Kc=i(Ua,"This model inherits from "),tr=r(Ua,"A",{href:!0});var Qu=s(tr);Jc=i(Qu,"PreTrainedModel"),Qu.forEach(t),Yc=i(Ua,`. 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.)`),Ua.forEach(t),Xc=h(se),$o=r(se,"P",{});var Va=s($o);Zc=i(Va,"This model is also a PyTorch "),zo=r(Va,"A",{href:!0,rel:!0});var Uu=s(zo);eh=i(Uu,"torch.nn.Module"),Uu.forEach(t),th=i(Va,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Va.forEach(t),oh=h(se),K=r(se,"DIV",{class:!0});var Nt=s(K);y(Mo.$$.fragment,Nt),nh=h(Nt),Se=r(Nt,"P",{});var xr=s(Se);rh=i(xr,"The "),or=r(xr,"A",{href:!0});var Vu=s(or);sh=i(Vu,"ErnieForMaskedLM"),Vu.forEach(t),ah=i(xr," forward method, overrides the "),bs=r(xr,"CODE",{});var Gu=s(bs);ih=i(Gu,"__call__"),Gu.forEach(t),dh=i(xr," special method."),xr.forEach(t),lh=h(Nt),y(ut.$$.fragment,Nt),ch=h(Nt),y(ft.$$.fragment,Nt),Nt.forEach(t),se.forEach(t),_a=h(o),Ie=r(o,"H2",{class:!0});var Ga=s(Ie);gt=r(Ga,"A",{id:!0,class:!0,href:!0});var Ku=s(gt);vs=r(Ku,"SPAN",{});var Ju=s(vs);y(Fo.$$.fragment,Ju),Ju.forEach(t),Ku.forEach(t),hh=h(Ga),ys=r(Ga,"SPAN",{});var Yu=s(ys);ph=i(Yu,"ErnieForNextSentencePrediction"),Yu.forEach(t),Ga.forEach(t),ka=h(o),L=r(o,"DIV",{class:!0});var ae=s(L);y(xo.$$.fragment,ae),mh=h(ae),Po=r(ae,"P",{});var Ka=s(Po);uh=i(Ka,"Ernie Model with a "),Ts=r(Ka,"CODE",{});var Xu=s(Ts);fh=i(Xu,"next sentence prediction (classification)"),Xu.forEach(t),gh=i(Ka," head on top."),Ka.forEach(t),_h=h(ae),Co=r(ae,"P",{});var Ja=s(Co);kh=i(Ja,"This model inherits from "),nr=r(Ja,"A",{href:!0});var Zu=s(nr);bh=i(Zu,"PreTrainedModel"),Zu.forEach(t),vh=i(Ja,`. 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.)`),Ja.forEach(t),yh=h(ae),qo=r(ae,"P",{});var Ya=s(qo);Th=i(Ya,"This model is also a PyTorch "),Ao=r(Ya,"A",{href:!0,rel:!0});var ef=s(Ao);Eh=i(ef,"torch.nn.Module"),ef.forEach(t),wh=i(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),$h=h(ae),J=r(ae,"DIV",{class:!0});var Ot=s(J);y(No.$$.fragment,Ot),zh=h(Ot),je=r(Ot,"P",{});var Pr=s(je);Mh=i(Pr,"The "),rr=r(Pr,"A",{href:!0});var tf=s(rr);Fh=i(tf,"ErnieForNextSentencePrediction"),tf.forEach(t),xh=i(Pr," forward method, overrides the "),Es=r(Pr,"CODE",{});var of=s(Es);Ph=i(of,"__call__"),of.forEach(t),Ch=i(Pr," special method."),Pr.forEach(t),qh=h(Ot),y(_t.$$.fragment,Ot),Ah=h(Ot),y(kt.$$.fragment,Ot),Ot.forEach(t),ae.forEach(t),ba=h(o),De=r(o,"H2",{class:!0});var Xa=s(De);bt=r(Xa,"A",{id:!0,class:!0,href:!0});var nf=s(bt);ws=r(nf,"SPAN",{});var rf=s(ws);y(Oo.$$.fragment,rf),rf.forEach(t),nf.forEach(t),Nh=h(Xa),$s=r(Xa,"SPAN",{});var sf=s($s);Oh=i(sf,"ErnieForSequenceClassification"),sf.forEach(t),Xa.forEach(t),va=h(o),S=r(o,"DIV",{class:!0});var ie=s(S);y(Lo.$$.fragment,ie),Lh=h(ie),zs=r(ie,"P",{});var af=s(zs);Sh=i(af,`Ernie Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled
output) e.g. for GLUE tasks.`),af.forEach(t),Ih=h(ie),So=r(ie,"P",{});var Za=s(So);jh=i(Za,"This model inherits from "),sr=r(Za,"A",{href:!0});var df=s(sr);Dh=i(df,"PreTrainedModel"),df.forEach(t),Wh=i(Za,`. 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.)`),Za.forEach(t),Hh=h(ie),Io=r(ie,"P",{});var ei=s(Io);Rh=i(ei,"This model is also a PyTorch "),jo=r(ei,"A",{href:!0,rel:!0});var lf=s(jo);Bh=i(lf,"torch.nn.Module"),lf.forEach(t),Qh=i(ei,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ei.forEach(t),Uh=h(ie),ee=r(ie,"DIV",{class:!0});var Cr=s(ee);y(Do.$$.fragment,Cr),Vh=h(Cr),We=r(Cr,"P",{});var qr=s(We);Gh=i(qr,"The "),ar=r(qr,"A",{href:!0});var cf=s(ar);Kh=i(cf,"ErnieForSequenceClassification"),cf.forEach(t),Jh=i(qr," forward method, overrides the "),Ms=r(qr,"CODE",{});var hf=s(Ms);Yh=i(hf,"__call__"),hf.forEach(t),Xh=i(qr," special method."),qr.forEach(t),Zh=h(Cr),y(vt.$$.fragment,Cr),Cr.forEach(t),ie.forEach(t),ya=h(o),He=r(o,"H2",{class:!0});var ti=s(He);yt=r(ti,"A",{id:!0,class:!0,href:!0});var pf=s(yt);Fs=r(pf,"SPAN",{});var mf=s(Fs);y(Wo.$$.fragment,mf),mf.forEach(t),pf.forEach(t),ep=h(ti),xs=r(ti,"SPAN",{});var uf=s(xs);tp=i(uf,"ErnieForMultipleChoice"),uf.forEach(t),ti.forEach(t),Ta=h(o),I=r(o,"DIV",{class:!0});var de=s(I);y(Ho.$$.fragment,de),op=h(de),Ps=r(de,"P",{});var ff=s(Ps);np=i(ff,`Ernie 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.`),ff.forEach(t),rp=h(de),Ro=r(de,"P",{});var oi=s(Ro);sp=i(oi,"This model inherits from "),ir=r(oi,"A",{href:!0});var gf=s(ir);ap=i(gf,"PreTrainedModel"),gf.forEach(t),ip=i(oi,`. 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.)`),oi.forEach(t),dp=h(de),Bo=r(de,"P",{});var ni=s(Bo);lp=i(ni,"This model is also a PyTorch "),Qo=r(ni,"A",{href:!0,rel:!0});var _f=s(Qo);cp=i(_f,"torch.nn.Module"),_f.forEach(t),hp=i(ni,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ni.forEach(t),pp=h(de),Y=r(de,"DIV",{class:!0});var Lt=s(Y);y(Uo.$$.fragment,Lt),mp=h(Lt),Re=r(Lt,"P",{});var Ar=s(Re);up=i(Ar,"The "),dr=r(Ar,"A",{href:!0});var kf=s(dr);fp=i(kf,"ErnieForMultipleChoice"),kf.forEach(t),gp=i(Ar," forward method, overrides the "),Cs=r(Ar,"CODE",{});var bf=s(Cs);_p=i(bf,"__call__"),bf.forEach(t),kp=i(Ar," special method."),Ar.forEach(t),bp=h(Lt),y(Tt.$$.fragment,Lt),vp=h(Lt),y(Et.$$.fragment,Lt),Lt.forEach(t),de.forEach(t),Ea=h(o),Be=r(o,"H2",{class:!0});var ri=s(Be);wt=r(ri,"A",{id:!0,class:!0,href:!0});var vf=s(wt);qs=r(vf,"SPAN",{});var yf=s(qs);y(Vo.$$.fragment,yf),yf.forEach(t),vf.forEach(t),yp=h(ri),As=r(ri,"SPAN",{});var Tf=s(As);Tp=i(Tf,"ErnieForTokenClassification"),Tf.forEach(t),ri.forEach(t),wa=h(o),j=r(o,"DIV",{class:!0});var le=s(j);y(Go.$$.fragment,le),Ep=h(le),Ns=r(le,"P",{});var Ef=s(Ns);wp=i(Ef,`Ernie 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.`),Ef.forEach(t),$p=h(le),Ko=r(le,"P",{});var si=s(Ko);zp=i(si,"This model inherits from "),lr=r(si,"A",{href:!0});var wf=s(lr);Mp=i(wf,"PreTrainedModel"),wf.forEach(t),Fp=i(si,`. 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.)`),si.forEach(t),xp=h(le),Jo=r(le,"P",{});var ai=s(Jo);Pp=i(ai,"This model is also a PyTorch "),Yo=r(ai,"A",{href:!0,rel:!0});var $f=s(Yo);Cp=i($f,"torch.nn.Module"),$f.forEach(t),qp=i(ai,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ai.forEach(t),Ap=h(le),te=r(le,"DIV",{class:!0});var Nr=s(te);y(Xo.$$.fragment,Nr),Np=h(Nr),Qe=r(Nr,"P",{});var Or=s(Qe);Op=i(Or,"The "),cr=r(Or,"A",{href:!0});var zf=s(cr);Lp=i(zf,"ErnieForTokenClassification"),zf.forEach(t),Sp=i(Or," forward method, overrides the "),Os=r(Or,"CODE",{});var Mf=s(Os);Ip=i(Mf,"__call__"),Mf.forEach(t),jp=i(Or," special method."),Or.forEach(t),Dp=h(Nr),y($t.$$.fragment,Nr),Nr.forEach(t),le.forEach(t),$a=h(o),Ue=r(o,"H2",{class:!0});var ii=s(Ue);zt=r(ii,"A",{id:!0,class:!0,href:!0});var Ff=s(zt);Ls=r(Ff,"SPAN",{});var xf=s(Ls);y(Zo.$$.fragment,xf),xf.forEach(t),Ff.forEach(t),Wp=h(ii),Ss=r(ii,"SPAN",{});var Pf=s(Ss);Hp=i(Pf,"ErnieForQuestionAnswering"),Pf.forEach(t),ii.forEach(t),za=h(o),D=r(o,"DIV",{class:!0});var ce=s(D);y(en.$$.fragment,ce),Rp=h(ce),Ve=r(ce,"P",{});var Lr=s(Ve);Bp=i(Lr,`Ernie 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 `),Is=r(Lr,"CODE",{});var Cf=s(Is);Qp=i(Cf,"span start logits"),Cf.forEach(t),Up=i(Lr," and "),js=r(Lr,"CODE",{});var qf=s(js);Vp=i(qf,"span end logits"),qf.forEach(t),Gp=i(Lr,")."),Lr.forEach(t),Kp=h(ce),tn=r(ce,"P",{});var di=s(tn);Jp=i(di,"This model inherits from "),hr=r(di,"A",{href:!0});var Af=s(hr);Yp=i(Af,"PreTrainedModel"),Af.forEach(t),Xp=i(di,`. 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.)`),di.forEach(t),Zp=h(ce),on=r(ce,"P",{});var li=s(on);em=i(li,"This model is also a PyTorch "),nn=r(li,"A",{href:!0,rel:!0});var Nf=s(nn);tm=i(Nf,"torch.nn.Module"),Nf.forEach(t),om=i(li,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),li.forEach(t),nm=h(ce),oe=r(ce,"DIV",{class:!0});var Sr=s(oe);y(rn.$$.fragment,Sr),rm=h(Sr),Ge=r(Sr,"P",{});var Ir=s(Ge);sm=i(Ir,"The "),pr=r(Ir,"A",{href:!0});var Of=s(pr);am=i(Of,"ErnieForQuestionAnswering"),Of.forEach(t),im=i(Ir," forward method, overrides the "),Ds=r(Ir,"CODE",{});var Lf=s(Ds);dm=i(Lf,"__call__"),Lf.forEach(t),lm=i(Ir," special method."),Ir.forEach(t),cm=h(Sr),y(Mt.$$.fragment,Sr),Sr.forEach(t),ce.forEach(t),this.h()},h(){l(p,"name","hf:doc:metadata"),l(p,"content",JSON.stringify(sg)),l(u,"id","ernie"),l(u,"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"),l(u,"href","#ernie"),l(f,"class","relative group"),l(Ye,"id","overview"),l(Ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Ye,"href","#overview"),l(he,"class","relative group"),l(jt,"href","https://huggingface.co/nghuyong"),l(jt,"rel","nofollow"),l(Dt,"href","https://github.com/PaddlePaddle/PaddleNLP"),l(Dt,"rel","nofollow"),l(Xe,"id","how-to-use"),l(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"),l(Xe,"href","#how-to-use"),l(pe,"class","relative group"),l(Ze,"id","supported-models"),l(Ze,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Ze,"href","#supported-models"),l(me,"class","relative group"),l(pn,"align","center"),l(mn,"align","center"),l(un,"align","center"),l(fn,"align","center"),l(gn,"align","center"),l(_n,"align","center"),l(kn,"align","center"),l(bn,"align","center"),l(vn,"align","center"),l(yn,"align","center"),l(Tn,"align","center"),l(En,"align","center"),l(wn,"align","center"),l($n,"align","center"),l(zn,"align","center"),l(Mn,"align","center"),l(Fn,"align","center"),l(xn,"align","center"),l(Pn,"align","center"),l(Cn,"align","center"),l(qn,"align","center"),l(An,"align","center"),l(Nn,"align","center"),l(On,"align","center"),l(Ln,"align","center"),l(Sn,"align","center"),l(In,"align","center"),l(jn,"align","center"),l(Dn,"align","center"),l(Wn,"align","center"),l(Hn,"align","center"),l(Rn,"align","center"),l(Bn,"align","center"),l(Bt,"href","https://huggingface.co/nghuyong"),l(Bt,"rel","nofollow"),l(Qt,"href","https://paddlenlp.readthedocs.io/zh/latest/model_zoo/transformers/ERNIE/contents.html"),l(Qt,"rel","nofollow"),l(Ut,"href","https://github.com/PaddlePaddle/ERNIE/blob/repro"),l(Ut,"rel","nofollow"),l(tt,"id","transformers.ErnieConfig"),l(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"),l(tt,"href","#transformers.ErnieConfig"),l($e,"class","relative group"),l(Qn,"href","/docs/transformers/main/en/model_doc/ernie#transformers.ErnieModel"),l(Kt,"href","https://huggingface.co/nghuyong/ernie-3.0-base-zh"),l(Kt,"rel","nofollow"),l(Un,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(Vn,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(nt,"id","transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput"),l(nt,"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"),l(nt,"href","#transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput"),l(Me,"class","relative group"),l(Gn,"href","/docs/transformers/main/en/model_doc/ernie#transformers.ErnieForPreTraining"),l(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(rt,"id","transformers.ErnieModel"),l(rt,"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"),l(rt,"href","#transformers.ErnieModel"),l(xe,"class","relative group"),l(Kn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),l(no,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(no,"rel","nofollow"),l(so,"href","https://arxiv.org/abs/1706.03762"),l(so,"rel","nofollow"),l(Jn,"href","/docs/transformers/main/en/model_doc/ernie#transformers.ErnieModel"),l(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(it,"id","transformers.ErnieForPreTraining"),l(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"),l(it,"href","#transformers.ErnieForPreTraining"),l(Ce,"class","relative group"),l(Yn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),l(po,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(po,"rel","nofollow"),l(Xn,"href","/docs/transformers/main/en/model_doc/ernie#transformers.ErnieForPreTraining"),l(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ct,"id","transformers.ErnieForCausalLM"),l(ct,"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"),l(ct,"href","#transformers.ErnieForCausalLM"),l(Ne,"class","relative group"),l(Zn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),l(bo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(bo,"rel","nofollow"),l(er,"href","/docs/transformers/main/en/model_doc/ernie#transformers.ErnieForCausalLM"),l(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(mt,"id","transformers.ErnieForMaskedLM"),l(mt,"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"),l(mt,"href","#transformers.ErnieForMaskedLM"),l(Le,"class","relative group"),l(tr,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),l(zo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(zo,"rel","nofollow"),l(or,"href","/docs/transformers/main/en/model_doc/ernie#transformers.ErnieForMaskedLM"),l(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(gt,"id","transformers.ErnieForNextSentencePrediction"),l(gt,"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"),l(gt,"href","#transformers.ErnieForNextSentencePrediction"),l(Ie,"class","relative group"),l(nr,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),l(Ao,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Ao,"rel","nofollow"),l(rr,"href","/docs/transformers/main/en/model_doc/ernie#transformers.ErnieForNextSentencePrediction"),l(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(bt,"id","transformers.ErnieForSequenceClassification"),l(bt,"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"),l(bt,"href","#transformers.ErnieForSequenceClassification"),l(De,"class","relative group"),l(sr,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),l(jo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(jo,"rel","nofollow"),l(ar,"href","/docs/transformers/main/en/model_doc/ernie#transformers.ErnieForSequenceClassification"),l(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(yt,"id","transformers.ErnieForMultipleChoice"),l(yt,"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"),l(yt,"href","#transformers.ErnieForMultipleChoice"),l(He,"class","relative group"),l(ir,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),l(Qo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Qo,"rel","nofollow"),l(dr,"href","/docs/transformers/main/en/model_doc/ernie#transformers.ErnieForMultipleChoice"),l(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(wt,"id","transformers.ErnieForTokenClassification"),l(wt,"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"),l(wt,"href","#transformers.ErnieForTokenClassification"),l(Be,"class","relative group"),l(lr,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),l(Yo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Yo,"rel","nofollow"),l(cr,"href","/docs/transformers/main/en/model_doc/ernie#transformers.ErnieForTokenClassification"),l(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(zt,"id","transformers.ErnieForQuestionAnswering"),l(zt,"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"),l(zt,"href","#transformers.ErnieForQuestionAnswering"),l(Ue,"class","relative group"),l(hr,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),l(nn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(nn,"rel","nofollow"),l(pr,"href","/docs/transformers/main/en/model_doc/ernie#transformers.ErnieForQuestionAnswering"),l(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(D,"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,p),_(o,b,g),_(o,f,g),e(f,u),e(u,k),T(d,k,null),e(f,m),e(f,M),e(M,ci),_(o,Xs,g),_(o,he,g),e(he,Ye),e(Ye,jr),T(It,jr,null),e(he,hi),e(he,Dr),e(Dr,pi),_(o,Zs,g),_(o,Z,g),e(Z,mi),e(Z,jt),e(jt,ui),e(Z,fi),e(Z,Dt),e(Dt,gi),e(Z,_i),_(o,ea,g),_(o,pe,g),e(pe,Xe),e(Xe,Wr),T(Wt,Wr,null),e(pe,ki),e(pe,Hr),e(Hr,bi),_(o,ta,g),T(Ht,o,g),_(o,oa,g),_(o,me,g),e(me,Ze),e(Ze,Rr),T(Rt,Rr,null),e(me,vi),e(me,Br),e(Br,yi),_(o,na,g),_(o,et,g),e(et,Qr),e(Qr,ue),e(ue,pn),e(pn,Ti),e(ue,Ei),e(ue,mn),e(mn,wi),e(ue,$i),e(ue,un),e(un,zi),e(et,Mi),e(et,F),e(F,fe),e(fe,fn),e(fn,Fi),e(fe,xi),e(fe,gn),e(gn,Pi),e(fe,Ci),e(fe,_n),e(_n,qi),e(F,Ai),e(F,ge),e(ge,kn),e(kn,Ni),e(ge,Oi),e(ge,bn),e(bn,Li),e(ge,Si),e(ge,vn),e(vn,Ii),e(F,ji),e(F,_e),e(_e,yn),e(yn,Di),e(_e,Wi),e(_e,Tn),e(Tn,Hi),e(_e,Ri),e(_e,En),e(En,Bi),e(F,Qi),e(F,ke),e(ke,wn),e(wn,Ui),e(ke,Vi),e(ke,$n),e($n,Gi),e(ke,Ki),e(ke,zn),e(zn,Ji),e(F,Yi),e(F,be),e(be,Mn),e(Mn,Xi),e(be,Zi),e(be,Fn),e(Fn,ed),e(be,td),e(be,xn),e(xn,od),e(F,nd),e(F,ve),e(ve,Pn),e(Pn,rd),e(ve,sd),e(ve,Cn),e(Cn,ad),e(ve,id),e(ve,qn),e(qn,dd),e(F,ld),e(F,ye),e(ye,An),e(An,cd),e(ye,hd),e(ye,Nn),e(Nn,pd),e(ye,md),e(ye,On),e(On,ud),e(F,fd),e(F,Te),e(Te,Ln),e(Ln,gd),e(Te,_d),e(Te,Sn),e(Sn,kd),e(Te,bd),e(Te,In),e(In,vd),e(F,yd),e(F,Ee),e(Ee,jn),e(jn,Td),e(Ee,Ed),e(Ee,Dn),e(Dn,wd),e(Ee,$d),e(Ee,Wn),e(Wn,zd),e(F,Md),e(F,we),e(we,Hn),e(Hn,Fd),e(we,xd),e(we,Rn),e(Rn,Pd),e(we,Cd),e(we,Bn),e(Bn,qd),_(o,ra,g),_(o,Q,g),e(Q,Ad),e(Q,Bt),e(Bt,Nd),e(Q,Od),e(Q,Qt),e(Qt,Ld),e(Q,Sd),e(Q,Ut),e(Ut,Id),e(Q,jd),_(o,sa,g),_(o,$e,g),e($e,tt),e(tt,Ur),T(Vt,Ur,null),e($e,Dd),e($e,Vr),e(Vr,Wd),_(o,aa,g),_(o,B,g),T(Gt,B,null),e(B,Hd),e(B,X),e(X,Rd),e(X,Qn),e(Qn,Bd),e(X,Qd),e(X,Gr),e(Gr,Ud),e(X,Vd),e(X,Kt),e(Kt,Gd),e(X,Kd),e(B,Jd),e(B,ze),e(ze,Yd),e(ze,Un),e(Un,Xd),e(ze,Zd),e(ze,Vn),e(Vn,el),e(ze,tl),e(B,ol),T(ot,B,null),_(o,ia,g),_(o,Me,g),e(Me,nt),e(nt,Kr),T(Jt,Kr,null),e(Me,nl),e(Me,Jr),e(Jr,rl),_(o,da,g),_(o,Fe,g),T(Yt,Fe,null),e(Fe,sl),e(Fe,Xt),e(Xt,al),e(Xt,Gn),e(Gn,il),e(Xt,dl),_(o,la,g),_(o,xe,g),e(xe,rt),e(rt,Yr),T(Zt,Yr,null),e(xe,ll),e(xe,Xr),e(Xr,cl),_(o,ca,g),_(o,C,g),T(eo,C,null),e(C,hl),e(C,Zr),e(Zr,pl),e(C,ml),e(C,to),e(to,ul),e(to,Kn),e(Kn,fl),e(to,gl),e(C,_l),e(C,oo),e(oo,kl),e(oo,no),e(no,bl),e(oo,vl),e(C,yl),e(C,ro),e(ro,Tl),e(ro,so),e(so,El),e(ro,wl),e(C,$l),e(C,q),e(q,zl),e(q,es),e(es,Ml),e(q,Fl),e(q,ts),e(ts,xl),e(q,Pl),e(q,os),e(os,Cl),e(q,ql),e(q,ns),e(ns,Al),e(q,Nl),e(q,rs),e(rs,Ol),e(q,Ll),e(q,ss),e(ss,Sl),e(q,Il),e(C,jl),e(C,U),T(ao,U,null),e(U,Dl),e(U,Pe),e(Pe,Wl),e(Pe,Jn),e(Jn,Hl),e(Pe,Rl),e(Pe,as),e(as,Bl),e(Pe,Ql),e(U,Ul),T(st,U,null),e(U,Vl),T(at,U,null),_(o,ha,g),_(o,Ce,g),e(Ce,it),e(it,is),T(io,is,null),e(Ce,Gl),e(Ce,ds),e(ds,Kl),_(o,pa,g),_(o,A,g),T(lo,A,null),e(A,Jl),e(A,qe),e(qe,Yl),e(qe,ls),e(ls,Xl),e(qe,Zl),e(qe,cs),e(cs,ec),e(qe,tc),e(A,oc),e(A,co),e(co,nc),e(co,Yn),e(Yn,rc),e(co,sc),e(A,ac),e(A,ho),e(ho,ic),e(ho,po),e(po,dc),e(ho,lc),e(A,cc),e(A,V),T(mo,V,null),e(V,hc),e(V,Ae),e(Ae,pc),e(Ae,Xn),e(Xn,mc),e(Ae,uc),e(Ae,hs),e(hs,fc),e(Ae,gc),e(V,_c),T(dt,V,null),e(V,kc),T(lt,V,null),_(o,ma,g),_(o,Ne,g),e(Ne,ct),e(ct,ps),T(uo,ps,null),e(Ne,bc),e(Ne,ms),e(ms,vc),_(o,ua,g),_(o,N,g),T(fo,N,null),e(N,yc),e(N,go),e(go,Tc),e(go,us),e(us,Ec),e(go,wc),e(N,$c),e(N,_o),e(_o,zc),e(_o,Zn),e(Zn,Mc),e(_o,Fc),e(N,xc),e(N,ko),e(ko,Pc),e(ko,bo),e(bo,Cc),e(ko,qc),e(N,Ac),e(N,G),T(vo,G,null),e(G,Nc),e(G,Oe),e(Oe,Oc),e(Oe,er),e(er,Lc),e(Oe,Sc),e(Oe,fs),e(fs,Ic),e(Oe,jc),e(G,Dc),T(ht,G,null),e(G,Wc),T(pt,G,null),_(o,fa,g),_(o,Le,g),e(Le,mt),e(mt,gs),T(yo,gs,null),e(Le,Hc),e(Le,_s),e(_s,Rc),_(o,ga,g),_(o,O,g),T(To,O,null),e(O,Bc),e(O,Eo),e(Eo,Qc),e(Eo,ks),e(ks,Uc),e(Eo,Vc),e(O,Gc),e(O,wo),e(wo,Kc),e(wo,tr),e(tr,Jc),e(wo,Yc),e(O,Xc),e(O,$o),e($o,Zc),e($o,zo),e(zo,eh),e($o,th),e(O,oh),e(O,K),T(Mo,K,null),e(K,nh),e(K,Se),e(Se,rh),e(Se,or),e(or,sh),e(Se,ah),e(Se,bs),e(bs,ih),e(Se,dh),e(K,lh),T(ut,K,null),e(K,ch),T(ft,K,null),_(o,_a,g),_(o,Ie,g),e(Ie,gt),e(gt,vs),T(Fo,vs,null),e(Ie,hh),e(Ie,ys),e(ys,ph),_(o,ka,g),_(o,L,g),T(xo,L,null),e(L,mh),e(L,Po),e(Po,uh),e(Po,Ts),e(Ts,fh),e(Po,gh),e(L,_h),e(L,Co),e(Co,kh),e(Co,nr),e(nr,bh),e(Co,vh),e(L,yh),e(L,qo),e(qo,Th),e(qo,Ao),e(Ao,Eh),e(qo,wh),e(L,$h),e(L,J),T(No,J,null),e(J,zh),e(J,je),e(je,Mh),e(je,rr),e(rr,Fh),e(je,xh),e(je,Es),e(Es,Ph),e(je,Ch),e(J,qh),T(_t,J,null),e(J,Ah),T(kt,J,null),_(o,ba,g),_(o,De,g),e(De,bt),e(bt,ws),T(Oo,ws,null),e(De,Nh),e(De,$s),e($s,Oh),_(o,va,g),_(o,S,g),T(Lo,S,null),e(S,Lh),e(S,zs),e(zs,Sh),e(S,Ih),e(S,So),e(So,jh),e(So,sr),e(sr,Dh),e(So,Wh),e(S,Hh),e(S,Io),e(Io,Rh),e(Io,jo),e(jo,Bh),e(Io,Qh),e(S,Uh),e(S,ee),T(Do,ee,null),e(ee,Vh),e(ee,We),e(We,Gh),e(We,ar),e(ar,Kh),e(We,Jh),e(We,Ms),e(Ms,Yh),e(We,Xh),e(ee,Zh),T(vt,ee,null),_(o,ya,g),_(o,He,g),e(He,yt),e(yt,Fs),T(Wo,Fs,null),e(He,ep),e(He,xs),e(xs,tp),_(o,Ta,g),_(o,I,g),T(Ho,I,null),e(I,op),e(I,Ps),e(Ps,np),e(I,rp),e(I,Ro),e(Ro,sp),e(Ro,ir),e(ir,ap),e(Ro,ip),e(I,dp),e(I,Bo),e(Bo,lp),e(Bo,Qo),e(Qo,cp),e(Bo,hp),e(I,pp),e(I,Y),T(Uo,Y,null),e(Y,mp),e(Y,Re),e(Re,up),e(Re,dr),e(dr,fp),e(Re,gp),e(Re,Cs),e(Cs,_p),e(Re,kp),e(Y,bp),T(Tt,Y,null),e(Y,vp),T(Et,Y,null),_(o,Ea,g),_(o,Be,g),e(Be,wt),e(wt,qs),T(Vo,qs,null),e(Be,yp),e(Be,As),e(As,Tp),_(o,wa,g),_(o,j,g),T(Go,j,null),e(j,Ep),e(j,Ns),e(Ns,wp),e(j,$p),e(j,Ko),e(Ko,zp),e(Ko,lr),e(lr,Mp),e(Ko,Fp),e(j,xp),e(j,Jo),e(Jo,Pp),e(Jo,Yo),e(Yo,Cp),e(Jo,qp),e(j,Ap),e(j,te),T(Xo,te,null),e(te,Np),e(te,Qe),e(Qe,Op),e(Qe,cr),e(cr,Lp),e(Qe,Sp),e(Qe,Os),e(Os,Ip),e(Qe,jp),e(te,Dp),T($t,te,null),_(o,$a,g),_(o,Ue,g),e(Ue,zt),e(zt,Ls),T(Zo,Ls,null),e(Ue,Wp),e(Ue,Ss),e(Ss,Hp),_(o,za,g),_(o,D,g),T(en,D,null),e(D,Rp),e(D,Ve),e(Ve,Bp),e(Ve,Is),e(Is,Qp),e(Ve,Up),e(Ve,js),e(js,Vp),e(Ve,Gp),e(D,Kp),e(D,tn),e(tn,Jp),e(tn,hr),e(hr,Yp),e(tn,Xp),e(D,Zp),e(D,on),e(on,em),e(on,nn),e(nn,tm),e(on,om),e(D,nm),e(D,oe),T(rn,oe,null),e(oe,rm),e(oe,Ge),e(Ge,sm),e(Ge,pr),e(pr,am),e(Ge,im),e(Ge,Ds),e(Ds,dm),e(Ge,lm),e(oe,cm),T(Mt,oe,null),Ma=!0},p(o,[g]){const sn={};g&2&&(sn.$$scope={dirty:g,ctx:o}),ot.$set(sn);const Ws={};g&2&&(Ws.$$scope={dirty:g,ctx:o}),st.$set(Ws);const Hs={};g&2&&(Hs.$$scope={dirty:g,ctx:o}),at.$set(Hs);const Rs={};g&2&&(Rs.$$scope={dirty:g,ctx:o}),dt.$set(Rs);const an={};g&2&&(an.$$scope={dirty:g,ctx:o}),lt.$set(an);const Bs={};g&2&&(Bs.$$scope={dirty:g,ctx:o}),ht.$set(Bs);const Qs={};g&2&&(Qs.$$scope={dirty:g,ctx:o}),pt.$set(Qs);const Us={};g&2&&(Us.$$scope={dirty:g,ctx:o}),ut.$set(Us);const Ke={};g&2&&(Ke.$$scope={dirty:g,ctx:o}),ft.$set(Ke);const Vs={};g&2&&(Vs.$$scope={dirty:g,ctx:o}),_t.$set(Vs);const Gs={};g&2&&(Gs.$$scope={dirty:g,ctx:o}),kt.$set(Gs);const dn={};g&2&&(dn.$$scope={dirty:g,ctx:o}),vt.$set(dn);const Ks={};g&2&&(Ks.$$scope={dirty:g,ctx:o}),Tt.$set(Ks);const Js={};g&2&&(Js.$$scope={dirty:g,ctx:o}),Et.$set(Js);const Ys={};g&2&&(Ys.$$scope={dirty:g,ctx:o}),$t.$set(Ys);const ln={};g&2&&(ln.$$scope={dirty:g,ctx:o}),Mt.$set(ln)},i(o){Ma||(E(d.$$.fragment,o),E(It.$$.fragment,o),E(Wt.$$.fragment,o),E(Ht.$$.fragment,o),E(Rt.$$.fragment,o),E(Vt.$$.fragment,o),E(Gt.$$.fragment,o),E(ot.$$.fragment,o),E(Jt.$$.fragment,o),E(Yt.$$.fragment,o),E(Zt.$$.fragment,o),E(eo.$$.fragment,o),E(ao.$$.fragment,o),E(st.$$.fragment,o),E(at.$$.fragment,o),E(io.$$.fragment,o),E(lo.$$.fragment,o),E(mo.$$.fragment,o),E(dt.$$.fragment,o),E(lt.$$.fragment,o),E(uo.$$.fragment,o),E(fo.$$.fragment,o),E(vo.$$.fragment,o),E(ht.$$.fragment,o),E(pt.$$.fragment,o),E(yo.$$.fragment,o),E(To.$$.fragment,o),E(Mo.$$.fragment,o),E(ut.$$.fragment,o),E(ft.$$.fragment,o),E(Fo.$$.fragment,o),E(xo.$$.fragment,o),E(No.$$.fragment,o),E(_t.$$.fragment,o),E(kt.$$.fragment,o),E(Oo.$$.fragment,o),E(Lo.$$.fragment,o),E(Do.$$.fragment,o),E(vt.$$.fragment,o),E(Wo.$$.fragment,o),E(Ho.$$.fragment,o),E(Uo.$$.fragment,o),E(Tt.$$.fragment,o),E(Et.$$.fragment,o),E(Vo.$$.fragment,o),E(Go.$$.fragment,o),E(Xo.$$.fragment,o),E($t.$$.fragment,o),E(Zo.$$.fragment,o),E(en.$$.fragment,o),E(rn.$$.fragment,o),E(Mt.$$.fragment,o),Ma=!0)},o(o){w(d.$$.fragment,o),w(It.$$.fragment,o),w(Wt.$$.fragment,o),w(Ht.$$.fragment,o),w(Rt.$$.fragment,o),w(Vt.$$.fragment,o),w(Gt.$$.fragment,o),w(ot.$$.fragment,o),w(Jt.$$.fragment,o),w(Yt.$$.fragment,o),w(Zt.$$.fragment,o),w(eo.$$.fragment,o),w(ao.$$.fragment,o),w(st.$$.fragment,o),w(at.$$.fragment,o),w(io.$$.fragment,o),w(lo.$$.fragment,o),w(mo.$$.fragment,o),w(dt.$$.fragment,o),w(lt.$$.fragment,o),w(uo.$$.fragment,o),w(fo.$$.fragment,o),w(vo.$$.fragment,o),w(ht.$$.fragment,o),w(pt.$$.fragment,o),w(yo.$$.fragment,o),w(To.$$.fragment,o),w(Mo.$$.fragment,o),w(ut.$$.fragment,o),w(ft.$$.fragment,o),w(Fo.$$.fragment,o),w(xo.$$.fragment,o),w(No.$$.fragment,o),w(_t.$$.fragment,o),w(kt.$$.fragment,o),w(Oo.$$.fragment,o),w(Lo.$$.fragment,o),w(Do.$$.fragment,o),w(vt.$$.fragment,o),w(Wo.$$.fragment,o),w(Ho.$$.fragment,o),w(Uo.$$.fragment,o),w(Tt.$$.fragment,o),w(Et.$$.fragment,o),w(Vo.$$.fragment,o),w(Go.$$.fragment,o),w(Xo.$$.fragment,o),w($t.$$.fragment,o),w(Zo.$$.fragment,o),w(en.$$.fragment,o),w(rn.$$.fragment,o),w(Mt.$$.fragment,o),Ma=!1},d(o){t(p),o&&t(b),o&&t(f),$(d),o&&t(Xs),o&&t(he),$(It),o&&t(Zs),o&&t(Z),o&&t(ea),o&&t(pe),$(Wt),o&&t(ta),$(Ht,o),o&&t(oa),o&&t(me),$(Rt),o&&t(na),o&&t(et),o&&t(ra),o&&t(Q),o&&t(sa),o&&t($e),$(Vt),o&&t(aa),o&&t(B),$(Gt),$(ot),o&&t(ia),o&&t(Me),$(Jt),o&&t(da),o&&t(Fe),$(Yt),o&&t(la),o&&t(xe),$(Zt),o&&t(ca),o&&t(C),$(eo),$(ao),$(st),$(at),o&&t(ha),o&&t(Ce),$(io),o&&t(pa),o&&t(A),$(lo),$(mo),$(dt),$(lt),o&&t(ma),o&&t(Ne),$(uo),o&&t(ua),o&&t(N),$(fo),$(vo),$(ht),$(pt),o&&t(fa),o&&t(Le),$(yo),o&&t(ga),o&&t(O),$(To),$(Mo),$(ut),$(ft),o&&t(_a),o&&t(Ie),$(Fo),o&&t(ka),o&&t(L),$(xo),$(No),$(_t),$(kt),o&&t(ba),o&&t(De),$(Oo),o&&t(va),o&&t(S),$(Lo),$(Do),$(vt),o&&t(ya),o&&t(He),$(Wo),o&&t(Ta),o&&t(I),$(Ho),$(Uo),$(Tt),$(Et),o&&t(Ea),o&&t(Be),$(Vo),o&&t(wa),o&&t(j),$(Go),$(Xo),$($t),o&&t($a),o&&t(Ue),$(Zo),o&&t(za),o&&t(D),$(en),$(rn),$(Mt)}}}const sg={local:"ernie",sections:[{local:"overview",sections:[{local:"how-to-use",title:"How to use"},{local:"supported-models",title:"Supported Models"}],title:"Overview"},{local:"transformers.ErnieConfig",title:"ErnieConfig"},{local:"transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput",title:"Ernie specific outputs"},{local:"transformers.ErnieModel",title:"ErnieModel"},{local:"transformers.ErnieForPreTraining",title:"ErnieForPreTraining"},{local:"transformers.ErnieForCausalLM",title:"ErnieForCausalLM"},{local:"transformers.ErnieForMaskedLM",title:"ErnieForMaskedLM"},{local:"transformers.ErnieForNextSentencePrediction",title:"ErnieForNextSentencePrediction"},{local:"transformers.ErnieForSequenceClassification",title:"ErnieForSequenceClassification"},{local:"transformers.ErnieForMultipleChoice",title:"ErnieForMultipleChoice"},{local:"transformers.ErnieForTokenClassification",title:"ErnieForTokenClassification"},{local:"transformers.ErnieForQuestionAnswering",title:"ErnieForQuestionAnswering"}],title:"ERNIE"};function ag(z){return Wf(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class mg extends Sf{constructor(p){super();If(this,p,ag,rg,jf,{})}}export{mg as default,sg as metadata};
