Buckets:
| import{s as ie,o as ce,n as me}from"../chunks/scheduler.18a86fab.js";import{S as de,i as ue,g as o,s as a,r as u,A as he,h as r,f as t,c as l,j as D,u as h,x as c,k as _,y as p,a as n,v as b,d as g,t as y,w as j}from"../chunks/index.98837b22.js";import{T as be}from"../chunks/Tip.77304350.js";import{D as rs}from"../chunks/Docstring.6758ea23.js";import{C as $s}from"../chunks/CodeBlock.8d0c2e8a.js";import{H as Zs}from"../chunks/Heading.7e7e0c5b.js";import{E as ge}from"../chunks/index.f01015d9.js";function ye(ps){let m,v=`ByT5’s architecture is based on the T5v1.1 model, refer to <a href="t5v1.1">T5v1.1’s documentation page</a> for the API reference. They | |
| only differ in how inputs should be prepared for the model, see the code examples below.`;return{c(){m=o("p"),m.innerHTML=v},l(M){m=r(M,"P",{"data-svelte-h":!0}),c(m)!=="svelte-i5fysz"&&(m.innerHTML=v)},m(M,P){n(M,m,P)},p:me,d(M){M&&t(m)}}}function je(ps){let m,v,M,P,B,is,f,Ls=`<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&logo=pytorch&logoColor=white"/> <img alt="TensorFlow" src="https://img.shields.io/badge/TensorFlow-FF6F00?style=flat&logo=tensorflow&logoColor=white"/> <img alt="Flax" src="https://img.shields.io/badge/Flax-29a79b.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAtCAMAAAANxBKoAAAC7lBMVEUAAADg5vYHPVgAoJH+/v76+v39/f9JbLP///9+AIgAnY3///+mcqzt8fXy9fgkXa3Ax9709fr+///9/f8qXq49qp5AaLGMwrv8/P0eW60VWawxYq8yqJzG2dytt9Wyu9elzci519Lf3O3S2efY3OrY0+Xp7PT///////+dqNCexMc6Z7AGpJeGvbenstPZ5ejQ1OfJzOLa7ejh4+/r8fT29vpccbklWK8PVa0AS6ghW63O498vYa+lsdKz1NDRt9Kw1c672tbD3tnAxt7R6OHp5vDe7OrDyuDn6vLl6/EAQKak0MgATakkppo3ZK/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RmOcrUmjohbT2WUllbmRvgfbythbQO3222fpDJoufaQPncYYuqoGtUEsCJZL6/3PR5b4syeSjZMQG/T2maGANlXT2v8S4AULWaUkCxfLyW8iW4kdka+nEMjxpL2NCwsYNBp+Q61PF43zyDg9Bm9+3NNySn78jMZUUkumqE4Gp7JmFOdP1vc8PpRrzj9+wPinCy8K1PiJ4aYbnTYpCCbDkBSbzhu2QJ1Gd82t8jI8TH51+OzvXoWbnXUOBkNW+0mWFwGcGOUVpU81/n3TOHb5oMt2FgYGjzau0Nif0Ss7Q3XB33hjjQHjHA5E5aOyIQc8CBrLdQSs3j92VG+3nNEjbkbdbBr9zm04ruvw37vh0QKOdeGIkckc80fX3KH/h7PT4BOjgCty8VZ5ux1MoO5Cf5naca2LAsEgehI+drX8o/0Nu+W0m6K/I9gGPd/dfx/EN/wN62AhsBWuAAAAAElFTkSuQmCC | |
| "/>`,cs,x,ms,G,Fs=`The ByT5 model was presented in <a href="https://arxiv.org/abs/2105.13626" rel="nofollow">ByT5: Towards a token-free future with pre-trained byte-to-byte models</a> by Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir | |
| Kale, Adam Roberts, Colin Raffel.`,ds,I,Ss="The abstract from the paper is the following:",us,C,Ys=`<em>Most widely-used pre-trained language models operate on sequences of tokens corresponding to word or subword units. | |
| Encoding text as a sequence of tokens requires a tokenizer, which is typically created as an independent artifact from | |
| the model. Token-free models that instead operate directly on raw text (bytes or characters) have many benefits: they | |
| can process text in any language out of the box, they are more robust to noise, and they minimize technical debt by | |
| removing complex and error-prone text preprocessing pipelines. Since byte or character sequences are longer than token | |
| sequences, past work on token-free models has often introduced new model architectures designed to amortize the cost of | |
| operating directly on raw text. In this paper, we show that a standard Transformer architecture can be used with | |
| minimal modifications to process byte sequences. We carefully characterize the trade-offs in terms of parameter count, | |
| training FLOPs, and inference speed, and show that byte-level models are competitive with their token-level | |
| counterparts. We also demonstrate that byte-level models are significantly more robust to noise and perform better on | |
| tasks that are sensitive to spelling and pronunciation. As part of our contribution, we release a new set of | |
| pre-trained byte-level Transformer models based on the T5 architecture, as well as all code and data used in our | |
| experiments.</em>`,hs,Z,Ds=`This model was contributed by <a href="https://huggingface.co/patrickvonplaten" rel="nofollow">patrickvonplaten</a>. The original code can be | |
| found <a href="https://github.com/google-research/byt5" rel="nofollow">here</a>.`,bs,k,gs,z,Ps=`Since ByT5 was pre-trained unsupervisedly, there’s 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.`,ys,W,js,R,Os="ByT5 works on raw UTF-8 bytes, so it can be used without a tokenizer:",Ms,N,Ts,V,Ks="For batched inference and training it is however recommended to make use of the tokenizer:",fs,A,ks,Q,se=`Similar to <a href="t5">T5</a>, ByT5 was trained on the span-mask denoising task. However, | |
| since the model works directly on characters, the pretraining task is a bit | |
| different. Let’s corrupt some characters of the | |
| input sentence <code>"The dog chases a ball in the park."</code> and ask ByT5 to predict them | |
| for us.`,ws,X,Js,q,Us,i,E,zs,O,ee="Construct a ByT5 tokenizer. ByT5 simply uses raw bytes utf-8 encoding.",Ws,K,te=`This tokenizer inherits from <a href="/docs/transformers/pr_33962/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a> which contains most of the main methods. Users should refer to | |
| this superclass for more information regarding those methods.`,Rs,T,H,Ns,ss,ne=`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:`,Vs,es,ae="<li>single sequence: <code>X </s></code></li> <li>pair of sequences: <code>A </s> B </s></code></li>",As,w,$,Qs,ts,le="Converts a sequence of tokens (string) in a single string.",Xs,J,L,qs,ns,oe=`Create a mask from the two sequences passed to be used in a sequence-pair classification task. ByT5 does not | |
| make use of token type ids, therefore a list of zeros is returned.`,Es,U,F,Hs,as,re=`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding | |
| special tokens using the tokenizer <code>prepare_for_model</code> method.`,_s,S,pe='See <a href="/docs/transformers/pr_33962/en/model_doc/byt5#transformers.ByT5Tokenizer">ByT5Tokenizer</a> for all details.',vs,Y,Bs,os,xs;return B=new Zs({props:{title:"ByT5",local:"byt5",headingTag:"h1"}}),x=new Zs({props:{title:"Overview",local:"overview",headingTag:"h2"}}),k=new be({props:{$$slots:{default:[ye]},$$scope:{ctx:ps}}}),W=new Zs({props:{title:"Usage example",local:"usage-example",headingTag:"h2"}}),N=new $s({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFQ1Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBaW1wb3J0JTIwdG9yY2glMEElMEFtb2RlbCUyMCUzRCUyMFQ1Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZieXQ1LXNtYWxsJTIyKSUwQSUwQW51bV9zcGVjaWFsX3Rva2VucyUyMCUzRCUyMDMlMEElMjMlMjBNb2RlbCUyMGhhcyUyMDMlMjBzcGVjaWFsJTIwdG9rZW5zJTIwd2hpY2glMjB0YWtlJTIwdXAlMjB0aGUlMjBpbnB1dCUyMGlkcyUyMDAlMkMxJTJDMiUyMG9mJTIwQnlUNS4lMEElMjMlMjAlM0QlM0UlMjBOZWVkJTIwdG8lMjBzaGlmdCUyMHV0Zi04JTIwY2hhcmFjdGVyJTIwZW5jb2RpbmdzJTIwYnklMjAzJTIwYmVmb3JlJTIwcGFzc2luZyUyMGlkcyUyMHRvJTIwbW9kZWwuJTBBJTBBaW5wdXRfaWRzJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1Qmxpc3QoJTIyTGlmZSUyMGlzJTIwbGlrZSUyMGElMjBib3glMjBvZiUyMGNob2NvbGF0ZXMuJTIyLmVuY29kZSglMjJ1dGYtOCUyMikpJTVEKSUyMCUyQiUyMG51bV9zcGVjaWFsX3Rva2VucyUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUJsaXN0KCUyMkxhJTIwdmllJTIwZXN0JTIwY29tbWUlMjB1bmUlMjBibyVDMyVBRXRlJTIwZGUlMjBjaG9jb2xhdC4lMjIuZW5jb2RlKCUyMnV0Zi04JTIyKSklNUQpJTIwJTJCJTIwbnVtX3NwZWNpYWxfdG9rZW5zJTBBJTBBbG9zcyUyMCUzRCUyMG1vZGVsKGlucHV0X2lkcyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcyUwQWxvc3MuaXRlbSgp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> T5ForConditionalGeneration | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>model = T5ForConditionalGeneration.from_pretrained(<span class="hljs-string">"google/byt5-small"</span>) | |
| <span class="hljs-meta">>>> </span>num_special_tokens = <span class="hljs-number">3</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Model has 3 special tokens which take up the input ids 0,1,2 of ByT5.</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># => Need to shift utf-8 character encodings by 3 before passing ids to model.</span> | |
| <span class="hljs-meta">>>> </span>input_ids = torch.tensor([<span class="hljs-built_in">list</span>(<span class="hljs-string">"Life is like a box of chocolates."</span>.encode(<span class="hljs-string">"utf-8"</span>))]) + num_special_tokens | |
| <span class="hljs-meta">>>> </span>labels = torch.tensor([<span class="hljs-built_in">list</span>(<span class="hljs-string">"La vie est comme une boîte de chocolat."</span>.encode(<span class="hljs-string">"utf-8"</span>))]) + num_special_tokens | |
| <span class="hljs-meta">>>> </span>loss = model(input_ids, labels=labels).loss | |
| <span class="hljs-meta">>>> </span>loss.item() | |
| <span class="hljs-number">2.66</span>`,wrap:!1}}),A=new $s({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFQ1Rm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsJTIwJTNEJTIwVDVGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRmJ5dDUtc21hbGwlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGYnl0NS1zbWFsbCUyMiklMEElMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwJTVCJTIyTGlmZSUyMGlzJTIwbGlrZSUyMGElMjBib3glMjBvZiUyMGNob2NvbGF0ZXMuJTIyJTJDJTIwJTIyVG9kYXklMjBpcyUyME1vbmRheS4lMjIlNUQlMkMlMjBwYWRkaW5nJTNEJTIybG9uZ2VzdCUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMEEpJTBBbGFiZWxzX2RpY3QlMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwJTVCJTIyTGElMjB2aWUlMjBlc3QlMjBjb21tZSUyMHVuZSUyMGJvJUMzJUFFdGUlMjBkZSUyMGNob2NvbGF0LiUyMiUyQyUyMCUyMkF1am91cmQnaHVpJTIwYydlc3QlMjBsdW5kaS4lMjIlNUQlMkMlMjBwYWRkaW5nJTNEJTIybG9uZ2VzdCUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMEEpJTBBbGFiZWxzJTIwJTNEJTIwbGFiZWxzX2RpY3QuaW5wdXRfaWRzJTBBJTBBbG9zcyUyMCUzRCUyMG1vZGVsKCoqbW9kZWxfaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKS5sb3NzJTBBbG9zcy5pdGVtKCk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> T5ForConditionalGeneration, AutoTokenizer | |
| <span class="hljs-meta">>>> </span>model = T5ForConditionalGeneration.from_pretrained(<span class="hljs-string">"google/byt5-small"</span>) | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"google/byt5-small"</span>) | |
| <span class="hljs-meta">>>> </span>model_inputs = tokenizer( | |
| <span class="hljs-meta">... </span> [<span class="hljs-string">"Life is like a box of chocolates."</span>, <span class="hljs-string">"Today is Monday."</span>], padding=<span class="hljs-string">"longest"</span>, return_tensors=<span class="hljs-string">"pt"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>labels_dict = tokenizer( | |
| <span class="hljs-meta">... </span> [<span class="hljs-string">"La vie est comme une boîte de chocolat."</span>, <span class="hljs-string">"Aujourd'hui c'est lundi."</span>], padding=<span class="hljs-string">"longest"</span>, return_tensors=<span class="hljs-string">"pt"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>labels = labels_dict.input_ids | |
| <span class="hljs-meta">>>> </span>loss = model(**model_inputs, labels=labels).loss | |
| <span class="hljs-meta">>>> </span>loss.item() | |
| <span class="hljs-number">17.9</span>`,wrap:!1}}),X=new $s({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JTZXEyU2VxTE0lMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRmJ5dDUtYmFzZSUyMiklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTS5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGYnl0NS1iYXNlJTIyKSUwQSUwQWlucHV0X2lkc19wcm9tcHQlMjAlM0QlMjAlMjJUaGUlMjBkb2clMjBjaGFzZXMlMjBhJTIwYmFsbCUyMGluJTIwdGhlJTIwcGFy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lkeCUyMCUzRCUyMG91dHB1dF9pZHMuaW5kZXgoc2VudGluZWxfdG9rZW4pJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2lkc19saXN0LmFwcGVuZChvdXRwdXRfaWRzJTVCc3RhcnRfdG9rZW4lM0FzcGxpdF9pZHglNUQpJTBBJTIwJTIwJTIwJTIwc3RhcnRfdG9rZW4lMjAlM0QlMjBzcGxpdF9pZHglMEElMjAlMjAlMjAlMjBzZW50aW5lbF90b2tlbiUyMC0lM0QlMjAxJTBBJTBBb3V0cHV0X2lkc19saXN0LmFwcGVuZChvdXRwdXRfaWRzJTVCc3RhcnRfdG9rZW4lM0ElNUQpJTBBb3V0cHV0X3N0cmluZyUyMCUzRCUyMHRva2VuaXplci5iYXRjaF9kZWNvZGUob3V0cHV0X2lkc19saXN0KSUwQW91dHB1dF9zdHJpbmc=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForSeq2SeqLM | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"google/byt5-base"</span>) | |
| <span class="hljs-meta">>>> </span>model = AutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">"google/byt5-base"</span>) | |
| <span class="hljs-meta">>>> </span>input_ids_prompt = <span class="hljs-string">"The dog chases a ball in the park."</span> | |
| <span class="hljs-meta">>>> </span>input_ids = tokenizer(input_ids_prompt).input_ids | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Note that we cannot add "{extra_id_...}" to the string directly</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># as the Byte tokenizer would incorrectly merge the tokens</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># For ByT5, we need to work directly on the character level</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Contrary to T5, ByT5 does not use sentinel tokens for masking, but instead</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># uses final utf character ids.</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># UTF-8 is represented by 8 bits and ByT5 has 3 special tokens.</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># => There are 2**8+2 = 259 input ids and mask tokens count down from index 258.</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># => mask to "The dog [258]a ball [257]park."</span> | |
| <span class="hljs-meta">>>> </span>input_ids = torch.tensor([input_ids[:<span class="hljs-number">8</span>] + [<span class="hljs-number">258</span>] + input_ids[<span class="hljs-number">14</span>:<span class="hljs-number">21</span>] + [<span class="hljs-number">257</span>] + input_ids[<span class="hljs-number">28</span>:]]) | |
| <span class="hljs-meta">>>> </span>input_ids | |
| tensor([[ <span class="hljs-number">87</span>, <span class="hljs-number">107</span>, <span class="hljs-number">104</span>, <span class="hljs-number">35</span>, <span class="hljs-number">103</span>, <span class="hljs-number">114</span>, <span class="hljs-number">106</span>, <span class="hljs-number">35</span>, <span class="hljs-number">258</span>, <span class="hljs-number">35</span>, <span class="hljs-number">100</span>, <span class="hljs-number">35</span>, <span class="hljs-number">101</span>, <span class="hljs-number">100</span>, <span class="hljs-number">111</span>, <span class="hljs-number">111</span>, <span class="hljs-number">257</span>, <span class="hljs-number">35</span>, <span class="hljs-number">115</span>, <span class="hljs-number">100</span>, <span class="hljs-number">117</span>, <span class="hljs-number">110</span>, <span class="hljs-number">49</span>, <span class="hljs-number">1</span>]]) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># ByT5 produces only one char at a time so we need to produce many more output characters here -> set \`max_length=100\`.</span> | |
| <span class="hljs-meta">>>> </span>output_ids = model.generate(input_ids, max_length=<span class="hljs-number">100</span>)[<span class="hljs-number">0</span>].tolist() | |
| <span class="hljs-meta">>>> </span>output_ids | |
| [<span class="hljs-number">0</span>, <span class="hljs-number">258</span>, <span class="hljs-number">108</span>, <span class="hljs-number">118</span>, <span class="hljs-number">35</span>, <span class="hljs-number">119</span>, <span class="hljs-number">107</span>, <span class="hljs-number">104</span>, <span class="hljs-number">35</span>, <span class="hljs-number">114</span>, <span class="hljs-number">113</span>, <span class="hljs-number">104</span>, <span class="hljs-number">35</span>, <span class="hljs-number">122</span>, <span class="hljs-number">107</span>, <span class="hljs-number">114</span>, <span class="hljs-number">35</span>, <span class="hljs-number">103</span>, <span class="hljs-number">114</span>, <span class="hljs-number">104</span>, <span class="hljs-number">118</span>, <span class="hljs-number">257</span>, <span class="hljs-number">35</span>, <span class="hljs-number">108</span>, <span class="hljs-number">113</span>, <span class="hljs-number">35</span>, <span class="hljs-number">119</span>, <span class="hljs-number">107</span>, <span class="hljs-number">104</span>, <span class="hljs-number">35</span>, <span class="hljs-number">103</span>, <span class="hljs-number">108</span>, <span class="hljs-number">118</span>, <span class="hljs-number">102</span>, <span class="hljs-number">114</span>, <span class="hljs-number">256</span>, <span class="hljs-number">108</span>, <span class="hljs-number">113</span>, <span class="hljs-number">35</span>, <span class="hljs-number">119</span>, <span class="hljs-number">107</span>, <span class="hljs-number">104</span>, <span class="hljs-number">35</span>, <span class="hljs-number">115</span>, <span class="hljs-number">100</span>, <span class="hljs-number">117</span>, <span class="hljs-number">110</span>, <span class="hljs-number">49</span>, <span class="hljs-number">35</span>, <span class="hljs-number">87</span>, <span class="hljs-number">107</span>, <span class="hljs-number">104</span>, <span class="hljs-number">35</span>, <span class="hljs-number">103</span>, <span class="hljs-number">114</span>, <span class="hljs-number">106</span>, <span class="hljs-number">35</span>, <span class="hljs-number">108</span>, <span class="hljs-number">118</span>, <span class="hljs-number">35</span>, <span class="hljs-number">119</span>, <span class="hljs-number">107</span>, <span class="hljs-number">104</span>, <span class="hljs-number">35</span>, <span class="hljs-number">114</span>, <span class="hljs-number">113</span>, <span class="hljs-number">104</span>, <span class="hljs-number">35</span>, <span class="hljs-number">122</span>, <span class="hljs-number">107</span>, <span class="hljs-number">114</span>, <span class="hljs-number">35</span>, <span class="hljs-number">103</span>, <span class="hljs-number">114</span>, <span class="hljs-number">104</span>, <span class="hljs-number">118</span>, <span class="hljs-number">35</span>, <span class="hljs-number">100</span>, <span class="hljs-number">35</span>, <span class="hljs-number">101</span>, <span class="hljs-number">100</span>, <span class="hljs-number">111</span>, <span class="hljs-number">111</span>, <span class="hljs-number">35</span>, <span class="hljs-number">108</span>, <span class="hljs-number">113</span>, <span class="hljs-number">255</span>, <span class="hljs-number">35</span>, <span class="hljs-number">108</span>, <span class="hljs-number">113</span>, <span class="hljs-number">35</span>, <span class="hljs-number">119</span>, <span class="hljs-number">107</span>, <span class="hljs-number">104</span>, <span class="hljs-number">35</span>, <span class="hljs-number">115</span>, <span class="hljs-number">100</span>, <span class="hljs-number">117</span>, <span class="hljs-number">110</span>, <span class="hljs-number">49</span>] | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># ^- Note how 258 descends to 257, 256, 255</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Now we need to split on the sentinel tokens, let's write a short loop for this</span> | |
| <span class="hljs-meta">>>> </span>output_ids_list = [] | |
| <span class="hljs-meta">>>> </span>start_token = <span class="hljs-number">0</span> | |
| <span class="hljs-meta">>>> </span>sentinel_token = <span class="hljs-number">258</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">while</span> sentinel_token <span class="hljs-keyword">in</span> output_ids: | |
| <span class="hljs-meta">... </span> split_idx = output_ids.index(sentinel_token) | |
| <span class="hljs-meta">... </span> output_ids_list.append(output_ids[start_token:split_idx]) | |
| <span class="hljs-meta">... </span> start_token = split_idx | |
| <span class="hljs-meta">... </span> sentinel_token -= <span class="hljs-number">1</span> | |
| <span class="hljs-meta">>>> </span>output_ids_list.append(output_ids[start_token:]) | |
| <span class="hljs-meta">>>> </span>output_string = tokenizer.batch_decode(output_ids_list) | |
| <span class="hljs-meta">>>> </span>output_string | |
| [<span class="hljs-string">'<pad>'</span>, <span class="hljs-string">'is the one who does'</span>, <span class="hljs-string">' in the disco'</span>, <span class="hljs-string">'in the park. The dog is the one who does a ball in'</span>, <span class="hljs-string">' in the park.'</span>]`,wrap:!1}}),q=new Zs({props:{title:"ByT5Tokenizer",local:"transformers.ByT5Tokenizer",headingTag:"h2"}}),E=new rs({props:{name:"class transformers.ByT5Tokenizer",anchor:"transformers.ByT5Tokenizer",parameters:[{name:"eos_token",val:" = '</s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"pad_token",val:" = '<pad>'"},{name:"extra_ids",val:" = 125"},{name:"additional_special_tokens",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ByT5Tokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"</s>"</code>) — | |
| 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.ByT5Tokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"<unk>"</code>) — | |
| 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.ByT5Tokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"<pad>"</code>) — | |
| The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.ByT5Tokenizer.extra_ids",description:`<strong>extra_ids</strong> (<code>int</code>, <em>optional</em>, defaults to 125) — | |
| Add a number of extra ids added to the end of the vocabulary for use as sentinels. These tokens are | |
| accessible as “<extra<em>id{%d}>” where ”{%d}” is a number between 0 and extra_ids-1. Extra tokens are | |
| indexed from the end of the vocabulary up to beginning (“<extra_id_0>” is the last token in the vocabulary | |
| like in ByT5 preprocessing see | |
| <a href="https://github.com/google-research/text-to-text-transfer-transformer/blob/9fd7b14a769417be33bc6c850f9598764913c833/t5/data/preprocessors.py#L2117" rel="nofollow">here</a>).</extra_id_0></extra<em>`,name:"extra_ids"},{anchor:"transformers.ByT5Tokenizer.additional_special_tokens",description:`<strong>additional_special_tokens</strong> (<code>List[str]</code>, <em>optional</em>) — | |
| Additional special tokens used by the tokenizer.`,name:"additional_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/vr_33962/src/transformers/models/byt5/tokenization_byt5.py#L27"}}),H=new rs({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.ByT5Tokenizer.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.ByT5Tokenizer.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) — | |
| List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.ByT5Tokenizer.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_33962/src/transformers/models/byt5/tokenization_byt5.py#L171",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>List[int]</code></p> | |
| `}}),$=new rs({props:{name:"convert_tokens_to_string",anchor:"transformers.ByT5Tokenizer.convert_tokens_to_string",parameters:[{name:"tokens",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_33962/src/transformers/models/byt5/tokenization_byt5.py#L217"}}),L=new rs({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.ByT5Tokenizer.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.ByT5Tokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) — | |
| List of IDs.`,name:"token_ids_0"},{anchor:"transformers.ByT5Tokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_33962/src/transformers/models/byt5/tokenization_byt5.py#L149",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>List of zeros.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>List[int]</code></p> | |
| `}}),F=new rs({props:{name:"get_special_tokens_mask",anchor:"transformers.ByT5Tokenizer.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.ByT5Tokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) — | |
| List of IDs.`,name:"token_ids_0"},{anchor:"transformers.ByT5Tokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.ByT5Tokenizer.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>) — | |
| 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/vr_33962/src/transformers/models/byt5/tokenization_byt5.py#L110",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>List[int]</code></p> | |
| `}}),Y=new ge({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/byt5.md"}}),{c(){m=o("meta"),v=a(),M=o("p"),P=a(),u(B.$$.fragment),is=a(),f=o("div"),f.innerHTML=Ls,cs=a(),u(x.$$.fragment),ms=a(),G=o("p"),G.innerHTML=Fs,ds=a(),I=o("p"),I.textContent=Ss,us=a(),C=o("p"),C.innerHTML=Ys,hs=a(),Z=o("p"),Z.innerHTML=Ds,bs=a(),u(k.$$.fragment),gs=a(),z=o("p"),z.textContent=Ps,ys=a(),u(W.$$.fragment),js=a(),R=o("p"),R.textContent=Os,Ms=a(),u(N.$$.fragment),Ts=a(),V=o("p"),V.textContent=Ks,fs=a(),u(A.$$.fragment),ks=a(),Q=o("p"),Q.innerHTML=se,ws=a(),u(X.$$.fragment),Js=a(),u(q.$$.fragment),Us=a(),i=o("div"),u(E.$$.fragment),zs=a(),O=o("p"),O.textContent=ee,Ws=a(),K=o("p"),K.innerHTML=te,Rs=a(),T=o("div"),u(H.$$.fragment),Ns=a(),ss=o("p"),ss.textContent=ne,Vs=a(),es=o("ul"),es.innerHTML=ae,As=a(),w=o("div"),u($.$$.fragment),Qs=a(),ts=o("p"),ts.textContent=le,Xs=a(),J=o("div"),u(L.$$.fragment),qs=a(),ns=o("p"),ns.textContent=oe,Es=a(),U=o("div"),u(F.$$.fragment),Hs=a(),as=o("p"),as.innerHTML=re,_s=a(),S=o("p"),S.innerHTML=pe,vs=a(),u(Y.$$.fragment),Bs=a(),os=o("p"),this.h()},l(s){const e=he("svelte-u9bgzb",document.head);m=r(e,"META",{name:!0,content:!0}),e.forEach(t),v=l(s),M=r(s,"P",{}),D(M).forEach(t),P=l(s),h(B.$$.fragment,s),is=l(s),f=r(s,"DIV",{class:!0,"data-svelte-h":!0}),c(f)!=="svelte-1px1zvi"&&(f.innerHTML=Ls),cs=l(s),h(x.$$.fragment,s),ms=l(s),G=r(s,"P",{"data-svelte-h":!0}),c(G)!=="svelte-1vxwc5j"&&(G.innerHTML=Fs),ds=l(s),I=r(s,"P",{"data-svelte-h":!0}),c(I)!=="svelte-vfdo9a"&&(I.textContent=Ss),us=l(s),C=r(s,"P",{"data-svelte-h":!0}),c(C)!=="svelte-1jd8hlb"&&(C.innerHTML=Ys),hs=l(s),Z=r(s,"P",{"data-svelte-h":!0}),c(Z)!=="svelte-19tarla"&&(Z.innerHTML=Ds),bs=l(s),h(k.$$.fragment,s),gs=l(s),z=r(s,"P",{"data-svelte-h":!0}),c(z)!=="svelte-x9ykzc"&&(z.textContent=Ps),ys=l(s),h(W.$$.fragment,s),js=l(s),R=r(s,"P",{"data-svelte-h":!0}),c(R)!=="svelte-11rzxcx"&&(R.textContent=Os),Ms=l(s),h(N.$$.fragment,s),Ts=l(s),V=r(s,"P",{"data-svelte-h":!0}),c(V)!=="svelte-1q3gwa3"&&(V.textContent=Ks),fs=l(s),h(A.$$.fragment,s),ks=l(s),Q=r(s,"P",{"data-svelte-h":!0}),c(Q)!=="svelte-yy2lov"&&(Q.innerHTML=se),ws=l(s),h(X.$$.fragment,s),Js=l(s),h(q.$$.fragment,s),Us=l(s),i=r(s,"DIV",{class:!0});var d=D(i);h(E.$$.fragment,d),zs=l(d),O=r(d,"P",{"data-svelte-h":!0}),c(O)!=="svelte-ab2b05"&&(O.textContent=ee),Ws=l(d),K=r(d,"P",{"data-svelte-h":!0}),c(K)!=="svelte-ljycb7"&&(K.innerHTML=te),Rs=l(d),T=r(d,"DIV",{class:!0});var ls=D(T);h(H.$$.fragment,ls),Ns=l(ls),ss=r(ls,"P",{"data-svelte-h":!0}),c(ss)!=="svelte-1wjq39d"&&(ss.textContent=ne),Vs=l(ls),es=r(ls,"UL",{"data-svelte-h":!0}),c(es)!=="svelte-8gh3n2"&&(es.innerHTML=ae),ls.forEach(t),As=l(d),w=r(d,"DIV",{class:!0});var Gs=D(w);h($.$$.fragment,Gs),Qs=l(Gs),ts=r(Gs,"P",{"data-svelte-h":!0}),c(ts)!=="svelte-b3k2yi"&&(ts.textContent=le),Gs.forEach(t),Xs=l(d),J=r(d,"DIV",{class:!0});var Is=D(J);h(L.$$.fragment,Is),qs=l(Is),ns=r(Is,"P",{"data-svelte-h":!0}),c(ns)!=="svelte-on9fcl"&&(ns.textContent=oe),Is.forEach(t),Es=l(d),U=r(d,"DIV",{class:!0});var Cs=D(U);h(F.$$.fragment,Cs),Hs=l(Cs),as=r(Cs,"P",{"data-svelte-h":!0}),c(as)!=="svelte-1f4f5kp"&&(as.innerHTML=re),Cs.forEach(t),d.forEach(t),_s=l(s),S=r(s,"P",{"data-svelte-h":!0}),c(S)!=="svelte-n0611x"&&(S.innerHTML=pe),vs=l(s),h(Y.$$.fragment,s),Bs=l(s),os=r(s,"P",{}),D(os).forEach(t),this.h()},h(){_(m,"name","hf:doc:metadata"),_(m,"content",Me),_(f,"class","flex flex-wrap space-x-1"),_(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),_(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(s,e){p(document.head,m),n(s,v,e),n(s,M,e),n(s,P,e),b(B,s,e),n(s,is,e),n(s,f,e),n(s,cs,e),b(x,s,e),n(s,ms,e),n(s,G,e),n(s,ds,e),n(s,I,e),n(s,us,e),n(s,C,e),n(s,hs,e),n(s,Z,e),n(s,bs,e),b(k,s,e),n(s,gs,e),n(s,z,e),n(s,ys,e),b(W,s,e),n(s,js,e),n(s,R,e),n(s,Ms,e),b(N,s,e),n(s,Ts,e),n(s,V,e),n(s,fs,e),b(A,s,e),n(s,ks,e),n(s,Q,e),n(s,ws,e),b(X,s,e),n(s,Js,e),b(q,s,e),n(s,Us,e),n(s,i,e),b(E,i,null),p(i,zs),p(i,O),p(i,Ws),p(i,K),p(i,Rs),p(i,T),b(H,T,null),p(T,Ns),p(T,ss),p(T,Vs),p(T,es),p(i,As),p(i,w),b($,w,null),p(w,Qs),p(w,ts),p(i,Xs),p(i,J),b(L,J,null),p(J,qs),p(J,ns),p(i,Es),p(i,U),b(F,U,null),p(U,Hs),p(U,as),n(s,_s,e),n(s,S,e),n(s,vs,e),b(Y,s,e),n(s,Bs,e),n(s,os,e),xs=!0},p(s,[e]){const d={};e&2&&(d.$$scope={dirty:e,ctx:s}),k.$set(d)},i(s){xs||(g(B.$$.fragment,s),g(x.$$.fragment,s),g(k.$$.fragment,s),g(W.$$.fragment,s),g(N.$$.fragment,s),g(A.$$.fragment,s),g(X.$$.fragment,s),g(q.$$.fragment,s),g(E.$$.fragment,s),g(H.$$.fragment,s),g($.$$.fragment,s),g(L.$$.fragment,s),g(F.$$.fragment,s),g(Y.$$.fragment,s),xs=!0)},o(s){y(B.$$.fragment,s),y(x.$$.fragment,s),y(k.$$.fragment,s),y(W.$$.fragment,s),y(N.$$.fragment,s),y(A.$$.fragment,s),y(X.$$.fragment,s),y(q.$$.fragment,s),y(E.$$.fragment,s),y(H.$$.fragment,s),y($.$$.fragment,s),y(L.$$.fragment,s),y(F.$$.fragment,s),y(Y.$$.fragment,s),xs=!1},d(s){s&&(t(v),t(M),t(P),t(is),t(f),t(cs),t(ms),t(G),t(ds),t(I),t(us),t(C),t(hs),t(Z),t(bs),t(gs),t(z),t(ys),t(js),t(R),t(Ms),t(Ts),t(V),t(fs),t(ks),t(Q),t(ws),t(Js),t(Us),t(i),t(_s),t(S),t(vs),t(Bs),t(os)),t(m),j(B,s),j(x,s),j(k,s),j(W,s),j(N,s),j(A,s),j(X,s),j(q,s),j(E),j(H),j($),j(L),j(F),j(Y,s)}}}const Me='{"title":"ByT5","local":"byt5","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage example","local":"usage-example","sections":[],"depth":2},{"title":"ByT5Tokenizer","local":"transformers.ByT5Tokenizer","sections":[],"depth":2}],"depth":1}';function Te(ps){return ce(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Be extends de{constructor(m){super(),ue(this,m,Te,je,ie,{})}}export{Be as component}; | |
Xet Storage Details
- Size:
- 39.2 kB
- Xet hash:
- 2b941936497e2acc1684978d201ba5746d927bf4ff744bfde12cbbee292d1187
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.