import{S as Ag,i as Ng,s as Og,e as n,k as c,w as b,t as a,M as Lg,c as r,d as t,m as h,a as s,x as y,h as i,b as d,G as e,g as _,y as T,q as E,o as w,B as $,v as Sg,L as gn}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ze}from"../../chunks/Tip-hf-doc-builder.js";import{D as P}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Wt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as N}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as fn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Ig(z){let p,k,g,m,v;return m=new Wt({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"),k=a("Examples:"),g=c(),b(m.$$.fragment)},l(l){p=r(l,"P",{});var u=s(p);k=i(u,"Examples:"),u.forEach(t),g=h(l),y(m.$$.fragment,l)},m(l,u){_(l,p,u),e(p,k),_(l,g,u),T(m,l,u),v=!0},p:gn,i(l){v||(E(m.$$.fragment,l),v=!0)},o(l){w(m.$$.fragment,l),v=!1},d(l){l&&t(p),l&&t(g),$(m,l)}}}function jg(z){let p,k,g,m,v;return{c(){p=n("p"),k=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),m=a("Module"),v=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(l){p=r(l,"P",{});var u=s(p);k=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(u,"CODE",{});var M=s(g);m=i(M,"Module"),M.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){_(l,p,u),e(p,k),e(p,g),e(g,m),e(p,v)},d(l){l&&t(p)}}}function Dg(z){let p,k,g,m,v;return m=new Wt({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"),k=a("Example:"),g=c(),b(m.$$.fragment)},l(l){p=r(l,"P",{});var u=s(p);k=i(u,"Example:"),u.forEach(t),g=h(l),y(m.$$.fragment,l)},m(l,u){_(l,p,u),e(p,k),_(l,g,u),T(m,l,u),v=!0},p:gn,i(l){v||(E(m.$$.fragment,l),v=!0)},o(l){w(m.$$.fragment,l),v=!1},d(l){l&&t(p),l&&t(g),$(m,l)}}}function Wg(z){let p,k,g,m,v;return{c(){p=n("p"),k=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),m=a("Module"),v=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(l){p=r(l,"P",{});var u=s(p);k=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(u,"CODE",{});var M=s(g);m=i(M,"Module"),M.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){_(l,p,u),e(p,k),e(p,g),e(g,m),e(p,v)},d(l){l&&t(p)}}}function Hg(z){let p,k,g,m,v;return m=new Wt({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"),k=a("Example:"),g=c(),b(m.$$.fragment)},l(l){p=r(l,"P",{});var u=s(p);k=i(u,"Example:"),u.forEach(t),g=h(l),y(m.$$.fragment,l)},m(l,u){_(l,p,u),e(p,k),_(l,g,u),T(m,l,u),v=!0},p:gn,i(l){v||(E(m.$$.fragment,l),v=!0)},o(l){w(m.$$.fragment,l),v=!1},d(l){l&&t(p),l&&t(g),$(m,l)}}}function Rg(z){let p,k,g,m,v;return{c(){p=n("p"),k=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),m=a("Module"),v=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(l){p=r(l,"P",{});var u=s(p);k=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(u,"CODE",{});var M=s(g);m=i(M,"Module"),M.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){_(l,p,u),e(p,k),e(p,g),e(g,m),e(p,v)},d(l){l&&t(p)}}}function Qg(z){let p,k,g,m,v;return m=new Wt({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"),k=a("Example:"),g=c(),b(m.$$.fragment)},l(l){p=r(l,"P",{});var u=s(p);k=i(u,"Example:"),u.forEach(t),g=h(l),y(m.$$.fragment,l)},m(l,u){_(l,p,u),e(p,k),_(l,g,u),T(m,l,u),v=!0},p:gn,i(l){v||(E(m.$$.fragment,l),v=!0)},o(l){w(m.$$.fragment,l),v=!1},d(l){l&&t(p),l&&t(g),$(m,l)}}}function Ug(z){let p,k,g,m,v;return{c(){p=n("p"),k=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),m=a("Module"),v=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(l){p=r(l,"P",{});var u=s(p);k=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(u,"CODE",{});var M=s(g);m=i(M,"Module"),M.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){_(l,p,u),e(p,k),e(p,g),e(g,m),e(p,v)},d(l){l&&t(p)}}}function Bg(z){let p,k,g,m,v;return m=new Wt({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"),k=a("Example:"),g=c(),b(m.$$.fragment)},l(l){p=r(l,"P",{});var u=s(p);k=i(u,"Example:"),u.forEach(t),g=h(l),y(m.$$.fragment,l)},m(l,u){_(l,p,u),e(p,k),_(l,g,u),T(m,l,u),v=!0},p:gn,i(l){v||(E(m.$$.fragment,l),v=!0)},o(l){w(m.$$.fragment,l),v=!1},d(l){l&&t(p),l&&t(g),$(m,l)}}}function Vg(z){let p,k,g,m,v;return{c(){p=n("p"),k=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),m=a("Module"),v=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(l){p=r(l,"P",{});var u=s(p);k=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(u,"CODE",{});var M=s(g);m=i(M,"Module"),M.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){_(l,p,u),e(p,k),e(p,g),e(g,m),e(p,v)},d(l){l&&t(p)}}}function Gg(z){let p,k,g,m,v;return m=new Wt({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"),k=a("Example:"),g=c(),b(m.$$.fragment)},l(l){p=r(l,"P",{});var u=s(p);k=i(u,"Example:"),u.forEach(t),g=h(l),y(m.$$.fragment,l)},m(l,u){_(l,p,u),e(p,k),_(l,g,u),T(m,l,u),v=!0},p:gn,i(l){v||(E(m.$$.fragment,l),v=!0)},o(l){w(m.$$.fragment,l),v=!1},d(l){l&&t(p),l&&t(g),$(m,l)}}}function Kg(z){let p,k,g,m,v;return{c(){p=n("p"),k=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),m=a("Module"),v=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(l){p=r(l,"P",{});var u=s(p);k=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(u,"CODE",{});var M=s(g);m=i(M,"Module"),M.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){_(l,p,u),e(p,k),e(p,g),e(g,m),e(p,v)},d(l){l&&t(p)}}}function Jg(z){let p,k,g,m,v;return{c(){p=n("p"),k=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),m=a("Module"),v=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(l){p=r(l,"P",{});var u=s(p);k=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(u,"CODE",{});var M=s(g);m=i(M,"Module"),M.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){_(l,p,u),e(p,k),e(p,g),e(g,m),e(p,v)},d(l){l&&t(p)}}}function Yg(z){let p,k,g,m,v;return m=new Wt({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"),k=a("Example:"),g=c(),b(m.$$.fragment)},l(l){p=r(l,"P",{});var u=s(p);k=i(u,"Example:"),u.forEach(t),g=h(l),y(m.$$.fragment,l)},m(l,u){_(l,p,u),e(p,k),_(l,g,u),T(m,l,u),v=!0},p:gn,i(l){v||(E(m.$$.fragment,l),v=!0)},o(l){w(m.$$.fragment,l),v=!1},d(l){l&&t(p),l&&t(g),$(m,l)}}}function Xg(z){let p,k,g,m,v;return{c(){p=n("p"),k=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),m=a("Module"),v=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(l){p=r(l,"P",{});var u=s(p);k=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(u,"CODE",{});var M=s(g);m=i(M,"Module"),M.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){_(l,p,u),e(p,k),e(p,g),e(g,m),e(p,v)},d(l){l&&t(p)}}}function Zg(z){let p,k,g,m,v;return{c(){p=n("p"),k=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),m=a("Module"),v=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(l){p=r(l,"P",{});var u=s(p);k=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=r(u,"CODE",{});var M=s(g);m=i(M,"Module"),M.forEach(t),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(l,u){_(l,p,u),e(p,k),e(p,g),e(g,m),e(p,v)},d(l){l&&t(p)}}}function e_(z){let p,k,g,m,v,l,u,M,qi,_a,ue,et,Jr,Ht,Ai,Yr,Ni,va,te,Oi,Rt,Li,Si,Qt,Ii,ji,ka,me,tt,Xr,Ut,Di,Zr,Wi,ba,Bt,ya,fe,ot,es,Vt,Hi,ts,Ri,Ta,nt,os,ge,_n,Qi,Ui,vn,Bi,Vi,kn,Gi,Ki,F,_e,bn,Ji,Yi,yn,Xi,Zi,Tn,ed,td,ve,En,od,nd,wn,rd,sd,$n,ad,id,ke,zn,dd,ld,Mn,cd,hd,Fn,pd,ud,be,xn,md,fd,Pn,gd,_d,Cn,vd,kd,ye,qn,bd,yd,An,Td,Ed,Nn,wd,$d,Te,On,zd,Md,Ln,Fd,xd,Sn,Pd,Cd,Ee,In,qd,Ad,jn,Nd,Od,Dn,Ld,Sd,we,Wn,Id,jd,Hn,Dd,Wd,Rn,Hd,Rd,$e,Qn,Qd,Ud,Un,Bd,Vd,Bn,Gd,Kd,ze,Vn,Jd,Yd,Gn,Xd,Zd,Kn,el,Ea,B,tl,Gt,ol,nl,Kt,rl,sl,Jt,al,il,wa,Me,rt,ns,Yt,dl,rs,ll,$a,A,ss,Jn,cl,hl,as,Yn,pl,ul,is,Xn,ml,fl,ds,Zn,gl,_l,ls,er,vl,kl,cs,tr,bl,za,Fe,st,hs,Xt,yl,ps,Tl,Ma,U,Zt,El,ee,wl,or,$l,zl,us,Ml,Fl,eo,xl,Pl,Cl,xe,ql,nr,Al,Nl,rr,Ol,Ll,Sl,at,Fa,Pe,it,ms,to,Il,fs,jl,xa,Ce,oo,Dl,no,Wl,sr,Hl,Rl,Pa,qe,dt,gs,ro,Ql,_s,Ul,Ca,C,so,Bl,vs,Vl,Gl,ao,Kl,ar,Jl,Yl,Xl,io,Zl,lo,ec,tc,oc,co,nc,ho,rc,sc,ac,q,ic,ks,dc,lc,bs,cc,hc,ys,pc,uc,Ts,mc,fc,Es,gc,_c,ws,vc,kc,bc,V,po,yc,Ae,Tc,ir,Ec,wc,$s,$c,zc,Mc,lt,Fc,ct,qa,Ne,ht,zs,uo,xc,Ms,Pc,Aa,O,mo,Cc,Oe,qc,Fs,Ac,Nc,xs,Oc,Lc,Sc,fo,Ic,dr,jc,Dc,Wc,go,Hc,_o,Rc,Qc,Uc,G,vo,Bc,Le,Vc,lr,Gc,Kc,Ps,Jc,Yc,Xc,pt,Zc,ut,Na,Se,mt,Cs,ko,eh,qs,th,Oa,L,bo,oh,yo,nh,As,rh,sh,ah,To,ih,cr,dh,lh,ch,Eo,hh,wo,ph,uh,mh,K,$o,fh,Ie,gh,hr,_h,vh,Ns,kh,bh,yh,ft,Th,gt,La,je,_t,Os,zo,Eh,Ls,wh,Sa,S,Mo,$h,Fo,zh,Ss,Mh,Fh,xh,xo,Ph,pr,Ch,qh,Ah,Po,Nh,Co,Oh,Lh,Sh,J,qo,Ih,De,jh,ur,Dh,Wh,Is,Hh,Rh,Qh,vt,Uh,kt,Ia,We,bt,js,Ao,Bh,Ds,Vh,ja,I,No,Gh,Oo,Kh,Ws,Jh,Yh,Xh,Lo,Zh,mr,ep,tp,op,So,np,Io,rp,sp,ap,Y,jo,ip,He,dp,fr,lp,cp,Hs,hp,pp,up,yt,mp,Tt,Da,Re,Et,Rs,Do,fp,Qs,gp,Wa,j,Wo,_p,Us,vp,kp,Ho,bp,gr,yp,Tp,Ep,Ro,wp,Qo,$p,zp,Mp,oe,Uo,Fp,Qe,xp,_r,Pp,Cp,Bs,qp,Ap,Np,wt,Ha,Ue,$t,Vs,Bo,Op,Gs,Lp,Ra,D,Vo,Sp,Ks,Ip,jp,Go,Dp,vr,Wp,Hp,Rp,Ko,Qp,Jo,Up,Bp,Vp,X,Yo,Gp,Be,Kp,kr,Jp,Yp,Js,Xp,Zp,eu,zt,tu,Mt,Qa,Ve,Ft,Ys,Xo,ou,Xs,nu,Ua,W,Zo,ru,Zs,su,au,en,iu,br,du,lu,cu,tn,hu,on,pu,uu,mu,ne,nn,fu,Ge,gu,yr,_u,vu,ea,ku,bu,yu,xt,Ba,Ke,Pt,ta,rn,Tu,oa,Eu,Va,H,sn,wu,Je,$u,na,zu,Mu,ra,Fu,xu,Pu,an,Cu,Tr,qu,Au,Nu,dn,Ou,ln,Lu,Su,Iu,re,cn,ju,Ye,Du,Er,Wu,Hu,sa,Ru,Qu,Uu,Ct,Ga;return l=new N({}),Ht=new N({}),Ut=new N({}),Bt=new Wt({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>)`}}),Vt=new N({}),Yt=new N({}),Xt=new N({}),Zt=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/v4.29.0/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/v4.29.0/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/v4.29.0/src/transformers/models/ernie/configuration_ernie.py#L41"}}),at=new fn({props:{anchor:"transformers.ErnieConfig.example",$$slots:{default:[Ig]},$$scope:{ctx:z}}}),to=new N({}),oo=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/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L689"}}),ro=new N({}),so=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L797"}}),po=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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/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/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L840",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),lt=new Ze({props:{$$slots:{default:[jg]},$$scope:{ctx:z}}}),ct=new fn({props:{anchor:"transformers.ErnieModel.forward.example",$$slots:{default:[Dg]},$$scope:{ctx:z}}}),uo=new N({}),mo=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L985"}}),vo=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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/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/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1006",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/en/model_doc/ernie#transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput"
>transformers.models.ernie.modeling_ernie.ErnieForPreTrainingOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),pt=new Ze({props:{$$slots:{default:[Wg]},$$scope:{ctx:z}}}),ut=new fn({props:{anchor:"transformers.ErnieForPreTraining.forward.example",$$slots:{default:[Hg]},$$scope:{ctx:z}}}),ko=new N({}),bo=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1096"}}),$o=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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/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/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1121",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ft=new Ze({props:{$$slots:{default:[Rg]},$$scope:{ctx:z}}}),gt=new fn({props:{anchor:"transformers.ErnieForCausalLM.forward.example",$$slots:{default:[Qg]},$$scope:{ctx:z}}}),zo=new N({}),Mo=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1243"}}),qo=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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/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/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1271",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),vt=new Ze({props:{$$slots:{default:[Ug]},$$scope:{ctx:z}}}),kt=new fn({props:{anchor:"transformers.ErnieForMaskedLM.forward.example",$$slots:{default:[Bg]},$$scope:{ctx:z}}}),Ao=new N({}),No=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1360"}}),jo=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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/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/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1371",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_outputs.NextSentencePredictorOutput"
>transformers.modeling_outputs.NextSentencePredictorOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),yt=new Ze({props:{$$slots:{default:[Vg]},$$scope:{ctx:z}}}),Tt=new fn({props:{anchor:"transformers.ErnieForNextSentencePrediction.forward.example",$$slots:{default:[Gg]},$$scope:{ctx:z}}}),Do=new N({}),Wo=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1468"}}),Uo=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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/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/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1485"}}),wt=new Ze({props:{$$slots:{default:[Kg]},$$scope:{ctx:z}}}),Bo=new N({}),Vo=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1567"}}),Yo=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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/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/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1582",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput"
>transformers.modeling_outputs.MultipleChoiceModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput"
>transformers.modeling_outputs.MultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),zt=new Ze({props:{$$slots:{default:[Jg]},$$scope:{ctx:z}}}),Mt=new fn({props:{anchor:"transformers.ErnieForMultipleChoice.forward.example",$$slots:{default:[Yg]},$$scope:{ctx:z}}}),Xo=new N({}),Zo=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1664"}}),nn=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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/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/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1682"}}),xt=new Ze({props:{$$slots:{default:[Xg]},$$scope:{ctx:z}}}),rn=new N({}),sn=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1745"}}),cn=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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/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/v4.29.0/src/transformers/models/ernie/modeling_ernie.py#L1759"}}),Ct=new Ze({props:{$$slots:{default:[Zg]},$$scope:{ctx:z}}}),{c(){p=n("meta"),k=c(),g=n("h1"),m=n("a"),v=n("span"),b(l.$$.fragment),u=c(),M=n("span"),qi=a("ERNIE"),_a=c(),ue=n("h2"),et=n("a"),Jr=n("span"),b(Ht.$$.fragment),Ai=c(),Yr=n("span"),Ni=a("Overview"),va=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.
`),te=n("p"),Oi=a("These models are contributed by "),Rt=n("a"),Li=a("nghuyong"),Si=a(" and the official code can be found in "),Qt=n("a"),Ii=a("PaddleNLP"),ji=a(" (in PaddlePaddle)."),ka=c(),me=n("h3"),tt=n("a"),Xr=n("span"),b(Ut.$$.fragment),Di=c(),Zr=n("span"),Wi=a("How to use"),ba=a(`

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

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

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

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