import{S as cu,i as pu,s as mu,e as o,k as p,w as b,t as l,M as hu,c as a,d as s,m,a as r,x as k,h as i,b as h,N as du,G as e,g as _,y as $,q as w,o as y,B as M,v as uu,L}from"../../chunks/vendor-hf-doc-builder.js";import{T as tm}from"../../chunks/Tip-hf-doc-builder.js";import{D as z}from"../../chunks/Docstring-hf-doc-builder.js";import{C as N}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as S}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function fu(x){let c,T,g,d,v;return d=new N({props:{code:`from transformers import MT5Model, AutoTokenizer

model = MT5Model.from_pretrained("google/mt5-small")
tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")
article = "UN Offizier sagt, dass weiter verhandelt werden muss in Syrien."
summary = "Weiter Verhandlung in Syrien."
inputs = tokenizer(article, return_tensors="pt")
labels = tokenizer(text_target=summary, return_tensors="pt")

outputs = model(input_ids=inputs["input_ids"], decoder_input_ids=labels["input_ids"])
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> MT5Model, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = MT5Model.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>article = <span class="hljs-string">&quot;UN Offizier sagt, dass weiter verhandelt werden muss in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>summary = <span class="hljs-string">&quot;Weiter Verhandlung in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(article, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tokenizer(text_target=summary, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>], decoder_input_ids=labels[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>hidden_states = outputs.last_hidden_state`}}),{c(){c=o("p"),T=l("Examples:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Examples:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function gu(x){let c,T,g,d,v;return d=new N({props:{code:`# On a 4 GPU machine with mt5-xl:
model = MT5ForConditionalGeneration.from_pretrained("Mt5-xl")
device_map = {
    0: [0, 1, 2],
    1: [3, 4, 5, 6, 7, 8, 9],
    2: [10, 11, 12, 13, 14, 15, 16],
    3: [17, 18, 19, 20, 21, 22, 23],
}
model.parallelize(device_map)  # Splits the model across several devices
model.deparallelize()  # Put the model back on cpu and cleans memory by calling torch.cuda.empty_cache()`,highlighted:`<span class="hljs-comment"># On a 4 GPU machine with mt5-xl:</span>
model = MT5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Mt5-xl&quot;</span>)
device_map = {
    <span class="hljs-number">0</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>],
    <span class="hljs-number">1</span>: [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>],
    <span class="hljs-number">2</span>: [<span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>, <span class="hljs-number">16</span>],
    <span class="hljs-number">3</span>: [<span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>, <span class="hljs-number">22</span>, <span class="hljs-number">23</span>],
}
model.parallelize(device_map)  <span class="hljs-comment"># Splits the model across several devices</span>
model.deparallelize()  <span class="hljs-comment"># Put the model back on cpu and cleans memory by calling torch.cuda.empty_cache()</span>`}}),{c(){c=o("p"),T=l("Example:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Example:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function _u(x){let c,T,g,d,v;return{c(){c=o("p"),T=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),d=l("Module"),v=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(u,"CODE",{});var G=r(g);d=i(G,"Module"),G.forEach(s),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(s)},m(n,u){_(n,c,u),e(c,T),e(c,g),e(g,d),e(c,v)},d(n){n&&s(c)}}}function vu(x){let c,T,g,d,v;return d=new N({props:{code:`from transformers import AutoTokenizer, MT5Model

tokenizer = AutoTokenizer.from_pretrained("mt5-small")
model = MT5Model.from_pretrained("mt5-small")

input_ids = tokenizer(
    "Studies have been shown that owning a dog is good for you", return_tensors="pt"
).input_ids  # Batch size 1
decoder_input_ids = tokenizer("Studies show that", return_tensors="pt").input_ids  # Batch size 1

# preprocess: Prepend decoder_input_ids with start token which is pad token for MT5Model.
# This is not needed for torch's MT5ForConditionalGeneration as it does this internally using labels arg.
decoder_input_ids = model._shift_right(decoder_input_ids)

# forward pass
outputs = model(input_ids=input_ids, decoder_input_ids=decoder_input_ids)
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, MT5Model

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MT5Model.from_pretrained(<span class="hljs-string">&quot;mt5-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Studies have been shown that owning a dog is good for you&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>).input_ids  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = tokenizer(<span class="hljs-string">&quot;Studies show that&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids  <span class="hljs-comment"># Batch size 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># preprocess: Prepend decoder_input_ids with start token which is pad token for MT5Model.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># This is not needed for torch&#x27;s MT5ForConditionalGeneration as it does this internally using labels arg.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = model._shift_right(decoder_input_ids)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids=input_ids, decoder_input_ids=decoder_input_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){c=o("p"),T=l("Example:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Example:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function Tu(x){let c,T,g,d,v;return d=new N({props:{code:`# Here is an example of a device map on a machine with 4 GPUs using mt5-xl, which has a total of 24 attention modules:
model = MT5ForConditionalGeneration.from_pretrained("mt5-xl")
device_map = {
    0: [0, 1, 2],
    1: [3, 4, 5, 6, 7, 8, 9],
    2: [10, 11, 12, 13, 14, 15, 16],
    3: [17, 18, 19, 20, 21, 22, 23],
}
model.parallelize(device_map)`,highlighted:`<span class="hljs-comment"># Here is an example of a device map on a machine with 4 GPUs using mt5-xl, which has a total of 24 attention modules:</span>
model = MT5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;mt5-xl&quot;</span>)
device_map = {
    <span class="hljs-number">0</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>],
    <span class="hljs-number">1</span>: [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>],
    <span class="hljs-number">2</span>: [<span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>, <span class="hljs-number">16</span>],
    <span class="hljs-number">3</span>: [<span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>, <span class="hljs-number">22</span>, <span class="hljs-number">23</span>],
}
model.parallelize(device_map)`}}),{c(){c=o("p"),T=l("Example:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Example:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function bu(x){let c,T,g,d,v;return d=new N({props:{code:`from transformers import MT5ForConditionalGeneration, AutoTokenizer

model = MT5ForConditionalGeneration.from_pretrained("google/mt5-small")
tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")
article = "UN Offizier sagt, dass weiter verhandelt werden muss in Syrien."
summary = "Weiter Verhandlung in Syrien."
inputs = tokenizer(article, text_target=summary, return_tensors="pt")

outputs = model(**inputs)
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> MT5ForConditionalGeneration, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = MT5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>article = <span class="hljs-string">&quot;UN Offizier sagt, dass weiter verhandelt werden muss in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>summary = <span class="hljs-string">&quot;Weiter Verhandlung in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(article, text_target=summary, 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>loss = outputs.loss`}}),{c(){c=o("p"),T=l("Examples:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Examples:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function ku(x){let c,T,g,d,v;return d=new N({props:{code:`# On a 4 GPU machine with mt5-xl:
model = MT5ForConditionalGeneration.from_pretrained("Mt5-xl")
device_map = {
    0: [0, 1, 2],
    1: [3, 4, 5, 6, 7, 8, 9],
    2: [10, 11, 12, 13, 14, 15, 16],
    3: [17, 18, 19, 20, 21, 22, 23],
}
model.parallelize(device_map)  # Splits the model across several devices
model.deparallelize()  # Put the model back on cpu and cleans memory by calling torch.cuda.empty_cache()`,highlighted:`<span class="hljs-comment"># On a 4 GPU machine with mt5-xl:</span>
model = MT5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Mt5-xl&quot;</span>)
device_map = {
    <span class="hljs-number">0</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>],
    <span class="hljs-number">1</span>: [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>],
    <span class="hljs-number">2</span>: [<span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>, <span class="hljs-number">16</span>],
    <span class="hljs-number">3</span>: [<span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>, <span class="hljs-number">22</span>, <span class="hljs-number">23</span>],
}
model.parallelize(device_map)  <span class="hljs-comment"># Splits the model across several devices</span>
model.deparallelize()  <span class="hljs-comment"># Put the model back on cpu and cleans memory by calling torch.cuda.empty_cache()</span>`}}),{c(){c=o("p"),T=l("Example:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Example:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function $u(x){let c,T,g,d,v;return{c(){c=o("p"),T=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),d=l("Module"),v=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(u,"CODE",{});var G=r(g);d=i(G,"Module"),G.forEach(s),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(s)},m(n,u){_(n,c,u),e(c,T),e(c,g),e(g,d),e(c,v)},d(n){n&&s(c)}}}function wu(x){let c,T,g,d,v;return d=new N({props:{code:`from transformers import AutoTokenizer, MT5ForConditionalGeneration

tokenizer = AutoTokenizer.from_pretrained("mt5-small")
model = MT5ForConditionalGeneration.from_pretrained("mt5-small")

# training
input_ids = tokenizer("The <extra_id_0> walks in <extra_id_1> park", return_tensors="pt").input_ids
labels = tokenizer("<extra_id_0> cute dog <extra_id_1> the <extra_id_2>", return_tensors="pt").input_ids
outputs = model(input_ids=input_ids, labels=labels)
loss = outputs.loss
logits = outputs.logits

# inference
input_ids = tokenizer(
    "summarize: studies have shown that owning a dog is good for you", return_tensors="pt"
).input_ids  # Batch size 1
outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# studies have shown that owning a dog is good for you.`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, MT5ForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MT5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;mt5-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># training</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer(<span class="hljs-string">&quot;The &lt;extra_id_0&gt; walks in &lt;extra_id_1&gt; park&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tokenizer(<span class="hljs-string">&quot;&lt;extra_id_0&gt; cute dog &lt;extra_id_1&gt; the &lt;extra_id_2&gt;&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids=input_ids, labels=labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># inference</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;summarize: studies have shown that owning a dog is good for you&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>).input_ids  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(input_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># studies have shown that owning a dog is good for you.</span>`}}),{c(){c=o("p"),T=l("Examples:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Examples:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function yu(x){let c,T,g,d,v;return d=new N({props:{code:`# Here is an example of a device map on a machine with 4 GPUs using mt5-xl, which has a total of 24 attention modules:
model = MT5ForConditionalGeneration.from_pretrained("mt5-xl")
device_map = {
    0: [0, 1, 2],
    1: [3, 4, 5, 6, 7, 8, 9],
    2: [10, 11, 12, 13, 14, 15, 16],
    3: [17, 18, 19, 20, 21, 22, 23],
}
model.parallelize(device_map)`,highlighted:`<span class="hljs-comment"># Here is an example of a device map on a machine with 4 GPUs using mt5-xl, which has a total of 24 attention modules:</span>
model = MT5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;mt5-xl&quot;</span>)
device_map = {
    <span class="hljs-number">0</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>],
    <span class="hljs-number">1</span>: [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>],
    <span class="hljs-number">2</span>: [<span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>, <span class="hljs-number">16</span>],
    <span class="hljs-number">3</span>: [<span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>, <span class="hljs-number">22</span>, <span class="hljs-number">23</span>],
}
model.parallelize(device_map)`}}),{c(){c=o("p"),T=l("Example:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Example:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function Mu(x){let c,T,g,d,v;return d=new N({props:{code:`from transformers import MT5EncoderModel, AutoTokenizer

model = MT5EncoderModel.from_pretrained("google/mt5-small")
tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")
article = "UN Offizier sagt, dass weiter verhandelt werden muss in Syrien."
input_ids = tokenizer(article, return_tensors="pt").input_ids
outputs = model(input_ids)
hidden_state = 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> MT5EncoderModel, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = MT5EncoderModel.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>article = <span class="hljs-string">&quot;UN Offizier sagt, dass weiter verhandelt werden muss in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer(article, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>hidden_state = outputs.last_hidden_state`}}),{c(){c=o("p"),T=l("Examples:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Examples:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function xu(x){let c,T,g,d,v;return d=new N({props:{code:`# On a 4 GPU machine with mt5-xl:
model = MT5ForConditionalGeneration.from_pretrained("Mt5-xl")
device_map = {
    0: [0, 1, 2],
    1: [3, 4, 5, 6, 7, 8, 9],
    2: [10, 11, 12, 13, 14, 15, 16],
    3: [17, 18, 19, 20, 21, 22, 23],
}
model.parallelize(device_map)  # Splits the model across several devices
model.deparallelize()  # Put the model back on cpu and cleans memory by calling torch.cuda.empty_cache()`,highlighted:`<span class="hljs-comment"># On a 4 GPU machine with mt5-xl:</span>
model = MT5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Mt5-xl&quot;</span>)
device_map = {
    <span class="hljs-number">0</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>],
    <span class="hljs-number">1</span>: [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>],
    <span class="hljs-number">2</span>: [<span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>, <span class="hljs-number">16</span>],
    <span class="hljs-number">3</span>: [<span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>, <span class="hljs-number">22</span>, <span class="hljs-number">23</span>],
}
model.parallelize(device_map)  <span class="hljs-comment"># Splits the model across several devices</span>
model.deparallelize()  <span class="hljs-comment"># Put the model back on cpu and cleans memory by calling torch.cuda.empty_cache()</span>`}}),{c(){c=o("p"),T=l("Example:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Example:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function zu(x){let c,T,g,d,v;return{c(){c=o("p"),T=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),d=l("Module"),v=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(u,"CODE",{});var G=r(g);d=i(G,"Module"),G.forEach(s),v=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(s)},m(n,u){_(n,c,u),e(c,T),e(c,g),e(g,d),e(c,v)},d(n){n&&s(c)}}}function ju(x){let c,T,g,d,v;return d=new N({props:{code:`from transformers import AutoTokenizer, MT5EncoderModel

tokenizer = AutoTokenizer.from_pretrained("mt5-small")
model = MT5EncoderModel.from_pretrained("mt5-small")
input_ids = tokenizer(
    "Studies have been shown that owning a dog is good for you", return_tensors="pt"
).input_ids  # Batch size 1
outputs = model(input_ids=input_ids)
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, MT5EncoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MT5EncoderModel.from_pretrained(<span class="hljs-string">&quot;mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Studies have been shown that owning a dog is good for you&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>).input_ids  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids=input_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){c=o("p"),T=l("Example:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Example:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function Eu(x){let c,T,g,d,v;return d=new N({props:{code:`# Here is an example of a device map on a machine with 4 GPUs using mt5-xl, which has a total of 24 attention modules:
model = MT5ForConditionalGeneration.from_pretrained("mt5-xl")
device_map = {
    0: [0, 1, 2],
    1: [3, 4, 5, 6, 7, 8, 9],
    2: [10, 11, 12, 13, 14, 15, 16],
    3: [17, 18, 19, 20, 21, 22, 23],
}
model.parallelize(device_map)`,highlighted:`<span class="hljs-comment"># Here is an example of a device map on a machine with 4 GPUs using mt5-xl, which has a total of 24 attention modules:</span>
model = MT5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;mt5-xl&quot;</span>)
device_map = {
    <span class="hljs-number">0</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>],
    <span class="hljs-number">1</span>: [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>],
    <span class="hljs-number">2</span>: [<span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>, <span class="hljs-number">16</span>],
    <span class="hljs-number">3</span>: [<span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>, <span class="hljs-number">22</span>, <span class="hljs-number">23</span>],
}
model.parallelize(device_map)`}}),{c(){c=o("p"),T=l("Example:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Example:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function qu(x){let c,T,g,d,v;return d=new N({props:{code:`from transformers import TFMT5Model, AutoTokenizer

model = TFMT5Model.from_pretrained("google/mt5-small")
tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")
article = "UN Offizier sagt, dass weiter verhandelt werden muss in Syrien."
summary = "Weiter Verhandlung in Syrien."
inputs = tokenizer(article, return_tensors="tf")
labels = tokenizer(text_target=summary, return_tensors="tf")

