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 y,h as i,b as h,N as du,G as e,g as _,y as v,q as w,o as k,B as j,v as uu,L as G}from"../../chunks/vendor-hf-doc-builder.js";import{T as tm}from"../../chunks/Tip-hf-doc-builder.js";import{D as J}from"../../chunks/Docstring-hf-doc-builder.js";import{C as V}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as B}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Z}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function fu($){let c,T,g,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1UNU1vZGVsJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsJTIwJTNEJTIwTVQ1TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm10NS1zbWFsbCUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZtdDUtc21hbGwlMjIpJTBBYXJ0aWNsZSUyMCUzRCUyMCUyMlVOJTIwT2ZmaXppZXIlMjBzYWd0JTJDJTIwZGFzcyUyMHdlaXRlciUyMHZlcmhhbmRlbHQlMjB3ZXJkZW4lMjBtdXNzJTIwaW4lMjBTeXJpZW4uJTIyJTBBc3VtbWFyeSUyMCUzRCUyMCUyMldlaXRlciUyMFZlcmhhbmRsdW5nJTIwaW4lMjBTeXJpZW4uJTIyJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKGFydGljbGUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQWxhYmVscyUyMCUzRCUyMHRva2VuaXplcih0ZXh0X3RhcmdldCUzRHN1bW1hcnklMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dF9pZHMlM0RpbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQlMkMlMjBkZWNvZGVyX2lucHV0X2lkcyUzRGxhYmVscyU1QiUyMmlucHV0X2lkcyUyMiU1RCklMEFoaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function gu($){let c,T,g,d,M;return d=new V({props:{code:"JTIzJTIwT24lMjBhJTIwNCUyMEdQVSUyMG1hY2hpbmUlMjB3aXRoJTIwbXQ1LXhsJTNBJTBBbW9kZWwlMjAlM0QlMjBNVDVGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMk10NS14bCUyMiklMEFkZXZpY2VfbWFwJTIwJTNEJTIwJTdCJTBBJTIwJTIwJTIwJTIwMCUzQSUyMCU1QjAlMkMlMjAxJTJDJTIwMiU1RCUyQyUwQSUyMCUyMCUyMCUyMDElM0ElMjAlNUIzJTJDJTIwNCUyQyUyMDUlMkMlMjA2JTJDJTIwNyUyQyUyMDglMkMlMjA5JTVEJTJDJTBBJTIwJTIwJTIwJTIwMiUzQSUyMCU1QjEwJTJDJTIwMTElMkMlMjAxMiUyQyUyMDEzJTJDJTIwMTQlMkMlMjAxNSUyQyUyMDE2JTVEJTJDJTBBJTIwJTIwJTIwJTIwMyUzQSUyMCU1QjE3JTJDJTIwMTglMkMlMjAxOSUyQyUyMDIwJTJDJTIwMjElMkMlMjAyMiUyQyUyMDIzJTVEJTJDJTBBJTdEJTBBbW9kZWwucGFyYWxsZWxpemUoZGV2aWNlX21hcCklMjAlMjAlMjMlMjBTcGxpdHMlMjB0aGUlMjBtb2RlbCUyMGFjcm9zcyUyMHNldmVyYWwlMjBkZXZpY2VzJTBBbW9kZWwuZGVwYXJhbGxlbGl6ZSgpJTIwJTIwJTIzJTIwUHV0JTIwdGhlJTIwbW9kZWwlMjBiYWNrJTIwb24lMjBjcHUlMjBhbmQlMjBjbGVhbnMlMjBtZW1vcnklMjBieSUyMGNhbGxpbmclMjB0b3JjaC5jdWRhLmVtcHR5X2NhY2hlKCk=",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function _u($){let c,T,g,d,M;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"),M=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 R=r(g);d=i(R,"Module"),R.forEach(s),M=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,M)},d(n){n&&s(c)}}}function Mu($){let c,T,g,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBNVDVNb2RlbCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMm10NS1zbWFsbCUyMiklMEFtb2RlbCUyMCUzRCUyME1UNU1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJtdDUtc21hbGwlMjIpJTBBJTBBaW5wdXRfaWRzJTIwJTNEJTIwdG9rZW5pemVyKCUwQSUyMCUyMCUyMCUyMCUyMlN0dWRpZXMlMjBoYXZlJTIwYmVlbiUyMHNob3duJTIwdGhhdCUyMG93bmluZyUyMGElMjBkb2clMjBpcyUyMGdvb2QlMjBmb3IlMjB5b3UlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKS5pbnB1dF9pZHMlMjAlMjAlMjMlMjBCYXRjaCUyMHNpemUlMjAxJTBBZGVjb2Rlcl9pbnB1dF9pZHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIyU3R1ZGllcyUyMHNob3clMjB0aGF0JTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikuaW5wdXRfaWRzJTIwJTIwJTIzJTIwQmF0Y2glMjBzaXplJTIwMSUwQSUwQSUyMyUyMHByZXByb2Nlc3MlM0ElMjBQcmVwZW5kJTIwZGVjb2Rlcl9pbnB1dF9pZHMlMjB3aXRoJTIwc3RhcnQlMjB0b2tlbiUyMHdoaWNoJTIwaXMlMjBwYWQlMjB0b2tlbiUyMGZvciUyME1UNU1vZGVsLiUwQSUyMyUyMFRoaXMlMjBpcyUyMG5vdCUyMG5lZWRlZCUyMGZvciUyMHRvcmNoJ3MlMjBNVDVGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMjBhcyUyMGl0JTIwZG9lcyUyMHRoaXMlMjBpbnRlcm5hbGx5JTIwdXNpbmclMjBsYWJlbHMlMjBhcmcuJTBBZGVjb2Rlcl9pbnB1dF9pZHMlMjAlM0QlMjBtb2RlbC5fc2hpZnRfcmlnaHQoZGVjb2Rlcl9pbnB1dF9pZHMpJTBBJTBBJTIzJTIwZm9yd2FyZCUyMHBhc3MlMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTIwZGVjb2Rlcl9pbnB1dF9pZHMlM0RkZWNvZGVyX2lucHV0X2lkcyklMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function Tu($){let c,T,g,d,M;return d=new V({props:{code:"JTIzJTIwSGVyZSUyMGlzJTIwYW4lMjBleGFtcGxlJTIwb2YlMjBhJTIwZGV2aWNlJTIwbWFwJTIwb24lMjBhJTIwbWFjaGluZSUyMHdpdGglMjA0JTIwR1BVcyUyMHVzaW5nJTIwbXQ1LXhsJTJDJTIwd2hpY2glMjBoYXMlMjBhJTIwdG90YWwlMjBvZiUyMDI0JTIwYXR0ZW50aW9uJTIwbW9kdWxlcyUzQSUwQW1vZGVsJTIwJTNEJTIwTVQ1Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJtdDUteGwlMjIpJTBBZGV2aWNlX21hcCUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMDAlM0ElMjAlNUIwJTJDJTIwMSUyQyUyMDIlNUQlMkMlMEElMjAlMjAlMjAlMjAxJTNBJTIwJTVCMyUyQyUyMDQlMkMlMjA1JTJDJTIwNiUyQyUyMDclMkMlMjA4JTJDJTIwOSU1RCUyQyUwQSUyMCUyMCUyMCUyMDIlM0ElMjAlNUIxMCUyQyUyMDExJTJDJTIwMTIlMkMlMjAxMyUyQyUyMDE0JTJDJTIwMTUlMkMlMjAxNiU1RCUyQyUwQSUyMCUyMCUyMCUyMDMlM0ElMjAlNUIxNyUyQyUyMDE4JTJDJTIwMTklMkMlMjAyMCUyQyUyMDIxJTJDJTIwMjIlMkMlMjAyMyU1RCUyQyUwQSU3RCUwQW1vZGVsLnBhcmFsbGVsaXplKGRldmljZV9tYXAp",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function bu($){let c,T,g,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1UNUZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUyQyUyMEF1dG9Ub2tlbml6ZXIlMEElMEFtb2RlbCUyMCUzRCUyME1UNUZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGbXQ1LXNtYWxsJTIyKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm10NS1zbWFsbCUyMiklMEFhcnRpY2xlJTIwJTNEJTIwJTIyVU4lMjBPZmZpemllciUyMHNhZ3QlMkMlMjBkYXNzJTIwd2VpdGVyJTIwdmVyaGFuZGVsdCUyMHdlcmRlbiUyMG11c3MlMjBpbiUyMFN5cmllbi4lMjIlMEFzdW1tYXJ5JTIwJTNEJTIwJTIyV2VpdGVyJTIwVmVyaGFuZGx1bmclMjBpbiUyMFN5cmllbi4lMjIlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoYXJ0aWNsZSUyQyUyMHRleHRfdGFyZ2V0JTNEc3VtbWFyeSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3M=",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function yu($){let c,T,g,d,M;return d=new V({props:{code:"JTIzJTIwT24lMjBhJTIwNCUyMEdQVSUyMG1hY2hpbmUlMjB3aXRoJTIwbXQ1LXhsJTNBJTBBbW9kZWwlMjAlM0QlMjBNVDVGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMk10NS14bCUyMiklMEFkZXZpY2VfbWFwJTIwJTNEJTIwJTdCJTBBJTIwJTIwJTIwJTIwMCUzQSUyMCU1QjAlMkMlMjAxJTJDJTIwMiU1RCUyQyUwQSUyMCUyMCUyMCUyMDElM0ElMjAlNUIzJTJDJTIwNCUyQyUyMDUlMkMlMjA2JTJDJTIwNyUyQyUyMDglMkMlMjA5JTVEJTJDJTBBJTIwJTIwJTIwJTIwMiUzQSUyMCU1QjEwJTJDJTIwMTElMkMlMjAxMiUyQyUyMDEzJTJDJTIwMTQlMkMlMjAxNSUyQyUyMDE2JTVEJTJDJTBBJTIwJTIwJTIwJTIwMyUzQSUyMCU1QjE3JTJDJTIwMTglMkMlMjAxOSUyQyUyMDIwJTJDJTIwMjElMkMlMjAyMiUyQyUyMDIzJTVEJTJDJTBBJTdEJTBBbW9kZWwucGFyYWxsZWxpemUoZGV2aWNlX21hcCklMjAlMjAlMjMlMjBTcGxpdHMlMjB0aGUlMjBtb2RlbCUyMGFjcm9zcyUyMHNldmVyYWwlMjBkZXZpY2VzJTBBbW9kZWwuZGVwYXJhbGxlbGl6ZSgpJTIwJTIwJTIzJTIwUHV0JTIwdGhlJTIwbW9kZWwlMjBiYWNrJTIwb24lMjBjcHUlMjBhbmQlMjBjbGVhbnMlMjBtZW1vcnklMjBieSUyMGNhbGxpbmclMjB0b3JjaC5jdWRhLmVtcHR5X2NhY2hlKCk=",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function vu($){let c,T,g,d,M;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"),M=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 R=r(g);d=i(R,"Module"),R.forEach(s),M=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,M)},d(n){n&&s(c)}}}function wu($){let c,T,g,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBNVDVGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJtdDUtc21hbGwlMjIpJTBBbW9kZWwlMjAlM0QlMjBNVDVGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMm10NS1zbWFsbCUyMiklMEElMEElMjMlMjB0cmFpbmluZyUwQWlucHV0X2lkcyUyMCUzRCUyMHRva2VuaXplciglMjJUaGUlMjAlM0NleHRyYV9pZF8wJTNFJTIwd2Fsa3MlMjBpbiUyMCUzQ2V4dHJhX2lkXzElM0UlMjBwYXJrJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikuaW5wdXRfaWRzJTBBbGFiZWxzJTIwJTNEJTIwdG9rZW5pemVyKCUyMiUzQ2V4dHJhX2lkXzAlM0UlMjBjdXRlJTIwZG9nJTIwJTNDZXh0cmFfaWRfMSUzRSUyMHRoZSUyMCUzQ2V4dHJhX2lkXzIlM0UlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5pbnB1dF9pZHMlMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cyUwQSUwQSUyMyUyMGluZmVyZW5jZSUwQWlucHV0X2lkcyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjAlMjJzdW1tYXJpemUlM0ElMjBzdHVkaWVzJTIwaGF2ZSUyMHNob3duJTIwdGhhdCUyMG93bmluZyUyMGElMjBkb2clMjBpcyUyMGdvb2QlMjBmb3IlMjB5b3UlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKS5pbnB1dF9pZHMlMjAlMjAlMjMlMjBCYXRjaCUyMHNpemUlMjAxJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0X2lkcyklMEFwcmludCh0b2tlbml6ZXIuZGVjb2RlKG91dHB1dHMlNUIwJTVEJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpKSUwQSUyMyUyMHN0dWRpZXMlMjBoYXZlJTIwc2hvd24lMjB0aGF0JTIwb3duaW5nJTIwYSUyMGRvZyUyMGlzJTIwZ29vZCUyMGZvciUyMHlvdS4=",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function ku($){let c,T,g,d,M;return d=new V({props:{code:"JTIzJTIwSGVyZSUyMGlzJTIwYW4lMjBleGFtcGxlJTIwb2YlMjBhJTIwZGV2aWNlJTIwbWFwJTIwb24lMjBhJTIwbWFjaGluZSUyMHdpdGglMjA0JTIwR1BVcyUyMHVzaW5nJTIwbXQ1LXhsJTJDJTIwd2hpY2glMjBoYXMlMjBhJTIwdG90YWwlMjBvZiUyMDI0JTIwYXR0ZW50aW9uJTIwbW9kdWxlcyUzQSUwQW1vZGVsJTIwJTNEJTIwTVQ1Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJtdDUteGwlMjIpJTBBZGV2aWNlX21hcCUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMDAlM0ElMjAlNUIwJTJDJTIwMSUyQyUyMDIlNUQlMkMlMEElMjAlMjAlMjAlMjAxJTNBJTIwJTVCMyUyQyUyMDQlMkMlMjA1JTJDJTIwNiUyQyUyMDclMkMlMjA4JTJDJTIwOSU1RCUyQyUwQSUyMCUyMCUyMCUyMDIlM0ElMjAlNUIxMCUyQyUyMDExJTJDJTIwMTIlMkMlMjAxMyUyQyUyMDE0JTJDJTIwMTUlMkMlMjAxNiU1RCUyQyUwQSUyMCUyMCUyMCUyMDMlM0ElMjAlNUIxNyUyQyUyMDE4JTJDJTIwMTklMkMlMjAyMCUyQyUyMDIxJTJDJTIwMjIlMkMlMjAyMyU1RCUyQyUwQSU3RCUwQW1vZGVsLnBhcmFsbGVsaXplKGRldmljZV9tYXAp",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function ju($){let c,T,g,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1UNUVuY29kZXJNb2RlbCUyQyUyMEF1dG9Ub2tlbml6ZXIlMEElMEFtb2RlbCUyMCUzRCUyME1UNUVuY29kZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGbXQ1LXNtYWxsJTIyKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm10NS1zbWFsbCUyMiklMEFhcnRpY2xlJTIwJTNEJTIwJTIyVU4lMjBPZmZpemllciUyMHNhZ3QlMkMlMjBkYXNzJTIwd2VpdGVyJTIwdmVyaGFuZGVsdCUyMHdlcmRlbiUyMG11c3MlMjBpbiUyMFN5cmllbi4lMjIlMEFpbnB1dF9pZHMlMjAlM0QlMjB0b2tlbml6ZXIoYXJ0aWNsZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dF9pZHMpJTBBaGlkZGVuX3N0YXRlJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function $u($){let c,T,g,d,M;return d=new V({props:{code:"JTIzJTIwT24lMjBhJTIwNCUyMEdQVSUyMG1hY2hpbmUlMjB3aXRoJTIwbXQ1LXhsJTNBJTBBbW9kZWwlMjAlM0QlMjBNVDVGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMk10NS14bCUyMiklMEFkZXZpY2VfbWFwJTIwJTNEJTIwJTdCJTBBJTIwJTIwJTIwJTIwMCUzQSUyMCU1QjAlMkMlMjAxJTJDJTIwMiU1RCUyQyUwQSUyMCUyMCUyMCUyMDElM0ElMjAlNUIzJTJDJTIwNCUyQyUyMDUlMkMlMjA2JTJDJTIwNyUyQyUyMDglMkMlMjA5JTVEJTJDJTBBJTIwJTIwJTIwJTIwMiUzQSUyMCU1QjEwJTJDJTIwMTElMkMlMjAxMiUyQyUyMDEzJTJDJTIwMTQlMkMlMjAxNSUyQyUyMDE2JTVEJTJDJTBBJTIwJTIwJTIwJTIwMyUzQSUyMCU1QjE3JTJDJTIwMTglMkMlMjAxOSUyQyUyMDIwJTJDJTIwMjElMkMlMjAyMiUyQyUyMDIzJTVEJTJDJTBBJTdEJTBBbW9kZWwucGFyYWxsZWxpemUoZGV2aWNlX21hcCklMjAlMjAlMjMlMjBTcGxpdHMlMjB0aGUlMjBtb2RlbCUyMGFjcm9zcyUyMHNldmVyYWwlMjBkZXZpY2VzJTBBbW9kZWwuZGVwYXJhbGxlbGl6ZSgpJTIwJTIwJTIzJTIwUHV0JTIwdGhlJTIwbW9kZWwlMjBiYWNrJTIwb24lMjBjcHUlMjBhbmQlMjBjbGVhbnMlMjBtZW1vcnklMjBieSUyMGNhbGxpbmclMjB0b3JjaC5jdWRhLmVtcHR5X2NhY2hlKCk=",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function Ju($){let c,T,g,d,M;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"),M=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 R=r(g);d=i(R,"Module"),R.forEach(s),M=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,M)},d(n){n&&s(c)}}}function Uu($){let c,T,g,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBNVDVFbmNvZGVyTW9kZWwlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJtdDUtc21hbGwlMjIpJTBBbW9kZWwlMjAlM0QlMjBNVDVFbmNvZGVyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm10NS1zbWFsbCUyMiklMEFpbnB1dF9pZHMlMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwJTIyU3R1ZGllcyUyMGhhdmUlMjBiZWVuJTIwc2hvd24lMjB0aGF0JTIwb3duaW5nJTIwYSUyMGRvZyUyMGlzJTIwZ29vZCUyMGZvciUyMHlvdSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMEEpLmlucHV0X2lkcyUyMCUyMCUyMyUyMEJhdGNoJTIwc2l6ZSUyMDElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRfaWRzJTNEaW5wdXRfaWRzKSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function Eu($){let c,T,g,d,M;return d=new V({props:{code:"JTIzJTIwSGVyZSUyMGlzJTIwYW4lMjBleGFtcGxlJTIwb2YlMjBhJTIwZGV2aWNlJTIwbWFwJTIwb24lMjBhJTIwbWFjaGluZSUyMHdpdGglMjA0JTIwR1BVcyUyMHVzaW5nJTIwbXQ1LXhsJTJDJTIwd2hpY2glMjBoYXMlMjBhJTIwdG90YWwlMjBvZiUyMDI0JTIwYXR0ZW50aW9uJTIwbW9kdWxlcyUzQSUwQW1vZGVsJTIwJTNEJTIwTVQ1Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJtdDUteGwlMjIpJTBBZGV2aWNlX21hcCUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMDAlM0ElMjAlNUIwJTJDJTIwMSUyQyUyMDIlNUQlMkMlMEElMjAlMjAlMjAlMjAxJTNBJTIwJTVCMyUyQyUyMDQlMkMlMjA1JTJDJTIwNiUyQyUyMDclMkMlMjA4JTJDJTIwOSU1RCUyQyUwQSUyMCUyMCUyMCUyMDIlM0ElMjAlNUIxMCUyQyUyMDExJTJDJTIwMTIlMkMlMjAxMyUyQyUyMDE0JTJDJTIwMTUlMkMlMjAxNiU1RCUyQyUwQSUyMCUyMCUyMCUyMDMlM0ElMjAlNUIxNyUyQyUyMDE4JTJDJTIwMTklMkMlMjAyMCUyQyUyMDIxJTJDJTIwMjIlMkMlMjAyMyU1RCUyQyUwQSU3RCUwQW1vZGVsLnBhcmFsbGVsaXplKGRldmljZV9tYXAp",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function Iu($){let c,T,g,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGTVQ1TW9kZWwlMkMlMjBBdXRvVG9rZW5pemVyJTBBJTBBbW9kZWwlMjAlM0QlMjBURk1UNU1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZtdDUtc21hbGwlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGbXQ1LXNtYWxsJTIyKSUwQWFydGljbGUlMjAlM0QlMjAlMjJVTiUyME9mZml6aWVyJTIwc2FndCUyQyUyMGRhc3MlMjB3ZWl0ZXIlMjB2ZXJoYW5kZWx0JTIwd2VyZGVuJTIwbXVzcyUyMGluJTIwU3lyaWVuLiUyMiUwQXN1bW1hcnklMjAlM0QlMjAlMjJXZWl0ZXIlMjBWZXJoYW5kbHVuZyUyMGluJTIwU3lyaWVuLiUyMiUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihhcnRpY2xlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFsYWJlbHMlMjAlM0QlMjB0b2tlbml6ZXIodGV4dF90YXJnZXQlM0RzdW1tYXJ5JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRfaWRzJTNEaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTJDJTIwZGVjb2Rlcl9pbnB1dF9pZHMlM0RsYWJlbHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQpJTBBaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function zu($){let c,T,g,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGTVQ1Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsJTIwJTNEJTIwVEZNVDVGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm10NS1zbWFsbCUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZtdDUtc21hbGwlMjIpJTBBYXJ0aWNsZSUyMCUzRCUyMCUyMlVOJTIwT2ZmaXppZXIlMjBzYWd0JTJDJTIwZGFzcyUyMHdlaXRlciUyMHZlcmhhbmRlbHQlMjB3ZXJkZW4lMjBtdXNzJTIwaW4lMjBTeXJpZW4uJTIyJTBBc3VtbWFyeSUyMCUzRCUyMCUyMldlaXRlciUyMFZlcmhhbmRsdW5nJTIwaW4lMjBTeXJpZW4uJTIyJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKGFydGljbGUlMkMlMjB0ZXh0X3RhcmdldCUzRHN1bW1hcnklMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3Nz",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function xu($){let c,T,g,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGTVQ1RW5jb2Rlck1vZGVsJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsJTIwJTNEJTIwVEZNVDVFbmNvZGVyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm10NS1zbWFsbCUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZtdDUtc21hbGwlMjIpJTBBYXJ0aWNsZSUyMCUzRCUyMCUyMlVOJTIwT2ZmaXppZXIlMjBzYWd0JTJDJTIwZGFzcyUyMHdlaXRlciUyMHZlcmhhbmRlbHQlMjB3ZXJkZW4lMjBtdXNzJTIwaW4lMjBTeXJpZW4uJTIyJTBBaW5wdXRfaWRzJTIwJTNEJTIwdG9rZW5pemVyKGFydGljbGUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKS5pbnB1dF9pZHMlMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRfaWRzKSUwQWhpZGRlbl9zdGF0ZSUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function Fu($){let c,T,g,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZsYXhNVDVNb2RlbCUyQyUyMEF1dG9Ub2tlbml6ZXIlMEElMEFtb2RlbCUyMCUzRCUyMEZsYXhNVDVNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGbXQ1LXNtYWxsJTIyKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm10NS1zbWFsbCUyMiklMEElMEFhcnRpY2xlJTIwJTNEJTIwJTIyVU4lMjBPZmZpemllciUyMHNhZ3QlMkMlMjBkYXNzJTIwd2VpdGVyJTIwdmVyaGFuZGVsdCUyMHdlcmRlbiUyMG11c3MlMjBpbiUyMFN5cmllbi4lMjIlMEFzdW1tYXJ5JTIwJTNEJTIwJTIyV2VpdGVyJTIwVmVyaGFuZGx1bmclMjBpbiUyMFN5cmllbi4lMjIlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoYXJ0aWNsZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIybnAlMjIpJTBBJTBBZGVjb2Rlcl9pbnB1dF9pZHMlMjAlM0QlMjB0b2tlbml6ZXIodGV4dF90YXJnZXQlM0RzdW1tYXJ5JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJucCUyMikuaW5wdXRfaWRzJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0X2lkcyUzRGlucHV0cyU1QiUyMmlucHV0X2lkcyUyMiU1RCUyQyUyMGRlY29kZXJfaW5wdXRfaWRzJTNEZGVjb2Rlcl9pbnB1dF9pZHMpJTBBaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function Cu($){let c,T,g,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZsYXhNVDVGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMkMlMjBBdXRvVG9rZW5pemVyJTBBJTBBbW9kZWwlMjAlM0QlMjBGbGF4TVQ1Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZtdDUtc21hbGwlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGbXQ1LXNtYWxsJTIyKSUwQSUwQWFydGljbGUlMjAlM0QlMjAlMjJVTiUyME9mZml6aWVyJTIwc2FndCUyQyUyMGRhc3MlMjB3ZWl0ZXIlMjB2ZXJoYW5kZWx0JTIwd2VyZGVuJTIwbXVzcyUyMGluJTIwU3lyaWVuLiUyMiUwQXN1bW1hcnklMjAlM0QlMjAlMjJXZWl0ZXIlMjBWZXJoYW5kbHVuZyUyMGluJTIwU3lyaWVuLiUyMiUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihhcnRpY2xlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJucCUyMiklMEElMEFkZWNvZGVyX2lucHV0X2lkcyUyMCUzRCUyMHRva2VuaXplcih0ZXh0X3RhcmdldCUzRHN1bW1hcnklMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMm5wJTIyKS5pbnB1dF9pZHMlMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjBkZWNvZGVyX2lucHV0X2lkcyUzRGRlY29kZXJfaW5wdXRfaWRzKSUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function Zu($){let c,T,g,d,M;return d=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZsYXhUNUVuY29kZXJNb2RlbCUyQyUyMEF1dG9Ub2tlbml6ZXIlMEElMEFtb2RlbCUyMCUzRCUyMEZsYXhUNUVuY29kZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGbXQ1LXNtYWxsJTIyKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm10NS1zbWFsbCUyMiklMEElMEFhcnRpY2xlJTIwJTNEJTIwJTIyVU4lMjBPZmZpemllciUyMHNhZ3QlMkMlMjBkYXNzJTIwd2VpdGVyJTIwdmVyaGFuZGVsdCUyMHdlcmRlbiUyMG11c3MlMjBpbiUyMFN5cmllbi4lMjIlMEFzdW1tYXJ5JTIwJTNEJTIwJTIyV2VpdGVyJTIwVmVyaGFuZGx1bmclMjBpbiUyMFN5cmllbi4lMjIlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoYXJ0aWNsZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIybnAlMjIpJTBBJTBBZGVjb2Rlcl9pbnB1dF9pZHMlMjAlM0QlMjB0b2tlbml6ZXIodGV4dF90YXJnZXQlM0RzdW1tYXJ5JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJucCUyMikuaW5wdXRfaWRzJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0X2lkcyUzRGlucHV0cyU1QiUyMmlucHV0X2lkcyUyMiU1RCklMEFoaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",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),y(d.$$.fragment,n)},m(n,u){_(n,c,u),e(c,T),_(n,g,u),v(d,n,u),M=!0},p:G,i(n){M||(w(d.$$.fragment,n),M=!0)},o(n){k(d.$$.fragment,n),M=!1},d(n){n&&s(c),n&&s(g),j(d,n)}}}function Gu($){let c,T,g,d,M,n,u,R,al,Fa,pe,rn,ln,sm,rl,dn,cn,nm,Ca,me,ze,ao,Ut,ll,ro,il,Za,xe,dl,Et,cl,pl,Ga,pn,ml,Va,mn,lo,hl,Wa,Fe,ul,It,fl,gl,Ba,hn,_l,Ra,N,io,co,zt,Ml,Tl,po,mo,xt,bl,yl,ho,uo,Ft,vl,wl,fo,go,Ct,kl,jl,_o,un,Zt,$l,Jl,Na,oe,Ul,Gt,El,Il,Vt,zl,xl,Xa,he,Ce,Mo,Wt,Fl,To,Cl,qa,Ze,bo,fn,Zl,Gl,yo,gn,Vl,Aa,ue,Ge,vo,Bt,Wl,wo,Bl,Sa,L,Rt,Rl,Y,Nl,_n,Xl,ql,Mn,Al,Sl,Nt,Ql,Dl,Hl,fe,Pl,Tn,Ll,Yl,bn,Ol,Kl,Qa,ge,Ve,ko,Xt,ei,jo,ti,Da,z,qt,si,At,ni,St,oi,ai,ri,Qt,li,yn,ii,di,ci,ae,Dt,pi,$o,mi,hi,Ht,vn,ui,Jo,fi,gi,wn,_i,Uo,Mi,Ti,We,Pt,bi,Eo,yi,vi,Be,Lt,wi,Io,ki,ji,Re,Yt,$i,Ot,Ji,zo,Ui,Ei,Ha,Ne,Ii,kn,zi,xi,Pa,_e,Xe,xo,Kt,Fi,Fo,Ci,La,W,es,Zi,Me,Gi,Co,Vi,Wi,ts,Bi,Ri,Ni,ss,Xi,jn,qi,Ai,Si,re,ns,Qi,Zo,Di,Hi,os,$n,Pi,Go,Li,Yi,Jn,Oi,Vo,Ki,ed,qe,as,td,Wo,sd,Ya,Ae,nd,Un,od,ad,Oa,Te,Se,Bo,rs,rd,Ro,ld,Ka,U,ls,id,No,dd,cd,is,pd,ds,md,hd,ud,cs,fd,En,gd,_d,Md,ps,Td,ms,bd,yd,vd,Qe,wd,le,hs,kd,Xo,jd,$d,De,Jd,A,us,Ud,be,Ed,In,Id,zd,qo,xd,Fd,Cd,He,Zd,Pe,Gd,S,fs,Vd,Ao,Wd,Bd,So,Rd,Nd,Le,er,ye,Ye,Qo,gs,Xd,Do,qd,tr,E,_s,Ad,Ms,Sd,Ho,Qd,Dd,Hd,Ts,Pd,bs,Ld,Yd,Od,ys,Kd,zn,ec,tc,sc,vs,nc,ws,oc,ac,rc,Oe,lc,ie,ks,ic,Po,dc,cc,Ke,pc,Q,js,mc,ve,hc,xn,uc,fc,Lo,gc,_c,Mc,et,Tc,tt,bc,D,$s,yc,Yo,vc,wc,Oo,kc,jc,st,sr,we,nt,Ko,Js,$c,ea,Jc,nr,I,Us,Uc,ta,Ec,Ic,Es,zc,Is,xc,Fc,Cc,zs,Zc,Fn,Gc,Vc,Wc,xs,Bc,Fs,Rc,Nc,Xc,ot,qc,de,Cs,Ac,sa,Sc,Qc,at,Dc,H,Zs,Hc,ke,Pc,Cn,Lc,Yc,na,Oc,Kc,ep,rt,tp,lt,sp,P,Gs,np,oa,op,ap,aa,rp,lp,it,or,je,dt,ra,Vs,ip,la,dp,ar,O,Ws,cp,Bs,pp,Zn,mp,hp,up,ct,rr,$e,pt,ia,Rs,fp,da,gp,lr,K,Ns,_p,Xs,Mp,Gn,Tp,bp,yp,mt,ir,Je,ht,ca,qs,vp,pa,wp,dr,ee,As,kp,Ss,jp,Vn,$p,Jp,Up,ut,cr,Ue,ft,ma,Qs,Ep,ha,Ip,pr,te,Ds,zp,Hs,xp,Wn,Fp,Cp,Zp,gt,mr,Ee,_t,ua,Ps,Gp,fa,Vp,hr,se,Ls,Wp,Ys,Bp,Bn,Rp,Np,Xp,Mt,ur,Ie,Tt,ga,Os,qp,_a,Ap,fr,ne,Ks,Sp,en,Qp,Rn,Dp,Hp,Pp,bt,gr;return n=new B({}),Ut=new B({}),Wt=new B({}),Bt=new B({}),Rt=new J({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.30.0/en/model_doc/t5#transformers.T5Model">T5Model</a> or <a href="/docs/transformers/v4.30.0/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.30.0/src/transformers/models/mt5/configuration_mt5.py#L26"}}),Xt=new B({}),qt=new J({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.30.0/src/transformers/models/t5/tokenization_t5.py#L55"}}),Dt=new J({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.30.0/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>
`}}),Pt=new J({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.30.0/src/transformers/models/t5/tokenization_t5.py#L317"}}),Lt=new J({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.30.0/src/transformers/models/t5/tokenization_t5.py#L234",returnDescription:`
<p>List of zeros.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Yt=new J({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.30.0/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>
`}}),Kt=new B({}),es=new J({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.30.0/src/transformers/models/t5/tokenization_t5_fast.py#L66"}}),ns=new J({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.30.0/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 J({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.30.0/src/transformers/models/t5/tokenization_t5_fast.py#L216",returnDescription:`
<p>List of zeros.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),rs=new B({}),ls=new J({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.30.0/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.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mt5/modeling_mt5.py#L1296"}}),Qe=new Z({props:{anchor:"transformers.MT5Model.example",$$slots:{default:[fu]},$$scope:{ctx:$}}}),hs=new J({props:{name:"deparallelize",anchor:"transformers.MT5Model.deparallelize",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mt5/modeling_mt5.py#L1372"}}),De=new Z({props:{anchor:"transformers.MT5Model.deparallelize.example",$$slots:{default:[gu]},$$scope:{ctx:$}}}),us=new J({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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mt5/modeling_mt5.py#L1414",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/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.30.0/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.30.0/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),He=new tm({props:{$$slots:{default:[_u]},$$scope:{ctx:$}}}),Pe=new Z({props:{anchor:"transformers.MT5Model.forward.example",$$slots:{default:[Mu]},$$scope:{ctx:$}}}),fs=new J({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.30.0/src/transformers/models/mt5/modeling_mt5.py#L1352"}}),Le=new Z({props:{anchor:"transformers.MT5Model.parallelize.example",$$slots:{default:[Tu]},$$scope:{ctx:$}}}),gs=new B({}),_s=new J({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.30.0/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.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mt5/modeling_mt5.py#L1531"}}),Oe=new Z({props:{anchor:"transformers.MT5ForConditionalGeneration.example",$$slots:{default:[bu]},$$scope:{ctx:$}}}),ks=new J({props:{name:"deparallelize",anchor:"transformers.MT5ForConditionalGeneration.deparallelize",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mt5/modeling_mt5.py#L1609"}}),Ke=new Z({props:{anchor:"transformers.MT5ForConditionalGeneration.deparallelize.example",$$slots:{default:[yu]},$$scope:{ctx:$}}}),js=new J({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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.0/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.30.0/src/transformers/models/mt5/modeling_mt5.py#L1651",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/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.30.0/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.30.0/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:[vu]},$$scope:{ctx:$}}}),tt=new Z({props:{anchor:"transformers.MT5ForConditionalGeneration.forward.example",$$slots:{default:[wu]},$$scope:{ctx:$}}}),$s=new J({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.30.0/src/transformers/models/mt5/modeling_mt5.py#L1588"}}),st=new Z({props:{anchor:"transformers.MT5ForConditionalGeneration.parallelize.example",$$slots:{default:[ku]},$$scope:{ctx:$}}}),Js=new B({}),Us=new J({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.30.0/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.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mt5/modeling_mt5.py#L1877"}}),ot=new Z({props:{anchor:"transformers.MT5EncoderModel.example",$$slots:{default:[ju]},$$scope:{ctx:$}}}),Cs=new J({props:{name:"deparallelize",anchor:"transformers.MT5EncoderModel.deparallelize",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mt5/modeling_mt5.py#L1938"}}),at=new Z({props:{anchor:"transformers.MT5EncoderModel.deparallelize.example",$$slots:{default:[$u]},$$scope:{ctx:$}}}),Zs=new J({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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mt5/modeling_mt5.py#L1973",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/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.30.0/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.30.0/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:[Ju]},$$scope:{ctx:$}}}),lt=new Z({props:{anchor:"transformers.MT5EncoderModel.forward.example",$$slots:{default:[Uu]},$$scope:{ctx:$}}}),Gs=new J({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.30.0/src/transformers/models/mt5/modeling_mt5.py#L1919"}}),it=new Z({props:{anchor:"transformers.MT5EncoderModel.parallelize.example",$$slots:{default:[Eu]},$$scope:{ctx:$}}}),Vs=new B({}),Ws=new J({props:{name:"class transformers.TFMT5Model",anchor:"transformers.TFMT5Model",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mt5/modeling_tf_mt5.py#L27"}}),ct=new Z({props:{anchor:"transformers.TFMT5Model.example",$$slots:{default:[Iu]},$$scope:{ctx:$}}}),Rs=new B({}),Ns=new J({props:{name:"class transformers.TFMT5ForConditionalGeneration",anchor:"transformers.TFMT5ForConditionalGeneration",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mt5/modeling_tf_mt5.py#L51"}}),mt=new Z({props:{anchor:"transformers.TFMT5ForConditionalGeneration.example",$$slots:{default:[zu]},$$scope:{ctx:$}}}),qs=new B({}),As=new J({props:{name:"class transformers.TFMT5EncoderModel",anchor:"transformers.TFMT5EncoderModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mt5/modeling_tf_mt5.py#L75"}}),ut=new Z({props:{anchor:"transformers.TFMT5EncoderModel.example",$$slots:{default:[xu]},$$scope:{ctx:$}}}),Qs=new B({}),Ds=new J({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.30.0/src/transformers/models/mt5/modeling_flax_mt5.py#L42"}}),gt=new Z({props:{anchor:"transformers.FlaxMT5Model.example",$$slots:{default:[Fu]},$$scope:{ctx:$}}}),Ps=new B({}),Ls=new J({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.30.0/src/transformers/models/mt5/modeling_flax_mt5.py#L94"}}),Mt=new Z({props:{anchor:"transformers.FlaxMT5ForConditionalGeneration.example",$$slots:{default:[Cu]},$$scope:{ctx:$}}}),Os=new B({}),Ks=new J({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.30.0/src/transformers/models/mt5/modeling_flax_mt5.py#L68"}}),bt=new Z({props:{anchor:"transformers.FlaxMT5EncoderModel.example",$$slots:{default:[Zu]},$$scope:{ctx:$}}}),{c(){c=o("meta"),T=p(),g=o("h1"),d=o("a"),M=o("span"),b(n.$$.fragment),u=p(),R=o("span"),al=l("mT5"),Fa=p(),pe=o("div"),rn=o("a"),ln=o("img"),rl=p(),dn=o("a"),cn=o("img"),Ca=p(),me=o("h2"),ze=o("a"),ao=o("span"),b(Ut.$$.fragment),ll=p(),ro=o("span"),il=l("Overview"),Za=p(),xe=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.`),Ga=p(),pn=o("p"),ml=l("The abstract from the paper is the following:"),Va=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.`),Wa=p(),Fe=o("p"),ul=l("Note: mT5 was only pre-trained on "),It=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.`),Ba=p(),hn=o("p"),_l=l("Google has released the following variants:"),Ra=p(),N=o("ul"),io=o("li"),co=o("p"),zt=o("a"),Ml=l("google/mt5-small"),Tl=p(),po=o("li"),mo=o("p"),xt=o("a"),bl=l("google/mt5-base"),yl=p(),ho=o("li"),uo=o("p"),Ft=o("a"),vl=l("google/mt5-large"),wl=p(),fo=o("li"),go=o("p"),Ct=o("a"),kl=l("google/mt5-xl"),jl=p(),_o=o("li"),un=o("p"),Zt=o("a"),$l=l("google/mt5-xxl"),Jl=l("."),Na=p(),oe=o("p"),Ul=l("This model was contributed by "),Gt=o("a"),El=l("patrickvonplaten"),Il=l(`. The original code can be
found `),Vt=o("a"),zl=l("here"),xl=l("."),Xa=p(),he=o("h2"),Ce=o("a"),Mo=o("span"),b(Wt.$$.fragment),Fl=p(),To=o("span"),Cl=l("Documentation resources"),qa=p(),Ze=o("ul"),bo=o("li"),fn=o("a"),Zl=l("Translation task guide"),Gl=p(),yo=o("li"),gn=o("a"),Vl=l("Summarization task guide"),Aa=p(),ue=o("h2"),Ge=o("a"),vo=o("span"),b(Bt.$$.fragment),Wl=p(),wo=o("span"),Bl=l("MT5Config"),Sa=p(),L=o("div"),b(Rt.$$.fragment),Rl=p(),Y=o("p"),Nl=l("This is the configuration class to store the configuration of a "),_n=o("a"),Xl=l("MT5Model"),ql=l(" or a "),Mn=o("a"),Al=l("TFMT5Model"),Sl=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
`),Nt=o("a"),Ql=l("google/mt5-small"),Dl=l(" architecture."),Hl=p(),fe=o("p"),Pl=l("Configuration objects inherit from "),Tn=o("a"),Ll=l("PretrainedConfig"),Yl=l(` and can be used to control the model outputs. Read the
documentation from `),bn=o("a"),Ol=l("PretrainedConfig"),Kl=l(" for more information."),Qa=p(),ge=o("h2"),Ve=o("a"),ko=o("span"),b(Xt.$$.fragment),ei=p(),jo=o("span"),ti=l("MT5Tokenizer"),Da=p(),z=o("div"),b(qt.$$.fragment),si=p(),At=o("p"),ni=l("Construct a T5 tokenizer. Based on "),St=o("a"),oi=l("SentencePiece"),ai=l("."),ri=p(),Qt=o("p"),li=l("This tokenizer inherits from "),yn=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(Dt.$$.fragment),pi=p(),$o=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(),Ht=o("ul"),vn=o("li"),ui=l("single sequence: "),Jo=o("code"),fi=l("X </s>"),gi=p(),wn=o("li"),_i=l("pair of sequences: "),Uo=o("code"),Mi=l("A </s> B </s>"),Ti=p(),We=o("div"),b(Pt.$$.fragment),bi=p(),Eo=o("p"),yi=l("Converts a sequence of tokens (string) in a single string."),vi=p(),Be=o("div"),b(Lt.$$.fragment),wi=p(),Io=o("p"),ki=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.`),ji=p(),Re=o("div"),b(Yt.$$.fragment),$i=p(),Ot=o("p"),Ji=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 `),zo=o("code"),Ui=l("prepare_for_model"),Ei=l(" method."),Ha=p(),Ne=o("p"),Ii=l("See "),kn=o("a"),zi=l("T5Tokenizer"),xi=l(" for all details."),Pa=p(),_e=o("h2"),Xe=o("a"),xo=o("span"),b(Kt.$$.fragment),Fi=p(),Fo=o("span"),Ci=l("MT5TokenizerFast"),La=p(),W=o("div"),b(es.$$.fragment),Zi=p(),Me=o("p"),Gi=l("Construct a \u201Cfast\u201D T5 tokenizer (backed by HuggingFace\u2019s "),Co=o("em"),Vi=l("tokenizers"),Wi=l(` library). Based on
`),ts=o("a"),Bi=l("Unigram"),Ri=l("."),Ni=p(),ss=o("p"),Xi=l("This tokenizer inherits from "),jn=o("a"),qi=l("PreTrainedTokenizerFast"),Ai=l(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Si=p(),re=o("div"),b(ns.$$.fragment),Qi=p(),Zo=o("p"),Di=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(),os=o("ul"),$n=o("li"),Pi=l("single sequence: "),Go=o("code"),Li=l("X </s>"),Yi=p(),Jn=o("li"),Oi=l("pair of sequences: "),Vo=o("code"),Ki=l("A </s> B </s>"),ed=p(),qe=o("div"),b(as.$$.fragment),td=p(),Wo=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(),Ae=o("p"),nd=l("See "),Un=o("a"),od=l("T5TokenizerFast"),ad=l(" for all details."),Oa=p(),Te=o("h2"),Se=o("a"),Bo=o("span"),b(rs.$$.fragment),rd=p(),Ro=o("span"),ld=l("MT5Model"),Ka=p(),U=o("div"),b(ls.$$.fragment),id=p(),No=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.)`),Md=p(),ps=o("p"),Td=l("This model is also a PyTorch "),ms=o("a"),bd=l("torch.nn.Module"),yd=l(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),vd=p(),b(Qe.$$.fragment),wd=p(),le=o("div"),b(hs.$$.fragment),kd=p(),Xo=o("p"),jd=l("Moves the model to cpu from a model parallel state."),$d=p(),b(De.$$.fragment),Jd=p(),A=o("div"),b(us.$$.fragment),Ud=p(),be=o("p"),Ed=l("The "),In=o("a"),Id=l("MT5Model"),zd=l(" forward method, overrides the "),qo=o("code"),xd=l("__call__"),Fd=l(" special method."),Cd=p(),b(He.$$.fragment),Zd=p(),b(Pe.$$.fragment),Gd=p(),S=o("div"),b(fs.$$.fragment),Vd=p(),Ao=o("p"),Wd=l("This is an experimental feature and is a subject to change at a moment\u2019s notice."),Bd=p(),So=o("p"),Rd=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.`),Nd=p(),b(Le.$$.fragment),er=p(),ye=o("h2"),Ye=o("a"),Qo=o("span"),b(gs.$$.fragment),Xd=p(),Do=o("span"),qd=l("MT5ForConditionalGeneration"),tr=p(),E=o("div"),b(_s.$$.fragment),Ad=p(),Ms=o("p"),Sd=l("MT5 Model with a "),Ho=o("code"),Qd=l("language modeling"),Dd=l(" head on top."),Hd=p(),Ts=o("p"),Pd=l("The MT5 model was proposed in "),bs=o("a"),Ld=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.`),Od=p(),ys=o("p"),Kd=l("This model inherits from "),zn=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(),vs=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(Oe.$$.fragment),lc=p(),ie=o("div"),b(ks.$$.fragment),ic=p(),Po=o("p"),dc=l("Moves the model to cpu from a model parallel state."),cc=p(),b(Ke.$$.fragment),pc=p(),Q=o("div"),b(js.$$.fragment),mc=p(),ve=o("p"),hc=l("The "),xn=o("a"),uc=l("MT5ForConditionalGeneration"),fc=l(" forward method, overrides the "),Lo=o("code"),gc=l("__call__"),_c=l(" special method."),Mc=p(),b(et.$$.fragment),Tc=p(),b(tt.$$.fragment),bc=p(),D=o("div"),b($s.$$.fragment),yc=p(),Yo=o("p"),vc=l("This is an experimental feature and is a subject to change at a moment\u2019s notice."),wc=p(),Oo=o("p"),kc=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.`),jc=p(),b(st.$$.fragment),sr=p(),we=o("h2"),nt=o("a"),Ko=o("span"),b(Js.$$.fragment),$c=p(),ea=o("span"),Jc=l("MT5EncoderModel"),nr=p(),I=o("div"),b(Us.$$.fragment),Uc=p(),ta=o("p"),Ec=l("The bare MT5 Model transformer outputting encoder\u2019s raw hidden-states without any specific head on top."),Ic=p(),Es=o("p"),zc=l("The MT5 model was proposed in "),Is=o("a"),xc=l(`Exploring the Limits of Transfer Learning with a Unified Text-to-Text
Transformer`),Fc=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(),zs=o("p"),Zc=l("This model inherits from "),Fn=o("a"),Gc=l("PreTrainedModel"),Vc=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.)`),Wc=p(),xs=o("p"),Bc=l("This model is also a PyTorch "),Fs=o("a"),Rc=l("torch.nn.Module"),Nc=l(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Xc=p(),b(ot.$$.fragment),qc=p(),de=o("div"),b(Cs.$$.fragment),Ac=p(),sa=o("p"),Sc=l("Moves the model to cpu from a model parallel state."),Qc=p(),b(at.$$.fragment),Dc=p(),H=o("div"),b(Zs.$$.fragment),Hc=p(),ke=o("p"),Pc=l("The "),Cn=o("a"),Lc=l("MT5EncoderModel"),Yc=l(" forward method, overrides the "),na=o("code"),Oc=l("__call__"),Kc=l(" special method."),ep=p(),b(rt.$$.fragment),tp=p(),b(lt.$$.fragment),sp=p(),P=o("div"),b(Gs.$$.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(),je=o("h2"),dt=o("a"),ra=o("span"),b(Vs.$$.fragment),ip=p(),la=o("span"),dp=l("TFMT5Model"),ar=p(),O=o("div"),b(Ws.$$.fragment),cp=p(),Bs=o("p"),pp=l("This class overrides "),Zn=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(),$e=o("h2"),pt=o("a"),ia=o("span"),b(Rs.$$.fragment),fp=p(),da=o("span"),gp=l("TFMT5ForConditionalGeneration"),lr=p(),K=o("div"),b(Ns.$$.fragment),_p=p(),Xs=o("p"),Mp=l("This class overrides "),Gn=o("a"),Tp=l("TFT5ForConditionalGeneration"),bp=l(`. Please check the superclass for the appropriate
documentation alongside usage examples.`),yp=p(),b(mt.$$.fragment),ir=p(),Je=o("h2"),ht=o("a"),ca=o("span"),b(qs.$$.fragment),vp=p(),pa=o("span"),wp=l("TFMT5EncoderModel"),dr=p(),ee=o("div"),b(As.$$.fragment),kp=p(),Ss=o("p"),jp=l("This class overrides "),Vn=o("a"),$p=l("TFT5EncoderModel"),Jp=l(`. Please check the superclass for the appropriate documentation alongside
usage examples.`),Up=p(),b(ut.$$.fragment),cr=p(),Ue=o("h2"),ft=o("a"),ma=o("span"),b(Qs.$$.fragment),Ep=p(),ha=o("span"),Ip=l("FlaxMT5Model"),pr=p(),te=o("div"),b(Ds.$$.fragment),zp=p(),Hs=o("p"),xp=l("This class overrides "),Wn=o("a"),Fp=l("FlaxT5Model"),Cp=l(`. Please check the superclass for the appropriate documentation alongside usage
examples.`),Zp=p(),b(gt.$$.fragment),mr=p(),Ee=o("h2"),_t=o("a"),ua=o("span"),b(Ps.$$.fragment),Gp=p(),fa=o("span"),Vp=l("FlaxMT5ForConditionalGeneration"),hr=p(),se=o("div"),b(Ls.$$.fragment),Wp=p(),Ys=o("p"),Bp=l("This class overrides "),Bn=o("a"),Rp=l("FlaxT5ForConditionalGeneration"),Np=l(`. Please check the superclass for the appropriate
documentation alongside usage examples.`),Xp=p(),b(Mt.$$.fragment),ur=p(),Ie=o("h2"),Tt=o("a"),ga=o("span"),b(Os.$$.fragment),qp=p(),_a=o("span"),Ap=l("FlaxMT5EncoderModel"),fr=p(),ne=o("div"),b(Ks.$$.fragment),Sp=p(),en=o("p"),Qp=l("This class overrides "),Rn=o("a"),Dp=l("FlaxT5EncoderModel"),Hp=l(`. Please check the superclass for the appropriate documentation
alongside usage examples.`),Pp=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 Ma=r(d);M=a(Ma,"SPAN",{});var Ta=r(M);y(n.$$.fragment,Ta),Ta.forEach(s),Ma.forEach(s),u=m(tn),R=a(tn,"SPAN",{});var ba=r(R);al=i(ba,"mT5"),ba.forEach(s),tn.forEach(s),Fa=m(t),pe=a(t,"DIV",{class:!0});var sn=r(pe);rn=a(sn,"A",{href:!0});var ya=r(rn);ln=a(ya,"IMG",{alt:!0,src:!0}),ya.forEach(s),rl=m(sn),dn=a(sn,"A",{href:!0});var va=r(dn);cn=a(va,"IMG",{alt:!0,src:!0}),va.forEach(s),sn.forEach(s),Ca=m(t),me=a(t,"H2",{class:!0});var nn=r(me);ze=a(nn,"A",{id:!0,class:!0,href:!0});var wa=r(ze);ao=a(wa,"SPAN",{});var ka=r(ao);y(Ut.$$.fragment,ka),ka.forEach(s),wa.forEach(s),ll=m(nn),ro=a(nn,"SPAN",{});var ja=r(ro);il=i(ja,"Overview"),ja.forEach(s),nn.forEach(s),Za=m(t),xe=a(t,"P",{});var on=r(xe);dl=i(on,"The mT5 model was presented in "),Et=a(on,"A",{href:!0,rel:!0});var $a=r(Et);cl=i($a,"mT5: A massively multilingual pre-trained text-to-text transformer"),$a.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),Ga=m(t),pn=a(t,"P",{});var Ja=r(pn);ml=i(Ja,"The abstract from the paper is the following:"),Ja.forEach(s),Va=m(t),mn=a(t,"P",{});var Ua=r(mn);lo=a(Ua,"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),Ua.forEach(s),Wa=m(t),Fe=a(t,"P",{});var an=r(Fe);ul=i(an,"Note: mT5 was only pre-trained on "),It=a(an,"A",{href:!0,rel:!0});var Ia=r(It);fl=i(Ia,"mC4"),Ia.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),Ba=m(t),hn=a(t,"P",{});var za=r(hn);_l=i(za,"Google has released the following variants:"),za.forEach(s),Ra=m(t),N=a(t,"UL",{});var q=r(N);io=a(q,"LI",{});var xa=r(io);co=a(xa,"P",{});var om=r(co);zt=a(om,"A",{href:!0,rel:!0});var am=r(zt);Ml=i(am,"google/mt5-small"),am.forEach(s),om.forEach(s),xa.forEach(s),Tl=m(q),po=a(q,"LI",{});var rm=r(po);mo=a(rm,"P",{});var lm=r(mo);xt=a(lm,"A",{href:!0,rel:!0});var im=r(xt);bl=i(im,"google/mt5-base"),im.forEach(s),lm.forEach(s),rm.forEach(s),yl=m(q),ho=a(q,"LI",{});var dm=r(ho);uo=a(dm,"P",{});var cm=r(uo);Ft=a(cm,"A",{href:!0,rel:!0});var pm=r(Ft);vl=i(pm,"google/mt5-large"),pm.forEach(s),cm.forEach(s),dm.forEach(s),wl=m(q),fo=a(q,"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);kl=i(um,"google/mt5-xl"),um.forEach(s),hm.forEach(s),mm.forEach(s),jl=m(q),_o=a(q,"LI",{});var fm=r(_o);un=a(fm,"P",{});var Lp=r(un);Zt=a(Lp,"A",{href:!0,rel:!0});var gm=r(Zt);$l=i(gm,"google/mt5-xxl"),gm.forEach(s),Jl=i(Lp,"."),Lp.forEach(s),fm.forEach(s),q.forEach(s),Na=m(t),oe=a(t,"P",{});var Nn=r(oe);Ul=i(Nn,"This model was contributed by "),Gt=a(Nn,"A",{href:!0,rel:!0});var _m=r(Gt);El=i(_m,"patrickvonplaten"),_m.forEach(s),Il=i(Nn,`. The original code can be
found `),Vt=a(Nn,"A",{href:!0,rel:!0});var Mm=r(Vt);zl=i(Mm,"here"),Mm.forEach(s),xl=i(Nn,"."),Nn.forEach(s),Xa=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);Mo=a(Tm,"SPAN",{});var bm=r(Mo);y(Wt.$$.fragment,bm),bm.forEach(s),Tm.forEach(s),Fl=m(_r),To=a(_r,"SPAN",{});var ym=r(To);Cl=i(ym,"Documentation resources"),ym.forEach(s),_r.forEach(s),qa=m(t),Ze=a(t,"UL",{});var Mr=r(Ze);bo=a(Mr,"LI",{});var vm=r(bo);fn=a(vm,"A",{href:!0});var wm=r(fn);Zl=i(wm,"Translation task guide"),wm.forEach(s),vm.forEach(s),Gl=m(Mr),yo=a(Mr,"LI",{});var km=r(yo);gn=a(km,"A",{href:!0});var jm=r(gn);Vl=i(jm,"Summarization task guide"),jm.forEach(s),km.forEach(s),Mr.forEach(s),Aa=m(t),ue=a(t,"H2",{class:!0});var Tr=r(ue);Ge=a(Tr,"A",{id:!0,class:!0,href:!0});var $m=r(Ge);vo=a($m,"SPAN",{});var Jm=r(vo);y(Bt.$$.fragment,Jm),Jm.forEach(s),$m.forEach(s),Wl=m(Tr),wo=a(Tr,"SPAN",{});var Um=r(wo);Bl=i(Um,"MT5Config"),Um.forEach(s),Tr.forEach(s),Sa=m(t),L=a(t,"DIV",{class:!0});var Xn=r(L);y(Rt.$$.fragment,Xn),Rl=m(Xn),Y=a(Xn,"P",{});var yt=r(Y);Nl=i(yt,"This is the configuration class to store the configuration of a "),_n=a(yt,"A",{href:!0});var Em=r(_n);Xl=i(Em,"MT5Model"),Em.forEach(s),ql=i(yt," or a "),Mn=a(yt,"A",{href:!0});var Im=r(Mn);Al=i(Im,"TFMT5Model"),Im.forEach(s),Sl=i(yt,`. 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
`),Nt=a(yt,"A",{href:!0,rel:!0});var zm=r(Nt);Ql=i(zm,"google/mt5-small"),zm.forEach(s),Dl=i(yt," architecture."),yt.forEach(s),Hl=m(Xn),fe=a(Xn,"P",{});var qn=r(fe);Pl=i(qn,"Configuration objects inherit from "),Tn=a(qn,"A",{href:!0});var xm=r(Tn);Ll=i(xm,"PretrainedConfig"),xm.forEach(s),Yl=i(qn,` and can be used to control the model outputs. Read the
documentation from `),bn=a(qn,"A",{href:!0});var Fm=r(bn);Ol=i(Fm,"PretrainedConfig"),Fm.forEach(s),Kl=i(qn," for more information."),qn.forEach(s),Xn.forEach(s),Qa=m(t),ge=a(t,"H2",{class:!0});var br=r(ge);Ve=a(br,"A",{id:!0,class:!0,href:!0});var Cm=r(Ve);ko=a(Cm,"SPAN",{});var Zm=r(ko);y(Xt.$$.fragment,Zm),Zm.forEach(s),Cm.forEach(s),ei=m(br),jo=a(br,"SPAN",{});var Gm=r(jo);ti=i(Gm,"MT5Tokenizer"),Gm.forEach(s),br.forEach(s),Da=m(t),z=a(t,"DIV",{class:!0});var X=r(z);y(qt.$$.fragment,X),si=m(X),At=a(X,"P",{});var yr=r(At);ni=i(yr,"Construct a T5 tokenizer. Based on "),St=a(yr,"A",{href:!0,rel:!0});var Vm=r(St);oi=i(Vm,"SentencePiece"),Vm.forEach(s),ai=i(yr,"."),yr.forEach(s),ri=m(X),Qt=a(X,"P",{});var vr=r(Qt);li=i(vr,"This tokenizer inherits from "),yn=a(vr,"A",{href:!0});var Wm=r(yn);ii=i(Wm,"PreTrainedTokenizer"),Wm.forEach(s),di=i(vr,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),vr.forEach(s),ci=m(X),ae=a(X,"DIV",{class:!0});var An=r(ae);y(Dt.$$.fragment,An),pi=m(An),$o=a(An,"P",{});var Bm=r($o);mi=i(Bm,`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:`),Bm.forEach(s),hi=m(An),Ht=a(An,"UL",{});var wr=r(Ht);vn=a(wr,"LI",{});var Yp=r(vn);ui=i(Yp,"single sequence: "),Jo=a(Yp,"CODE",{});var Rm=r(Jo);fi=i(Rm,"X </s>"),Rm.forEach(s),Yp.forEach(s),gi=m(wr),wn=a(wr,"LI",{});var Op=r(wn);_i=i(Op,"pair of sequences: "),Uo=a(Op,"CODE",{});var Nm=r(Uo);Mi=i(Nm,"A </s> B </s>"),Nm.forEach(s),Op.forEach(s),wr.forEach(s),An.forEach(s),Ti=m(X),We=a(X,"DIV",{class:!0});var kr=r(We);y(Pt.$$.fragment,kr),bi=m(kr),Eo=a(kr,"P",{});var Xm=r(Eo);yi=i(Xm,"Converts a sequence of tokens (string) in a single string."),Xm.forEach(s),kr.forEach(s),vi=m(X),Be=a(X,"DIV",{class:!0});var jr=r(Be);y(Lt.$$.fragment,jr),wi=m(jr),Io=a(jr,"P",{});var qm=r(Io);ki=i(qm,`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.`),qm.forEach(s),jr.forEach(s),ji=m(X),Re=a(X,"DIV",{class:!0});var $r=r(Re);y(Yt.$$.fragment,$r),$i=m($r),Ot=a($r,"P",{});var Jr=r(Ot);Ji=i(Jr,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),zo=a(Jr,"CODE",{});var Am=r(zo);Ui=i(Am,"prepare_for_model"),Am.forEach(s),Ei=i(Jr," method."),Jr.forEach(s),$r.forEach(s),X.forEach(s),Ha=m(t),Ne=a(t,"P",{});var Ur=r(Ne);Ii=i(Ur,"See "),kn=a(Ur,"A",{href:!0});var Sm=r(kn);zi=i(Sm,"T5Tokenizer"),Sm.forEach(s),xi=i(Ur," for all details."),Ur.forEach(s),Pa=m(t),_e=a(t,"H2",{class:!0});var Er=r(_e);Xe=a(Er,"A",{id:!0,class:!0,href:!0});var Qm=r(Xe);xo=a(Qm,"SPAN",{});var Dm=r(xo);y(Kt.$$.fragment,Dm),Dm.forEach(s),Qm.forEach(s),Fi=m(Er),Fo=a(Er,"SPAN",{});var Hm=r(Fo);Ci=i(Hm,"MT5TokenizerFast"),Hm.forEach(s),Er.forEach(s),La=m(t),W=a(t,"DIV",{class:!0});var ce=r(W);y(es.$$.fragment,ce),Zi=m(ce),Me=a(ce,"P",{});var Sn=r(Me);Gi=i(Sn,"Construct a \u201Cfast\u201D T5 tokenizer (backed by HuggingFace\u2019s "),Co=a(Sn,"EM",{});var Pm=r(Co);Vi=i(Pm,"tokenizers"),Pm.forEach(s),Wi=i(Sn,` library). Based on
`),ts=a(Sn,"A",{href:!0,rel:!0});var Lm=r(ts);Bi=i(Lm,"Unigram"),Lm.forEach(s),Ri=i(Sn,"."),Sn.forEach(s),Ni=m(ce),ss=a(ce,"P",{});var Ir=r(ss);Xi=i(Ir,"This tokenizer inherits from "),jn=a(Ir,"A",{href:!0});var Ym=r(jn);qi=i(Ym,"PreTrainedTokenizerFast"),Ym.forEach(s),Ai=i(Ir,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Ir.forEach(s),Si=m(ce),re=a(ce,"DIV",{class:!0});var Qn=r(re);y(ns.$$.fragment,Qn),Qi=m(Qn),Zo=a(Qn,"P",{});var Om=r(Zo);Di=i(Om,`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:`),Om.forEach(s),Hi=m(Qn),os=a(Qn,"UL",{});var zr=r(os);$n=a(zr,"LI",{});var Kp=r($n);Pi=i(Kp,"single sequence: "),Go=a(Kp,"CODE",{});var Km=r(Go);Li=i(Km,"X </s>"),Km.forEach(s),Kp.forEach(s),Yi=m(zr),Jn=a(zr,"LI",{});var em=r(Jn);Oi=i(em,"pair of sequences: "),Vo=a(em,"CODE",{});var eh=r(Vo);Ki=i(eh,"A </s> B </s>"),eh.forEach(s),em.forEach(s),zr.forEach(s),Qn.forEach(s),ed=m(ce),qe=a(ce,"DIV",{class:!0});var xr=r(qe);y(as.$$.fragment,xr),td=m(xr),Wo=a(xr,"P",{});var th=r(Wo);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),xr.forEach(s),ce.forEach(s),Ya=m(t),Ae=a(t,"P",{});var Fr=r(Ae);nd=i(Fr,"See "),Un=a(Fr,"A",{href:!0});var sh=r(Un);od=i(sh,"T5TokenizerFast"),sh.forEach(s),ad=i(Fr," for all details."),Fr.forEach(s),Oa=m(t),Te=a(t,"H2",{class:!0});var Cr=r(Te);Se=a(Cr,"A",{id:!0,class:!0,href:!0});var nh=r(Se);Bo=a(nh,"SPAN",{});var oh=r(Bo);y(rs.$$.fragment,oh),oh.forEach(s),nh.forEach(s),rd=m(Cr),Ro=a(Cr,"SPAN",{});var ah=r(Ro);ld=i(ah,"MT5Model"),ah.forEach(s),Cr.forEach(s),Ka=m(t),U=a(t,"DIV",{class:!0});var x=r(U);y(ls.$$.fragment,x),id=m(x),No=a(x,"P",{});var rh=r(No);dd=i(rh,"The bare MT5 Model transformer outputting raw hidden-states without any specific head on top."),rh.forEach(s),cd=m(x),is=a(x,"P",{});var Zr=r(is);pd=i(Zr,"The MT5 model was proposed in "),ds=a(Zr,"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(Zr,` 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.`),Zr.forEach(s),ud=m(x),cs=a(x,"P",{});var Gr=r(cs);fd=i(Gr,"This model inherits from "),En=a(Gr,"A",{href:!0});var ih=r(En);gd=i(ih,"PreTrainedModel"),ih.forEach(s),_d=i(Gr,`. 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.)`),Gr.forEach(s),Md=m(x),ps=a(x,"P",{});var Vr=r(ps);Td=i(Vr,"This model is also a PyTorch "),ms=a(Vr,"A",{href:!0,rel:!0});var dh=r(ms);bd=i(dh,"torch.nn.Module"),dh.forEach(s),yd=i(Vr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Vr.forEach(s),vd=m(x),y(Qe.$$.fragment,x),wd=m(x),le=a(x,"DIV",{class:!0});var Dn=r(le);y(hs.$$.fragment,Dn),kd=m(Dn),Xo=a(Dn,"P",{});var ch=r(Xo);jd=i(ch,"Moves the model to cpu from a model parallel state."),ch.forEach(s),$d=m(Dn),y(De.$$.fragment,Dn),Dn.forEach(s),Jd=m(x),A=a(x,"DIV",{class:!0});var vt=r(A);y(us.$$.fragment,vt),Ud=m(vt),be=a(vt,"P",{});var Hn=r(be);Ed=i(Hn,"The "),In=a(Hn,"A",{href:!0});var ph=r(In);Id=i(ph,"MT5Model"),ph.forEach(s),zd=i(Hn," forward method, overrides the "),qo=a(Hn,"CODE",{});var mh=r(qo);xd=i(mh,"__call__"),mh.forEach(s),Fd=i(Hn," special method."),Hn.forEach(s),Cd=m(vt),y(He.$$.fragment,vt),Zd=m(vt),y(Pe.$$.fragment,vt),vt.forEach(s),Gd=m(x),S=a(x,"DIV",{class:!0});var wt=r(S);y(fs.$$.fragment,wt),Vd=m(wt),Ao=a(wt,"P",{});var hh=r(Ao);Wd=i(hh,"This is an experimental feature and is a subject to change at a moment\u2019s notice."),hh.forEach(s),Bd=m(wt),So=a(wt,"P",{});var uh=r(So);Rd=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),Nd=m(wt),y(Le.$$.fragment,wt),wt.forEach(s),x.forEach(s),er=m(t),ye=a(t,"H2",{class:!0});var Wr=r(ye);Ye=a(Wr,"A",{id:!0,class:!0,href:!0});var fh=r(Ye);Qo=a(fh,"SPAN",{});var gh=r(Qo);y(gs.$$.fragment,gh),gh.forEach(s),fh.forEach(s),Xd=m(Wr),Do=a(Wr,"SPAN",{});var _h=r(Do);qd=i(_h,"MT5ForConditionalGeneration"),_h.forEach(s),Wr.forEach(s),tr=m(t),E=a(t,"DIV",{class:!0});var F=r(E);y(_s.$$.fragment,F),Ad=m(F),Ms=a(F,"P",{});var Br=r(Ms);Sd=i(Br,"MT5 Model with a "),Ho=a(Br,"CODE",{});var Mh=r(Ho);Qd=i(Mh,"language modeling"),Mh.forEach(s),Dd=i(Br," head on top."),Br.forEach(s),Hd=m(F),Ts=a(F,"P",{});var Rr=r(Ts);Pd=i(Rr,"The MT5 model was proposed in "),bs=a(Rr,"A",{href:!0,rel:!0});var Th=r(bs);Ld=i(Th,`Exploring the Limits of Transfer Learning with a Unified Text-to-Text
Transformer`),Th.forEach(s),Yd=i(Rr,` 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.`),Rr.forEach(s),Od=m(F),ys=a(F,"P",{});var Nr=r(ys);Kd=i(Nr,"This model inherits from "),zn=a(Nr,"A",{href:!0});var bh=r(zn);ec=i(bh,"PreTrainedModel"),bh.forEach(s),tc=i(Nr,`. 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.)`),Nr.forEach(s),sc=m(F),vs=a(F,"P",{});var Xr=r(vs);nc=i(Xr,"This model is also a PyTorch "),ws=a(Xr,"A",{href:!0,rel:!0});var yh=r(ws);oc=i(yh,"torch.nn.Module"),yh.forEach(s),ac=i(Xr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Xr.forEach(s),rc=m(F),y(Oe.$$.fragment,F),lc=m(F),ie=a(F,"DIV",{class:!0});var Pn=r(ie);y(ks.$$.fragment,Pn),ic=m(Pn),Po=a(Pn,"P",{});var vh=r(Po);dc=i(vh,"Moves the model to cpu from a model parallel state."),vh.forEach(s),cc=m(Pn),y(Ke.$$.fragment,Pn),Pn.forEach(s),pc=m(F),Q=a(F,"DIV",{class:!0});var kt=r(Q);y(js.$$.fragment,kt),mc=m(kt),ve=a(kt,"P",{});var Ln=r(ve);hc=i(Ln,"The "),xn=a(Ln,"A",{href:!0});var wh=r(xn);uc=i(wh,"MT5ForConditionalGeneration"),wh.forEach(s),fc=i(Ln," forward method, overrides the "),Lo=a(Ln,"CODE",{});var kh=r(Lo);gc=i(kh,"__call__"),kh.forEach(s),_c=i(Ln," special method."),Ln.forEach(s),Mc=m(kt),y(et.$$.fragment,kt),Tc=m(kt),y(tt.$$.fragment,kt),kt.forEach(s),bc=m(F),D=a(F,"DIV",{class:!0});var jt=r(D);y($s.$$.fragment,jt),yc=m(jt),Yo=a(jt,"P",{});var jh=r(Yo);vc=i(jh,"This is an experimental feature and is a subject to change at a moment\u2019s notice."),jh.forEach(s),wc=m(jt),Oo=a(jt,"P",{});var $h=r(Oo);kc=i($h,`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.`),$h.forEach(s),jc=m(jt),y(st.$$.fragment,jt),jt.forEach(s),F.forEach(s),sr=m(t),we=a(t,"H2",{class:!0});var qr=r(we);nt=a(qr,"A",{id:!0,class:!0,href:!0});var Jh=r(nt);Ko=a(Jh,"SPAN",{});var Uh=r(Ko);y(Js.$$.fragment,Uh),Uh.forEach(s),Jh.forEach(s),$c=m(qr),ea=a(qr,"SPAN",{});var Eh=r(ea);Jc=i(Eh,"MT5EncoderModel"),Eh.forEach(s),qr.forEach(s),nr=m(t),I=a(t,"DIV",{class:!0});var C=r(I);y(Us.$$.fragment,C),Uc=m(C),ta=a(C,"P",{});var Ih=r(ta);Ec=i(Ih,"The bare MT5 Model transformer outputting encoder\u2019s raw hidden-states without any specific head on top."),Ih.forEach(s),Ic=m(C),Es=a(C,"P",{});var Ar=r(Es);zc=i(Ar,"The MT5 model was proposed in "),Is=a(Ar,"A",{href:!0,rel:!0});var zh=r(Is);xc=i(zh,`Exploring the Limits of Transfer Learning with a Unified Text-to-Text
Transformer`),zh.forEach(s),Fc=i(Ar,` 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.`),Ar.forEach(s),Cc=m(C),zs=a(C,"P",{});var Sr=r(zs);Zc=i(Sr,"This model inherits from "),Fn=a(Sr,"A",{href:!0});var xh=r(Fn);Gc=i(xh,"PreTrainedModel"),xh.forEach(s),Vc=i(Sr,`. 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.)`),Sr.forEach(s),Wc=m(C),xs=a(C,"P",{});var Qr=r(xs);Bc=i(Qr,"This model is also a PyTorch "),Fs=a(Qr,"A",{href:!0,rel:!0});var Fh=r(Fs);Rc=i(Fh,"torch.nn.Module"),Fh.forEach(s),Nc=i(Qr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Qr.forEach(s),Xc=m(C),y(ot.$$.fragment,C),qc=m(C),de=a(C,"DIV",{class:!0});var Yn=r(de);y(Cs.$$.fragment,Yn),Ac=m(Yn),sa=a(Yn,"P",{});var Ch=r(sa);Sc=i(Ch,"Moves the model to cpu from a model parallel state."),Ch.forEach(s),Qc=m(Yn),y(at.$$.fragment,Yn),Yn.forEach(s),Dc=m(C),H=a(C,"DIV",{class:!0});var $t=r(H);y(Zs.$$.fragment,$t),Hc=m($t),ke=a($t,"P",{});var On=r(ke);Pc=i(On,"The "),Cn=a(On,"A",{href:!0});var Zh=r(Cn);Lc=i(Zh,"MT5EncoderModel"),Zh.forEach(s),Yc=i(On," forward method, overrides the "),na=a(On,"CODE",{});var Gh=r(na);Oc=i(Gh,"__call__"),Gh.forEach(s),Kc=i(On," special method."),On.forEach(s),ep=m($t),y(rt.$$.fragment,$t),tp=m($t),y(lt.$$.fragment,$t),$t.forEach(s),sp=m(C),P=a(C,"DIV",{class:!0});var Jt=r(P);y(Gs.$$.fragment,Jt),np=m(Jt),oa=a(Jt,"P",{});var Vh=r(oa);op=i(Vh,"This is an experimental feature and is a subject to change at a moment\u2019s notice."),Vh.forEach(s),ap=m(Jt),aa=a(Jt,"P",{});var Wh=r(aa);rp=i(Wh,`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.`),Wh.forEach(s),lp=m(Jt),y(it.$$.fragment,Jt),Jt.forEach(s),C.forEach(s),or=m(t),je=a(t,"H2",{class:!0});var Dr=r(je);dt=a(Dr,"A",{id:!0,class:!0,href:!0});var Bh=r(dt);ra=a(Bh,"SPAN",{});var Rh=r(ra);y(Vs.$$.fragment,Rh),Rh.forEach(s),Bh.forEach(s),ip=m(Dr),la=a(Dr,"SPAN",{});var Nh=r(la);dp=i(Nh,"TFMT5Model"),Nh.forEach(s),Dr.forEach(s),ar=m(t),O=a(t,"DIV",{class:!0});var Kn=r(O);y(Ws.$$.fragment,Kn),cp=m(Kn),Bs=a(Kn,"P",{});var Hr=r(Bs);pp=i(Hr,"This class overrides "),Zn=a(Hr,"A",{href:!0});var Xh=r(Zn);mp=i(Xh,"TFT5Model"),Xh.forEach(s),hp=i(Hr,`. Please check the superclass for the appropriate documentation alongside usage
examples.`),Hr.forEach(s),up=m(Kn),y(ct.$$.fragment,Kn),Kn.forEach(s),rr=m(t),$e=a(t,"H2",{class:!0});var Pr=r($e);pt=a(Pr,"A",{id:!0,class:!0,href:!0});var qh=r(pt);ia=a(qh,"SPAN",{});var Ah=r(ia);y(Rs.$$.fragment,Ah),Ah.forEach(s),qh.forEach(s),fp=m(Pr),da=a(Pr,"SPAN",{});var Sh=r(da);gp=i(Sh,"TFMT5ForConditionalGeneration"),Sh.forEach(s),Pr.forEach(s),lr=m(t),K=a(t,"DIV",{class:!0});var eo=r(K);y(Ns.$$.fragment,eo),_p=m(eo),Xs=a(eo,"P",{});var Lr=r(Xs);Mp=i(Lr,"This class overrides "),Gn=a(Lr,"A",{href:!0});var Qh=r(Gn);Tp=i(Qh,"TFT5ForConditionalGeneration"),Qh.forEach(s),bp=i(Lr,`. Please check the superclass for the appropriate
documentation alongside usage examples.`),Lr.forEach(s),yp=m(eo),y(mt.$$.fragment,eo),eo.forEach(s),ir=m(t),Je=a(t,"H2",{class:!0});var Yr=r(Je);ht=a(Yr,"A",{id:!0,class:!0,href:!0});var Dh=r(ht);ca=a(Dh,"SPAN",{});var Hh=r(ca);y(qs.$$.fragment,Hh),Hh.forEach(s),Dh.forEach(s),vp=m(Yr),pa=a(Yr,"SPAN",{});var Ph=r(pa);wp=i(Ph,"TFMT5EncoderModel"),Ph.forEach(s),Yr.forEach(s),dr=m(t),ee=a(t,"DIV",{class:!0});var to=r(ee);y(As.$$.fragment,to),kp=m(to),Ss=a(to,"P",{});var Or=r(Ss);jp=i(Or,"This class overrides "),Vn=a(Or,"A",{href:!0});var Lh=r(Vn);$p=i(Lh,"TFT5EncoderModel"),Lh.forEach(s),Jp=i(Or,`. Please check the superclass for the appropriate documentation alongside
usage examples.`),Or.forEach(s),Up=m(to),y(ut.$$.fragment,to),to.forEach(s),cr=m(t),Ue=a(t,"H2",{class:!0});var Kr=r(Ue);ft=a(Kr,"A",{id:!0,class:!0,href:!0});var Yh=r(ft);ma=a(Yh,"SPAN",{});var Oh=r(ma);y(Qs.$$.fragment,Oh),Oh.forEach(s),Yh.forEach(s),Ep=m(Kr),ha=a(Kr,"SPAN",{});var Kh=r(ha);Ip=i(Kh,"FlaxMT5Model"),Kh.forEach(s),Kr.forEach(s),pr=m(t),te=a(t,"DIV",{class:!0});var so=r(te);y(Ds.$$.fragment,so),zp=m(so),Hs=a(so,"P",{});var el=r(Hs);xp=i(el,"This class overrides "),Wn=a(el,"A",{href:!0});var eu=r(Wn);Fp=i(eu,"FlaxT5Model"),eu.forEach(s),Cp=i(el,`. Please check the superclass for the appropriate documentation alongside usage
examples.`),el.forEach(s),Zp=m(so),y(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);y(Ps.$$.fragment,su),su.forEach(s),tu.forEach(s),Gp=m(tl),fa=a(tl,"SPAN",{});var nu=r(fa);Vp=i(nu,"FlaxMT5ForConditionalGeneration"),nu.forEach(s),tl.forEach(s),hr=m(t),se=a(t,"DIV",{class:!0});var no=r(se);y(Ls.$$.fragment,no),Wp=m(no),Ys=a(no,"P",{});var sl=r(Ys);Bp=i(sl,"This class overrides "),Bn=a(sl,"A",{href:!0});var ou=r(Bn);Rp=i(ou,"FlaxT5ForConditionalGeneration"),ou.forEach(s),Np=i(sl,`. Please check the superclass for the appropriate
documentation alongside usage examples.`),sl.forEach(s),Xp=m(no),y(Mt.$$.fragment,no),no.forEach(s),ur=m(t),Ie=a(t,"H2",{class:!0});var nl=r(Ie);Tt=a(nl,"A",{id:!0,class:!0,href:!0});var au=r(Tt);ga=a(au,"SPAN",{});var ru=r(ga);y(Os.$$.fragment,ru),ru.forEach(s),au.forEach(s),qp=m(nl),_a=a(nl,"SPAN",{});var lu=r(_a);Ap=i(lu,"FlaxMT5EncoderModel"),lu.forEach(s),nl.forEach(s),fr=m(t),ne=a(t,"DIV",{class:!0});var oo=r(ne);y(Ks.$$.fragment,oo),Sp=m(oo),en=a(oo,"P",{});var ol=r(en);Qp=i(ol,"This class overrides "),Rn=a(ol,"A",{href:!0});var iu=r(Rn);Dp=i(iu,"FlaxT5EncoderModel"),iu.forEach(s),Hp=i(ol,`. Please check the superclass for the appropriate documentation
alongside usage examples.`),ol.forEach(s),Pp=m(oo),y(bt.$$.fragment,oo),oo.forEach(s),this.h()},h(){h(c,"name","hf:doc:metadata"),h(c,"content",JSON.stringify(Vu)),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(ze,"id","overview"),h(ze,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ze,"href","#overview"),h(me,"class","relative group"),h(Et,"href","https://arxiv.org/abs/2010.11934"),h(Et,"rel","nofollow"),h(It,"href","https://huggingface.co/datasets/mc4"),h(It,"rel","nofollow"),h(zt,"href","https://huggingface.co/google/mt5-small"),h(zt,"rel","nofollow"),h(xt,"href","https://huggingface.co/google/mt5-base"),h(xt,"rel","nofollow"),h(Ft,"href","https://huggingface.co/google/mt5-large"),h(Ft,"rel","nofollow"),h(Ct,"href","https://huggingface.co/google/mt5-xl"),h(Ct,"rel","nofollow"),h(Zt,"href","https://huggingface.co/google/mt5-xxl"),h(Zt,"rel","nofollow"),h(Gt,"href","https://huggingface.co/patrickvonplaten"),h(Gt,"rel","nofollow"),h(Vt,"href","https://github.com/google-research/multilingual-t5"),h(Vt,"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(Ge,"id","transformers.MT5Config"),h(Ge,"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(Ge,"href","#transformers.MT5Config"),h(ue,"class","relative group"),h(_n,"href","/docs/transformers/v4.30.0/en/model_doc/mt5#transformers.MT5Model"),h(Mn,"href","/docs/transformers/v4.30.0/en/model_doc/mt5#transformers.TFMT5Model"),h(Nt,"href","https://huggingface.co/google/mt5-small"),h(Nt,"rel","nofollow"),h(Tn,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(bn,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ve,"id","transformers.T5Tokenizer"),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.T5Tokenizer"),h(ge,"class","relative group"),h(St,"href","https://github.com/google/sentencepiece"),h(St,"rel","nofollow"),h(yn,"href","/docs/transformers/v4.30.0/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(We,"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(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(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(kn,"href","/docs/transformers/v4.30.0/en/model_doc/t5#transformers.T5Tokenizer"),h(Xe,"id","transformers.T5TokenizerFast"),h(Xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Xe,"href","#transformers.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(jn,"href","/docs/transformers/v4.30.0/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(qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(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(Un,"href","/docs/transformers/v4.30.0/en/model_doc/t5#transformers.T5TokenizerFast"),h(Se,"id","transformers.MT5Model"),h(Se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Se,"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.30.0/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(In,"href","/docs/transformers/v4.30.0/en/model_doc/mt5#transformers.MT5Model"),h(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(U,"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(ye,"class","relative group"),h(bs,"href","https://arxiv.org/abs/1910.10683"),h(bs,"rel","nofollow"),h(zn,"href","/docs/transformers/v4.30.0/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(xn,"href","/docs/transformers/v4.30.0/en/model_doc/mt5#transformers.MT5ForConditionalGeneration"),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(D,"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(Is,"href","https://arxiv.org/abs/1910.10683"),h(Is,"rel","nofollow"),h(Fn,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel"),h(Fs,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Fs,"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.30.0/en/model_doc/mt5#transformers.MT5EncoderModel"),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(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(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(je,"class","relative group"),h(Zn,"href","/docs/transformers/v4.30.0/en/model_doc/t5#transformers.TFT5Model"),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(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($e,"class","relative group"),h(Gn,"href","/docs/transformers/v4.30.0/en/model_doc/t5#transformers.TFT5ForConditionalGeneration"),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(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(Je,"class","relative group"),h(Vn,"href","/docs/transformers/v4.30.0/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(Ue,"class","relative group"),h(Wn,"href","/docs/transformers/v4.30.0/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(Bn,"href","/docs/transformers/v4.30.0/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(Ie,"class","relative group"),h(Rn,"href","/docs/transformers/v4.30.0/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,M),v(n,M,null),e(g,u),e(g,R),e(R,al),_(t,Fa,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,ze),e(ze,ao),v(Ut,ao,null),e(me,ll),e(me,ro),e(ro,il),_(t,Za,f),_(t,xe,f),e(xe,dl),e(xe,Et),e(Et,cl),e(xe,pl),_(t,Ga,f),_(t,pn,f),e(pn,ml),_(t,Va,f),_(t,mn,f),e(mn,lo),e(lo,hl),_(t,Wa,f),_(t,Fe,f),e(Fe,ul),e(Fe,It),e(It,fl),e(Fe,gl),_(t,Ba,f),_(t,hn,f),e(hn,_l),_(t,Ra,f),_(t,N,f),e(N,io),e(io,co),e(co,zt),e(zt,Ml),e(N,Tl),e(N,po),e(po,mo),e(mo,xt),e(xt,bl),e(N,yl),e(N,ho),e(ho,uo),e(uo,Ft),e(Ft,vl),e(N,wl),e(N,fo),e(fo,go),e(go,Ct),e(Ct,kl),e(N,jl),e(N,_o),e(_o,un),e(un,Zt),e(Zt,$l),e(un,Jl),_(t,Na,f),_(t,oe,f),e(oe,Ul),e(oe,Gt),e(Gt,El),e(oe,Il),e(oe,Vt),e(Vt,zl),e(oe,xl),_(t,Xa,f),_(t,he,f),e(he,Ce),e(Ce,Mo),v(Wt,Mo,null),e(he,Fl),e(he,To),e(To,Cl),_(t,qa,f),_(t,Ze,f),e(Ze,bo),e(bo,fn),e(fn,Zl),e(Ze,Gl),e(Ze,yo),e(yo,gn),e(gn,Vl),_(t,Aa,f),_(t,ue,f),e(ue,Ge),e(Ge,vo),v(Bt,vo,null),e(ue,Wl),e(ue,wo),e(wo,Bl),_(t,Sa,f),_(t,L,f),v(Rt,L,null),e(L,Rl),e(L,Y),e(Y,Nl),e(Y,_n),e(_n,Xl),e(Y,ql),e(Y,Mn),e(Mn,Al),e(Y,Sl),e(Y,Nt),e(Nt,Ql),e(Y,Dl),e(L,Hl),e(L,fe),e(fe,Pl),e(fe,Tn),e(Tn,Ll),e(fe,Yl),e(fe,bn),e(bn,Ol),e(fe,Kl),_(t,Qa,f),_(t,ge,f),e(ge,Ve),e(Ve,ko),v(Xt,ko,null),e(ge,ei),e(ge,jo),e(jo,ti),_(t,Da,f),_(t,z,f),v(qt,z,null),e(z,si),e(z,At),e(At,ni),e(At,St),e(St,oi),e(At,ai),e(z,ri),e(z,Qt),e(Qt,li),e(Qt,yn),e(yn,ii),e(Qt,di),e(z,ci),e(z,ae),v(Dt,ae,null),e(ae,pi),e(ae,$o),e($o,mi),e(ae,hi),e(ae,Ht),e(Ht,vn),e(vn,ui),e(vn,Jo),e(Jo,fi),e(Ht,gi),e(Ht,wn),e(wn,_i),e(wn,Uo),e(Uo,Mi),e(z,Ti),e(z,We),v(Pt,We,null),e(We,bi),e(We,Eo),e(Eo,yi),e(z,vi),e(z,Be),v(Lt,Be,null),e(Be,wi),e(Be,Io),e(Io,ki),e(z,ji),e(z,Re),v(Yt,Re,null),e(Re,$i),e(Re,Ot),e(Ot,Ji),e(Ot,zo),e(zo,Ui),e(Ot,Ei),_(t,Ha,f),_(t,Ne,f),e(Ne,Ii),e(Ne,kn),e(kn,zi),e(Ne,xi),_(t,Pa,f),_(t,_e,f),e(_e,Xe),e(Xe,xo),v(Kt,xo,null),e(_e,Fi),e(_e,Fo),e(Fo,Ci),_(t,La,f),_(t,W,f),v(es,W,null),e(W,Zi),e(W,Me),e(Me,Gi),e(Me,Co),e(Co,Vi),e(Me,Wi),e(Me,ts),e(ts,Bi),e(Me,Ri),e(W,Ni),e(W,ss),e(ss,Xi),e(ss,jn),e(jn,qi),e(ss,Ai),e(W,Si),e(W,re),v(ns,re,null),e(re,Qi),e(re,Zo),e(Zo,Di),e(re,Hi),e(re,os),e(os,$n),e($n,Pi),e($n,Go),e(Go,Li),e(os,Yi),e(os,Jn),e(Jn,Oi),e(Jn,Vo),e(Vo,Ki),e(W,ed),e(W,qe),v(as,qe,null),e(qe,td),e(qe,Wo),e(Wo,sd),_(t,Ya,f),_(t,Ae,f),e(Ae,nd),e(Ae,Un),e(Un,od),e(Ae,ad),_(t,Oa,f),_(t,Te,f),e(Te,Se),e(Se,Bo),v(rs,Bo,null),e(Te,rd),e(Te,Ro),e(Ro,ld),_(t,Ka,f),_(t,U,f),v(ls,U,null),e(U,id),e(U,No),e(No,dd),e(U,cd),e(U,is),e(is,pd),e(is,ds),e(ds,md),e(is,hd),e(U,ud),e(U,cs),e(cs,fd),e(cs,En),e(En,gd),e(cs,_d),e(U,Md),e(U,ps),e(ps,Td),e(ps,ms),e(ms,bd),e(ps,yd),e(U,vd),v(Qe,U,null),e(U,wd),e(U,le),v(hs,le,null),e(le,kd),e(le,Xo),e(Xo,jd),e(le,$d),v(De,le,null),e(U,Jd),e(U,A),v(us,A,null),e(A,Ud),e(A,be),e(be,Ed),e(be,In),e(In,Id),e(be,zd),e(be,qo),e(qo,xd),e(be,Fd),e(A,Cd),v(He,A,null),e(A,Zd),v(Pe,A,null),e(U,Gd),e(U,S),v(fs,S,null),e(S,Vd),e(S,Ao),e(Ao,Wd),e(S,Bd),e(S,So),e(So,Rd),e(S,Nd),v(Le,S,null),_(t,er,f),_(t,ye,f),e(ye,Ye),e(Ye,Qo),v(gs,Qo,null),e(ye,Xd),e(ye,Do),e(Do,qd),_(t,tr,f),_(t,E,f),v(_s,E,null),e(E,Ad),e(E,Ms),e(Ms,Sd),e(Ms,Ho),e(Ho,Qd),e(Ms,Dd),e(E,Hd),e(E,Ts),e(Ts,Pd),e(Ts,bs),e(bs,Ld),e(Ts,Yd),e(E,Od),e(E,ys),e(ys,Kd),e(ys,zn),e(zn,ec),e(ys,tc),e(E,sc),e(E,vs),e(vs,nc),e(vs,ws),e(ws,oc),e(vs,ac),e(E,rc),v(Oe,E,null),e(E,lc),e(E,ie),v(ks,ie,null),e(ie,ic),e(ie,Po),e(Po,dc),e(ie,cc),v(Ke,ie,null),e(E,pc),e(E,Q),v(js,Q,null),e(Q,mc),e(Q,ve),e(ve,hc),e(ve,xn),e(xn,uc),e(ve,fc),e(ve,Lo),e(Lo,gc),e(ve,_c),e(Q,Mc),v(et,Q,null),e(Q,Tc),v(tt,Q,null),e(E,bc),e(E,D),v($s,D,null),e(D,yc),e(D,Yo),e(Yo,vc),e(D,wc),e(D,Oo),e(Oo,kc),e(D,jc),v(st,D,null),_(t,sr,f),_(t,we,f),e(we,nt),e(nt,Ko),v(Js,Ko,null),e(we,$c),e(we,ea),e(ea,Jc),_(t,nr,f),_(t,I,f),v(Us,I,null),e(I,Uc),e(I,ta),e(ta,Ec),e(I,Ic),e(I,Es),e(Es,zc),e(Es,Is),e(Is,xc),e(Es,Fc),e(I,Cc),e(I,zs),e(zs,Zc),e(zs,Fn),e(Fn,Gc),e(zs,Vc),e(I,Wc),e(I,xs),e(xs,Bc),e(xs,Fs),e(Fs,Rc),e(xs,Nc),e(I,Xc),v(ot,I,null),e(I,qc),e(I,de),v(Cs,de,null),e(de,Ac),e(de,sa),e(sa,Sc),e(de,Qc),v(at,de,null),e(I,Dc),e(I,H),v(Zs,H,null),e(H,Hc),e(H,ke),e(ke,Pc),e(ke,Cn),e(Cn,Lc),e(ke,Yc),e(ke,na),e(na,Oc),e(ke,Kc),e(H,ep),v(rt,H,null),e(H,tp),v(lt,H,null),e(I,sp),e(I,P),v(Gs,P,null),e(P,np),e(P,oa),e(oa,op),e(P,ap),e(P,aa),e(aa,rp),e(P,lp),v(it,P,null),_(t,or,f),_(t,je,f),e(je,dt),e(dt,ra),v(Vs,ra,null),e(je,ip),e(je,la),e(la,dp),_(t,ar,f),_(t,O,f),v(Ws,O,null),e(O,cp),e(O,Bs),e(Bs,pp),e(Bs,Zn),e(Zn,mp),e(Bs,hp),e(O,up),v(ct,O,null),_(t,rr,f),_(t,$e,f),e($e,pt),e(pt,ia),v(Rs,ia,null),e($e,fp),e($e,da),e(da,gp),_(t,lr,f),_(t,K,f),v(Ns,K,null),e(K,_p),e(K,Xs),e(Xs,Mp),e(Xs,Gn),e(Gn,Tp),e(Xs,bp),e(K,yp),v(mt,K,null),_(t,ir,f),_(t,Je,f),e(Je,ht),e(ht,ca),v(qs,ca,null),e(Je,vp),e(Je,pa),e(pa,wp),_(t,dr,f),_(t,ee,f),v(As,ee,null),e(ee,kp),e(ee,Ss),e(Ss,jp),e(Ss,Vn),e(Vn,$p),e(Ss,Jp),e(ee,Up),v(ut,ee,null),_(t,cr,f),_(t,Ue,f),e(Ue,ft),e(ft,ma),v(Qs,ma,null),e(Ue,Ep),e(Ue,ha),e(ha,Ip),_(t,pr,f),_(t,te,f),v(Ds,te,null),e(te,zp),e(te,Hs),e(Hs,xp),e(Hs,Wn),e(Wn,Fp),e(Hs,Cp),e(te,Zp),v(gt,te,null),_(t,mr,f),_(t,Ee,f),e(Ee,_t),e(_t,ua),v(Ps,ua,null),e(Ee,Gp),e(Ee,fa),e(fa,Vp),_(t,hr,f),_(t,se,f),v(Ls,se,null),e(se,Wp),e(se,Ys),e(Ys,Bp),e(Ys,Bn),e(Bn,Rp),e(Ys,Np),e(se,Xp),v(Mt,se,null),_(t,ur,f),_(t,Ie,f),e(Ie,Tt),e(Tt,ga),v(Os,ga,null),e(Ie,qp),e(Ie,_a),e(_a,Ap),_(t,fr,f),_(t,ne,f),v(Ks,ne,null),e(ne,Sp),e(ne,en),e(en,Qp),e(en,Rn),e(Rn,Dp),e(en,Hp),e(ne,Pp),v(bt,ne,null),gr=!0},p(t,[f]){const tn={};f&2&&(tn.$$scope={dirty:f,ctx:t}),Qe.$set(tn);const Ma={};f&2&&(Ma.$$scope={dirty:f,ctx:t}),De.$set(Ma);const Ta={};f&2&&(Ta.$$scope={dirty:f,ctx:t}),He.$set(Ta);const ba={};f&2&&(ba.$$scope={dirty:f,ctx:t}),Pe.$set(ba);const sn={};f&2&&(sn.$$scope={dirty:f,ctx:t}),Le.$set(sn);const ya={};f&2&&(ya.$$scope={dirty:f,ctx:t}),Oe.$set(ya);const va={};f&2&&(va.$$scope={dirty:f,ctx:t}),Ke.$set(va);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 ka={};f&2&&(ka.$$scope={dirty:f,ctx:t}),st.$set(ka);const ja={};f&2&&(ja.$$scope={dirty:f,ctx:t}),ot.$set(ja);const on={};f&2&&(on.$$scope={dirty:f,ctx:t}),at.$set(on);const $a={};f&2&&($a.$$scope={dirty:f,ctx:t}),rt.$set($a);const Ja={};f&2&&(Ja.$$scope={dirty:f,ctx:t}),lt.$set(Ja);const Ua={};f&2&&(Ua.$$scope={dirty:f,ctx:t}),it.$set(Ua);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 Ia={};f&2&&(Ia.$$scope={dirty:f,ctx:t}),ut.$set(Ia);const za={};f&2&&(za.$$scope={dirty:f,ctx:t}),gt.$set(za);const q={};f&2&&(q.$$scope={dirty:f,ctx:t}),Mt.$set(q);const xa={};f&2&&(xa.$$scope={dirty:f,ctx:t}),bt.$set(xa)},i(t){gr||(w(n.$$.fragment,t),w(Ut.$$.fragment,t),w(Wt.$$.fragment,t),w(Bt.$$.fragment,t),w(Rt.$$.fragment,t),w(Xt.$$.fragment,t),w(qt.$$.fragment,t),w(Dt.$$.fragment,t),w(Pt.$$.fragment,t),w(Lt.$$.fragment,t),w(Yt.$$.fragment,t),w(Kt.$$.fragment,t),w(es.$$.fragment,t),w(ns.$$.fragment,t),w(as.$$.fragment,t),w(rs.$$.fragment,t),w(ls.$$.fragment,t),w(Qe.$$.fragment,t),w(hs.$$.fragment,t),w(De.$$.fragment,t),w(us.$$.fragment,t),w(He.$$.fragment,t),w(Pe.$$.fragment,t),w(fs.$$.fragment,t),w(Le.$$.fragment,t),w(gs.$$.fragment,t),w(_s.$$.fragment,t),w(Oe.$$.fragment,t),w(ks.$$.fragment,t),w(Ke.$$.fragment,t),w(js.$$.fragment,t),w(et.$$.fragment,t),w(tt.$$.fragment,t),w($s.$$.fragment,t),w(st.$$.fragment,t),w(Js.$$.fragment,t),w(Us.$$.fragment,t),w(ot.$$.fragment,t),w(Cs.$$.fragment,t),w(at.$$.fragment,t),w(Zs.$$.fragment,t),w(rt.$$.fragment,t),w(lt.$$.fragment,t),w(Gs.$$.fragment,t),w(it.$$.fragment,t),w(Vs.$$.fragment,t),w(Ws.$$.fragment,t),w(ct.$$.fragment,t),w(Rs.$$.fragment,t),w(Ns.$$.fragment,t),w(mt.$$.fragment,t),w(qs.$$.fragment,t),w(As.$$.fragment,t),w(ut.$$.fragment,t),w(Qs.$$.fragment,t),w(Ds.$$.fragment,t),w(gt.$$.fragment,t),w(Ps.$$.fragment,t),w(Ls.$$.fragment,t),w(Mt.$$.fragment,t),w(Os.$$.fragment,t),w(Ks.$$.fragment,t),w(bt.$$.fragment,t),gr=!0)},o(t){k(n.$$.fragment,t),k(Ut.$$.fragment,t),k(Wt.$$.fragment,t),k(Bt.$$.fragment,t),k(Rt.$$.fragment,t),k(Xt.$$.fragment,t),k(qt.$$.fragment,t),k(Dt.$$.fragment,t),k(Pt.$$.fragment,t),k(Lt.$$.fragment,t),k(Yt.$$.fragment,t),k(Kt.$$.fragment,t),k(es.$$.fragment,t),k(ns.$$.fragment,t),k(as.$$.fragment,t),k(rs.$$.fragment,t),k(ls.$$.fragment,t),k(Qe.$$.fragment,t),k(hs.$$.fragment,t),k(De.$$.fragment,t),k(us.$$.fragment,t),k(He.$$.fragment,t),k(Pe.$$.fragment,t),k(fs.$$.fragment,t),k(Le.$$.fragment,t),k(gs.$$.fragment,t),k(_s.$$.fragment,t),k(Oe.$$.fragment,t),k(ks.$$.fragment,t),k(Ke.$$.fragment,t),k(js.$$.fragment,t),k(et.$$.fragment,t),k(tt.$$.fragment,t),k($s.$$.fragment,t),k(st.$$.fragment,t),k(Js.$$.fragment,t),k(Us.$$.fragment,t),k(ot.$$.fragment,t),k(Cs.$$.fragment,t),k(at.$$.fragment,t),k(Zs.$$.fragment,t),k(rt.$$.fragment,t),k(lt.$$.fragment,t),k(Gs.$$.fragment,t),k(it.$$.fragment,t),k(Vs.$$.fragment,t),k(Ws.$$.fragment,t),k(ct.$$.fragment,t),k(Rs.$$.fragment,t),k(Ns.$$.fragment,t),k(mt.$$.fragment,t),k(qs.$$.fragment,t),k(As.$$.fragment,t),k(ut.$$.fragment,t),k(Qs.$$.fragment,t),k(Ds.$$.fragment,t),k(gt.$$.fragment,t),k(Ps.$$.fragment,t),k(Ls.$$.fragment,t),k(Mt.$$.fragment,t),k(Os.$$.fragment,t),k(Ks.$$.fragment,t),k(bt.$$.fragment,t),gr=!1},d(t){s(c),t&&s(T),t&&s(g),j(n),t&&s(Fa),t&&s(pe),t&&s(Ca),t&&s(me),j(Ut),t&&s(Za),t&&s(xe),t&&s(Ga),t&&s(pn),t&&s(Va),t&&s(mn),t&&s(Wa),t&&s(Fe),t&&s(Ba),t&&s(hn),t&&s(Ra),t&&s(N),t&&s(Na),t&&s(oe),t&&s(Xa),t&&s(he),j(Wt),t&&s(qa),t&&s(Ze),t&&s(Aa),t&&s(ue),j(Bt),t&&s(Sa),t&&s(L),j(Rt),t&&s(Qa),t&&s(ge),j(Xt),t&&s(Da),t&&s(z),j(qt),j(Dt),j(Pt),j(Lt),j(Yt),t&&s(Ha),t&&s(Ne),t&&s(Pa),t&&s(_e),j(Kt),t&&s(La),t&&s(W),j(es),j(ns),j(as),t&&s(Ya),t&&s(Ae),t&&s(Oa),t&&s(Te),j(rs),t&&s(Ka),t&&s(U),j(ls),j(Qe),j(hs),j(De),j(us),j(He),j(Pe),j(fs),j(Le),t&&s(er),t&&s(ye),j(gs),t&&s(tr),t&&s(E),j(_s),j(Oe),j(ks),j(Ke),j(js),j(et),j(tt),j($s),j(st),t&&s(sr),t&&s(we),j(Js),t&&s(nr),t&&s(I),j(Us),j(ot),j(Cs),j(at),j(Zs),j(rt),j(lt),j(Gs),j(it),t&&s(or),t&&s(je),j(Vs),t&&s(ar),t&&s(O),j(Ws),j(ct),t&&s(rr),t&&s($e),j(Rs),t&&s(lr),t&&s(K),j(Ns),j(mt),t&&s(ir),t&&s(Je),j(qs),t&&s(dr),t&&s(ee),j(As),j(ut),t&&s(cr),t&&s(Ue),j(Qs),t&&s(pr),t&&s(te),j(Ds),j(gt),t&&s(mr),t&&s(Ee),j(Ps),t&&s(hr),t&&s(se),j(Ls),j(Mt),t&&s(ur),t&&s(Ie),j(Os),t&&s(fr),t&&s(ne),j(Ks),j(bt)}}}const Vu={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 Wu($){return uu(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Su extends cu{constructor(c){super();pu(this,c,Wu,Gu,mu,{})}}export{Su as default,Vu as metadata};
