import{S as Hc,i as Qc,s as Uc,e as n,k as c,w as k,t as a,M as Rc,c as s,d as o,m as p,a as r,x as E,h as i,b as h,G as e,g as _,y as w,q as M,o as y,B as T,v as Vc,L as Jo}from"../../chunks/vendor-hf-doc-builder.js";import{T as Bo}from"../../chunks/Tip-hf-doc-builder.js";import{D as x}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ko}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as V}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Go}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Bc($){let d,v,g,u,b;return{c(){d=n("p"),v=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=a("Module"),b=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){d=s(l,"P",{});var m=r(d);v=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var z=r(g);u=i(z,"Module"),z.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,v),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function Gc($){let d,v,g,u,b;return u=new Ko({props:{code:`from transformers import AutoTokenizer, ErnieMModel
import torch

tokenizer = AutoTokenizer.from_pretrained("susnato/ernie-m-base_pytorch")
model = ErnieMModel.from_pretrained("susnato/ernie-m-base_pytorch")

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, ErnieMModel
<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;susnato/ernie-m-base_pytorch&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieMModel.from_pretrained(<span class="hljs-string">&quot;susnato/ernie-m-base_pytorch&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

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

tokenizer = AutoTokenizer.from_pretrained("susnato/ernie-m-base_pytorch")
model = ErnieMForSequenceClassification.from_pretrained("susnato/ernie-m-base_pytorch")

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

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

predicted_class_id = logits.argmax().item()

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = ErnieMForSequenceClassification.from_pretrained("susnato/ernie-m-base_pytorch", num_labels=num_labels)

labels = torch.tensor([1])
loss = model(**inputs, labels=labels).loss`,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, ErnieMForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;susnato/ernie-m-base_pytorch&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieMForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;susnato/ernie-m-base_pytorch&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = logits.argmax().item()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieMForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;susnato/ernie-m-base_pytorch&quot;</span>, num_labels=num_labels)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor([<span class="hljs-number">1</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=n("p"),v=a("Example of single-label classification:"),g=c(),k(u.$$.fragment)},l(l){d=s(l,"P",{});var m=r(d);v=i(m,"Example of single-label classification:"),m.forEach(o),g=p(l),E(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,v),_(l,g,m),w(u,l,m),b=!0},p:Jo,i(l){b||(M(u.$$.fragment,l),b=!0)},o(l){y(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),T(u,l)}}}function Xc($){let d,v,g,u,b;return u=new Ko({props:{code:`import torch
from transformers import AutoTokenizer, ErnieMForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("susnato/ernie-m-base_pytorch")
model = ErnieMForSequenceClassification.from_pretrained("susnato/ernie-m-base_pytorch", problem_type="multi_label_classification")

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

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

predicted_class_ids = torch.arange(0, logits.shape[-1])[torch.sigmoid(logits).squeeze(dim=0) > 0.5]

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = ErnieMForSequenceClassification.from_pretrained(
    "susnato/ernie-m-base_pytorch", num_labels=num_labels, problem_type="multi_label_classification"
)

labels = torch.sum(
    torch.nn.functional.one_hot(predicted_class_ids[None, :].clone(), num_classes=num_labels), dim=1
).to(torch.float)
loss = model(**inputs, labels=labels).loss`,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, ErnieMForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;susnato/ernie-m-base_pytorch&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieMForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;susnato/ernie-m-base_pytorch&quot;</span>, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_ids = torch.arange(<span class="hljs-number">0</span>, logits.shape[-<span class="hljs-number">1</span>])[torch.sigmoid(logits).squeeze(dim=<span class="hljs-number">0</span>) &gt; <span class="hljs-number">0.5</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieMForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;susnato/ernie-m-base_pytorch&quot;</span>, num_labels=num_labels, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.<span class="hljs-built_in">sum</span>(
<span class="hljs-meta">... </span>    torch.nn.functional.one_hot(predicted_class_ids[<span class="hljs-literal">None</span>, :].clone(), num_classes=num_labels), dim=<span class="hljs-number">1</span>
<span class="hljs-meta">... </span>).to(torch.<span class="hljs-built_in">float</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=n("p"),v=a("Example of multi-label classification:"),g=c(),k(u.$$.fragment)},l(l){d=s(l,"P",{});var m=r(d);v=i(m,"Example of multi-label classification:"),m.forEach(o),g=p(l),E(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,v),_(l,g,m),w(u,l,m),b=!0},p:Jo,i(l){b||(M(u.$$.fragment,l),b=!0)},o(l){y(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),T(u,l)}}}function Yc($){let d,v,g,u,b;return{c(){d=n("p"),v=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=a("Module"),b=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){d=s(l,"P",{});var m=r(d);v=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var z=r(g);u=i(z,"Module"),z.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,v),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function Zc($){let d,v,g,u,b;return u=new Ko({props:{code:`from transformers import AutoTokenizer, ErnieMForMultipleChoice
import torch

tokenizer = AutoTokenizer.from_pretrained("susnato/ernie-m-base_pytorch")
model = ErnieMForMultipleChoice.from_pretrained("susnato/ernie-m-base_pytorch")

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, ErnieMForMultipleChoice
<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;susnato/ernie-m-base_pytorch&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieMForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;susnato/ernie-m-base_pytorch&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>choice0 = <span class="hljs-string">&quot;It is eaten with a fork and a knife.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>choice1 = <span class="hljs-string">&quot;It is eaten while held in the hand.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor(<span class="hljs-number">0</span>).unsqueeze(<span class="hljs-number">0</span>)  <span class="hljs-comment"># choice0 is correct (according to Wikipedia ;)), batch size 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**{k: v.unsqueeze(<span class="hljs-number">0</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> encoding.items()}, labels=labels)  <span class="hljs-comment"># batch size is 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># the linear classifier still needs to be trained</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){d=n("p"),v=a("Example:"),g=c(),k(u.$$.fragment)},l(l){d=s(l,"P",{});var m=r(d);v=i(m,"Example:"),m.forEach(o),g=p(l),E(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,v),_(l,g,m),w(u,l,m),b=!0},p:Jo,i(l){b||(M(u.$$.fragment,l),b=!0)},o(l){y(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),T(u,l)}}}function ep($){let d,v,g,u,b;return{c(){d=n("p"),v=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=a("Module"),b=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){d=s(l,"P",{});var m=r(d);v=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var z=r(g);u=i(z,"Module"),z.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,v),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function tp($){let d,v,g,u,b;return u=new Ko({props:{code:`from transformers import AutoTokenizer, ErnieMForTokenClassification
import torch

tokenizer = AutoTokenizer.from_pretrained("susnato/ernie-m-base_pytorch")
model = ErnieMForTokenClassification.from_pretrained("susnato/ernie-m-base_pytorch")

inputs = tokenizer(
    "HuggingFace is a company based in Paris and New York", add_special_tokens=False, return_tensors="pt"
)

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

predicted_token_class_ids = logits.argmax(-1)

# Note that tokens are classified rather then input words which means that
# there might be more predicted token classes than words.
# Multiple token classes might account for the same word
predicted_tokens_classes = [model.config.id2label[t.item()] for t in predicted_token_class_ids[0]]

labels = predicted_token_class_ids
loss = model(**inputs, labels=labels).loss`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ErnieMForTokenClassification
<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;susnato/ernie-m-base_pytorch&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieMForTokenClassification.from_pretrained(<span class="hljs-string">&quot;susnato/ernie-m-base_pytorch&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;HuggingFace is a company based in Paris and New York&quot;</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_class_ids = logits.argmax(-<span class="hljs-number">1</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Note that tokens are classified rather then input words which means that</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># there might be more predicted token classes than words.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Multiple token classes might account for the same word</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_tokens_classes = [model.config.id2label[t.item()] <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> predicted_token_class_ids[<span class="hljs-number">0</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = predicted_token_class_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=n("p"),v=a("Example:"),g=c(),k(u.$$.fragment)},l(l){d=s(l,"P",{});var m=r(d);v=i(m,"Example:"),m.forEach(o),g=p(l),E(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,v),_(l,g,m),w(u,l,m),b=!0},p:Jo,i(l){b||(M(u.$$.fragment,l),b=!0)},o(l){y(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),T(u,l)}}}function op($){let d,v,g,u,b;return{c(){d=n("p"),v=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=a("Module"),b=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){d=s(l,"P",{});var m=r(d);v=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var z=r(g);u=i(z,"Module"),z.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,v),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function np($){let d,v,g,u,b;return u=new Ko({props:{code:`from transformers import AutoTokenizer, ErnieMForQuestionAnswering
import torch

tokenizer = AutoTokenizer.from_pretrained("susnato/ernie-m-base_pytorch")
model = ErnieMForQuestionAnswering.from_pretrained("susnato/ernie-m-base_pytorch")

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"

inputs = tokenizer(question, text, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)

answer_start_index = outputs.start_logits.argmax()
answer_end_index = outputs.end_logits.argmax()

predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]

# target is "nice puppet"
target_start_index = torch.tensor([14])
target_end_index = torch.tensor([15])

outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index)
loss = outputs.loss`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ErnieMForQuestionAnswering
<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;susnato/ernie-m-base_pytorch&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ErnieMForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;susnato/ernie-m-base_pytorch&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>question, text = <span class="hljs-string">&quot;Who was Jim Henson?&quot;</span>, <span class="hljs-string">&quot;Jim Henson was a nice puppet&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>answer_start_index = outputs.start_logits.argmax()
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_end_index = outputs.end_logits.argmax()

<span class="hljs-meta">&gt;&gt;&gt; </span>predict_answer_tokens = inputs.input_ids[<span class="hljs-number">0</span>, answer_start_index : answer_end_index + <span class="hljs-number">1</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># target is &quot;nice puppet&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_start_index = torch.tensor([<span class="hljs-number">14</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>target_end_index = torch.tensor([<span class="hljs-number">15</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss`}}),{c(){d=n("p"),v=a("Example:"),g=c(),k(u.$$.fragment)},l(l){d=s(l,"P",{});var m=r(d);v=i(m,"Example:"),m.forEach(o),g=p(l),E(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,v),_(l,g,m),w(u,l,m),b=!0},p:Jo,i(l){b||(M(u.$$.fragment,l),b=!0)},o(l){y(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),T(u,l)}}}function sp($){let d,v,g,u,b;return{c(){d=n("p"),v=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=a("Module"),b=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){d=s(l,"P",{});var m=r(d);v=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var z=r(g);u=i(z,"Module"),z.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,v),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function rp($){let d,v,g,u,b,l,m,z,sr,rs,ne,ye,Xo,nt,rr,Yo,ar,as,Te,ir,st,lr,dr,is,ao,cr,ls,io,Zo,pr,ds,lo,hr,cs,N,en,mr,ur,se,fr,tn,gr,_r,on,br,vr,kr,nn,Er,wr,sn,Mr,ps,B,yr,rt,Tr,$r,at,zr,xr,hs,re,$e,rn,it,qr,an,Fr,ms,D,ln,co,Cr,Pr,dn,po,jr,Ar,cn,ho,Sr,Ir,pn,mo,Or,us,ae,ze,hn,lt,Nr,mn,Dr,fs,O,dt,Lr,R,Wr,uo,Hr,Qr,un,Ur,Rr,ct,Vr,Br,Gr,ie,Jr,fo,Kr,Xr,go,Yr,Zr,ea,le,ta,fn,oa,na,gn,sa,ra,gs,de,xe,_n,pt,aa,bn,ia,_s,q,ht,la,mt,da,vn,ca,pa,ha,G,ut,ma,kn,ua,fa,ft,_o,ga,En,_a,ba,bo,va,wn,ka,Ea,qe,gt,wa,_t,Ma,Mn,ya,Ta,$a,Fe,bt,za,vt,xa,vo,qa,Fa,Ca,ko,kt,bs,ce,Ce,yn,Et,Pa,Tn,ja,vs,F,wt,Aa,$n,Sa,Ia,Mt,Oa,Eo,Na,Da,La,yt,Wa,Tt,Ha,Qa,Ua,L,$t,Ra,pe,Va,wo,Ba,Ga,zn,Ja,Ka,Xa,Pe,Ya,je,ks,he,Ae,xn,zt,Za,qn,ei,Es,C,xt,ti,Fn,oi,ni,qt,si,Mo,ri,ai,ii,Ft,li,Ct,di,ci,pi,I,Pt,hi,me,mi,yo,ui,fi,Cn,gi,_i,bi,Se,vi,Ie,ki,Oe,ws,ue,Ne,Pn,jt,Ei,jn,wi,Ms,P,At,Mi,An,yi,Ti,St,$i,To,zi,xi,qi,It,Fi,Ot,Ci,Pi,ji,W,Nt,Ai,fe,Si,$o,Ii,Oi,Sn,Ni,Di,Li,De,Wi,Le,ys,ge,We,In,Dt,Hi,On,Qi,Ts,j,Lt,Ui,Nn,Ri,Vi,Wt,Bi,zo,Gi,Ji,Ki,Ht,Xi,Qt,Yi,Zi,el,H,Ut,tl,_e,ol,xo,nl,sl,Dn,rl,al,il,He,ll,Qe,$s,be,Ue,Ln,Rt,dl,Wn,cl,zs,A,Vt,pl,ve,hl,Hn,ml,ul,Qn,fl,gl,_l,Bt,bl,qo,vl,kl,El,Gt,wl,Jt,Ml,yl,Tl,Q,Kt,$l,ke,zl,Fo,xl,ql,Un,Fl,Cl,Pl,Re,jl,Ve,xs,Ee,Be,Rn,Xt,Al,Vn,Sl,qs,S,Yt,Il,we,Ol,Bn,Nl,Dl,Gn,Ll,Wl,Hl,Zt,Ql,Co,Ul,Rl,Vl,eo,Bl,to,Gl,Jl,Kl,J,oo,Xl,Me,Yl,Po,Zl,ed,Jn,td,od,nd,Ge,Fs;return l=new V({}),nt=new V({}),it=new V({}),lt=new V({}),dt=new x({props:{name:"class transformers.ErnieMConfig",anchor:"transformers.ErnieMConfig",parameters:[{name:"vocab_size",val:": int = 250002"},{name:"hidden_size",val:": int = 768"},{name:"num_hidden_layers",val:": int = 12"},{name:"num_attention_heads",val:": int = 12"},{name:"intermediate_size",val:": int = 3072"},{name:"hidden_act",val:": str = 'gelu'"},{name:"hidden_dropout_prob",val:": float = 0.1"},{name:"attention_probs_dropout_prob",val:": float = 0.1"},{name:"max_position_embeddings",val:": int = 514"},{name:"initializer_range",val:": float = 0.02"},{name:"pad_token_id",val:": int = 1"},{name:"layer_norm_eps",val:": float = 1e-05"},{name:"classifier_dropout",val:" = None"},{name:"is_decoder",val:" = False"},{name:"act_dropout",val:" = 0.0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ErnieMConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 250002) &#x2014;
Vocabulary size of <code>inputs_ids</code> in <a href="/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMModel">ErnieMModel</a>. Also is the vocab size of token embedding matrix.
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_m#transformers.ErnieMModel">ErnieMModel</a>.`,name:"vocab_size"},{anchor:"transformers.ErnieMConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the embedding layer, encoder layers and pooler layer.`,name:"hidden_size"},{anchor:"transformers.ErnieMConfig.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.ErnieMConfig.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.ErnieMConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the feed-forward (ff) layer in the encoder. Input tensors to feed-forward layers are
firstly projected from hidden_size to intermediate_size, and then projected back to hidden_size. Typically
intermediate_size is larger than hidden_size.`,name:"intermediate_size"},{anchor:"transformers.ErnieMConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function in the feed-forward layer. <code>&quot;gelu&quot;</code>, <code>&quot;relu&quot;</code> and any other torch
supported activation functions are supported.`,name:"hidden_act"},{anchor:"transformers.ErnieMConfig.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 and encoder.`,name:"hidden_dropout_prob"},{anchor:"transformers.ErnieMConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability used in <code>MultiHeadAttention</code> in all encoder layers to drop some attention target.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.ErnieMConfig.act_dropout",description:`<strong>act_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
This dropout probability is used in <code>ErnieMEncoderLayer</code> after activation.`,name:"act_dropout"},{anchor:"transformers.ErnieMConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The maximum value of the dimensionality of position encoding, which dictates the maximum supported length
of an input sequence.`,name:"max_position_embeddings"},{anchor:"transformers.ErnieMConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.ErnieMConfig.classifier_dropout",description:`<strong>classifier_dropout</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The dropout ratio for the classification head.`,name:"classifier_dropout"},{anchor:"transformers.ErnieMConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the normal initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.ErnieMConfig.pad_token_id(int,",description:`<strong>pad_token_id(<code>int</code>,</strong> <em>optional</em>, defaults to 1) &#x2014;
The index of padding token in the token vocabulary.`,name:"pad_token_id(int,"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie_m/configuration_ernie_m.py#L31"}}),pt=new V({}),ht=new x({props:{name:"class transformers.ErnieMTokenizer",anchor:"transformers.ErnieMTokenizer",parameters:[{name:"sentencepiece_model_ckpt",val:""},{name:"vocab_file",val:" = None"},{name:"do_lower_case",val:" = False"},{name:"encoding",val:" = 'utf8'"},{name:"unk_token",val:" = '[UNK]'"},{name:"sep_token",val:" = '[SEP]'"},{name:"pad_token",val:" = '[PAD]'"},{name:"cls_token",val:" = '[CLS]'"},{name:"mask_token",val:" = '[MASK]'"},{name:"sp_model_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ErnieMTokenizer.sentencepiece_model_file",description:`<strong>sentencepiece_model_file</strong> (<code>str</code>) &#x2014;
The file path of sentencepiece model.`,name:"sentencepiece_model_file"},{anchor:"transformers.ErnieMTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The file path of the vocabulary.`,name:"vocab_file"},{anchor:"transformers.ErnieMTokenizer.do_lower_case",description:`<strong>do_lower_case</strong> (<code>str</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to lowercase the input when tokenizing.`,name:"do_lower_case"},{anchor:"transformers.ErnieMTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[UNK]&quot;</code>) &#x2014;
A special token representing the <code>unknown (out-of-vocabulary)</code> token. An unknown token is set to be
<code>unk_token</code> inorder to be converted to an ID.`,name:"unk_token"},{anchor:"transformers.ErnieMTokenizer.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[SEP]&quot;</code>) &#x2014;
A special token separating two different sentences in the same input.`,name:"sep_token"},{anchor:"transformers.ErnieMTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[PAD]&quot;</code>) &#x2014;
A special token used to make arrays of tokens the same size for batching purposes.`,name:"pad_token"},{anchor:"transformers.ErnieMTokenizer.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[CLS]&quot;</code>) &#x2014;
A special token used for sequence classification. It is the last token of the sequence when built with
special tokens.`,name:"cls_token"},{anchor:"transformers.ErnieMTokenizer.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[MASK]&quot;</code>) &#x2014;
A special token representing a masked token. This is the token used in the masked language modeling task
which the model tries to predict the original unmasked ones.`,name:"mask_token"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie_m/tokenization_ernie_m.py#L62"}}),ut=new x({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.ErnieMTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:""},{name:"token_ids_1",val:" = None"}],parametersDescription:[{anchor:"transformers.ErnieMTokenizer.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.ErnieMTokenizer.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie_m/tokenization_ernie_m.py#L262",returnDescription:`
<p>List of input_id with the appropriate special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),gt=new x({props:{name:"get_special_tokens_mask",anchor:"transformers.ErnieMTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:""},{name:"token_ids_1",val:" = None"},{name:"already_has_special_tokens",val:" = False"}],parametersDescription:[{anchor:"transformers.ErnieMTokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of ids of the first sequence.`,name:"token_ids_0"},{anchor:"transformers.ErnieMTokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.ErnieMTokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>str</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie_m/tokenization_ernie_m.py#L305",returnDescription:`
<p>The list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),bt=new x({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.ErnieMTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.ErnieMTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
The first tokenized sequence.`,name:"token_ids_0"},{anchor:"transformers.ErnieMTokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
The second tokenized sequence.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie_m/tokenization_ernie_m.py#L334",returnDescription:`
<p>The token type ids.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),kt=new x({props:{name:"save_vocabulary",anchor:"transformers.ErnieMTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie_m/tokenization_ernie_m.py#L403"}}),Et=new V({}),wt=new x({props:{name:"class transformers.ErnieMModel",anchor:"transformers.ErnieMModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"}],parametersDescription:[{anchor:"transformers.ErnieMModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMConfig">ErnieMConfig</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_m/modeling_ernie_m.py#L500"}}),$t=new x({props:{name:"forward",anchor:"transformers.ErnieMModel.forward",parameters:[{name:"input_ids",val:": typing.Union[<built-in method tensor of type object at 0x7f9493770500>, NoneType] = None"},{name:"position_ids",val:": typing.Union[<built-in method tensor of type object at 0x7f9493770500>, NoneType] = None"},{name:"attention_mask",val:": typing.Union[<built-in method tensor of type object at 0x7f9493770500>, NoneType] = None"},{name:"head_mask",val:": typing.Union[<built-in method tensor of type object at 0x7f9493770500>, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[<built-in method tensor of type object at 0x7f9493770500>, NoneType] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[<built-in method tensor of type object at 0x7f9493770500>]], NoneType] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ErnieMModel.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/ernie_m#transformers.ErnieMTokenizer">ErnieMTokenizer</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.ErnieMModel.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.ErnieMModel.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.ErnieMModel.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.ErnieMModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ErnieMModel.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.ErnieMModel.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.ErnieMModel.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"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/ernie_m/modeling_ernie_m.py#L523",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</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_m#transformers.ErnieMConfig"
>ErnieMConfig</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>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</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>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> and <code>config.add_cross_attention=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Pe=new Bo({props:{$$slots:{default:[Bc]},$$scope:{ctx:$}}}),je=new Go({props:{anchor:"transformers.ErnieMModel.forward.example",$$slots:{default:[Gc]},$$scope:{ctx:$}}}),zt=new V({}),xt=new x({props:{name:"class transformers.ErnieMForSequenceClassification",anchor:"transformers.ErnieMForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieMForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMConfig">ErnieMConfig</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_m/modeling_ernie_m.py#L614"}}),Pt=new x({props:{name:"forward",anchor:"transformers.ErnieMForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",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:"past_key_values",val:": typing.Optional[typing.List[torch.Tensor]] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = True"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"transformers.ErnieMForSequenceClassification.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/ernie_m#transformers.ErnieMTokenizer">ErnieMTokenizer</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.ErnieMForSequenceClassification.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.ErnieMForSequenceClassification.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.ErnieMForSequenceClassification.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.ErnieMForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ErnieMForSequenceClassification.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.ErnieMForSequenceClassification.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.ErnieMForSequenceClassification.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.ErnieMForSequenceClassification.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_m/modeling_ernie_m.py#L631",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMConfig"
>ErnieMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Se=new Bo({props:{$$slots:{default:[Jc]},$$scope:{ctx:$}}}),Ie=new Go({props:{anchor:"transformers.ErnieMForSequenceClassification.forward.example",$$slots:{default:[Kc]},$$scope:{ctx:$}}}),Oe=new Go({props:{anchor:"transformers.ErnieMForSequenceClassification.forward.example-2",$$slots:{default:[Xc]},$$scope:{ctx:$}}}),jt=new V({}),At=new x({props:{name:"class transformers.ErnieMForMultipleChoice",anchor:"transformers.ErnieMForMultipleChoice",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieMForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMConfig">ErnieMConfig</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_m/modeling_ernie_m.py#L716"}}),Nt=new x({props:{name:"forward",anchor:"transformers.ErnieMForMultipleChoice.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",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] = True"}],parametersDescription:[{anchor:"transformers.ErnieMForMultipleChoice.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/ernie_m#transformers.ErnieMTokenizer">ErnieMTokenizer</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.ErnieMForMultipleChoice.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.ErnieMForMultipleChoice.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.ErnieMForMultipleChoice.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.ErnieMForMultipleChoice.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ErnieMForMultipleChoice.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.ErnieMForMultipleChoice.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.ErnieMForMultipleChoice.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.ErnieMForMultipleChoice.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_m/modeling_ernie_m.py#L731",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_m#transformers.ErnieMConfig"
>ErnieMConfig</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>
`}}),De=new Bo({props:{$$slots:{default:[Yc]},$$scope:{ctx:$}}}),Le=new Go({props:{anchor:"transformers.ErnieMForMultipleChoice.forward.example",$$slots:{default:[Zc]},$$scope:{ctx:$}}}),Dt=new V({}),Lt=new x({props:{name:"class transformers.ErnieMForTokenClassification",anchor:"transformers.ErnieMForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieMForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMConfig">ErnieMConfig</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_m/modeling_ernie_m.py#L806"}}),Ut=new x({props:{name:"forward",anchor:"transformers.ErnieMForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",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:"past_key_values",val:": typing.Optional[typing.List[torch.Tensor]] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = True"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"transformers.ErnieMForTokenClassification.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/ernie_m#transformers.ErnieMTokenizer">ErnieMTokenizer</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.ErnieMForTokenClassification.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.ErnieMForTokenClassification.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.ErnieMForTokenClassification.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.ErnieMForTokenClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ErnieMForTokenClassification.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.ErnieMForTokenClassification.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.ErnieMForTokenClassification.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.ErnieMForTokenClassification.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_m/modeling_ernie_m.py#L822",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMConfig"
>ErnieMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided)  \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),He=new Bo({props:{$$slots:{default:[ep]},$$scope:{ctx:$}}}),Qe=new Go({props:{anchor:"transformers.ErnieMForTokenClassification.forward.example",$$slots:{default:[tp]},$$scope:{ctx:$}}}),Rt=new V({}),Vt=new x({props:{name:"class transformers.ErnieMForQuestionAnswering",anchor:"transformers.ErnieMForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieMForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMConfig">ErnieMConfig</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_m/modeling_ernie_m.py#L887"}}),Kt=new x({props:{name:"forward",anchor:"transformers.ErnieMForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",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] = True"}],parametersDescription:[{anchor:"transformers.ErnieMForQuestionAnswering.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/ernie_m#transformers.ErnieMTokenizer">ErnieMTokenizer</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.ErnieMForQuestionAnswering.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.ErnieMForQuestionAnswering.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.ErnieMForQuestionAnswering.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.ErnieMForQuestionAnswering.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ErnieMForQuestionAnswering.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.ErnieMForQuestionAnswering.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.ErnieMForQuestionAnswering.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.ErnieMForQuestionAnswering.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.ErnieMForQuestionAnswering.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_m/modeling_ernie_m.py#L899",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMConfig"
>ErnieMConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Re=new Bo({props:{$$slots:{default:[op]},$$scope:{ctx:$}}}),Ve=new Go({props:{anchor:"transformers.ErnieMForQuestionAnswering.forward.example",$$slots:{default:[np]},$$scope:{ctx:$}}}),Xt=new V({}),Yt=new x({props:{name:"class transformers.ErnieMForInformationExtraction",anchor:"transformers.ErnieMForInformationExtraction",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ErnieMForInformationExtraction.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMConfig">ErnieMConfig</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_m/modeling_ernie_m.py#L985"}}),oo=new x({props:{name:"forward",anchor:"transformers.ErnieMForInformationExtraction.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",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] = True"}],parametersDescription:[{anchor:"transformers.ErnieMForInformationExtraction.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/ernie_m#transformers.ErnieMTokenizer">ErnieMTokenizer</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.ErnieMForInformationExtraction.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.ErnieMForInformationExtraction.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.ErnieMForInformationExtraction.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.ErnieMForInformationExtraction.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ErnieMForInformationExtraction.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.ErnieMForInformationExtraction.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.ErnieMForInformationExtraction.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.ErnieMForInformationExtraction.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for position (index) for computing the start_positions loss. Position outside of the sequence are
not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.ErnieMForInformationExtraction.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) for computing the end_positions loss. 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_m/modeling_ernie_m.py#L994"}}),Ge=new Bo({props:{$$slots:{default:[sp]},$$scope:{ctx:$}}}),{c(){d=n("meta"),v=c(),g=n("h1"),u=n("a"),b=n("span"),k(l.$$.fragment),m=c(),z=n("span"),sr=a("ErnieM"),rs=c(),ne=n("h2"),ye=n("a"),Xo=n("span"),k(nt.$$.fragment),rr=c(),Yo=n("span"),ar=a("Overview"),as=c(),Te=n("p"),ir=a("The ErnieM model was proposed in "),st=n("a"),lr=a(`ERNIE-M: Enhanced Multilingual Representation by Aligning
Cross-lingual Semantics with Monolingual Corpora`),dr=a(`  by Xuan Ouyang, Shuohuan Wang, Chao Pang, Yu Sun,
Hao Tian, Hua Wu, Haifeng Wang.`),is=c(),ao=n("p"),cr=a("The abstract from the paper is the following:"),ls=c(),io=n("p"),Zo=n("em"),pr=a("Recent studies have demonstrated that pre-trained cross-lingual models achieve impressive performance in downstream cross-lingual tasks. This improvement benefits from learning a large amount of monolingual and parallel corpora. Although it is generally acknowledged that parallel corpora are critical for improving the model performance, existing methods are often constrained by the size of parallel corpora, especially for lowresource languages. In this paper, we propose ERNIE-M, a new training method that encourages the model to align the representation of multiple languages with monolingual corpora, to overcome the constraint that the parallel corpus size places on the model performance. Our key insight is to integrate back-translation into the pre-training process. We generate pseudo-parallel sentence pairs on a monolingual corpus to enable the learning of semantic alignments between different languages, thereby enhancing the semantic modeling of cross-lingual models. Experimental results show that ERNIE-M outperforms existing cross-lingual models and delivers new state-of-the-art results in various cross-lingual downstream tasks."),ds=c(),lo=n("p"),hr=a("Tips:"),cs=c(),N=n("ol"),en=n("li"),mr=a("Ernie-M is a BERT-like model so it is a stacked Transformer Encoder."),ur=c(),se=n("li"),fr=a("Instead of using MaskedLM for pretraining (like BERT) the authors used two novel techniques: "),tn=n("code"),gr=a("Cross-attention Masked Language Modeling"),_r=a(" and "),on=n("code"),br=a("Back-translation Masked Language Modeling"),vr=a(". For now these two LMHead objectives are not implemented here."),kr=c(),nn=n("li"),Er=a("It is a multilingual language model."),wr=c(),sn=n("li"),Mr=a("Next Sentence Prediction was not used in pretraining process."),ps=c(),B=n("p"),yr=a("This model was contributed by "),rt=n("a"),Tr=a("Susnato Dhar"),$r=a(". The original code can be found "),at=n("a"),zr=a("here"),xr=a("."),hs=c(),re=n("h2"),$e=n("a"),rn=n("span"),k(it.$$.fragment),qr=c(),an=n("span"),Fr=a("Documentation resources"),ms=c(),D=n("ul"),ln=n("li"),co=n("a"),Cr=a("Text classification task guide"),Pr=c(),dn=n("li"),po=n("a"),jr=a("Token classification task guide"),Ar=c(),cn=n("li"),ho=n("a"),Sr=a("Question answering task guide"),Ir=c(),pn=n("li"),mo=n("a"),Or=a("Multiple choice task guide"),us=c(),ae=n("h2"),ze=n("a"),hn=n("span"),k(lt.$$.fragment),Nr=c(),mn=n("span"),Dr=a("ErnieMConfig"),fs=c(),O=n("div"),k(dt.$$.fragment),Lr=c(),R=n("p"),Wr=a("This is the configuration class to store the configuration of a "),uo=n("a"),Hr=a("ErnieMModel"),Qr=a(`. It is used to instantiate a
Ernie-M 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 `),un=n("code"),Ur=a("Ernie-M"),Rr=c(),ct=n("a"),Vr=a("susnato/ernie-m-base_pytorch"),Br=a(" architecture."),Gr=c(),ie=n("p"),Jr=a("Configuration objects inherit from "),fo=n("a"),Kr=a("PretrainedConfig"),Xr=a(` and can be used to control the model outputs. Read the
documentation from `),go=n("a"),Yr=a("PretrainedConfig"),Zr=a(" for more information."),ea=c(),le=n("p"),ta=a(`A normal_initializer initializes weight matrices as normal distributions. See
`),fn=n("code"),oa=a("ErnieMPretrainedModel._init_weights()"),na=a(" for how weights are initialized in "),gn=n("code"),sa=a("ErnieMModel"),ra=a("."),gs=c(),de=n("h2"),xe=n("a"),_n=n("span"),k(pt.$$.fragment),aa=c(),bn=n("span"),ia=a("ErnieMTokenizer"),_s=c(),q=n("div"),k(ht.$$.fragment),la=c(),mt=n("p"),da=a("Constructs a Ernie-M tokenizer. It uses the "),vn=n("code"),ca=a("sentencepiece"),pa=a(" tools to cut the words to sub-words."),ha=c(),G=n("div"),k(ut.$$.fragment),ma=c(),kn=n("p"),ua=a(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. An ErnieM sequence has the following format:`),fa=c(),ft=n("ul"),_o=n("li"),ga=a("single sequence: "),En=n("code"),_a=a("[CLS] X [SEP]"),ba=c(),bo=n("li"),va=a("pair of sequences: "),wn=n("code"),ka=a("[CLS] A [SEP] [SEP] B [SEP]"),Ea=c(),qe=n("div"),k(gt.$$.fragment),wa=c(),_t=n("p"),Ma=a(`Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),Mn=n("code"),ya=a("encode"),Ta=a(" method."),$a=c(),Fe=n("div"),k(bt.$$.fragment),za=c(),vt=n("p"),xa=a("Create the token type IDs corresponding to the sequences passed. "),vo=n("a"),qa=a(`What are token type
IDs?`),Fa=a(` Should be overridden in a subclass if the model has a special way of
building: those.`),Ca=c(),ko=n("div"),k(kt.$$.fragment),bs=c(),ce=n("h2"),Ce=n("a"),yn=n("span"),k(Et.$$.fragment),Pa=c(),Tn=n("span"),ja=a("ErnieMModel"),vs=c(),F=n("div"),k(wt.$$.fragment),Aa=c(),$n=n("p"),Sa=a("The bare ErnieM Model transformer outputting raw hidden-states without any specific head on top."),Ia=c(),Mt=n("p"),Oa=a("This model inherits from "),Eo=n("a"),Na=a("PreTrainedModel"),Da=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.)`),La=c(),yt=n("p"),Wa=a("This model is a PyTorch "),Tt=n("a"),Ha=a("torch.nn.Module"),Qa=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ua=c(),L=n("div"),k($t.$$.fragment),Ra=c(),pe=n("p"),Va=a("The "),wo=n("a"),Ba=a("ErnieMModel"),Ga=a(" forward method, overrides the "),zn=n("code"),Ja=a("__call__"),Ka=a(" special method."),Xa=c(),k(Pe.$$.fragment),Ya=c(),k(je.$$.fragment),ks=c(),he=n("h2"),Ae=n("a"),xn=n("span"),k(zt.$$.fragment),Za=c(),qn=n("span"),ei=a("ErnieMForSequenceClassification"),Es=c(),C=n("div"),k(xt.$$.fragment),ti=c(),Fn=n("p"),oi=a(`ErnieM Model transformer with a sequence classification/regression head on top (a linear layer on top of
the pooled output) e.g. for GLUE tasks.`),ni=c(),qt=n("p"),si=a("This model inherits from "),Mo=n("a"),ri=a("PreTrainedModel"),ai=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.)`),ii=c(),Ft=n("p"),li=a("This model is a PyTorch "),Ct=n("a"),di=a("torch.nn.Module"),ci=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),pi=c(),I=n("div"),k(Pt.$$.fragment),hi=c(),me=n("p"),mi=a("The "),yo=n("a"),ui=a("ErnieMForSequenceClassification"),fi=a(" forward method, overrides the "),Cn=n("code"),gi=a("__call__"),_i=a(" special method."),bi=c(),k(Se.$$.fragment),vi=c(),k(Ie.$$.fragment),ki=c(),k(Oe.$$.fragment),ws=c(),ue=n("h2"),Ne=n("a"),Pn=n("span"),k(jt.$$.fragment),Ei=c(),jn=n("span"),wi=a("ErnieMForMultipleChoice"),Ms=c(),P=n("div"),k(At.$$.fragment),Mi=c(),An=n("p"),yi=a(`ErnieM 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.`),Ti=c(),St=n("p"),$i=a("This model inherits from "),To=n("a"),zi=a("PreTrainedModel"),xi=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.)`),qi=c(),It=n("p"),Fi=a("This model is a PyTorch "),Ot=n("a"),Ci=a("torch.nn.Module"),Pi=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ji=c(),W=n("div"),k(Nt.$$.fragment),Ai=c(),fe=n("p"),Si=a("The "),$o=n("a"),Ii=a("ErnieMForMultipleChoice"),Oi=a(" forward method, overrides the "),Sn=n("code"),Ni=a("__call__"),Di=a(" special method."),Li=c(),k(De.$$.fragment),Wi=c(),k(Le.$$.fragment),ys=c(),ge=n("h2"),We=n("a"),In=n("span"),k(Dt.$$.fragment),Hi=c(),On=n("span"),Qi=a("ErnieMForTokenClassification"),Ts=c(),j=n("div"),k(Lt.$$.fragment),Ui=c(),Nn=n("p"),Ri=a(`ErnieM 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.`),Vi=c(),Wt=n("p"),Bi=a("This model inherits from "),zo=n("a"),Gi=a("PreTrainedModel"),Ji=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.)`),Ki=c(),Ht=n("p"),Xi=a("This model is a PyTorch "),Qt=n("a"),Yi=a("torch.nn.Module"),Zi=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),el=c(),H=n("div"),k(Ut.$$.fragment),tl=c(),_e=n("p"),ol=a("The "),xo=n("a"),nl=a("ErnieMForTokenClassification"),sl=a(" forward method, overrides the "),Dn=n("code"),rl=a("__call__"),al=a(" special method."),il=c(),k(He.$$.fragment),ll=c(),k(Qe.$$.fragment),$s=c(),be=n("h2"),Ue=n("a"),Ln=n("span"),k(Rt.$$.fragment),dl=c(),Wn=n("span"),cl=a("ErnieMForQuestionAnswering"),zs=c(),A=n("div"),k(Vt.$$.fragment),pl=c(),ve=n("p"),hl=a(`ErnieM 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 `),Hn=n("code"),ml=a("span start logits"),ul=a(" and "),Qn=n("code"),fl=a("span end logits"),gl=a(")."),_l=c(),Bt=n("p"),bl=a("This model inherits from "),qo=n("a"),vl=a("PreTrainedModel"),kl=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.)`),El=c(),Gt=n("p"),wl=a("This model is a PyTorch "),Jt=n("a"),Ml=a("torch.nn.Module"),yl=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Tl=c(),Q=n("div"),k(Kt.$$.fragment),$l=c(),ke=n("p"),zl=a("The "),Fo=n("a"),xl=a("ErnieMForQuestionAnswering"),ql=a(" forward method, overrides the "),Un=n("code"),Fl=a("__call__"),Cl=a(" special method."),Pl=c(),k(Re.$$.fragment),jl=c(),k(Ve.$$.fragment),xs=c(),Ee=n("h2"),Be=n("a"),Rn=n("span"),k(Xt.$$.fragment),Al=c(),Vn=n("span"),Sl=a("ErnieMForInformationExtraction"),qs=c(),S=n("div"),k(Yt.$$.fragment),Il=c(),we=n("p"),Ol=a(`ErnieMForInformationExtraction is a Ernie-M Model with two linear layer on top of the hidden-states output to
compute `),Bn=n("code"),Nl=a("start_prob"),Dl=a(" and "),Gn=n("code"),Ll=a("end_prob"),Wl=a(", designed for Universal Information Extraction."),Hl=c(),Zt=n("p"),Ql=a("This model inherits from "),Co=n("a"),Ul=a("PreTrainedModel"),Rl=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.)`),Vl=c(),eo=n("p"),Bl=a("This model is a PyTorch "),to=n("a"),Gl=a("torch.nn.Module"),Jl=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Kl=c(),J=n("div"),k(oo.$$.fragment),Xl=c(),Me=n("p"),Yl=a("The "),Po=n("a"),Zl=a("ErnieMForInformationExtraction"),ed=a(" forward method, overrides the "),Jn=n("code"),td=a("__call__"),od=a(" special method."),nd=c(),k(Ge.$$.fragment),this.h()},l(t){const f=Rc('[data-svelte="svelte-1phssyn"]',document.head);d=s(f,"META",{name:!0,content:!0}),f.forEach(o),v=p(t),g=s(t,"H1",{class:!0});var no=r(g);u=s(no,"A",{id:!0,class:!0,href:!0});var Kn=r(u);b=s(Kn,"SPAN",{});var Xn=r(b);E(l.$$.fragment,Xn),Xn.forEach(o),Kn.forEach(o),m=p(no),z=s(no,"SPAN",{});var Yn=r(z);sr=i(Yn,"ErnieM"),Yn.forEach(o),no.forEach(o),rs=p(t),ne=s(t,"H2",{class:!0});var so=r(ne);ye=s(so,"A",{id:!0,class:!0,href:!0});var Zn=r(ye);Xo=s(Zn,"SPAN",{});var es=r(Xo);E(nt.$$.fragment,es),es.forEach(o),Zn.forEach(o),rr=p(so),Yo=s(so,"SPAN",{});var ts=r(Yo);ar=i(ts,"Overview"),ts.forEach(o),so.forEach(o),as=p(t),Te=s(t,"P",{});var ro=r(Te);ir=i(ro,"The ErnieM model was proposed in "),st=s(ro,"A",{href:!0,rel:!0});var os=r(st);lr=i(os,`ERNIE-M: Enhanced Multilingual Representation by Aligning
Cross-lingual Semantics with Monolingual Corpora`),os.forEach(o),dr=i(ro,`  by Xuan Ouyang, Shuohuan Wang, Chao Pang, Yu Sun,
Hao Tian, Hua Wu, Haifeng Wang.`),ro.forEach(o),is=p(t),ao=s(t,"P",{});var ns=r(ao);cr=i(ns,"The abstract from the paper is the following:"),ns.forEach(o),ls=p(t),io=s(t,"P",{});var ss=r(io);Zo=s(ss,"EM",{});var ad=r(Zo);pr=i(ad,"Recent studies have demonstrated that pre-trained cross-lingual models achieve impressive performance in downstream cross-lingual tasks. This improvement benefits from learning a large amount of monolingual and parallel corpora. Although it is generally acknowledged that parallel corpora are critical for improving the model performance, existing methods are often constrained by the size of parallel corpora, especially for lowresource languages. In this paper, we propose ERNIE-M, a new training method that encourages the model to align the representation of multiple languages with monolingual corpora, to overcome the constraint that the parallel corpus size places on the model performance. Our key insight is to integrate back-translation into the pre-training process. We generate pseudo-parallel sentence pairs on a monolingual corpus to enable the learning of semantic alignments between different languages, thereby enhancing the semantic modeling of cross-lingual models. Experimental results show that ERNIE-M outperforms existing cross-lingual models and delivers new state-of-the-art results in various cross-lingual downstream tasks."),ad.forEach(o),ss.forEach(o),ds=p(t),lo=s(t,"P",{});var id=r(lo);hr=i(id,"Tips:"),id.forEach(o),cs=p(t),N=s(t,"OL",{});var Je=r(N);en=s(Je,"LI",{});var ld=r(en);mr=i(ld,"Ernie-M is a BERT-like model so it is a stacked Transformer Encoder."),ld.forEach(o),ur=p(Je),se=s(Je,"LI",{});var jo=r(se);fr=i(jo,"Instead of using MaskedLM for pretraining (like BERT) the authors used two novel techniques: "),tn=s(jo,"CODE",{});var dd=r(tn);gr=i(dd,"Cross-attention Masked Language Modeling"),dd.forEach(o),_r=i(jo," and "),on=s(jo,"CODE",{});var cd=r(on);br=i(cd,"Back-translation Masked Language Modeling"),cd.forEach(o),vr=i(jo,". For now these two LMHead objectives are not implemented here."),jo.forEach(o),kr=p(Je),nn=s(Je,"LI",{});var pd=r(nn);Er=i(pd,"It is a multilingual language model."),pd.forEach(o),wr=p(Je),sn=s(Je,"LI",{});var hd=r(sn);Mr=i(hd,"Next Sentence Prediction was not used in pretraining process."),hd.forEach(o),Je.forEach(o),ps=p(t),B=s(t,"P",{});var Ao=r(B);yr=i(Ao,"This model was contributed by "),rt=s(Ao,"A",{href:!0,rel:!0});var md=r(rt);Tr=i(md,"Susnato Dhar"),md.forEach(o),$r=i(Ao,". The original code can be found "),at=s(Ao,"A",{href:!0,rel:!0});var ud=r(at);zr=i(ud,"here"),ud.forEach(o),xr=i(Ao,"."),Ao.forEach(o),hs=p(t),re=s(t,"H2",{class:!0});var Cs=r(re);$e=s(Cs,"A",{id:!0,class:!0,href:!0});var fd=r($e);rn=s(fd,"SPAN",{});var gd=r(rn);E(it.$$.fragment,gd),gd.forEach(o),fd.forEach(o),qr=p(Cs),an=s(Cs,"SPAN",{});var _d=r(an);Fr=i(_d,"Documentation resources"),_d.forEach(o),Cs.forEach(o),ms=p(t),D=s(t,"UL",{});var Ke=r(D);ln=s(Ke,"LI",{});var bd=r(ln);co=s(bd,"A",{href:!0});var vd=r(co);Cr=i(vd,"Text classification task guide"),vd.forEach(o),bd.forEach(o),Pr=p(Ke),dn=s(Ke,"LI",{});var kd=r(dn);po=s(kd,"A",{href:!0});var Ed=r(po);jr=i(Ed,"Token classification task guide"),Ed.forEach(o),kd.forEach(o),Ar=p(Ke),cn=s(Ke,"LI",{});var wd=r(cn);ho=s(wd,"A",{href:!0});var Md=r(ho);Sr=i(Md,"Question answering task guide"),Md.forEach(o),wd.forEach(o),Ir=p(Ke),pn=s(Ke,"LI",{});var yd=r(pn);mo=s(yd,"A",{href:!0});var Td=r(mo);Or=i(Td,"Multiple choice task guide"),Td.forEach(o),yd.forEach(o),Ke.forEach(o),us=p(t),ae=s(t,"H2",{class:!0});var Ps=r(ae);ze=s(Ps,"A",{id:!0,class:!0,href:!0});var $d=r(ze);hn=s($d,"SPAN",{});var zd=r(hn);E(lt.$$.fragment,zd),zd.forEach(o),$d.forEach(o),Nr=p(Ps),mn=s(Ps,"SPAN",{});var xd=r(mn);Dr=i(xd,"ErnieMConfig"),xd.forEach(o),Ps.forEach(o),fs=p(t),O=s(t,"DIV",{class:!0});var Xe=r(O);E(dt.$$.fragment,Xe),Lr=p(Xe),R=s(Xe,"P",{});var Ye=r(R);Wr=i(Ye,"This is the configuration class to store the configuration of a "),uo=s(Ye,"A",{href:!0});var qd=r(uo);Hr=i(qd,"ErnieMModel"),qd.forEach(o),Qr=i(Ye,`. It is used to instantiate a
Ernie-M 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 `),un=s(Ye,"CODE",{});var Fd=r(un);Ur=i(Fd,"Ernie-M"),Fd.forEach(o),Rr=p(Ye),ct=s(Ye,"A",{href:!0,rel:!0});var Cd=r(ct);Vr=i(Cd,"susnato/ernie-m-base_pytorch"),Cd.forEach(o),Br=i(Ye," architecture."),Ye.forEach(o),Gr=p(Xe),ie=s(Xe,"P",{});var So=r(ie);Jr=i(So,"Configuration objects inherit from "),fo=s(So,"A",{href:!0});var Pd=r(fo);Kr=i(Pd,"PretrainedConfig"),Pd.forEach(o),Xr=i(So,` and can be used to control the model outputs. Read the
documentation from `),go=s(So,"A",{href:!0});var jd=r(go);Yr=i(jd,"PretrainedConfig"),jd.forEach(o),Zr=i(So," for more information."),So.forEach(o),ea=p(Xe),le=s(Xe,"P",{});var Io=r(le);ta=i(Io,`A normal_initializer initializes weight matrices as normal distributions. See
`),fn=s(Io,"CODE",{});var Ad=r(fn);oa=i(Ad,"ErnieMPretrainedModel._init_weights()"),Ad.forEach(o),na=i(Io," for how weights are initialized in "),gn=s(Io,"CODE",{});var Sd=r(gn);sa=i(Sd,"ErnieMModel"),Sd.forEach(o),ra=i(Io,"."),Io.forEach(o),Xe.forEach(o),gs=p(t),de=s(t,"H2",{class:!0});var js=r(de);xe=s(js,"A",{id:!0,class:!0,href:!0});var Id=r(xe);_n=s(Id,"SPAN",{});var Od=r(_n);E(pt.$$.fragment,Od),Od.forEach(o),Id.forEach(o),aa=p(js),bn=s(js,"SPAN",{});var Nd=r(bn);ia=i(Nd,"ErnieMTokenizer"),Nd.forEach(o),js.forEach(o),_s=p(t),q=s(t,"DIV",{class:!0});var U=r(q);E(ht.$$.fragment,U),la=p(U),mt=s(U,"P",{});var As=r(mt);da=i(As,"Constructs a Ernie-M tokenizer. It uses the "),vn=s(As,"CODE",{});var Dd=r(vn);ca=i(Dd,"sentencepiece"),Dd.forEach(o),pa=i(As," tools to cut the words to sub-words."),As.forEach(o),ha=p(U),G=s(U,"DIV",{class:!0});var Oo=r(G);E(ut.$$.fragment,Oo),ma=p(Oo),kn=s(Oo,"P",{});var Ld=r(kn);ua=i(Ld,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. An ErnieM sequence has the following format:`),Ld.forEach(o),fa=p(Oo),ft=s(Oo,"UL",{});var Ss=r(ft);_o=s(Ss,"LI",{});var sd=r(_o);ga=i(sd,"single sequence: "),En=s(sd,"CODE",{});var Wd=r(En);_a=i(Wd,"[CLS] X [SEP]"),Wd.forEach(o),sd.forEach(o),ba=p(Ss),bo=s(Ss,"LI",{});var rd=r(bo);va=i(rd,"pair of sequences: "),wn=s(rd,"CODE",{});var Hd=r(wn);ka=i(Hd,"[CLS] A [SEP] [SEP] B [SEP]"),Hd.forEach(o),rd.forEach(o),Ss.forEach(o),Oo.forEach(o),Ea=p(U),qe=s(U,"DIV",{class:!0});var Is=r(qe);E(gt.$$.fragment,Is),wa=p(Is),_t=s(Is,"P",{});var Os=r(_t);Ma=i(Os,`Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),Mn=s(Os,"CODE",{});var Qd=r(Mn);ya=i(Qd,"encode"),Qd.forEach(o),Ta=i(Os," method."),Os.forEach(o),Is.forEach(o),$a=p(U),Fe=s(U,"DIV",{class:!0});var Ns=r(Fe);E(bt.$$.fragment,Ns),za=p(Ns),vt=s(Ns,"P",{});var Ds=r(vt);xa=i(Ds,"Create the token type IDs corresponding to the sequences passed. "),vo=s(Ds,"A",{href:!0});var Ud=r(vo);qa=i(Ud,`What are token type
IDs?`),Ud.forEach(o),Fa=i(Ds,` Should be overridden in a subclass if the model has a special way of
building: those.`),Ds.forEach(o),Ns.forEach(o),Ca=p(U),ko=s(U,"DIV",{class:!0});var Rd=r(ko);E(kt.$$.fragment,Rd),Rd.forEach(o),U.forEach(o),bs=p(t),ce=s(t,"H2",{class:!0});var Ls=r(ce);Ce=s(Ls,"A",{id:!0,class:!0,href:!0});var Vd=r(Ce);yn=s(Vd,"SPAN",{});var Bd=r(yn);E(Et.$$.fragment,Bd),Bd.forEach(o),Vd.forEach(o),Pa=p(Ls),Tn=s(Ls,"SPAN",{});var Gd=r(Tn);ja=i(Gd,"ErnieMModel"),Gd.forEach(o),Ls.forEach(o),vs=p(t),F=s(t,"DIV",{class:!0});var K=r(F);E(wt.$$.fragment,K),Aa=p(K),$n=s(K,"P",{});var Jd=r($n);Sa=i(Jd,"The bare ErnieM Model transformer outputting raw hidden-states without any specific head on top."),Jd.forEach(o),Ia=p(K),Mt=s(K,"P",{});var Ws=r(Mt);Oa=i(Ws,"This model inherits from "),Eo=s(Ws,"A",{href:!0});var Kd=r(Eo);Na=i(Kd,"PreTrainedModel"),Kd.forEach(o),Da=i(Ws,`. 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.)`),Ws.forEach(o),La=p(K),yt=s(K,"P",{});var Hs=r(yt);Wa=i(Hs,"This model is a PyTorch "),Tt=s(Hs,"A",{href:!0,rel:!0});var Xd=r(Tt);Ha=i(Xd,"torch.nn.Module"),Xd.forEach(o),Qa=i(Hs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Hs.forEach(o),Ua=p(K),L=s(K,"DIV",{class:!0});var Ze=r(L);E($t.$$.fragment,Ze),Ra=p(Ze),pe=s(Ze,"P",{});var No=r(pe);Va=i(No,"The "),wo=s(No,"A",{href:!0});var Yd=r(wo);Ba=i(Yd,"ErnieMModel"),Yd.forEach(o),Ga=i(No," forward method, overrides the "),zn=s(No,"CODE",{});var Zd=r(zn);Ja=i(Zd,"__call__"),Zd.forEach(o),Ka=i(No," special method."),No.forEach(o),Xa=p(Ze),E(Pe.$$.fragment,Ze),Ya=p(Ze),E(je.$$.fragment,Ze),Ze.forEach(o),K.forEach(o),ks=p(t),he=s(t,"H2",{class:!0});var Qs=r(he);Ae=s(Qs,"A",{id:!0,class:!0,href:!0});var ec=r(Ae);xn=s(ec,"SPAN",{});var tc=r(xn);E(zt.$$.fragment,tc),tc.forEach(o),ec.forEach(o),Za=p(Qs),qn=s(Qs,"SPAN",{});var oc=r(qn);ei=i(oc,"ErnieMForSequenceClassification"),oc.forEach(o),Qs.forEach(o),Es=p(t),C=s(t,"DIV",{class:!0});var X=r(C);E(xt.$$.fragment,X),ti=p(X),Fn=s(X,"P",{});var nc=r(Fn);oi=i(nc,`ErnieM Model transformer with a sequence classification/regression head on top (a linear layer on top of
the pooled output) e.g. for GLUE tasks.`),nc.forEach(o),ni=p(X),qt=s(X,"P",{});var Us=r(qt);si=i(Us,"This model inherits from "),Mo=s(Us,"A",{href:!0});var sc=r(Mo);ri=i(sc,"PreTrainedModel"),sc.forEach(o),ai=i(Us,`. 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.)`),Us.forEach(o),ii=p(X),Ft=s(X,"P",{});var Rs=r(Ft);li=i(Rs,"This model is a PyTorch "),Ct=s(Rs,"A",{href:!0,rel:!0});var rc=r(Ct);di=i(rc,"torch.nn.Module"),rc.forEach(o),ci=i(Rs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Rs.forEach(o),pi=p(X),I=s(X,"DIV",{class:!0});var Y=r(I);E(Pt.$$.fragment,Y),hi=p(Y),me=s(Y,"P",{});var Do=r(me);mi=i(Do,"The "),yo=s(Do,"A",{href:!0});var ac=r(yo);ui=i(ac,"ErnieMForSequenceClassification"),ac.forEach(o),fi=i(Do," forward method, overrides the "),Cn=s(Do,"CODE",{});var ic=r(Cn);gi=i(ic,"__call__"),ic.forEach(o),_i=i(Do," special method."),Do.forEach(o),bi=p(Y),E(Se.$$.fragment,Y),vi=p(Y),E(Ie.$$.fragment,Y),ki=p(Y),E(Oe.$$.fragment,Y),Y.forEach(o),X.forEach(o),ws=p(t),ue=s(t,"H2",{class:!0});var Vs=r(ue);Ne=s(Vs,"A",{id:!0,class:!0,href:!0});var lc=r(Ne);Pn=s(lc,"SPAN",{});var dc=r(Pn);E(jt.$$.fragment,dc),dc.forEach(o),lc.forEach(o),Ei=p(Vs),jn=s(Vs,"SPAN",{});var cc=r(jn);wi=i(cc,"ErnieMForMultipleChoice"),cc.forEach(o),Vs.forEach(o),Ms=p(t),P=s(t,"DIV",{class:!0});var Z=r(P);E(At.$$.fragment,Z),Mi=p(Z),An=s(Z,"P",{});var pc=r(An);yi=i(pc,`ErnieM 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.`),pc.forEach(o),Ti=p(Z),St=s(Z,"P",{});var Bs=r(St);$i=i(Bs,"This model inherits from "),To=s(Bs,"A",{href:!0});var hc=r(To);zi=i(hc,"PreTrainedModel"),hc.forEach(o),xi=i(Bs,`. 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.)`),Bs.forEach(o),qi=p(Z),It=s(Z,"P",{});var Gs=r(It);Fi=i(Gs,"This model is a PyTorch "),Ot=s(Gs,"A",{href:!0,rel:!0});var mc=r(Ot);Ci=i(mc,"torch.nn.Module"),mc.forEach(o),Pi=i(Gs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Gs.forEach(o),ji=p(Z),W=s(Z,"DIV",{class:!0});var et=r(W);E(Nt.$$.fragment,et),Ai=p(et),fe=s(et,"P",{});var Lo=r(fe);Si=i(Lo,"The "),$o=s(Lo,"A",{href:!0});var uc=r($o);Ii=i(uc,"ErnieMForMultipleChoice"),uc.forEach(o),Oi=i(Lo," forward method, overrides the "),Sn=s(Lo,"CODE",{});var fc=r(Sn);Ni=i(fc,"__call__"),fc.forEach(o),Di=i(Lo," special method."),Lo.forEach(o),Li=p(et),E(De.$$.fragment,et),Wi=p(et),E(Le.$$.fragment,et),et.forEach(o),Z.forEach(o),ys=p(t),ge=s(t,"H2",{class:!0});var Js=r(ge);We=s(Js,"A",{id:!0,class:!0,href:!0});var gc=r(We);In=s(gc,"SPAN",{});var _c=r(In);E(Dt.$$.fragment,_c),_c.forEach(o),gc.forEach(o),Hi=p(Js),On=s(Js,"SPAN",{});var bc=r(On);Qi=i(bc,"ErnieMForTokenClassification"),bc.forEach(o),Js.forEach(o),Ts=p(t),j=s(t,"DIV",{class:!0});var ee=r(j);E(Lt.$$.fragment,ee),Ui=p(ee),Nn=s(ee,"P",{});var vc=r(Nn);Ri=i(vc,`ErnieM 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.`),vc.forEach(o),Vi=p(ee),Wt=s(ee,"P",{});var Ks=r(Wt);Bi=i(Ks,"This model inherits from "),zo=s(Ks,"A",{href:!0});var kc=r(zo);Gi=i(kc,"PreTrainedModel"),kc.forEach(o),Ji=i(Ks,`. 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.)`),Ks.forEach(o),Ki=p(ee),Ht=s(ee,"P",{});var Xs=r(Ht);Xi=i(Xs,"This model is a PyTorch "),Qt=s(Xs,"A",{href:!0,rel:!0});var Ec=r(Qt);Yi=i(Ec,"torch.nn.Module"),Ec.forEach(o),Zi=i(Xs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Xs.forEach(o),el=p(ee),H=s(ee,"DIV",{class:!0});var tt=r(H);E(Ut.$$.fragment,tt),tl=p(tt),_e=s(tt,"P",{});var Wo=r(_e);ol=i(Wo,"The "),xo=s(Wo,"A",{href:!0});var wc=r(xo);nl=i(wc,"ErnieMForTokenClassification"),wc.forEach(o),sl=i(Wo," forward method, overrides the "),Dn=s(Wo,"CODE",{});var Mc=r(Dn);rl=i(Mc,"__call__"),Mc.forEach(o),al=i(Wo," special method."),Wo.forEach(o),il=p(tt),E(He.$$.fragment,tt),ll=p(tt),E(Qe.$$.fragment,tt),tt.forEach(o),ee.forEach(o),$s=p(t),be=s(t,"H2",{class:!0});var Ys=r(be);Ue=s(Ys,"A",{id:!0,class:!0,href:!0});var yc=r(Ue);Ln=s(yc,"SPAN",{});var Tc=r(Ln);E(Rt.$$.fragment,Tc),Tc.forEach(o),yc.forEach(o),dl=p(Ys),Wn=s(Ys,"SPAN",{});var $c=r(Wn);cl=i($c,"ErnieMForQuestionAnswering"),$c.forEach(o),Ys.forEach(o),zs=p(t),A=s(t,"DIV",{class:!0});var te=r(A);E(Vt.$$.fragment,te),pl=p(te),ve=s(te,"P",{});var Ho=r(ve);hl=i(Ho,`ErnieM 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 `),Hn=s(Ho,"CODE",{});var zc=r(Hn);ml=i(zc,"span start logits"),zc.forEach(o),ul=i(Ho," and "),Qn=s(Ho,"CODE",{});var xc=r(Qn);fl=i(xc,"span end logits"),xc.forEach(o),gl=i(Ho,")."),Ho.forEach(o),_l=p(te),Bt=s(te,"P",{});var Zs=r(Bt);bl=i(Zs,"This model inherits from "),qo=s(Zs,"A",{href:!0});var qc=r(qo);vl=i(qc,"PreTrainedModel"),qc.forEach(o),kl=i(Zs,`. 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.)`),Zs.forEach(o),El=p(te),Gt=s(te,"P",{});var er=r(Gt);wl=i(er,"This model is a PyTorch "),Jt=s(er,"A",{href:!0,rel:!0});var Fc=r(Jt);Ml=i(Fc,"torch.nn.Module"),Fc.forEach(o),yl=i(er,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),er.forEach(o),Tl=p(te),Q=s(te,"DIV",{class:!0});var ot=r(Q);E(Kt.$$.fragment,ot),$l=p(ot),ke=s(ot,"P",{});var Qo=r(ke);zl=i(Qo,"The "),Fo=s(Qo,"A",{href:!0});var Cc=r(Fo);xl=i(Cc,"ErnieMForQuestionAnswering"),Cc.forEach(o),ql=i(Qo," forward method, overrides the "),Un=s(Qo,"CODE",{});var Pc=r(Un);Fl=i(Pc,"__call__"),Pc.forEach(o),Cl=i(Qo," special method."),Qo.forEach(o),Pl=p(ot),E(Re.$$.fragment,ot),jl=p(ot),E(Ve.$$.fragment,ot),ot.forEach(o),te.forEach(o),xs=p(t),Ee=s(t,"H2",{class:!0});var tr=r(Ee);Be=s(tr,"A",{id:!0,class:!0,href:!0});var jc=r(Be);Rn=s(jc,"SPAN",{});var Ac=r(Rn);E(Xt.$$.fragment,Ac),Ac.forEach(o),jc.forEach(o),Al=p(tr),Vn=s(tr,"SPAN",{});var Sc=r(Vn);Sl=i(Sc,"ErnieMForInformationExtraction"),Sc.forEach(o),tr.forEach(o),qs=p(t),S=s(t,"DIV",{class:!0});var oe=r(S);E(Yt.$$.fragment,oe),Il=p(oe),we=s(oe,"P",{});var Uo=r(we);Ol=i(Uo,`ErnieMForInformationExtraction is a Ernie-M Model with two linear layer on top of the hidden-states output to
compute `),Bn=s(Uo,"CODE",{});var Ic=r(Bn);Nl=i(Ic,"start_prob"),Ic.forEach(o),Dl=i(Uo," and "),Gn=s(Uo,"CODE",{});var Oc=r(Gn);Ll=i(Oc,"end_prob"),Oc.forEach(o),Wl=i(Uo,", designed for Universal Information Extraction."),Uo.forEach(o),Hl=p(oe),Zt=s(oe,"P",{});var or=r(Zt);Ql=i(or,"This model inherits from "),Co=s(or,"A",{href:!0});var Nc=r(Co);Ul=i(Nc,"PreTrainedModel"),Nc.forEach(o),Rl=i(or,`. 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.)`),or.forEach(o),Vl=p(oe),eo=s(oe,"P",{});var nr=r(eo);Bl=i(nr,"This model is a PyTorch "),to=s(nr,"A",{href:!0,rel:!0});var Dc=r(to);Gl=i(Dc,"torch.nn.Module"),Dc.forEach(o),Jl=i(nr,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),nr.forEach(o),Kl=p(oe),J=s(oe,"DIV",{class:!0});var Ro=r(J);E(oo.$$.fragment,Ro),Xl=p(Ro),Me=s(Ro,"P",{});var Vo=r(Me);Yl=i(Vo,"The "),Po=s(Vo,"A",{href:!0});var Lc=r(Po);Zl=i(Lc,"ErnieMForInformationExtraction"),Lc.forEach(o),ed=i(Vo," forward method, overrides the "),Jn=s(Vo,"CODE",{});var Wc=r(Jn);td=i(Wc,"__call__"),Wc.forEach(o),od=i(Vo," special method."),Vo.forEach(o),nd=p(Ro),E(Ge.$$.fragment,Ro),Ro.forEach(o),oe.forEach(o),this.h()},h(){h(d,"name","hf:doc:metadata"),h(d,"content",JSON.stringify(ap)),h(u,"id","erniem"),h(u,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(u,"href","#erniem"),h(g,"class","relative group"),h(ye,"id","overview"),h(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ye,"href","#overview"),h(ne,"class","relative group"),h(st,"href","https://arxiv.org/abs/2012.15674"),h(st,"rel","nofollow"),h(rt,"href","https://huggingface.co/susnato"),h(rt,"rel","nofollow"),h(at,"href","https://github.com/PaddlePaddle/PaddleNLP/tree/develop/paddlenlp/transformers/ernie_m"),h(at,"rel","nofollow"),h($e,"id","documentation-resources"),h($e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h($e,"href","#documentation-resources"),h(re,"class","relative group"),h(co,"href","../tasks/sequence_classification"),h(po,"href","../tasks/token_classification"),h(ho,"href","../tasks/question_answering"),h(mo,"href","../tasks/multiple_choice"),h(ze,"id","transformers.ErnieMConfig"),h(ze,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ze,"href","#transformers.ErnieMConfig"),h(ae,"class","relative group"),h(uo,"href","/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMModel"),h(ct,"href","https://huggingface.co/susnato/ernie-m-base_pytorch"),h(ct,"rel","nofollow"),h(fo,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(go,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(xe,"id","transformers.ErnieMTokenizer"),h(xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(xe,"href","#transformers.ErnieMTokenizer"),h(de,"class","relative group"),h(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(vo,"href","../glossary#token-type-ids"),h(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ko,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ce,"id","transformers.ErnieMModel"),h(Ce,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Ce,"href","#transformers.ErnieMModel"),h(ce,"class","relative group"),h(Eo,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),h(Tt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Tt,"rel","nofollow"),h(wo,"href","/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMModel"),h(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ae,"id","transformers.ErnieMForSequenceClassification"),h(Ae,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Ae,"href","#transformers.ErnieMForSequenceClassification"),h(he,"class","relative group"),h(Mo,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),h(Ct,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Ct,"rel","nofollow"),h(yo,"href","/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMForSequenceClassification"),h(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ne,"id","transformers.ErnieMForMultipleChoice"),h(Ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Ne,"href","#transformers.ErnieMForMultipleChoice"),h(ue,"class","relative group"),h(To,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),h(Ot,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Ot,"rel","nofollow"),h($o,"href","/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMForMultipleChoice"),h(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(We,"id","transformers.ErnieMForTokenClassification"),h(We,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(We,"href","#transformers.ErnieMForTokenClassification"),h(ge,"class","relative group"),h(zo,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),h(Qt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Qt,"rel","nofollow"),h(xo,"href","/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMForTokenClassification"),h(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ue,"id","transformers.ErnieMForQuestionAnswering"),h(Ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Ue,"href","#transformers.ErnieMForQuestionAnswering"),h(be,"class","relative group"),h(qo,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),h(Jt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Jt,"rel","nofollow"),h(Fo,"href","/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMForQuestionAnswering"),h(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Be,"id","transformers.ErnieMForInformationExtraction"),h(Be,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Be,"href","#transformers.ErnieMForInformationExtraction"),h(Ee,"class","relative group"),h(Co,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),h(to,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(to,"rel","nofollow"),h(Po,"href","/docs/transformers/v4.29.0/en/model_doc/ernie_m#transformers.ErnieMForInformationExtraction"),h(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,f){e(document.head,d),_(t,v,f),_(t,g,f),e(g,u),e(u,b),w(l,b,null),e(g,m),e(g,z),e(z,sr),_(t,rs,f),_(t,ne,f),e(ne,ye),e(ye,Xo),w(nt,Xo,null),e(ne,rr),e(ne,Yo),e(Yo,ar),_(t,as,f),_(t,Te,f),e(Te,ir),e(Te,st),e(st,lr),e(Te,dr),_(t,is,f),_(t,ao,f),e(ao,cr),_(t,ls,f),_(t,io,f),e(io,Zo),e(Zo,pr),_(t,ds,f),_(t,lo,f),e(lo,hr),_(t,cs,f),_(t,N,f),e(N,en),e(en,mr),e(N,ur),e(N,se),e(se,fr),e(se,tn),e(tn,gr),e(se,_r),e(se,on),e(on,br),e(se,vr),e(N,kr),e(N,nn),e(nn,Er),e(N,wr),e(N,sn),e(sn,Mr),_(t,ps,f),_(t,B,f),e(B,yr),e(B,rt),e(rt,Tr),e(B,$r),e(B,at),e(at,zr),e(B,xr),_(t,hs,f),_(t,re,f),e(re,$e),e($e,rn),w(it,rn,null),e(re,qr),e(re,an),e(an,Fr),_(t,ms,f),_(t,D,f),e(D,ln),e(ln,co),e(co,Cr),e(D,Pr),e(D,dn),e(dn,po),e(po,jr),e(D,Ar),e(D,cn),e(cn,ho),e(ho,Sr),e(D,Ir),e(D,pn),e(pn,mo),e(mo,Or),_(t,us,f),_(t,ae,f),e(ae,ze),e(ze,hn),w(lt,hn,null),e(ae,Nr),e(ae,mn),e(mn,Dr),_(t,fs,f),_(t,O,f),w(dt,O,null),e(O,Lr),e(O,R),e(R,Wr),e(R,uo),e(uo,Hr),e(R,Qr),e(R,un),e(un,Ur),e(R,Rr),e(R,ct),e(ct,Vr),e(R,Br),e(O,Gr),e(O,ie),e(ie,Jr),e(ie,fo),e(fo,Kr),e(ie,Xr),e(ie,go),e(go,Yr),e(ie,Zr),e(O,ea),e(O,le),e(le,ta),e(le,fn),e(fn,oa),e(le,na),e(le,gn),e(gn,sa),e(le,ra),_(t,gs,f),_(t,de,f),e(de,xe),e(xe,_n),w(pt,_n,null),e(de,aa),e(de,bn),e(bn,ia),_(t,_s,f),_(t,q,f),w(ht,q,null),e(q,la),e(q,mt),e(mt,da),e(mt,vn),e(vn,ca),e(mt,pa),e(q,ha),e(q,G),w(ut,G,null),e(G,ma),e(G,kn),e(kn,ua),e(G,fa),e(G,ft),e(ft,_o),e(_o,ga),e(_o,En),e(En,_a),e(ft,ba),e(ft,bo),e(bo,va),e(bo,wn),e(wn,ka),e(q,Ea),e(q,qe),w(gt,qe,null),e(qe,wa),e(qe,_t),e(_t,Ma),e(_t,Mn),e(Mn,ya),e(_t,Ta),e(q,$a),e(q,Fe),w(bt,Fe,null),e(Fe,za),e(Fe,vt),e(vt,xa),e(vt,vo),e(vo,qa),e(vt,Fa),e(q,Ca),e(q,ko),w(kt,ko,null),_(t,bs,f),_(t,ce,f),e(ce,Ce),e(Ce,yn),w(Et,yn,null),e(ce,Pa),e(ce,Tn),e(Tn,ja),_(t,vs,f),_(t,F,f),w(wt,F,null),e(F,Aa),e(F,$n),e($n,Sa),e(F,Ia),e(F,Mt),e(Mt,Oa),e(Mt,Eo),e(Eo,Na),e(Mt,Da),e(F,La),e(F,yt),e(yt,Wa),e(yt,Tt),e(Tt,Ha),e(yt,Qa),e(F,Ua),e(F,L),w($t,L,null),e(L,Ra),e(L,pe),e(pe,Va),e(pe,wo),e(wo,Ba),e(pe,Ga),e(pe,zn),e(zn,Ja),e(pe,Ka),e(L,Xa),w(Pe,L,null),e(L,Ya),w(je,L,null),_(t,ks,f),_(t,he,f),e(he,Ae),e(Ae,xn),w(zt,xn,null),e(he,Za),e(he,qn),e(qn,ei),_(t,Es,f),_(t,C,f),w(xt,C,null),e(C,ti),e(C,Fn),e(Fn,oi),e(C,ni),e(C,qt),e(qt,si),e(qt,Mo),e(Mo,ri),e(qt,ai),e(C,ii),e(C,Ft),e(Ft,li),e(Ft,Ct),e(Ct,di),e(Ft,ci),e(C,pi),e(C,I),w(Pt,I,null),e(I,hi),e(I,me),e(me,mi),e(me,yo),e(yo,ui),e(me,fi),e(me,Cn),e(Cn,gi),e(me,_i),e(I,bi),w(Se,I,null),e(I,vi),w(Ie,I,null),e(I,ki),w(Oe,I,null),_(t,ws,f),_(t,ue,f),e(ue,Ne),e(Ne,Pn),w(jt,Pn,null),e(ue,Ei),e(ue,jn),e(jn,wi),_(t,Ms,f),_(t,P,f),w(At,P,null),e(P,Mi),e(P,An),e(An,yi),e(P,Ti),e(P,St),e(St,$i),e(St,To),e(To,zi),e(St,xi),e(P,qi),e(P,It),e(It,Fi),e(It,Ot),e(Ot,Ci),e(It,Pi),e(P,ji),e(P,W),w(Nt,W,null),e(W,Ai),e(W,fe),e(fe,Si),e(fe,$o),e($o,Ii),e(fe,Oi),e(fe,Sn),e(Sn,Ni),e(fe,Di),e(W,Li),w(De,W,null),e(W,Wi),w(Le,W,null),_(t,ys,f),_(t,ge,f),e(ge,We),e(We,In),w(Dt,In,null),e(ge,Hi),e(ge,On),e(On,Qi),_(t,Ts,f),_(t,j,f),w(Lt,j,null),e(j,Ui),e(j,Nn),e(Nn,Ri),e(j,Vi),e(j,Wt),e(Wt,Bi),e(Wt,zo),e(zo,Gi),e(Wt,Ji),e(j,Ki),e(j,Ht),e(Ht,Xi),e(Ht,Qt),e(Qt,Yi),e(Ht,Zi),e(j,el),e(j,H),w(Ut,H,null),e(H,tl),e(H,_e),e(_e,ol),e(_e,xo),e(xo,nl),e(_e,sl),e(_e,Dn),e(Dn,rl),e(_e,al),e(H,il),w(He,H,null),e(H,ll),w(Qe,H,null),_(t,$s,f),_(t,be,f),e(be,Ue),e(Ue,Ln),w(Rt,Ln,null),e(be,dl),e(be,Wn),e(Wn,cl),_(t,zs,f),_(t,A,f),w(Vt,A,null),e(A,pl),e(A,ve),e(ve,hl),e(ve,Hn),e(Hn,ml),e(ve,ul),e(ve,Qn),e(Qn,fl),e(ve,gl),e(A,_l),e(A,Bt),e(Bt,bl),e(Bt,qo),e(qo,vl),e(Bt,kl),e(A,El),e(A,Gt),e(Gt,wl),e(Gt,Jt),e(Jt,Ml),e(Gt,yl),e(A,Tl),e(A,Q),w(Kt,Q,null),e(Q,$l),e(Q,ke),e(ke,zl),e(ke,Fo),e(Fo,xl),e(ke,ql),e(ke,Un),e(Un,Fl),e(ke,Cl),e(Q,Pl),w(Re,Q,null),e(Q,jl),w(Ve,Q,null),_(t,xs,f),_(t,Ee,f),e(Ee,Be),e(Be,Rn),w(Xt,Rn,null),e(Ee,Al),e(Ee,Vn),e(Vn,Sl),_(t,qs,f),_(t,S,f),w(Yt,S,null),e(S,Il),e(S,we),e(we,Ol),e(we,Bn),e(Bn,Nl),e(we,Dl),e(we,Gn),e(Gn,Ll),e(we,Wl),e(S,Hl),e(S,Zt),e(Zt,Ql),e(Zt,Co),e(Co,Ul),e(Zt,Rl),e(S,Vl),e(S,eo),e(eo,Bl),e(eo,to),e(to,Gl),e(eo,Jl),e(S,Kl),e(S,J),w(oo,J,null),e(J,Xl),e(J,Me),e(Me,Yl),e(Me,Po),e(Po,Zl),e(Me,ed),e(Me,Jn),e(Jn,td),e(Me,od),e(J,nd),w(Ge,J,null),Fs=!0},p(t,[f]){const no={};f&2&&(no.$$scope={dirty:f,ctx:t}),Pe.$set(no);const Kn={};f&2&&(Kn.$$scope={dirty:f,ctx:t}),je.$set(Kn);const Xn={};f&2&&(Xn.$$scope={dirty:f,ctx:t}),Se.$set(Xn);const Yn={};f&2&&(Yn.$$scope={dirty:f,ctx:t}),Ie.$set(Yn);const so={};f&2&&(so.$$scope={dirty:f,ctx:t}),Oe.$set(so);const Zn={};f&2&&(Zn.$$scope={dirty:f,ctx:t}),De.$set(Zn);const es={};f&2&&(es.$$scope={dirty:f,ctx:t}),Le.$set(es);const ts={};f&2&&(ts.$$scope={dirty:f,ctx:t}),He.$set(ts);const ro={};f&2&&(ro.$$scope={dirty:f,ctx:t}),Qe.$set(ro);const os={};f&2&&(os.$$scope={dirty:f,ctx:t}),Re.$set(os);const ns={};f&2&&(ns.$$scope={dirty:f,ctx:t}),Ve.$set(ns);const ss={};f&2&&(ss.$$scope={dirty:f,ctx:t}),Ge.$set(ss)},i(t){Fs||(M(l.$$.fragment,t),M(nt.$$.fragment,t),M(it.$$.fragment,t),M(lt.$$.fragment,t),M(dt.$$.fragment,t),M(pt.$$.fragment,t),M(ht.$$.fragment,t),M(ut.$$.fragment,t),M(gt.$$.fragment,t),M(bt.$$.fragment,t),M(kt.$$.fragment,t),M(Et.$$.fragment,t),M(wt.$$.fragment,t),M($t.$$.fragment,t),M(Pe.$$.fragment,t),M(je.$$.fragment,t),M(zt.$$.fragment,t),M(xt.$$.fragment,t),M(Pt.$$.fragment,t),M(Se.$$.fragment,t),M(Ie.$$.fragment,t),M(Oe.$$.fragment,t),M(jt.$$.fragment,t),M(At.$$.fragment,t),M(Nt.$$.fragment,t),M(De.$$.fragment,t),M(Le.$$.fragment,t),M(Dt.$$.fragment,t),M(Lt.$$.fragment,t),M(Ut.$$.fragment,t),M(He.$$.fragment,t),M(Qe.$$.fragment,t),M(Rt.$$.fragment,t),M(Vt.$$.fragment,t),M(Kt.$$.fragment,t),M(Re.$$.fragment,t),M(Ve.$$.fragment,t),M(Xt.$$.fragment,t),M(Yt.$$.fragment,t),M(oo.$$.fragment,t),M(Ge.$$.fragment,t),Fs=!0)},o(t){y(l.$$.fragment,t),y(nt.$$.fragment,t),y(it.$$.fragment,t),y(lt.$$.fragment,t),y(dt.$$.fragment,t),y(pt.$$.fragment,t),y(ht.$$.fragment,t),y(ut.$$.fragment,t),y(gt.$$.fragment,t),y(bt.$$.fragment,t),y(kt.$$.fragment,t),y(Et.$$.fragment,t),y(wt.$$.fragment,t),y($t.$$.fragment,t),y(Pe.$$.fragment,t),y(je.$$.fragment,t),y(zt.$$.fragment,t),y(xt.$$.fragment,t),y(Pt.$$.fragment,t),y(Se.$$.fragment,t),y(Ie.$$.fragment,t),y(Oe.$$.fragment,t),y(jt.$$.fragment,t),y(At.$$.fragment,t),y(Nt.$$.fragment,t),y(De.$$.fragment,t),y(Le.$$.fragment,t),y(Dt.$$.fragment,t),y(Lt.$$.fragment,t),y(Ut.$$.fragment,t),y(He.$$.fragment,t),y(Qe.$$.fragment,t),y(Rt.$$.fragment,t),y(Vt.$$.fragment,t),y(Kt.$$.fragment,t),y(Re.$$.fragment,t),y(Ve.$$.fragment,t),y(Xt.$$.fragment,t),y(Yt.$$.fragment,t),y(oo.$$.fragment,t),y(Ge.$$.fragment,t),Fs=!1},d(t){o(d),t&&o(v),t&&o(g),T(l),t&&o(rs),t&&o(ne),T(nt),t&&o(as),t&&o(Te),t&&o(is),t&&o(ao),t&&o(ls),t&&o(io),t&&o(ds),t&&o(lo),t&&o(cs),t&&o(N),t&&o(ps),t&&o(B),t&&o(hs),t&&o(re),T(it),t&&o(ms),t&&o(D),t&&o(us),t&&o(ae),T(lt),t&&o(fs),t&&o(O),T(dt),t&&o(gs),t&&o(de),T(pt),t&&o(_s),t&&o(q),T(ht),T(ut),T(gt),T(bt),T(kt),t&&o(bs),t&&o(ce),T(Et),t&&o(vs),t&&o(F),T(wt),T($t),T(Pe),T(je),t&&o(ks),t&&o(he),T(zt),t&&o(Es),t&&o(C),T(xt),T(Pt),T(Se),T(Ie),T(Oe),t&&o(ws),t&&o(ue),T(jt),t&&o(Ms),t&&o(P),T(At),T(Nt),T(De),T(Le),t&&o(ys),t&&o(ge),T(Dt),t&&o(Ts),t&&o(j),T(Lt),T(Ut),T(He),T(Qe),t&&o($s),t&&o(be),T(Rt),t&&o(zs),t&&o(A),T(Vt),T(Kt),T(Re),T(Ve),t&&o(xs),t&&o(Ee),T(Xt),t&&o(qs),t&&o(S),T(Yt),T(oo),T(Ge)}}}const ap={local:"erniem",sections:[{local:"overview",title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.ErnieMConfig",title:"ErnieMConfig"},{local:"transformers.ErnieMTokenizer",title:"ErnieMTokenizer"},{local:"transformers.ErnieMModel",title:"ErnieMModel"},{local:"transformers.ErnieMForSequenceClassification",title:"ErnieMForSequenceClassification"},{local:"transformers.ErnieMForMultipleChoice",title:"ErnieMForMultipleChoice"},{local:"transformers.ErnieMForTokenClassification",title:"ErnieMForTokenClassification"},{local:"transformers.ErnieMForQuestionAnswering",title:"ErnieMForQuestionAnswering"},{local:"transformers.ErnieMForInformationExtraction",title:"ErnieMForInformationExtraction"}],title:"ErnieM"};function ip($){return Vc(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class up extends Hc{constructor(d){super();Qc(this,d,ip,rp,Uc,{})}}export{up as default,ap as metadata};