outputs = model(input_ids=inputs["input_ids"], decoder_input_ids=labels["input_ids"])
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> TFMT5Model, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFMT5Model.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>article = <span class="hljs-string">&quot;UN Offizier sagt, dass weiter verhandelt werden muss in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>summary = <span class="hljs-string">&quot;Weiter Verhandlung in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(article, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tokenizer(text_target=summary, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>], decoder_input_ids=labels[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>hidden_states = outputs.last_hidden_state`}}),{c(){c=o("p"),T=l("Examples:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Examples:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function Fu(x){let c,T,g,d,v;return d=new N({props:{code:`from transformers import TFMT5ForConditionalGeneration, AutoTokenizer

model = TFMT5ForConditionalGeneration.from_pretrained("google/mt5-small")
tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")
article = "UN Offizier sagt, dass weiter verhandelt werden muss in Syrien."
summary = "Weiter Verhandlung in Syrien."
inputs = tokenizer(article, text_target=summary, return_tensors="tf")

outputs = model(**inputs)
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> TFMT5ForConditionalGeneration, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFMT5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>article = <span class="hljs-string">&quot;UN Offizier sagt, dass weiter verhandelt werden muss in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>summary = <span class="hljs-string">&quot;Weiter Verhandlung in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(article, text_target=summary, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss`}}),{c(){c=o("p"),T=l("Examples:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Examples:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function Pu(x){let c,T,g,d,v;return d=new N({props:{code:`from transformers import TFMT5EncoderModel, AutoTokenizer

model = TFMT5EncoderModel.from_pretrained("google/mt5-small")
tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")
article = "UN Offizier sagt, dass weiter verhandelt werden muss in Syrien."
input_ids = tokenizer(article, return_tensors="tf").input_ids
outputs = model(input_ids)
hidden_state = 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> TFMT5EncoderModel, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFMT5EncoderModel.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>article = <span class="hljs-string">&quot;UN Offizier sagt, dass weiter verhandelt werden muss in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer(article, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).input_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>hidden_state = outputs.last_hidden_state`}}),{c(){c=o("p"),T=l("Examples:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Examples:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function Au(x){let c,T,g,d,v;return d=new N({props:{code:`from transformers import FlaxMT5Model, AutoTokenizer

model = FlaxMT5Model.from_pretrained("google/mt5-small")
tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")

article = "UN Offizier sagt, dass weiter verhandelt werden muss in Syrien."
summary = "Weiter Verhandlung in Syrien."
inputs = tokenizer(article, return_tensors="np")

decoder_input_ids = tokenizer(text_target=summary, return_tensors="np").input_ids

outputs = model(input_ids=inputs["input_ids"], decoder_input_ids=decoder_input_ids)
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> FlaxMT5Model, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxMT5Model.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>article = <span class="hljs-string">&quot;UN Offizier sagt, dass weiter verhandelt werden muss in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>summary = <span class="hljs-string">&quot;Weiter Verhandlung in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(article, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = tokenizer(text_target=summary, return_tensors=<span class="hljs-string">&quot;np&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>], decoder_input_ids=decoder_input_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>hidden_states = outputs.last_hidden_state`}}),{c(){c=o("p"),T=l("Examples:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Examples:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function Cu(x){let c,T,g,d,v;return d=new N({props:{code:`from transformers import FlaxMT5ForConditionalGeneration, AutoTokenizer

model = FlaxMT5ForConditionalGeneration.from_pretrained("google/mt5-small")
tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")

article = "UN Offizier sagt, dass weiter verhandelt werden muss in Syrien."
summary = "Weiter Verhandlung in Syrien."
inputs = tokenizer(article, return_tensors="np")

decoder_input_ids = tokenizer(text_target=summary, return_tensors="np").input_ids

outputs = model(**inputs, decoder_input_ids=decoder_input_ids)
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> FlaxMT5ForConditionalGeneration, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxMT5ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>article = <span class="hljs-string">&quot;UN Offizier sagt, dass weiter verhandelt werden muss in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>summary = <span class="hljs-string">&quot;Weiter Verhandlung in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(article, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = tokenizer(text_target=summary, return_tensors=<span class="hljs-string">&quot;np&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, decoder_input_ids=decoder_input_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){c=o("p"),T=l("Examples:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Examples:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function Su(x){let c,T,g,d,v;return d=new N({props:{code:`from transformers import FlaxT5EncoderModel, AutoTokenizer

model = FlaxT5EncoderModel.from_pretrained("google/mt5-small")
tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")

article = "UN Offizier sagt, dass weiter verhandelt werden muss in Syrien."
summary = "Weiter Verhandlung in Syrien."
inputs = tokenizer(article, return_tensors="np")

decoder_input_ids = tokenizer(text_target=summary, return_tensors="np").input_ids

outputs = model(input_ids=inputs["input_ids"])
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> FlaxT5EncoderModel, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxT5EncoderModel.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/mt5-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>article = <span class="hljs-string">&quot;UN Offizier sagt, dass weiter verhandelt werden muss in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>summary = <span class="hljs-string">&quot;Weiter Verhandlung in Syrien.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(article, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = tokenizer(text_target=summary, return_tensors=<span class="hljs-string">&quot;np&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>hidden_states = outputs.last_hidden_state`}}),{c(){c=o("p"),T=l("Examples:"),g=p(),b(d.$$.fragment)},l(n){c=a(n,"P",{});var u=r(c);T=i(u,"Examples:"),u.forEach(s),g=m(n),k(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),$(d,n,u),v=!0},p:L,i(n){v||(w(d.$$.fragment,n),v=!0)},o(n){y(d.$$.fragment,n),v=!1},d(n){n&&s(c),n&&s(g),M(d,n)}}}function Lu(x){let c,T,g,d,v,n,u,G,al,Aa,pe,rn,ln,sm,rl,dn,cn,nm,Ca,me,Fe,ao,jt,ll,ro,il,Sa,Pe,dl,Et,cl,pl,La,pn,ml,Na,mn,lo,hl,Oa,Ae,ul,qt,fl,gl,Ia,hn,_l,Ga,D,io,co,Ft,vl,Tl,po,mo,Pt,bl,kl,ho,uo,At,$l,wl,fo,go,Ct,yl,Ml,_o,un,St,xl,zl,Da,oe,jl,Lt,El,ql,Nt,Fl,Pl,Ua,he,Ce,vo,Ot,Al,To,Cl,Ba,Se,bo,fn,Sl,Ll,ko,gn,Nl,Wa,ue,Le,$o,It,Ol,wo,Il,Va,X,Gt,Gl,Y,Dl,_n,Ul,Bl,vn,Wl,Vl,Dt,Hl,Rl,Kl,fe,Jl,Tn,Xl,Yl,bn,Zl,Ql,Ha,ge,Ne,yo,Ut,ei,Mo,ti,Ra,F,Bt,si,Wt,ni,Vt,oi,ai,ri,Ht,li,kn,ii,di,ci,ae,Rt,pi,xo,mi,hi,Kt,$n,ui,zo,fi,gi,wn,_i,jo,vi,Ti,Oe,Jt,bi,Eo,ki,$i,Ie,Xt,wi,qo,yi,Mi,Ge,Yt,xi,Zt,zi,Fo,ji,Ei,Ka,De,qi,yn,Fi,Pi,Ja,_e,Ue,Po,Qt,Ai,Ao,Ci,Xa,O,es,Si,ve,Li,Co,Ni,Oi,ts,Ii,Gi,Di,ss,Ui,Mn,Bi,Wi,Vi,re,ns,Hi,So,Ri,Ki,os,xn,Ji,Lo,Xi,Yi,zn,Zi,No,Qi,ed,Be,as,td,Oo,sd,Ya,We,nd,jn,od,ad,Za,Te,Ve,Io,rs,rd,Go,ld,Qa,j,ls,id,Do,dd,cd,is,pd,ds,md,hd,ud,cs,fd,En,gd,_d,vd,ps,Td,ms,bd,kd,$d,He,wd,le,hs,yd,Uo,Md,xd,Re,zd,W,us,jd,be,Ed,qn,qd,Fd,Bo,Pd,Ad,Cd,Ke,Sd,Je,Ld,V,fs,Nd,Wo,Od,Id,Vo,Gd,Dd,Xe,er,ke,Ye,Ho,gs,Ud,Ro,Bd,tr,E,_s,Wd,vs,Vd,Ko,Hd,Rd,Kd,Ts,Jd,bs,Xd,Yd,Zd,ks,Qd,Fn,ec,tc,sc,$s,nc,ws,oc,ac,rc,Ze,lc,ie,ys,ic,Jo,dc,cc,Qe,pc,H,Ms,mc,$e,hc,Pn,uc,fc,Xo,gc,_c,vc,et,Tc,tt,bc,R,xs,kc,Yo,$c,wc,Zo,yc,Mc,st,sr,we,nt,Qo,zs,xc,ea,zc,nr,q,js,jc,ta,Ec,qc,Es,Fc,qs,Pc,Ac,Cc,Fs,Sc,An,Lc,Nc,Oc,Ps,Ic,As,Gc,Dc,Uc,ot,Bc,de,Cs,Wc,sa,Vc,Hc,at,Rc,K,Ss,Kc,ye,Jc,Cn,Xc,Yc,na,Zc,Qc,ep,rt,tp,lt,sp,J,Ls,np,oa,op,ap,aa,rp,lp,it,or,Me,dt,ra,Ns,ip,la,dp,ar,Z,Os,cp,Is,pp,Sn,mp,hp,up,ct,rr,xe,pt,ia,Gs,fp,da,gp,lr,Q,Ds,_p,Us,vp,Ln,Tp,bp,kp,mt,ir,ze,ht,ca,Bs,$p,pa,wp,dr,ee,Ws,yp,Vs,Mp,Nn,xp,zp,jp,ut,cr,je,ft,ma,Hs,Ep,ha,qp,pr,te,Rs,Fp,Ks,Pp,On,Ap,Cp,Sp,gt,mr,Ee,_t,ua,Js,Lp,fa,Np,hr,se,Xs,Op,Ys,Ip,In,Gp,Dp,Up,vt,ur,qe,Tt,ga,Zs,Bp,_a,Wp,fr,ne,Qs,Vp,en,Hp,Gn,Rp,Kp,Jp,bt,gr;return n=new I({}),jt=new I({}),Ot=new I({}),It=new I({}),Gt=new z({props:{name:"class transformers.MT5Config",anchor:"transformers.MT5Config",parameters:[{name:"vocab_size",val:" = 250112"},{name:"d_model",val:" = 512"},{name:"d_kv",val:" = 64"},{name:"d_ff",val:" = 1024"},{name:"num_layers",val:" = 8"},{name:"num_decoder_layers",val:" = None"},{name:"num_heads",val:" = 6"},{name:"relative_attention_num_buckets",val:" = 32"},{name:"relative_attention_max_distance",val:" = 128"},{name:"dropout_rate",val:" = 0.1"},{name:"layer_norm_epsilon",val:" = 1e-06"},{name:"initializer_factor",val:" = 1.0"},{name:"feed_forward_proj",val:" = 'gated-gelu'"},{name:"is_encoder_decoder",val:" = True"},{name:"use_cache",val:" = True"},{name:"tokenizer_class",val:" = 'T5Tokenizer'"},{name:"tie_word_embeddings",val:" = False"},{name:"pad_token_id",val:" = 0"},{name:"eos_token_id",val:" = 1"},{name:"decoder_start_token_id",val:" = 0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MT5Config.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 250112) &#x2014;
Vocabulary size of the T5 model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.27.1/en/model_doc/t5#transformers.T5Model">T5Model</a> or <a href="/docs/transformers/v4.27.1/en/model_doc/t5#transformers.TFT5Model">TFT5Model</a>.`,name:"vocab_size"},{anchor:"transformers.MT5Config.d_model",description:`<strong>d_model</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Size of the encoder layers and the pooler layer.`,name:"d_model"},{anchor:"transformers.MT5Config.d_kv",description:`<strong>d_kv</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Size of the key, query, value projections per attention head. <code>d_kv</code> has to be equal to <code>d_model // num_heads</code>.`,name:"d_kv"},{anchor:"transformers.MT5Config.d_ff",description:`<strong>d_ff</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Size of the intermediate feed forward layer in each <code>T5Block</code>.`,name:"d_ff"},{anchor:"transformers.MT5Config.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_layers"},{anchor:"transformers.MT5Config.num_decoder_layers",description:`<strong>num_decoder_layers</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of hidden layers in the Transformer decoder. Will use the same value as <code>num_layers</code> if not set.`,name:"num_decoder_layers"},{anchor:"transformers.MT5Config.num_heads",description:`<strong>num_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 6) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_heads"},{anchor:"transformers.MT5Config.relative_attention_num_buckets",description:`<strong>relative_attention_num_buckets</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The number of buckets to use for each attention layer.`,name:"relative_attention_num_buckets"},{anchor:"transformers.MT5Config.relative_attention_max_distance",description:`<strong>relative_attention_max_distance</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The maximum distance of the longer sequences for the bucket separation.`,name:"relative_attention_max_distance"},{anchor:"transformers.MT5Config.dropout_rate",description:`<strong>dropout_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The ratio for all dropout layers.`,name:"dropout_rate"},{anchor:"transformers.MT5Config.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.MT5Config.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.MT5Config.feed_forward_proj",description:`<strong>feed_forward_proj</strong> (<code>string</code>, <em>optional</em>, defaults to <code>&quot;gated-gelu&quot;</code>) &#x2014;
Type of feed forward layer to be used. Should be one of <code>&quot;relu&quot;</code> or <code>&quot;gated-gelu&quot;</code>.`,name:"feed_forward_proj"},{anchor:"transformers.MT5Config.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/configuration_mt5.py#L26"}}),Ut=new I({}),Bt=new z({props:{name:"class transformers.T5Tokenizer",anchor:"transformers.T5Tokenizer",parameters:[{name:"vocab_file",val:""},{name:"eos_token",val:" = '</s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"pad_token",val:" = '<pad>'"},{name:"extra_ids",val:" = 100"},{name:"additional_special_tokens",val:" = None"},{name:"sp_model_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.T5Tokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
<a href="https://github.com/google/sentencepiece" rel="nofollow">SentencePiece</a> file (generally has a <em>.spm</em> extension) that
contains the vocabulary necessary to instantiate a tokenizer.`,name:"vocab_file"},{anchor:"transformers.T5Tokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the end of sequence.
The token used is the <code>sep_token</code>.</p>

					</div>`,name:"eos_token"},{anchor:"transformers.T5Tokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.T5Tokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.T5Tokenizer.extra_ids",description:`<strong>extra_ids</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
Add a number of extra ids added to the vocabulary for use as sentinels. These tokens are
accessible as &#x201C;<extra<em>id{%d}&gt;&#x201D; where &#x201D;{%d}&#x201D; is a number between 0 and extra_ids-1. These tokens can be
retrieved by calling get_sentinel_tokens method and token ids can be by calling get_sentinel_token_ids
method
additional_special_tokens (<code>List[str]</code>, <em>optional</em>):
Additional special tokens used by the tokenizer.</extra<em>`,name:"extra_ids"},{anchor:"transformers.T5Tokenizer.sp_model_kwargs",description:`<strong>sp_model_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Will be passed to the <code>SentencePieceProcessor.__init__()</code> method. The <a href="https://github.com/google/sentencepiece/tree/master/python" rel="nofollow">Python wrapper for
SentencePiece</a> can be used, among other things,
to set:</p>
<ul>
<li>
<p><code>enable_sampling</code>: Enable subword regularization.</p>
</li>
<li>
<p><code>nbest_size</code>: Sampling parameters for unigram. Invalid for BPE-Dropout.</p>
<ul>
<li><code>nbest_size = {0,1}</code>: No sampling is performed.</li>
<li><code>nbest_size &gt; 1</code>: samples from the nbest_size results.</li>
<li><code>nbest_size &lt; 0</code>: assuming that nbest_size is infinite and samples from the all hypothesis (lattice)
using forward-filtering-and-backward-sampling algorithm.</li>
</ul>
</li>
<li>
<p><code>alpha</code>: Smoothing parameter for unigram sampling, and dropout probability of merge operations for
BPE-dropout.</p>
</li>
</ul>`,name:"sp_model_kwargs"},{anchor:"transformers.T5Tokenizer.sp_model",description:`<strong>sp_model</strong> (<code>SentencePieceProcessor</code>) &#x2014;
The <em>SentencePiece</em> processor that is used for every conversion (string, tokens and IDs).`,name:"sp_model"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/t5/tokenization_t5.py#L55"}}),Rt=new z({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.T5Tokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.T5Tokenizer.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.T5Tokenizer.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.27.1/src/transformers/models/t5/tokenization_t5.py#L256",returnDescription:`
<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Jt=new z({props:{name:"convert_tokens_to_string",anchor:"transformers.T5Tokenizer.convert_tokens_to_string",parameters:[{name:"tokens",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/t5/tokenization_t5.py#L317"}}),Xt=new z({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.T5Tokenizer.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.T5Tokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.T5Tokenizer.create_token_type_ids_from_sequences.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.27.1/src/transformers/models/t5/tokenization_t5.py#L234",returnDescription:`
<p>List of zeros.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Yt=new z({props:{name:"get_special_tokens_mask",anchor:"transformers.T5Tokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.T5Tokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.T5Tokenizer.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.T5Tokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</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.27.1/src/transformers/models/t5/tokenization_t5.py#L187",returnDescription:`
<p>A 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>
`}}),Qt=new I({}),es=new z({props:{name:"class transformers.T5TokenizerFast",anchor:"transformers.T5TokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"eos_token",val:" = '</s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"pad_token",val:" = '<pad>'"},{name:"extra_ids",val:" = 100"},{name:"additional_special_tokens",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.T5TokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
<a href="https://github.com/google/sentencepiece" rel="nofollow">SentencePiece</a> file (generally has a <em>.spm</em> extension) that
contains the vocabulary necessary to instantiate a tokenizer.`,name:"vocab_file"},{anchor:"transformers.T5TokenizerFast.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the end of sequence.
The token used is the <code>sep_token</code>.</p>

					</div>`,name:"eos_token"},{anchor:"transformers.T5TokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.T5TokenizerFast.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.T5TokenizerFast.extra_ids",description:`<strong>extra_ids</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
Add a number of extra ids added to the vocabulary for use as sentinels. These tokens are accessible as
&#x201C;<extra<em>id{%d}&gt;&#x201D; where &#x201D;{%d}&#x201D; is a number between 0 and extra_ids-1. These tokens can be retrieved by
calling get_sentinel_tokens method and token ids can be by calling get_sentinel_token_ids method</extra<em>`,name:"extra_ids"},{anchor:"transformers.T5TokenizerFast.additional_special_tokens",description:`<strong>additional_special_tokens</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
Additional special tokens used by the tokenizer.`,name:"additional_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/t5/tokenization_t5_fast.py#L66"}}),ns=new z({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.T5TokenizerFast.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.T5TokenizerFast.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.T5TokenizerFast.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.27.1/src/transformers/models/t5/tokenization_t5_fast.py#L190",returnDescription:`
<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),as=new z({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.T5TokenizerFast.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.T5TokenizerFast.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.T5TokenizerFast.create_token_type_ids_from_sequences.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.27.1/src/transformers/models/t5/tokenization_t5_fast.py#L216",returnDescription:`
<p>List of zeros.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),rs=new I({}),ls=new z({props:{name:"class transformers.MT5Model",anchor:"transformers.MT5Model",parameters:[{name:"config",val:": MT5Config"}],parametersDescription:[{anchor:"transformers.MT5Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/mt5#transformers.MT5Config">MT5Config</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.27.1/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.27.1/src/transformers/models/mt5/modeling_mt5.py#L1279"}}),He=new S({props:{anchor:"transformers.MT5Model.example",$$slots:{default:[fu]},$$scope:{ctx:x}}}),hs=new z({props:{name:"deparallelize",anchor:"transformers.MT5Model.deparallelize",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_mt5.py#L1355"}}),Re=new S({props:{anchor:"transformers.MT5Model.deparallelize.example",$$slots:{default:[gu]},$$scope:{ctx:x}}}),us=new z({props:{name:"forward",anchor:"transformers.MT5Model.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_attention_mask",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"cross_attn_head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_outputs",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"decoder_inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.MT5Model.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. MT5 is a model with relative position embeddings so you
should be able to pad the inputs on both the right and the left.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for detail.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
<p>To know more on how to prepare <code>input_ids</code> for pretraining take a look a <a href="./mt5#training">MT5 Training</a>.`,name:"input_ids"},{anchor:"transformers.MT5Model.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.MT5Model.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>MT5 uses the <code>pad_token_id</code> as the starting token for <code>decoder_input_ids</code> generation. If <code>past_key_values</code>
is used, optionally only the last <code>decoder_input_ids</code> have to be input (see <code>past_key_values</code>).</p>
<p>To know more on how to prepare <code>decoder_input_ids</code> for pretraining take a look at <a href="./mt5#training">MT5
Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.MT5Model.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.MT5Model.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 in the encoder. 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.MT5Model.forward.decoder_head_mask",description:`<strong>decoder_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 in the decoder. 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:"decoder_head_mask"},{anchor:"transformers.MT5Model.forward.cross_attn_head_mask",description:`<strong>cross_attn_head_mask</strong> (<code>torch.Tensor</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 cross-attention modules in the decoder. 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:"cross_attn_head_mask"},{anchor:"transformers.MT5Model.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <code>optional</code>: <em>hidden_states</em>, <code>optional</code>: <em>attentions</em>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code> is a sequence of hidden states at
the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.MT5Model.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.MT5Model.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.MT5Model.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. If <code>past_key_values</code> is used, optionally only the last <code>decoder_inputs_embeds</code> have to be
input (see <code>past_key_values</code>). This is useful if you want more control over how to convert
<code>decoder_input_ids</code> indices into associated vectors than the model&#x2019;s internal embedding lookup matrix.</p>
<p>If <code>decoder_input_ids</code> and <code>decoder_inputs_embeds</code> are both unset, <code>decoder_inputs_embeds</code> takes the value
of <code>inputs_embeds</code>.`,name:"decoder_inputs_embeds"},{anchor:"transformers.MT5Model.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.MT5Model.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.MT5Model.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.MT5Model.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.27.1/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.27.1/src/transformers/models/mt5/modeling_mt5.py#L1397",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</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.27.1/en/model_doc/mt5#transformers.MT5Config"
>MT5Config</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 decoder 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 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 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>decoder_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 decoder at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>decoder_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 of the decoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) \u2014 Sequence of hidden-states at the output of the last layer of the encoder of the model.</p>
</li>
<li>
<p><strong>encoder_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 encoder at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>encoder_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 of the encoder, 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.27.1/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ke=new tm({props:{$$slots:{default:[_u]},$$scope:{ctx:x}}}),Je=new S({props:{anchor:"transformers.MT5Model.forward.example",$$slots:{default:[vu]},$$scope:{ctx:x}}}),fs=new z({props:{name:"parallelize",anchor:"transformers.MT5Model.parallelize",parameters:[{name:"device_map",val:" = None"}],parametersDescription:[{anchor:"transformers.MT5Model.parallelize.device_map",description:`<strong>device_map</strong> (<code>Dict[int, list]</code>, optional, defaults to None) &#x2014;
A dictionary that maps attention modules to devices. Note that the embedding module and LMHead are always
automatically mapped to the first device (for esoteric reasons). That means that the first device should
have fewer attention modules mapped to it than other devices. For reference, the mt5 models have the
following number of attention modules:</p>
<ul>
<li>mt5-small: 6</li>
<li>mt5-base: 12</li>
<li>mt5-large: 24</li>
<li>mt5-xl: 24</li>
<li>mt5-xxl: 24</li>
</ul>`,name:"device_map"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_mt5.py#L1335"}}),Xe=new S({props:{anchor:"transformers.MT5Model.parallelize.example",$$slots:{default:[Tu]},$$scope:{ctx:x}}}),gs=new I({}),_s=new z({props:{name:"class transformers.MT5ForConditionalGeneration",anchor:"transformers.MT5ForConditionalGeneration",parameters:[{name:"config",val:": MT5Config"}],parametersDescription:[{anchor:"transformers.MT5ForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/mt5#transformers.MT5Config">MT5Config</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.27.1/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.27.1/src/transformers/models/mt5/modeling_mt5.py#L1514"}}),Ze=new S({props:{anchor:"transformers.MT5ForConditionalGeneration.example",$$slots:{default:[bu]},$$scope:{ctx:x}}}),ys=new z({props:{name:"deparallelize",anchor:"transformers.MT5ForConditionalGeneration.deparallelize",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_mt5.py#L1592"}}),Qe=new S({props:{anchor:"transformers.MT5ForConditionalGeneration.deparallelize.example",$$slots:{default:[ku]},$$scope:{ctx:x}}}),Ms=new z({props:{name:"forward",anchor:"transformers.MT5ForConditionalGeneration.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_attention_mask",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"cross_attn_head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_outputs",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.MT5ForConditionalGeneration.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. MT5 is a model with relative position embeddings so you
should be able to pad the inputs on both the right and the left.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for detail.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
<p>To know more on how to prepare <code>input_ids</code> for pretraining take a look a <a href="./mt5#training">MT5 Training</a>.`,name:"input_ids"},{anchor:"transformers.MT5ForConditionalGeneration.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.MT5ForConditionalGeneration.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>MT5 uses the <code>pad_token_id</code> as the starting token for <code>decoder_input_ids</code> generation. If <code>past_key_values</code>
is used, optionally only the last <code>decoder_input_ids</code> have to be input (see <code>past_key_values</code>).</p>
<p>To know more on how to prepare <code>decoder_input_ids</code> for pretraining take a look at <a href="./mt5#training">MT5
Training</a>.`,name:"decoder_input_ids"},{anchor:"transformers.MT5ForConditionalGeneration.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.MT5ForConditionalGeneration.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 in the encoder. 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.MT5ForConditionalGeneration.forward.decoder_head_mask",description:`<strong>decoder_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 in the decoder. 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:"decoder_head_mask"},{anchor:"transformers.MT5ForConditionalGeneration.forward.cross_attn_head_mask",description:`<strong>cross_attn_head_mask</strong> (<code>torch.Tensor</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 cross-attention modules in the decoder. 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:"cross_attn_head_mask"},{anchor:"transformers.MT5ForConditionalGeneration.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <code>optional</code>: <em>hidden_states</em>, <code>optional</code>: <em>attentions</em>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code> is a sequence of hidden states at
the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.MT5ForConditionalGeneration.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.MT5ForConditionalGeneration.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.MT5ForConditionalGeneration.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. If <code>past_key_values</code> is used, optionally only the last <code>decoder_inputs_embeds</code> have to be
input (see <code>past_key_values</code>). This is useful if you want more control over how to convert
<code>decoder_input_ids</code> indices into associated vectors than the model&#x2019;s internal embedding lookup matrix.</p>
<p>If <code>decoder_input_ids</code> and <code>decoder_inputs_embeds</code> are both unset, <code>decoder_inputs_embeds</code> takes the value
of <code>inputs_embeds</code>.`,name:"decoder_inputs_embeds"},{anchor:"transformers.MT5ForConditionalGeneration.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.MT5ForConditionalGeneration.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.MT5ForConditionalGeneration.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.MT5ForConditionalGeneration.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.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.MT5ForConditionalGeneration.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>[-100, 0, ..., config.vocab_size - 1]</code>. All labels set to <code>-100</code> are ignored (masked), the loss is only computed for
labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_mt5.py#L1634",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.Seq2SeqLMOutput"
>transformers.modeling_outputs.Seq2SeqLMOutput</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.27.1/en/model_doc/mt5#transformers.MT5Config"
>MT5Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Language modeling loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>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 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 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>decoder_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 decoder at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>decoder_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 of the decoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) \u2014 Sequence of hidden-states at the output of the last layer of the encoder of the model.</p>
</li>
<li>
<p><strong>encoder_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 encoder at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>encoder_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 of the encoder, 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.27.1/en/main_classes/output#transformers.modeling_outputs.Seq2SeqLMOutput"
>transformers.modeling_outputs.Seq2SeqLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),et=new tm({props:{$$slots:{default:[$u]},$$scope:{ctx:x}}}),tt=new S({props:{anchor:"transformers.MT5ForConditionalGeneration.forward.example",$$slots:{default:[wu]},$$scope:{ctx:x}}}),xs=new z({props:{name:"parallelize",anchor:"transformers.MT5ForConditionalGeneration.parallelize",parameters:[{name:"device_map",val:" = None"}],parametersDescription:[{anchor:"transformers.MT5ForConditionalGeneration.parallelize.device_map",description:`<strong>device_map</strong> (<code>Dict[int, list]</code>, optional, defaults to None) &#x2014;
A dictionary that maps attention modules to devices. Note that the embedding module and LMHead are always
automatically mapped to the first device (for esoteric reasons). That means that the first device should
have fewer attention modules mapped to it than other devices. For reference, the mt5 models have the
following number of attention modules:</p>
<ul>
<li>mt5-small: 6</li>
<li>mt5-base: 12</li>
<li>mt5-large: 24</li>
<li>mt5-xl: 24</li>
<li>mt5-xxl: 24</li>
</ul>`,name:"device_map"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_mt5.py#L1571"}}),st=new S({props:{anchor:"transformers.MT5ForConditionalGeneration.parallelize.example",$$slots:{default:[yu]},$$scope:{ctx:x}}}),zs=new I({}),js=new z({props:{name:"class transformers.MT5EncoderModel",anchor:"transformers.MT5EncoderModel",parameters:[{name:"config",val:": MT5Config"}],parametersDescription:[{anchor:"transformers.MT5EncoderModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/mt5#transformers.MT5Config">MT5Config</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.27.1/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.27.1/src/transformers/models/mt5/modeling_mt5.py#L1850"}}),ot=new S({props:{anchor:"transformers.MT5EncoderModel.example",$$slots:{default:[Mu]},$$scope:{ctx:x}}}),Cs=new z({props:{name:"deparallelize",anchor:"transformers.MT5EncoderModel.deparallelize",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_mt5.py#L1911"}}),at=new S({props:{anchor:"transformers.MT5EncoderModel.deparallelize.example",$$slots:{default:[xu]},$$scope:{ctx:x}}}),Ss=new z({props:{name:"forward",anchor:"transformers.MT5EncoderModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.MT5EncoderModel.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. MT5 is a model with relative position embeddings so you
should be able to pad the inputs on both the right and the left.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for detail.</p>
<p>To know more on how to prepare <code>input_ids</code> for pretraining take a look a <a href="./mt5#training">MT5 Training</a>.`,name:"input_ids"},{anchor:"transformers.MT5EncoderModel.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.MT5EncoderModel.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.MT5EncoderModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.MT5EncoderModel.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.MT5EncoderModel.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.MT5EncoderModel.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.27.1/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.27.1/src/transformers/models/mt5/modeling_mt5.py#L1946",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</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.27.1/en/model_doc/mt5#transformers.MT5Config"
>MT5Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>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.27.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),rt=new tm({props:{$$slots:{default:[zu]},$$scope:{ctx:x}}}),lt=new S({props:{anchor:"transformers.MT5EncoderModel.forward.example",$$slots:{default:[ju]},$$scope:{ctx:x}}}),Ls=new z({props:{name:"parallelize",anchor:"transformers.MT5EncoderModel.parallelize",parameters:[{name:"device_map",val:" = None"}],parametersDescription:[{anchor:"transformers.MT5EncoderModel.parallelize.device_map",description:`<strong>device_map</strong> (<code>Dict[int, list]</code>, optional, defaults to None) &#x2014;
A dictionary that maps attention modules to devices. Note that the embedding module and LMHead are always
automatically mapped to the first device (for esoteric reasons). That means that the first device should
have fewer attention modules mapped to it than other devices. For reference, the mt5 models have the
following number of attention modules:</p>
<ul>
<li>mt5-small: 6</li>
<li>mt5-base: 12</li>
<li>mt5-large: 24</li>
<li>mt5-xl: 24</li>
<li>mt5-xxl: 24</li>
</ul>`,name:"device_map"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_mt5.py#L1892"}}),it=new S({props:{anchor:"transformers.MT5EncoderModel.parallelize.example",$$slots:{default:[Eu]},$$scope:{ctx:x}}}),Ns=new I({}),Os=new z({props:{name:"class transformers.TFMT5Model",anchor:"transformers.TFMT5Model",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_tf_mt5.py#L27"}}),ct=new S({props:{anchor:"transformers.TFMT5Model.example",$$slots:{default:[qu]},$$scope:{ctx:x}}}),Gs=new I({}),Ds=new z({props:{name:"class transformers.TFMT5ForConditionalGeneration",anchor:"transformers.TFMT5ForConditionalGeneration",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_tf_mt5.py#L51"}}),mt=new S({props:{anchor:"transformers.TFMT5ForConditionalGeneration.example",$$slots:{default:[Fu]},$$scope:{ctx:x}}}),Bs=new I({}),Ws=new z({props:{name:"class transformers.TFMT5EncoderModel",anchor:"transformers.TFMT5EncoderModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_tf_mt5.py#L75"}}),ut=new S({props:{anchor:"transformers.TFMT5EncoderModel.example",$$slots:{default:[Pu]},$$scope:{ctx:x}}}),Hs=new I({}),Rs=new z({props:{name:"class transformers.FlaxMT5Model",anchor:"transformers.FlaxMT5Model",parameters:[{name:"config",val:": T5Config"},{name:"input_shape",val:": typing.Tuple[int] = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"gradient_checkpointing",val:": bool = False"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_flax_mt5.py#L42"}}),gt=new S({props:{anchor:"transformers.FlaxMT5Model.example",$$slots:{default:[Au]},$$scope:{ctx:x}}}),Js=new I({}),Xs=new z({props:{name:"class transformers.FlaxMT5ForConditionalGeneration",anchor:"transformers.FlaxMT5ForConditionalGeneration",parameters:[{name:"config",val:": T5Config"},{name:"input_shape",val:": typing.Tuple[int] = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"gradient_checkpointing",val:": bool = False"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_flax_mt5.py#L94"}}),vt=new S({props:{anchor:"transformers.FlaxMT5ForConditionalGeneration.example",$$slots:{default:[Cu]},$$scope:{ctx:x}}}),Zs=new I({}),Qs=new z({props:{name:"class transformers.FlaxMT5EncoderModel",anchor:"transformers.FlaxMT5EncoderModel",parameters:[{name:"config",val:": T5Config"},{name:"input_shape",val:": typing.Tuple[int] = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"gradient_checkpointing",val:": bool = False"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/mt5/modeling_flax_mt5.py#L68"}}),bt=new S({props:{anchor:"transformers.FlaxMT5EncoderModel.example",$$slots:{default:[Su]},$$scope:{ctx:x}}}),{c(){c=o("meta"),T=p(),g=o("h1"),d=o("a"),v=o("span"),b(n.$$.fragment),u=p(),G=o("span"),al=l("mT5"),Aa=p(),pe=o("div"),rn=o("a"),ln=o("img"),rl=p(),dn=o("a"),cn=o("img"),Ca=p(),me=o("h2"),Fe=o("a"),ao=o("span"),b(jt.$$.fragment),ll=p(),ro=o("span"),il=l("Overview"),Sa=p(),Pe=o("p"),dl=l("The mT5 model was presented in "),Et=o("a"),cl=l("mT5: A massively multilingual pre-trained text-to-text transformer"),pl=l(` by Linting Xue, Noah Constant, Adam Roberts, Mihir Kale, Rami Al-Rfou, Aditya
Siddhant, Aditya Barua, Colin Raffel.`),La=p(),pn=o("p"),ml=l("The abstract from the paper is the following:"),Na=p(),mn=o("p"),lo=o("em"),hl=l(`The recent \u201CText-to-Text Transfer Transformer\u201D (T5) leveraged a unified text-to-text format and scale to attain
state-of-the-art results on a wide variety of English-language NLP tasks. In this paper, we introduce mT5, a
multilingual variant of T5 that was pre-trained on a new Common Crawl-based dataset covering 101 languages. We detail
the design and modified training of mT5 and demonstrate its state-of-the-art performance on many multilingual
benchmarks. We also describe a simple technique to prevent \u201Caccidental translation\u201D in the zero-shot setting, where a
generative model chooses to (partially) translate its prediction into the wrong language. All of the code and model
checkpoints used in this work are publicly available.`),Oa=p(),Ae=o("p"),ul=l("Note: mT5 was only pre-trained on "),qt=o("a"),fl=l("mC4"),gl=l(` excluding any supervised training.
Therefore, this model has to be fine-tuned before it is usable on a downstream task, unlike the original T5 model.
Since mT5 was pre-trained unsupervisedly, there\u2019s no real advantage to using a task prefix during single-task
fine-tuning. If you are doing multi-task fine-tuning, you should use a prefix.`),Ia=p(),hn=o("p"),_l=l("Google has released the following variants:"),Ga=p(),D=o("ul"),io=o("li"),co=o("p"),Ft=o("a"),vl=l("google/mt5-small"),Tl=p(),po=o("li"),mo=o("p"),Pt=o("a"),bl=l("google/mt5-base"),kl=p(),ho=o("li"),uo=o("p"),At=o("a"),$l=l("google/mt5-large"),wl=p(),fo=o("li"),go=o("p"),Ct=o("a"),yl=l("google/mt5-xl"),Ml=p(),_o=o("li"),un=o("p"),St=o("a"),xl=l("google/mt5-xxl"),zl=l("."),Da=p(),oe=o("p"),jl=l("This model was contributed by "),Lt=o("a"),El=l("patrickvonplaten"),ql=l(`. The original code can be
found `),Nt=o("a"),Fl=l("here"),Pl=l("."),Ua=p(),he=o("h2"),Ce=o("a"),vo=o("span"),b(Ot.$$.fragment),Al=p(),To=o("span"),Cl=l("Documentation resources"),Ba=p(),Se=o("ul"),bo=o("li"),fn=o("a"),Sl=l("Translation task guide"),Ll=p(),ko=o("li"),gn=o("a"),Nl=l("Summarization task guide"),Wa=p(),ue=o("h2"),Le=o("a"),$o=o("span"),b(It.$$.fragment),Ol=p(),wo=o("span"),Il=l("MT5Config"),Va=p(),X=o("div"),b(Gt.$$.fragment),Gl=p(),Y=o("p"),Dl=l("This is the configuration class to store the configuration of a "),_n=o("a"),Ul=l("MT5Model"),Bl=l(" or a "),vn=o("a"),Wl=l("TFMT5Model"),Vl=l(`. It is used to
instantiate a mT5 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 mT5
`),Dt=o("a"),Hl=l("google/mt5-small"),Rl=l(" architecture."),Kl=p(),fe=o("p"),Jl=l("Configuration objects inherit from "),Tn=o("a"),Xl=l("PretrainedConfig"),Yl=l(` and can be used to control the model outputs. Read the
documentation from `),bn=o("a"),Zl=l("PretrainedConfig"),Ql=l(" for more information."),Ha=p(),ge=o("h2"),Ne=o("a"),yo=o("span"),b(Ut.$$.fragment),ei=p(),Mo=o("span"),ti=l("MT5Tokenizer"),Ra=p(),F=o("div"),b(Bt.$$.fragment),si=p(),Wt=o("p"),ni=l("Construct a T5 tokenizer. Based on "),Vt=o("a"),oi=l("SentencePiece"),ai=l("."),ri=p(),Ht=o("p"),li=l("This tokenizer inherits from "),kn=o("a"),ii=l("PreTrainedTokenizer"),di=l(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),ci=p(),ae=o("div"),b(Rt.$$.fragment),pi=p(),xo=o("p"),mi=l(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A sequence has the following format:`),hi=p(),Kt=o("ul"),$n=o("li"),ui=l("single sequence: "),zo=o("code"),fi=l("X </s>"),gi=p(),wn=o("li"),_i=l("pair of sequences: "),jo=o("code"),vi=l("A </s> B </s>"),Ti=p(),Oe=o("div"),b(Jt.$$.fragment),bi=p(),Eo=o("p"),ki=l("Converts a sequence of tokens (string) in a single string."),$i=p(),Ie=o("div"),b(Xt.$$.fragment),wi=p(),qo=o("p"),yi=l(`Create a mask from the two sequences passed to be used in a sequence-pair classification task. T5 does not make
use of token type ids, therefore a list of zeros is returned.`),Mi=p(),Ge=o("div"),b(Yt.$$.fragment),xi=p(),Zt=o("p"),zi=l(`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),Fo=o("code"),ji=l("prepare_for_model"),Ei=l(" method."),Ka=p(),De=o("p"),qi=l("See "),yn=o("a"),Fi=l("T5Tokenizer"),Pi=l(" for all details."),Ja=p(),_e=o("h2"),Ue=o("a"),Po=o("span"),b(Qt.$$.fragment),Ai=p(),Ao=o("span"),Ci=l("MT5TokenizerFast"),Xa=p(),O=o("div"),b(es.$$.fragment),Si=p(),ve=o("p"),Li=l("Construct a \u201Cfast\u201D T5 tokenizer (backed by HuggingFace\u2019s "),Co=o("em"),Ni=l("tokenizers"),Oi=l(` library). Based on
`),ts=o("a"),Ii=l("Unigram"),Gi=l("."),Di=p(),ss=o("p"),Ui=l("This tokenizer inherits from "),Mn=o("a"),Bi=l("PreTrainedTokenizerFast"),Wi=l(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Vi=p(),re=o("div"),b(ns.$$.fragment),Hi=p(),So=o("p"),Ri=l(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A sequence has the following format:`),Ki=p(),os=o("ul"),xn=o("li"),Ji=l("single sequence: "),Lo=o("code"),Xi=l("X </s>"),Yi=p(),zn=o("li"),Zi=l("pair of sequences: "),No=o("code"),Qi=l("A </s> B </s>"),ed=p(),Be=o("div"),b(as.$$.fragment),td=p(),Oo=o("p"),sd=l(`Create a mask from the two sequences passed to be used in a sequence-pair classification task. T5 does not make
use of token type ids, therefore a list of zeros is returned.`),Ya=p(),We=o("p"),nd=l("See "),jn=o("a"),od=l("T5TokenizerFast"),ad=l(" for all details."),Za=p(),Te=o("h2"),Ve=o("a"),Io=o("span"),b(rs.$$.fragment),rd=p(),Go=o("span"),ld=l("MT5Model"),Qa=p(),j=o("div"),b(ls.$$.fragment),id=p(),Do=o("p"),dd=l("The bare MT5 Model transformer outputting raw hidden-states without any specific head on top."),cd=p(),is=o("p"),pd=l("The MT5 model was proposed in "),ds=o("a"),md=l(`Exploring the Limits of Transfer Learning with a Unified Text-to-Text
Transformer`),hd=l(` by Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan
Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J. Liu. It\u2019s an encoder decoder transformer pre-trained in a
text-to-text denoising generative setting.`),ud=p(),cs=o("p"),fd=l("This model inherits from "),En=o("a"),gd=l("PreTrainedModel"),_d=l(`. 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.)`),vd=p(),ps=o("p"),Td=l("This model is also a PyTorch "),ms=o("a"),bd=l("torch.nn.Module"),kd=l(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),$d=p(),b(He.$$.fragment),wd=p(),le=o("div"),b(hs.$$.fragment),yd=p(),Uo=o("p"),Md=l("Moves the model to cpu from a model parallel state."),xd=p(),b(Re.$$.fragment),zd=p(),W=o("div"),b(us.$$.fragment),jd=p(),be=o("p"),Ed=l("The "),qn=o("a"),qd=l("MT5Model"),Fd=l(" forward method, overrides the "),Bo=o("code"),Pd=l("__call__"),Ad=l(" special method."),Cd=p(),b(Ke.$$.fragment),Sd=p(),b(Je.$$.fragment),Ld=p(),V=o("div"),b(fs.$$.fragment),Nd=p(),Wo=o("p"),Od=l("This is an experimental feature and is a subject to change at a moment\u2019s notice."),Id=p(),Vo=o("p"),Gd=l(`Uses a device map to distribute attention modules of the model across several devices. If no device map is given,
it will evenly distribute blocks across all devices.`),Dd=p(),b(Xe.$$.fragment),er=p(),ke=o("h2"),Ye=o("a"),Ho=o("span"),b(gs.$$.fragment),Ud=p(),Ro=o("span"),Bd=l("MT5ForConditionalGeneration"),tr=p(),E=o("div"),b(_s.$$.fragment),Wd=p(),vs=o("p"),Vd=l("MT5 Model with a "),Ko=o("code"),Hd=l("language modeling"),Rd=l(" head on top."),Kd=p(),Ts=o("p"),Jd=l("The MT5 model was proposed in "),bs=o("a"),Xd=l(`Exploring the Limits of Transfer Learning with a Unified Text-to-Text
Transformer`),Yd=l(` by Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan
Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J. Liu. It\u2019s an encoder decoder transformer pre-trained in a
text-to-text denoising generative setting.`),Zd=p(),ks=o("p"),Qd=l("This model inherits from "),Fn=o("a"),ec=l("PreTrainedModel"),tc=l(`. 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.)`),sc=p(),$s=o("p"),nc=l("This model is also a PyTorch "),ws=o("a"),oc=l("torch.nn.Module"),ac=l(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),rc=p(),b(Ze.$$.fragment),lc=p(),ie=o("div"),b(ys.$$.fragment),ic=p(),Jo=o("p"),dc=l("Moves the model to cpu from a model parallel state."),cc=p(),b(Qe.$$.fragment),pc=p(),H=o("div"),b(Ms.$$.fragment),mc=p(),$e=o("p"),hc=l("The "),Pn=o("a"),uc=l("MT5ForConditionalGeneration"),fc=l(" forward method, overrides the "),Xo=o("code"),gc=l("__call__"),_c=l(" special method."),vc=p(),b(et.$$.fragment),Tc=p(),b(tt.$$.fragment),bc=p(),R=o("div"),b(xs.$$.fragment),kc=p(),Yo=o("p"),$c=l("This is an experimental feature and is a subject to change at a moment\u2019s notice."),wc=p(),Zo=o("p"),yc=l(`Uses a device map to distribute attention modules of the model across several devices. If no device map is given,
it will evenly distribute blocks across all devices.`),Mc=p(),b(st.$$.fragment),sr=p(),we=o("h2"),nt=o("a"),Qo=o("span"),b(zs.$$.fragment),xc=p(),ea=o("span"),zc=l("MT5EncoderModel"),nr=p(),q=o("div"),b(js.$$.fragment),jc=p(),ta=o("p"),Ec=l("The bare MT5 Model transformer outputting encoder\u2019s raw hidden-states without any specific head on top."),qc=p(),Es=o("p"),Fc=l("The MT5 model was proposed in "),qs=o("a"),Pc=l(`Exploring the Limits of Transfer Learning with a Unified Text-to-Text
Transformer`),Ac=l(` by Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan
Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J. Liu. It\u2019s an encoder decoder transformer pre-trained in a
text-to-text denoising generative setting.`),Cc=p(),Fs=o("p"),Sc=l("This model inherits from "),An=o("a"),Lc=l("PreTrainedModel"),Nc=l(`. 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.)`),Oc=p(),Ps=o("p"),Ic=l("This model is also a PyTorch "),As=o("a"),Gc=l("torch.nn.Module"),Dc=l(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Uc=p(),b(ot.$$.fragment),Bc=p(),de=o("div"),b(Cs.$$.fragment),Wc=p(),sa=o("p"),Vc=l("Moves the model to cpu from a model parallel state."),Hc=p(),b(at.$$.fragment),Rc=p(),K=o("div"),b(Ss.$$.fragment),Kc=p(),ye=o("p"),Jc=l("The "),Cn=o("a"),Xc=l("MT5EncoderModel"),Yc=l(" forward method, overrides the "),na=o("code"),Zc=l("__call__"),Qc=l(" special method."),ep=p(),b(rt.$$.fragment),tp=p(),b(lt.$$.fragment),sp=p(),J=o("div"),b(Ls.$$.fragment),np=p(),oa=o("p"),op=l("This is an experimental feature and is a subject to change at a moment\u2019s notice."),ap=p(),aa=o("p"),rp=l(`Uses a device map to distribute attention modules of the model across several devices. If no device map is given,
it will evenly distribute blocks across all devices.`),lp=p(),b(it.$$.fragment),or=p(),Me=o("h2"),dt=o("a"),ra=o("span"),b(Ns.$$.fragment),ip=p(),la=o("span"),dp=l("TFMT5Model"),ar=p(),Z=o("div"),b(Os.$$.fragment),cp=p(),Is=o("p"),pp=l("This class overrides "),Sn=o("a"),mp=l("TFT5Model"),hp=l(`. Please check the superclass for the appropriate documentation alongside usage
examples.`),up=p(),b(ct.$$.fragment),rr=p(),xe=o("h2"),pt=o("a"),ia=o("span"),b(Gs.$$.fragment),fp=p(),da=o("span"),gp=l("TFMT5ForConditionalGeneration"),lr=p(),Q=o("div"),b(Ds.$$.fragment),_p=p(),Us=o("p"),vp=l("This class overrides "),Ln=o("a"),Tp=l("TFT5ForConditionalGeneration"),bp=l(`. Please check the superclass for the appropriate
documentation alongside usage examples.`),kp=p(),b(mt.$$.fragment),ir=p(),ze=o("h2"),ht=o("a"),ca=o("span"),b(Bs.$$.fragment),$p=p(),pa=o("span"),wp=l("TFMT5EncoderModel"),dr=p(),ee=o("div"),b(Ws.$$.fragment),yp=p(),Vs=o("p"),Mp=l("This class overrides "),Nn=o("a"),xp=l("TFT5EncoderModel"),zp=l(`. Please check the superclass for the appropriate documentation alongside
usage examples.`),jp=p(),b(ut.$$.fragment),cr=p(),je=o("h2"),ft=o("a"),ma=o("span"),b(Hs.$$.fragment),Ep=p(),ha=o("span"),qp=l("FlaxMT5Model"),pr=p(),te=o("div"),b(Rs.$$.fragment),Fp=p(),Ks=o("p"),Pp=l("This class overrides "),On=o("a"),Ap=l("FlaxT5Model"),Cp=l(`. Please check the superclass for the appropriate documentation alongside usage
examples.`),Sp=p(),b(gt.$$.fragment),mr=p(),Ee=o("h2"),_t=o("a"),ua=o("span"),b(Js.$$.fragment),Lp=p(),fa=o("span"),Np=l("FlaxMT5ForConditionalGeneration"),hr=p(),se=o("div"),b(Xs.$$.fragment),Op=p(),Ys=o("p"),Ip=l("This class overrides "),In=o("a"),Gp=l("FlaxT5ForConditionalGeneration"),Dp=l(`. Please check the superclass for the appropriate
documentation alongside usage examples.`),Up=p(),b(vt.$$.fragment),ur=p(),qe=o("h2"),Tt=o("a"),ga=o("span"),b(Zs.$$.fragment),Bp=p(),_a=o("span"),Wp=l("FlaxMT5EncoderModel"),fr=p(),ne=o("div"),b(Qs.$$.fragment),Vp=p(),en=o("p"),Hp=l("This class overrides "),Gn=o("a"),Rp=l("FlaxT5EncoderModel"),Kp=l(`. Please check the superclass for the appropriate documentation
alongside usage examples.`),Jp=p(),b(bt.$$.fragment),this.h()},l(t){const f=hu('[data-svelte="svelte-1phssyn"]',document.head);c=a(f,"META",{name:!0,content:!0}),f.forEach(s),T=m(t),g=a(t,"H1",{class:!0});var tn=r(g);d=a(tn,"A",{id:!0,class:!0,href:!0});var va=r(d);v=a(va,"SPAN",{});var Ta=r(v);k(n.$$.fragment,Ta),Ta.forEach(s),va.forEach(s),u=m(tn),G=a(tn,"SPAN",{});var ba=r(G);al=i(ba,"mT5"),ba.forEach(s),tn.forEach(s),Aa=m(t),pe=a(t,"DIV",{class:!0});var sn=r(pe);rn=a(sn,"A",{href:!0});var ka=r(rn);ln=a(ka,"IMG",{alt:!0,src:!0}),ka.forEach(s),rl=m(sn),dn=a(sn,"A",{href:!0});var $a=r(dn);cn=a($a,"IMG",{alt:!0,src:!0}),$a.forEach(s),sn.forEach(s),Ca=m(t),me=a(t,"H2",{class:!0});var nn=r(me);Fe=a(nn,"A",{id:!0,class:!0,href:!0});var wa=r(Fe);ao=a(wa,"SPAN",{});var ya=r(ao);k(jt.$$.fragment,ya),ya.forEach(s),wa.forEach(s),ll=m(nn),ro=a(nn,"SPAN",{});var Ma=r(ro);il=i(Ma,"Overview"),Ma.forEach(s),nn.forEach(s),Sa=m(t),Pe=a(t,"P",{});var on=r(Pe);dl=i(on,"The mT5 model was presented in "),Et=a(on,"A",{href:!0,rel:!0});var xa=r(Et);cl=i(xa,"mT5: A massively multilingual pre-trained text-to-text transformer"),xa.forEach(s),pl=i(on,` by Linting Xue, Noah Constant, Adam Roberts, Mihir Kale, Rami Al-Rfou, Aditya
Siddhant, Aditya Barua, Colin Raffel.`),on.forEach(s),La=m(t),pn=a(t,"P",{});var za=r(pn);ml=i(za,"The abstract from the paper is the following:"),za.forEach(s),Na=m(t),mn=a(t,"P",{});var ja=r(mn);lo=a(ja,"EM",{});var Ea=r(lo);hl=i(Ea,`The recent \u201CText-to-Text Transfer Transformer\u201D (T5) leveraged a unified text-to-text format and scale to attain
state-of-the-art results on a wide variety of English-language NLP tasks. In this paper, we introduce mT5, a
multilingual variant of T5 that was pre-trained on a new Common Crawl-based dataset covering 101 languages. We detail
the design and modified training of mT5 and demonstrate its state-of-the-art performance on many multilingual
benchmarks. We also describe a simple technique to prevent \u201Caccidental translation\u201D in the zero-shot setting, where a
generative model chooses to (partially) translate its prediction into the wrong language. All of the code and model
checkpoints used in this work are publicly available.`),Ea.forEach(s),ja.forEach(s),Oa=m(t),Ae=a(t,"P",{});var an=r(Ae);ul=i(an,"Note: mT5 was only pre-trained on "),qt=a(an,"A",{href:!0,rel:!0});var qa=r(qt);fl=i(qa,"mC4"),qa.forEach(s),gl=i(an,` excluding any supervised training.
Therefore, this model has to be fine-tuned before it is usable on a downstream task, unlike the original T5 model.
Since mT5 was pre-trained unsupervisedly, there\u2019s no real advantage to using a task prefix during single-task
fine-tuning. If you are doing multi-task fine-tuning, you should use a prefix.`),an.forEach(s),Ia=m(t),hn=a(t,"P",{});var Fa=r(hn);_l=i(Fa,"Google has released the following variants:"),Fa.forEach(s),Ga=m(t),D=a(t,"UL",{});var B=r(D);io=a(B,"LI",{});var Pa=r(io);co=a(Pa,"P",{});var om=r(co);Ft=a(om,"A",{href:!0,rel:!0});var am=r(Ft);vl=i(am,"google/mt5-small"),am.forEach(s),om.forEach(s),Pa.forEach(s),Tl=m(B),po=a(B,"LI",{});var rm=r(po);mo=a(rm,"P",{});var lm=r(mo);Pt=a(lm,"A",{href:!0,rel:!0});var im=r(Pt);bl=i(im,"google/mt5-base"),im.forEach(s),lm.forEach(s),rm.forEach(s),kl=m(B),ho=a(B,"LI",{});var dm=r(ho);uo=a(dm,"P",{});var cm=r(uo);At=a(cm,"A",{href:!0,rel:!0});var pm=r(At);$l=i(pm,"google/mt5-large"),pm.forEach(s),cm.forEach(s),dm.forEach(s),wl=m(B),fo=a(B,"LI",{});var mm=r(fo);go=a(mm,"P",{});var hm=r(go);Ct=a(hm,"A",{href:!0,rel:!0});var um=r(Ct);yl=i(um,"google/mt5-xl"),um.forEach(s),hm.forEach(s),mm.forEach(s),Ml=m(B),_o=a(B,"LI",{});var fm=r(_o);un=a(fm,"P",{});var Xp=r(un);St=a(Xp,"A",{href:!0,rel:!0});var gm=r(St);xl=i(gm,"google/mt5-xxl"),gm.forEach(s),zl=i(Xp,"."),Xp.forEach(s),fm.forEach(s),B.forEach(s),Da=m(t),oe=a(t,"P",{});var Dn=r(oe);jl=i(Dn,"This model was contributed by "),Lt=a(Dn,"A",{href:!0,rel:!0});var _m=r(Lt);El=i(_m,"patrickvonplaten"),_m.forEach(s),ql=i(Dn,`. The original code can be
found `),Nt=a(Dn,"A",{href:!0,rel:!0});var vm=r(Nt);Fl=i(vm,"here"),vm.forEach(s),Pl=i(Dn,"."),Dn.forEach(s),Ua=m(t),he=a(t,"H2",{class:!0});var _r=r(he);Ce=a(_r,"A",{id:!0,class:!0,href:!0});var Tm=r(Ce);vo=a(Tm,"SPAN",{});var bm=r(vo);k(Ot.$$.fragment,bm),bm.forEach(s),Tm.forEach(s),Al=m(_r),To=a(_r,"SPAN",{});var km=r(To);Cl=i(km,"Documentation resources"),km.forEach(s),_r.forEach(s),Ba=m(t),Se=a(t,"UL",{});var vr=r(Se);bo=a(vr,"LI",{});var $m=r(bo);fn=a($m,"A",{href:!0});var wm=r(fn);Sl=i(wm,"Translation task guide"),wm.forEach(s),$m.forEach(s),Ll=m(vr),ko=a(vr,"LI",{});var ym=r(ko);gn=a(ym,"A",{href:!0});var Mm=r(gn);Nl=i(Mm,"Summarization task guide"),Mm.forEach(s),ym.forEach(s),vr.forEach(s),Wa=m(t),ue=a(t,"H2",{class:!0});var Tr=r(ue);Le=a(Tr,"A",{id:!0,class:!0,href:!0});var xm=r(Le);$o=a(xm,"SPAN",{});var zm=r($o);k(It.$$.fragment,zm),zm.forEach(s),xm.forEach(s),Ol=m(Tr),wo=a(Tr,"SPAN",{});var jm=r(wo);Il=i(jm,"MT5Config"),jm.forEach(s),Tr.forEach(s),Va=m(t),X=a(t,"DIV",{class:!0});var Un=r(X);k(Gt.$$.fragment,Un),Gl=m(Un),Y=a(Un,"P",{});var kt=r(Y);Dl=i(kt,"This is the configuration class to store the configuration of a "),_n=a(kt,"A",{href:!0});var Em=r(_n);Ul=i(Em,"MT5Model"),Em.forEach(s),Bl=i(kt," or a "),vn=a(kt,"A",{href:!0});var qm=r(vn);Wl=i(qm,"TFMT5Model"),qm.forEach(s),Vl=i(kt,`. It is used to
instantiate a mT5 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 mT5
`),Dt=a(kt,"A",{href:!0,rel:!0});var Fm=r(Dt);Hl=i(Fm,"google/mt5-small"),Fm.forEach(s),Rl=i(kt," architecture."),kt.forEach(s),Kl=m(Un),fe=a(Un,"P",{});var Bn=r(fe);Jl=i(Bn,"Configuration objects inherit from "),Tn=a(Bn,"A",{href:!0});var Pm=r(Tn);Xl=i(Pm,"PretrainedConfig"),Pm.forEach(s),Yl=i(Bn,` and can be used to control the model outputs. Read the
documentation from `),bn=a(Bn,"A",{href:!0});var Am=r(bn);Zl=i(Am,"PretrainedConfig"),Am.forEach(s),Ql=i(Bn," for more information."),Bn.forEach(s),Un.forEach(s),Ha=m(t),ge=a(t,"H2",{class:!0});var br=r(ge);Ne=a(br,"A",{id:!0,class:!0,href:!0});var Cm=r(Ne);yo=a(Cm,"SPAN",{});var Sm=r(yo);k(Ut.$$.fragment,Sm),Sm.forEach(s),Cm.forEach(s),ei=m(br),Mo=a(br,"SPAN",{});var Lm=r(Mo);ti=i(Lm,"MT5Tokenizer"),Lm.forEach(s),br.forEach(s),Ra=m(t),F=a(t,"DIV",{class:!0});var U=r(F);k(Bt.$$.fragment,U),si=m(U),Wt=a(U,"P",{});var kr=r(Wt);ni=i(kr,"Construct a T5 tokenizer. Based on "),Vt=a(kr,"A",{href:!0,rel:!0});var Nm=r(Vt);oi=i(Nm,"SentencePiece"),Nm.forEach(s),ai=i(kr,"."),kr.forEach(s),ri=m(U),Ht=a(U,"P",{});var $r=r(Ht);li=i($r,"This tokenizer inherits from "),kn=a($r,"A",{href:!0});var Om=r(kn);ii=i(Om,"PreTrainedTokenizer"),Om.forEach(s),di=i($r,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),$r.forEach(s),ci=m(U),ae=a(U,"DIV",{class:!0});var Wn=r(ae);k(Rt.$$.fragment,Wn),pi=m(Wn),xo=a(Wn,"P",{});var Im=r(xo);mi=i(Im,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A sequence has the following format:`),Im.forEach(s),hi=m(Wn),Kt=a(Wn,"UL",{});var wr=r(Kt);$n=a(wr,"LI",{});var Yp=r($n);ui=i(Yp,"single sequence: "),zo=a(Yp,"CODE",{});var Gm=r(zo);fi=i(Gm,"X </s>"),Gm.forEach(s),Yp.forEach(s),gi=m(wr),wn=a(wr,"LI",{});var Zp=r(wn);_i=i(Zp,"pair of sequences: "),jo=a(Zp,"CODE",{});var Dm=r(jo);vi=i(Dm,"A </s> B </s>"),Dm.forEach(s),Zp.forEach(s),wr.forEach(s),Wn.forEach(s),Ti=m(U),Oe=a(U,"DIV",{class:!0});var yr=r(Oe);k(Jt.$$.fragment,yr),bi=m(yr),Eo=a(yr,"P",{});var Um=r(Eo);ki=i(Um,"Converts a sequence of tokens (string) in a single string."),Um.forEach(s),yr.forEach(s),$i=m(U),Ie=a(U,"DIV",{class:!0});var Mr=r(Ie);k(Xt.$$.fragment,Mr),wi=m(Mr),qo=a(Mr,"P",{});var Bm=r(qo);yi=i(Bm,`Create a mask from the two sequences passed to be used in a sequence-pair classification task. T5 does not make
use of token type ids, therefore a list of zeros is returned.`),Bm.forEach(s),Mr.forEach(s),Mi=m(U),Ge=a(U,"DIV",{class:!0});var xr=r(Ge);k(Yt.$$.fragment,xr),xi=m(xr),Zt=a(xr,"P",{});var zr=r(Zt);zi=i(zr,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),Fo=a(zr,"CODE",{});var Wm=r(Fo);ji=i(Wm,"prepare_for_model"),Wm.forEach(s),Ei=i(zr," method."),zr.forEach(s),xr.forEach(s),U.forEach(s),Ka=m(t),De=a(t,"P",{});var jr=r(De);qi=i(jr,"See "),yn=a(jr,"A",{href:!0});var Vm=r(yn);Fi=i(Vm,"T5Tokenizer"),Vm.forEach(s),Pi=i(jr," for all details."),jr.forEach(s),Ja=m(t),_e=a(t,"H2",{class:!0});var Er=r(_e);Ue=a(Er,"A",{id:!0,class:!0,href:!0});var Hm=r(Ue);Po=a(Hm,"SPAN",{});var Rm=r(Po);k(Qt.$$.fragment,Rm),Rm.forEach(s),Hm.forEach(s),Ai=m(Er),Ao=a(Er,"SPAN",{});var Km=r(Ao);Ci=i(Km,"MT5TokenizerFast"),Km.forEach(s),Er.forEach(s),Xa=m(t),O=a(t,"DIV",{class:!0});var ce=r(O);k(es.$$.fragment,ce),Si=m(ce),ve=a(ce,"P",{});var Vn=r(ve);Li=i(Vn,"Construct a \u201Cfast\u201D T5 tokenizer (backed by HuggingFace\u2019s "),Co=a(Vn,"EM",{});var Jm=r(Co);Ni=i(Jm,"tokenizers"),Jm.forEach(s),Oi=i(Vn,` library). Based on
`),ts=a(Vn,"A",{href:!0,rel:!0});var Xm=r(ts);Ii=i(Xm,"Unigram"),Xm.forEach(s),Gi=i(Vn,"."),Vn.forEach(s),Di=m(ce),ss=a(ce,"P",{});var qr=r(ss);Ui=i(qr,"This tokenizer inherits from "),Mn=a(qr,"A",{href:!0});var Ym=r(Mn);Bi=i(Ym,"PreTrainedTokenizerFast"),Ym.forEach(s),Wi=i(qr,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),qr.forEach(s),Vi=m(ce),re=a(ce,"DIV",{class:!0});var Hn=r(re);k(ns.$$.fragment,Hn),Hi=m(Hn),So=a(Hn,"P",{});var Zm=r(So);Ri=i(Zm,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A sequence has the following format:`),Zm.forEach(s),Ki=m(Hn),os=a(Hn,"UL",{});var Fr=r(os);xn=a(Fr,"LI",{});var Qp=r(xn);Ji=i(Qp,"single sequence: "),Lo=a(Qp,"CODE",{});var Qm=r(Lo);Xi=i(Qm,"X </s>"),Qm.forEach(s),Qp.forEach(s),Yi=m(Fr),zn=a(Fr,"LI",{});var em=r(zn);Zi=i(em,"pair of sequences: "),No=a(em,"CODE",{});var eh=r(No);Qi=i(eh,"A </s> B </s>"),eh.forEach(s),em.forEach(s),Fr.forEach(s),Hn.forEach(s),ed=m(ce),Be=a(ce,"DIV",{class:!0});var Pr=r(Be);k(as.$$.fragment,Pr),td=m(Pr),Oo=a(Pr,"P",{});var th=r(Oo);sd=i(th,`Create a mask from the two sequences passed to be used in a sequence-pair classification task. T5 does not make
use of token type ids, therefore a list of zeros is returned.`),th.forEach(s),Pr.forEach(s),ce.forEach(s),Ya=m(t),We=a(t,"P",{});var Ar=r(We);nd=i(Ar,"See "),jn=a(Ar,"A",{href:!0});var sh=r(jn);od=i(sh,"T5TokenizerFast"),sh.forEach(s),ad=i(Ar," for all details."),Ar.forEach(s),Za=m(t),Te=a(t,"H2",{class:!0});var Cr=r(Te);Ve=a(Cr,"A",{id:!0,class:!0,href:!0});var nh=r(Ve);Io=a(nh,"SPAN",{});var oh=r(Io);k(rs.$$.fragment,oh),oh.forEach(s),nh.forEach(s),rd=m(Cr),Go=a(Cr,"SPAN",{});var ah=r(Go);ld=i(ah,"MT5Model"),ah.forEach(s),Cr.forEach(s),Qa=m(t),j=a(t,"DIV",{class:!0});var P=r(j);k(ls.$$.fragment,P),id=m(P),Do=a(P,"P",{});var rh=r(Do);dd=i(rh,"The bare MT5 Model transformer outputting raw hidden-states without any specific head on top."),rh.forEach(s),cd=m(P),is=a(P,"P",{});var Sr=r(is);pd=i(Sr,"The MT5 model was proposed in "),ds=a(Sr,"A",{href:!0,rel:!0});var lh=r(ds);md=i(lh,`Exploring the Limits of Transfer Learning with a Unified Text-to-Text
Transformer`),lh.forEach(s),hd=i(Sr,` by Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan
Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J. Liu. It\u2019s an encoder decoder transformer pre-trained in a
text-to-text denoising generative setting.`),Sr.forEach(s),ud=m(P),cs=a(P,"P",{});var Lr=r(cs);fd=i(Lr,"This model inherits from "),En=a(Lr,"A",{href:!0});var ih=r(En);gd=i(ih,"PreTrainedModel"),ih.forEach(s),_d=i(Lr,`. 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.)`),Lr.forEach(s),vd=m(P),ps=a(P,"P",{});var Nr=r(ps);Td=i(Nr,"This model is also a PyTorch "),ms=a(Nr,"A",{href:!0,rel:!0});var dh=r(ms);bd=i(dh,"torch.nn.Module"),dh.forEach(s),kd=i(Nr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Nr.forEach(s),$d=m(P),k(He.$$.fragment,P),wd=m(P),le=a(P,"DIV",{class:!0});var Rn=r(le);k(hs.$$.fragment,Rn),yd=m(Rn),Uo=a(Rn,"P",{});var ch=r(Uo);Md=i(ch,"Moves the model to cpu from a model parallel state."),ch.forEach(s),xd=m(Rn),k(Re.$$.fragment,Rn),Rn.forEach(s),zd=m(P),W=a(P,"DIV",{class:!0});var $t=r(W);k(us.$$.fragment,$t),jd=m($t),be=a($t,"P",{});var Kn=r(be);Ed=i(Kn,"The "),qn=a(Kn,"A",{href:!0});var ph=r(qn);qd=i(ph,"MT5Model"),ph.forEach(s),Fd=i(Kn," forward method, overrides the "),Bo=a(Kn,"CODE",{});var mh=r(Bo);Pd=i(mh,"__call__"),mh.forEach(s),Ad=i(Kn," special method."),Kn.forEach(s),Cd=m($t),k(Ke.$$.fragment,$t),Sd=m($t),k(Je.$$.fragment,$t),$t.forEach(s),Ld=m(P),V=a(P,"DIV",{class:!0});var wt=r(V);k(fs.$$.fragment,wt),Nd=m(wt),Wo=a(wt,"P",{});var hh=r(Wo);Od=i(hh,"This is an experimental feature and is a subject to change at a moment\u2019s notice."),hh.forEach(s),Id=m(wt),Vo=a(wt,"P",{});var uh=r(Vo);Gd=i(uh,`Uses a device map to distribute attention modules of the model across several devices. If no device map is given,
it will evenly distribute blocks across all devices.`),uh.forEach(s),Dd=m(wt),k(Xe.$$.fragment,wt),wt.forEach(s),P.forEach(s),er=m(t),ke=a(t,"H2",{class:!0});var Or=r(ke);Ye=a(Or,"A",{id:!0,class:!0,href:!0});var fh=r(Ye);Ho=a(fh,"SPAN",{});var gh=r(Ho);k(gs.$$.fragment,gh),gh.forEach(s),fh.forEach(s),Ud=m(Or),Ro=a(Or,"SPAN",{});var _h=r(Ro);Bd=i(_h,"MT5ForConditionalGeneration"),_h.forEach(s),Or.forEach(s),tr=m(t),E=a(t,"DIV",{class:!0});var A=r(E);k(_s.$$.fragment,A),Wd=m(A),vs=a(A,"P",{});var Ir=r(vs);Vd=i(Ir,"MT5 Model with a "),Ko=a(Ir,"CODE",{});var vh=r(Ko);Hd=i(vh,"language modeling"),vh.forEach(s),Rd=i(Ir," head on top."),Ir.forEach(s),Kd=m(A),Ts=a(A,"P",{});var Gr=r(Ts);Jd=i(Gr,"The MT5 model was proposed in "),bs=a(Gr,"A",{href:!0,rel:!0});var Th=r(bs);Xd=i(Th,`Exploring the Limits of Transfer Learning with a Unified Text-to-Text
Transformer`),Th.forEach(s),Yd=i(Gr,` by Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan
Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J. Liu. It\u2019s an encoder decoder transformer pre-trained in a
text-to-text denoising generative setting.`),Gr.forEach(s),Zd=m(A),ks=a(A,"P",{});var Dr=r(ks);Qd=i(Dr,"This model inherits from "),Fn=a(Dr,"A",{href:!0});var bh=r(Fn);ec=i(bh,"PreTrainedModel"),bh.forEach(s),tc=i(Dr,`. 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.)`),Dr.forEach(s),sc=m(A),$s=a(A,"P",{});var Ur=r($s);nc=i(Ur,"This model is also a PyTorch "),ws=a(Ur,"A",{href:!0,rel:!0});var kh=r(ws);oc=i(kh,"torch.nn.Module"),kh.forEach(s),ac=i(Ur,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ur.forEach(s),rc=m(A),k(Ze.$$.fragment,A),lc=m(A),ie=a(A,"DIV",{class:!0});var Jn=r(ie);k(ys.$$.fragment,Jn),ic=m(Jn),Jo=a(Jn,"P",{});var $h=r(Jo);dc=i($h,"Moves the model to cpu from a model parallel state."),$h.forEach(s),cc=m(Jn),k(Qe.$$.fragment,Jn),Jn.forEach(s),pc=m(A),H=a(A,"DIV",{class:!0});var yt=r(H);k(Ms.$$.fragment,yt),mc=m(yt),$e=a(yt,"P",{});var Xn=r($e);hc=i(Xn,"The "),Pn=a(Xn,"A",{href:!0});var wh=r(Pn);uc=i(wh,"MT5ForConditionalGeneration"),wh.forEach(s),fc=i(Xn," forward method, overrides the "),Xo=a(Xn,"CODE",{});var yh=r(Xo);gc=i(yh,"__call__"),yh.forEach(s),_c=i(Xn," special method."),Xn.forEach(s),vc=m(yt),k(et.$$.fragment,yt),Tc=m(yt),k(tt.$$.fragment,yt),yt.forEach(s),bc=m(A),R=a(A,"DIV",{class:!0});var Mt=r(R);k(xs.$$.fragment,Mt),kc=m(Mt),Yo=a(Mt,"P",{});var Mh=r(Yo);$c=i(Mh,"This is an experimental feature and is a subject to change at a moment\u2019s notice."),Mh.forEach(s),wc=m(Mt),Zo=a(Mt,"P",{});var xh=r(Zo);yc=i(xh,`Uses a device map to distribute attention modules of the model across several devices. If no device map is given,
it will evenly distribute blocks across all devices.`),xh.forEach(s),Mc=m(Mt),k(st.$$.fragment,Mt),Mt.forEach(s),A.forEach(s),sr=m(t),we=a(t,"H2",{class:!0});var Br=r(we);nt=a(Br,"A",{id:!0,class:!0,href:!0});var zh=r(nt);Qo=a(zh,"SPAN",{});var jh=r(Qo);k(zs.$$.fragment,jh),jh.forEach(s),zh.forEach(s),xc=m(Br),ea=a(Br,"SPAN",{});var Eh=r(ea);zc=i(Eh,"MT5EncoderModel"),Eh.forEach(s),Br.forEach(s),nr=m(t),q=a(t,"DIV",{class:!0});var C=r(q);k(js.$$.fragment,C),jc=m(C),ta=a(C,"P",{});var qh=r(ta);Ec=i(qh,"The bare MT5 Model transformer outputting encoder\u2019s raw hidden-states without any specific head on top."),qh.forEach(s),qc=m(C),Es=a(C,"P",{});var Wr=r(Es);Fc=i(Wr,"The MT5 model was proposed in "),qs=a(Wr,"A",{href:!0,rel:!0});var Fh=r(qs);Pc=i(Fh,`Exploring the Limits of Transfer Learning with a Unified Text-to-Text
Transformer`),Fh.forEach(s),Ac=i(Wr,` by Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan
Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J. Liu. It\u2019s an encoder decoder transformer pre-trained in a
text-to-text denoising generative setting.`),Wr.forEach(s),Cc=m(C),Fs=a(C,"P",{});var Vr=r(Fs);Sc=i(Vr,"This model inherits from "),An=a(Vr,"A",{href:!0});var Ph=r(An);Lc=i(Ph,"PreTrainedModel"),Ph.forEach(s),Nc=i(Vr,`. 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.)`),Vr.forEach(s),Oc=m(C),Ps=a(C,"P",{});var Hr=r(Ps);Ic=i(Hr,"This model is also a PyTorch "),As=a(Hr,"A",{href:!0,rel:!0});var Ah=r(As);Gc=i(Ah,"torch.nn.Module"),Ah.forEach(s),Dc=i(Hr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Hr.forEach(s),Uc=m(C),k(ot.$$.fragment,C),Bc=m(C),de=a(C,"DIV",{class:!0});var Yn=r(de);k(Cs.$$.fragment,Yn),Wc=m(Yn),sa=a(Yn,"P",{});var Ch=r(sa);Vc=i(Ch,"Moves the model to cpu from a model parallel state."),Ch.forEach(s),Hc=m(Yn),k(at.$$.fragment,Yn),Yn.forEach(s),Rc=m(C),K=a(C,"DIV",{class:!0});var xt=r(K);k(Ss.$$.fragment,xt),Kc=m(xt),ye=a(xt,"P",{});var Zn=r(ye);Jc=i(Zn,"The "),Cn=a(Zn,"A",{href:!0});var Sh=r(Cn);Xc=i(Sh,"MT5EncoderModel"),Sh.forEach(s),Yc=i(Zn," forward method, overrides the "),na=a(Zn,"CODE",{});var Lh=r(na);Zc=i(Lh,"__call__"),Lh.forEach(s),Qc=i(Zn," special method."),Zn.forEach(s),ep=m(xt),k(rt.$$.fragment,xt),tp=m(xt),k(lt.$$.fragment,xt),xt.forEach(s),sp=m(C),J=a(C,"DIV",{class:!0});var zt=r(J);k(Ls.$$.fragment,zt),np=m(zt),oa=a(zt,"P",{});var Nh=r(oa);op=i(Nh,"This is an experimental feature and is a subject to change at a moment\u2019s notice."),Nh.forEach(s),ap=m(zt),aa=a(zt,"P",{});var Oh=r(aa);rp=i(Oh,`Uses a device map to distribute attention modules of the model across several devices. If no device map is given,
it will evenly distribute blocks across all devices.`),Oh.forEach(s),lp=m(zt),k(it.$$.fragment,zt),zt.forEach(s),C.forEach(s),or=m(t),Me=a(t,"H2",{class:!0});var Rr=r(Me);dt=a(Rr,"A",{id:!0,class:!0,href:!0});var Ih=r(dt);ra=a(Ih,"SPAN",{});var Gh=r(ra);k(Ns.$$.fragment,Gh),Gh.forEach(s),Ih.forEach(s),ip=m(Rr),la=a(Rr,"SPAN",{});var Dh=r(la);dp=i(Dh,"TFMT5Model"),Dh.forEach(s),Rr.forEach(s),ar=m(t),Z=a(t,"DIV",{class:!0});var Qn=r(Z);k(Os.$$.fragment,Qn),cp=m(Qn),Is=a(Qn,"P",{});var Kr=r(Is);pp=i(Kr,"This class overrides "),Sn=a(Kr,"A",{href:!0});var Uh=r(Sn);mp=i(Uh,"TFT5Model"),Uh.forEach(s),hp=i(Kr,`. Please check the superclass for the appropriate documentation alongside usage
examples.`),Kr.forEach(s),up=m(Qn),k(ct.$$.fragment,Qn),Qn.forEach(s),rr=m(t),xe=a(t,"H2",{class:!0});var Jr=r(xe);pt=a(Jr,"A",{id:!0,class:!0,href:!0});var Bh=r(pt);ia=a(Bh,"SPAN",{});var Wh=r(ia);k(Gs.$$.fragment,Wh),Wh.forEach(s),Bh.forEach(s),fp=m(Jr),da=a(Jr,"SPAN",{});var Vh=r(da);gp=i(Vh,"TFMT5ForConditionalGeneration"),Vh.forEach(s),Jr.forEach(s),lr=m(t),Q=a(t,"DIV",{class:!0});var eo=r(Q);k(Ds.$$.fragment,eo),_p=m(eo),Us=a(eo,"P",{});var Xr=r(Us);vp=i(Xr,"This class overrides "),Ln=a(Xr,"A",{href:!0});var Hh=r(Ln);Tp=i(Hh,"TFT5ForConditionalGeneration"),Hh.forEach(s),bp=i(Xr,`. Please check the superclass for the appropriate
documentation alongside usage examples.`),Xr.forEach(s),kp=m(eo),k(mt.$$.fragment,eo),eo.forEach(s),ir=m(t),ze=a(t,"H2",{class:!0});var Yr=r(ze);ht=a(Yr,"A",{id:!0,class:!0,href:!0});var Rh=r(ht);ca=a(Rh,"SPAN",{});var Kh=r(ca);k(Bs.$$.fragment,Kh),Kh.forEach(s),Rh.forEach(s),$p=m(Yr),pa=a(Yr,"SPAN",{});var Jh=r(pa);wp=i(Jh,"TFMT5EncoderModel"),Jh.forEach(s),Yr.forEach(s),dr=m(t),ee=a(t,"DIV",{class:!0});var to=r(ee);k(Ws.$$.fragment,to),yp=m(to),Vs=a(to,"P",{});var Zr=r(Vs);Mp=i(Zr,"This class overrides "),Nn=a(Zr,"A",{href:!0});var Xh=r(Nn);xp=i(Xh,"TFT5EncoderModel"),Xh.forEach(s),zp=i(Zr,`. Please check the superclass for the appropriate documentation alongside
usage examples.`),Zr.forEach(s),jp=m(to),k(ut.$$.fragment,to),to.forEach(s),cr=m(t),je=a(t,"H2",{class:!0});var Qr=r(je);ft=a(Qr,"A",{id:!0,class:!0,href:!0});var Yh=r(ft);ma=a(Yh,"SPAN",{});var Zh=r(ma);k(Hs.$$.fragment,Zh),Zh.forEach(s),Yh.forEach(s),Ep=m(Qr),ha=a(Qr,"SPAN",{});var Qh=r(ha);qp=i(Qh,"FlaxMT5Model"),Qh.forEach(s),Qr.forEach(s),pr=m(t),te=a(t,"DIV",{class:!0});var so=r(te);k(Rs.$$.fragment,so),Fp=m(so),Ks=a(so,"P",{});var el=r(Ks);Pp=i(el,"This class overrides "),On=a(el,"A",{href:!0});var eu=r(On);Ap=i(eu,"FlaxT5Model"),eu.forEach(s),Cp=i(el,`. Please check the superclass for the appropriate documentation alongside usage
examples.`),el.forEach(s),Sp=m(so),k(gt.$$.fragment,so),so.forEach(s),mr=m(t),Ee=a(t,"H2",{class:!0});var tl=r(Ee);_t=a(tl,"A",{id:!0,class:!0,href:!0});var tu=r(_t);ua=a(tu,"SPAN",{});var su=r(ua);k(Js.$$.fragment,su),su.forEach(s),tu.forEach(s),Lp=m(tl),fa=a(tl,"SPAN",{});var nu=r(fa);Np=i(nu,"FlaxMT5ForConditionalGeneration"),nu.forEach(s),tl.forEach(s),hr=m(t),se=a(t,"DIV",{class:!0});var no=r(se);k(Xs.$$.fragment,no),Op=m(no),Ys=a(no,"P",{});var sl=r(Ys);Ip=i(sl,"This class overrides "),In=a(sl,"A",{href:!0});var ou=r(In);Gp=i(ou,"FlaxT5ForConditionalGeneration"),ou.forEach(s),Dp=i(sl,`. Please check the superclass for the appropriate
documentation alongside usage examples.`),sl.forEach(s),Up=m(no),k(vt.$$.fragment,no),no.forEach(s),ur=m(t),qe=a(t,"H2",{class:!0});var nl=r(qe);Tt=a(nl,"A",{id:!0,class:!0,href:!0});var au=r(Tt);ga=a(au,"SPAN",{});var ru=r(ga);k(Zs.$$.fragment,ru),ru.forEach(s),au.forEach(s),Bp=m(nl),_a=a(nl,"SPAN",{});var lu=r(_a);Wp=i(lu,"FlaxMT5EncoderModel"),lu.forEach(s),nl.forEach(s),fr=m(t),ne=a(t,"DIV",{class:!0});var oo=r(ne);k(Qs.$$.fragment,oo),Vp=m(oo),en=a(oo,"P",{});var ol=r(en);Hp=i(ol,"This class overrides "),Gn=a(ol,"A",{href:!0});var iu=r(Gn);Rp=i(iu,"FlaxT5EncoderModel"),iu.forEach(s),Kp=i(ol,`. Please check the superclass for the appropriate documentation
alongside usage examples.`),ol.forEach(s),Jp=m(oo),k(bt.$$.fragment,oo),oo.forEach(s),this.h()},h(){h(c,"name","hf:doc:metadata"),h(c,"content",JSON.stringify(Nu)),h(d,"id","mt5"),h(d,"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(d,"href","#mt5"),h(g,"class","relative group"),h(ln,"alt","Models"),du(ln.src,sm="https://img.shields.io/badge/All_model_pages-mt5-blueviolet")||h(ln,"src",sm),h(rn,"href","https://huggingface.co/models?filter=mt5"),h(cn,"alt","Spaces"),du(cn.src,nm="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue")||h(cn,"src",nm),h(dn,"href","https://huggingface.co/spaces/docs-demos/mt5-small-finetuned-arxiv-cs-finetuned-arxiv-cs-full"),h(pe,"class","flex flex-wrap space-x-1"),h(Fe,"id","overview"),h(Fe,"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(Fe,"href","#overview"),h(me,"class","relative group"),h(Et,"href","https://arxiv.org/abs/2010.11934"),h(Et,"rel","nofollow"),h(qt,"href","https://huggingface.co/datasets/mc4"),h(qt,"rel","nofollow"),h(Ft,"href","https://huggingface.co/google/mt5-small"),h(Ft,"rel","nofollow"),h(Pt,"href","https://huggingface.co/google/mt5-base"),h(Pt,"rel","nofollow"),h(At,"href","https://huggingface.co/google/mt5-large"),h(At,"rel","nofollow"),h(Ct,"href","https://huggingface.co/google/mt5-xl"),h(Ct,"rel","nofollow"),h(St,"href","https://huggingface.co/google/mt5-xxl"),h(St,"rel","nofollow"),h(Lt,"href","https://huggingface.co/patrickvonplaten"),h(Lt,"rel","nofollow"),h(Nt,"href","https://github.com/google-research/multilingual-t5"),h(Nt,"rel","nofollow"),h(Ce,"id","documentation-resources"),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","#documentation-resources"),h(he,"class","relative group"),h(fn,"href","./tasks/translation"),h(gn,"href","./tasks/summarization"),h(Le,"id","transformers.MT5Config"),h(Le,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Le,"href","#transformers.MT5Config"),h(ue,"class","relative group"),h(_n,"href","/docs/transformers/v4.27.1/en/model_doc/mt5#transformers.MT5Model"),h(vn,"href","/docs/transformers/v4.27.1/en/model_doc/mt5#transformers.TFMT5Model"),h(Dt,"href","https://huggingface.co/google/mt5-small"),h(Dt,"rel","nofollow"),h(Tn,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),h(bn,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),h(X,"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.T5Tokenizer"),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.T5Tokenizer"),h(ge,"class","relative group"),h(Vt,"href","https://github.com/google/sentencepiece"),h(Vt,"rel","nofollow"),h(kn,"href","/docs/transformers/v4.27.1/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),h(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ge,"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(yn,"href","/docs/transformers/v4.27.1/en/model_doc/mt5#transformers.T5Tokenizer"),h(Ue,"id","transformers.T5TokenizerFast"),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.T5TokenizerFast"),h(_e,"class","relative group"),h(ts,"href","https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models"),h(ts,"rel","nofollow"),h(Mn,"href","/docs/transformers/v4.27.1/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),h(re,"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,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(jn,"href","/docs/transformers/v4.27.1/en/model_doc/mt5#transformers.T5TokenizerFast"),h(Ve,"id","transformers.MT5Model"),h(Ve,"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(Ve,"href","#transformers.MT5Model"),h(Te,"class","relative group"),h(ds,"href","https://arxiv.org/abs/1910.10683"),h(ds,"rel","nofollow"),h(En,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),h(ms,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(ms,"rel","nofollow"),h(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(qn,"href","/docs/transformers/v4.27.1/en/model_doc/mt5#transformers.MT5Model"),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(V,"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(Ye,"id","transformers.MT5ForConditionalGeneration"),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","#transformers.MT5ForConditionalGeneration"),h(ke,"class","relative group"),h(bs,"href","https://arxiv.org/abs/1910.10683"),h(bs,"rel","nofollow"),h(Fn,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),h(ws,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(ws,"rel","nofollow"),h(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Pn,"href","/docs/transformers/v4.27.1/en/model_doc/mt5#transformers.MT5ForConditionalGeneration"),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(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(nt,"id","transformers.MT5EncoderModel"),h(nt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(nt,"href","#transformers.MT5EncoderModel"),h(we,"class","relative group"),h(qs,"href","https://arxiv.org/abs/1910.10683"),h(qs,"rel","nofollow"),h(An,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),h(As,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(As,"rel","nofollow"),h(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Cn,"href","/docs/transformers/v4.27.1/en/model_doc/mt5#transformers.MT5EncoderModel"),h(K,"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(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(dt,"id","transformers.TFMT5Model"),h(dt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(dt,"href","#transformers.TFMT5Model"),h(Me,"class","relative group"),h(Sn,"href","/docs/transformers/v4.27.1/en/model_doc/t5#transformers.TFT5Model"),h(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(pt,"id","transformers.TFMT5ForConditionalGeneration"),h(pt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(pt,"href","#transformers.TFMT5ForConditionalGeneration"),h(xe,"class","relative group"),h(Ln,"href","/docs/transformers/v4.27.1/en/model_doc/t5#transformers.TFT5ForConditionalGeneration"),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(ht,"id","transformers.TFMT5EncoderModel"),h(ht,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ht,"href","#transformers.TFMT5EncoderModel"),h(ze,"class","relative group"),h(Nn,"href","/docs/transformers/v4.27.1/en/model_doc/t5#transformers.TFT5EncoderModel"),h(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ft,"id","transformers.FlaxMT5Model"),h(ft,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ft,"href","#transformers.FlaxMT5Model"),h(je,"class","relative group"),h(On,"href","/docs/transformers/v4.27.1/en/model_doc/t5#transformers.FlaxT5Model"),h(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(_t,"id","transformers.FlaxMT5ForConditionalGeneration"),h(_t,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(_t,"href","#transformers.FlaxMT5ForConditionalGeneration"),h(Ee,"class","relative group"),h(In,"href","/docs/transformers/v4.27.1/en/model_doc/t5#transformers.FlaxT5ForConditionalGeneration"),h(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Tt,"id","transformers.FlaxMT5EncoderModel"),h(Tt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Tt,"href","#transformers.FlaxMT5EncoderModel"),h(qe,"class","relative group"),h(Gn,"href","/docs/transformers/v4.27.1/en/model_doc/t5#transformers.FlaxT5EncoderModel"),h(ne,"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,c),_(t,T,f),_(t,g,f),e(g,d),e(d,v),$(n,v,null),e(g,u),e(g,G),e(G,al),_(t,Aa,f),_(t,pe,f),e(pe,rn),e(rn,ln),e(pe,rl),e(pe,dn),e(dn,cn),_(t,Ca,f),_(t,me,f),e(me,Fe),e(Fe,ao),$(jt,ao,null),e(me,ll),e(me,ro),e(ro,il),_(t,Sa,f),_(t,Pe,f),e(Pe,dl),e(Pe,Et),e(Et,cl),e(Pe,pl),_(t,La,f),_(t,pn,f),e(pn,ml),_(t,Na,f),_(t,mn,f),e(mn,lo),e(lo,hl),_(t,Oa,f),_(t,Ae,f),e(Ae,ul),e(Ae,qt),e(qt,fl),e(Ae,gl),_(t,Ia,f),_(t,hn,f),e(hn,_l),_(t,Ga,f),_(t,D,f),e(D,io),e(io,co),e(co,Ft),e(Ft,vl),e(D,Tl),e(D,po),e(po,mo),e(mo,Pt),e(Pt,bl),e(D,kl),e(D,ho),e(ho,uo),e(uo,At),e(At,$l),e(D,wl),e(D,fo),e(fo,go),e(go,Ct),e(Ct,yl),e(D,Ml),e(D,_o),e(_o,un),e(un,St),e(St,xl),e(un,zl),_(t,Da,f),_(t,oe,f),e(oe,jl),e(oe,Lt),e(Lt,El),e(oe,ql),e(oe,Nt),e(Nt,Fl),e(oe,Pl),_(t,Ua,f),_(t,he,f),e(he,Ce),e(Ce,vo),$(Ot,vo,null),e(he,Al),e(he,To),e(To,Cl),_(t,Ba,f),_(t,Se,f),e(Se,bo),e(bo,fn),e(fn,Sl),e(Se,Ll),e(Se,ko),e(ko,gn),e(gn,Nl),_(t,Wa,f),_(t,ue,f),e(ue,Le),e(Le,$o),$(It,$o,null),e(ue,Ol),e(ue,wo),e(wo,Il),_(t,Va,f),_(t,X,f),$(Gt,X,null),e(X,Gl),e(X,Y),e(Y,Dl),e(Y,_n),e(_n,Ul),e(Y,Bl),e(Y,vn),e(vn,Wl),e(Y,Vl),e(Y,Dt),e(Dt,Hl),e(Y,Rl),e(X,Kl),e(X,fe),e(fe,Jl),e(fe,Tn),e(Tn,Xl),e(fe,Yl),e(fe,bn),e(bn,Zl),e(fe,Ql),_(t,Ha,f),_(t,ge,f),e(ge,Ne),e(Ne,yo),$(Ut,yo,null),e(ge,ei),e(ge,Mo),e(Mo,ti),_(t,Ra,f),_(t,F,f),$(Bt,F,null),e(F,si),e(F,Wt),e(Wt,ni),e(Wt,Vt),e(Vt,oi),e(Wt,ai),e(F,ri),e(F,Ht),e(Ht,li),e(Ht,kn),e(kn,ii),e(Ht,di),e(F,ci),e(F,ae),$(Rt,ae,null),e(ae,pi),e(ae,xo),e(xo,mi),e(ae,hi),e(ae,Kt),e(Kt,$n),e($n,ui),e($n,zo),e(zo,fi),e(Kt,gi),e(Kt,wn),e(wn,_i),e(wn,jo),e(jo,vi),e(F,Ti),e(F,Oe),$(Jt,Oe,null),e(Oe,bi),e(Oe,Eo),e(Eo,ki),e(F,$i),e(F,Ie),$(Xt,Ie,null),e(Ie,wi),e(Ie,qo),e(qo,yi),e(F,Mi),e(F,Ge),$(Yt,Ge,null),e(Ge,xi),e(Ge,Zt),e(Zt,zi),e(Zt,Fo),e(Fo,ji),e(Zt,Ei),_(t,Ka,f),_(t,De,f),e(De,qi),e(De,yn),e(yn,Fi),e(De,Pi),_(t,Ja,f),_(t,_e,f),e(_e,Ue),e(Ue,Po),$(Qt,Po,null),e(_e,Ai),e(_e,Ao),e(Ao,Ci),_(t,Xa,f),_(t,O,f),$(es,O,null),e(O,Si),e(O,ve),e(ve,Li),e(ve,Co),e(Co,Ni),e(ve,Oi),e(ve,ts),e(ts,Ii),e(ve,Gi),e(O,Di),e(O,ss),e(ss,Ui),e(ss,Mn),e(Mn,Bi),e(ss,Wi),e(O,Vi),e(O,re),$(ns,re,null),e(re,Hi),e(re,So),e(So,Ri),e(re,Ki),e(re,os),e(os,xn),e(xn,Ji),e(xn,Lo),e(Lo,Xi),e(os,Yi),e(os,zn),e(zn,Zi),e(zn,No),e(No,Qi),e(O,ed),e(O,Be),$(as,Be,null),e(Be,td),e(Be,Oo),e(Oo,sd),_(t,Ya,f),_(t,We,f),e(We,nd),e(We,jn),e(jn,od),e(We,ad),_(t,Za,f),_(t,Te,f),e(Te,Ve),e(Ve,Io),$(rs,Io,null),e(Te,rd),e(Te,Go),e(Go,ld),_(t,Qa,f),_(t,j,f),$(ls,j,null),e(j,id),e(j,Do),e(Do,dd),e(j,cd),e(j,is),e(is,pd),e(is,ds),e(ds,md),e(is,hd),e(j,ud),e(j,cs),e(cs,fd),e(cs,En),e(En,gd),e(cs,_d),e(j,vd),e(j,ps),e(ps,Td),e(ps,ms),e(ms,bd),e(ps,kd),e(j,$d),$(He,j,null),e(j,wd),e(j,le),$(hs,le,null),e(le,yd),e(le,Uo),e(Uo,Md),e(le,xd),$(Re,le,null),e(j,zd),e(j,W),$(us,W,null),e(W,jd),e(W,be),e(be,Ed),e(be,qn),e(qn,qd),e(be,Fd),e(be,Bo),e(Bo,Pd),e(be,Ad),e(W,Cd),$(Ke,W,null),e(W,Sd),$(Je,W,null),e(j,Ld),e(j,V),$(fs,V,null),e(V,Nd),e(V,Wo),e(Wo,Od),e(V,Id),e(V,Vo),e(Vo,Gd),e(V,Dd),$(Xe,V,null),_(t,er,f),_(t,ke,f),e(ke,Ye),e(Ye,Ho),$(gs,Ho,null),e(ke,Ud),e(ke,Ro),e(Ro,Bd),_(t,tr,f),_(t,E,f),$(_s,E,null),e(E,Wd),e(E,vs),e(vs,Vd),e(vs,Ko),e(Ko,Hd),e(vs,Rd),e(E,Kd),e(E,Ts),e(Ts,Jd),e(Ts,bs),e(bs,Xd),e(Ts,Yd),e(E,Zd),e(E,ks),e(ks,Qd),e(ks,Fn),e(Fn,ec),e(ks,tc),e(E,sc),e(E,$s),e($s,nc),e($s,ws),e(ws,oc),e($s,ac),e(E,rc),$(Ze,E,null),e(E,lc),e(E,ie),$(ys,ie,null),e(ie,ic),e(ie,Jo),e(Jo,dc),e(ie,cc),$(Qe,ie,null),e(E,pc),e(E,H),$(Ms,H,null),e(H,mc),e(H,$e),e($e,hc),e($e,Pn),e(Pn,uc),e($e,fc),e($e,Xo),e(Xo,gc),e($e,_c),e(H,vc),$(et,H,null),e(H,Tc),$(tt,H,null),e(E,bc),e(E,R),$(xs,R,null),e(R,kc),e(R,Yo),e(Yo,$c),e(R,wc),e(R,Zo),e(Zo,yc),e(R,Mc),$(st,R,null),_(t,sr,f),_(t,we,f),e(we,nt),e(nt,Qo),$(zs,Qo,null),e(we,xc),e(we,ea),e(ea,zc),_(t,nr,f),_(t,q,f),$(js,q,null),e(q,jc),e(q,ta),e(ta,Ec),e(q,qc),e(q,Es),e(Es,Fc),e(Es,qs),e(qs,Pc),e(Es,Ac),e(q,Cc),e(q,Fs),e(Fs,Sc),e(Fs,An),e(An,Lc),e(Fs,Nc),e(q,Oc),e(q,Ps),e(Ps,Ic),e(Ps,As),e(As,Gc),e(Ps,Dc),e(q,Uc),$(ot,q,null),e(q,Bc),e(q,de),$(Cs,de,null),e(de,Wc),e(de,sa),e(sa,Vc),e(de,Hc),$(at,de,null),e(q,Rc),e(q,K),$(Ss,K,null),e(K,Kc),e(K,ye),e(ye,Jc),e(ye,Cn),e(Cn,Xc),e(ye,Yc),e(ye,na),e(na,Zc),e(ye,Qc),e(K,ep),$(rt,K,null),e(K,tp),$(lt,K,null),e(q,sp),e(q,J),$(Ls,J,null),e(J,np),e(J,oa),e(oa,op),e(J,ap),e(J,aa),e(aa,rp),e(J,lp),$(it,J,null),_(t,or,f),_(t,Me,f),e(Me,dt),e(dt,ra),$(Ns,ra,null),e(Me,ip),e(Me,la),e(la,dp),_(t,ar,f),_(t,Z,f),$(Os,Z,null),e(Z,cp),e(Z,Is),e(Is,pp),e(Is,Sn),e(Sn,mp),e(Is,hp),e(Z,up),$(ct,Z,null),_(t,rr,f),_(t,xe,f),e(xe,pt),e(pt,ia),$(Gs,ia,null),e(xe,fp),e(xe,da),e(da,gp),_(t,lr,f),_(t,Q,f),$(Ds,Q,null),e(Q,_p),e(Q,Us),e(Us,vp),e(Us,Ln),e(Ln,Tp),e(Us,bp),e(Q,kp),$(mt,Q,null),_(t,ir,f),_(t,ze,f),e(ze,ht),e(ht,ca),$(Bs,ca,null),e(ze,$p),e(ze,pa),e(pa,wp),_(t,dr,f),_(t,ee,f),$(Ws,ee,null),e(ee,yp),e(ee,Vs),e(Vs,Mp),e(Vs,Nn),e(Nn,xp),e(Vs,zp),e(ee,jp),$(ut,ee,null),_(t,cr,f),_(t,je,f),e(je,ft),e(ft,ma),$(Hs,ma,null),e(je,Ep),e(je,ha),e(ha,qp),_(t,pr,f),_(t,te,f),$(Rs,te,null),e(te,Fp),e(te,Ks),e(Ks,Pp),e(Ks,On),e(On,Ap),e(Ks,Cp),e(te,Sp),$(gt,te,null),_(t,mr,f),_(t,Ee,f),e(Ee,_t),e(_t,ua),$(Js,ua,null),e(Ee,Lp),e(Ee,fa),e(fa,Np),_(t,hr,f),_(t,se,f),$(Xs,se,null),e(se,Op),e(se,Ys),e(Ys,Ip),e(Ys,In),e(In,Gp),e(Ys,Dp),e(se,Up),$(vt,se,null),_(t,ur,f),_(t,qe,f),e(qe,Tt),e(Tt,ga),$(Zs,ga,null),e(qe,Bp),e(qe,_a),e(_a,Wp),_(t,fr,f),_(t,ne,f),$(Qs,ne,null),e(ne,Vp),e(ne,en),e(en,Hp),e(en,Gn),e(Gn,Rp),e(en,Kp),e(ne,Jp),$(bt,ne,null),gr=!0},p(t,[f]){const tn={};f&2&&(tn.$$scope={dirty:f,ctx:t}),He.$set(tn);const va={};f&2&&(va.$$scope={dirty:f,ctx:t}),Re.$set(va);const Ta={};f&2&&(Ta.$$scope={dirty:f,ctx:t}),Ke.$set(Ta);const ba={};f&2&&(ba.$$scope={dirty:f,ctx:t}),Je.$set(ba);const sn={};f&2&&(sn.$$scope={dirty:f,ctx:t}),Xe.$set(sn);const ka={};f&2&&(ka.$$scope={dirty:f,ctx:t}),Ze.$set(ka);const $a={};f&2&&($a.$$scope={dirty:f,ctx:t}),Qe.$set($a);const nn={};f&2&&(nn.$$scope={dirty:f,ctx:t}),et.$set(nn);const wa={};f&2&&(wa.$$scope={dirty:f,ctx:t}),tt.$set(wa);const ya={};f&2&&(ya.$$scope={dirty:f,ctx:t}),st.$set(ya);const Ma={};f&2&&(Ma.$$scope={dirty:f,ctx:t}),ot.$set(Ma);const on={};f&2&&(on.$$scope={dirty:f,ctx:t}),at.$set(on);const xa={};f&2&&(xa.$$scope={dirty:f,ctx:t}),rt.$set(xa);const za={};f&2&&(za.$$scope={dirty:f,ctx:t}),lt.$set(za);const ja={};f&2&&(ja.$$scope={dirty:f,ctx:t}),it.$set(ja);const Ea={};f&2&&(Ea.$$scope={dirty:f,ctx:t}),ct.$set(Ea);const an={};f&2&&(an.$$scope={dirty:f,ctx:t}),mt.$set(an);const qa={};f&2&&(qa.$$scope={dirty:f,ctx:t}),ut.$set(qa);const Fa={};f&2&&(Fa.$$scope={dirty:f,ctx:t}),gt.$set(Fa);const B={};f&2&&(B.$$scope={dirty:f,ctx:t}),vt.$set(B);const Pa={};f&2&&(Pa.$$scope={dirty:f,ctx:t}),bt.$set(Pa)},i(t){gr||(w(n.$$.fragment,t),w(jt.$$.fragment,t),w(Ot.$$.fragment,t),w(It.$$.fragment,t),w(Gt.$$.fragment,t),w(Ut.$$.fragment,t),w(Bt.$$.fragment,t),w(Rt.$$.fragment,t),w(Jt.$$.fragment,t),w(Xt.$$.fragment,t),w(Yt.$$.fragment,t),w(Qt.$$.fragment,t),w(es.$$.fragment,t),w(ns.$$.fragment,t),w(as.$$.fragment,t),w(rs.$$.fragment,t),w(ls.$$.fragment,t),w(He.$$.fragment,t),w(hs.$$.fragment,t),w(Re.$$.fragment,t),w(us.$$.fragment,t),w(Ke.$$.fragment,t),w(Je.$$.fragment,t),w(fs.$$.fragment,t),w(Xe.$$.fragment,t),w(gs.$$.fragment,t),w(_s.$$.fragment,t),w(Ze.$$.fragment,t),w(ys.$$.fragment,t),w(Qe.$$.fragment,t),w(Ms.$$.fragment,t),w(et.$$.fragment,t),w(tt.$$.fragment,t),w(xs.$$.fragment,t),w(st.$$.fragment,t),w(zs.$$.fragment,t),w(js.$$.fragment,t),w(ot.$$.fragment,t),w(Cs.$$.fragment,t),w(at.$$.fragment,t),w(Ss.$$.fragment,t),w(rt.$$.fragment,t),w(lt.$$.fragment,t),w(Ls.$$.fragment,t),w(it.$$.fragment,t),w(Ns.$$.fragment,t),w(Os.$$.fragment,t),w(ct.$$.fragment,t),w(Gs.$$.fragment,t),w(Ds.$$.fragment,t),w(mt.$$.fragment,t),w(Bs.$$.fragment,t),w(Ws.$$.fragment,t),w(ut.$$.fragment,t),w(Hs.$$.fragment,t),w(Rs.$$.fragment,t),w(gt.$$.fragment,t),w(Js.$$.fragment,t),w(Xs.$$.fragment,t),w(vt.$$.fragment,t),w(Zs.$$.fragment,t),w(Qs.$$.fragment,t),w(bt.$$.fragment,t),gr=!0)},o(t){y(n.$$.fragment,t),y(jt.$$.fragment,t),y(Ot.$$.fragment,t),y(It.$$.fragment,t),y(Gt.$$.fragment,t),y(Ut.$$.fragment,t),y(Bt.$$.fragment,t),y(Rt.$$.fragment,t),y(Jt.$$.fragment,t),y(Xt.$$.fragment,t),y(Yt.$$.fragment,t),y(Qt.$$.fragment,t),y(es.$$.fragment,t),y(ns.$$.fragment,t),y(as.$$.fragment,t),y(rs.$$.fragment,t),y(ls.$$.fragment,t),y(He.$$.fragment,t),y(hs.$$.fragment,t),y(Re.$$.fragment,t),y(us.$$.fragment,t),y(Ke.$$.fragment,t),y(Je.$$.fragment,t),y(fs.$$.fragment,t),y(Xe.$$.fragment,t),y(gs.$$.fragment,t),y(_s.$$.fragment,t),y(Ze.$$.fragment,t),y(ys.$$.fragment,t),y(Qe.$$.fragment,t),y(Ms.$$.fragment,t),y(et.$$.fragment,t),y(tt.$$.fragment,t),y(xs.$$.fragment,t),y(st.$$.fragment,t),y(zs.$$.fragment,t),y(js.$$.fragment,t),y(ot.$$.fragment,t),y(Cs.$$.fragment,t),y(at.$$.fragment,t),y(Ss.$$.fragment,t),y(rt.$$.fragment,t),y(lt.$$.fragment,t),y(Ls.$$.fragment,t),y(it.$$.fragment,t),y(Ns.$$.fragment,t),y(Os.$$.fragment,t),y(ct.$$.fragment,t),y(Gs.$$.fragment,t),y(Ds.$$.fragment,t),y(mt.$$.fragment,t),y(Bs.$$.fragment,t),y(Ws.$$.fragment,t),y(ut.$$.fragment,t),y(Hs.$$.fragment,t),y(Rs.$$.fragment,t),y(gt.$$.fragment,t),y(Js.$$.fragment,t),y(Xs.$$.fragment,t),y(vt.$$.fragment,t),y(Zs.$$.fragment,t),y(Qs.$$.fragment,t),y(bt.$$.fragment,t),gr=!1},d(t){s(c),t&&s(T),t&&s(g),M(n),t&&s(Aa),t&&s(pe),t&&s(Ca),t&&s(me),M(jt),t&&s(Sa),t&&s(Pe),t&&s(La),t&&s(pn),t&&s(Na),t&&s(mn),t&&s(Oa),t&&s(Ae),t&&s(Ia),t&&s(hn),t&&s(Ga),t&&s(D),t&&s(Da),t&&s(oe),t&&s(Ua),t&&s(he),M(Ot),t&&s(Ba),t&&s(Se),t&&s(Wa),t&&s(ue),M(It),t&&s(Va),t&&s(X),M(Gt),t&&s(Ha),t&&s(ge),M(Ut),t&&s(Ra),t&&s(F),M(Bt),M(Rt),M(Jt),M(Xt),M(Yt),t&&s(Ka),t&&s(De),t&&s(Ja),t&&s(_e),M(Qt),t&&s(Xa),t&&s(O),M(es),M(ns),M(as),t&&s(Ya),t&&s(We),t&&s(Za),t&&s(Te),M(rs),t&&s(Qa),t&&s(j),M(ls),M(He),M(hs),M(Re),M(us),M(Ke),M(Je),M(fs),M(Xe),t&&s(er),t&&s(ke),M(gs),t&&s(tr),t&&s(E),M(_s),M(Ze),M(ys),M(Qe),M(Ms),M(et),M(tt),M(xs),M(st),t&&s(sr),t&&s(we),M(zs),t&&s(nr),t&&s(q),M(js),M(ot),M(Cs),M(at),M(Ss),M(rt),M(lt),M(Ls),M(it),t&&s(or),t&&s(Me),M(Ns),t&&s(ar),t&&s(Z),M(Os),M(ct),t&&s(rr),t&&s(xe),M(Gs),t&&s(lr),t&&s(Q),M(Ds),M(mt),t&&s(ir),t&&s(ze),M(Bs),t&&s(dr),t&&s(ee),M(Ws),M(ut),t&&s(cr),t&&s(je),M(Hs),t&&s(pr),t&&s(te),M(Rs),M(gt),t&&s(mr),t&&s(Ee),M(Js),t&&s(hr),t&&s(se),M(Xs),M(vt),t&&s(ur),t&&s(qe),M(Zs),t&&s(fr),t&&s(ne),M(Qs),M(bt)}}}const Nu={local:"mt5",sections:[{local:"overview",title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.MT5Config",title:"MT5Config"},{local:"transformers.T5Tokenizer",title:"MT5Tokenizer"},{local:"transformers.T5TokenizerFast",title:"MT5TokenizerFast"},{local:"transformers.MT5Model",title:"MT5Model"},{local:"transformers.MT5ForConditionalGeneration",title:"MT5ForConditionalGeneration"},{local:"transformers.MT5EncoderModel",title:"MT5EncoderModel"},{local:"transformers.TFMT5Model",title:"TFMT5Model"},{local:"transformers.TFMT5ForConditionalGeneration",title:"TFMT5ForConditionalGeneration"},{local:"transformers.TFMT5EncoderModel",title:"TFMT5EncoderModel"},{local:"transformers.FlaxMT5Model",title:"FlaxMT5Model"},{local:"transformers.FlaxMT5ForConditionalGeneration",title:"FlaxMT5ForConditionalGeneration"},{local:"transformers.FlaxMT5EncoderModel",title:"FlaxMT5EncoderModel"}],title:"mT5"};function Ou(x){return uu(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Vu extends cu{constructor(c){super();pu(this,c,Ou,Lu,mu,{})}}export{Vu as default,Nu as metadata};
